commit c19f898a576dbcf4eafb2fdb10c0b8eb0eee9f53 Author: Daniel Eder Date: Fri Aug 1 09:16:36 2025 +0200 initial commit diff --git a/.obsidian/app.json b/.obsidian/app.json new file mode 100644 index 0000000..2e2123b --- /dev/null +++ b/.obsidian/app.json @@ -0,0 +1,13 @@ +{ + "attachmentFolderPath": "_Attachments", + "defaultViewMode": "preview", + "readableLineLength": false, + "alwaysUpdateLinks": true, + "pdfExportSettings": { + "includeName": true, + "pageSize": "Letter", + "landscape": false, + "margin": "0", + "downscalePercent": 100 + } +} \ No newline at end of file diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json new file mode 100644 index 0000000..469c591 --- /dev/null +++ b/.obsidian/appearance.json @@ -0,0 +1,6 @@ +{ + "cssTheme": "ITS Theme", + "enabledCssSnippets": [ + "dashboard" + ] +} \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json new file mode 100644 index 0000000..19dff66 --- /dev/null +++ b/.obsidian/community-plugins.json @@ -0,0 +1,11 @@ +[ + "obsidian-leaflet-plugin", + "better-export-pdf", + "omnisearch", + "obsidian-reading-time", + "obsidian-smart-typography", + "novel-word-count", + "obisidian-note-linker", + "longform", + "obsidian-git" +] \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json new file mode 100644 index 0000000..b977c25 --- /dev/null +++ b/.obsidian/core-plugins.json @@ -0,0 +1,31 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "properties": false, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": true, + "webviewer": false +} \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json new file mode 100644 index 0000000..549360f --- /dev/null +++ b/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": false, + "colorGroups": [], + "collapse-display": false, + "showArrow": false, + "textFadeMultiplier": -3, + "nodeSizeMultiplier": 0.814583333333333, + "lineSizeMultiplier": 2.03958333333333, + "collapse-forces": false, + "centerStrength": 0.453125, + "repelStrength": 13.9583333333333, + "linkStrength": 1, + "linkDistance": 187, + "scale": 0.40857576540631124, + "close": true +} \ No newline at end of file diff --git a/.obsidian/plugins/better-export-pdf/data.json b/.obsidian/plugins/better-export-pdf/data.json new file mode 100644 index 0000000..bc16786 --- /dev/null +++ b/.obsidian/plugins/better-export-pdf/data.json @@ -0,0 +1,30 @@ +{ + "showTitle": true, + "maxLevel": "6", + "displayHeader": true, + "displayFooter": true, + "headerTemplate": "
", + "footerTemplate": "
/
", + "printBackground": false, + "generateTaggedPDF": false, + "displayMetadata": false, + "debug": false, + "isTimestamp": false, + "enabledCss": false, + "concurrency": "5", + "prevConfig": { + "pageSize": "A4", + "marginType": "1", + "showTitle": true, + "open": false, + "scale": 100, + "landscape": false, + "marginTop": "10", + "marginBottom": "10", + "marginLeft": "10", + "marginRight": "10", + "displayHeader": true, + "displayFooter": true, + "cssSnippet": "0" + } +} \ No newline at end of file diff --git a/.obsidian/plugins/better-export-pdf/main.js b/.obsidian/plugins/better-export-pdf/main.js new file mode 100644 index 0000000..5ac26c0 --- /dev/null +++ b/.obsidian/plugins/better-export-pdf/main.js @@ -0,0 +1,25940 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __typeError = (msg) => { + throw TypeError(msg); +}; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); +var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); +var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); +var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); +var __privateWrapper = (obj, member, setter, getter) => ({ + set _(value) { + __privateSet(obj, member, value, setter); + }, + get _() { + return __privateGet(obj, member, getter); + } +}); + +// node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js +var require_cjs = __commonJS({ + "node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"(exports, module2) { + "use strict"; + var isMergeableObject = function isMergeableObject2(value) { + return isNonNullObject(value) && !isSpecial(value); + }; + function isNonNullObject(value) { + return !!value && typeof value === "object"; + } + function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value); + } + var canUseSymbol = typeof Symbol === "function" && Symbol.for; + var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103; + function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE; + } + function emptyTarget(val) { + return Array.isArray(val) ? [] : {}; + } + function cloneUnlessOtherwiseSpecified(value, options) { + return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; + } + function defaultArrayMerge(target, source2, options) { + return target.concat(source2).map(function(element2) { + return cloneUnlessOtherwiseSpecified(element2, options); + }); + } + function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge; + } + var customMerge = options.customMerge(key); + return typeof customMerge === "function" ? customMerge : deepmerge; + } + function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return Object.propertyIsEnumerable.call(target, symbol); + }) : []; + } + function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); + } + function propertyIsOnObject(object, property) { + try { + return property in object; + } catch (_) { + return false; + } + } + function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key)); + } + function mergeObject(target, source2, options) { + var destination = {}; + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + } + getKeys(source2).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return; + } + if (propertyIsOnObject(target, key) && options.isMergeableObject(source2[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source2[key], options); + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source2[key], options); + } + }); + return destination; + } + function deepmerge(target, source2, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; + var sourceIsArray = Array.isArray(source2); + var targetIsArray = Array.isArray(target); + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source2, options); + } else if (sourceIsArray) { + return options.arrayMerge(target, source2, options); + } else { + return mergeObject(target, source2, options); + } + } + deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error("first argument should be an array"); + } + return array.reduce(function(prev, next2) { + return deepmerge(prev, next2, options); + }, {}); + }; + var deepmerge_1 = deepmerge; + module2.exports = deepmerge_1; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js +var require_common = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js"(exports) { + "use strict"; + var TYPED_OK = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Int32Array !== "undefined"; + function _has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); + } + exports.assign = function(obj) { + var sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + var source2 = sources.shift(); + if (!source2) { + continue; + } + if (typeof source2 !== "object") { + throw new TypeError(source2 + "must be non-object"); + } + for (var p in source2) { + if (_has(source2, p)) { + obj[p] = source2[p]; + } + } + } + return obj; + }; + exports.shrinkBuf = function(buf, size) { + if (buf.length === size) { + return buf; + } + if (buf.subarray) { + return buf.subarray(0, size); + } + buf.length = size; + return buf; + }; + var fnTyped = { + arraySet: function(dest, src, src_offs, len, dest_offs) { + if (src.subarray && dest.subarray) { + dest.set(src.subarray(src_offs, src_offs + len), dest_offs); + return; + } + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function(chunks) { + var i, l, len, pos, chunk, result; + len = 0; + for (i = 0, l = chunks.length; i < l; i++) { + len += chunks[i].length; + } + result = new Uint8Array(len); + pos = 0; + for (i = 0, l = chunks.length; i < l; i++) { + chunk = chunks[i]; + result.set(chunk, pos); + pos += chunk.length; + } + return result; + } + }; + var fnUntyped = { + arraySet: function(dest, src, src_offs, len, dest_offs) { + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function(chunks) { + return [].concat.apply([], chunks); + } + }; + exports.setTyped = function(on2) { + if (on2) { + exports.Buf8 = Uint8Array; + exports.Buf16 = Uint16Array; + exports.Buf32 = Int32Array; + exports.assign(exports, fnTyped); + } else { + exports.Buf8 = Array; + exports.Buf16 = Array; + exports.Buf32 = Array; + exports.assign(exports, fnUntyped); + } + }; + exports.setTyped(TYPED_OK); + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js +var require_trees = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js"(exports) { + "use strict"; + var utils = require_common(); + var Z_FIXED = 4; + var Z_BINARY = 0; + var Z_TEXT = 1; + var Z_UNKNOWN = 2; + function zero(buf) { + var len = buf.length; + while (--len >= 0) { + buf[len] = 0; + } + } + var STORED_BLOCK = 0; + var STATIC_TREES = 1; + var DYN_TREES = 2; + var MIN_MATCH = 3; + var MAX_MATCH = 258; + var LENGTH_CODES = 29; + var LITERALS = 256; + var L_CODES = LITERALS + 1 + LENGTH_CODES; + var D_CODES = 30; + var BL_CODES = 19; + var HEAP_SIZE = 2 * L_CODES + 1; + var MAX_BITS = 15; + var Buf_size = 16; + var MAX_BL_BITS = 7; + var END_BLOCK = 256; + var REP_3_6 = 16; + var REPZ_3_10 = 17; + var REPZ_11_138 = 18; + var extra_lbits = ( + /* extra bits for each length code */ + [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] + ); + var extra_dbits = ( + /* extra bits for each distance code */ + [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] + ); + var extra_blbits = ( + /* extra bits for each bit length code */ + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7] + ); + var bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; + var DIST_CODE_LEN = 512; + var static_ltree = new Array((L_CODES + 2) * 2); + zero(static_ltree); + var static_dtree = new Array(D_CODES * 2); + zero(static_dtree); + var _dist_code = new Array(DIST_CODE_LEN); + zero(_dist_code); + var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); + zero(_length_code); + var base_length = new Array(LENGTH_CODES); + zero(base_length); + var base_dist = new Array(D_CODES); + zero(base_dist); + function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { + this.static_tree = static_tree; + this.extra_bits = extra_bits; + this.extra_base = extra_base; + this.elems = elems; + this.max_length = max_length; + this.has_stree = static_tree && static_tree.length; + } + var static_l_desc; + var static_d_desc; + var static_bl_desc; + function TreeDesc(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; + this.max_code = 0; + this.stat_desc = stat_desc; + } + function d_code(dist) { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; + } + function put_short(s, w) { + s.pending_buf[s.pending++] = w & 255; + s.pending_buf[s.pending++] = w >>> 8 & 255; + } + function send_bits(s, value, length) { + if (s.bi_valid > Buf_size - length) { + s.bi_buf |= value << s.bi_valid & 65535; + put_short(s, s.bi_buf); + s.bi_buf = value >> Buf_size - s.bi_valid; + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= value << s.bi_valid & 65535; + s.bi_valid += length; + } + } + function send_code(s, c, tree) { + send_bits( + s, + tree[c * 2], + tree[c * 2 + 1] + /*.Len*/ + ); + } + function bi_reverse(code, len) { + var res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; + } + function bi_flush(s) { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 255; + s.bi_buf >>= 8; + s.bi_valid -= 8; + } + } + function gen_bitlen(s, desc) { + var tree = desc.dyn_tree; + var max_code = desc.max_code; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var extra = desc.stat_desc.extra_bits; + var base = desc.stat_desc.extra_base; + var max_length = desc.stat_desc.max_length; + var h; + var n, m; + var bits; + var xbits; + var f; + var overflow = 0; + for (bits = 0; bits <= MAX_BITS; bits++) { + s.bl_count[bits] = 0; + } + tree[s.heap[s.heap_max] * 2 + 1] = 0; + for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { + n = s.heap[h]; + bits = tree[tree[n * 2 + 1] * 2 + 1] + 1; + if (bits > max_length) { + bits = max_length; + overflow++; + } + tree[n * 2 + 1] = bits; + if (n > max_code) { + continue; + } + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n - base]; + } + f = tree[n * 2]; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n * 2 + 1] + xbits); + } + } + if (overflow === 0) { + return; + } + do { + bits = max_length - 1; + while (s.bl_count[bits] === 0) { + bits--; + } + s.bl_count[bits]--; + s.bl_count[bits + 1] += 2; + s.bl_count[max_length]--; + overflow -= 2; + } while (overflow > 0); + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m = s.heap[--h]; + if (m > max_code) { + continue; + } + if (tree[m * 2 + 1] !== bits) { + s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2]; + tree[m * 2 + 1] = bits; + } + n--; + } + } + } + function gen_codes(tree, max_code, bl_count) { + var next_code = new Array(MAX_BITS + 1); + var code = 0; + var bits; + var n; + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = code + bl_count[bits - 1] << 1; + } + for (n = 0; n <= max_code; n++) { + var len = tree[n * 2 + 1]; + if (len === 0) { + continue; + } + tree[n * 2] = bi_reverse(next_code[len]++, len); + } + } + function tr_static_init() { + var n; + var bits; + var length; + var code; + var dist; + var bl_count = new Array(MAX_BITS + 1); + length = 0; + for (code = 0; code < LENGTH_CODES - 1; code++) { + base_length[code] = length; + for (n = 0; n < 1 << extra_lbits[code]; n++) { + _length_code[length++] = code; + } + } + _length_code[length - 1] = code; + dist = 0; + for (code = 0; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < 1 << extra_dbits[code]; n++) { + _dist_code[dist++] = code; + } + } + dist >>= 7; + for (; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < 1 << extra_dbits[code] - 7; n++) { + _dist_code[256 + dist++] = code; + } + } + for (bits = 0; bits <= MAX_BITS; bits++) { + bl_count[bits] = 0; + } + n = 0; + while (n <= 143) { + static_ltree[n * 2 + 1] = 8; + n++; + bl_count[8]++; + } + while (n <= 255) { + static_ltree[n * 2 + 1] = 9; + n++; + bl_count[9]++; + } + while (n <= 279) { + static_ltree[n * 2 + 1] = 7; + n++; + bl_count[7]++; + } + while (n <= 287) { + static_ltree[n * 2 + 1] = 8; + n++; + bl_count[8]++; + } + gen_codes(static_ltree, L_CODES + 1, bl_count); + for (n = 0; n < D_CODES; n++) { + static_dtree[n * 2 + 1] = 5; + static_dtree[n * 2] = bi_reverse(n, 5); + } + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); + static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); + } + function init_block(s) { + var n; + for (n = 0; n < L_CODES; n++) { + s.dyn_ltree[n * 2] = 0; + } + for (n = 0; n < D_CODES; n++) { + s.dyn_dtree[n * 2] = 0; + } + for (n = 0; n < BL_CODES; n++) { + s.bl_tree[n * 2] = 0; + } + s.dyn_ltree[END_BLOCK * 2] = 1; + s.opt_len = s.static_len = 0; + s.last_lit = s.matches = 0; + } + function bi_windup(s) { + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + s.pending_buf[s.pending++] = s.bi_buf; + } + s.bi_buf = 0; + s.bi_valid = 0; + } + function copy_block(s, buf, len, header) { + bi_windup(s); + if (header) { + put_short(s, len); + put_short(s, ~len); + } + utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); + s.pending += len; + } + function smaller(tree, n, m, depth) { + var _n2 = n * 2; + var _m2 = m * 2; + return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m]; + } + function pqdownheap(s, tree, k) { + var v = s.heap[k]; + var j = k << 1; + while (j <= s.heap_len) { + if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { + j++; + } + if (smaller(tree, v, s.heap[j], s.depth)) { + break; + } + s.heap[k] = s.heap[j]; + k = j; + j <<= 1; + } + s.heap[k] = v; + } + function compress_block(s, ltree, dtree) { + var dist; + var lc; + var lx = 0; + var code; + var extra; + if (s.last_lit !== 0) { + do { + dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1]; + lc = s.pending_buf[s.l_buf + lx]; + lx++; + if (dist === 0) { + send_code(s, lc, ltree); + } else { + code = _length_code[lc]; + send_code(s, code + LITERALS + 1, ltree); + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); + } + dist--; + code = d_code(dist); + send_code(s, code, dtree); + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); + } + } + } while (lx < s.last_lit); + } + send_code(s, END_BLOCK, ltree); + } + function build_tree(s, desc) { + var tree = desc.dyn_tree; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var elems = desc.stat_desc.elems; + var n, m; + var max_code = -1; + var node; + s.heap_len = 0; + s.heap_max = HEAP_SIZE; + for (n = 0; n < elems; n++) { + if (tree[n * 2] !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + } else { + tree[n * 2 + 1] = 0; + } + } + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0; + tree[node * 2] = 1; + s.depth[node] = 0; + s.opt_len--; + if (has_stree) { + s.static_len -= stree[node * 2 + 1]; + } + } + desc.max_code = max_code; + for (n = s.heap_len >> 1; n >= 1; n--) { + pqdownheap(s, tree, n); + } + node = elems; + do { + n = s.heap[ + 1 + /*SMALLEST*/ + ]; + s.heap[ + 1 + /*SMALLEST*/ + ] = s.heap[s.heap_len--]; + pqdownheap( + s, + tree, + 1 + /*SMALLEST*/ + ); + m = s.heap[ + 1 + /*SMALLEST*/ + ]; + s.heap[--s.heap_max] = n; + s.heap[--s.heap_max] = m; + tree[node * 2] = tree[n * 2] + tree[m * 2]; + s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; + tree[n * 2 + 1] = tree[m * 2 + 1] = node; + s.heap[ + 1 + /*SMALLEST*/ + ] = node++; + pqdownheap( + s, + tree, + 1 + /*SMALLEST*/ + ); + } while (s.heap_len >= 2); + s.heap[--s.heap_max] = s.heap[ + 1 + /*SMALLEST*/ + ]; + gen_bitlen(s, desc); + gen_codes(tree, max_code, s.bl_count); + } + function scan_tree(s, tree, max_code) { + var n; + var prevlen = -1; + var curlen; + var nextlen = tree[0 * 2 + 1]; + var count = 0; + var max_count = 7; + var min_count = 4; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + tree[(max_code + 1) * 2 + 1] = 65535; + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]; + if (++count < max_count && curlen === nextlen) { + continue; + } else if (count < min_count) { + s.bl_tree[curlen * 2] += count; + } else if (curlen !== 0) { + if (curlen !== prevlen) { + s.bl_tree[curlen * 2]++; + } + s.bl_tree[REP_3_6 * 2]++; + } else if (count <= 10) { + s.bl_tree[REPZ_3_10 * 2]++; + } else { + s.bl_tree[REPZ_11_138 * 2]++; + } + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + } else { + max_count = 7; + min_count = 4; + } + } + } + function send_tree(s, tree, max_code) { + var n; + var prevlen = -1; + var curlen; + var nextlen = tree[0 * 2 + 1]; + var count = 0; + var max_count = 7; + var min_count = 4; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]; + if (++count < max_count && curlen === nextlen) { + continue; + } else if (count < min_count) { + do { + send_code(s, curlen, s.bl_tree); + } while (--count !== 0); + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count - 3, 2); + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count - 3, 3); + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count - 11, 7); + } + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + } else { + max_count = 7; + min_count = 4; + } + } + } + function build_bl_tree(s) { + var max_blindex; + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + build_tree(s, s.bl_desc); + for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0) { + break; + } + } + s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; + return max_blindex; + } + function send_all_trees(s, lcodes, dcodes, blcodes) { + var rank; + send_bits(s, lcodes - 257, 5); + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); + for (rank = 0; rank < blcodes; rank++) { + send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], 3); + } + send_tree(s, s.dyn_ltree, lcodes - 1); + send_tree(s, s.dyn_dtree, dcodes - 1); + } + function detect_data_type(s) { + var black_mask = 4093624447; + var n; + for (n = 0; n <= 31; n++, black_mask >>>= 1) { + if (black_mask & 1 && s.dyn_ltree[n * 2] !== 0) { + return Z_BINARY; + } + } + if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 || s.dyn_ltree[13 * 2] !== 0) { + return Z_TEXT; + } + for (n = 32; n < LITERALS; n++) { + if (s.dyn_ltree[n * 2] !== 0) { + return Z_TEXT; + } + } + return Z_BINARY; + } + var static_init_done = false; + function _tr_init(s) { + if (!static_init_done) { + tr_static_init(); + static_init_done = true; + } + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + s.bi_buf = 0; + s.bi_valid = 0; + init_block(s); + } + function _tr_stored_block(s, buf, stored_len, last2) { + send_bits(s, (STORED_BLOCK << 1) + (last2 ? 1 : 0), 3); + copy_block(s, buf, stored_len, true); + } + function _tr_align(s) { + send_bits(s, STATIC_TREES << 1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); + } + function _tr_flush_block(s, buf, stored_len, last2) { + var opt_lenb, static_lenb; + var max_blindex = 0; + if (s.level > 0) { + if (s.strm.data_type === Z_UNKNOWN) { + s.strm.data_type = detect_data_type(s); + } + build_tree(s, s.l_desc); + build_tree(s, s.d_desc); + max_blindex = build_bl_tree(s); + opt_lenb = s.opt_len + 3 + 7 >>> 3; + static_lenb = s.static_len + 3 + 7 >>> 3; + if (static_lenb <= opt_lenb) { + opt_lenb = static_lenb; + } + } else { + opt_lenb = static_lenb = stored_len + 5; + } + if (stored_len + 4 <= opt_lenb && buf !== -1) { + _tr_stored_block(s, buf, stored_len, last2); + } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { + send_bits(s, (STATIC_TREES << 1) + (last2 ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + } else { + send_bits(s, (DYN_TREES << 1) + (last2 ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); + } + init_block(s); + if (last2) { + bi_windup(s); + } + } + function _tr_tally(s, dist, lc) { + s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 255; + s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 255; + s.pending_buf[s.l_buf + s.last_lit] = lc & 255; + s.last_lit++; + if (dist === 0) { + s.dyn_ltree[lc * 2]++; + } else { + s.matches++; + dist--; + s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++; + s.dyn_dtree[d_code(dist) * 2]++; + } + return s.last_lit === s.lit_bufsize - 1; + } + exports._tr_init = _tr_init; + exports._tr_stored_block = _tr_stored_block; + exports._tr_flush_block = _tr_flush_block; + exports._tr_tally = _tr_tally; + exports._tr_align = _tr_align; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js +var require_adler32 = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js"(exports, module2) { + "use strict"; + function adler32(adler, buf, len, pos) { + var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0; + while (len !== 0) { + n = len > 2e3 ? 2e3 : len; + len -= n; + do { + s1 = s1 + buf[pos++] | 0; + s2 = s2 + s1 | 0; + } while (--n); + s1 %= 65521; + s2 %= 65521; + } + return s1 | s2 << 16 | 0; + } + module2.exports = adler32; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js +var require_crc32 = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js"(exports, module2) { + "use strict"; + function makeTable() { + var c, table = []; + for (var n = 0; n < 256; n++) { + c = n; + for (var k = 0; k < 8; k++) { + c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1; + } + table[n] = c; + } + return table; + } + var crcTable = makeTable(); + function crc32(crc, buf, len, pos) { + var t = crcTable, end = pos + len; + crc ^= -1; + for (var i = pos; i < end; i++) { + crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255]; + } + return crc ^ -1; + } + module2.exports = crc32; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js +var require_messages = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js"(exports, module2) { + "use strict"; + module2.exports = { + 2: "need dictionary", + /* Z_NEED_DICT 2 */ + 1: "stream end", + /* Z_STREAM_END 1 */ + 0: "", + /* Z_OK 0 */ + "-1": "file error", + /* Z_ERRNO (-1) */ + "-2": "stream error", + /* Z_STREAM_ERROR (-2) */ + "-3": "data error", + /* Z_DATA_ERROR (-3) */ + "-4": "insufficient memory", + /* Z_MEM_ERROR (-4) */ + "-5": "buffer error", + /* Z_BUF_ERROR (-5) */ + "-6": "incompatible version" + /* Z_VERSION_ERROR (-6) */ + }; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js +var require_deflate = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js"(exports) { + "use strict"; + var utils = require_common(); + var trees = require_trees(); + var adler32 = require_adler32(); + var crc32 = require_crc32(); + var msg = require_messages(); + var Z_NO_FLUSH = 0; + var Z_PARTIAL_FLUSH = 1; + var Z_FULL_FLUSH = 3; + var Z_FINISH = 4; + var Z_BLOCK = 5; + var Z_OK = 0; + var Z_STREAM_END = 1; + var Z_STREAM_ERROR = -2; + var Z_DATA_ERROR = -3; + var Z_BUF_ERROR = -5; + var Z_DEFAULT_COMPRESSION = -1; + var Z_FILTERED = 1; + var Z_HUFFMAN_ONLY = 2; + var Z_RLE = 3; + var Z_FIXED = 4; + var Z_DEFAULT_STRATEGY = 0; + var Z_UNKNOWN = 2; + var Z_DEFLATED = 8; + var MAX_MEM_LEVEL = 9; + var MAX_WBITS = 15; + var DEF_MEM_LEVEL = 8; + var LENGTH_CODES = 29; + var LITERALS = 256; + var L_CODES = LITERALS + 1 + LENGTH_CODES; + var D_CODES = 30; + var BL_CODES = 19; + var HEAP_SIZE = 2 * L_CODES + 1; + var MAX_BITS = 15; + var MIN_MATCH = 3; + var MAX_MATCH = 258; + var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1; + var PRESET_DICT = 32; + var INIT_STATE = 42; + var EXTRA_STATE = 69; + var NAME_STATE = 73; + var COMMENT_STATE = 91; + var HCRC_STATE = 103; + var BUSY_STATE = 113; + var FINISH_STATE = 666; + var BS_NEED_MORE = 1; + var BS_BLOCK_DONE = 2; + var BS_FINISH_STARTED = 3; + var BS_FINISH_DONE = 4; + var OS_CODE = 3; + function err(strm, errorCode) { + strm.msg = msg[errorCode]; + return errorCode; + } + function rank(f) { + return (f << 1) - (f > 4 ? 9 : 0); + } + function zero(buf) { + var len = buf.length; + while (--len >= 0) { + buf[len] = 0; + } + } + function flush_pending(strm) { + var s = strm.state; + var len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; + } + if (len === 0) { + return; + } + utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; + } + } + function flush_block_only(s, last2) { + trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last2); + s.block_start = s.strstart; + flush_pending(s.strm); + } + function put_byte(s, b) { + s.pending_buf[s.pending++] = b; + } + function putShortMSB(s, b) { + s.pending_buf[s.pending++] = b >>> 8 & 255; + s.pending_buf[s.pending++] = b & 255; + } + function read_buf(strm, buf, start, size) { + var len = strm.avail_in; + if (len > size) { + len = size; + } + if (len === 0) { + return 0; + } + strm.avail_in -= len; + utils.arraySet(buf, strm.input, strm.next_in, len, start); + if (strm.state.wrap === 1) { + strm.adler = adler32(strm.adler, buf, len, start); + } else if (strm.state.wrap === 2) { + strm.adler = crc32(strm.adler, buf, len, start); + } + strm.next_in += len; + strm.total_in += len; + return len; + } + function longest_match(s, cur_match) { + var chain_length = s.max_chain_length; + var scan = s.strstart; + var match; + var len; + var best_len = s.prev_length; + var nice_match = s.nice_match; + var limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0; + var _win = s.window; + var wmask = s.w_mask; + var prev = s.prev; + var strend = s.strstart + MAX_MATCH; + var scan_end1 = _win[scan + best_len - 1]; + var scan_end = _win[scan + best_len]; + if (s.prev_length >= s.good_match) { + chain_length >>= 2; + } + if (nice_match > s.lookahead) { + nice_match = s.lookahead; + } + do { + match = cur_match; + if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { + continue; + } + scan += 2; + match++; + do { + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + if (best_len <= s.lookahead) { + return best_len; + } + return s.lookahead; + } + function fill_window(s) { + var _w_size = s.w_size; + var p, n, m, more, str; + do { + more = s.window_size - s.lookahead - s.strstart; + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + utils.arraySet(s.window, s.window, _w_size, _w_size, 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + s.block_start -= _w_size; + n = s.hash_size; + p = n; + do { + m = s.head[--p]; + s.head[p] = m >= _w_size ? m - _w_size : 0; + } while (--n); + n = _w_size; + p = n; + do { + m = s.prev[--p]; + s.prev[p] = m >= _w_size ? m - _w_size : 0; + } while (--n); + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask; + while (s.insert) { + s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); + } + function deflate_stored(s, flush) { + var max_block_size = 65535; + if (max_block_size > s.pending_buf_size - 5) { + max_block_size = s.pending_buf_size - 5; + } + for (; ; ) { + if (s.lookahead <= 1) { + fill_window(s); + if (s.lookahead === 0 && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } + } + s.strstart += s.lookahead; + s.lookahead = 0; + var max_start = s.block_start + max_block_size; + if (s.strstart === 0 || s.strstart >= max_start) { + s.lookahead = s.strstart - max_start; + s.strstart = max_start; + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } + s.insert = 0; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.strstart > s.block_start) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_NEED_MORE; + } + function deflate_fast(s, flush) { + var hash_head; + var bflush; + for (; ; ) { + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } + } + hash_head = 0; + if (s.lookahead >= MIN_MATCH) { + s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + } + if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { + s.match_length = longest_match(s, hash_head); + } + if (s.match_length >= MIN_MATCH) { + bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + s.lookahead -= s.match_length; + if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) { + s.match_length--; + do { + s.strstart++; + s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + } while (--s.match_length !== 0); + s.strstart++; + } else { + s.strstart += s.match_length; + s.match_length = 0; + s.ins_h = s.window[s.strstart]; + s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask; + } + } else { + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + } + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.last_lit) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; + } + function deflate_slow(s, flush) { + var hash_head; + var bflush; + var max_insert; + for (; ; ) { + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } + } + hash_head = 0; + if (s.lookahead >= MIN_MATCH) { + s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + } + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH - 1; + if (hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { + s.match_length = longest_match(s, hash_head); + if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096)) { + s.match_length = MIN_MATCH - 1; + } + } + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); + s.lookahead -= s.prev_length - 1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH - 1; + s.strstart++; + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } else if (s.match_available) { + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + if (bflush) { + flush_block_only(s, false); + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + s.match_available = 1; + s.strstart++; + s.lookahead--; + } + } + if (s.match_available) { + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + s.match_available = 0; + } + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.last_lit) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; + } + function deflate_rle(s, flush) { + var bflush; + var prev; + var scan, strend; + var _win = s.window; + for (; ; ) { + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } + } + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + } + if (s.match_length >= MIN_MATCH) { + bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + } + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } + s.insert = 0; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.last_lit) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; + } + function deflate_huff(s, flush) { + var bflush; + for (; ; ) { + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + break; + } + } + s.match_length = 0; + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } + s.insert = 0; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.last_lit) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; + } + function Config(good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; + } + var configuration_table; + configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), + /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), + /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), + /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), + /* 3 */ + new Config(4, 4, 16, 16, deflate_slow), + /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), + /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), + /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), + /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), + /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) + /* 9 max compression */ + ]; + function lm_init(s) { + s.window_size = 2 * s.w_size; + zero(s.head); + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; + } + function DeflateState() { + this.strm = null; + this.status = 0; + this.pending_buf = null; + this.pending_buf_size = 0; + this.pending_out = 0; + this.pending = 0; + this.wrap = 0; + this.gzhead = null; + this.gzindex = 0; + this.method = Z_DEFLATED; + this.last_flush = -1; + this.w_size = 0; + this.w_bits = 0; + this.w_mask = 0; + this.window = null; + this.window_size = 0; + this.prev = null; + this.head = null; + this.ins_h = 0; + this.hash_size = 0; + this.hash_bits = 0; + this.hash_mask = 0; + this.hash_shift = 0; + this.block_start = 0; + this.match_length = 0; + this.prev_match = 0; + this.match_available = 0; + this.strstart = 0; + this.match_start = 0; + this.lookahead = 0; + this.prev_length = 0; + this.max_chain_length = 0; + this.max_lazy_match = 0; + this.level = 0; + this.strategy = 0; + this.good_match = 0; + this.nice_match = 0; + this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); + this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); + this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + this.l_desc = null; + this.d_desc = null; + this.bl_desc = null; + this.bl_count = new utils.Buf16(MAX_BITS + 1); + this.heap = new utils.Buf16(2 * L_CODES + 1); + zero(this.heap); + this.heap_len = 0; + this.heap_max = 0; + this.depth = new utils.Buf16(2 * L_CODES + 1); + zero(this.depth); + this.l_buf = 0; + this.lit_bufsize = 0; + this.last_lit = 0; + this.d_buf = 0; + this.opt_len = 0; + this.static_len = 0; + this.matches = 0; + this.insert = 0; + this.bi_buf = 0; + this.bi_valid = 0; + } + function deflateResetKeep(strm) { + var s; + if (!strm || !strm.state) { + return err(strm, Z_STREAM_ERROR); + } + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + s = strm.state; + s.pending = 0; + s.pending_out = 0; + if (s.wrap < 0) { + s.wrap = -s.wrap; + } + s.status = s.wrap ? INIT_STATE : BUSY_STATE; + strm.adler = s.wrap === 2 ? 0 : 1; + s.last_flush = Z_NO_FLUSH; + trees._tr_init(s); + return Z_OK; + } + function deflateReset(strm) { + var ret = deflateResetKeep(strm); + if (ret === Z_OK) { + lm_init(strm.state); + } + return ret; + } + function deflateSetHeader(strm, head2) { + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + if (strm.state.wrap !== 2) { + return Z_STREAM_ERROR; + } + strm.state.gzhead = head2; + return Z_OK; + } + function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { + if (!strm) { + return Z_STREAM_ERROR; + } + var wrap = 1; + if (level === Z_DEFAULT_COMPRESSION) { + level = 6; + } + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } else if (windowBits > 15) { + wrap = 2; + windowBits -= 16; + } + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { + return err(strm, Z_STREAM_ERROR); + } + if (windowBits === 8) { + windowBits = 9; + } + var s = new DeflateState(); + strm.state = s; + s.strm = strm; + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + s.hash_bits = memLevel + 7; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + s.window = new utils.Buf8(s.w_size * 2); + s.head = new utils.Buf16(s.hash_size); + s.prev = new utils.Buf16(s.w_size); + s.lit_bufsize = 1 << memLevel + 6; + s.pending_buf_size = s.lit_bufsize * 4; + s.pending_buf = new utils.Buf8(s.pending_buf_size); + s.d_buf = 1 * s.lit_bufsize; + s.l_buf = (1 + 2) * s.lit_bufsize; + s.level = level; + s.strategy = strategy; + s.method = method; + return deflateReset(strm); + } + function deflateInit(strm, level) { + return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); + } + function deflate(strm, flush) { + var old_flush, s; + var beg, val; + if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; + } + s = strm.state; + if (!strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH) { + return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR); + } + s.strm = strm; + old_flush = s.last_flush; + s.last_flush = flush; + if (s.status === INIT_STATE) { + if (s.wrap === 2) { + strm.adler = 0; + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + } else { + put_byte( + s, + (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 255); + put_byte(s, s.gzhead.time >> 8 & 255); + put_byte(s, s.gzhead.time >> 16 & 255); + put_byte(s, s.gzhead.time >> 24 & 255); + put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); + put_byte(s, s.gzhead.os & 255); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 255); + put_byte(s, s.gzhead.extra.length >> 8 & 255); + } + if (s.gzhead.hcrc) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); + } + s.gzindex = 0; + s.status = EXTRA_STATE; + } + } else { + var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8; + var level_flags = -1; + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; + } + header |= level_flags << 6; + if (s.strstart !== 0) { + header |= PRESET_DICT; + } + header += 31 - header % 31; + s.status = BUSY_STATE; + putShortMSB(s, header); + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 65535); + } + strm.adler = 1; + } + } + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra) { + beg = s.pending; + while (s.gzindex < (s.gzhead.extra.length & 65535)) { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + break; + } + } + put_byte(s, s.gzhead.extra[s.gzindex] & 255); + s.gzindex++; + } + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (s.gzindex === s.gzhead.extra.length) { + s.gzindex = 0; + s.status = NAME_STATE; + } + } else { + s.status = NAME_STATE; + } + } + if (s.status === NAME_STATE) { + if (s.gzhead.name) { + beg = s.pending; + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 255; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.gzindex = 0; + s.status = COMMENT_STATE; + } + } else { + s.status = COMMENT_STATE; + } + } + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment) { + beg = s.pending; + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.status = HCRC_STATE; + } + } else { + s.status = HCRC_STATE; + } + } + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + } + if (s.pending + 2 <= s.pending_buf_size) { + put_byte(s, strm.adler & 255); + put_byte(s, strm.adler >> 8 & 255); + strm.adler = 0; + s.status = BUSY_STATE; + } + } else { + s.status = BUSY_STATE; + } + } + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; + return Z_OK; + } + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) { + return err(strm, Z_BUF_ERROR); + } + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR); + } + if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) { + var bstate = s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush); + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; + } + return Z_OK; + } + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + trees._tr_align(s); + } else if (flush !== Z_BLOCK) { + trees._tr_stored_block(s, 0, 0, false); + if (flush === Z_FULL_FLUSH) { + zero(s.head); + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; + return Z_OK; + } + } + } + if (flush !== Z_FINISH) { + return Z_OK; + } + if (s.wrap <= 0) { + return Z_STREAM_END; + } + if (s.wrap === 2) { + put_byte(s, strm.adler & 255); + put_byte(s, strm.adler >> 8 & 255); + put_byte(s, strm.adler >> 16 & 255); + put_byte(s, strm.adler >> 24 & 255); + put_byte(s, strm.total_in & 255); + put_byte(s, strm.total_in >> 8 & 255); + put_byte(s, strm.total_in >> 16 & 255); + put_byte(s, strm.total_in >> 24 & 255); + } else { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 65535); + } + flush_pending(strm); + if (s.wrap > 0) { + s.wrap = -s.wrap; + } + return s.pending !== 0 ? Z_OK : Z_STREAM_END; + } + function deflateEnd(strm) { + var status; + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + status = strm.state.status; + if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE) { + return err(strm, Z_STREAM_ERROR); + } + strm.state = null; + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; + } + function deflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + var s; + var str, n; + var wrap; + var avail; + var next2; + var input; + var tmpDict; + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + s = strm.state; + wrap = s.wrap; + if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) { + return Z_STREAM_ERROR; + } + if (wrap === 1) { + strm.adler = adler32(strm.adler, dictionary, dictLength, 0); + } + s.wrap = 0; + if (dictLength >= s.w_size) { + if (wrap === 0) { + zero(s.head); + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + tmpDict = new utils.Buf8(s.w_size); + utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); + dictionary = tmpDict; + dictLength = s.w_size; + } + avail = strm.avail_in; + next2 = strm.next_in; + input = strm.input; + strm.avail_in = dictLength; + strm.next_in = 0; + strm.input = dictionary; + fill_window(s); + while (s.lookahead >= MIN_MATCH) { + str = s.strstart; + n = s.lookahead - (MIN_MATCH - 1); + do { + s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + } while (--n); + s.strstart = str; + s.lookahead = MIN_MATCH - 1; + fill_window(s); + } + s.strstart += s.lookahead; + s.block_start = s.strstart; + s.insert = s.lookahead; + s.lookahead = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + strm.next_in = next2; + strm.input = input; + strm.avail_in = avail; + s.wrap = wrap; + return Z_OK; + } + exports.deflateInit = deflateInit; + exports.deflateInit2 = deflateInit2; + exports.deflateReset = deflateReset; + exports.deflateResetKeep = deflateResetKeep; + exports.deflateSetHeader = deflateSetHeader; + exports.deflate = deflate; + exports.deflateEnd = deflateEnd; + exports.deflateSetDictionary = deflateSetDictionary; + exports.deflateInfo = "pako deflate (from Nodeca project)"; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js +var require_strings = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js"(exports) { + "use strict"; + var utils = require_common(); + var STR_APPLY_OK = true; + var STR_APPLY_UIA_OK = true; + try { + String.fromCharCode.apply(null, [0]); + } catch (__) { + STR_APPLY_OK = false; + } + try { + String.fromCharCode.apply(null, new Uint8Array(1)); + } catch (__) { + STR_APPLY_UIA_OK = false; + } + var _utf8len = new utils.Buf8(256); + for (q = 0; q < 256; q++) { + _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1; + } + var q; + _utf8len[254] = _utf8len[254] = 1; + exports.string2buf = function(str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 64512) === 55296 && m_pos + 1 < str_len) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 64512) === 56320) { + c = 65536 + (c - 55296 << 10) + (c2 - 56320); + m_pos++; + } + } + buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4; + } + buf = new utils.Buf8(buf_len); + for (i = 0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 64512) === 55296 && m_pos + 1 < str_len) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 64512) === 56320) { + c = 65536 + (c - 55296 << 10) + (c2 - 56320); + m_pos++; + } + } + if (c < 128) { + buf[i++] = c; + } else if (c < 2048) { + buf[i++] = 192 | c >>> 6; + buf[i++] = 128 | c & 63; + } else if (c < 65536) { + buf[i++] = 224 | c >>> 12; + buf[i++] = 128 | c >>> 6 & 63; + buf[i++] = 128 | c & 63; + } else { + buf[i++] = 240 | c >>> 18; + buf[i++] = 128 | c >>> 12 & 63; + buf[i++] = 128 | c >>> 6 & 63; + buf[i++] = 128 | c & 63; + } + } + return buf; + }; + function buf2binstring(buf, len) { + if (len < 65534) { + if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) { + return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); + } + } + var result = ""; + for (var i = 0; i < len; i++) { + result += String.fromCharCode(buf[i]); + } + return result; + } + exports.buf2binstring = function(buf) { + return buf2binstring(buf, buf.length); + }; + exports.binstring2buf = function(str) { + var buf = new utils.Buf8(str.length); + for (var i = 0, len = buf.length; i < len; i++) { + buf[i] = str.charCodeAt(i); + } + return buf; + }; + exports.buf2string = function(buf, max) { + var i, out, c, c_len; + var len = max || buf.length; + var utf16buf = new Array(len * 2); + for (out = 0, i = 0; i < len; ) { + c = buf[i++]; + if (c < 128) { + utf16buf[out++] = c; + continue; + } + c_len = _utf8len[c]; + if (c_len > 4) { + utf16buf[out++] = 65533; + i += c_len - 1; + continue; + } + c &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7; + while (c_len > 1 && i < len) { + c = c << 6 | buf[i++] & 63; + c_len--; + } + if (c_len > 1) { + utf16buf[out++] = 65533; + continue; + } + if (c < 65536) { + utf16buf[out++] = c; + } else { + c -= 65536; + utf16buf[out++] = 55296 | c >> 10 & 1023; + utf16buf[out++] = 56320 | c & 1023; + } + } + return buf2binstring(utf16buf, out); + }; + exports.utf8border = function(buf, max) { + var pos; + max = max || buf.length; + if (max > buf.length) { + max = buf.length; + } + pos = max - 1; + while (pos >= 0 && (buf[pos] & 192) === 128) { + pos--; + } + if (pos < 0) { + return max; + } + if (pos === 0) { + return max; + } + return pos + _utf8len[buf[pos]] > max ? pos : max; + }; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js +var require_zstream = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js"(exports, module2) { + "use strict"; + function ZStream() { + this.input = null; + this.next_in = 0; + this.avail_in = 0; + this.total_in = 0; + this.output = null; + this.next_out = 0; + this.avail_out = 0; + this.total_out = 0; + this.msg = ""; + this.state = null; + this.data_type = 2; + this.adler = 0; + } + module2.exports = ZStream; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js +var require_deflate2 = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js"(exports) { + "use strict"; + var zlib_deflate = require_deflate(); + var utils = require_common(); + var strings = require_strings(); + var msg = require_messages(); + var ZStream = require_zstream(); + var toString = Object.prototype.toString; + var Z_NO_FLUSH = 0; + var Z_FINISH = 4; + var Z_OK = 0; + var Z_STREAM_END = 1; + var Z_SYNC_FLUSH = 2; + var Z_DEFAULT_COMPRESSION = -1; + var Z_DEFAULT_STRATEGY = 0; + var Z_DEFLATED = 8; + function Deflate(options) { + if (!(this instanceof Deflate)) return new Deflate(options); + this.options = utils.assign({ + level: Z_DEFAULT_COMPRESSION, + method: Z_DEFLATED, + chunkSize: 16384, + windowBits: 15, + memLevel: 8, + strategy: Z_DEFAULT_STRATEGY, + to: "" + }, options || {}); + var opt = this.options; + if (opt.raw && opt.windowBits > 0) { + opt.windowBits = -opt.windowBits; + } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) { + opt.windowBits += 16; + } + this.err = 0; + this.msg = ""; + this.ended = false; + this.chunks = []; + this.strm = new ZStream(); + this.strm.avail_out = 0; + var status = zlib_deflate.deflateInit2( + this.strm, + opt.level, + opt.method, + opt.windowBits, + opt.memLevel, + opt.strategy + ); + if (status !== Z_OK) { + throw new Error(msg[status]); + } + if (opt.header) { + zlib_deflate.deflateSetHeader(this.strm, opt.header); + } + if (opt.dictionary) { + var dict; + if (typeof opt.dictionary === "string") { + dict = strings.string2buf(opt.dictionary); + } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { + dict = new Uint8Array(opt.dictionary); + } else { + dict = opt.dictionary; + } + status = zlib_deflate.deflateSetDictionary(this.strm, dict); + if (status !== Z_OK) { + throw new Error(msg[status]); + } + this._dict_set = true; + } + } + Deflate.prototype.push = function(data, mode) { + var strm = this.strm; + var chunkSize = this.options.chunkSize; + var status, _mode; + if (this.ended) { + return false; + } + _mode = mode === ~~mode ? mode : mode === true ? Z_FINISH : Z_NO_FLUSH; + if (typeof data === "string") { + strm.input = strings.string2buf(data); + } else if (toString.call(data) === "[object ArrayBuffer]") { + strm.input = new Uint8Array(data); + } else { + strm.input = data; + } + strm.next_in = 0; + strm.avail_in = strm.input.length; + do { + if (strm.avail_out === 0) { + strm.output = new utils.Buf8(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + status = zlib_deflate.deflate(strm, _mode); + if (status !== Z_STREAM_END && status !== Z_OK) { + this.onEnd(status); + this.ended = true; + return false; + } + if (strm.avail_out === 0 || strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH)) { + if (this.options.to === "string") { + this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); + } else { + this.onData(utils.shrinkBuf(strm.output, strm.next_out)); + } + } + } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); + if (_mode === Z_FINISH) { + status = zlib_deflate.deflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === Z_OK; + } + if (_mode === Z_SYNC_FLUSH) { + this.onEnd(Z_OK); + strm.avail_out = 0; + return true; + } + return true; + }; + Deflate.prototype.onData = function(chunk) { + this.chunks.push(chunk); + }; + Deflate.prototype.onEnd = function(status) { + if (status === Z_OK) { + if (this.options.to === "string") { + this.result = this.chunks.join(""); + } else { + this.result = utils.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; + }; + function deflate(input, options) { + var deflator = new Deflate(options); + deflator.push(input, true); + if (deflator.err) { + throw deflator.msg || msg[deflator.err]; + } + return deflator.result; + } + function deflateRaw(input, options) { + options = options || {}; + options.raw = true; + return deflate(input, options); + } + function gzip(input, options) { + options = options || {}; + options.gzip = true; + return deflate(input, options); + } + exports.Deflate = Deflate; + exports.deflate = deflate; + exports.deflateRaw = deflateRaw; + exports.gzip = gzip; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js +var require_inffast = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js"(exports, module2) { + "use strict"; + var BAD = 30; + var TYPE = 12; + module2.exports = function inflate_fast(strm, start) { + var state2; + var _in; + var last2; + var _out; + var beg; + var end; + var dmax; + var wsize; + var whave; + var wnext; + var s_window; + var hold; + var bits; + var lcode; + var dcode; + var lmask; + var dmask; + var here; + var op; + var len; + var dist; + var from; + var from_source; + var input, output; + state2 = strm.state; + _in = strm.next_in; + input = strm.input; + last2 = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); + dmax = state2.dmax; + wsize = state2.wsize; + whave = state2.whave; + wnext = state2.wnext; + s_window = state2.window; + hold = state2.hold; + bits = state2.bits; + lcode = state2.lencode; + dcode = state2.distcode; + lmask = (1 << state2.lenbits) - 1; + dmask = (1 << state2.distbits) - 1; + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = lcode[hold & lmask]; + dolen: + for (; ; ) { + op = here >>> 24; + hold >>>= op; + bits -= op; + op = here >>> 16 & 255; + if (op === 0) { + output[_out++] = here & 65535; + } else if (op & 16) { + len = here & 65535; + op &= 15; + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & (1 << op) - 1; + hold >>>= op; + bits -= op; + } + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + dodist: + for (; ; ) { + op = here >>> 24; + hold >>>= op; + bits -= op; + op = here >>> 16 & 255; + if (op & 16) { + dist = here & 65535; + op &= 15; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & (1 << op) - 1; + if (dist > dmax) { + strm.msg = "invalid distance too far back"; + state2.mode = BAD; + break top; + } + hold >>>= op; + bits -= op; + op = _out - beg; + if (dist > op) { + op = dist - op; + if (op > whave) { + if (state2.sane) { + strm.msg = "invalid distance too far back"; + state2.mode = BAD; + break top; + } + } + from = 0; + from_source = s_window; + if (wnext === 0) { + from += wsize - op; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } else if (wnext < op) { + from += wsize + wnext - op; + op -= wnext; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = 0; + if (wnext < len) { + op = wnext; + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } + } else { + from += wnext - op; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } else { + from = _out - dist; + do { + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } else if ((op & 64) === 0) { + here = dcode[(here & 65535) + (hold & (1 << op) - 1)]; + continue dodist; + } else { + strm.msg = "invalid distance code"; + state2.mode = BAD; + break top; + } + break; + } + } else if ((op & 64) === 0) { + here = lcode[(here & 65535) + (hold & (1 << op) - 1)]; + continue dolen; + } else if (op & 32) { + state2.mode = TYPE; + break top; + } else { + strm.msg = "invalid literal/length code"; + state2.mode = BAD; + break top; + } + break; + } + } while (_in < last2 && _out < end); + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = _in < last2 ? 5 + (last2 - _in) : 5 - (_in - last2); + strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); + state2.hold = hold; + state2.bits = bits; + return; + }; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js +var require_inftrees = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js"(exports, module2) { + "use strict"; + var utils = require_common(); + var MAXBITS = 15; + var ENOUGH_LENS = 852; + var ENOUGH_DISTS = 592; + var CODES = 0; + var LENS = 1; + var DISTS = 2; + var lbase = [ + /* Length codes 257..285 base */ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 13, + 15, + 17, + 19, + 23, + 27, + 31, + 35, + 43, + 51, + 59, + 67, + 83, + 99, + 115, + 131, + 163, + 195, + 227, + 258, + 0, + 0 + ]; + var lext = [ + /* Length codes 257..285 extra */ + 16, + 16, + 16, + 16, + 16, + 16, + 16, + 16, + 17, + 17, + 17, + 17, + 18, + 18, + 18, + 18, + 19, + 19, + 19, + 19, + 20, + 20, + 20, + 20, + 21, + 21, + 21, + 21, + 16, + 72, + 78 + ]; + var dbase = [ + /* Distance codes 0..29 base */ + 1, + 2, + 3, + 4, + 5, + 7, + 9, + 13, + 17, + 25, + 33, + 49, + 65, + 97, + 129, + 193, + 257, + 385, + 513, + 769, + 1025, + 1537, + 2049, + 3073, + 4097, + 6145, + 8193, + 12289, + 16385, + 24577, + 0, + 0 + ]; + var dext = [ + /* Distance codes 0..29 extra */ + 16, + 16, + 16, + 16, + 17, + 17, + 18, + 18, + 19, + 19, + 20, + 20, + 21, + 21, + 22, + 22, + 23, + 23, + 24, + 24, + 25, + 25, + 26, + 26, + 27, + 27, + 28, + 28, + 29, + 29, + 64, + 64 + ]; + module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { + var bits = opts.bits; + var len = 0; + var sym = 0; + var min = 0, max = 0; + var root3 = 0; + var curr = 0; + var drop = 0; + var left = 0; + var used = 0; + var huff = 0; + var incr; + var fill2; + var low; + var mask; + var next2; + var base = null; + var base_index = 0; + var end; + var count = new utils.Buf16(MAXBITS + 1); + var offs = new utils.Buf16(MAXBITS + 1); + var extra = null; + var extra_index = 0; + var here_bits, here_op, here_val; + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; + } + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; + } + root3 = bits; + for (max = MAXBITS; max >= 1; max--) { + if (count[max] !== 0) { + break; + } + } + if (root3 > max) { + root3 = max; + } + if (max === 0) { + table[table_index++] = 1 << 24 | 64 << 16 | 0; + table[table_index++] = 1 << 24 | 64 << 16 | 0; + opts.bits = 1; + return 0; + } + for (min = 1; min < max; min++) { + if (count[min] !== 0) { + break; + } + } + if (root3 < min) { + root3 = min; + } + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } + } + if (left > 0 && (type === CODES || max !== 1)) { + return -1; + } + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; + } + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } + } + if (type === CODES) { + base = extra = work; + end = 19; + } else if (type === LENS) { + base = lbase; + base_index -= 257; + extra = lext; + extra_index -= 257; + end = 256; + } else { + base = dbase; + extra = dext; + end = -1; + } + huff = 0; + sym = 0; + len = min; + next2 = table_index; + curr = root3; + drop = 0; + low = -1; + used = 1 << root3; + mask = used - 1; + if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { + return 1; + } + for (; ; ) { + here_bits = len - drop; + if (work[sym] < end) { + here_op = 0; + here_val = work[sym]; + } else if (work[sym] > end) { + here_op = extra[extra_index + work[sym]]; + here_val = base[base_index + work[sym]]; + } else { + here_op = 32 + 64; + here_val = 0; + } + incr = 1 << len - drop; + fill2 = 1 << curr; + min = fill2; + do { + fill2 -= incr; + table[next2 + (huff >> drop) + fill2] = here_bits << 24 | here_op << 16 | here_val | 0; + } while (fill2 !== 0); + incr = 1 << len - 1; + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + sym++; + if (--count[len] === 0) { + if (len === max) { + break; + } + len = lens[lens_index + work[sym]]; + } + if (len > root3 && (huff & mask) !== low) { + if (drop === 0) { + drop = root3; + } + next2 += min; + curr = len - drop; + left = 1 << curr; + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) { + break; + } + curr++; + left <<= 1; + } + used += 1 << curr; + if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { + return 1; + } + low = huff & mask; + table[low] = root3 << 24 | curr << 16 | next2 - table_index | 0; + } + } + if (huff !== 0) { + table[next2 + huff] = len - drop << 24 | 64 << 16 | 0; + } + opts.bits = root3; + return 0; + }; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js +var require_inflate = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js"(exports) { + "use strict"; + var utils = require_common(); + var adler32 = require_adler32(); + var crc32 = require_crc32(); + var inflate_fast = require_inffast(); + var inflate_table = require_inftrees(); + var CODES = 0; + var LENS = 1; + var DISTS = 2; + var Z_FINISH = 4; + var Z_BLOCK = 5; + var Z_TREES = 6; + var Z_OK = 0; + var Z_STREAM_END = 1; + var Z_NEED_DICT = 2; + var Z_STREAM_ERROR = -2; + var Z_DATA_ERROR = -3; + var Z_MEM_ERROR = -4; + var Z_BUF_ERROR = -5; + var Z_DEFLATED = 8; + var HEAD = 1; + var FLAGS = 2; + var TIME = 3; + var OS = 4; + var EXLEN = 5; + var EXTRA = 6; + var NAME = 7; + var COMMENT = 8; + var HCRC = 9; + var DICTID = 10; + var DICT = 11; + var TYPE = 12; + var TYPEDO = 13; + var STORED = 14; + var COPY_ = 15; + var COPY = 16; + var TABLE = 17; + var LENLENS = 18; + var CODELENS = 19; + var LEN_ = 20; + var LEN = 21; + var LENEXT = 22; + var DIST = 23; + var DISTEXT = 24; + var MATCH = 25; + var LIT = 26; + var CHECK = 27; + var LENGTH = 28; + var DONE = 29; + var BAD = 30; + var MEM = 31; + var SYNC = 32; + var ENOUGH_LENS = 852; + var ENOUGH_DISTS = 592; + var MAX_WBITS = 15; + var DEF_WBITS = MAX_WBITS; + function zswap32(q) { + return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24); + } + function InflateState() { + this.mode = 0; + this.last = false; + this.wrap = 0; + this.havedict = false; + this.flags = 0; + this.dmax = 0; + this.check = 0; + this.total = 0; + this.head = null; + this.wbits = 0; + this.wsize = 0; + this.whave = 0; + this.wnext = 0; + this.window = null; + this.hold = 0; + this.bits = 0; + this.length = 0; + this.offset = 0; + this.extra = 0; + this.lencode = null; + this.distcode = null; + this.lenbits = 0; + this.distbits = 0; + this.ncode = 0; + this.nlen = 0; + this.ndist = 0; + this.have = 0; + this.next = null; + this.lens = new utils.Buf16(320); + this.work = new utils.Buf16(288); + this.lendyn = null; + this.distdyn = null; + this.sane = 0; + this.back = 0; + this.was = 0; + } + function inflateResetKeep(strm) { + var state2; + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + state2 = strm.state; + strm.total_in = strm.total_out = state2.total = 0; + strm.msg = ""; + if (state2.wrap) { + strm.adler = state2.wrap & 1; + } + state2.mode = HEAD; + state2.last = 0; + state2.havedict = 0; + state2.dmax = 32768; + state2.head = null; + state2.hold = 0; + state2.bits = 0; + state2.lencode = state2.lendyn = new utils.Buf32(ENOUGH_LENS); + state2.distcode = state2.distdyn = new utils.Buf32(ENOUGH_DISTS); + state2.sane = 1; + state2.back = -1; + return Z_OK; + } + function inflateReset(strm) { + var state2; + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + state2 = strm.state; + state2.wsize = 0; + state2.whave = 0; + state2.wnext = 0; + return inflateResetKeep(strm); + } + function inflateReset2(strm, windowBits) { + var wrap; + var state2; + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + state2 = strm.state; + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } else { + wrap = (windowBits >> 4) + 1; + if (windowBits < 48) { + windowBits &= 15; + } + } + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR; + } + if (state2.window !== null && state2.wbits !== windowBits) { + state2.window = null; + } + state2.wrap = wrap; + state2.wbits = windowBits; + return inflateReset(strm); + } + function inflateInit2(strm, windowBits) { + var ret; + var state2; + if (!strm) { + return Z_STREAM_ERROR; + } + state2 = new InflateState(); + strm.state = state2; + state2.window = null; + ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK) { + strm.state = null; + } + return ret; + } + function inflateInit(strm) { + return inflateInit2(strm, DEF_WBITS); + } + var virgin = true; + var lenfix; + var distfix; + function fixedtables(state2) { + if (virgin) { + var sym; + lenfix = new utils.Buf32(512); + distfix = new utils.Buf32(32); + sym = 0; + while (sym < 144) { + state2.lens[sym++] = 8; + } + while (sym < 256) { + state2.lens[sym++] = 9; + } + while (sym < 280) { + state2.lens[sym++] = 7; + } + while (sym < 288) { + state2.lens[sym++] = 8; + } + inflate_table(LENS, state2.lens, 0, 288, lenfix, 0, state2.work, { bits: 9 }); + sym = 0; + while (sym < 32) { + state2.lens[sym++] = 5; + } + inflate_table(DISTS, state2.lens, 0, 32, distfix, 0, state2.work, { bits: 5 }); + virgin = false; + } + state2.lencode = lenfix; + state2.lenbits = 9; + state2.distcode = distfix; + state2.distbits = 5; + } + function updatewindow(strm, src, end, copy) { + var dist; + var state2 = strm.state; + if (state2.window === null) { + state2.wsize = 1 << state2.wbits; + state2.wnext = 0; + state2.whave = 0; + state2.window = new utils.Buf8(state2.wsize); + } + if (copy >= state2.wsize) { + utils.arraySet(state2.window, src, end - state2.wsize, state2.wsize, 0); + state2.wnext = 0; + state2.whave = state2.wsize; + } else { + dist = state2.wsize - state2.wnext; + if (dist > copy) { + dist = copy; + } + utils.arraySet(state2.window, src, end - copy, dist, state2.wnext); + copy -= dist; + if (copy) { + utils.arraySet(state2.window, src, end - copy, copy, 0); + state2.wnext = copy; + state2.whave = state2.wsize; + } else { + state2.wnext += dist; + if (state2.wnext === state2.wsize) { + state2.wnext = 0; + } + if (state2.whave < state2.wsize) { + state2.whave += dist; + } + } + } + return 0; + } + function inflate(strm, flush) { + var state2; + var input, output; + var next2; + var put; + var have, left; + var hold; + var bits; + var _in, _out; + var copy; + var from; + var from_source; + var here = 0; + var here_bits, here_op, here_val; + var last_bits, last_op, last_val; + var len; + var ret; + var hbuf = new utils.Buf8(4); + var opts; + var n; + var order = ( + /* permutation of code lengths */ + [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] + ); + if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) { + return Z_STREAM_ERROR; + } + state2 = strm.state; + if (state2.mode === TYPE) { + state2.mode = TYPEDO; + } + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next2 = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state2.hold; + bits = state2.bits; + _in = have; + _out = left; + ret = Z_OK; + inf_leave: + for (; ; ) { + switch (state2.mode) { + case HEAD: + if (state2.wrap === 0) { + state2.mode = TYPEDO; + break; + } + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if (state2.wrap & 2 && hold === 35615) { + state2.check = 0; + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state2.check = crc32(state2.check, hbuf, 2, 0); + hold = 0; + bits = 0; + state2.mode = FLAGS; + break; + } + state2.flags = 0; + if (state2.head) { + state2.head.done = false; + } + if (!(state2.wrap & 1) || /* check if zlib header allowed */ + (((hold & 255) << 8) + (hold >> 8)) % 31) { + strm.msg = "incorrect header check"; + state2.mode = BAD; + break; + } + if ((hold & 15) !== Z_DEFLATED) { + strm.msg = "unknown compression method"; + state2.mode = BAD; + break; + } + hold >>>= 4; + bits -= 4; + len = (hold & 15) + 8; + if (state2.wbits === 0) { + state2.wbits = len; + } else if (len > state2.wbits) { + strm.msg = "invalid window size"; + state2.mode = BAD; + break; + } + state2.dmax = 1 << len; + strm.adler = state2.check = 1; + state2.mode = hold & 512 ? DICTID : TYPE; + hold = 0; + bits = 0; + break; + case FLAGS: + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + state2.flags = hold; + if ((state2.flags & 255) !== Z_DEFLATED) { + strm.msg = "unknown compression method"; + state2.mode = BAD; + break; + } + if (state2.flags & 57344) { + strm.msg = "unknown header flags set"; + state2.mode = BAD; + break; + } + if (state2.head) { + state2.head.text = hold >> 8 & 1; + } + if (state2.flags & 512) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state2.check = crc32(state2.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + state2.mode = TIME; + /* falls through */ + case TIME: + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if (state2.head) { + state2.head.time = hold; + } + if (state2.flags & 512) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + hbuf[2] = hold >>> 16 & 255; + hbuf[3] = hold >>> 24 & 255; + state2.check = crc32(state2.check, hbuf, 4, 0); + } + hold = 0; + bits = 0; + state2.mode = OS; + /* falls through */ + case OS: + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if (state2.head) { + state2.head.xflags = hold & 255; + state2.head.os = hold >> 8; + } + if (state2.flags & 512) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state2.check = crc32(state2.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + state2.mode = EXLEN; + /* falls through */ + case EXLEN: + if (state2.flags & 1024) { + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + state2.length = hold; + if (state2.head) { + state2.head.extra_len = hold; + } + if (state2.flags & 512) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state2.check = crc32(state2.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + } else if (state2.head) { + state2.head.extra = null; + } + state2.mode = EXTRA; + /* falls through */ + case EXTRA: + if (state2.flags & 1024) { + copy = state2.length; + if (copy > have) { + copy = have; + } + if (copy) { + if (state2.head) { + len = state2.head.extra_len - state2.length; + if (!state2.head.extra) { + state2.head.extra = new Array(state2.head.extra_len); + } + utils.arraySet( + state2.head.extra, + input, + next2, + // extra field is limited to 65536 bytes + // - no need for additional size check + copy, + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + } + if (state2.flags & 512) { + state2.check = crc32(state2.check, input, copy, next2); + } + have -= copy; + next2 += copy; + state2.length -= copy; + } + if (state2.length) { + break inf_leave; + } + } + state2.length = 0; + state2.mode = NAME; + /* falls through */ + case NAME: + if (state2.flags & 2048) { + if (have === 0) { + break inf_leave; + } + copy = 0; + do { + len = input[next2 + copy++]; + if (state2.head && len && state2.length < 65536) { + state2.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + if (state2.flags & 512) { + state2.check = crc32(state2.check, input, copy, next2); + } + have -= copy; + next2 += copy; + if (len) { + break inf_leave; + } + } else if (state2.head) { + state2.head.name = null; + } + state2.length = 0; + state2.mode = COMMENT; + /* falls through */ + case COMMENT: + if (state2.flags & 4096) { + if (have === 0) { + break inf_leave; + } + copy = 0; + do { + len = input[next2 + copy++]; + if (state2.head && len && state2.length < 65536) { + state2.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state2.flags & 512) { + state2.check = crc32(state2.check, input, copy, next2); + } + have -= copy; + next2 += copy; + if (len) { + break inf_leave; + } + } else if (state2.head) { + state2.head.comment = null; + } + state2.mode = HCRC; + /* falls through */ + case HCRC: + if (state2.flags & 512) { + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if (hold !== (state2.check & 65535)) { + strm.msg = "header crc mismatch"; + state2.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + if (state2.head) { + state2.head.hcrc = state2.flags >> 9 & 1; + state2.head.done = true; + } + strm.adler = state2.check = 0; + state2.mode = TYPE; + break; + case DICTID: + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + strm.adler = state2.check = zswap32(hold); + hold = 0; + bits = 0; + state2.mode = DICT; + /* falls through */ + case DICT: + if (state2.havedict === 0) { + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next2; + strm.avail_in = have; + state2.hold = hold; + state2.bits = bits; + return Z_NEED_DICT; + } + strm.adler = state2.check = 1; + state2.mode = TYPE; + /* falls through */ + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { + break inf_leave; + } + /* falls through */ + case TYPEDO: + if (state2.last) { + hold >>>= bits & 7; + bits -= bits & 7; + state2.mode = CHECK; + break; + } + while (bits < 3) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + state2.last = hold & 1; + hold >>>= 1; + bits -= 1; + switch (hold & 3) { + case 0: + state2.mode = STORED; + break; + case 1: + fixedtables(state2); + state2.mode = LEN_; + if (flush === Z_TREES) { + hold >>>= 2; + bits -= 2; + break inf_leave; + } + break; + case 2: + state2.mode = TABLE; + break; + case 3: + strm.msg = "invalid block type"; + state2.mode = BAD; + } + hold >>>= 2; + bits -= 2; + break; + case STORED: + hold >>>= bits & 7; + bits -= bits & 7; + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if ((hold & 65535) !== (hold >>> 16 ^ 65535)) { + strm.msg = "invalid stored block lengths"; + state2.mode = BAD; + break; + } + state2.length = hold & 65535; + hold = 0; + bits = 0; + state2.mode = COPY_; + if (flush === Z_TREES) { + break inf_leave; + } + /* falls through */ + case COPY_: + state2.mode = COPY; + /* falls through */ + case COPY: + copy = state2.length; + if (copy) { + if (copy > have) { + copy = have; + } + if (copy > left) { + copy = left; + } + if (copy === 0) { + break inf_leave; + } + utils.arraySet(output, input, next2, copy, put); + have -= copy; + next2 += copy; + left -= copy; + put += copy; + state2.length -= copy; + break; + } + state2.mode = TYPE; + break; + case TABLE: + while (bits < 14) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + state2.nlen = (hold & 31) + 257; + hold >>>= 5; + bits -= 5; + state2.ndist = (hold & 31) + 1; + hold >>>= 5; + bits -= 5; + state2.ncode = (hold & 15) + 4; + hold >>>= 4; + bits -= 4; + if (state2.nlen > 286 || state2.ndist > 30) { + strm.msg = "too many length or distance symbols"; + state2.mode = BAD; + break; + } + state2.have = 0; + state2.mode = LENLENS; + /* falls through */ + case LENLENS: + while (state2.have < state2.ncode) { + while (bits < 3) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + state2.lens[order[state2.have++]] = hold & 7; + hold >>>= 3; + bits -= 3; + } + while (state2.have < 19) { + state2.lens[order[state2.have++]] = 0; + } + state2.lencode = state2.lendyn; + state2.lenbits = 7; + opts = { bits: state2.lenbits }; + ret = inflate_table(CODES, state2.lens, 0, 19, state2.lencode, 0, state2.work, opts); + state2.lenbits = opts.bits; + if (ret) { + strm.msg = "invalid code lengths set"; + state2.mode = BAD; + break; + } + state2.have = 0; + state2.mode = CODELENS; + /* falls through */ + case CODELENS: + while (state2.have < state2.nlen + state2.ndist) { + for (; ; ) { + here = state2.lencode[hold & (1 << state2.lenbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if (here_val < 16) { + hold >>>= here_bits; + bits -= here_bits; + state2.lens[state2.have++] = here_val; + } else { + if (here_val === 16) { + n = here_bits + 2; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + if (state2.have === 0) { + strm.msg = "invalid bit length repeat"; + state2.mode = BAD; + break; + } + len = state2.lens[state2.have - 1]; + copy = 3 + (hold & 3); + hold >>>= 2; + bits -= 2; + } else if (here_val === 17) { + n = here_bits + 3; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + len = 0; + copy = 3 + (hold & 7); + hold >>>= 3; + bits -= 3; + } else { + n = here_bits + 7; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + len = 0; + copy = 11 + (hold & 127); + hold >>>= 7; + bits -= 7; + } + if (state2.have + copy > state2.nlen + state2.ndist) { + strm.msg = "invalid bit length repeat"; + state2.mode = BAD; + break; + } + while (copy--) { + state2.lens[state2.have++] = len; + } + } + } + if (state2.mode === BAD) { + break; + } + if (state2.lens[256] === 0) { + strm.msg = "invalid code -- missing end-of-block"; + state2.mode = BAD; + break; + } + state2.lenbits = 9; + opts = { bits: state2.lenbits }; + ret = inflate_table(LENS, state2.lens, 0, state2.nlen, state2.lencode, 0, state2.work, opts); + state2.lenbits = opts.bits; + if (ret) { + strm.msg = "invalid literal/lengths set"; + state2.mode = BAD; + break; + } + state2.distbits = 6; + state2.distcode = state2.distdyn; + opts = { bits: state2.distbits }; + ret = inflate_table(DISTS, state2.lens, state2.nlen, state2.ndist, state2.distcode, 0, state2.work, opts); + state2.distbits = opts.bits; + if (ret) { + strm.msg = "invalid distances set"; + state2.mode = BAD; + break; + } + state2.mode = LEN_; + if (flush === Z_TREES) { + break inf_leave; + } + /* falls through */ + case LEN_: + state2.mode = LEN; + /* falls through */ + case LEN: + if (have >= 6 && left >= 258) { + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next2; + strm.avail_in = have; + state2.hold = hold; + state2.bits = bits; + inflate_fast(strm, _out); + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next2 = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state2.hold; + bits = state2.bits; + if (state2.mode === TYPE) { + state2.back = -1; + } + break; + } + state2.back = 0; + for (; ; ) { + here = state2.lencode[hold & (1 << state2.lenbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if (here_op && (here_op & 240) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (; ; ) { + here = state2.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (last_bits + here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + hold >>>= last_bits; + bits -= last_bits; + state2.back += last_bits; + } + hold >>>= here_bits; + bits -= here_bits; + state2.back += here_bits; + state2.length = here_val; + if (here_op === 0) { + state2.mode = LIT; + break; + } + if (here_op & 32) { + state2.back = -1; + state2.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = "invalid literal/length code"; + state2.mode = BAD; + break; + } + state2.extra = here_op & 15; + state2.mode = LENEXT; + /* falls through */ + case LENEXT: + if (state2.extra) { + n = state2.extra; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + state2.length += hold & (1 << state2.extra) - 1; + hold >>>= state2.extra; + bits -= state2.extra; + state2.back += state2.extra; + } + state2.was = state2.length; + state2.mode = DIST; + /* falls through */ + case DIST: + for (; ; ) { + here = state2.distcode[hold & (1 << state2.distbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if ((here_op & 240) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (; ; ) { + here = state2.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (last_bits + here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + hold >>>= last_bits; + bits -= last_bits; + state2.back += last_bits; + } + hold >>>= here_bits; + bits -= here_bits; + state2.back += here_bits; + if (here_op & 64) { + strm.msg = "invalid distance code"; + state2.mode = BAD; + break; + } + state2.offset = here_val; + state2.extra = here_op & 15; + state2.mode = DISTEXT; + /* falls through */ + case DISTEXT: + if (state2.extra) { + n = state2.extra; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + state2.offset += hold & (1 << state2.extra) - 1; + hold >>>= state2.extra; + bits -= state2.extra; + state2.back += state2.extra; + } + if (state2.offset > state2.dmax) { + strm.msg = "invalid distance too far back"; + state2.mode = BAD; + break; + } + state2.mode = MATCH; + /* falls through */ + case MATCH: + if (left === 0) { + break inf_leave; + } + copy = _out - left; + if (state2.offset > copy) { + copy = state2.offset - copy; + if (copy > state2.whave) { + if (state2.sane) { + strm.msg = "invalid distance too far back"; + state2.mode = BAD; + break; + } + } + if (copy > state2.wnext) { + copy -= state2.wnext; + from = state2.wsize - copy; + } else { + from = state2.wnext - copy; + } + if (copy > state2.length) { + copy = state2.length; + } + from_source = state2.window; + } else { + from_source = output; + from = put - state2.offset; + copy = state2.length; + } + if (copy > left) { + copy = left; + } + left -= copy; + state2.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state2.length === 0) { + state2.mode = LEN; + } + break; + case LIT: + if (left === 0) { + break inf_leave; + } + output[put++] = state2.length; + left--; + state2.mode = LEN; + break; + case CHECK: + if (state2.wrap) { + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold |= input[next2++] << bits; + bits += 8; + } + _out -= left; + strm.total_out += _out; + state2.total += _out; + if (_out) { + strm.adler = state2.check = /*UPDATE(state.check, put - _out, _out);*/ + state2.flags ? crc32(state2.check, output, _out, put - _out) : adler32(state2.check, output, _out, put - _out); + } + _out = left; + if ((state2.flags ? hold : zswap32(hold)) !== state2.check) { + strm.msg = "incorrect data check"; + state2.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + state2.mode = LENGTH; + /* falls through */ + case LENGTH: + if (state2.wrap && state2.flags) { + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next2++] << bits; + bits += 8; + } + if (hold !== (state2.total & 4294967295)) { + strm.msg = "incorrect length check"; + state2.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + state2.mode = DONE; + /* falls through */ + case DONE: + ret = Z_STREAM_END; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR; + break inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + /* falls through */ + default: + return Z_STREAM_ERROR; + } + } + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next2; + strm.avail_in = have; + state2.hold = hold; + state2.bits = bits; + if (state2.wsize || _out !== strm.avail_out && state2.mode < BAD && (state2.mode < CHECK || flush !== Z_FINISH)) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { + state2.mode = MEM; + return Z_MEM_ERROR; + } + } + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state2.total += _out; + if (state2.wrap && _out) { + strm.adler = state2.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ + state2.flags ? crc32(state2.check, output, _out, strm.next_out - _out) : adler32(state2.check, output, _out, strm.next_out - _out); + } + strm.data_type = state2.bits + (state2.last ? 64 : 0) + (state2.mode === TYPE ? 128 : 0) + (state2.mode === LEN_ || state2.mode === COPY_ ? 256 : 0); + if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) { + ret = Z_BUF_ERROR; + } + return ret; + } + function inflateEnd(strm) { + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + var state2 = strm.state; + if (state2.window) { + state2.window = null; + } + strm.state = null; + return Z_OK; + } + function inflateGetHeader(strm, head2) { + var state2; + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + state2 = strm.state; + if ((state2.wrap & 2) === 0) { + return Z_STREAM_ERROR; + } + state2.head = head2; + head2.done = false; + return Z_OK; + } + function inflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + var state2; + var dictid; + var ret; + if (!strm || !strm.state) { + return Z_STREAM_ERROR; + } + state2 = strm.state; + if (state2.wrap !== 0 && state2.mode !== DICT) { + return Z_STREAM_ERROR; + } + if (state2.mode === DICT) { + dictid = 1; + dictid = adler32(dictid, dictionary, dictLength, 0); + if (dictid !== state2.check) { + return Z_DATA_ERROR; + } + } + ret = updatewindow(strm, dictionary, dictLength, dictLength); + if (ret) { + state2.mode = MEM; + return Z_MEM_ERROR; + } + state2.havedict = 1; + return Z_OK; + } + exports.inflateReset = inflateReset; + exports.inflateReset2 = inflateReset2; + exports.inflateResetKeep = inflateResetKeep; + exports.inflateInit = inflateInit; + exports.inflateInit2 = inflateInit2; + exports.inflate = inflate; + exports.inflateEnd = inflateEnd; + exports.inflateGetHeader = inflateGetHeader; + exports.inflateSetDictionary = inflateSetDictionary; + exports.inflateInfo = "pako inflate (from Nodeca project)"; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js +var require_constants = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js"(exports, module2) { + "use strict"; + module2.exports = { + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + //Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type + }; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js +var require_gzheader = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js"(exports, module2) { + "use strict"; + function GZheader() { + this.text = 0; + this.time = 0; + this.xflags = 0; + this.os = 0; + this.extra = null; + this.extra_len = 0; + this.name = ""; + this.comment = ""; + this.hcrc = 0; + this.done = false; + } + module2.exports = GZheader; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js +var require_inflate2 = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js"(exports) { + "use strict"; + var zlib_inflate = require_inflate(); + var utils = require_common(); + var strings = require_strings(); + var c = require_constants(); + var msg = require_messages(); + var ZStream = require_zstream(); + var GZheader = require_gzheader(); + var toString = Object.prototype.toString; + function Inflate(options) { + if (!(this instanceof Inflate)) return new Inflate(options); + this.options = utils.assign({ + chunkSize: 16384, + windowBits: 0, + to: "" + }, options || {}); + var opt = this.options; + if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) { + opt.windowBits = -opt.windowBits; + if (opt.windowBits === 0) { + opt.windowBits = -15; + } + } + if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) { + opt.windowBits += 32; + } + if (opt.windowBits > 15 && opt.windowBits < 48) { + if ((opt.windowBits & 15) === 0) { + opt.windowBits |= 15; + } + } + this.err = 0; + this.msg = ""; + this.ended = false; + this.chunks = []; + this.strm = new ZStream(); + this.strm.avail_out = 0; + var status = zlib_inflate.inflateInit2( + this.strm, + opt.windowBits + ); + if (status !== c.Z_OK) { + throw new Error(msg[status]); + } + this.header = new GZheader(); + zlib_inflate.inflateGetHeader(this.strm, this.header); + if (opt.dictionary) { + if (typeof opt.dictionary === "string") { + opt.dictionary = strings.string2buf(opt.dictionary); + } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { + opt.dictionary = new Uint8Array(opt.dictionary); + } + if (opt.raw) { + status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); + if (status !== c.Z_OK) { + throw new Error(msg[status]); + } + } + } + } + Inflate.prototype.push = function(data, mode) { + var strm = this.strm; + var chunkSize = this.options.chunkSize; + var dictionary = this.options.dictionary; + var status, _mode; + var next_out_utf8, tail, utf8str; + var allowBufError = false; + if (this.ended) { + return false; + } + _mode = mode === ~~mode ? mode : mode === true ? c.Z_FINISH : c.Z_NO_FLUSH; + if (typeof data === "string") { + strm.input = strings.binstring2buf(data); + } else if (toString.call(data) === "[object ArrayBuffer]") { + strm.input = new Uint8Array(data); + } else { + strm.input = data; + } + strm.next_in = 0; + strm.avail_in = strm.input.length; + do { + if (strm.avail_out === 0) { + strm.output = new utils.Buf8(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); + if (status === c.Z_NEED_DICT && dictionary) { + status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); + } + if (status === c.Z_BUF_ERROR && allowBufError === true) { + status = c.Z_OK; + allowBufError = false; + } + if (status !== c.Z_STREAM_END && status !== c.Z_OK) { + this.onEnd(status); + this.ended = true; + return false; + } + if (strm.next_out) { + if (strm.avail_out === 0 || status === c.Z_STREAM_END || strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH)) { + if (this.options.to === "string") { + next_out_utf8 = strings.utf8border(strm.output, strm.next_out); + tail = strm.next_out - next_out_utf8; + utf8str = strings.buf2string(strm.output, next_out_utf8); + strm.next_out = tail; + strm.avail_out = chunkSize - tail; + if (tail) { + utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); + } + this.onData(utf8str); + } else { + this.onData(utils.shrinkBuf(strm.output, strm.next_out)); + } + } + } + if (strm.avail_in === 0 && strm.avail_out === 0) { + allowBufError = true; + } + } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); + if (status === c.Z_STREAM_END) { + _mode = c.Z_FINISH; + } + if (_mode === c.Z_FINISH) { + status = zlib_inflate.inflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === c.Z_OK; + } + if (_mode === c.Z_SYNC_FLUSH) { + this.onEnd(c.Z_OK); + strm.avail_out = 0; + return true; + } + return true; + }; + Inflate.prototype.onData = function(chunk) { + this.chunks.push(chunk); + }; + Inflate.prototype.onEnd = function(status) { + if (status === c.Z_OK) { + if (this.options.to === "string") { + this.result = this.chunks.join(""); + } else { + this.result = utils.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; + }; + function inflate(input, options) { + var inflator = new Inflate(options); + inflator.push(input, true); + if (inflator.err) { + throw inflator.msg || msg[inflator.err]; + } + return inflator.result; + } + function inflateRaw(input, options) { + options = options || {}; + options.raw = true; + return inflate(input, options); + } + exports.Inflate = Inflate; + exports.inflate = inflate; + exports.inflateRaw = inflateRaw; + exports.ungzip = inflate; + } +}); + +// node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js +var require_pako = __commonJS({ + "node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js"(exports, module2) { + "use strict"; + var assign2 = require_common().assign; + var deflate = require_deflate2(); + var inflate = require_inflate2(); + var constants = require_constants(); + var pako5 = {}; + assign2(pako5, deflate, inflate, constants); + module2.exports = pako5; + } +}); + +// src/main.ts +var main_exports = {}; +__export(main_exports, { + default: () => BetterExportPdfPlugin3 +}); +module.exports = __toCommonJS(main_exports); +var import_obsidian6 = require("obsidian"); + +// src/i18n/index.ts +var import_deepmerge = __toESM(require_cjs()); + +// src/i18n/en.ts +var en_default = { + exportCurrentFile: "Export current file to PDF", + exportCurrentFileWithPrevious: "Export to PDF with previous Settings", + exportDialog: { + filenameAsTitle: "Include file name as title", + pageSize: "Page Size", + margin: "Margin", + downscalePercent: "Downscale Percent", + landscape: "Landscape", + displayHeader: "Display Header", + displayFooter: "Display Footer", + openAfterExport: "Open after export", + cssSnippets: "CSS snippets" + }, + settings: { + showTitle: "Add file name as title", + displayHeader: "Display headers", + displayFooter: "Display footer", + printBackground: "Print background", + maxLevel: "Max headings level of the outline", + displayMetadata: "PDF metadata", + headerTemplate: "Header Template", + footerTemplate: "Footer Template", + isTimestamp: "Add timestamp", + enabledCss: "Enable select css snippets", + concurrency: "Limit concurrency", + debugMode: "Debug Mode" + } +}; + +// src/i18n/zh.ts +var zh_default = { + exportCurrentFile: "\u5BFC\u51FA\u5F53\u524D\u6587\u4EF6\u4E3APDF", + exportCurrentFileWithPrevious: "\u4F7F\u7528\u4E0A\u4E00\u6B21\u8BBE\u7F6E\u5BFC\u51FA\u4E3APDF", + exportDialog: { + filenameAsTitle: "\u5C06\u7B14\u8BB0\u540D\u4F5C\u4E3A\u6807\u9898", + pageSize: "\u7EB8\u5F20\u5C3A\u5BF8", + margin: "\u9875\u8FB9\u8DDD", + downscalePercent: "\u7F29\u653E", + landscape: "\u6A2A\u5411\u6253\u5370", + displayHeader: "\u9875\u7709", + displayFooter: "\u9875\u811A", + openAfterExport: "\u5BFC\u51FA\u540E\u6253\u5F00", + cssSnippets: "CSS\u4EE3\u7801\u7247\u6BB5" + }, + settings: { + showTitle: "\u5C06\u7B14\u8BB0\u540D\u4F5C\u4E3A\u6807\u9898", + displayHeader: "\u663E\u793A\u9875\u7709", + displayFooter: "\u663E\u793A\u9875\u811A", + printBackground: "\u6253\u5370\u80CC\u666F", + maxLevel: "\u6700\u5927\u6807\u9898\u7EA7\u522B", + displayMetadata: "PDF\u5143\u6570\u636E", + headerTemplate: "\u9875\u7709\u6A21\u677F", + footerTemplate: "\u9875\u811A\u6A21\u677F", + isTimestamp: "\u6587\u4EF6\u540D\u6DFB\u52A0\u65F6\u95F4\u6233", + enabledCss: "\u542F\u7528CSS\u7247\u6BB5\u9009\u62E9", + concurrency: "\u9650\u5236\u5E76\u53D1\u6570", + debugMode: "\u8C03\u8BD5\u6A21\u5F0F" + } +}; + +// src/i18n/index.ts +var i18n_default = { + i18n: { + en: en_default, + zh: zh_default + }, + get current() { + var _a3, _b3; + const lang = (_a3 = window.localStorage.getItem("language")) != null ? _a3 : "en"; + return (0, import_deepmerge.default)(this.i18n.en, (_b3 = this.i18n[lang]) != null ? _b3 : {}); + } +}; + +// src/modal.ts +var electron2 = require("electron"); +var fs2 = __toESM(require("fs/promises")); +var import_obsidian4 = require("obsidian"); +var import_path = __toESM(require("path")); + +// src/constant.ts +var PageSize = { + A0: [841, 1189], + A1: [594, 841], + A2: [420, 594], + A3: [297, 420], + A4: [210, 297], + A5: [148, 210], + A6: [105, 148], + Legal: [216, 356], + Letter: [216, 279], + Tabloid: [279, 432], + Ledger: [432, 279] +}; + +// src/pdf.ts +var import_electron = __toESM(require("electron")); +var fs = __toESM(require("fs/promises")); +var import_obsidian2 = require("obsidian"); + +// node_modules/.pnpm/tslib@1.14.1/node_modules/tslib/tslib.es6.js +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (b2.hasOwnProperty(p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); +}; +function __extends(d, b) { + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +var __assign = function() { + __assign = Object.assign || function __assign2(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + 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; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } +} +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r2 = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r2[k] = a[j]; + return r2; +} + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/base64.js +var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var lookup = new Uint8Array(256); +for (i = 0; i < chars.length; i++) { + lookup[chars.charCodeAt(i)] = i; +} +var i; +var encodeToBase64 = function(bytes) { + var base64 = ""; + var len = bytes.length; + for (var i = 0; i < len; i += 3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4]; + base64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6]; + base64 += chars[bytes[i + 2] & 63]; + } + if (len % 3 === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + return base64; +}; +var decodeFromBase64 = function(base64) { + var bufferLength = base64.length * 0.75; + var len = base64.length; + var i; + var p = 0; + var encoded1; + var encoded2; + var encoded3; + var encoded4; + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + var bytes = new Uint8Array(bufferLength); + for (i = 0; i < len; i += 4) { + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i + 1)]; + encoded3 = lookup[base64.charCodeAt(i + 2)]; + encoded4 = lookup[base64.charCodeAt(i + 3)]; + bytes[p++] = encoded1 << 2 | encoded2 >> 4; + bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2; + bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63; + } + return bytes; +}; +var DATA_URI_PREFIX_REGEX = /^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i; +var decodeFromBase64DataUri = function(dataUri) { + var trimmedUri = dataUri.trim(); + var prefix = trimmedUri.substring(0, 100); + var res = prefix.match(DATA_URI_PREFIX_REGEX); + if (!res) + return decodeFromBase64(trimmedUri); + var fullMatch = res[0]; + var data = trimmedUri.substring(fullMatch.length); + return decodeFromBase64(data); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/strings.js +var toCharCode = function(character) { + return character.charCodeAt(0); +}; +var toCodePoint = function(character) { + return character.codePointAt(0); +}; +var toHexStringOfMinLength = function(num, minLength) { + return padStart(num.toString(16), minLength, "0").toUpperCase(); +}; +var toHexString = function(num) { + return toHexStringOfMinLength(num, 2); +}; +var charFromCode = function(code) { + return String.fromCharCode(code); +}; +var charFromHexCode = function(hex) { + return charFromCode(parseInt(hex, 16)); +}; +var padStart = function(value, length, padChar) { + var padding = ""; + for (var idx = 0, len = length - value.length; idx < len; idx++) { + padding += padChar; + } + return padding + value; +}; +var copyStringIntoBuffer = function(str, buffer, offset) { + var length = str.length; + for (var idx = 0; idx < length; idx++) { + buffer[offset++] = str.charCodeAt(idx); + } + return length; +}; +var escapeRegExp = function(str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +}; +var cleanText = function(text2) { + return text2.replace(/\t|\u0085|\u2028|\u2029/g, " ").replace(/[\b\v]/g, ""); +}; +var escapedNewlineChars = ["\\n", "\\f", "\\r", "\\u000B"]; +var isNewlineChar = function(text2) { + return /^[\n\f\r\u000B]$/.test(text2); +}; +var lineSplit = function(text2) { + return text2.split(/[\n\f\r\u000B]/); +}; +var mergeLines = function(text2) { + return text2.replace(/[\n\f\r\u000B]/g, " "); +}; +var charAtIndex = function(text2, index2) { + var cuFirst = text2.charCodeAt(index2); + var cuSecond; + var nextIndex = index2 + 1; + var length = 1; + if ( + // Check if it's the start of a surrogate pair. + cuFirst >= 55296 && cuFirst <= 56319 && // high surrogate + text2.length > nextIndex + ) { + cuSecond = text2.charCodeAt(nextIndex); + if (cuSecond >= 56320 && cuSecond <= 57343) + length = 2; + } + return [text2.slice(index2, index2 + length), length]; +}; +var charSplit = function(text2) { + var chars3 = []; + for (var idx = 0, len = text2.length; idx < len; ) { + var _a3 = charAtIndex(text2, idx), c = _a3[0], cLen = _a3[1]; + chars3.push(c); + idx += cLen; + } + return chars3; +}; +var buildWordBreakRegex = function(wordBreaks) { + var newlineCharUnion = escapedNewlineChars.join("|"); + var escapedRules = ["$"]; + for (var idx = 0, len = wordBreaks.length; idx < len; idx++) { + var wordBreak = wordBreaks[idx]; + if (isNewlineChar(wordBreak)) { + throw new TypeError("`wordBreak` must not include " + newlineCharUnion); + } + escapedRules.push(wordBreak === "" ? "." : escapeRegExp(wordBreak)); + } + var breakRules = escapedRules.join("|"); + return new RegExp("(" + newlineCharUnion + ")|((.*?)(" + breakRules + "))", "gm"); +}; +var breakTextIntoLines = function(text2, wordBreaks, maxWidth, computeWidthOfText) { + var regex = buildWordBreakRegex(wordBreaks); + var words = cleanText(text2).match(regex); + var currLine = ""; + var currWidth = 0; + var lines = []; + var pushCurrLine = function() { + if (currLine !== "") + lines.push(currLine); + currLine = ""; + currWidth = 0; + }; + for (var idx = 0, len = words.length; idx < len; idx++) { + var word = words[idx]; + if (isNewlineChar(word)) { + pushCurrLine(); + } else { + var width = computeWidthOfText(word); + if (currWidth + width > maxWidth) + pushCurrLine(); + currLine += word; + currWidth += width; + } + } + pushCurrLine(); + return lines; +}; +var dateRegex = /^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/; +var parseDate = function(dateStr) { + var match = dateStr.match(dateRegex); + if (!match) + return void 0; + var year = match[1], _a3 = match[2], month = _a3 === void 0 ? "01" : _a3, _b3 = match[3], day = _b3 === void 0 ? "01" : _b3, _c2 = match[4], hours = _c2 === void 0 ? "00" : _c2, _d = match[5], mins = _d === void 0 ? "00" : _d, _e = match[6], secs = _e === void 0 ? "00" : _e, _f = match[7], offsetSign = _f === void 0 ? "Z" : _f, _g = match[8], offsetHours = _g === void 0 ? "00" : _g, _h = match[9], offsetMins = _h === void 0 ? "00" : _h; + var tzOffset = offsetSign === "Z" ? "Z" : "" + offsetSign + offsetHours + ":" + offsetMins; + var date = /* @__PURE__ */ new Date(year + "-" + month + "-" + day + "T" + hours + ":" + mins + ":" + secs + tzOffset); + return date; +}; +var findLastMatch = function(value, regex) { + var _a3; + var position = 0; + var lastMatch; + while (position < value.length) { + var match = value.substring(position).match(regex); + if (!match) + return { match: lastMatch, pos: position }; + lastMatch = match; + position += ((_a3 = match.index) !== null && _a3 !== void 0 ? _a3 : 0) + match[0].length; + } + return { match: lastMatch, pos: position }; +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/arrays.js +var last = function(array) { + return array[array.length - 1]; +}; +var typedArrayFor = function(value) { + if (value instanceof Uint8Array) + return value; + var length = value.length; + var typedArray = new Uint8Array(length); + for (var idx = 0; idx < length; idx++) { + typedArray[idx] = value.charCodeAt(idx); + } + return typedArray; +}; +var mergeIntoTypedArray = function() { + var arrays = []; + for (var _i = 0; _i < arguments.length; _i++) { + arrays[_i] = arguments[_i]; + } + var arrayCount = arrays.length; + var typedArrays = []; + for (var idx = 0; idx < arrayCount; idx++) { + var element2 = arrays[idx]; + typedArrays[idx] = element2 instanceof Uint8Array ? element2 : typedArrayFor(element2); + } + var totalSize = 0; + for (var idx = 0; idx < arrayCount; idx++) { + totalSize += arrays[idx].length; + } + var merged = new Uint8Array(totalSize); + var offset = 0; + for (var arrIdx = 0; arrIdx < arrayCount; arrIdx++) { + var arr = typedArrays[arrIdx]; + for (var byteIdx = 0, arrLen = arr.length; byteIdx < arrLen; byteIdx++) { + merged[offset++] = arr[byteIdx]; + } + } + return merged; +}; +var mergeUint8Arrays = function(arrays) { + var totalSize = 0; + for (var idx = 0, len = arrays.length; idx < len; idx++) { + totalSize += arrays[idx].length; + } + var mergedBuffer = new Uint8Array(totalSize); + var offset = 0; + for (var idx = 0, len = arrays.length; idx < len; idx++) { + var array = arrays[idx]; + mergedBuffer.set(array, offset); + offset += array.length; + } + return mergedBuffer; +}; +var arrayAsString = function(array) { + var str = ""; + for (var idx = 0, len = array.length; idx < len; idx++) { + str += charFromCode(array[idx]); + } + return str; +}; +var byAscendingId = function(a, b) { + return a.id - b.id; +}; +var sortedUniq = function(array, indexer) { + var uniq = []; + for (var idx = 0, len = array.length; idx < len; idx++) { + var curr = array[idx]; + var prev = array[idx - 1]; + if (idx === 0 || indexer(curr) !== indexer(prev)) { + uniq.push(curr); + } + } + return uniq; +}; +var reverseArray = function(array) { + var arrayLen = array.length; + for (var idx = 0, len = Math.floor(arrayLen / 2); idx < len; idx++) { + var leftIdx = idx; + var rightIdx = arrayLen - idx - 1; + var temp = array[idx]; + array[leftIdx] = array[rightIdx]; + array[rightIdx] = temp; + } + return array; +}; +var sum = function(array) { + var total = 0; + for (var idx = 0, len = array.length; idx < len; idx++) { + total += array[idx]; + } + return total; +}; +var range = function(start, end) { + var arr = new Array(end - start); + for (var idx = 0, len = arr.length; idx < len; idx++) { + arr[idx] = start + idx; + } + return arr; +}; +var pluckIndices = function(arr, indices) { + var plucked = new Array(indices.length); + for (var idx = 0, len = indices.length; idx < len; idx++) { + plucked[idx] = arr[indices[idx]]; + } + return plucked; +}; +var canBeConvertedToUint8Array = function(input) { + return input instanceof Uint8Array || input instanceof ArrayBuffer || typeof input === "string"; +}; +var toUint8Array = function(input) { + if (typeof input === "string") { + return decodeFromBase64DataUri(input); + } else if (input instanceof ArrayBuffer) { + return new Uint8Array(input); + } else if (input instanceof Uint8Array) { + return input; + } else { + throw new TypeError("`input` must be one of `string | ArrayBuffer | Uint8Array`"); + } +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/async.js +var waitForTick = function() { + return new Promise(function(resolve) { + setTimeout(function() { + return resolve(); + }, 0); + }); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/unicode.js +var utf16Encode = function(input, byteOrderMark) { + if (byteOrderMark === void 0) { + byteOrderMark = true; + } + var encoded = []; + if (byteOrderMark) + encoded.push(65279); + for (var idx = 0, len = input.length; idx < len; ) { + var codePoint = input.codePointAt(idx); + if (codePoint < 65536) { + encoded.push(codePoint); + idx += 1; + } else if (codePoint < 1114112) { + encoded.push(highSurrogate(codePoint), lowSurrogate(codePoint)); + idx += 2; + } else + throw new Error("Invalid code point: 0x" + toHexString(codePoint)); + } + return new Uint16Array(encoded); +}; +var isWithinBMP = function(codePoint) { + return codePoint >= 0 && codePoint <= 65535; +}; +var hasSurrogates = function(codePoint) { + return codePoint >= 65536 && codePoint <= 1114111; +}; +var highSurrogate = function(codePoint) { + return Math.floor((codePoint - 65536) / 1024) + 55296; +}; +var lowSurrogate = function(codePoint) { + return (codePoint - 65536) % 1024 + 56320; +}; +var ByteOrder; +(function(ByteOrder2) { + ByteOrder2["BigEndian"] = "BigEndian"; + ByteOrder2["LittleEndian"] = "LittleEndian"; +})(ByteOrder || (ByteOrder = {})); +var REPLACEMENT = "\uFFFD".codePointAt(0); +var utf16Decode = function(input, byteOrderMark) { + if (byteOrderMark === void 0) { + byteOrderMark = true; + } + if (input.length <= 1) + return String.fromCodePoint(REPLACEMENT); + var byteOrder = byteOrderMark ? readBOM(input) : ByteOrder.BigEndian; + var idx = byteOrderMark ? 2 : 0; + var codePoints = []; + while (input.length - idx >= 2) { + var first = decodeValues(input[idx++], input[idx++], byteOrder); + if (isHighSurrogate(first)) { + if (input.length - idx < 2) { + codePoints.push(REPLACEMENT); + } else { + var second = decodeValues(input[idx++], input[idx++], byteOrder); + if (isLowSurrogate(second)) { + codePoints.push(first, second); + } else { + codePoints.push(REPLACEMENT); + } + } + } else if (isLowSurrogate(first)) { + idx += 2; + codePoints.push(REPLACEMENT); + } else { + codePoints.push(first); + } + } + if (idx < input.length) + codePoints.push(REPLACEMENT); + return String.fromCodePoint.apply(String, codePoints); +}; +var isHighSurrogate = function(codePoint) { + return codePoint >= 55296 && codePoint <= 56319; +}; +var isLowSurrogate = function(codePoint) { + return codePoint >= 56320 && codePoint <= 57343; +}; +var decodeValues = function(first, second, byteOrder) { + if (byteOrder === ByteOrder.LittleEndian) + return second << 8 | first; + if (byteOrder === ByteOrder.BigEndian) + return first << 8 | second; + throw new Error("Invalid byteOrder: " + byteOrder); +}; +var readBOM = function(bytes) { + return hasUtf16BigEndianBOM(bytes) ? ByteOrder.BigEndian : hasUtf16LittleEndianBOM(bytes) ? ByteOrder.LittleEndian : ByteOrder.BigEndian; +}; +var hasUtf16BigEndianBOM = function(bytes) { + return bytes[0] === 254 && bytes[1] === 255; +}; +var hasUtf16LittleEndianBOM = function(bytes) { + return bytes[0] === 255 && bytes[1] === 254; +}; +var hasUtf16BOM = function(bytes) { + return hasUtf16BigEndianBOM(bytes) || hasUtf16LittleEndianBOM(bytes); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/numbers.js +var numberToString = function(num) { + var numStr = String(num); + if (Math.abs(num) < 1) { + var e = parseInt(num.toString().split("e-")[1]); + if (e) { + var negative = num < 0; + if (negative) + num *= -1; + num *= Math.pow(10, e - 1); + numStr = "0." + new Array(e).join("0") + num.toString().substring(2); + if (negative) + numStr = "-" + numStr; + } + } else { + var e = parseInt(num.toString().split("+")[1]); + if (e > 20) { + e -= 20; + num /= Math.pow(10, e); + numStr = num.toString() + new Array(e + 1).join("0"); + } + } + return numStr; +}; +var sizeInBytes = function(n) { + return Math.ceil(n.toString(2).length / 8); +}; +var bytesFor = function(n) { + var bytes = new Uint8Array(sizeInBytes(n)); + for (var i = 1; i <= bytes.length; i++) { + bytes[i - 1] = n >> (bytes.length - i) * 8; + } + return bytes; +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/errors.js +var error = function(msg) { + throw new Error(msg); +}; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/utils.js +var import_pako = __toESM(require_pako()); +var chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var lookup2 = new Uint8Array(256); +for (i = 0; i < chars2.length; i++) { + lookup2[chars2.charCodeAt(i)] = i; +} +var i; +var decodeFromBase642 = function(base64) { + var bufferLength = base64.length * 0.75; + var len = base64.length; + var i; + var p = 0; + var encoded1; + var encoded2; + var encoded3; + var encoded4; + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + var bytes = new Uint8Array(bufferLength); + for (i = 0; i < len; i += 4) { + encoded1 = lookup2[base64.charCodeAt(i)]; + encoded2 = lookup2[base64.charCodeAt(i + 1)]; + encoded3 = lookup2[base64.charCodeAt(i + 2)]; + encoded4 = lookup2[base64.charCodeAt(i + 3)]; + bytes[p++] = encoded1 << 2 | encoded2 >> 4; + bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2; + bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63; + } + return bytes; +}; +var arrayToString = function(array) { + var str = ""; + for (var i = 0; i < array.length; i++) { + str += String.fromCharCode(array[i]); + } + return str; +}; +var decompressJson = function(compressedJson) { + return arrayToString(import_pako.default.inflate(decodeFromBase642(compressedJson))); +}; +var padStart2 = function(value, length, padChar) { + var padding = ""; + for (var idx = 0, len = length - value.length; idx < len; idx++) { + padding += padChar; + } + return padding + value; +}; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Courier-Bold.compressed.json +var Courier_Bold_compressed_default = "eJyFWdtyGjkQ/RVqnnar8Bb4lpg3jEnCxgEvGDtxKg9iphm01oyILrZxKv++mrGd3az6KC8UnNa0+nrUGr5lI11VVLtskF198FaU1Dns9w9OOkf7/ePDrJu90bWbiorCgpH2RpLZO9WqaCReqZ8lnReJqKTa/SwL8DXJctPs9Lxs4oSS+bAuVVjXC7/tG/lAxYV0+SYbOOOpm402wojckVlQ8+T4wVFdUDHXlaifrTs91Q/Z4PNeMLu7t3/U6746POm+7vW/dLNlWGuUrOlCW+mkrrPBXr/X+4/gciPz25qszQbhyeyKjG2XZb3ewR+9Xi/sMdVO5k+ebHemcaHzW/57p3/y+qQbPk967We//TxoP191hoVeUWexs44q25nUuTZbbYSj4o9OZ6hUZ97osZ05WTJ3AQ37jMOqQtblIt9QG7lWycKJuhCmeJGGhSOxffccyqPj/W728eXX4cFJNxvavAmRyQbH++HnGf34vdc/etXNFq54d50NXh+2X6/C137v+CnQH8gZmYdQfP6WXX8MCppQTYMlditCBL53/wfTQ65EFeNfvQ6erlQsqX21akJc1rGs0EoJE+NbMnlToZFAVEFkQ3iABW2uGH3CUK1ojUTgMWEbjfaWeUp5G6N5aCwRw5vddkOM98EVqRlPrBJ2E8OPZHSM6prJkrtnVrqNIWbtOjQrg8o7Zq2VDwxId5x3xMe0lpzBuVaa0WGpkkCkmgaON/3qBVODpaHQiIybXz3ZliTi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YhEJmTFsk6pWvyPfJOj4HiXNGFFQJw1hOCVaYgChNUOGcA6tD0DZCMSdDczMBDa5TFVWDqWn5i/yB+BByqARcGhx6ziqXVD4Ii2TqZmnLi8AS3L8dGqRoBIzwkM0LmXNpOAOKTNKbKciPBvg8XdZJ6RDoHEKO5meuGdDzmOiQMTrt0d63SVfAIDBJtgIwwaUvN7ps8l1r7v0I5lKPRUEV+rcqfaHlDvJH4FSdVBVCjk8IiXp87Jv/Ib90s/dk6gshTfPv8Zfv/wDUfBK2"; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Courier-BoldOblique.compressed.json +var Courier_BoldOblique_compressed_default = "eJyFWdtyGjkQ/RVqnnarcAo7vuE3jEnCxgEvGDtxKg9iRgxaa0ZEF9s4lX/fnrGdTVZ9lBcKTmvU96PW8C0bmqqStc9OsqsPwYlSdnaPDvb6naP+3v5+1s3emNpPRCVpwdAEq6TdOTW6mC61+hpksyBo/euCTrOg89MKUSm9/XUNwddSletGcbOcfo+90Cof1KWmdTu7e4S4N+pBFhfK5+vsxNsgu9lwLazIvbRz2Tw7evCyLmQxM5Won809PTUP2cnnnYOj7s7eQa97fNjvHvd2v3SzBS21WtXywjjllakbRb3eT4LLtcpva+lcdkJPZlfSunZZ1uu9ftXr9UjFxHiVP7my2drGh84f+Z+d3f5xv0uf/V77udt+vm4/jzqDwixlZ751XlauM65zYzfGCi+LV53OQOvOrNnHdWbSSXtHKOkZ0apC1eU8X8s2dO0mcy/qQtjiRUoLh2Lz7jmWB4cUto8vv/Zf97vZwOVNhGx2crhHP8/kj987uxShbO6Ld9fZyfF++/WKvu72Dp/i/EF6q3IKxedv2fVH2qAJ1YQscRtBEfje/R8sH3Itqhj/Ggx5utSxpA7VsglxWceywmgtbIxvpM2bio0EoiKRo/AAC9pcMfsJK2stV0gEHhOu2dHdMk/p4GI0p0YTMbzebtaS8Z5cUYbxxGnh1jH8KK2JUVMzWfL3zEq/tpJZu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dSeyZXnidpf28SjIhNq5hXGgpYZNJz5giFvgATTsvjVMCWCpkxbZ6oV74i3yfr+BwkzltRyEpYxnKZYIUxiNIYFc45sJqCthaaORmamwlocJOqqBpMTYvf5A/ERyKHSsCl5NBzVrmk8kGYJ1M3TVteEEtw/3YYkKIhMCJANi9UzqXhDGxkk95MQH4MwGfpsk5KB2DPAeRofuaagn0eEx0yQqc90n2bdAUMAuNkKwATfPpyY8om37Xh3o9gLg1YRFuhf6vSF1ruIH8ETtXJrSjk+IRQqMdHofkf8ks3ey9tfSGUbf49/vL9XxrnGMA="; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Courier-Oblique.compressed.json +var Courier_Oblique_compressed_default = "eJyFWVtT2zgU/isZP+3OhE5Iy/UtDaHNFhI2IdDS4UGxFUeLbKW6AKHT/77Hhnbb1fnUFw98x9K5fzpyvmZDU1Wy9tlxdnUenChlZ3e//+awc7B32D/Kutmpqf1EVJJeGJpglbQ706VWX4JshEHrX4Wdn4SiUnr7q5jga6nKdaPvXBYqVISMvdAqH9Slpjd3dvuEuFP1KIsL5fN1duxtkN1suBZW5F7auWxWjx69rAtZzEwl6hc73741j9nx553+QXenv9frHr456h729m672YJetVrV8sI45ZWpG0W93k+Cy7XK72rpXHZMK7MraV37WtbrvX7V6/VIxcR4lT87s9naxovOH/mfnd2jw6MuPY967XO3ffbb5+v2edAZFGYpO/Ot87JynXGdG7sxVnhZvOp0Blp3Zs1urjOTTtp7QknbiN4qVF3O87VsQ9huMveiLoQtvkvpxaHYvH+J6d4+Be/j9//e9Pe72cDlTZxsdrzfP+pmJ/LH/zu7ewfdbO6L99e0crf98+rlzybY59JblVM8Pn/Nrj/S+iZeEzLEbQSF4Vv3f7B8zLWoYvxLMOToUseSOlTLJs5lHcsKo7WwMb6RNm/qNRKIikSOogMsaBPG7CesrLVcIRFYJlyzo7tjVungYjSnNhMxvN5u1pLxnlxRhvHEaeHWMfwkrYlRUzNZ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1BrIN1TlBF09KBMOaQZOzFNjiXAwxOpPZMrz5O0fzAJRsSmVcwnDQUsMuk5c4RCX4AJp+VxKmBLhcyYNk/UK1+RH5J1fAYS560oZCUsY7lMsMIYRGmMCucMWE1BWwvNnAzNzQQ0uElVVA2mpsVv8gfiI5FDJeBScuglq1xS+SDMk6mbpi0viCW4XzsMSNEQGBEgmxcq59JwAjaySW8mID8G4LN0WSelA7DnAHI0P3NNwT5PiQ4ZodMe6b5LugIGgXGyFYAJPn25MWWT79pw30cwlwYsoq3Qr1XpCy13kD8Bp+rkVhRyfEIo1OOj0PwOedvNPkhbXwhlm1+Pb7/9C/NFF2U="; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Courier.compressed.json +var Courier_compressed_default = "eJyFWdtSGzkQ/RXXPO1WmZSBEAJvjnESb8AmGENCKg+ypj3Wohk5ugAmlX9fzUCyW6s+ysuUfVqXvh61Zr4XI1PX1PjiuLg6C05U1Ns/Ojx42TsYHB4eFf3irWn8VNQUB4xMsIpsCwatU1DUSm8T+JpUtW7XP6NShToiEy+0ksOm0nHkIP53b9UDlefKy3Vx7G2gfjFaCyukJzundu74wVNTUnlhatE8a/XmjXkojr/s7O33d/YOBv3D3YP+68HB136xiEOtVg2dG6e8Mk1xvLM7GPxHcLlW8rYh54rjOLO4Iuu6YcVgsP9iMBjELabGK/lkymZrWxt6f8g/e7tHr4/68Xk06J673XOve+53z8PesDRL6s23zlPtepNGGrsxVngqX/R6Q617F+1qrndBjuxdRONu4ziqVE01l2vqHNgtMveiKYUtf0rjwJHYvH/26MGrvX7x6ee/l3uv+sXQydZPtjh+tXfUL07o1/+d3YPDfjH35fvrOHO3+3n1/LN19hl5q2T0x5fvxfWnOL/11zQq4jYiuuFH/38wPUgt6hT/Fkw0dKlTSRPqZevnqkllpdFa2BTfkJVtdiYCUUeRi94BGnQBY9YTlhpNKyQC04RrV3S3zCwdXIrKWFQihdfbzZoY66MpyjCWOC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k5XAwY+oNNDeMxQRdPSgSDm0MzZilm1LgIUnpD0TK8+TtL83GUbEqtXMKw0FNDL5PnOMXF+CDqfj8ZjANiYyo9o8k698Rn7I5vEpCJy3oqRaWEZzyrDCBHhpghLnFGgdnbYWmjkZ2psJKHCTy6gGdE2L38QP+IeQQRXg0mjQc1S5oPJOmGdDN8trXkaW4L52GBCiEVAiQDYvleTCcAIWsllrpiA+BuAX+bTOSodgzSHkaL7nmoF1HjMVMkanPdr7NmsKaAQm2VIAKvj85cZUbbwbw70fwVwasCguhb5W5S+03EH+CIxqsktFl+MTQqEaH4f2O+TXfvGBbHMulG2/Hn/98Q/b2xEO"; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Helvetica-Bold.compressed.json +var Helvetica_Bold_compressed_default = "eJyNnVtzG0eyrf8KA0/7RMhzJJK6+U2+zMX2mJYsEuJMzANEtihsgYQMEITaO/Z/P41CV+bKlaug86JQf6uArsrKXNVX8H8m3y9vb7u7+8m3k4t/btazm+7o5PmTZy+PTl88eXk6eTT56/Lu/tfZbTc0+Hu3eOju51ezb75bLq532maxYO2oarPb+aJndRCm3fzm425/Y8N/3M8W86tXdzeLoeXjYXv91/mX7vq3+f3Vx8m396tN92jy/cfZanZ1361+73af/PHLfXd33V2/Wd7O7sY+fvfd8svk239/8+T540ffHB+/ePTk8eOTRy+fHf/n0eR8aLxazO+635br+f18eTf59ptBBuHtx/nVp7tuvZ58+3TgF91qXZpNHj8+/svjx4+Hnfy6HAawG8z3y8/9ajeGo/+6+j9HT16+ePpo9+/z8u/L3b8vH5d/nx+9ul6+745+79f33e366B93V8vV5+Vqdt9d/+Xo6NVicfRm9z3rozfduls9DNTDOF8fzY7uV7Pr7na2+nS0/HD0y/xued9/7r4ZGi2OXv3taHZ3/X+Xq6P58AXrzfv1/Ho+W8279V+Gzv447Op6fnfz+9XHrsxA6cnv98NHZqvrqg4Nv599/vs4Ic+fvHg0eVe3np4cP5q8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LIiMET1XRdEzCpDlFrGKb+MqyQzMWeaSZRuxjnnTODEMyFmn2FKQb7MQqGAdDBEGWmc0tK5yE0Tc4K6lLPUNEpV45yvJnDShms3TyOi9G1cuyExJ3K+dkNcp7S4dkMCJXe+dhM5pzncpINMR0rJjhLlO0oq5VHPWY8qJT5KnPuocfqjFisAFSqC/C6IiBWkG1KqBpSoIIIkagL1XBZBzZWBMhUHSlwfqHGJgAZVgpQKBSVVK6jnckGVKgYlXTTYgusGNSodlKh6xGtAY1L8OYHnmP+EHAASnlj+k2ccMJ9n/UnzCzQ8hfwnziag+Lzxn+DjTGKn2cUTzt0XHp6UNBB2cMY0pOTfI68nm10mcVyG47gc53GZlsblShqXSXFchmlcxmlc+JJUp2kcX5DiGKOUxxn0NNaopvEGOY45SDTuoMHY//O//w/7Vd1G"; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Helvetica-BoldOblique.compressed.json +var Helvetica_BoldOblique_compressed_default = "eJyNnVtzG0eyrf8KA0/7RMhzRIq6+U2+zMX2mJYsEuJMzANEtihsgYQMEITaO/Z/P41CV+bKlaug86JQf6uArsrKXNVX8H8m3y9vb7u7+8m3k4t/btazm+7o+PT0xcnRsxdPXzybPJr8dXl3/+vsthsa/L1bPHT386vZN98tF9dn7xfzPzbdrslmseAmR7smR9Bmdjtf9NxqEKbd/Objbve7Dwzb/7ifLeZXr+5uFkPLb45PBrL+6/xLd/3b/P7q4+Tb+9WmezT5/uNsNbu671a/d7vP/vjlvru77q7fLG9nd2Onv/tu+WXy7b+/OX5++uibk5MXj46Pj08fvXx28p9Hk/Oh8Woxv+t+W67n9/Pl3W5Xjx+D8Pbj/OrTXbdeT759OvCLbrUuzSaPH5/85fHjx8NOfl0OQ9gN5/vl5361G8XRf139n6Pjly+ePtr9+7z8+3L378vH5d/nR6+ul++7o9/79X13uz76x93VcvV5uZrdd9d/OTp6tVgcvdl9z/roTbfuVg8D9YDO10ezo/vV7Lq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e7nHsaXquruB416MguqNRGN3M6MdaeeJbMa96rBVAItV6qhWgMdX6UCvA/Cf8nI21AiTmWJ9qpQ/z0Od56PM89I156OU89Hoe+jwPvZiHvjEPpQie2pYVgaNYBM6xCJxaETjiInDFi8CZFYEjKwJDVN91QcSsMkSpZZzyy7hKMhNzpplE6Wacc84ETjwTYvYZphTkyywUCkgHQ5SRxiktnYvcNDEnqEs5S02jVDXO+WoCJ224dvM0IkrfxrUbEnMi52s3xHVKi2s3JFBy52s3kXOaw006yHSklOwoUb6jpFIe9Zz1qFLio8S5jxqnP2qxAlChIsjvgohYQbohpWpAiQoiSKImUM9lEdRcGShTcaDE9YEalwhoUCVIqVBQUrWCei4XVKliUNJFgy24blCj0kGJqke8BjQmxZ8TeI75T8gBIOGJ5T95xgHzedafNL9Aw1PIf+JsAorPG/8JPs4kdppdPOHcfeHhSUkDYQdnTENK/j3yerLZZRLHZTiOy3Eel2lpXK6kcZkUx2WYxmWcxoUvSXWaxvEFKY4xSnmcQU9jjWoab5DjmINE4w4ajP0///v/AGoZ428="; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Helvetica-Oblique.compressed.json +var Helvetica_Oblique_compressed_default = "eJyNnVtzG8mxrf+KAk/nRGh8eBWleZPnItsaD0dXWNvhB5BsUdgC0TLAFgjt2P/9AI2uzJUrV7X8olB/q4CuyspaVX0p8H8mP7V3d83yfvLj5P3fu/Xstnl0fPbsydGjJ89Oz55MHk9+bZf3v8/uml2BvzSLr839/Hr2w+XVYv7vrtnL3WLB8iOQZ3fzxZYL7IRpM7/9tD/r35ubeXe3I3+9ny3m18+Xt4td2R+OT3Zk/ev8obn5Y35//Wny4/2qax5Pfvo0W82u75vVm2b/6V8e7pvlTXPzur2bLYfa/vnP7cPkx3/+cHxx9PiHk5Pzx8fHx08ePzs9/tfjybtd4dVivmz+aNfz+3m73J/q6AiEt5/m15+XzXo9+fF8x983q3VfbHJ0dPKno6Oj3Ul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JtTi1ApUaaDMYhPrDeF8Nq6T2uRaWzi9jVf6NiU6vDINuY6UIoASZTxKKj6o5xChSlFCiSOBGncsanEMoEKhUr+rkYOlP8DjASUaEkEaD5YYGEHNYwPleizTCEFtJJatpvW2y9GC+mgDecygpIcNlhhpIw8elOpJwUPoW1mvnttRXIN/C+tVQHkN/o3Xq0Bxveo4Ls2/xfWqM1qafyvrVT/KdW4rFWxlBdtck7RedUXU0derjuK1wjeciRhR/dNMlLhonJqJkpT7Ic1EzLm1eSYioRWo0kDZS2omYqlS2Uqn5ZmIBeq+NBMNvNyvUoiaaJz60Llouom56S7lPjSNwmKc220C92ERWoEqDZR9aGK9IdyHxnUfmlxrC/ehcepD/BWkGqamBo36M2oiFKFADkeUc98GnUIWNI5LELmfUWwreCQIss9DgfGGct8HTfd/KDLWVs6DoEEu/Ot//z8nhUqv"; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Helvetica.compressed.json +var Helvetica_compressed_default = "eJyNnVtzG8mxrf+KAk/nRGh8eBWleZPnItsaj0ZXWNvhB5BsUdgE0TLAFgjt2P/9AI2uzJUrV7X8olB/q4CuyspaVX0p8H8mP7V3d83yfvLj5MPfu/Xspnl0enH05Nmjs6dHz84mjye/tsv732d3za7AX5rF1+Z+fjXb426xUHh2N19shTBt5jef92f5e3M97+525K/3s8X86vnyZrEre7Q7Xv86f2iu/5jfX32e/Hi/6prHk58+z1azq/tm9bbZf/aXh/tmed1cv2nvZsuhbn/+c/sw+fGfPxw/efL4h5OT88fHR0dHj5+dHv/r8eT9rvBqMV82f7Tr+f28XU5+/GEng/Du8/zqdtms15Mfz3f8Q7Na98UmR0cnf9p90e4kv7e7Juyb81P7Zbvat+LR/7n6v4+Onz09f7z/96L/99n+32dH/b8Xj55ft5fNo7fb9X1zt3701+VVu/rSrmb3zfWfHj16vlg8erP/nvWjN826WX3dUQvVo/n60ezR/Wp23dzNVreP2k+Pfpsv2/vtl+aHXaHF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KIhEaTxYImBEdQ8NlCuxzKNENRGYtlqWm+7HC2ojzaQxwxKethgiZE28uBBqZ4UPIS+lfXquR3FNfi3sF4FlNfg33i9ChTXq47j0vxbXK86o6X5t7Je9aNc57ZSwVZWsM01SetVV0Qdfb3qKF4rfMOZiBHVP81EiYvGqZkoSbkf0kzEnFubZyISWoEqDZS9pGYiliqVrXRanolYoO5LM9HAy/0qhaiJxqkPnYumm5ib7lLuQ9MoLMa53SZwHxahFajSQNmHJtYbwn1oXPehybW2cB8apz7EX0GqYWpq0Kg/oyZCEQrkcEQ5923QKWRB47gEkfsZxbaCR4Ig+zwUGG8o933QdP+HImNt5TwIGuTCv/73/wO+9kRf"; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Times-Bold.compressed.json +var Times_Bold_compressed_default = "eJyFnVtzG0eShf8KA0+7EfKseJXkN9nj0Vj0yNaNEHZiHkCySWEJsmmAIA1PzH/fRqMr8+TJU9CLQv2dYqMrK/NU9Q349+jH9va2uXsYfT86+8dqOb1u9o72Tw5P9o4PTk72R89Gf2vvHt5Nb5uuwafZbbP87od2frnhq/kc+V7h09vZfI1KB8fN7Prr5jOGRj8/TOezi9d31/Ou1fNue/m32R/N5W+zh4uvo+8fFqvm2ejHr9PF9OKhWXxsNn/50x8Pzd1lc/mhvZ3eDcf1ww/tH6Pv//nd/snLZ98d7L98tv/8+fNnrw6P//Vs9LlrvJjP7prf2uXsYdbejb7/rpNB+PR1dnFz1yyXo++PO37WLJZ9s9Hz5wd/6XbUfci79mF2senIj+39erHpw95/Xfz33v6rl8fPNv++6P99tfn31fP+38P+3xd7ry/b82bv43r50Nwu936+u2gX9+1i+tBc/mVv7/V8vvdhs7fl3odm2SweO7oN4my5N917WEwvm9vp4mavvdr7ZXbXPqzvm+/+3nR/9frN3vTu8n/axd6s++Pl6nw5u5xNF7Nm+ZfucH/qPuZydnf98eJr08e/P4qPD92fTBeXRe0a/ji9//swJCcvTp6Nv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Pm7rsbJJt9KhOQFu6/GyUa7cyG5Q+VqnFLva8Oc/SLIv9d26N4xnNj1Fxm2l2qMlKATtq+0iji+HBA1fEEgKvaSQMT+OkDk/kpA5OW1gEjtG6oC/jQqr3MasRNnwuIV0CJuvk37KOx3nNpM0mdPdEwnKUDdAMFPCvVb8XpPj6JN9Ehc3+l5uq7T03g9p0d0HadndP2mZ+G6TU/i9ZpHmBS8T1Fvcp/ojsNjNnrnsk/ihsJj8HFHoqt8v+Cx2JJv5WPmFx+NywNs85Hktx5NEcfYxvfRHoN9GDJreNGjpzQcT6FrT7lrT5WuPcmuPeWuPVW79iS69pS79pS79pS7tk5dW4dMW+dMW+dMW1cybS0zba0zbZ0zbS0ybS0ybT3Ce+prHA5A4p76moYDaLynvhbDAQrdU1/jcACK99TXYjj4wscwJuHCR2zJo5MvfDAX4yQvfLCURyxf+CDOYycufEQBRjFdHmCuxlNdHmCJRrZ2eYBlHuN0eYA5jXa6FjAMuXh2cRh1fnYxteexl08uCklkQOW5RaXmPFCPLQqJs0E/tpg0yAn1MKGQVGZUHiUUKuXHjgcJRQvOEvUYoZAoV9RDhF26/Os//w8s8zdF"; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Times-BoldItalic.compressed.json +var Times_BoldItalic_compressed_default = "eJyFnV9TG0myxb8K0U/3RjC7NgZj5o0ZZnYGz5pZGyH3bsyDEA3oImhWfxCajf3ut1Xqyjx5Mkt+cbh/p9RdlZV1qrrVJf5T/dg+PjZPi+r76urvy/nortk7PPpwfLh39P7DyUm1X/3cPi0+jR6brsDl5LGZf/dDO735dTGaTsYbdTmdorq3UfdUHj1Opmss0MFhM7m731xwU7Y73pY+fbqbdqW+e3vUkfnPk9fm5vfJYnxffb+YLZv96sf70Ww0XjSzL83msz+9Lpqnm+bmc/s4euqr+cMP7Wv1/b++O3jzZv+7g7cf9k9O3u+fHLz9Y78adGVn08lT83s7nywm7dPmSl0xFS7vJ+OHp2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28g+VRFjVKR/tTQj+gt0t9TV2+njoQ/HNjgPGA5A9hcKHtwkDNx9cf/A8QRsv89/MHMsMPod9wcT6Acf6IdCoB94PlNqw/9QDP+DnbSU2S558F1iRygGvfDOf6xSV+x65z8u4jtoxzv/cQnqttI7/7HMnenfvw/jxV286/37uIjv+ML797Eap0Pp/ftYpiQpvH+/VTeO9yLz8FP2YEDZgxGZM4KQf3lQUdsfbb/t3Rxt3gg/kCMN5OZobY9sZyTkwttilfurZASXyujVf3AdILqycH95Mx9BHQyHihj+WjjPusSpXlb0lYNJEaoGFCoG9DU8wzqmVCWUfIXyxAu1yQiqktGr/+A6QFQD4f7y9LYo1IIUqAwpr8WzrcsK1ZBlX1FZjUAVhUHlhL0Gn11HjKqigq9E/g1YqENGUIWMXv0H1wGi60d/5qmX0Ez6y2cEl8/o1X9wHSC6vHB3+byuKSxrrWy1hKbN7SLL2//3N4r4gepG2mbxePtH7yPNXDA45Sz+mGyRijR5DhJpdsnvS8zjeszt80yr5QuGWr7diFVTnajE82hcuKxugLI42gFmSmgKdtGV9f97IbII7hF/j0KYi/MvLBB2xcM9n6FIH+1js/37SseG2Bd5BMtfV7I42LcmGi79rGJ3qgmm3WfC6UUi4Wa/mVB5w9bgzW9zbd/azGToSO2J5K7F+MwvKS/QAdsLv/Sr7m26vOBSG5AdcC9uUQ3cvZn3wstnwPaFvRezUAamd5jCWnvk69wWKtiGFWx9TdzaVpWgjq19dfDFLF0FSX5vg9/NC5Xemacja/gJ2VfLEwoW9om7aSFRu4RPiJbkidF9fGLmN3wTsevxlUuoVYWPElaVe5SwMgkFKG5TE7YpeBaxMgmlKGgqP7JYmYRa+YRaFRJqFSbUyifUqphQqyChVj6hVj6hVj6hXk3wX33wX33wXwvBfw2D/xoH/9UH/zUI/msQ/LVLobVv2JqnKMJcPPgKxiv4oT/++/9jjgIE"; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Times-Italic.compressed.json +var Times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3HCbwF0PkL8bJX5yzv7gi/SWs9KDLRIG9JqrsOFGVvhOTCPeJCdiDopqcKMrJj6JMrhRF9qb4jATKMArsA1FlNyA1eZZ+MFMqVFAvaz9LLpbWp7VwMCfJ1w6sT+skwuPq69M6BftdZX1ay8n70gMdLbAPHnqgI9MkT0wL4yeqyiV/PLAwrpMIr9QL41qt+GZlYVzL7KF6YVyq2U+D/Hst3OitUWCHjSr7LKnJbUkXnjstBo2vbe03DBixW4nY7DVi8RV509BQoxK/G2+YvgVv3L0z8mKakcaPwhf8WyYWVsIxXkHc/UG2/R+tLWT3l9hOQkx3f4LtLKSxv71GGAK0V+7BWvcvjdxjddujh5ToISfaQqL9Bzy2mGhCPNElzMnF9r2s4I/+/b//H63X5Vs="; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Times-Roman.compressed.json +var Times_Roman_compressed_default = "eJyFnVtzG0mOhf+Kgk+7Ee5ZSdbN/aa+ebzuMdvupmjORD9QUlnmmmJpSMoSZ2L++9YNwMEBkn5xuL6TdUkkgLxUFvXv0Y/1/X212o6+H1397XEzv6sOTl6+Onx1cHry6uXJ6MXol3q1fTe/r5oCfyzuq813H+r7+aoVHpdLFA5UmN8vljuUGjitFnef27tIqTfb+XJxc7m6WzbFDpvjzS+L5+r2t8X25vPo++36sXox+vHzfD2/2Vbr36v21J+ft9XqtrrVGzWP9sMP9fPo+398d3R28eK746OLF0eHh4cvLl5d/PliNGkKr5eLVfVbvVlsF/Vq9P13jQzCH58XN19W1WYz+v604VfVetMVGx0eHv+luVBzk3f1dnHT1uTH+mG3bitx8F83/31w9Ori9EX773n376v231eH3b8vu3/PDy5v6+vq4PfdZlvdbw7erG7q9UO9nm+r278cHFwulwcf2qs1dqs21fprQ3szLjYH84Pten5b3c/XXw7qTwe/Llb1dvdQfffXqjnr8vXBfHX7P/X6YNGcvHm83ixuF/P1otr8pXncn5vb3C5Wd7/ffK66Buie4vdtc8p8fStqU/DH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G1I7"; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Symbol.compressed.json +var Symbol_compressed_default = "eJx9WFlv2zgQ/iuGnnYBt5DkS85bmk13g27SoEkPbNEHWqIlIhSpklSuov99R7JIkSLtFyGZjxzN8c0h/4oueF1jpqKz6Mt1K1GJZ4s4S+PZYrvdbqJ59J4zdYNqDAfuXuodp52spdSToZrQl6n0KyZl1Sm/xgVpa5BcKURJfs5KCgdj+F++J8+4uCUqr6IzJVo8jy4qJFCusLjD3d27BucE0cGYd+/4c3T2/U2SxfM36XYxT+JtDI8k/jGPPrMCC0oYvuWSKMJZdPYmiWMLuK9I/sCwlNHZCuRfsJD9sSiOk7dxnMFbbrgieefGBW9eROfA7I/8z1myzVbz7rnpn9vuCW/unpvZecF3eHb3IhWu5eyK5Vw0XCCFi7ezc0pnvRo5E1hi8QhCeM0lHCoIK+/yCvdR67zrfd2THPA7VfzzNTrbpv2fX+BPeH8fm2usBMnBg++/oq/forO08+QGNMgGgeG/5wfxYrE4iPFzTlFt5JtkkLeMPIL/EFoNreJBE2vrXReako3YcqvVEXCTKWJdzPS7Gizyjk/mZZvsAKC66d7FCgMtF4NC2eaVqpDyLW+QwIzi/TGoD6tvPQL7BJEPNVKVb39DW2mkJnY5FALyD9eEhU6DL4SPrqTaS0mRrHyDXrHgvpQz7AvVU+CkqgQOnN3zVgSkkFVfKslzQIgfMfPFOBxWRiyDjcs5p5wFIoFr4kImprQrP59WP1ubiVpcCgxlNLq5XC4PwM8Wy77EvSs5ZyU0EpuFaXqAzmlTjVlerzcH8TuskH/4oiLj0WQQ/oWpdXadJAfxZSOJ7exmPfD01lYSD8K/kU0288JLS7Mh+hW337dINCPA5MRX8QE1jXU8Wx/E/6J6V4zyLBtCdd36Km4Cso+QTOG4N6T5dvRusxxsu6/scK5Wgw2fKovZ20HxHSnrQDjv0WjEejvw7/MkxmMD6ZQkvnEfa1xayperg/ibZfN2kN1K4lvxHw4l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+// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/ZapfDingbats.compressed.json +var ZapfDingbats_compressed_default = "eJxtmNtu20YQhl+F4FULyMGeD7pz3AY1ChtG7NpFA18w1NomIlECSRcxgrx7SVk7+wOdG8H5OJydf2Z2d5gf9cV+t0v9VK/r+6vXsXlOlbHe28paq229qj/t++m62aXZ4J/m8PRb1z9/baZxefK63Z6eXN5dVMvTCh83u277xr/6kLrnl2XNq7TpXnczuZyabdee98/b2VzM/x4/dd/T5qab2pd6PQ2vaVVfvDRD005puE3Lu7eH1HbN9hTjx4/77/X6y5lcnUmjVzHIVVDicVX/1W/SsO36dLMfu6nb9/X6TAoBD+5euvZbn8axXtuZ36dhPJrVQqgPQoh5hev91LWLkIv94W1Ygq9+aX+tZAx2tfz64284/sblN/rqfLP/mqrbt3FKu7G67Nv9cNgPzZQ2H6rz7bb6vLgZq89pTMO/M/xfEqturJpqSM/d7GJIm2oamk3aNcO3av80O5xh3yyKmm1193ZIT02bqovTKjP+MAf++7zsZvZ3276kYyWWXB0z99S18/PbafPHQ71W4fjn/fxnFO+ZvkrT0LVzTr78qB/+nk38bHM9exgP8zr1z9U7jt6840YW5uSJKcZOCaBBnKgm5mU8MVNYyMwWFvO7Ukagkmgg6sDWQ5yFFqjzUrLEaQ3BEmiwNsMSaZS0vgWfOkPHWQowNeTUc0kumnxZvsgPxlGai6VTGUqAVCTQ6QkWnc77DKEiLktSUBJKqHIQZ86d8gCpHYoiEzMsb1ubYy8vW50DChB5ZhGqrijD0EqUIeiaEHIfCg5Kpuu0ApiToaGPSY0uaQsyr65L2oKi1yFt1PLaQ3lzfXTgXodGoJYzglndSLDMPg1sTPJpQJHJigw0QrGERqD9YhyTOgONQDUyuF1zaxuokc/BW2ztXCMrGZ9WMW1oQZHIXWNBkSCfRZEL5BMUiZw6CzVSFCfUSGZFNjIldoKDkonTKQiJIGzWmFd3BizJJ9SINoLDriOfUCOZS+zg+KGD1qGiLNMLxtJD1/ns00ON6EzyUCM6vbxhoBKaqbG3DFQCNiL1iHccBPV0DHhQH/JW8EW90dkyFKGywCJU0WkVSvSGeiSUODWFFD0HYdPQVoiRgfPMA+/nnRgiAyNYSjpWNQcNSMrtFCUH4ZIRpSCWocFCSuhCEY6hoUClc0WC52BJlCYYLQdhN+hygRRRlo5BKRRLS6oihSqh+ZzzRGG1Mo4Iz1LoP0qsxDGFzk0JE42ji0jCPejomJKCuwil4m5CiRMEUMVSzVLDUstSx1Juc0oVWMpqY295qVltmtWmWW2a1aZZbZrVplltmtWmWW2G1WZYbYbVZlhthtVmWG2G1WZYbYbVZlhtltVmWW2W1WZZbZbVZlltltVmWW2W1QYjQCh7E2aAQHeGhCFgPoNoy8KNb2wxBhmGKBxoUZXlLGsLI6AsftEDHV0wIURVbANLcTKlGGBIKPOAxCmhePCKUwFzAmpDFRQvjA9R06Hq8TONvshgKDCuRAZTXigUxjxNFfKRo3CLhnIJBMFRvMZpqpNBMlQJzGT5WFQMVQI/AikPMIhEU1aDjqJvQwmjSHB05cC9jbYwc5UtAHNLhDw41ha+lEqF4JaH3gmB61SYcqInxTDmQK8v08vjqv4zDf1N0w3Lf4A8/vwPpfK11w=="; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Font.js +var compressedJsonForFontName = { + "Courier": Courier_compressed_default, + "Courier-Bold": Courier_Bold_compressed_default, + "Courier-Oblique": Courier_Oblique_compressed_default, + "Courier-BoldOblique": Courier_BoldOblique_compressed_default, + "Helvetica": Helvetica_compressed_default, + "Helvetica-Bold": Helvetica_Bold_compressed_default, + "Helvetica-Oblique": Helvetica_Oblique_compressed_default, + "Helvetica-BoldOblique": Helvetica_BoldOblique_compressed_default, + "Times-Roman": Times_Roman_compressed_default, + "Times-Bold": Times_Bold_compressed_default, + "Times-Italic": Times_Italic_compressed_default, + "Times-BoldItalic": Times_BoldItalic_compressed_default, + "Symbol": Symbol_compressed_default, + "ZapfDingbats": ZapfDingbats_compressed_default +}; +var FontNames; +(function(FontNames2) { + FontNames2["Courier"] = "Courier"; + FontNames2["CourierBold"] = "Courier-Bold"; + FontNames2["CourierOblique"] = "Courier-Oblique"; + FontNames2["CourierBoldOblique"] = "Courier-BoldOblique"; + FontNames2["Helvetica"] = "Helvetica"; + FontNames2["HelveticaBold"] = "Helvetica-Bold"; + FontNames2["HelveticaOblique"] = "Helvetica-Oblique"; + FontNames2["HelveticaBoldOblique"] = "Helvetica-BoldOblique"; + FontNames2["TimesRoman"] = "Times-Roman"; + FontNames2["TimesRomanBold"] = "Times-Bold"; + FontNames2["TimesRomanItalic"] = "Times-Italic"; + FontNames2["TimesRomanBoldItalic"] = "Times-BoldItalic"; + FontNames2["Symbol"] = "Symbol"; + FontNames2["ZapfDingbats"] = "ZapfDingbats"; +})(FontNames || (FontNames = {})); +var fontCache = {}; +var Font = ( + /** @class */ + function() { + function Font2() { + var _this = this; + this.getWidthOfGlyph = function(glyphName) { + return _this.CharWidths[glyphName]; + }; + this.getXAxisKerningForPair = function(leftGlyphName, rightGlyphName) { + return (_this.KernPairXAmounts[leftGlyphName] || {})[rightGlyphName]; + }; + } + Font2.load = function(fontName) { + var cachedFont = fontCache[fontName]; + if (cachedFont) + return cachedFont; + var json = decompressJson(compressedJsonForFontName[fontName]); + var font = Object.assign(new Font2(), JSON.parse(json)); + font.CharWidths = font.CharMetrics.reduce(function(acc, metric) { + acc[metric.N] = metric.WX; + return acc; + }, {}); + font.KernPairXAmounts = font.KernPairs.reduce(function(acc, _a3) { + var name1 = _a3[0], name2 = _a3[1], width = _a3[2]; + if (!acc[name1]) + acc[name1] = {}; + acc[name1][name2] = width; + return acc; + }, {}); + fontCache[fontName] = font; + return font; + }; + return Font2; + }() +); + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/all-encodings.compressed.json +var all_encodings_compressed_default = "eJztWsuy48iN/Ret74KZfHtX47meqfGjPHaXx4/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Ip/WC3Mb12i24cHXIEfkcs3FzGDM/UPnnJjcKb+cQXOmfrHFThn6h/fgItO1z8+4IjO2P+0LBOdsX9znHgBKUYn7Id+Pkklvh3TCgtpX9DFhbSvll1I+1t0C3NfTBcX5v4IeSHv5sYxX7g7H86dt+/Wbpw7c+8XsLkz934Bmztz79+AzZ2+9w+4cmfww2ptZ/DDam1n8MPbtZ3GDw9rs9ui3KZPblw4tz8vJiuc208LhMK5/bRAKJzbT28gFE7wp9XCTvCnR1zO8ZeLw7Fwjj8tTlw4x78v0Ern+PcFWukc//4GWulE//6AonSu/7paxrn+zZ2YnRclRK/rBXJsCAjxh2cKEAWVJ02ku/wOoFv2+12XkmnODwHgW4uQGVbZ0uM7mAJ1b/68/JlpUMnWdy5MF6/Vd5eL19YYSPd6FqPwBkNQo/h2NQxdQQ3bn/dpCxrGrqCW7U8rKZl/mfi0Xytk3Am66ZhYbg4y+KAVslDwbXdNL2d5qU5hnYBlTZaa6hs2t1qWdaeeTptcLco+hl5R7w4H5uOGcQbtEkpT18GusOI2xT9dYcVJf7zCSjmbD+Iud2s1NPRb9E+0UICmizb8ZK/+5JOLOulSqwaw5VJr2vB8dSFn89fvv/8H0oq1dA=="; + +// node_modules/.pnpm/@pdf-lib+standard-fonts@1.0.0/node_modules/@pdf-lib/standard-fonts/es/Encoding.js +var decompressedEncodings = decompressJson(all_encodings_compressed_default); +var allUnicodeMappings = JSON.parse(decompressedEncodings); +var Encoding = ( + /** @class */ + /* @__PURE__ */ function() { + function Encoding2(name, unicodeMappings) { + var _this = this; + this.canEncodeUnicodeCodePoint = function(codePoint) { + return codePoint in _this.unicodeMappings; + }; + this.encodeUnicodeCodePoint = function(codePoint) { + var mapped = _this.unicodeMappings[codePoint]; + if (!mapped) { + var str = String.fromCharCode(codePoint); + var hexCode = "0x" + padStart2(codePoint.toString(16), 4, "0"); + var msg = _this.name + ' cannot encode "' + str + '" (' + hexCode + ")"; + throw new Error(msg); + } + return { code: mapped[0], name: mapped[1] }; + }; + this.name = name; + this.supportedCodePoints = Object.keys(unicodeMappings).map(Number).sort(function(a, b) { + return a - b; + }); + this.unicodeMappings = unicodeMappings; + } + return Encoding2; + }() +); +var Encodings = { + Symbol: new Encoding("Symbol", allUnicodeMappings.symbol), + ZapfDingbats: new Encoding("ZapfDingbats", allUnicodeMappings.zapfdingbats), + WinAnsi: new Encoding("WinAnsi", allUnicodeMappings.win1252) +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/objects.js +var values = function(obj) { + return Object.keys(obj).map(function(k) { + return obj[k]; + }); +}; +var StandardFontValues = values(FontNames); +var isStandardFont = function(input) { + return StandardFontValues.includes(input); +}; +var rectanglesAreEqual = function(a, b) { + return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/validators.js +var backtick = function(val) { + return "`" + val + "`"; +}; +var singleQuote = function(val) { + return "'" + val + "'"; +}; +var formatValue = function(value) { + var type = typeof value; + if (type === "string") + return singleQuote(value); + else if (type === "undefined") + return backtick(value); + else + return value; +}; +var createValueErrorMsg = function(value, valueName, values2) { + var allowedValues = new Array(values2.length); + for (var idx = 0, len = values2.length; idx < len; idx++) { + var v = values2[idx]; + allowedValues[idx] = formatValue(v); + } + var joinedValues = allowedValues.join(" or "); + return backtick(valueName) + " must be one of " + joinedValues + ", but was actually " + formatValue(value); +}; +var assertIsOneOf = function(value, valueName, allowedValues) { + if (!Array.isArray(allowedValues)) { + allowedValues = values(allowedValues); + } + for (var idx = 0, len = allowedValues.length; idx < len; idx++) { + if (value === allowedValues[idx]) + return; + } + throw new TypeError(createValueErrorMsg(value, valueName, allowedValues)); +}; +var assertIsOneOfOrUndefined = function(value, valueName, allowedValues) { + if (!Array.isArray(allowedValues)) { + allowedValues = values(allowedValues); + } + assertIsOneOf(value, valueName, allowedValues.concat(void 0)); +}; +var assertIsSubset = function(values2, valueName, allowedValues) { + if (!Array.isArray(allowedValues)) { + allowedValues = values(allowedValues); + } + for (var idx = 0, len = values2.length; idx < len; idx++) { + assertIsOneOf(values2[idx], valueName, allowedValues); + } +}; +var getType = function(val) { + if (val === null) + return "null"; + if (val === void 0) + return "undefined"; + if (typeof val === "string") + return "string"; + if (isNaN(val)) + return "NaN"; + if (typeof val === "number") + return "number"; + if (typeof val === "boolean") + return "boolean"; + if (typeof val === "symbol") + return "symbol"; + if (typeof val === "bigint") + return "bigint"; + if (val.constructor && val.constructor.name) + return val.constructor.name; + if (val.name) + return val.name; + if (val.constructor) + return String(val.constructor); + return String(val); +}; +var isType = function(value, type) { + if (type === "null") + return value === null; + if (type === "undefined") + return value === void 0; + if (type === "string") + return typeof value === "string"; + if (type === "number") + return typeof value === "number" && !isNaN(value); + if (type === "boolean") + return typeof value === "boolean"; + if (type === "symbol") + return typeof value === "symbol"; + if (type === "bigint") + return typeof value === "bigint"; + if (type === Date) + return value instanceof Date; + if (type === Array) + return value instanceof Array; + if (type === Uint8Array) + return value instanceof Uint8Array; + if (type === ArrayBuffer) + return value instanceof ArrayBuffer; + if (type === Function) + return value instanceof Function; + return value instanceof type[0]; +}; +var createTypeErrorMsg = function(value, valueName, types) { + var allowedTypes = new Array(types.length); + for (var idx = 0, len = types.length; idx < len; idx++) { + var type = types[idx]; + if (type === "null") + allowedTypes[idx] = backtick("null"); + if (type === "undefined") + allowedTypes[idx] = backtick("undefined"); + if (type === "string") + allowedTypes[idx] = backtick("string"); + else if (type === "number") + allowedTypes[idx] = backtick("number"); + else if (type === "boolean") + allowedTypes[idx] = backtick("boolean"); + else if (type === "symbol") + allowedTypes[idx] = backtick("symbol"); + else if (type === "bigint") + allowedTypes[idx] = backtick("bigint"); + else if (type === Array) + allowedTypes[idx] = backtick("Array"); + else if (type === Uint8Array) + allowedTypes[idx] = backtick("Uint8Array"); + else if (type === ArrayBuffer) + allowedTypes[idx] = backtick("ArrayBuffer"); + else + allowedTypes[idx] = backtick(type[1]); + } + var joinedTypes = allowedTypes.join(" or "); + return backtick(valueName) + " must be of type " + joinedTypes + ", but was actually of type " + backtick(getType(value)); +}; +var assertIs = function(value, valueName, types) { + for (var idx = 0, len = types.length; idx < len; idx++) { + if (isType(value, types[idx])) + return; + } + throw new TypeError(createTypeErrorMsg(value, valueName, types)); +}; +var assertOrUndefined = function(value, valueName, types) { + assertIs(value, valueName, types.concat("undefined")); +}; +var assertEachIs = function(values2, valueName, types) { + for (var idx = 0, len = values2.length; idx < len; idx++) { + assertIs(values2[idx], valueName, types); + } +}; +var assertRange = function(value, valueName, min, max) { + assertIs(value, valueName, ["number"]); + assertIs(min, "min", ["number"]); + assertIs(max, "max", ["number"]); + max = Math.max(min, max); + if (value < min || value > max) { + throw new Error(backtick(valueName) + " must be at least " + min + " and at most " + max + ", but was actually " + value); + } +}; +var assertRangeOrUndefined = function(value, valueName, min, max) { + assertIs(value, valueName, ["number", "undefined"]); + if (typeof value === "number") + assertRange(value, valueName, min, max); +}; +var assertMultiple = function(value, valueName, multiplier) { + assertIs(value, valueName, ["number"]); + if (value % multiplier !== 0) { + throw new Error(backtick(valueName) + " must be a multiple of " + multiplier + ", but was actually " + value); + } +}; +var assertInteger = function(value, valueName) { + if (!Number.isInteger(value)) { + throw new Error(backtick(valueName) + " must be an integer, but was actually " + value); + } +}; +var assertPositive = function(value, valueName) { + if (![1, 0].includes(Math.sign(value))) { + throw new Error(backtick(valueName) + " must be a positive number or 0, but was actually " + value); + } +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/pdfDocEncoding.js +var pdfDocEncodingToUnicode = new Uint16Array(256); +for (idx = 0; idx < 256; idx++) { + pdfDocEncodingToUnicode[idx] = idx; +} +var idx; +pdfDocEncodingToUnicode[22] = toCharCode(""); +pdfDocEncodingToUnicode[24] = toCharCode("\u02D8"); +pdfDocEncodingToUnicode[25] = toCharCode("\u02C7"); +pdfDocEncodingToUnicode[26] = toCharCode("\u02C6"); +pdfDocEncodingToUnicode[27] = toCharCode("\u02D9"); +pdfDocEncodingToUnicode[28] = toCharCode("\u02DD"); +pdfDocEncodingToUnicode[29] = toCharCode("\u02DB"); +pdfDocEncodingToUnicode[30] = toCharCode("\u02DA"); +pdfDocEncodingToUnicode[31] = toCharCode("\u02DC"); +pdfDocEncodingToUnicode[127] = toCharCode("\uFFFD"); +pdfDocEncodingToUnicode[128] = toCharCode("\u2022"); +pdfDocEncodingToUnicode[129] = toCharCode("\u2020"); +pdfDocEncodingToUnicode[130] = toCharCode("\u2021"); +pdfDocEncodingToUnicode[131] = toCharCode("\u2026"); +pdfDocEncodingToUnicode[132] = toCharCode("\u2014"); +pdfDocEncodingToUnicode[133] = toCharCode("\u2013"); +pdfDocEncodingToUnicode[134] = toCharCode("\u0192"); +pdfDocEncodingToUnicode[135] = toCharCode("\u2044"); +pdfDocEncodingToUnicode[136] = toCharCode("\u2039"); +pdfDocEncodingToUnicode[137] = toCharCode("\u203A"); +pdfDocEncodingToUnicode[138] = toCharCode("\u2212"); +pdfDocEncodingToUnicode[139] = toCharCode("\u2030"); +pdfDocEncodingToUnicode[140] = toCharCode("\u201E"); +pdfDocEncodingToUnicode[141] = toCharCode("\u201C"); +pdfDocEncodingToUnicode[142] = toCharCode("\u201D"); +pdfDocEncodingToUnicode[143] = toCharCode("\u2018"); +pdfDocEncodingToUnicode[144] = toCharCode("\u2019"); +pdfDocEncodingToUnicode[145] = toCharCode("\u201A"); +pdfDocEncodingToUnicode[146] = toCharCode("\u2122"); +pdfDocEncodingToUnicode[147] = toCharCode("\uFB01"); +pdfDocEncodingToUnicode[148] = toCharCode("\uFB02"); +pdfDocEncodingToUnicode[149] = toCharCode("\u0141"); +pdfDocEncodingToUnicode[150] = toCharCode("\u0152"); +pdfDocEncodingToUnicode[151] = toCharCode("\u0160"); +pdfDocEncodingToUnicode[152] = toCharCode("\u0178"); +pdfDocEncodingToUnicode[153] = toCharCode("\u017D"); +pdfDocEncodingToUnicode[154] = toCharCode("\u0131"); +pdfDocEncodingToUnicode[155] = toCharCode("\u0142"); +pdfDocEncodingToUnicode[156] = toCharCode("\u0153"); +pdfDocEncodingToUnicode[157] = toCharCode("\u0161"); +pdfDocEncodingToUnicode[158] = toCharCode("\u017E"); +pdfDocEncodingToUnicode[159] = toCharCode("\uFFFD"); +pdfDocEncodingToUnicode[160] = toCharCode("\u20AC"); +pdfDocEncodingToUnicode[173] = toCharCode("\uFFFD"); +var pdfDocEncodingDecode = function(bytes) { + var codePoints = new Array(bytes.length); + for (var idx = 0, len = bytes.length; idx < len; idx++) { + codePoints[idx] = pdfDocEncodingToUnicode[bytes[idx]]; + } + return String.fromCodePoint.apply(String, codePoints); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/Cache.js +var Cache = ( + /** @class */ + function() { + function Cache2(populate) { + this.populate = populate; + this.value = void 0; + } + Cache2.prototype.getValue = function() { + return this.value; + }; + Cache2.prototype.access = function() { + if (!this.value) + this.value = this.populate(); + return this.value; + }; + Cache2.prototype.invalidate = function() { + this.value = void 0; + }; + Cache2.populatedBy = function(populate) { + return new Cache2(populate); + }; + return Cache2; + }() +); +var Cache_default = Cache; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/errors.js +var MethodNotImplementedError = ( + /** @class */ + function(_super) { + __extends(MethodNotImplementedError2, _super); + function MethodNotImplementedError2(className, methodName) { + var _this = this; + var msg = "Method " + className + "." + methodName + "() not implemented"; + _this = _super.call(this, msg) || this; + return _this; + } + return MethodNotImplementedError2; + }(Error) +); +var PrivateConstructorError = ( + /** @class */ + function(_super) { + __extends(PrivateConstructorError2, _super); + function PrivateConstructorError2(className) { + var _this = this; + var msg = "Cannot construct " + className + " - it has a private constructor"; + _this = _super.call(this, msg) || this; + return _this; + } + return PrivateConstructorError2; + }(Error) +); +var UnexpectedObjectTypeError = ( + /** @class */ + function(_super) { + __extends(UnexpectedObjectTypeError2, _super); + function UnexpectedObjectTypeError2(expected, actual) { + var _this = this; + var name = function(t) { + var _a3, _b3; + return (_a3 = t === null || t === void 0 ? void 0 : t.name) !== null && _a3 !== void 0 ? _a3 : (_b3 = t === null || t === void 0 ? void 0 : t.constructor) === null || _b3 === void 0 ? void 0 : _b3.name; + }; + var expectedTypes = Array.isArray(expected) ? expected.map(name) : [name(expected)]; + var msg = "Expected instance of " + expectedTypes.join(" or ") + ", " + ("but got instance of " + (actual ? name(actual) : actual)); + _this = _super.call(this, msg) || this; + return _this; + } + return UnexpectedObjectTypeError2; + }(Error) +); +var UnsupportedEncodingError = ( + /** @class */ + function(_super) { + __extends(UnsupportedEncodingError2, _super); + function UnsupportedEncodingError2(encoding) { + var _this = this; + var msg = encoding + " stream encoding not supported"; + _this = _super.call(this, msg) || this; + return _this; + } + return UnsupportedEncodingError2; + }(Error) +); +var ReparseError = ( + /** @class */ + function(_super) { + __extends(ReparseError2, _super); + function ReparseError2(className, methodName) { + var _this = this; + var msg = "Cannot call " + className + "." + methodName + "() more than once"; + _this = _super.call(this, msg) || this; + return _this; + } + return ReparseError2; + }(Error) +); +var MissingCatalogError = ( + /** @class */ + function(_super) { + __extends(MissingCatalogError2, _super); + function MissingCatalogError2(ref) { + var _this = this; + var msg = "Missing catalog (ref=" + ref + ")"; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingCatalogError2; + }(Error) +); +var MissingPageContentsEmbeddingError = ( + /** @class */ + function(_super) { + __extends(MissingPageContentsEmbeddingError2, _super); + function MissingPageContentsEmbeddingError2() { + var _this = this; + var msg = "Can't embed page with missing Contents"; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingPageContentsEmbeddingError2; + }(Error) +); +var UnrecognizedStreamTypeError = ( + /** @class */ + function(_super) { + __extends(UnrecognizedStreamTypeError2, _super); + function UnrecognizedStreamTypeError2(stream2) { + var _a3, _b3, _c2; + var _this = this; + var streamType = (_c2 = (_b3 = (_a3 = stream2 === null || stream2 === void 0 ? void 0 : stream2.contructor) === null || _a3 === void 0 ? void 0 : _a3.name) !== null && _b3 !== void 0 ? _b3 : stream2 === null || stream2 === void 0 ? void 0 : stream2.name) !== null && _c2 !== void 0 ? _c2 : stream2; + var msg = "Unrecognized stream type: " + streamType; + _this = _super.call(this, msg) || this; + return _this; + } + return UnrecognizedStreamTypeError2; + }(Error) +); +var PageEmbeddingMismatchedContextError = ( + /** @class */ + function(_super) { + __extends(PageEmbeddingMismatchedContextError2, _super); + function PageEmbeddingMismatchedContextError2() { + var _this = this; + var msg = "Found mismatched contexts while embedding pages. All pages in the array passed to `PDFDocument.embedPages()` must be from the same document."; + _this = _super.call(this, msg) || this; + return _this; + } + return PageEmbeddingMismatchedContextError2; + }(Error) +); +var PDFArrayIsNotRectangleError = ( + /** @class */ + function(_super) { + __extends(PDFArrayIsNotRectangleError2, _super); + function PDFArrayIsNotRectangleError2(size) { + var _this = this; + var msg = "Attempted to convert PDFArray with " + size + " elements to rectangle, but must have exactly 4 elements."; + _this = _super.call(this, msg) || this; + return _this; + } + return PDFArrayIsNotRectangleError2; + }(Error) +); +var InvalidPDFDateStringError = ( + /** @class */ + function(_super) { + __extends(InvalidPDFDateStringError2, _super); + function InvalidPDFDateStringError2(value) { + var _this = this; + var msg = 'Attempted to convert "' + value + '" to a date, but it does not match the PDF date string format.'; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidPDFDateStringError2; + }(Error) +); +var InvalidTargetIndexError = ( + /** @class */ + function(_super) { + __extends(InvalidTargetIndexError2, _super); + function InvalidTargetIndexError2(targetIndex, Count) { + var _this = this; + var msg = "Invalid targetIndex specified: targetIndex=" + targetIndex + " must be less than Count=" + Count; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidTargetIndexError2; + }(Error) +); +var CorruptPageTreeError = ( + /** @class */ + function(_super) { + __extends(CorruptPageTreeError2, _super); + function CorruptPageTreeError2(targetIndex, operation) { + var _this = this; + var msg = "Failed to " + operation + " at targetIndex=" + targetIndex + " due to corrupt page tree: It is likely that one or more 'Count' entries are invalid"; + _this = _super.call(this, msg) || this; + return _this; + } + return CorruptPageTreeError2; + }(Error) +); +var IndexOutOfBoundsError = ( + /** @class */ + function(_super) { + __extends(IndexOutOfBoundsError2, _super); + function IndexOutOfBoundsError2(index2, min, max) { + var _this = this; + var msg = "index should be at least " + min + " and at most " + max + ", but was actually " + index2; + _this = _super.call(this, msg) || this; + return _this; + } + return IndexOutOfBoundsError2; + }(Error) +); +var InvalidAcroFieldValueError = ( + /** @class */ + function(_super) { + __extends(InvalidAcroFieldValueError2, _super); + function InvalidAcroFieldValueError2() { + var _this = this; + var msg = "Attempted to set invalid field value"; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidAcroFieldValueError2; + }(Error) +); +var MultiSelectValueError = ( + /** @class */ + function(_super) { + __extends(MultiSelectValueError2, _super); + function MultiSelectValueError2() { + var _this = this; + var msg = "Attempted to select multiple values for single-select field"; + _this = _super.call(this, msg) || this; + return _this; + } + return MultiSelectValueError2; + }(Error) +); +var MissingDAEntryError = ( + /** @class */ + function(_super) { + __extends(MissingDAEntryError2, _super); + function MissingDAEntryError2(fieldName) { + var _this = this; + var msg = "No /DA (default appearance) entry found for field: " + fieldName; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingDAEntryError2; + }(Error) +); +var MissingTfOperatorError = ( + /** @class */ + function(_super) { + __extends(MissingTfOperatorError2, _super); + function MissingTfOperatorError2(fieldName) { + var _this = this; + var msg = "No Tf operator found for DA of field: " + fieldName; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingTfOperatorError2; + }(Error) +); +var NumberParsingError = ( + /** @class */ + function(_super) { + __extends(NumberParsingError2, _super); + function NumberParsingError2(pos, value) { + var _this = this; + var msg = "Failed to parse number " + ("(line:" + pos.line + " col:" + pos.column + " offset=" + pos.offset + '): "' + value + '"'); + _this = _super.call(this, msg) || this; + return _this; + } + return NumberParsingError2; + }(Error) +); +var PDFParsingError = ( + /** @class */ + function(_super) { + __extends(PDFParsingError2, _super); + function PDFParsingError2(pos, details) { + var _this = this; + var msg = "Failed to parse PDF document " + ("(line:" + pos.line + " col:" + pos.column + " offset=" + pos.offset + "): " + details); + _this = _super.call(this, msg) || this; + return _this; + } + return PDFParsingError2; + }(Error) +); +var NextByteAssertionError = ( + /** @class */ + function(_super) { + __extends(NextByteAssertionError2, _super); + function NextByteAssertionError2(pos, expectedByte, actualByte) { + var _this = this; + var msg = "Expected next byte to be " + expectedByte + " but it was actually " + actualByte; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return NextByteAssertionError2; + }(PDFParsingError) +); +var PDFObjectParsingError = ( + /** @class */ + function(_super) { + __extends(PDFObjectParsingError2, _super); + function PDFObjectParsingError2(pos, byte) { + var _this = this; + var msg = "Failed to parse PDF object starting with the following byte: " + byte; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return PDFObjectParsingError2; + }(PDFParsingError) +); +var PDFInvalidObjectParsingError = ( + /** @class */ + function(_super) { + __extends(PDFInvalidObjectParsingError2, _super); + function PDFInvalidObjectParsingError2(pos) { + var _this = this; + var msg = "Failed to parse invalid PDF object"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return PDFInvalidObjectParsingError2; + }(PDFParsingError) +); +var PDFStreamParsingError = ( + /** @class */ + function(_super) { + __extends(PDFStreamParsingError2, _super); + function PDFStreamParsingError2(pos) { + var _this = this; + var msg = "Failed to parse PDF stream"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return PDFStreamParsingError2; + }(PDFParsingError) +); +var UnbalancedParenthesisError = ( + /** @class */ + function(_super) { + __extends(UnbalancedParenthesisError2, _super); + function UnbalancedParenthesisError2(pos) { + var _this = this; + var msg = "Failed to parse PDF literal string due to unbalanced parenthesis"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return UnbalancedParenthesisError2; + }(PDFParsingError) +); +var StalledParserError = ( + /** @class */ + function(_super) { + __extends(StalledParserError2, _super); + function StalledParserError2(pos) { + var _this = this; + var msg = "Parser stalled"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return StalledParserError2; + }(PDFParsingError) +); +var MissingPDFHeaderError = ( + /** @class */ + function(_super) { + __extends(MissingPDFHeaderError2, _super); + function MissingPDFHeaderError2(pos) { + var _this = this; + var msg = "No PDF header found"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return MissingPDFHeaderError2; + }(PDFParsingError) +); +var MissingKeywordError = ( + /** @class */ + function(_super) { + __extends(MissingKeywordError2, _super); + function MissingKeywordError2(pos, keyword) { + var _this = this; + var msg = "Did not find expected keyword '" + arrayAsString(keyword) + "'"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return MissingKeywordError2; + }(PDFParsingError) +); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/syntax/CharCodes.js +var CharCodes; +(function(CharCodes2) { + CharCodes2[CharCodes2["Null"] = 0] = "Null"; + CharCodes2[CharCodes2["Backspace"] = 8] = "Backspace"; + CharCodes2[CharCodes2["Tab"] = 9] = "Tab"; + CharCodes2[CharCodes2["Newline"] = 10] = "Newline"; + CharCodes2[CharCodes2["FormFeed"] = 12] = "FormFeed"; + CharCodes2[CharCodes2["CarriageReturn"] = 13] = "CarriageReturn"; + CharCodes2[CharCodes2["Space"] = 32] = "Space"; + CharCodes2[CharCodes2["ExclamationPoint"] = 33] = "ExclamationPoint"; + CharCodes2[CharCodes2["Hash"] = 35] = "Hash"; + CharCodes2[CharCodes2["Percent"] = 37] = "Percent"; + CharCodes2[CharCodes2["LeftParen"] = 40] = "LeftParen"; + CharCodes2[CharCodes2["RightParen"] = 41] = "RightParen"; + CharCodes2[CharCodes2["Plus"] = 43] = "Plus"; + CharCodes2[CharCodes2["Minus"] = 45] = "Minus"; + CharCodes2[CharCodes2["Dash"] = 45] = "Dash"; + CharCodes2[CharCodes2["Period"] = 46] = "Period"; + CharCodes2[CharCodes2["ForwardSlash"] = 47] = "ForwardSlash"; + CharCodes2[CharCodes2["Zero"] = 48] = "Zero"; + CharCodes2[CharCodes2["One"] = 49] = "One"; + CharCodes2[CharCodes2["Two"] = 50] = "Two"; + CharCodes2[CharCodes2["Three"] = 51] = "Three"; + CharCodes2[CharCodes2["Four"] = 52] = "Four"; + CharCodes2[CharCodes2["Five"] = 53] = "Five"; + CharCodes2[CharCodes2["Six"] = 54] = "Six"; + CharCodes2[CharCodes2["Seven"] = 55] = "Seven"; + CharCodes2[CharCodes2["Eight"] = 56] = "Eight"; + CharCodes2[CharCodes2["Nine"] = 57] = "Nine"; + CharCodes2[CharCodes2["LessThan"] = 60] = "LessThan"; + CharCodes2[CharCodes2["GreaterThan"] = 62] = "GreaterThan"; + CharCodes2[CharCodes2["A"] = 65] = "A"; + CharCodes2[CharCodes2["D"] = 68] = "D"; + CharCodes2[CharCodes2["E"] = 69] = "E"; + CharCodes2[CharCodes2["F"] = 70] = "F"; + CharCodes2[CharCodes2["O"] = 79] = "O"; + CharCodes2[CharCodes2["P"] = 80] = "P"; + CharCodes2[CharCodes2["R"] = 82] = "R"; + CharCodes2[CharCodes2["LeftSquareBracket"] = 91] = "LeftSquareBracket"; + CharCodes2[CharCodes2["BackSlash"] = 92] = "BackSlash"; + CharCodes2[CharCodes2["RightSquareBracket"] = 93] = "RightSquareBracket"; + CharCodes2[CharCodes2["a"] = 97] = "a"; + CharCodes2[CharCodes2["b"] = 98] = "b"; + CharCodes2[CharCodes2["d"] = 100] = "d"; + CharCodes2[CharCodes2["e"] = 101] = "e"; + CharCodes2[CharCodes2["f"] = 102] = "f"; + CharCodes2[CharCodes2["i"] = 105] = "i"; + CharCodes2[CharCodes2["j"] = 106] = "j"; + CharCodes2[CharCodes2["l"] = 108] = "l"; + CharCodes2[CharCodes2["m"] = 109] = "m"; + CharCodes2[CharCodes2["n"] = 110] = "n"; + CharCodes2[CharCodes2["o"] = 111] = "o"; + CharCodes2[CharCodes2["r"] = 114] = "r"; + CharCodes2[CharCodes2["s"] = 115] = "s"; + CharCodes2[CharCodes2["t"] = 116] = "t"; + CharCodes2[CharCodes2["u"] = 117] = "u"; + CharCodes2[CharCodes2["x"] = 120] = "x"; + CharCodes2[CharCodes2["LeftCurly"] = 123] = "LeftCurly"; + CharCodes2[CharCodes2["RightCurly"] = 125] = "RightCurly"; + CharCodes2[CharCodes2["Tilde"] = 126] = "Tilde"; +})(CharCodes || (CharCodes = {})); +var CharCodes_default = CharCodes; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/PDFContext.js +var import_pako3 = __toESM(require_pako()); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/document/PDFHeader.js +var PDFHeader = ( + /** @class */ + function() { + function PDFHeader2(major, minor) { + this.major = String(major); + this.minor = String(minor); + } + PDFHeader2.prototype.toString = function() { + var bc = charFromCode(129); + return "%PDF-" + this.major + "." + this.minor + "\n%" + bc + bc + bc + bc; + }; + PDFHeader2.prototype.sizeInBytes = function() { + return 12 + this.major.length + this.minor.length; + }; + PDFHeader2.prototype.copyBytesInto = function(buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_default.Percent; + buffer[offset++] = CharCodes_default.P; + buffer[offset++] = CharCodes_default.D; + buffer[offset++] = CharCodes_default.F; + buffer[offset++] = CharCodes_default.Dash; + offset += copyStringIntoBuffer(this.major, buffer, offset); + buffer[offset++] = CharCodes_default.Period; + offset += copyStringIntoBuffer(this.minor, buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + buffer[offset++] = CharCodes_default.Percent; + buffer[offset++] = 129; + buffer[offset++] = 129; + buffer[offset++] = 129; + buffer[offset++] = 129; + return offset - initialOffset; + }; + PDFHeader2.forVersion = function(major, minor) { + return new PDFHeader2(major, minor); + }; + return PDFHeader2; + }() +); +var PDFHeader_default = PDFHeader; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFObject.js +var PDFObject = ( + /** @class */ + function() { + function PDFObject2() { + } + PDFObject2.prototype.clone = function(_context) { + throw new MethodNotImplementedError(this.constructor.name, "clone"); + }; + PDFObject2.prototype.toString = function() { + throw new MethodNotImplementedError(this.constructor.name, "toString"); + }; + PDFObject2.prototype.sizeInBytes = function() { + throw new MethodNotImplementedError(this.constructor.name, "sizeInBytes"); + }; + PDFObject2.prototype.copyBytesInto = function(_buffer, _offset) { + throw new MethodNotImplementedError(this.constructor.name, "copyBytesInto"); + }; + return PDFObject2; + }() +); +var PDFObject_default = PDFObject; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFNumber.js +var PDFNumber = ( + /** @class */ + function(_super) { + __extends(PDFNumber2, _super); + function PDFNumber2(value) { + var _this = _super.call(this) || this; + _this.numberValue = value; + _this.stringValue = numberToString(value); + return _this; + } + PDFNumber2.prototype.asNumber = function() { + return this.numberValue; + }; + PDFNumber2.prototype.value = function() { + return this.numberValue; + }; + PDFNumber2.prototype.clone = function() { + return PDFNumber2.of(this.numberValue); + }; + PDFNumber2.prototype.toString = function() { + return this.stringValue; + }; + PDFNumber2.prototype.sizeInBytes = function() { + return this.stringValue.length; + }; + PDFNumber2.prototype.copyBytesInto = function(buffer, offset) { + offset += copyStringIntoBuffer(this.stringValue, buffer, offset); + return this.stringValue.length; + }; + PDFNumber2.of = function(value) { + return new PDFNumber2(value); + }; + return PDFNumber2; + }(PDFObject_default) +); +var PDFNumber_default = PDFNumber; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFArray.js +var PDFArray = ( + /** @class */ + function(_super) { + __extends(PDFArray3, _super); + function PDFArray3(context) { + var _this = _super.call(this) || this; + _this.array = []; + _this.context = context; + return _this; + } + PDFArray3.prototype.size = function() { + return this.array.length; + }; + PDFArray3.prototype.push = function(object) { + this.array.push(object); + }; + PDFArray3.prototype.insert = function(index2, object) { + this.array.splice(index2, 0, object); + }; + PDFArray3.prototype.indexOf = function(object) { + var index2 = this.array.indexOf(object); + return index2 === -1 ? void 0 : index2; + }; + PDFArray3.prototype.remove = function(index2) { + this.array.splice(index2, 1); + }; + PDFArray3.prototype.set = function(idx, object) { + this.array[idx] = object; + }; + PDFArray3.prototype.get = function(index2) { + return this.array[index2]; + }; + PDFArray3.prototype.lookupMaybe = function(index2) { + var _a3; + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + return (_a3 = this.context).lookupMaybe.apply(_a3, __spreadArrays([this.get(index2)], types)); + }; + PDFArray3.prototype.lookup = function(index2) { + var _a3; + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + return (_a3 = this.context).lookup.apply(_a3, __spreadArrays([this.get(index2)], types)); + }; + PDFArray3.prototype.asRectangle = function() { + if (this.size() !== 4) + throw new PDFArrayIsNotRectangleError(this.size()); + var lowerLeftX = this.lookup(0, PDFNumber_default).asNumber(); + var lowerLeftY = this.lookup(1, PDFNumber_default).asNumber(); + var upperRightX = this.lookup(2, PDFNumber_default).asNumber(); + var upperRightY = this.lookup(3, PDFNumber_default).asNumber(); + var x = lowerLeftX; + var y = lowerLeftY; + var width = upperRightX - lowerLeftX; + var height = upperRightY - lowerLeftY; + return { x, y, width, height }; + }; + PDFArray3.prototype.asArray = function() { + return this.array.slice(); + }; + PDFArray3.prototype.clone = function(context) { + var clone = PDFArray3.withContext(context || this.context); + for (var idx = 0, len = this.size(); idx < len; idx++) { + clone.push(this.array[idx]); + } + return clone; + }; + PDFArray3.prototype.toString = function() { + var arrayString = "[ "; + for (var idx = 0, len = this.size(); idx < len; idx++) { + arrayString += this.get(idx).toString(); + arrayString += " "; + } + arrayString += "]"; + return arrayString; + }; + PDFArray3.prototype.sizeInBytes = function() { + var size = 3; + for (var idx = 0, len = this.size(); idx < len; idx++) { + size += this.get(idx).sizeInBytes() + 1; + } + return size; + }; + PDFArray3.prototype.copyBytesInto = function(buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_default.LeftSquareBracket; + buffer[offset++] = CharCodes_default.Space; + for (var idx = 0, len = this.size(); idx < len; idx++) { + offset += this.get(idx).copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Space; + } + buffer[offset++] = CharCodes_default.RightSquareBracket; + return offset - initialOffset; + }; + PDFArray3.prototype.scalePDFNumbers = function(x, y) { + for (var idx = 0, len = this.size(); idx < len; idx++) { + var el = this.lookup(idx); + if (el instanceof PDFNumber_default) { + var factor = idx % 2 === 0 ? x : y; + this.set(idx, PDFNumber_default.of(el.asNumber() * factor)); + } + } + }; + PDFArray3.withContext = function(context) { + return new PDFArray3(context); + }; + return PDFArray3; + }(PDFObject_default) +); +var PDFArray_default = PDFArray; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFBool.js +var ENFORCER = {}; +var PDFBool = ( + /** @class */ + function(_super) { + __extends(PDFBool2, _super); + function PDFBool2(enforcer, value) { + var _this = this; + if (enforcer !== ENFORCER) + throw new PrivateConstructorError("PDFBool"); + _this = _super.call(this) || this; + _this.value = value; + return _this; + } + PDFBool2.prototype.asBoolean = function() { + return this.value; + }; + PDFBool2.prototype.clone = function() { + return this; + }; + PDFBool2.prototype.toString = function() { + return String(this.value); + }; + PDFBool2.prototype.sizeInBytes = function() { + return this.value ? 4 : 5; + }; + PDFBool2.prototype.copyBytesInto = function(buffer, offset) { + if (this.value) { + buffer[offset++] = CharCodes_default.t; + buffer[offset++] = CharCodes_default.r; + buffer[offset++] = CharCodes_default.u; + buffer[offset++] = CharCodes_default.e; + return 4; + } else { + buffer[offset++] = CharCodes_default.f; + buffer[offset++] = CharCodes_default.a; + buffer[offset++] = CharCodes_default.l; + buffer[offset++] = CharCodes_default.s; + buffer[offset++] = CharCodes_default.e; + return 5; + } + }; + PDFBool2.True = new PDFBool2(ENFORCER, true); + PDFBool2.False = new PDFBool2(ENFORCER, false); + return PDFBool2; + }(PDFObject_default) +); +var PDFBool_default = PDFBool; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/syntax/Delimiters.js +var IsDelimiter = new Uint8Array(256); +IsDelimiter[CharCodes_default.LeftParen] = 1; +IsDelimiter[CharCodes_default.RightParen] = 1; +IsDelimiter[CharCodes_default.LessThan] = 1; +IsDelimiter[CharCodes_default.GreaterThan] = 1; +IsDelimiter[CharCodes_default.LeftSquareBracket] = 1; +IsDelimiter[CharCodes_default.RightSquareBracket] = 1; +IsDelimiter[CharCodes_default.LeftCurly] = 1; +IsDelimiter[CharCodes_default.RightCurly] = 1; +IsDelimiter[CharCodes_default.ForwardSlash] = 1; +IsDelimiter[CharCodes_default.Percent] = 1; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/syntax/Whitespace.js +var IsWhitespace = new Uint8Array(256); +IsWhitespace[CharCodes_default.Null] = 1; +IsWhitespace[CharCodes_default.Tab] = 1; +IsWhitespace[CharCodes_default.Newline] = 1; +IsWhitespace[CharCodes_default.FormFeed] = 1; +IsWhitespace[CharCodes_default.CarriageReturn] = 1; +IsWhitespace[CharCodes_default.Space] = 1; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/syntax/Irregular.js +var IsIrregular = new Uint8Array(256); +for (idx = 0, len = 256; idx < len; idx++) { + IsIrregular[idx] = IsWhitespace[idx] || IsDelimiter[idx] ? 1 : 0; +} +var idx; +var len; +IsIrregular[CharCodes_default.Hash] = 1; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFName.js +var decodeName = function(name) { + return name.replace(/#([\dABCDEF]{2})/g, function(_, hex) { + return charFromHexCode(hex); + }); +}; +var isRegularChar = function(charCode) { + return charCode >= CharCodes_default.ExclamationPoint && charCode <= CharCodes_default.Tilde && !IsIrregular[charCode]; +}; +var ENFORCER2 = {}; +var pool = /* @__PURE__ */ new Map(); +var PDFName = ( + /** @class */ + function(_super) { + __extends(PDFName2, _super); + function PDFName2(enforcer, name) { + var _this = this; + if (enforcer !== ENFORCER2) + throw new PrivateConstructorError("PDFName"); + _this = _super.call(this) || this; + var encodedName = "/"; + for (var idx = 0, len = name.length; idx < len; idx++) { + var character = name[idx]; + var code = toCharCode(character); + encodedName += isRegularChar(code) ? character : "#" + toHexString(code); + } + _this.encodedName = encodedName; + return _this; + } + PDFName2.prototype.asBytes = function() { + var bytes = []; + var hex = ""; + var escaped = false; + var pushByte = function(byte2) { + if (byte2 !== void 0) + bytes.push(byte2); + escaped = false; + }; + for (var idx = 1, len = this.encodedName.length; idx < len; idx++) { + var char = this.encodedName[idx]; + var byte = toCharCode(char); + var nextChar = this.encodedName[idx + 1]; + if (!escaped) { + if (byte === CharCodes_default.Hash) + escaped = true; + else + pushByte(byte); + } else { + if (byte >= CharCodes_default.Zero && byte <= CharCodes_default.Nine || byte >= CharCodes_default.a && byte <= CharCodes_default.f || byte >= CharCodes_default.A && byte <= CharCodes_default.F) { + hex += char; + if (hex.length === 2 || !(nextChar >= "0" && nextChar <= "9" || nextChar >= "a" && nextChar <= "f" || nextChar >= "A" && nextChar <= "F")) { + pushByte(parseInt(hex, 16)); + hex = ""; + } + } else { + pushByte(byte); + } + } + } + return new Uint8Array(bytes); + }; + PDFName2.prototype.decodeText = function() { + var bytes = this.asBytes(); + return String.fromCharCode.apply(String, Array.from(bytes)); + }; + PDFName2.prototype.asString = function() { + return this.encodedName; + }; + PDFName2.prototype.value = function() { + return this.encodedName; + }; + PDFName2.prototype.clone = function() { + return this; + }; + PDFName2.prototype.toString = function() { + return this.encodedName; + }; + PDFName2.prototype.sizeInBytes = function() { + return this.encodedName.length; + }; + PDFName2.prototype.copyBytesInto = function(buffer, offset) { + offset += copyStringIntoBuffer(this.encodedName, buffer, offset); + return this.encodedName.length; + }; + PDFName2.of = function(name) { + var decodedValue = decodeName(name); + var instance = pool.get(decodedValue); + if (!instance) { + instance = new PDFName2(ENFORCER2, decodedValue); + pool.set(decodedValue, instance); + } + return instance; + }; + PDFName2.Length = PDFName2.of("Length"); + PDFName2.FlateDecode = PDFName2.of("FlateDecode"); + PDFName2.Resources = PDFName2.of("Resources"); + PDFName2.Font = PDFName2.of("Font"); + PDFName2.XObject = PDFName2.of("XObject"); + PDFName2.ExtGState = PDFName2.of("ExtGState"); + PDFName2.Contents = PDFName2.of("Contents"); + PDFName2.Type = PDFName2.of("Type"); + PDFName2.Parent = PDFName2.of("Parent"); + PDFName2.MediaBox = PDFName2.of("MediaBox"); + PDFName2.Page = PDFName2.of("Page"); + PDFName2.Annots = PDFName2.of("Annots"); + PDFName2.TrimBox = PDFName2.of("TrimBox"); + PDFName2.ArtBox = PDFName2.of("ArtBox"); + PDFName2.BleedBox = PDFName2.of("BleedBox"); + PDFName2.CropBox = PDFName2.of("CropBox"); + PDFName2.Rotate = PDFName2.of("Rotate"); + PDFName2.Title = PDFName2.of("Title"); + PDFName2.Author = PDFName2.of("Author"); + PDFName2.Subject = PDFName2.of("Subject"); + PDFName2.Creator = PDFName2.of("Creator"); + PDFName2.Keywords = PDFName2.of("Keywords"); + PDFName2.Producer = PDFName2.of("Producer"); + PDFName2.CreationDate = PDFName2.of("CreationDate"); + PDFName2.ModDate = PDFName2.of("ModDate"); + return PDFName2; + }(PDFObject_default) +); +var PDFName_default = PDFName; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFNull.js +var PDFNull = ( + /** @class */ + function(_super) { + __extends(PDFNull2, _super); + function PDFNull2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFNull2.prototype.asNull = function() { + return null; + }; + PDFNull2.prototype.clone = function() { + return this; + }; + PDFNull2.prototype.toString = function() { + return "null"; + }; + PDFNull2.prototype.sizeInBytes = function() { + return 4; + }; + PDFNull2.prototype.copyBytesInto = function(buffer, offset) { + buffer[offset++] = CharCodes_default.n; + buffer[offset++] = CharCodes_default.u; + buffer[offset++] = CharCodes_default.l; + buffer[offset++] = CharCodes_default.l; + return 4; + }; + return PDFNull2; + }(PDFObject_default) +); +var PDFNull_default = new PDFNull(); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFDict.js +var PDFDict = ( + /** @class */ + function(_super) { + __extends(PDFDict2, _super); + function PDFDict2(map, context) { + var _this = _super.call(this) || this; + _this.dict = map; + _this.context = context; + return _this; + } + PDFDict2.prototype.keys = function() { + return Array.from(this.dict.keys()); + }; + PDFDict2.prototype.values = function() { + return Array.from(this.dict.values()); + }; + PDFDict2.prototype.entries = function() { + return Array.from(this.dict.entries()); + }; + PDFDict2.prototype.set = function(key, value) { + this.dict.set(key, value); + }; + PDFDict2.prototype.get = function(key, preservePDFNull) { + if (preservePDFNull === void 0) { + preservePDFNull = false; + } + var value = this.dict.get(key); + if (value === PDFNull_default && !preservePDFNull) + return void 0; + return value; + }; + PDFDict2.prototype.has = function(key) { + var value = this.dict.get(key); + return value !== void 0 && value !== PDFNull_default; + }; + PDFDict2.prototype.lookupMaybe = function(key) { + var _a3; + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + var preservePDFNull = types.includes(PDFNull_default); + var value = (_a3 = this.context).lookupMaybe.apply(_a3, __spreadArrays([this.get(key, preservePDFNull)], types)); + if (value === PDFNull_default && !preservePDFNull) + return void 0; + return value; + }; + PDFDict2.prototype.lookup = function(key) { + var _a3; + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + var preservePDFNull = types.includes(PDFNull_default); + var value = (_a3 = this.context).lookup.apply(_a3, __spreadArrays([this.get(key, preservePDFNull)], types)); + if (value === PDFNull_default && !preservePDFNull) + return void 0; + return value; + }; + PDFDict2.prototype.delete = function(key) { + return this.dict.delete(key); + }; + PDFDict2.prototype.asMap = function() { + return new Map(this.dict); + }; + PDFDict2.prototype.uniqueKey = function(tag) { + if (tag === void 0) { + tag = ""; + } + var existingKeys = this.keys(); + var key = PDFName_default.of(this.context.addRandomSuffix(tag, 10)); + while (existingKeys.includes(key)) { + key = PDFName_default.of(this.context.addRandomSuffix(tag, 10)); + } + return key; + }; + PDFDict2.prototype.clone = function(context) { + var clone = PDFDict2.withContext(context || this.context); + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a3 = entries[idx], key = _a3[0], value = _a3[1]; + clone.set(key, value); + } + return clone; + }; + PDFDict2.prototype.toString = function() { + var dictString = "<<\n"; + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a3 = entries[idx], key = _a3[0], value = _a3[1]; + dictString += key.toString() + " " + value.toString() + "\n"; + } + dictString += ">>"; + return dictString; + }; + PDFDict2.prototype.sizeInBytes = function() { + var size = 5; + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a3 = entries[idx], key = _a3[0], value = _a3[1]; + size += key.sizeInBytes() + value.sizeInBytes() + 2; + } + return size; + }; + PDFDict2.prototype.copyBytesInto = function(buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_default.LessThan; + buffer[offset++] = CharCodes_default.LessThan; + buffer[offset++] = CharCodes_default.Newline; + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a3 = entries[idx], key = _a3[0], value = _a3[1]; + offset += key.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Space; + offset += value.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + } + buffer[offset++] = CharCodes_default.GreaterThan; + buffer[offset++] = CharCodes_default.GreaterThan; + return offset - initialOffset; + }; + PDFDict2.withContext = function(context) { + return new PDFDict2(/* @__PURE__ */ new Map(), context); + }; + PDFDict2.fromMapWithContext = function(map, context) { + return new PDFDict2(map, context); + }; + return PDFDict2; + }(PDFObject_default) +); +var PDFDict_default = PDFDict; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFStream.js +var PDFStream = ( + /** @class */ + function(_super) { + __extends(PDFStream2, _super); + function PDFStream2(dict) { + var _this = _super.call(this) || this; + _this.dict = dict; + return _this; + } + PDFStream2.prototype.clone = function(_context) { + throw new MethodNotImplementedError(this.constructor.name, "clone"); + }; + PDFStream2.prototype.getContentsString = function() { + throw new MethodNotImplementedError(this.constructor.name, "getContentsString"); + }; + PDFStream2.prototype.getContents = function() { + throw new MethodNotImplementedError(this.constructor.name, "getContents"); + }; + PDFStream2.prototype.getContentsSize = function() { + throw new MethodNotImplementedError(this.constructor.name, "getContentsSize"); + }; + PDFStream2.prototype.updateDict = function() { + var contentsSize = this.getContentsSize(); + this.dict.set(PDFName_default.Length, PDFNumber_default.of(contentsSize)); + }; + PDFStream2.prototype.sizeInBytes = function() { + this.updateDict(); + return this.dict.sizeInBytes() + this.getContentsSize() + 18; + }; + PDFStream2.prototype.toString = function() { + this.updateDict(); + var streamString = this.dict.toString(); + streamString += "\nstream\n"; + streamString += this.getContentsString(); + streamString += "\nendstream"; + return streamString; + }; + PDFStream2.prototype.copyBytesInto = function(buffer, offset) { + this.updateDict(); + var initialOffset = offset; + offset += this.dict.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + buffer[offset++] = CharCodes_default.s; + buffer[offset++] = CharCodes_default.t; + buffer[offset++] = CharCodes_default.r; + buffer[offset++] = CharCodes_default.e; + buffer[offset++] = CharCodes_default.a; + buffer[offset++] = CharCodes_default.m; + buffer[offset++] = CharCodes_default.Newline; + var contents = this.getContents(); + for (var idx = 0, len = contents.length; idx < len; idx++) { + buffer[offset++] = contents[idx]; + } + buffer[offset++] = CharCodes_default.Newline; + buffer[offset++] = CharCodes_default.e; + buffer[offset++] = CharCodes_default.n; + buffer[offset++] = CharCodes_default.d; + buffer[offset++] = CharCodes_default.s; + buffer[offset++] = CharCodes_default.t; + buffer[offset++] = CharCodes_default.r; + buffer[offset++] = CharCodes_default.e; + buffer[offset++] = CharCodes_default.a; + buffer[offset++] = CharCodes_default.m; + return offset - initialOffset; + }; + return PDFStream2; + }(PDFObject_default) +); +var PDFStream_default = PDFStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFRawStream.js +var PDFRawStream = ( + /** @class */ + function(_super) { + __extends(PDFRawStream2, _super); + function PDFRawStream2(dict, contents) { + var _this = _super.call(this, dict) || this; + _this.contents = contents; + return _this; + } + PDFRawStream2.prototype.asUint8Array = function() { + return this.contents.slice(); + }; + PDFRawStream2.prototype.clone = function(context) { + return PDFRawStream2.of(this.dict.clone(context), this.contents.slice()); + }; + PDFRawStream2.prototype.getContentsString = function() { + return arrayAsString(this.contents); + }; + PDFRawStream2.prototype.getContents = function() { + return this.contents; + }; + PDFRawStream2.prototype.getContentsSize = function() { + return this.contents.length; + }; + PDFRawStream2.of = function(dict, contents) { + return new PDFRawStream2(dict, contents); + }; + return PDFRawStream2; + }(PDFStream_default) +); +var PDFRawStream_default = PDFRawStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFRef.js +var ENFORCER3 = {}; +var pool2 = /* @__PURE__ */ new Map(); +var PDFRef = ( + /** @class */ + function(_super) { + __extends(PDFRef3, _super); + function PDFRef3(enforcer, objectNumber, generationNumber) { + var _this = this; + if (enforcer !== ENFORCER3) + throw new PrivateConstructorError("PDFRef"); + _this = _super.call(this) || this; + _this.objectNumber = objectNumber; + _this.generationNumber = generationNumber; + _this.tag = objectNumber + " " + generationNumber + " R"; + return _this; + } + PDFRef3.prototype.clone = function() { + return this; + }; + PDFRef3.prototype.toString = function() { + return this.tag; + }; + PDFRef3.prototype.sizeInBytes = function() { + return this.tag.length; + }; + PDFRef3.prototype.copyBytesInto = function(buffer, offset) { + offset += copyStringIntoBuffer(this.tag, buffer, offset); + return this.tag.length; + }; + PDFRef3.of = function(objectNumber, generationNumber) { + if (generationNumber === void 0) { + generationNumber = 0; + } + var tag = objectNumber + " " + generationNumber + " R"; + var instance = pool2.get(tag); + if (!instance) { + instance = new PDFRef3(ENFORCER3, objectNumber, generationNumber); + pool2.set(tag, instance); + } + return instance; + }; + return PDFRef3; + }(PDFObject_default) +); +var PDFRef_default = PDFRef; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/operators/PDFOperator.js +var PDFOperator = ( + /** @class */ + function() { + function PDFOperator2(name, args) { + this.name = name; + this.args = args || []; + } + PDFOperator2.prototype.clone = function(context) { + var args = new Array(this.args.length); + for (var idx = 0, len = args.length; idx < len; idx++) { + var arg = this.args[idx]; + args[idx] = arg instanceof PDFObject_default ? arg.clone(context) : arg; + } + return PDFOperator2.of(this.name, args); + }; + PDFOperator2.prototype.toString = function() { + var value = ""; + for (var idx = 0, len = this.args.length; idx < len; idx++) { + value += String(this.args[idx]) + " "; + } + value += this.name; + return value; + }; + PDFOperator2.prototype.sizeInBytes = function() { + var size = 0; + for (var idx = 0, len = this.args.length; idx < len; idx++) { + var arg = this.args[idx]; + size += (arg instanceof PDFObject_default ? arg.sizeInBytes() : arg.length) + 1; + } + size += this.name.length; + return size; + }; + PDFOperator2.prototype.copyBytesInto = function(buffer, offset) { + var initialOffset = offset; + for (var idx = 0, len = this.args.length; idx < len; idx++) { + var arg = this.args[idx]; + if (arg instanceof PDFObject_default) { + offset += arg.copyBytesInto(buffer, offset); + } else { + offset += copyStringIntoBuffer(arg, buffer, offset); + } + buffer[offset++] = CharCodes_default.Space; + } + offset += copyStringIntoBuffer(this.name, buffer, offset); + return offset - initialOffset; + }; + PDFOperator2.of = function(name, args) { + return new PDFOperator2(name, args); + }; + return PDFOperator2; + }() +); +var PDFOperator_default = PDFOperator; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/operators/PDFOperatorNames.js +var PDFOperatorNames; +(function(PDFOperatorNames2) { + PDFOperatorNames2["NonStrokingColor"] = "sc"; + PDFOperatorNames2["NonStrokingColorN"] = "scn"; + PDFOperatorNames2["NonStrokingColorRgb"] = "rg"; + PDFOperatorNames2["NonStrokingColorGray"] = "g"; + PDFOperatorNames2["NonStrokingColorCmyk"] = "k"; + PDFOperatorNames2["NonStrokingColorspace"] = "cs"; + PDFOperatorNames2["StrokingColor"] = "SC"; + PDFOperatorNames2["StrokingColorN"] = "SCN"; + PDFOperatorNames2["StrokingColorRgb"] = "RG"; + PDFOperatorNames2["StrokingColorGray"] = "G"; + PDFOperatorNames2["StrokingColorCmyk"] = "K"; + PDFOperatorNames2["StrokingColorspace"] = "CS"; + PDFOperatorNames2["BeginMarkedContentSequence"] = "BDC"; + PDFOperatorNames2["BeginMarkedContent"] = "BMC"; + PDFOperatorNames2["EndMarkedContent"] = "EMC"; + PDFOperatorNames2["MarkedContentPointWithProps"] = "DP"; + PDFOperatorNames2["MarkedContentPoint"] = "MP"; + PDFOperatorNames2["DrawObject"] = "Do"; + PDFOperatorNames2["ConcatTransformationMatrix"] = "cm"; + PDFOperatorNames2["PopGraphicsState"] = "Q"; + PDFOperatorNames2["PushGraphicsState"] = "q"; + PDFOperatorNames2["SetFlatness"] = "i"; + PDFOperatorNames2["SetGraphicsStateParams"] = "gs"; + PDFOperatorNames2["SetLineCapStyle"] = "J"; + PDFOperatorNames2["SetLineDashPattern"] = "d"; + PDFOperatorNames2["SetLineJoinStyle"] = "j"; + PDFOperatorNames2["SetLineMiterLimit"] = "M"; + PDFOperatorNames2["SetLineWidth"] = "w"; + PDFOperatorNames2["SetTextMatrix"] = "Tm"; + PDFOperatorNames2["SetRenderingIntent"] = "ri"; + PDFOperatorNames2["AppendRectangle"] = "re"; + PDFOperatorNames2["BeginInlineImage"] = "BI"; + PDFOperatorNames2["BeginInlineImageData"] = "ID"; + PDFOperatorNames2["EndInlineImage"] = "EI"; + PDFOperatorNames2["ClipEvenOdd"] = "W*"; + PDFOperatorNames2["ClipNonZero"] = "W"; + PDFOperatorNames2["CloseAndStroke"] = "s"; + PDFOperatorNames2["CloseFillEvenOddAndStroke"] = "b*"; + PDFOperatorNames2["CloseFillNonZeroAndStroke"] = "b"; + PDFOperatorNames2["ClosePath"] = "h"; + PDFOperatorNames2["AppendBezierCurve"] = "c"; + PDFOperatorNames2["CurveToReplicateFinalPoint"] = "y"; + PDFOperatorNames2["CurveToReplicateInitialPoint"] = "v"; + PDFOperatorNames2["EndPath"] = "n"; + PDFOperatorNames2["FillEvenOddAndStroke"] = "B*"; + PDFOperatorNames2["FillEvenOdd"] = "f*"; + PDFOperatorNames2["FillNonZeroAndStroke"] = "B"; + PDFOperatorNames2["FillNonZero"] = "f"; + PDFOperatorNames2["LegacyFillNonZero"] = "F"; + PDFOperatorNames2["LineTo"] = "l"; + PDFOperatorNames2["MoveTo"] = "m"; + PDFOperatorNames2["ShadingFill"] = "sh"; + PDFOperatorNames2["StrokePath"] = "S"; + PDFOperatorNames2["BeginText"] = "BT"; + PDFOperatorNames2["EndText"] = "ET"; + PDFOperatorNames2["MoveText"] = "Td"; + PDFOperatorNames2["MoveTextSetLeading"] = "TD"; + PDFOperatorNames2["NextLine"] = "T*"; + PDFOperatorNames2["SetCharacterSpacing"] = "Tc"; + PDFOperatorNames2["SetFontAndSize"] = "Tf"; + PDFOperatorNames2["SetTextHorizontalScaling"] = "Tz"; + PDFOperatorNames2["SetTextLineHeight"] = "TL"; + PDFOperatorNames2["SetTextRenderingMode"] = "Tr"; + PDFOperatorNames2["SetTextRise"] = "Ts"; + PDFOperatorNames2["SetWordSpacing"] = "Tw"; + PDFOperatorNames2["ShowText"] = "Tj"; + PDFOperatorNames2["ShowTextAdjusted"] = "TJ"; + PDFOperatorNames2["ShowTextLine"] = "'"; + PDFOperatorNames2["ShowTextLineAndSpace"] = '"'; + PDFOperatorNames2["Type3D0"] = "d0"; + PDFOperatorNames2["Type3D1"] = "d1"; + PDFOperatorNames2["BeginCompatibilitySection"] = "BX"; + PDFOperatorNames2["EndCompatibilitySection"] = "EX"; +})(PDFOperatorNames || (PDFOperatorNames = {})); +var PDFOperatorNames_default = PDFOperatorNames; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/structures/PDFFlateStream.js +var import_pako2 = __toESM(require_pako()); +var PDFFlateStream = ( + /** @class */ + function(_super) { + __extends(PDFFlateStream2, _super); + function PDFFlateStream2(dict, encode) { + var _this = _super.call(this, dict) || this; + _this.computeContents = function() { + var unencodedContents = _this.getUnencodedContents(); + return _this.encode ? import_pako2.default.deflate(unencodedContents) : unencodedContents; + }; + _this.encode = encode; + if (encode) + dict.set(PDFName_default.of("Filter"), PDFName_default.of("FlateDecode")); + _this.contentsCache = Cache_default.populatedBy(_this.computeContents); + return _this; + } + PDFFlateStream2.prototype.getContents = function() { + return this.contentsCache.access(); + }; + PDFFlateStream2.prototype.getContentsSize = function() { + return this.contentsCache.access().length; + }; + PDFFlateStream2.prototype.getUnencodedContents = function() { + throw new MethodNotImplementedError(this.constructor.name, "getUnencodedContents"); + }; + return PDFFlateStream2; + }(PDFStream_default) +); +var PDFFlateStream_default = PDFFlateStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/structures/PDFContentStream.js +var PDFContentStream = ( + /** @class */ + function(_super) { + __extends(PDFContentStream2, _super); + function PDFContentStream2(dict, operators, encode) { + if (encode === void 0) { + encode = true; + } + var _this = _super.call(this, dict, encode) || this; + _this.operators = operators; + return _this; + } + PDFContentStream2.prototype.push = function() { + var _a3; + var operators = []; + for (var _i = 0; _i < arguments.length; _i++) { + operators[_i] = arguments[_i]; + } + (_a3 = this.operators).push.apply(_a3, operators); + }; + PDFContentStream2.prototype.clone = function(context) { + var operators = new Array(this.operators.length); + for (var idx = 0, len = this.operators.length; idx < len; idx++) { + operators[idx] = this.operators[idx].clone(context); + } + var _a3 = this, dict = _a3.dict, encode = _a3.encode; + return PDFContentStream2.of(dict.clone(context), operators, encode); + }; + PDFContentStream2.prototype.getContentsString = function() { + var value = ""; + for (var idx = 0, len = this.operators.length; idx < len; idx++) { + value += this.operators[idx] + "\n"; + } + return value; + }; + PDFContentStream2.prototype.getUnencodedContents = function() { + var buffer = new Uint8Array(this.getUnencodedContentsSize()); + var offset = 0; + for (var idx = 0, len = this.operators.length; idx < len; idx++) { + offset += this.operators[idx].copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + } + return buffer; + }; + PDFContentStream2.prototype.getUnencodedContentsSize = function() { + var size = 0; + for (var idx = 0, len = this.operators.length; idx < len; idx++) { + size += this.operators[idx].sizeInBytes() + 1; + } + return size; + }; + PDFContentStream2.of = function(dict, operators, encode) { + if (encode === void 0) { + encode = true; + } + return new PDFContentStream2(dict, operators, encode); + }; + return PDFContentStream2; + }(PDFFlateStream_default) +); +var PDFContentStream_default = PDFContentStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/rng.js +var SimpleRNG = ( + /** @class */ + function() { + function SimpleRNG2(seed) { + this.seed = seed; + } + SimpleRNG2.prototype.nextInt = function() { + var x = Math.sin(this.seed++) * 1e4; + return x - Math.floor(x); + }; + SimpleRNG2.withSeed = function(seed) { + return new SimpleRNG2(seed); + }; + return SimpleRNG2; + }() +); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/PDFContext.js +var byAscendingObjectNumber = function(_a3, _b3) { + var a = _a3[0]; + var b = _b3[0]; + return a.objectNumber - b.objectNumber; +}; +var PDFContext = ( + /** @class */ + function() { + function PDFContext2() { + this.largestObjectNumber = 0; + this.header = PDFHeader_default.forVersion(1, 7); + this.trailerInfo = {}; + this.indirectObjects = /* @__PURE__ */ new Map(); + this.rng = SimpleRNG.withSeed(1); + } + PDFContext2.prototype.assign = function(ref, object) { + this.indirectObjects.set(ref, object); + if (ref.objectNumber > this.largestObjectNumber) { + this.largestObjectNumber = ref.objectNumber; + } + }; + PDFContext2.prototype.nextRef = function() { + this.largestObjectNumber += 1; + return PDFRef_default.of(this.largestObjectNumber); + }; + PDFContext2.prototype.register = function(object) { + var ref = this.nextRef(); + this.assign(ref, object); + return ref; + }; + PDFContext2.prototype.delete = function(ref) { + return this.indirectObjects.delete(ref); + }; + PDFContext2.prototype.lookupMaybe = function(ref) { + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + var preservePDFNull = types.includes(PDFNull_default); + var result = ref instanceof PDFRef_default ? this.indirectObjects.get(ref) : ref; + if (!result || result === PDFNull_default && !preservePDFNull) + return void 0; + for (var idx = 0, len = types.length; idx < len; idx++) { + var type = types[idx]; + if (type === PDFNull_default) { + if (result === PDFNull_default) + return result; + } else { + if (result instanceof type) + return result; + } + } + throw new UnexpectedObjectTypeError(types, result); + }; + PDFContext2.prototype.lookup = function(ref) { + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + var result = ref instanceof PDFRef_default ? this.indirectObjects.get(ref) : ref; + if (types.length === 0) + return result; + for (var idx = 0, len = types.length; idx < len; idx++) { + var type = types[idx]; + if (type === PDFNull_default) { + if (result === PDFNull_default) + return result; + } else { + if (result instanceof type) + return result; + } + } + throw new UnexpectedObjectTypeError(types, result); + }; + PDFContext2.prototype.getObjectRef = function(pdfObject) { + var entries = Array.from(this.indirectObjects.entries()); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a3 = entries[idx], ref = _a3[0], object = _a3[1]; + if (object === pdfObject) { + return ref; + } + } + return void 0; + }; + PDFContext2.prototype.enumerateIndirectObjects = function() { + return Array.from(this.indirectObjects.entries()).sort(byAscendingObjectNumber); + }; + PDFContext2.prototype.obj = function(literal) { + if (literal instanceof PDFObject_default) { + return literal; + } else if (literal === null || literal === void 0) { + return PDFNull_default; + } else if (typeof literal === "string") { + return PDFName_default.of(literal); + } else if (typeof literal === "number") { + return PDFNumber_default.of(literal); + } else if (typeof literal === "boolean") { + return literal ? PDFBool_default.True : PDFBool_default.False; + } else if (Array.isArray(literal)) { + var array = PDFArray_default.withContext(this); + for (var idx = 0, len = literal.length; idx < len; idx++) { + array.push(this.obj(literal[idx])); + } + return array; + } else { + var dict = PDFDict_default.withContext(this); + var keys = Object.keys(literal); + for (var idx = 0, len = keys.length; idx < len; idx++) { + var key = keys[idx]; + var value = literal[key]; + if (value !== void 0) + dict.set(PDFName_default.of(key), this.obj(value)); + } + return dict; + } + }; + PDFContext2.prototype.stream = function(contents, dict) { + if (dict === void 0) { + dict = {}; + } + return PDFRawStream_default.of(this.obj(dict), typedArrayFor(contents)); + }; + PDFContext2.prototype.flateStream = function(contents, dict) { + if (dict === void 0) { + dict = {}; + } + return this.stream(import_pako3.default.deflate(typedArrayFor(contents)), __assign(__assign({}, dict), { Filter: "FlateDecode" })); + }; + PDFContext2.prototype.contentStream = function(operators, dict) { + if (dict === void 0) { + dict = {}; + } + return PDFContentStream_default.of(this.obj(dict), operators); + }; + PDFContext2.prototype.formXObject = function(operators, dict) { + if (dict === void 0) { + dict = {}; + } + return this.contentStream(operators, __assign(__assign({ BBox: this.obj([0, 0, 0, 0]), Matrix: this.obj([1, 0, 0, 1, 0, 0]) }, dict), { Type: "XObject", Subtype: "Form" })); + }; + PDFContext2.prototype.getPushGraphicsStateContentStream = function() { + if (this.pushGraphicsStateContentStreamRef) { + return this.pushGraphicsStateContentStreamRef; + } + var dict = this.obj({}); + var op = PDFOperator_default.of(PDFOperatorNames_default.PushGraphicsState); + var stream2 = PDFContentStream_default.of(dict, [op]); + this.pushGraphicsStateContentStreamRef = this.register(stream2); + return this.pushGraphicsStateContentStreamRef; + }; + PDFContext2.prototype.getPopGraphicsStateContentStream = function() { + if (this.popGraphicsStateContentStreamRef) { + return this.popGraphicsStateContentStreamRef; + } + var dict = this.obj({}); + var op = PDFOperator_default.of(PDFOperatorNames_default.PopGraphicsState); + var stream2 = PDFContentStream_default.of(dict, [op]); + this.popGraphicsStateContentStreamRef = this.register(stream2); + return this.popGraphicsStateContentStreamRef; + }; + PDFContext2.prototype.addRandomSuffix = function(prefix, suffixLength) { + if (suffixLength === void 0) { + suffixLength = 4; + } + return prefix + "-" + Math.floor(this.rng.nextInt() * Math.pow(10, suffixLength)); + }; + PDFContext2.create = function() { + return new PDFContext2(); + }; + return PDFContext2; + }() +); +var PDFContext_default = PDFContext; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/structures/PDFPageLeaf.js +var PDFPageLeaf = ( + /** @class */ + function(_super) { + __extends(PDFPageLeaf2, _super); + function PDFPageLeaf2(map, context, autoNormalizeCTM) { + if (autoNormalizeCTM === void 0) { + autoNormalizeCTM = true; + } + var _this = _super.call(this, map, context) || this; + _this.normalized = false; + _this.autoNormalizeCTM = autoNormalizeCTM; + return _this; + } + PDFPageLeaf2.prototype.clone = function(context) { + var clone = PDFPageLeaf2.fromMapWithContext(/* @__PURE__ */ new Map(), context || this.context, this.autoNormalizeCTM); + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a3 = entries[idx], key = _a3[0], value = _a3[1]; + clone.set(key, value); + } + return clone; + }; + PDFPageLeaf2.prototype.Parent = function() { + return this.lookupMaybe(PDFName_default.Parent, PDFDict_default); + }; + PDFPageLeaf2.prototype.Contents = function() { + return this.lookup(PDFName_default.of("Contents")); + }; + PDFPageLeaf2.prototype.Annots = function() { + return this.lookupMaybe(PDFName_default.Annots, PDFArray_default); + }; + PDFPageLeaf2.prototype.BleedBox = function() { + return this.lookupMaybe(PDFName_default.BleedBox, PDFArray_default); + }; + PDFPageLeaf2.prototype.TrimBox = function() { + return this.lookupMaybe(PDFName_default.TrimBox, PDFArray_default); + }; + PDFPageLeaf2.prototype.ArtBox = function() { + return this.lookupMaybe(PDFName_default.ArtBox, PDFArray_default); + }; + PDFPageLeaf2.prototype.Resources = function() { + var dictOrRef = this.getInheritableAttribute(PDFName_default.Resources); + return this.context.lookupMaybe(dictOrRef, PDFDict_default); + }; + PDFPageLeaf2.prototype.MediaBox = function() { + var arrayOrRef = this.getInheritableAttribute(PDFName_default.MediaBox); + return this.context.lookup(arrayOrRef, PDFArray_default); + }; + PDFPageLeaf2.prototype.CropBox = function() { + var arrayOrRef = this.getInheritableAttribute(PDFName_default.CropBox); + return this.context.lookupMaybe(arrayOrRef, PDFArray_default); + }; + PDFPageLeaf2.prototype.Rotate = function() { + var numberOrRef = this.getInheritableAttribute(PDFName_default.Rotate); + return this.context.lookupMaybe(numberOrRef, PDFNumber_default); + }; + PDFPageLeaf2.prototype.getInheritableAttribute = function(name) { + var attribute; + this.ascend(function(node) { + if (!attribute) + attribute = node.get(name); + }); + return attribute; + }; + PDFPageLeaf2.prototype.setParent = function(parentRef) { + this.set(PDFName_default.Parent, parentRef); + }; + PDFPageLeaf2.prototype.addContentStream = function(contentStreamRef) { + var Contents = this.normalizedEntries().Contents || this.context.obj([]); + this.set(PDFName_default.Contents, Contents); + Contents.push(contentStreamRef); + }; + PDFPageLeaf2.prototype.wrapContentStreams = function(startStream, endStream) { + var Contents = this.Contents(); + if (Contents instanceof PDFArray_default) { + Contents.insert(0, startStream); + Contents.push(endStream); + return true; + } + return false; + }; + PDFPageLeaf2.prototype.addAnnot = function(annotRef) { + var Annots = this.normalizedEntries().Annots; + Annots.push(annotRef); + }; + PDFPageLeaf2.prototype.removeAnnot = function(annotRef) { + var Annots = this.normalizedEntries().Annots; + var index2 = Annots.indexOf(annotRef); + if (index2 !== void 0) { + Annots.remove(index2); + } + }; + PDFPageLeaf2.prototype.setFontDictionary = function(name, fontDictRef) { + var Font2 = this.normalizedEntries().Font; + Font2.set(name, fontDictRef); + }; + PDFPageLeaf2.prototype.newFontDictionaryKey = function(tag) { + var Font2 = this.normalizedEntries().Font; + return Font2.uniqueKey(tag); + }; + PDFPageLeaf2.prototype.newFontDictionary = function(tag, fontDictRef) { + var key = this.newFontDictionaryKey(tag); + this.setFontDictionary(key, fontDictRef); + return key; + }; + PDFPageLeaf2.prototype.setXObject = function(name, xObjectRef) { + var XObject = this.normalizedEntries().XObject; + XObject.set(name, xObjectRef); + }; + PDFPageLeaf2.prototype.newXObjectKey = function(tag) { + var XObject = this.normalizedEntries().XObject; + return XObject.uniqueKey(tag); + }; + PDFPageLeaf2.prototype.newXObject = function(tag, xObjectRef) { + var key = this.newXObjectKey(tag); + this.setXObject(key, xObjectRef); + return key; + }; + PDFPageLeaf2.prototype.setExtGState = function(name, extGStateRef) { + var ExtGState = this.normalizedEntries().ExtGState; + ExtGState.set(name, extGStateRef); + }; + PDFPageLeaf2.prototype.newExtGStateKey = function(tag) { + var ExtGState = this.normalizedEntries().ExtGState; + return ExtGState.uniqueKey(tag); + }; + PDFPageLeaf2.prototype.newExtGState = function(tag, extGStateRef) { + var key = this.newExtGStateKey(tag); + this.setExtGState(key, extGStateRef); + return key; + }; + PDFPageLeaf2.prototype.ascend = function(visitor) { + visitor(this); + var Parent = this.Parent(); + if (Parent) + Parent.ascend(visitor); + }; + PDFPageLeaf2.prototype.normalize = function() { + if (this.normalized) + return; + var context = this.context; + var contentsRef = this.get(PDFName_default.Contents); + var contents = this.context.lookup(contentsRef); + if (contents instanceof PDFStream_default) { + this.set(PDFName_default.Contents, context.obj([contentsRef])); + } + if (this.autoNormalizeCTM) { + this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(), this.context.getPopGraphicsStateContentStream()); + } + var dictOrRef = this.getInheritableAttribute(PDFName_default.Resources); + var Resources = context.lookupMaybe(dictOrRef, PDFDict_default) || context.obj({}); + this.set(PDFName_default.Resources, Resources); + var Font2 = Resources.lookupMaybe(PDFName_default.Font, PDFDict_default) || context.obj({}); + Resources.set(PDFName_default.Font, Font2); + var XObject = Resources.lookupMaybe(PDFName_default.XObject, PDFDict_default) || context.obj({}); + Resources.set(PDFName_default.XObject, XObject); + var ExtGState = Resources.lookupMaybe(PDFName_default.ExtGState, PDFDict_default) || context.obj({}); + Resources.set(PDFName_default.ExtGState, ExtGState); + var Annots = this.Annots() || context.obj([]); + this.set(PDFName_default.Annots, Annots); + this.normalized = true; + }; + PDFPageLeaf2.prototype.normalizedEntries = function() { + this.normalize(); + var Annots = this.Annots(); + var Resources = this.Resources(); + var Contents = this.Contents(); + return { + Annots, + Resources, + Contents, + Font: Resources.lookup(PDFName_default.Font, PDFDict_default), + XObject: Resources.lookup(PDFName_default.XObject, PDFDict_default), + ExtGState: Resources.lookup(PDFName_default.ExtGState, PDFDict_default) + }; + }; + PDFPageLeaf2.InheritableEntries = [ + "Resources", + "MediaBox", + "CropBox", + "Rotate" + ]; + PDFPageLeaf2.withContextAndParent = function(context, parent) { + var dict = /* @__PURE__ */ new Map(); + dict.set(PDFName_default.Type, PDFName_default.Page); + dict.set(PDFName_default.Parent, parent); + dict.set(PDFName_default.Resources, context.obj({})); + dict.set(PDFName_default.MediaBox, context.obj([0, 0, 612, 792])); + return new PDFPageLeaf2(dict, context, false); + }; + PDFPageLeaf2.fromMapWithContext = function(map, context, autoNormalizeCTM) { + if (autoNormalizeCTM === void 0) { + autoNormalizeCTM = true; + } + return new PDFPageLeaf2(map, context, autoNormalizeCTM); + }; + return PDFPageLeaf2; + }(PDFDict_default) +); +var PDFPageLeaf_default = PDFPageLeaf; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/PDFObjectCopier.js +var PDFObjectCopier = ( + /** @class */ + function() { + function PDFObjectCopier2(src, dest) { + var _this = this; + this.traversedObjects = /* @__PURE__ */ new Map(); + this.copy = function(object) { + return object instanceof PDFPageLeaf_default ? _this.copyPDFPage(object) : object instanceof PDFDict_default ? _this.copyPDFDict(object) : object instanceof PDFArray_default ? _this.copyPDFArray(object) : object instanceof PDFStream_default ? _this.copyPDFStream(object) : object instanceof PDFRef_default ? _this.copyPDFIndirectObject(object) : object.clone(); + }; + this.copyPDFPage = function(originalPage) { + var clonedPage = originalPage.clone(); + var InheritableEntries = PDFPageLeaf_default.InheritableEntries; + for (var idx = 0, len = InheritableEntries.length; idx < len; idx++) { + var key = PDFName_default.of(InheritableEntries[idx]); + var value = clonedPage.getInheritableAttribute(key); + if (!clonedPage.get(key) && value) + clonedPage.set(key, value); + } + clonedPage.delete(PDFName_default.of("Parent")); + return _this.copyPDFDict(clonedPage); + }; + this.copyPDFDict = function(originalDict) { + if (_this.traversedObjects.has(originalDict)) { + return _this.traversedObjects.get(originalDict); + } + var clonedDict = originalDict.clone(_this.dest); + _this.traversedObjects.set(originalDict, clonedDict); + var entries = originalDict.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a3 = entries[idx], key = _a3[0], value = _a3[1]; + clonedDict.set(key, _this.copy(value)); + } + return clonedDict; + }; + this.copyPDFArray = function(originalArray) { + if (_this.traversedObjects.has(originalArray)) { + return _this.traversedObjects.get(originalArray); + } + var clonedArray = originalArray.clone(_this.dest); + _this.traversedObjects.set(originalArray, clonedArray); + for (var idx = 0, len = originalArray.size(); idx < len; idx++) { + var value = originalArray.get(idx); + clonedArray.set(idx, _this.copy(value)); + } + return clonedArray; + }; + this.copyPDFStream = function(originalStream) { + if (_this.traversedObjects.has(originalStream)) { + return _this.traversedObjects.get(originalStream); + } + var clonedStream = originalStream.clone(_this.dest); + _this.traversedObjects.set(originalStream, clonedStream); + var entries = originalStream.dict.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a3 = entries[idx], key = _a3[0], value = _a3[1]; + clonedStream.dict.set(key, _this.copy(value)); + } + return clonedStream; + }; + this.copyPDFIndirectObject = function(ref) { + var alreadyMapped = _this.traversedObjects.has(ref); + if (!alreadyMapped) { + var newRef = _this.dest.nextRef(); + _this.traversedObjects.set(ref, newRef); + var dereferencedValue = _this.src.lookup(ref); + if (dereferencedValue) { + var cloned = _this.copy(dereferencedValue); + _this.dest.assign(newRef, cloned); + } + } + return _this.traversedObjects.get(ref); + }; + this.src = src; + this.dest = dest; + } + PDFObjectCopier2.for = function(src, dest) { + return new PDFObjectCopier2(src, dest); + }; + return PDFObjectCopier2; + }() +); +var PDFObjectCopier_default = PDFObjectCopier; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/document/PDFCrossRefSection.js +var PDFCrossRefSection = ( + /** @class */ + function() { + function PDFCrossRefSection2(firstEntry) { + this.subsections = firstEntry ? [[firstEntry]] : []; + this.chunkIdx = 0; + this.chunkLength = firstEntry ? 1 : 0; + } + PDFCrossRefSection2.prototype.addEntry = function(ref, offset) { + this.append({ ref, offset, deleted: false }); + }; + PDFCrossRefSection2.prototype.addDeletedEntry = function(ref, nextFreeObjectNumber) { + this.append({ ref, offset: nextFreeObjectNumber, deleted: true }); + }; + PDFCrossRefSection2.prototype.toString = function() { + var section = "xref\n"; + for (var rangeIdx = 0, rangeLen = this.subsections.length; rangeIdx < rangeLen; rangeIdx++) { + var range2 = this.subsections[rangeIdx]; + section += range2[0].ref.objectNumber + " " + range2.length + "\n"; + for (var entryIdx = 0, entryLen = range2.length; entryIdx < entryLen; entryIdx++) { + var entry = range2[entryIdx]; + section += padStart(String(entry.offset), 10, "0"); + section += " "; + section += padStart(String(entry.ref.generationNumber), 5, "0"); + section += " "; + section += entry.deleted ? "f" : "n"; + section += " \n"; + } + } + return section; + }; + PDFCrossRefSection2.prototype.sizeInBytes = function() { + var size = 5; + for (var idx = 0, len = this.subsections.length; idx < len; idx++) { + var subsection = this.subsections[idx]; + var subsectionLength = subsection.length; + var firstEntry = subsection[0]; + size += 2; + size += String(firstEntry.ref.objectNumber).length; + size += String(subsectionLength).length; + size += 20 * subsectionLength; + } + return size; + }; + PDFCrossRefSection2.prototype.copyBytesInto = function(buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_default.x; + buffer[offset++] = CharCodes_default.r; + buffer[offset++] = CharCodes_default.e; + buffer[offset++] = CharCodes_default.f; + buffer[offset++] = CharCodes_default.Newline; + offset += this.copySubsectionsIntoBuffer(this.subsections, buffer, offset); + return offset - initialOffset; + }; + PDFCrossRefSection2.prototype.copySubsectionsIntoBuffer = function(subsections, buffer, offset) { + var initialOffset = offset; + var length = subsections.length; + for (var idx = 0; idx < length; idx++) { + var subsection = this.subsections[idx]; + var firstObjectNumber = String(subsection[0].ref.objectNumber); + offset += copyStringIntoBuffer(firstObjectNumber, buffer, offset); + buffer[offset++] = CharCodes_default.Space; + var rangeLength = String(subsection.length); + offset += copyStringIntoBuffer(rangeLength, buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + offset += this.copyEntriesIntoBuffer(subsection, buffer, offset); + } + return offset - initialOffset; + }; + PDFCrossRefSection2.prototype.copyEntriesIntoBuffer = function(entries, buffer, offset) { + var length = entries.length; + for (var idx = 0; idx < length; idx++) { + var entry = entries[idx]; + var entryOffset = padStart(String(entry.offset), 10, "0"); + offset += copyStringIntoBuffer(entryOffset, buffer, offset); + buffer[offset++] = CharCodes_default.Space; + var entryGen = padStart(String(entry.ref.generationNumber), 5, "0"); + offset += copyStringIntoBuffer(entryGen, buffer, offset); + buffer[offset++] = CharCodes_default.Space; + buffer[offset++] = entry.deleted ? CharCodes_default.f : CharCodes_default.n; + buffer[offset++] = CharCodes_default.Space; + buffer[offset++] = CharCodes_default.Newline; + } + return 20 * length; + }; + PDFCrossRefSection2.prototype.append = function(currEntry) { + if (this.chunkLength === 0) { + this.subsections.push([currEntry]); + this.chunkIdx = 0; + this.chunkLength = 1; + return; + } + var chunk = this.subsections[this.chunkIdx]; + var prevEntry = chunk[this.chunkLength - 1]; + if (currEntry.ref.objectNumber - prevEntry.ref.objectNumber > 1) { + this.subsections.push([currEntry]); + this.chunkIdx += 1; + this.chunkLength = 1; + } else { + chunk.push(currEntry); + this.chunkLength += 1; + } + }; + PDFCrossRefSection2.create = function() { + return new PDFCrossRefSection2({ + ref: PDFRef_default.of(0, 65535), + offset: 0, + deleted: true + }); + }; + PDFCrossRefSection2.createEmpty = function() { + return new PDFCrossRefSection2(); + }; + return PDFCrossRefSection2; + }() +); +var PDFCrossRefSection_default = PDFCrossRefSection; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/document/PDFTrailer.js +var PDFTrailer = ( + /** @class */ + function() { + function PDFTrailer2(lastXRefOffset) { + this.lastXRefOffset = String(lastXRefOffset); + } + PDFTrailer2.prototype.toString = function() { + return "startxref\n" + this.lastXRefOffset + "\n%%EOF"; + }; + PDFTrailer2.prototype.sizeInBytes = function() { + return 16 + this.lastXRefOffset.length; + }; + PDFTrailer2.prototype.copyBytesInto = function(buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_default.s; + buffer[offset++] = CharCodes_default.t; + buffer[offset++] = CharCodes_default.a; + buffer[offset++] = CharCodes_default.r; + buffer[offset++] = CharCodes_default.t; + buffer[offset++] = CharCodes_default.x; + buffer[offset++] = CharCodes_default.r; + buffer[offset++] = CharCodes_default.e; + buffer[offset++] = CharCodes_default.f; + buffer[offset++] = CharCodes_default.Newline; + offset += copyStringIntoBuffer(this.lastXRefOffset, buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + buffer[offset++] = CharCodes_default.Percent; + buffer[offset++] = CharCodes_default.Percent; + buffer[offset++] = CharCodes_default.E; + buffer[offset++] = CharCodes_default.O; + buffer[offset++] = CharCodes_default.F; + return offset - initialOffset; + }; + PDFTrailer2.forLastCrossRefSectionOffset = function(offset) { + return new PDFTrailer2(offset); + }; + return PDFTrailer2; + }() +); +var PDFTrailer_default = PDFTrailer; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/document/PDFTrailerDict.js +var PDFTrailerDict = ( + /** @class */ + function() { + function PDFTrailerDict2(dict) { + this.dict = dict; + } + PDFTrailerDict2.prototype.toString = function() { + return "trailer\n" + this.dict.toString(); + }; + PDFTrailerDict2.prototype.sizeInBytes = function() { + return 8 + this.dict.sizeInBytes(); + }; + PDFTrailerDict2.prototype.copyBytesInto = function(buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_default.t; + buffer[offset++] = CharCodes_default.r; + buffer[offset++] = CharCodes_default.a; + buffer[offset++] = CharCodes_default.i; + buffer[offset++] = CharCodes_default.l; + buffer[offset++] = CharCodes_default.e; + buffer[offset++] = CharCodes_default.r; + buffer[offset++] = CharCodes_default.Newline; + offset += this.dict.copyBytesInto(buffer, offset); + return offset - initialOffset; + }; + PDFTrailerDict2.of = function(dict) { + return new PDFTrailerDict2(dict); + }; + return PDFTrailerDict2; + }() +); +var PDFTrailerDict_default = PDFTrailerDict; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/structures/PDFObjectStream.js +var PDFObjectStream = ( + /** @class */ + function(_super) { + __extends(PDFObjectStream2, _super); + function PDFObjectStream2(context, objects, encode) { + if (encode === void 0) { + encode = true; + } + var _this = _super.call(this, context.obj({}), encode) || this; + _this.objects = objects; + _this.offsets = _this.computeObjectOffsets(); + _this.offsetsString = _this.computeOffsetsString(); + _this.dict.set(PDFName_default.of("Type"), PDFName_default.of("ObjStm")); + _this.dict.set(PDFName_default.of("N"), PDFNumber_default.of(_this.objects.length)); + _this.dict.set(PDFName_default.of("First"), PDFNumber_default.of(_this.offsetsString.length)); + return _this; + } + PDFObjectStream2.prototype.getObjectsCount = function() { + return this.objects.length; + }; + PDFObjectStream2.prototype.clone = function(context) { + return PDFObjectStream2.withContextAndObjects(context || this.dict.context, this.objects.slice(), this.encode); + }; + PDFObjectStream2.prototype.getContentsString = function() { + var value = this.offsetsString; + for (var idx = 0, len = this.objects.length; idx < len; idx++) { + var _a3 = this.objects[idx], object = _a3[1]; + value += object + "\n"; + } + return value; + }; + PDFObjectStream2.prototype.getUnencodedContents = function() { + var buffer = new Uint8Array(this.getUnencodedContentsSize()); + var offset = copyStringIntoBuffer(this.offsetsString, buffer, 0); + for (var idx = 0, len = this.objects.length; idx < len; idx++) { + var _a3 = this.objects[idx], object = _a3[1]; + offset += object.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + } + return buffer; + }; + PDFObjectStream2.prototype.getUnencodedContentsSize = function() { + return this.offsetsString.length + last(this.offsets)[1] + last(this.objects)[1].sizeInBytes() + 1; + }; + PDFObjectStream2.prototype.computeOffsetsString = function() { + var offsetsString = ""; + for (var idx = 0, len = this.offsets.length; idx < len; idx++) { + var _a3 = this.offsets[idx], objectNumber = _a3[0], offset = _a3[1]; + offsetsString += objectNumber + " " + offset + " "; + } + return offsetsString; + }; + PDFObjectStream2.prototype.computeObjectOffsets = function() { + var offset = 0; + var offsets = new Array(this.objects.length); + for (var idx = 0, len = this.objects.length; idx < len; idx++) { + var _a3 = this.objects[idx], ref = _a3[0], object = _a3[1]; + offsets[idx] = [ref.objectNumber, offset]; + offset += object.sizeInBytes() + 1; + } + return offsets; + }; + PDFObjectStream2.withContextAndObjects = function(context, objects, encode) { + if (encode === void 0) { + encode = true; + } + return new PDFObjectStream2(context, objects, encode); + }; + return PDFObjectStream2; + }(PDFFlateStream_default) +); +var PDFObjectStream_default = PDFObjectStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/writers/PDFWriter.js +var PDFWriter = ( + /** @class */ + function() { + function PDFWriter2(context, objectsPerTick) { + var _this = this; + this.parsedObjects = 0; + this.shouldWaitForTick = function(n) { + _this.parsedObjects += n; + return _this.parsedObjects % _this.objectsPerTick === 0; + }; + this.context = context; + this.objectsPerTick = objectsPerTick; + } + PDFWriter2.prototype.serializeToBuffer = function() { + return __awaiter(this, void 0, void 0, function() { + var _a3, size, header, indirectObjects, xref, trailerDict, trailer, offset, buffer, idx, len, _b3, ref, object, objectNumber, generationNumber, n; + return __generator(this, function(_c2) { + switch (_c2.label) { + case 0: + return [4, this.computeBufferSize()]; + case 1: + _a3 = _c2.sent(), size = _a3.size, header = _a3.header, indirectObjects = _a3.indirectObjects, xref = _a3.xref, trailerDict = _a3.trailerDict, trailer = _a3.trailer; + offset = 0; + buffer = new Uint8Array(size); + offset += header.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + buffer[offset++] = CharCodes_default.Newline; + idx = 0, len = indirectObjects.length; + _c2.label = 2; + case 2: + if (!(idx < len)) return [3, 5]; + _b3 = indirectObjects[idx], ref = _b3[0], object = _b3[1]; + objectNumber = String(ref.objectNumber); + offset += copyStringIntoBuffer(objectNumber, buffer, offset); + buffer[offset++] = CharCodes_default.Space; + generationNumber = String(ref.generationNumber); + offset += copyStringIntoBuffer(generationNumber, buffer, offset); + buffer[offset++] = CharCodes_default.Space; + buffer[offset++] = CharCodes_default.o; + buffer[offset++] = CharCodes_default.b; + buffer[offset++] = CharCodes_default.j; + buffer[offset++] = CharCodes_default.Newline; + offset += object.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + buffer[offset++] = CharCodes_default.e; + buffer[offset++] = CharCodes_default.n; + buffer[offset++] = CharCodes_default.d; + buffer[offset++] = CharCodes_default.o; + buffer[offset++] = CharCodes_default.b; + buffer[offset++] = CharCodes_default.j; + buffer[offset++] = CharCodes_default.Newline; + buffer[offset++] = CharCodes_default.Newline; + n = object instanceof PDFObjectStream_default ? object.getObjectsCount() : 1; + if (!this.shouldWaitForTick(n)) return [3, 4]; + return [4, waitForTick()]; + case 3: + _c2.sent(); + _c2.label = 4; + case 4: + idx++; + return [3, 2]; + case 5: + if (xref) { + offset += xref.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + } + if (trailerDict) { + offset += trailerDict.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_default.Newline; + buffer[offset++] = CharCodes_default.Newline; + } + offset += trailer.copyBytesInto(buffer, offset); + return [2, buffer]; + } + }); + }); + }; + PDFWriter2.prototype.computeIndirectObjectSize = function(_a3) { + var ref = _a3[0], object = _a3[1]; + var refSize = ref.sizeInBytes() + 3; + var objectSize = object.sizeInBytes() + 9; + return refSize + objectSize; + }; + PDFWriter2.prototype.createTrailerDict = function() { + return this.context.obj({ + Size: this.context.largestObjectNumber + 1, + Root: this.context.trailerInfo.Root, + Encrypt: this.context.trailerInfo.Encrypt, + Info: this.context.trailerInfo.Info, + ID: this.context.trailerInfo.ID + }); + }; + PDFWriter2.prototype.computeBufferSize = function() { + return __awaiter(this, void 0, void 0, function() { + var header, size, xref, indirectObjects, idx, len, indirectObject, ref, xrefOffset, trailerDict, trailer; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + header = PDFHeader_default.forVersion(1, 7); + size = header.sizeInBytes() + 2; + xref = PDFCrossRefSection_default.create(); + indirectObjects = this.context.enumerateIndirectObjects(); + idx = 0, len = indirectObjects.length; + _a3.label = 1; + case 1: + if (!(idx < len)) return [3, 4]; + indirectObject = indirectObjects[idx]; + ref = indirectObject[0]; + xref.addEntry(ref, size); + size += this.computeIndirectObjectSize(indirectObject); + if (!this.shouldWaitForTick(1)) return [3, 3]; + return [4, waitForTick()]; + case 2: + _a3.sent(); + _a3.label = 3; + case 3: + idx++; + return [3, 1]; + case 4: + xrefOffset = size; + size += xref.sizeInBytes() + 1; + trailerDict = PDFTrailerDict_default.of(this.createTrailerDict()); + size += trailerDict.sizeInBytes() + 2; + trailer = PDFTrailer_default.forLastCrossRefSectionOffset(xrefOffset); + size += trailer.sizeInBytes(); + return [2, { size, header, indirectObjects, xref, trailerDict, trailer }]; + } + }); + }); + }; + PDFWriter2.forContext = function(context, objectsPerTick) { + return new PDFWriter2(context, objectsPerTick); + }; + return PDFWriter2; + }() +); +var PDFWriter_default = PDFWriter; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFInvalidObject.js +var PDFInvalidObject = ( + /** @class */ + function(_super) { + __extends(PDFInvalidObject2, _super); + function PDFInvalidObject2(data) { + var _this = _super.call(this) || this; + _this.data = data; + return _this; + } + PDFInvalidObject2.prototype.clone = function() { + return PDFInvalidObject2.of(this.data.slice()); + }; + PDFInvalidObject2.prototype.toString = function() { + return "PDFInvalidObject(" + this.data.length + " bytes)"; + }; + PDFInvalidObject2.prototype.sizeInBytes = function() { + return this.data.length; + }; + PDFInvalidObject2.prototype.copyBytesInto = function(buffer, offset) { + var length = this.data.length; + for (var idx = 0; idx < length; idx++) { + buffer[offset++] = this.data[idx]; + } + return length; + }; + PDFInvalidObject2.of = function(data) { + return new PDFInvalidObject2(data); + }; + return PDFInvalidObject2; + }(PDFObject_default) +); +var PDFInvalidObject_default = PDFInvalidObject; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.js +var EntryType; +(function(EntryType2) { + EntryType2[EntryType2["Deleted"] = 0] = "Deleted"; + EntryType2[EntryType2["Uncompressed"] = 1] = "Uncompressed"; + EntryType2[EntryType2["Compressed"] = 2] = "Compressed"; +})(EntryType || (EntryType = {})); +var PDFCrossRefStream = ( + /** @class */ + function(_super) { + __extends(PDFCrossRefStream2, _super); + function PDFCrossRefStream2(dict, entries, encode) { + if (encode === void 0) { + encode = true; + } + var _this = _super.call(this, dict, encode) || this; + _this.computeIndex = function() { + var subsections = []; + var subsectionLength = 0; + for (var idx = 0, len = _this.entries.length; idx < len; idx++) { + var currEntry = _this.entries[idx]; + var prevEntry = _this.entries[idx - 1]; + if (idx === 0) { + subsections.push(currEntry.ref.objectNumber); + } else if (currEntry.ref.objectNumber - prevEntry.ref.objectNumber > 1) { + subsections.push(subsectionLength); + subsections.push(currEntry.ref.objectNumber); + subsectionLength = 0; + } + subsectionLength += 1; + } + subsections.push(subsectionLength); + return subsections; + }; + _this.computeEntryTuples = function() { + var entryTuples = new Array(_this.entries.length); + for (var idx = 0, len = _this.entries.length; idx < len; idx++) { + var entry = _this.entries[idx]; + if (entry.type === EntryType.Deleted) { + var type = entry.type, nextFreeObjectNumber = entry.nextFreeObjectNumber, ref = entry.ref; + entryTuples[idx] = [type, nextFreeObjectNumber, ref.generationNumber]; + } + if (entry.type === EntryType.Uncompressed) { + var type = entry.type, offset = entry.offset, ref = entry.ref; + entryTuples[idx] = [type, offset, ref.generationNumber]; + } + if (entry.type === EntryType.Compressed) { + var type = entry.type, objectStreamRef = entry.objectStreamRef, index2 = entry.index; + entryTuples[idx] = [type, objectStreamRef.objectNumber, index2]; + } + } + return entryTuples; + }; + _this.computeMaxEntryByteWidths = function() { + var entryTuples = _this.entryTuplesCache.access(); + var widths = [0, 0, 0]; + for (var idx = 0, len = entryTuples.length; idx < len; idx++) { + var _a3 = entryTuples[idx], first = _a3[0], second = _a3[1], third = _a3[2]; + var firstSize = sizeInBytes(first); + var secondSize = sizeInBytes(second); + var thirdSize = sizeInBytes(third); + if (firstSize > widths[0]) + widths[0] = firstSize; + if (secondSize > widths[1]) + widths[1] = secondSize; + if (thirdSize > widths[2]) + widths[2] = thirdSize; + } + return widths; + }; + _this.entries = entries || []; + _this.entryTuplesCache = Cache_default.populatedBy(_this.computeEntryTuples); + _this.maxByteWidthsCache = Cache_default.populatedBy(_this.computeMaxEntryByteWidths); + _this.indexCache = Cache_default.populatedBy(_this.computeIndex); + dict.set(PDFName_default.of("Type"), PDFName_default.of("XRef")); + return _this; + } + PDFCrossRefStream2.prototype.addDeletedEntry = function(ref, nextFreeObjectNumber) { + var type = EntryType.Deleted; + this.entries.push({ type, ref, nextFreeObjectNumber }); + this.entryTuplesCache.invalidate(); + this.maxByteWidthsCache.invalidate(); + this.indexCache.invalidate(); + this.contentsCache.invalidate(); + }; + PDFCrossRefStream2.prototype.addUncompressedEntry = function(ref, offset) { + var type = EntryType.Uncompressed; + this.entries.push({ type, ref, offset }); + this.entryTuplesCache.invalidate(); + this.maxByteWidthsCache.invalidate(); + this.indexCache.invalidate(); + this.contentsCache.invalidate(); + }; + PDFCrossRefStream2.prototype.addCompressedEntry = function(ref, objectStreamRef, index2) { + var type = EntryType.Compressed; + this.entries.push({ type, ref, objectStreamRef, index: index2 }); + this.entryTuplesCache.invalidate(); + this.maxByteWidthsCache.invalidate(); + this.indexCache.invalidate(); + this.contentsCache.invalidate(); + }; + PDFCrossRefStream2.prototype.clone = function(context) { + var _a3 = this, dict = _a3.dict, entries = _a3.entries, encode = _a3.encode; + return PDFCrossRefStream2.of(dict.clone(context), entries.slice(), encode); + }; + PDFCrossRefStream2.prototype.getContentsString = function() { + var entryTuples = this.entryTuplesCache.access(); + var byteWidths = this.maxByteWidthsCache.access(); + var value = ""; + for (var entryIdx = 0, entriesLen = entryTuples.length; entryIdx < entriesLen; entryIdx++) { + var _a3 = entryTuples[entryIdx], first = _a3[0], second = _a3[1], third = _a3[2]; + var firstBytes = reverseArray(bytesFor(first)); + var secondBytes = reverseArray(bytesFor(second)); + var thirdBytes = reverseArray(bytesFor(third)); + for (var idx = byteWidths[0] - 1; idx >= 0; idx--) { + value += (firstBytes[idx] || 0).toString(2); + } + for (var idx = byteWidths[1] - 1; idx >= 0; idx--) { + value += (secondBytes[idx] || 0).toString(2); + } + for (var idx = byteWidths[2] - 1; idx >= 0; idx--) { + value += (thirdBytes[idx] || 0).toString(2); + } + } + return value; + }; + PDFCrossRefStream2.prototype.getUnencodedContents = function() { + var entryTuples = this.entryTuplesCache.access(); + var byteWidths = this.maxByteWidthsCache.access(); + var buffer = new Uint8Array(this.getUnencodedContentsSize()); + var offset = 0; + for (var entryIdx = 0, entriesLen = entryTuples.length; entryIdx < entriesLen; entryIdx++) { + var _a3 = entryTuples[entryIdx], first = _a3[0], second = _a3[1], third = _a3[2]; + var firstBytes = reverseArray(bytesFor(first)); + var secondBytes = reverseArray(bytesFor(second)); + var thirdBytes = reverseArray(bytesFor(third)); + for (var idx = byteWidths[0] - 1; idx >= 0; idx--) { + buffer[offset++] = firstBytes[idx] || 0; + } + for (var idx = byteWidths[1] - 1; idx >= 0; idx--) { + buffer[offset++] = secondBytes[idx] || 0; + } + for (var idx = byteWidths[2] - 1; idx >= 0; idx--) { + buffer[offset++] = thirdBytes[idx] || 0; + } + } + return buffer; + }; + PDFCrossRefStream2.prototype.getUnencodedContentsSize = function() { + var byteWidths = this.maxByteWidthsCache.access(); + var entryWidth = sum(byteWidths); + return entryWidth * this.entries.length; + }; + PDFCrossRefStream2.prototype.updateDict = function() { + _super.prototype.updateDict.call(this); + var byteWidths = this.maxByteWidthsCache.access(); + var index2 = this.indexCache.access(); + var context = this.dict.context; + this.dict.set(PDFName_default.of("W"), context.obj(byteWidths)); + this.dict.set(PDFName_default.of("Index"), context.obj(index2)); + }; + PDFCrossRefStream2.create = function(dict, encode) { + if (encode === void 0) { + encode = true; + } + var stream2 = new PDFCrossRefStream2(dict, [], encode); + stream2.addDeletedEntry(PDFRef_default.of(0, 65535), 0); + return stream2; + }; + PDFCrossRefStream2.of = function(dict, entries, encode) { + if (encode === void 0) { + encode = true; + } + return new PDFCrossRefStream2(dict, entries, encode); + }; + return PDFCrossRefStream2; + }(PDFFlateStream_default) +); +var PDFCrossRefStream_default = PDFCrossRefStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/writers/PDFStreamWriter.js +var PDFStreamWriter = ( + /** @class */ + function(_super) { + __extends(PDFStreamWriter2, _super); + function PDFStreamWriter2(context, objectsPerTick, encodeStreams, objectsPerStream) { + var _this = _super.call(this, context, objectsPerTick) || this; + _this.encodeStreams = encodeStreams; + _this.objectsPerStream = objectsPerStream; + return _this; + } + PDFStreamWriter2.prototype.computeBufferSize = function() { + return __awaiter(this, void 0, void 0, function() { + var objectNumber, header, size, xrefStream, uncompressedObjects, compressedObjects, objectStreamRefs, indirectObjects, idx, len, indirectObject, ref, object, shouldNotCompress, chunk, objectStreamRef, idx, len, chunk, ref, objectStream, xrefStreamRef, xrefOffset, trailer; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + objectNumber = this.context.largestObjectNumber + 1; + header = PDFHeader_default.forVersion(1, 7); + size = header.sizeInBytes() + 2; + xrefStream = PDFCrossRefStream_default.create(this.createTrailerDict(), this.encodeStreams); + uncompressedObjects = []; + compressedObjects = []; + objectStreamRefs = []; + indirectObjects = this.context.enumerateIndirectObjects(); + idx = 0, len = indirectObjects.length; + _a3.label = 1; + case 1: + if (!(idx < len)) return [3, 6]; + indirectObject = indirectObjects[idx]; + ref = indirectObject[0], object = indirectObject[1]; + shouldNotCompress = ref === this.context.trailerInfo.Encrypt || object instanceof PDFStream_default || object instanceof PDFInvalidObject_default || ref.generationNumber !== 0; + if (!shouldNotCompress) return [3, 4]; + uncompressedObjects.push(indirectObject); + xrefStream.addUncompressedEntry(ref, size); + size += this.computeIndirectObjectSize(indirectObject); + if (!this.shouldWaitForTick(1)) return [3, 3]; + return [4, waitForTick()]; + case 2: + _a3.sent(); + _a3.label = 3; + case 3: + return [3, 5]; + case 4: + chunk = last(compressedObjects); + objectStreamRef = last(objectStreamRefs); + if (!chunk || chunk.length % this.objectsPerStream === 0) { + chunk = []; + compressedObjects.push(chunk); + objectStreamRef = PDFRef_default.of(objectNumber++); + objectStreamRefs.push(objectStreamRef); + } + xrefStream.addCompressedEntry(ref, objectStreamRef, chunk.length); + chunk.push(indirectObject); + _a3.label = 5; + case 5: + idx++; + return [3, 1]; + case 6: + idx = 0, len = compressedObjects.length; + _a3.label = 7; + case 7: + if (!(idx < len)) return [3, 10]; + chunk = compressedObjects[idx]; + ref = objectStreamRefs[idx]; + objectStream = PDFObjectStream_default.withContextAndObjects(this.context, chunk, this.encodeStreams); + xrefStream.addUncompressedEntry(ref, size); + size += this.computeIndirectObjectSize([ref, objectStream]); + uncompressedObjects.push([ref, objectStream]); + if (!this.shouldWaitForTick(chunk.length)) return [3, 9]; + return [4, waitForTick()]; + case 8: + _a3.sent(); + _a3.label = 9; + case 9: + idx++; + return [3, 7]; + case 10: + xrefStreamRef = PDFRef_default.of(objectNumber++); + xrefStream.dict.set(PDFName_default.of("Size"), PDFNumber_default.of(objectNumber)); + xrefStream.addUncompressedEntry(xrefStreamRef, size); + xrefOffset = size; + size += this.computeIndirectObjectSize([xrefStreamRef, xrefStream]); + uncompressedObjects.push([xrefStreamRef, xrefStream]); + trailer = PDFTrailer_default.forLastCrossRefSectionOffset(xrefOffset); + size += trailer.sizeInBytes(); + return [2, { size, header, indirectObjects: uncompressedObjects, trailer }]; + } + }); + }); + }; + PDFStreamWriter2.forContext = function(context, objectsPerTick, encodeStreams, objectsPerStream) { + if (encodeStreams === void 0) { + encodeStreams = true; + } + if (objectsPerStream === void 0) { + objectsPerStream = 50; + } + return new PDFStreamWriter2(context, objectsPerTick, encodeStreams, objectsPerStream); + }; + return PDFStreamWriter2; + }(PDFWriter_default) +); +var PDFStreamWriter_default = PDFStreamWriter; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFHexString.js +var PDFHexString = ( + /** @class */ + function(_super) { + __extends(PDFHexString2, _super); + function PDFHexString2(value) { + var _this = _super.call(this) || this; + _this.value = value; + return _this; + } + PDFHexString2.prototype.asBytes = function() { + var hex = this.value + (this.value.length % 2 === 1 ? "0" : ""); + var hexLength = hex.length; + var bytes = new Uint8Array(hex.length / 2); + var hexOffset = 0; + var bytesOffset = 0; + while (hexOffset < hexLength) { + var byte = parseInt(hex.substring(hexOffset, hexOffset + 2), 16); + bytes[bytesOffset] = byte; + hexOffset += 2; + bytesOffset += 1; + } + return bytes; + }; + PDFHexString2.prototype.decodeText = function() { + var bytes = this.asBytes(); + if (hasUtf16BOM(bytes)) + return utf16Decode(bytes); + return pdfDocEncodingDecode(bytes); + }; + PDFHexString2.prototype.decodeDate = function() { + var text2 = this.decodeText(); + var date = parseDate(text2); + if (!date) + throw new InvalidPDFDateStringError(text2); + return date; + }; + PDFHexString2.prototype.asString = function() { + return this.value; + }; + PDFHexString2.prototype.clone = function() { + return PDFHexString2.of(this.value); + }; + PDFHexString2.prototype.toString = function() { + return "<" + this.value + ">"; + }; + PDFHexString2.prototype.sizeInBytes = function() { + return this.value.length + 2; + }; + PDFHexString2.prototype.copyBytesInto = function(buffer, offset) { + buffer[offset++] = CharCodes_default.LessThan; + offset += copyStringIntoBuffer(this.value, buffer, offset); + buffer[offset++] = CharCodes_default.GreaterThan; + return this.value.length + 2; + }; + PDFHexString2.of = function(value) { + return new PDFHexString2(value); + }; + PDFHexString2.fromText = function(value) { + var encoded = utf16Encode(value); + var hex = ""; + for (var idx = 0, len = encoded.length; idx < len; idx++) { + hex += toHexStringOfMinLength(encoded[idx], 4); + } + return new PDFHexString2(hex); + }; + return PDFHexString2; + }(PDFObject_default) +); +var PDFHexString_default = PDFHexString; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/StandardFontEmbedder.js +var StandardFontEmbedder = ( + /** @class */ + function() { + function StandardFontEmbedder2(fontName, customName) { + this.encoding = fontName === FontNames.ZapfDingbats ? Encodings.ZapfDingbats : fontName === FontNames.Symbol ? Encodings.Symbol : Encodings.WinAnsi; + this.font = Font.load(fontName); + this.fontName = this.font.FontName; + this.customName = customName; + } + StandardFontEmbedder2.prototype.encodeText = function(text2) { + var glyphs = this.encodeTextAsGlyphs(text2); + var hexCodes = new Array(glyphs.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + hexCodes[idx] = toHexString(glyphs[idx].code); + } + return PDFHexString_default.of(hexCodes.join("")); + }; + StandardFontEmbedder2.prototype.widthOfTextAtSize = function(text2, size) { + var glyphs = this.encodeTextAsGlyphs(text2); + var totalWidth = 0; + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var left = glyphs[idx].name; + var right = (glyphs[idx + 1] || {}).name; + var kernAmount = this.font.getXAxisKerningForPair(left, right) || 0; + totalWidth += this.widthOfGlyph(left) + kernAmount; + } + var scale2 = size / 1e3; + return totalWidth * scale2; + }; + StandardFontEmbedder2.prototype.heightOfFontAtSize = function(size, options) { + if (options === void 0) { + options = {}; + } + var _a3 = options.descender, descender = _a3 === void 0 ? true : _a3; + var _b3 = this.font, Ascender = _b3.Ascender, Descender = _b3.Descender, FontBBox = _b3.FontBBox; + var yTop = Ascender || FontBBox[3]; + var yBottom = Descender || FontBBox[1]; + var height = yTop - yBottom; + if (!descender) + height += Descender || 0; + return height / 1e3 * size; + }; + StandardFontEmbedder2.prototype.sizeOfFontAtHeight = function(height) { + var _a3 = this.font, Ascender = _a3.Ascender, Descender = _a3.Descender, FontBBox = _a3.FontBBox; + var yTop = Ascender || FontBBox[3]; + var yBottom = Descender || FontBBox[1]; + return 1e3 * height / (yTop - yBottom); + }; + StandardFontEmbedder2.prototype.embedIntoContext = function(context, ref) { + var fontDict = context.obj({ + Type: "Font", + Subtype: "Type1", + BaseFont: this.customName || this.fontName, + Encoding: this.encoding === Encodings.WinAnsi ? "WinAnsiEncoding" : void 0 + }); + if (ref) { + context.assign(ref, fontDict); + return ref; + } else { + return context.register(fontDict); + } + }; + StandardFontEmbedder2.prototype.widthOfGlyph = function(glyphName) { + return this.font.getWidthOfGlyph(glyphName) || 250; + }; + StandardFontEmbedder2.prototype.encodeTextAsGlyphs = function(text2) { + var codePoints = Array.from(text2); + var glyphs = new Array(codePoints.length); + for (var idx = 0, len = codePoints.length; idx < len; idx++) { + var codePoint = toCodePoint(codePoints[idx]); + glyphs[idx] = this.encoding.encodeUnicodeCodePoint(codePoint); + } + return glyphs; + }; + StandardFontEmbedder2.for = function(fontName, customName) { + return new StandardFontEmbedder2(fontName, customName); + }; + return StandardFontEmbedder2; + }() +); +var StandardFontEmbedder_default = StandardFontEmbedder; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/CMap.js +var createCmap = function(glyphs, glyphId) { + var bfChars = new Array(glyphs.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var glyph = glyphs[idx]; + var id = cmapHexFormat(cmapHexString(glyphId(glyph))); + var unicode = cmapHexFormat.apply(void 0, glyph.codePoints.map(cmapCodePointFormat)); + bfChars[idx] = [id, unicode]; + } + return fillCmapTemplate(bfChars); +}; +var fillCmapTemplate = function(bfChars) { + return "/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo <<\n /Registry (Adobe)\n /Ordering (UCS)\n /Supplement 0\n>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 begincodespacerange\n<0000>\nendcodespacerange\n" + bfChars.length + " beginbfchar\n" + bfChars.map(function(_a3) { + var glyphId = _a3[0], codePoint = _a3[1]; + return glyphId + " " + codePoint; + }).join("\n") + "\nendbfchar\nendcmap\nCMapName currentdict /CMap defineresource pop\nend\nend"; +}; +var cmapHexFormat = function() { + var values2 = []; + for (var _i = 0; _i < arguments.length; _i++) { + values2[_i] = arguments[_i]; + } + return "<" + values2.join("") + ">"; +}; +var cmapHexString = function(value) { + return toHexStringOfMinLength(value, 4); +}; +var cmapCodePointFormat = function(codePoint) { + if (isWithinBMP(codePoint)) + return cmapHexString(codePoint); + if (hasSurrogates(codePoint)) { + var hs = highSurrogate(codePoint); + var ls = lowSurrogate(codePoint); + return "" + cmapHexString(hs) + cmapHexString(ls); + } + var hex = toHexString(codePoint); + var msg = "0x" + hex + " is not a valid UTF-8 or UTF-16 codepoint."; + throw new Error(msg); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/FontFlags.js +var makeFontFlags = function(options) { + var flags = 0; + var flipBit = function(bit) { + flags |= 1 << bit - 1; + }; + if (options.fixedPitch) + flipBit(1); + if (options.serif) + flipBit(2); + if (options.symbolic) + flipBit(3); + if (options.script) + flipBit(4); + if (options.nonsymbolic) + flipBit(6); + if (options.italic) + flipBit(7); + if (options.allCap) + flipBit(17); + if (options.smallCap) + flipBit(18); + if (options.forceBold) + flipBit(19); + return flags; +}; +var deriveFontFlags = function(font) { + var familyClass = font["OS/2"] ? font["OS/2"].sFamilyClass : 0; + var flags = makeFontFlags({ + fixedPitch: font.post.isFixedPitch, + serif: 1 <= familyClass && familyClass <= 7, + symbolic: true, + script: familyClass === 10, + italic: font.head.macStyle.italic + }); + return flags; +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/objects/PDFString.js +var PDFString = ( + /** @class */ + function(_super) { + __extends(PDFString2, _super); + function PDFString2(value) { + var _this = _super.call(this) || this; + _this.value = value; + return _this; + } + PDFString2.prototype.asBytes = function() { + var bytes = []; + var octal = ""; + var escaped = false; + var pushByte = function(byte2) { + if (byte2 !== void 0) + bytes.push(byte2); + escaped = false; + }; + for (var idx = 0, len = this.value.length; idx < len; idx++) { + var char = this.value[idx]; + var byte = toCharCode(char); + var nextChar = this.value[idx + 1]; + if (!escaped) { + if (byte === CharCodes_default.BackSlash) + escaped = true; + else + pushByte(byte); + } else { + if (byte === CharCodes_default.Newline) + pushByte(); + else if (byte === CharCodes_default.CarriageReturn) + pushByte(); + else if (byte === CharCodes_default.n) + pushByte(CharCodes_default.Newline); + else if (byte === CharCodes_default.r) + pushByte(CharCodes_default.CarriageReturn); + else if (byte === CharCodes_default.t) + pushByte(CharCodes_default.Tab); + else if (byte === CharCodes_default.b) + pushByte(CharCodes_default.Backspace); + else if (byte === CharCodes_default.f) + pushByte(CharCodes_default.FormFeed); + else if (byte === CharCodes_default.LeftParen) + pushByte(CharCodes_default.LeftParen); + else if (byte === CharCodes_default.RightParen) + pushByte(CharCodes_default.RightParen); + else if (byte === CharCodes_default.Backspace) + pushByte(CharCodes_default.BackSlash); + else if (byte >= CharCodes_default.Zero && byte <= CharCodes_default.Seven) { + octal += char; + if (octal.length === 3 || !(nextChar >= "0" && nextChar <= "7")) { + pushByte(parseInt(octal, 8)); + octal = ""; + } + } else { + pushByte(byte); + } + } + } + return new Uint8Array(bytes); + }; + PDFString2.prototype.decodeText = function() { + var bytes = this.asBytes(); + if (hasUtf16BOM(bytes)) + return utf16Decode(bytes); + return pdfDocEncodingDecode(bytes); + }; + PDFString2.prototype.decodeDate = function() { + var text2 = this.decodeText(); + var date = parseDate(text2); + if (!date) + throw new InvalidPDFDateStringError(text2); + return date; + }; + PDFString2.prototype.asString = function() { + return this.value; + }; + PDFString2.prototype.clone = function() { + return PDFString2.of(this.value); + }; + PDFString2.prototype.toString = function() { + return "(" + this.value + ")"; + }; + PDFString2.prototype.sizeInBytes = function() { + return this.value.length + 2; + }; + PDFString2.prototype.copyBytesInto = function(buffer, offset) { + buffer[offset++] = CharCodes_default.LeftParen; + offset += copyStringIntoBuffer(this.value, buffer, offset); + buffer[offset++] = CharCodes_default.RightParen; + return this.value.length + 2; + }; + PDFString2.of = function(value) { + return new PDFString2(value); + }; + PDFString2.fromDate = function(date) { + var year = padStart(String(date.getUTCFullYear()), 4, "0"); + var month = padStart(String(date.getUTCMonth() + 1), 2, "0"); + var day = padStart(String(date.getUTCDate()), 2, "0"); + var hours = padStart(String(date.getUTCHours()), 2, "0"); + var mins = padStart(String(date.getUTCMinutes()), 2, "0"); + var secs = padStart(String(date.getUTCSeconds()), 2, "0"); + return new PDFString2("D:" + year + month + day + hours + mins + secs + "Z"); + }; + return PDFString2; + }(PDFObject_default) +); +var PDFString_default = PDFString; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/CustomFontEmbedder.js +var CustomFontEmbedder = ( + /** @class */ + function() { + function CustomFontEmbedder2(font, fontData, customName, fontFeatures) { + var _this = this; + this.allGlyphsInFontSortedById = function() { + var glyphs = new Array(_this.font.characterSet.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var codePoint = _this.font.characterSet[idx]; + glyphs[idx] = _this.font.glyphForCodePoint(codePoint); + } + return sortedUniq(glyphs.sort(byAscendingId), function(g) { + return g.id; + }); + }; + this.font = font; + this.scale = 1e3 / this.font.unitsPerEm; + this.fontData = fontData; + this.fontName = this.font.postscriptName || "Font"; + this.customName = customName; + this.fontFeatures = fontFeatures; + this.baseFontName = ""; + this.glyphCache = Cache_default.populatedBy(this.allGlyphsInFontSortedById); + } + CustomFontEmbedder2.for = function(fontkit, fontData, customName, fontFeatures) { + return __awaiter(this, void 0, void 0, function() { + var font; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + return [4, fontkit.create(fontData)]; + case 1: + font = _a3.sent(); + return [2, new CustomFontEmbedder2(font, fontData, customName, fontFeatures)]; + } + }); + }); + }; + CustomFontEmbedder2.prototype.encodeText = function(text2) { + var glyphs = this.font.layout(text2, this.fontFeatures).glyphs; + var hexCodes = new Array(glyphs.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + hexCodes[idx] = toHexStringOfMinLength(glyphs[idx].id, 4); + } + return PDFHexString_default.of(hexCodes.join("")); + }; + CustomFontEmbedder2.prototype.widthOfTextAtSize = function(text2, size) { + var glyphs = this.font.layout(text2, this.fontFeatures).glyphs; + var totalWidth = 0; + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + totalWidth += glyphs[idx].advanceWidth * this.scale; + } + var scale2 = size / 1e3; + return totalWidth * scale2; + }; + CustomFontEmbedder2.prototype.heightOfFontAtSize = function(size, options) { + if (options === void 0) { + options = {}; + } + var _a3 = options.descender, descender = _a3 === void 0 ? true : _a3; + var _b3 = this.font, ascent = _b3.ascent, descent = _b3.descent, bbox = _b3.bbox; + var yTop = (ascent || bbox.maxY) * this.scale; + var yBottom = (descent || bbox.minY) * this.scale; + var height = yTop - yBottom; + if (!descender) + height -= Math.abs(descent) || 0; + return height / 1e3 * size; + }; + CustomFontEmbedder2.prototype.sizeOfFontAtHeight = function(height) { + var _a3 = this.font, ascent = _a3.ascent, descent = _a3.descent, bbox = _a3.bbox; + var yTop = (ascent || bbox.maxY) * this.scale; + var yBottom = (descent || bbox.minY) * this.scale; + return 1e3 * height / (yTop - yBottom); + }; + CustomFontEmbedder2.prototype.embedIntoContext = function(context, ref) { + this.baseFontName = this.customName || context.addRandomSuffix(this.fontName); + return this.embedFontDict(context, ref); + }; + CustomFontEmbedder2.prototype.embedFontDict = function(context, ref) { + return __awaiter(this, void 0, void 0, function() { + var cidFontDictRef, unicodeCMapRef, fontDict; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + return [4, this.embedCIDFontDict(context)]; + case 1: + cidFontDictRef = _a3.sent(); + unicodeCMapRef = this.embedUnicodeCmap(context); + fontDict = context.obj({ + Type: "Font", + Subtype: "Type0", + BaseFont: this.baseFontName, + Encoding: "Identity-H", + DescendantFonts: [cidFontDictRef], + ToUnicode: unicodeCMapRef + }); + if (ref) { + context.assign(ref, fontDict); + return [2, ref]; + } else { + return [2, context.register(fontDict)]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + CustomFontEmbedder2.prototype.isCFF = function() { + return this.font.cff; + }; + CustomFontEmbedder2.prototype.embedCIDFontDict = function(context) { + return __awaiter(this, void 0, void 0, function() { + var fontDescriptorRef, cidFontDict; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + return [4, this.embedFontDescriptor(context)]; + case 1: + fontDescriptorRef = _a3.sent(); + cidFontDict = context.obj({ + Type: "Font", + Subtype: this.isCFF() ? "CIDFontType0" : "CIDFontType2", + CIDToGIDMap: "Identity", + BaseFont: this.baseFontName, + CIDSystemInfo: { + Registry: PDFString_default.of("Adobe"), + Ordering: PDFString_default.of("Identity"), + Supplement: 0 + }, + FontDescriptor: fontDescriptorRef, + W: this.computeWidths() + }); + return [2, context.register(cidFontDict)]; + } + }); + }); + }; + CustomFontEmbedder2.prototype.embedFontDescriptor = function(context) { + return __awaiter(this, void 0, void 0, function() { + var fontStreamRef, scale2, _a3, italicAngle, ascent, descent, capHeight, xHeight, _b3, minX, minY, maxX, maxY, fontDescriptor; + var _c2; + return __generator(this, function(_d) { + switch (_d.label) { + case 0: + return [4, this.embedFontStream(context)]; + case 1: + fontStreamRef = _d.sent(); + scale2 = this.scale; + _a3 = this.font, italicAngle = _a3.italicAngle, ascent = _a3.ascent, descent = _a3.descent, capHeight = _a3.capHeight, xHeight = _a3.xHeight; + _b3 = this.font.bbox, minX = _b3.minX, minY = _b3.minY, maxX = _b3.maxX, maxY = _b3.maxY; + fontDescriptor = context.obj((_c2 = { + Type: "FontDescriptor", + FontName: this.baseFontName, + Flags: deriveFontFlags(this.font), + FontBBox: [minX * scale2, minY * scale2, maxX * scale2, maxY * scale2], + ItalicAngle: italicAngle, + Ascent: ascent * scale2, + Descent: descent * scale2, + CapHeight: (capHeight || ascent) * scale2, + XHeight: (xHeight || 0) * scale2, + // Not sure how to compute/find this, nor is anybody else really: + // https://stackoverflow.com/questions/35485179/stemv-value-of-the-truetype-font + StemV: 0 + }, _c2[this.isCFF() ? "FontFile3" : "FontFile2"] = fontStreamRef, _c2)); + return [2, context.register(fontDescriptor)]; + } + }); + }); + }; + CustomFontEmbedder2.prototype.serializeFont = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a3) { + return [2, this.fontData]; + }); + }); + }; + CustomFontEmbedder2.prototype.embedFontStream = function(context) { + return __awaiter(this, void 0, void 0, function() { + var fontStream, _a3, _b3; + return __generator(this, function(_c2) { + switch (_c2.label) { + case 0: + _b3 = (_a3 = context).flateStream; + return [4, this.serializeFont()]; + case 1: + fontStream = _b3.apply(_a3, [_c2.sent(), { + Subtype: this.isCFF() ? "CIDFontType0C" : void 0 + }]); + return [2, context.register(fontStream)]; + } + }); + }); + }; + CustomFontEmbedder2.prototype.embedUnicodeCmap = function(context) { + var cmap = createCmap(this.glyphCache.access(), this.glyphId.bind(this)); + var cmapStream = context.flateStream(cmap); + return context.register(cmapStream); + }; + CustomFontEmbedder2.prototype.glyphId = function(glyph) { + return glyph ? glyph.id : -1; + }; + CustomFontEmbedder2.prototype.computeWidths = function() { + var glyphs = this.glyphCache.access(); + var widths = []; + var currSection = []; + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var currGlyph = glyphs[idx]; + var prevGlyph = glyphs[idx - 1]; + var currGlyphId = this.glyphId(currGlyph); + var prevGlyphId = this.glyphId(prevGlyph); + if (idx === 0) { + widths.push(currGlyphId); + } else if (currGlyphId - prevGlyphId !== 1) { + widths.push(currSection); + widths.push(currGlyphId); + currSection = []; + } + currSection.push(currGlyph.advanceWidth * this.scale); + } + widths.push(currSection); + return widths; + }; + return CustomFontEmbedder2; + }() +); +var CustomFontEmbedder_default = CustomFontEmbedder; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/CustomFontSubsetEmbedder.js +var CustomFontSubsetEmbedder = ( + /** @class */ + function(_super) { + __extends(CustomFontSubsetEmbedder2, _super); + function CustomFontSubsetEmbedder2(font, fontData, customFontName, fontFeatures) { + var _this = _super.call(this, font, fontData, customFontName, fontFeatures) || this; + _this.subset = _this.font.createSubset(); + _this.glyphs = []; + _this.glyphCache = Cache_default.populatedBy(function() { + return _this.glyphs; + }); + _this.glyphIdMap = /* @__PURE__ */ new Map(); + return _this; + } + CustomFontSubsetEmbedder2.for = function(fontkit, fontData, customFontName, fontFeatures) { + return __awaiter(this, void 0, void 0, function() { + var font; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + return [4, fontkit.create(fontData)]; + case 1: + font = _a3.sent(); + return [2, new CustomFontSubsetEmbedder2(font, fontData, customFontName, fontFeatures)]; + } + }); + }); + }; + CustomFontSubsetEmbedder2.prototype.encodeText = function(text2) { + var glyphs = this.font.layout(text2, this.fontFeatures).glyphs; + var hexCodes = new Array(glyphs.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var glyph = glyphs[idx]; + var subsetGlyphId = this.subset.includeGlyph(glyph); + this.glyphs[subsetGlyphId - 1] = glyph; + this.glyphIdMap.set(glyph.id, subsetGlyphId); + hexCodes[idx] = toHexStringOfMinLength(subsetGlyphId, 4); + } + this.glyphCache.invalidate(); + return PDFHexString_default.of(hexCodes.join("")); + }; + CustomFontSubsetEmbedder2.prototype.isCFF = function() { + return this.subset.cff; + }; + CustomFontSubsetEmbedder2.prototype.glyphId = function(glyph) { + return glyph ? this.glyphIdMap.get(glyph.id) : -1; + }; + CustomFontSubsetEmbedder2.prototype.serializeFont = function() { + var _this = this; + return new Promise(function(resolve, reject) { + var parts = []; + _this.subset.encodeStream().on("data", function(bytes) { + return parts.push(bytes); + }).on("end", function() { + return resolve(mergeUint8Arrays(parts)); + }).on("error", function(err) { + return reject(err); + }); + }); + }; + return CustomFontSubsetEmbedder2; + }(CustomFontEmbedder_default) +); +var CustomFontSubsetEmbedder_default = CustomFontSubsetEmbedder; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/FileEmbedder.js +var AFRelationship; +(function(AFRelationship2) { + AFRelationship2["Source"] = "Source"; + AFRelationship2["Data"] = "Data"; + AFRelationship2["Alternative"] = "Alternative"; + AFRelationship2["Supplement"] = "Supplement"; + AFRelationship2["EncryptedPayload"] = "EncryptedPayload"; + AFRelationship2["FormData"] = "EncryptedPayload"; + AFRelationship2["Schema"] = "Schema"; + AFRelationship2["Unspecified"] = "Unspecified"; +})(AFRelationship || (AFRelationship = {})); +var FileEmbedder = ( + /** @class */ + function() { + function FileEmbedder2(fileData, fileName, options) { + if (options === void 0) { + options = {}; + } + this.fileData = fileData; + this.fileName = fileName; + this.options = options; + } + FileEmbedder2.for = function(bytes, fileName, options) { + if (options === void 0) { + options = {}; + } + return new FileEmbedder2(bytes, fileName, options); + }; + FileEmbedder2.prototype.embedIntoContext = function(context, ref) { + return __awaiter(this, void 0, void 0, function() { + var _a3, mimeType, description, creationDate, modificationDate, afRelationship, embeddedFileStream, embeddedFileStreamRef, fileSpecDict; + return __generator(this, function(_b3) { + _a3 = this.options, mimeType = _a3.mimeType, description = _a3.description, creationDate = _a3.creationDate, modificationDate = _a3.modificationDate, afRelationship = _a3.afRelationship; + embeddedFileStream = context.flateStream(this.fileData, { + Type: "EmbeddedFile", + Subtype: mimeType !== null && mimeType !== void 0 ? mimeType : void 0, + Params: { + Size: this.fileData.length, + CreationDate: creationDate ? PDFString_default.fromDate(creationDate) : void 0, + ModDate: modificationDate ? PDFString_default.fromDate(modificationDate) : void 0 + } + }); + embeddedFileStreamRef = context.register(embeddedFileStream); + fileSpecDict = context.obj({ + Type: "Filespec", + F: PDFString_default.of(this.fileName), + UF: PDFHexString_default.fromText(this.fileName), + EF: { F: embeddedFileStreamRef }, + Desc: description ? PDFHexString_default.fromText(description) : void 0, + AFRelationship: afRelationship !== null && afRelationship !== void 0 ? afRelationship : void 0 + }); + if (ref) { + context.assign(ref, fileSpecDict); + return [2, ref]; + } else { + return [2, context.register(fileSpecDict)]; + } + return [ + 2 + /*return*/ + ]; + }); + }); + }; + return FileEmbedder2; + }() +); +var FileEmbedder_default = FileEmbedder; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/JpegEmbedder.js +var MARKERS = [ + 65472, + 65473, + 65474, + 65475, + 65477, + 65478, + 65479, + 65480, + 65481, + 65482, + 65483, + 65484, + 65485, + 65486, + 65487 +]; +var ColorSpace; +(function(ColorSpace2) { + ColorSpace2["DeviceGray"] = "DeviceGray"; + ColorSpace2["DeviceRGB"] = "DeviceRGB"; + ColorSpace2["DeviceCMYK"] = "DeviceCMYK"; +})(ColorSpace || (ColorSpace = {})); +var ChannelToColorSpace = { + 1: ColorSpace.DeviceGray, + 3: ColorSpace.DeviceRGB, + 4: ColorSpace.DeviceCMYK +}; +var JpegEmbedder = ( + /** @class */ + function() { + function JpegEmbedder2(imageData, bitsPerComponent, width, height, colorSpace) { + this.imageData = imageData; + this.bitsPerComponent = bitsPerComponent; + this.width = width; + this.height = height; + this.colorSpace = colorSpace; + } + JpegEmbedder2.for = function(imageData) { + return __awaiter(this, void 0, void 0, function() { + var dataView, soi, pos, marker, bitsPerComponent, height, width, channelByte, channelName, colorSpace; + return __generator(this, function(_a3) { + dataView = new DataView(imageData.buffer); + soi = dataView.getUint16(0); + if (soi !== 65496) + throw new Error("SOI not found in JPEG"); + pos = 2; + while (pos < dataView.byteLength) { + marker = dataView.getUint16(pos); + pos += 2; + if (MARKERS.includes(marker)) + break; + pos += dataView.getUint16(pos); + } + if (!MARKERS.includes(marker)) + throw new Error("Invalid JPEG"); + pos += 2; + bitsPerComponent = dataView.getUint8(pos++); + height = dataView.getUint16(pos); + pos += 2; + width = dataView.getUint16(pos); + pos += 2; + channelByte = dataView.getUint8(pos++); + channelName = ChannelToColorSpace[channelByte]; + if (!channelName) + throw new Error("Unknown JPEG channel."); + colorSpace = channelName; + return [2, new JpegEmbedder2(imageData, bitsPerComponent, width, height, colorSpace)]; + }); + }); + }; + JpegEmbedder2.prototype.embedIntoContext = function(context, ref) { + return __awaiter(this, void 0, void 0, function() { + var xObject; + return __generator(this, function(_a3) { + xObject = context.stream(this.imageData, { + Type: "XObject", + Subtype: "Image", + BitsPerComponent: this.bitsPerComponent, + Width: this.width, + Height: this.height, + ColorSpace: this.colorSpace, + Filter: "DCTDecode", + // CMYK JPEG streams in PDF are typically stored complemented, + // with 1 as 'off' and 0 as 'on' (PDF 32000-1:2008, 8.6.4.4). + // + // Standalone CMYK JPEG (usually exported by Photoshop) are + // stored inverse, with 0 as 'off' and 1 as 'on', like RGB. + // + // Applying a swap here as a hedge that most bytes passing + // through this method will benefit from it. + Decode: this.colorSpace === ColorSpace.DeviceCMYK ? [1, 0, 1, 0, 1, 0, 1, 0] : void 0 + }); + if (ref) { + context.assign(ref, xObject); + return [2, ref]; + } else { + return [2, context.register(xObject)]; + } + return [ + 2 + /*return*/ + ]; + }); + }); + }; + return JpegEmbedder2; + }() +); +var JpegEmbedder_default = JpegEmbedder; + +// node_modules/.pnpm/@pdf-lib+upng@1.0.1/node_modules/@pdf-lib/upng/UPNG.js +var import_pako4 = __toESM(require_pako()); +var UPNG = {}; +UPNG.toRGBA8 = function(out) { + var w = out.width, h = out.height; + if (out.tabs.acTL == null) return [UPNG.toRGBA8.decodeImage(out.data, w, h, out).buffer]; + var frms = []; + if (out.frames[0].data == null) out.frames[0].data = out.data; + var len = w * h * 4, img = new Uint8Array(len), empty = new Uint8Array(len), prev = new Uint8Array(len); + for (var i = 0; i < out.frames.length; i++) { + var frm = out.frames[i]; + var fx = frm.rect.x, fy = frm.rect.y, fw = frm.rect.width, fh = frm.rect.height; + var fdata = UPNG.toRGBA8.decodeImage(frm.data, fw, fh, out); + if (i != 0) for (var j = 0; j < len; j++) prev[j] = img[j]; + if (frm.blend == 0) UPNG._copyTile(fdata, fw, fh, img, w, h, fx, fy, 0); + else if (frm.blend == 1) UPNG._copyTile(fdata, fw, fh, img, w, h, fx, fy, 1); + frms.push(img.buffer.slice(0)); + if (frm.dispose == 0) { + } else if (frm.dispose == 1) UPNG._copyTile(empty, fw, fh, img, w, h, fx, fy, 0); + else if (frm.dispose == 2) for (var j = 0; j < len; j++) img[j] = prev[j]; + } + return frms; +}; +UPNG.toRGBA8.decodeImage = function(data, w, h, out) { + var area = w * h, bpp = UPNG.decode._getBPP(out); + var bpl = Math.ceil(w * bpp / 8); + var bf = new Uint8Array(area * 4), bf32 = new Uint32Array(bf.buffer); + var ctype = out.ctype, depth = out.depth; + var rs = UPNG._bin.readUshort; + var time = Date.now(); + if (ctype == 6) { + var qarea = area << 2; + if (depth == 8) for (var i = 0; i < qarea; i += 4) { + bf[i] = data[i]; + bf[i + 1] = data[i + 1]; + bf[i + 2] = data[i + 2]; + bf[i + 3] = data[i + 3]; + } + if (depth == 16) for (var i = 0; i < qarea; i++) { + bf[i] = data[i << 1]; + } + } else if (ctype == 2) { + var ts = out.tabs["tRNS"]; + if (ts == null) { + if (depth == 8) for (var i = 0; i < area; i++) { + var ti = i * 3; + bf32[i] = 255 << 24 | data[ti + 2] << 16 | data[ti + 1] << 8 | data[ti]; + } + if (depth == 16) for (var i = 0; i < area; i++) { + var ti = i * 6; + bf32[i] = 255 << 24 | data[ti + 4] << 16 | data[ti + 2] << 8 | data[ti]; + } + } else { + var tr = ts[0], tg = ts[1], tb = ts[2]; + if (depth == 8) for (var i = 0; i < area; i++) { + var qi = i << 2, ti = i * 3; + bf32[i] = 255 << 24 | data[ti + 2] << 16 | data[ti + 1] << 8 | data[ti]; + if (data[ti] == tr && data[ti + 1] == tg && data[ti + 2] == tb) bf[qi + 3] = 0; + } + if (depth == 16) for (var i = 0; i < area; i++) { + var qi = i << 2, ti = i * 6; + bf32[i] = 255 << 24 | data[ti + 4] << 16 | data[ti + 2] << 8 | data[ti]; + if (rs(data, ti) == tr && rs(data, ti + 2) == tg && rs(data, ti + 4) == tb) bf[qi + 3] = 0; + } + } + } else if (ctype == 3) { + var p = out.tabs["PLTE"], ap = out.tabs["tRNS"], tl = ap ? ap.length : 0; + if (depth == 1) for (var y = 0; y < h; y++) { + var s0 = y * bpl, t0 = y * w; + for (var i = 0; i < w; i++) { + var qi = t0 + i << 2, j = data[s0 + (i >> 3)] >> 7 - ((i & 7) << 0) & 1, cj = 3 * j; + bf[qi] = p[cj]; + bf[qi + 1] = p[cj + 1]; + bf[qi + 2] = p[cj + 2]; + bf[qi + 3] = j < tl ? ap[j] : 255; + } + } + if (depth == 2) for (var y = 0; y < h; y++) { + var s0 = y * bpl, t0 = y * w; + for (var i = 0; i < w; i++) { + var qi = t0 + i << 2, j = data[s0 + (i >> 2)] >> 6 - ((i & 3) << 1) & 3, cj = 3 * j; + bf[qi] = p[cj]; + bf[qi + 1] = p[cj + 1]; + bf[qi + 2] = p[cj + 2]; + bf[qi + 3] = j < tl ? ap[j] : 255; + } + } + if (depth == 4) for (var y = 0; y < h; y++) { + var s0 = y * bpl, t0 = y * w; + for (var i = 0; i < w; i++) { + var qi = t0 + i << 2, j = data[s0 + (i >> 1)] >> 4 - ((i & 1) << 2) & 15, cj = 3 * j; + bf[qi] = p[cj]; + bf[qi + 1] = p[cj + 1]; + bf[qi + 2] = p[cj + 2]; + bf[qi + 3] = j < tl ? ap[j] : 255; + } + } + if (depth == 8) for (var i = 0; i < area; i++) { + var qi = i << 2, j = data[i], cj = 3 * j; + bf[qi] = p[cj]; + bf[qi + 1] = p[cj + 1]; + bf[qi + 2] = p[cj + 2]; + bf[qi + 3] = j < tl ? ap[j] : 255; + } + } else if (ctype == 4) { + if (depth == 8) for (var i = 0; i < area; i++) { + var qi = i << 2, di = i << 1, gr = data[di]; + bf[qi] = gr; + bf[qi + 1] = gr; + bf[qi + 2] = gr; + bf[qi + 3] = data[di + 1]; + } + if (depth == 16) for (var i = 0; i < area; i++) { + var qi = i << 2, di = i << 2, gr = data[di]; + bf[qi] = gr; + bf[qi + 1] = gr; + bf[qi + 2] = gr; + bf[qi + 3] = data[di + 2]; + } + } else if (ctype == 0) { + var tr = out.tabs["tRNS"] ? out.tabs["tRNS"] : -1; + for (var y = 0; y < h; y++) { + var off = y * bpl, to = y * w; + if (depth == 1) for (var x = 0; x < w; x++) { + var gr = 255 * (data[off + (x >>> 3)] >>> 7 - (x & 7) & 1), al = gr == tr * 255 ? 0 : 255; + bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr; + } + else if (depth == 2) for (var x = 0; x < w; x++) { + var gr = 85 * (data[off + (x >>> 2)] >>> 6 - ((x & 3) << 1) & 3), al = gr == tr * 85 ? 0 : 255; + bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr; + } + else if (depth == 4) for (var x = 0; x < w; x++) { + var gr = 17 * (data[off + (x >>> 1)] >>> 4 - ((x & 1) << 2) & 15), al = gr == tr * 17 ? 0 : 255; + bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr; + } + else if (depth == 8) for (var x = 0; x < w; x++) { + var gr = data[off + x], al = gr == tr ? 0 : 255; + bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr; + } + else if (depth == 16) for (var x = 0; x < w; x++) { + var gr = data[off + (x << 1)], al = rs(data, off + (x << i)) == tr ? 0 : 255; + bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr; + } + } + } + return bf; +}; +UPNG.decode = function(buff) { + var data = new Uint8Array(buff), offset = 8, bin = UPNG._bin, rUs = bin.readUshort, rUi = bin.readUint; + var out = { tabs: {}, frames: [] }; + var dd = new Uint8Array(data.length), doff = 0; + var fd, foff = 0; + var mgck = [137, 80, 78, 71, 13, 10, 26, 10]; + for (var i = 0; i < 8; i++) if (data[i] != mgck[i]) throw "The input is not a PNG file!"; + while (offset < data.length) { + var len = bin.readUint(data, offset); + offset += 4; + var type = bin.readASCII(data, offset, 4); + offset += 4; + if (type == "IHDR") { + UPNG.decode._IHDR(data, offset, out); + } else if (type == "IDAT") { + for (var i = 0; i < len; i++) dd[doff + i] = data[offset + i]; + doff += len; + } else if (type == "acTL") { + out.tabs[type] = { num_frames: rUi(data, offset), num_plays: rUi(data, offset + 4) }; + fd = new Uint8Array(data.length); + } else if (type == "fcTL") { + if (foff != 0) { + var fr = out.frames[out.frames.length - 1]; + fr.data = UPNG.decode._decompress(out, fd.slice(0, foff), fr.rect.width, fr.rect.height); + foff = 0; + } + var rct = { x: rUi(data, offset + 12), y: rUi(data, offset + 16), width: rUi(data, offset + 4), height: rUi(data, offset + 8) }; + var del = rUs(data, offset + 22); + del = rUs(data, offset + 20) / (del == 0 ? 100 : del); + var frm = { rect: rct, delay: Math.round(del * 1e3), dispose: data[offset + 24], blend: data[offset + 25] }; + out.frames.push(frm); + } else if (type == "fdAT") { + for (var i = 0; i < len - 4; i++) fd[foff + i] = data[offset + i + 4]; + foff += len - 4; + } else if (type == "pHYs") { + out.tabs[type] = [bin.readUint(data, offset), bin.readUint(data, offset + 4), data[offset + 8]]; + } else if (type == "cHRM") { + out.tabs[type] = []; + for (var i = 0; i < 8; i++) out.tabs[type].push(bin.readUint(data, offset + i * 4)); + } else if (type == "tEXt") { + if (out.tabs[type] == null) out.tabs[type] = {}; + var nz = bin.nextZero(data, offset); + var keyw = bin.readASCII(data, offset, nz - offset); + var text2 = bin.readASCII(data, nz + 1, offset + len - nz - 1); + out.tabs[type][keyw] = text2; + } else if (type == "iTXt") { + if (out.tabs[type] == null) out.tabs[type] = {}; + var nz = 0, off = offset; + nz = bin.nextZero(data, off); + var keyw = bin.readASCII(data, off, nz - off); + off = nz + 1; + var cflag = data[off], cmeth = data[off + 1]; + off += 2; + nz = bin.nextZero(data, off); + var ltag = bin.readASCII(data, off, nz - off); + off = nz + 1; + nz = bin.nextZero(data, off); + var tkeyw = bin.readUTF8(data, off, nz - off); + off = nz + 1; + var text2 = bin.readUTF8(data, off, len - (off - offset)); + out.tabs[type][keyw] = text2; + } else if (type == "PLTE") { + out.tabs[type] = bin.readBytes(data, offset, len); + } else if (type == "hIST") { + var pl = out.tabs["PLTE"].length / 3; + out.tabs[type] = []; + for (var i = 0; i < pl; i++) out.tabs[type].push(rUs(data, offset + i * 2)); + } else if (type == "tRNS") { + if (out.ctype == 3) out.tabs[type] = bin.readBytes(data, offset, len); + else if (out.ctype == 0) out.tabs[type] = rUs(data, offset); + else if (out.ctype == 2) out.tabs[type] = [rUs(data, offset), rUs(data, offset + 2), rUs(data, offset + 4)]; + } else if (type == "gAMA") out.tabs[type] = bin.readUint(data, offset) / 1e5; + else if (type == "sRGB") out.tabs[type] = data[offset]; + else if (type == "bKGD") { + if (out.ctype == 0 || out.ctype == 4) out.tabs[type] = [rUs(data, offset)]; + else if (out.ctype == 2 || out.ctype == 6) out.tabs[type] = [rUs(data, offset), rUs(data, offset + 2), rUs(data, offset + 4)]; + else if (out.ctype == 3) out.tabs[type] = data[offset]; + } else if (type == "IEND") { + break; + } + offset += len; + var crc = bin.readUint(data, offset); + offset += 4; + } + if (foff != 0) { + var fr = out.frames[out.frames.length - 1]; + fr.data = UPNG.decode._decompress(out, fd.slice(0, foff), fr.rect.width, fr.rect.height); + foff = 0; + } + out.data = UPNG.decode._decompress(out, dd, out.width, out.height); + delete out.compress; + delete out.interlace; + delete out.filter; + return out; +}; +UPNG.decode._decompress = function(out, dd, w, h) { + var time = Date.now(); + var bpp = UPNG.decode._getBPP(out), bpl = Math.ceil(w * bpp / 8), buff = new Uint8Array((bpl + 1 + out.interlace) * h); + dd = UPNG.decode._inflate(dd, buff); + var time = Date.now(); + if (out.interlace == 0) dd = UPNG.decode._filterZero(dd, out, 0, w, h); + else if (out.interlace == 1) dd = UPNG.decode._readInterlace(dd, out); + return dd; +}; +UPNG.decode._inflate = function(data, buff) { + var out = UPNG["inflateRaw"](new Uint8Array(data.buffer, 2, data.length - 6), buff); + return out; +}; +UPNG.inflateRaw = function() { + var H = {}; + H.H = {}; + H.H.N = function(N, W) { + var R = Uint8Array, i = 0, m = 0, J = 0, h = 0, Q = 0, X = 0, u = 0, w = 0, d = 0, v, C; + if (N[0] == 3 && N[1] == 0) return W ? W : new R(0); + var V = H.H, n = V.b, A = V.e, l = V.R, M = V.n, I = V.A, e = V.Z, b = V.m, Z = W == null; + if (Z) W = new R(N.length >>> 2 << 3); + while (i == 0) { + i = n(N, d, 1); + m = n(N, d + 1, 2); + d += 3; + if (m == 0) { + if ((d & 7) != 0) d += 8 - (d & 7); + var D = (d >>> 3) + 4, q = N[D - 4] | N[D - 3] << 8; + if (Z) W = H.H.W(W, w + q); + W.set(new R(N.buffer, N.byteOffset + D, q), w); + d = D + q << 3; + w += q; + continue; + } + if (Z) W = H.H.W(W, w + (1 << 17)); + if (m == 1) { + v = b.J; + C = b.h; + X = (1 << 9) - 1; + u = (1 << 5) - 1; + } + if (m == 2) { + J = A(N, d, 5) + 257; + h = A(N, d + 5, 5) + 1; + Q = A(N, d + 10, 4) + 4; + d += 14; + var E = d, j = 1; + for (var c = 0; c < 38; c += 2) { + b.Q[c] = 0; + b.Q[c + 1] = 0; + } + for (var c = 0; c < Q; c++) { + var K = A(N, d + c * 3, 3); + b.Q[(b.X[c] << 1) + 1] = K; + if (K > j) j = K; + } + d += 3 * Q; + M(b.Q, j); + I(b.Q, j, b.u); + v = b.w; + C = b.d; + d = l(b.u, (1 << j) - 1, J + h, N, d, b.v); + var r2 = V.V(b.v, 0, J, b.C); + X = (1 << r2) - 1; + var S = V.V(b.v, J, h, b.D); + u = (1 << S) - 1; + M(b.C, r2); + I(b.C, r2, v); + M(b.D, S); + I(b.D, S, C); + } + while (true) { + var T = v[e(N, d) & X]; + d += T & 15; + var p = T >>> 4; + if (p >>> 8 == 0) { + W[w++] = p; + } else if (p == 256) { + break; + } else { + var z = w + p - 254; + if (p > 264) { + var _ = b.q[p - 257]; + z = w + (_ >>> 3) + A(N, d, _ & 7); + d += _ & 7; + } + var $ = C[e(N, d) & u]; + d += $ & 15; + var s = $ >>> 4, Y = b.c[s], a = (Y >>> 4) + n(N, d, Y & 15); + d += Y & 15; + while (w < z) { + W[w] = W[w++ - a]; + W[w] = W[w++ - a]; + W[w] = W[w++ - a]; + W[w] = W[w++ - a]; + } + w = z; + } + } + } + return W.length == w ? W : W.slice(0, w); + }; + H.H.W = function(N, W) { + var R = N.length; + if (W <= R) return N; + var V = new Uint8Array(R << 1); + V.set(N, 0); + return V; + }; + H.H.R = function(N, W, R, V, n, A) { + var l = H.H.e, M = H.H.Z, I = 0; + while (I < R) { + var e = N[M(V, n) & W]; + n += e & 15; + var b = e >>> 4; + if (b <= 15) { + A[I] = b; + I++; + } else { + var Z = 0, m = 0; + if (b == 16) { + m = 3 + l(V, n, 2); + n += 2; + Z = A[I - 1]; + } else if (b == 17) { + m = 3 + l(V, n, 3); + n += 3; + } else if (b == 18) { + m = 11 + l(V, n, 7); + n += 7; + } + var J = I + m; + while (I < J) { + A[I] = Z; + I++; + } + } + } + return n; + }; + H.H.V = function(N, W, R, V) { + var n = 0, A = 0, l = V.length >>> 1; + while (A < R) { + var M = N[A + W]; + V[A << 1] = 0; + V[(A << 1) + 1] = M; + if (M > n) n = M; + A++; + } + while (A < l) { + V[A << 1] = 0; + V[(A << 1) + 1] = 0; + A++; + } + return n; + }; + H.H.n = function(N, W) { + var R = H.H.m, V = N.length, n, A, l, M, I, e = R.j; + for (var M = 0; M <= W; M++) e[M] = 0; + for (M = 1; M < V; M += 2) e[N[M]]++; + var b = R.K; + n = 0; + e[0] = 0; + for (A = 1; A <= W; A++) { + n = n + e[A - 1] << 1; + b[A] = n; + } + for (l = 0; l < V; l += 2) { + I = N[l + 1]; + if (I != 0) { + N[l] = b[I]; + b[I]++; + } + } + }; + H.H.A = function(N, W, R) { + var V = N.length, n = H.H.m, A = n.r; + for (var l = 0; l < V; l += 2) if (N[l + 1] != 0) { + var M = l >> 1, I = N[l + 1], e = M << 4 | I, b = W - I, Z = N[l] << b, m = Z + (1 << b); + while (Z != m) { + var J = A[Z] >>> 15 - W; + R[J] = e; + Z++; + } + } + }; + H.H.l = function(N, W) { + var R = H.H.m.r, V = 15 - W; + for (var n = 0; n < N.length; n += 2) { + var A = N[n] << W - N[n + 1]; + N[n] = R[A] >>> V; + } + }; + H.H.M = function(N, W, R) { + R = R << (W & 7); + var V = W >>> 3; + N[V] |= R; + N[V + 1] |= R >>> 8; + }; + H.H.I = function(N, W, R) { + R = R << (W & 7); + var V = W >>> 3; + N[V] |= R; + N[V + 1] |= R >>> 8; + N[V + 2] |= R >>> 16; + }; + H.H.e = function(N, W, R) { + return (N[W >>> 3] | N[(W >>> 3) + 1] << 8) >>> (W & 7) & (1 << R) - 1; + }; + H.H.b = function(N, W, R) { + return (N[W >>> 3] | N[(W >>> 3) + 1] << 8 | N[(W >>> 3) + 2] << 16) >>> (W & 7) & (1 << R) - 1; + }; + H.H.Z = function(N, W) { + return (N[W >>> 3] | N[(W >>> 3) + 1] << 8 | N[(W >>> 3) + 2] << 16) >>> (W & 7); + }; + H.H.i = function(N, W) { + return (N[W >>> 3] | N[(W >>> 3) + 1] << 8 | N[(W >>> 3) + 2] << 16 | N[(W >>> 3) + 3] << 24) >>> (W & 7); + }; + H.H.m = function() { + var N = Uint16Array, W = Uint32Array; + return { K: new N(16), j: new N(16), X: [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], S: [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 999, 999, 999], T: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0], q: new N(32), p: [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 65535, 65535], z: [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0], c: new W(32), J: new N(512), _: [], h: new N(32), $: [], w: new N(32768), C: [], v: [], d: new N(32768), D: [], u: new N(512), Q: [], r: new N(1 << 15), s: new W(286), Y: new W(30), a: new W(19), t: new W(15e3), k: new N(1 << 16), g: new N(1 << 15) }; + }(); + (function() { + var N = H.H.m, W = 1 << 15; + for (var R = 0; R < W; R++) { + var V = R; + V = (V & 2863311530) >>> 1 | (V & 1431655765) << 1; + V = (V & 3435973836) >>> 2 | (V & 858993459) << 2; + V = (V & 4042322160) >>> 4 | (V & 252645135) << 4; + V = (V & 4278255360) >>> 8 | (V & 16711935) << 8; + N.r[R] = (V >>> 16 | V << 16) >>> 17; + } + function n(A, l, M) { + while (l-- != 0) A.push(0, M); + } + for (var R = 0; R < 32; R++) { + N.q[R] = N.S[R] << 3 | N.T[R]; + N.c[R] = N.p[R] << 4 | N.z[R]; + } + n(N._, 144, 8); + n(N._, 255 - 143, 9); + n(N._, 279 - 255, 7); + n(N._, 287 - 279, 8); + H.H.n(N._, 9); + H.H.A(N._, 9, N.J); + H.H.l(N._, 9); + n(N.$, 32, 5); + H.H.n(N.$, 5); + H.H.A(N.$, 5, N.h); + H.H.l(N.$, 5); + n(N.Q, 19, 0); + n(N.C, 286, 0); + n(N.D, 30, 0); + n(N.v, 320, 0); + })(); + return H.H.N; +}(); +UPNG.decode._readInterlace = function(data, out) { + var w = out.width, h = out.height; + var bpp = UPNG.decode._getBPP(out), cbpp = bpp >> 3, bpl = Math.ceil(w * bpp / 8); + var img = new Uint8Array(h * bpl); + var di = 0; + var starting_row = [0, 0, 4, 0, 2, 0, 1]; + var starting_col = [0, 4, 0, 2, 0, 1, 0]; + var row_increment = [8, 8, 8, 4, 4, 2, 2]; + var col_increment = [8, 8, 4, 4, 2, 2, 1]; + var pass = 0; + while (pass < 7) { + var ri = row_increment[pass], ci = col_increment[pass]; + var sw = 0, sh = 0; + var cr = starting_row[pass]; + while (cr < h) { + cr += ri; + sh++; + } + var cc = starting_col[pass]; + while (cc < w) { + cc += ci; + sw++; + } + var bpll = Math.ceil(sw * bpp / 8); + UPNG.decode._filterZero(data, out, di, sw, sh); + var y = 0, row = starting_row[pass]; + while (row < h) { + var col = starting_col[pass]; + var cdi = di + y * bpll << 3; + while (col < w) { + if (bpp == 1) { + var val = data[cdi >> 3]; + val = val >> 7 - (cdi & 7) & 1; + img[row * bpl + (col >> 3)] |= val << 7 - ((col & 7) << 0); + } + if (bpp == 2) { + var val = data[cdi >> 3]; + val = val >> 6 - (cdi & 7) & 3; + img[row * bpl + (col >> 2)] |= val << 6 - ((col & 3) << 1); + } + if (bpp == 4) { + var val = data[cdi >> 3]; + val = val >> 4 - (cdi & 7) & 15; + img[row * bpl + (col >> 1)] |= val << 4 - ((col & 1) << 2); + } + if (bpp >= 8) { + var ii = row * bpl + col * cbpp; + for (var j = 0; j < cbpp; j++) img[ii + j] = data[(cdi >> 3) + j]; + } + cdi += bpp; + col += ci; + } + y++; + row += ri; + } + if (sw * sh != 0) di += sh * (1 + bpll); + pass = pass + 1; + } + return img; +}; +UPNG.decode._getBPP = function(out) { + var noc = [1, null, 3, 1, 2, null, 4][out.ctype]; + return noc * out.depth; +}; +UPNG.decode._filterZero = function(data, out, off, w, h) { + var bpp = UPNG.decode._getBPP(out), bpl = Math.ceil(w * bpp / 8), paeth = UPNG.decode._paeth; + bpp = Math.ceil(bpp / 8); + var i = 0, di = 1, type = data[off], x = 0; + if (type > 1) data[off] = [0, 0, 1][type - 2]; + if (type == 3) for (x = bpp; x < bpl; x++) data[x + 1] = data[x + 1] + (data[x + 1 - bpp] >>> 1) & 255; + for (var y = 0; y < h; y++) { + i = off + y * bpl; + di = i + y + 1; + type = data[di - 1]; + x = 0; + if (type == 0) for (; x < bpl; x++) data[i + x] = data[di + x]; + else if (type == 1) { + for (; x < bpp; x++) data[i + x] = data[di + x]; + for (; x < bpl; x++) data[i + x] = data[di + x] + data[i + x - bpp]; + } else if (type == 2) { + for (; x < bpl; x++) data[i + x] = data[di + x] + data[i + x - bpl]; + } else if (type == 3) { + for (; x < bpp; x++) data[i + x] = data[di + x] + (data[i + x - bpl] >>> 1); + for (; x < bpl; x++) data[i + x] = data[di + x] + (data[i + x - bpl] + data[i + x - bpp] >>> 1); + } else { + for (; x < bpp; x++) data[i + x] = data[di + x] + paeth(0, data[i + x - bpl], 0); + for (; x < bpl; x++) data[i + x] = data[di + x] + paeth(data[i + x - bpp], data[i + x - bpl], data[i + x - bpp - bpl]); + } + } + return data; +}; +UPNG.decode._paeth = function(a, b, c) { + var p = a + b - c, pa = p - a, pb = p - b, pc = p - c; + if (pa * pa <= pb * pb && pa * pa <= pc * pc) return a; + else if (pb * pb <= pc * pc) return b; + return c; +}; +UPNG.decode._IHDR = function(data, offset, out) { + var bin = UPNG._bin; + out.width = bin.readUint(data, offset); + offset += 4; + out.height = bin.readUint(data, offset); + offset += 4; + out.depth = data[offset]; + offset++; + out.ctype = data[offset]; + offset++; + out.compress = data[offset]; + offset++; + out.filter = data[offset]; + offset++; + out.interlace = data[offset]; + offset++; +}; +UPNG._bin = { + nextZero: function(data, p) { + while (data[p] != 0) p++; + return p; + }, + readUshort: function(buff, p) { + return buff[p] << 8 | buff[p + 1]; + }, + writeUshort: function(buff, p, n) { + buff[p] = n >> 8 & 255; + buff[p + 1] = n & 255; + }, + readUint: function(buff, p) { + return buff[p] * (256 * 256 * 256) + (buff[p + 1] << 16 | buff[p + 2] << 8 | buff[p + 3]); + }, + writeUint: function(buff, p, n) { + buff[p] = n >> 24 & 255; + buff[p + 1] = n >> 16 & 255; + buff[p + 2] = n >> 8 & 255; + buff[p + 3] = n & 255; + }, + readASCII: function(buff, p, l) { + var s = ""; + for (var i = 0; i < l; i++) s += String.fromCharCode(buff[p + i]); + return s; + }, + writeASCII: function(data, p, s) { + for (var i = 0; i < s.length; i++) data[p + i] = s.charCodeAt(i); + }, + readBytes: function(buff, p, l) { + var arr = []; + for (var i = 0; i < l; i++) arr.push(buff[p + i]); + return arr; + }, + pad: function(n) { + return n.length < 2 ? "0" + n : n; + }, + readUTF8: function(buff, p, l) { + var s = "", ns; + for (var i = 0; i < l; i++) s += "%" + UPNG._bin.pad(buff[p + i].toString(16)); + try { + ns = decodeURIComponent(s); + } catch (e) { + return UPNG._bin.readASCII(buff, p, l); + } + return ns; + } +}; +UPNG._copyTile = function(sb, sw, sh, tb, tw, th, xoff, yoff, mode) { + var w = Math.min(sw, tw), h = Math.min(sh, th); + var si = 0, ti = 0; + for (var y = 0; y < h; y++) + for (var x = 0; x < w; x++) { + if (xoff >= 0 && yoff >= 0) { + si = y * sw + x << 2; + ti = (yoff + y) * tw + xoff + x << 2; + } else { + si = (-yoff + y) * sw - xoff + x << 2; + ti = y * tw + x << 2; + } + if (mode == 0) { + tb[ti] = sb[si]; + tb[ti + 1] = sb[si + 1]; + tb[ti + 2] = sb[si + 2]; + tb[ti + 3] = sb[si + 3]; + } else if (mode == 1) { + var fa = sb[si + 3] * (1 / 255), fr = sb[si] * fa, fg = sb[si + 1] * fa, fb = sb[si + 2] * fa; + var ba = tb[ti + 3] * (1 / 255), br = tb[ti] * ba, bg = tb[ti + 1] * ba, bb = tb[ti + 2] * ba; + var ifa = 1 - fa, oa = fa + ba * ifa, ioa = oa == 0 ? 0 : 1 / oa; + tb[ti + 3] = 255 * oa; + tb[ti + 0] = (fr + br * ifa) * ioa; + tb[ti + 1] = (fg + bg * ifa) * ioa; + tb[ti + 2] = (fb + bb * ifa) * ioa; + } else if (mode == 2) { + var fa = sb[si + 3], fr = sb[si], fg = sb[si + 1], fb = sb[si + 2]; + var ba = tb[ti + 3], br = tb[ti], bg = tb[ti + 1], bb = tb[ti + 2]; + if (fa == ba && fr == br && fg == bg && fb == bb) { + tb[ti] = 0; + tb[ti + 1] = 0; + tb[ti + 2] = 0; + tb[ti + 3] = 0; + } else { + tb[ti] = fr; + tb[ti + 1] = fg; + tb[ti + 2] = fb; + tb[ti + 3] = fa; + } + } else if (mode == 3) { + var fa = sb[si + 3], fr = sb[si], fg = sb[si + 1], fb = sb[si + 2]; + var ba = tb[ti + 3], br = tb[ti], bg = tb[ti + 1], bb = tb[ti + 2]; + if (fa == ba && fr == br && fg == bg && fb == bb) continue; + if (fa < 220 && ba > 20) return false; + } + } + return true; +}; +UPNG.encode = function(bufs, w, h, ps, dels, tabs, forbidPlte) { + if (ps == null) ps = 0; + if (forbidPlte == null) forbidPlte = false; + var nimg = UPNG.encode.compress(bufs, w, h, ps, [false, false, false, 0, forbidPlte]); + UPNG.encode.compressPNG(nimg, -1); + return UPNG.encode._main(nimg, w, h, dels, tabs); +}; +UPNG.encodeLL = function(bufs, w, h, cc, ac, depth, dels, tabs) { + var nimg = { ctype: 0 + (cc == 1 ? 0 : 2) + (ac == 0 ? 0 : 4), depth, frames: [] }; + var time = Date.now(); + var bipp = (cc + ac) * depth, bipl = bipp * w; + for (var i = 0; i < bufs.length; i++) + nimg.frames.push({ rect: { x: 0, y: 0, width: w, height: h }, img: new Uint8Array(bufs[i]), blend: 0, dispose: 1, bpp: Math.ceil(bipp / 8), bpl: Math.ceil(bipl / 8) }); + UPNG.encode.compressPNG(nimg, 0, true); + var out = UPNG.encode._main(nimg, w, h, dels, tabs); + return out; +}; +UPNG.encode._main = function(nimg, w, h, dels, tabs) { + if (tabs == null) tabs = {}; + var crc = UPNG.crc.crc, wUi = UPNG._bin.writeUint, wUs = UPNG._bin.writeUshort, wAs = UPNG._bin.writeASCII; + var offset = 8, anim = nimg.frames.length > 1, pltAlpha = false; + var leng = 8 + (16 + 5 + 4) + (anim ? 20 : 0); + if (tabs["sRGB"] != null) leng += 8 + 1 + 4; + if (tabs["pHYs"] != null) leng += 8 + 9 + 4; + if (nimg.ctype == 3) { + var dl = nimg.plte.length; + for (var i = 0; i < dl; i++) if (nimg.plte[i] >>> 24 != 255) pltAlpha = true; + leng += 8 + dl * 3 + 4 + (pltAlpha ? 8 + dl * 1 + 4 : 0); + } + for (var j = 0; j < nimg.frames.length; j++) { + var fr = nimg.frames[j]; + if (anim) leng += 38; + leng += fr.cimg.length + 12; + if (j != 0) leng += 4; + } + leng += 12; + var data = new Uint8Array(leng); + var wr = [137, 80, 78, 71, 13, 10, 26, 10]; + for (var i = 0; i < 8; i++) data[i] = wr[i]; + wUi(data, offset, 13); + offset += 4; + wAs(data, offset, "IHDR"); + offset += 4; + wUi(data, offset, w); + offset += 4; + wUi(data, offset, h); + offset += 4; + data[offset] = nimg.depth; + offset++; + data[offset] = nimg.ctype; + offset++; + data[offset] = 0; + offset++; + data[offset] = 0; + offset++; + data[offset] = 0; + offset++; + wUi(data, offset, crc(data, offset - 17, 17)); + offset += 4; + if (tabs["sRGB"] != null) { + wUi(data, offset, 1); + offset += 4; + wAs(data, offset, "sRGB"); + offset += 4; + data[offset] = tabs["sRGB"]; + offset++; + wUi(data, offset, crc(data, offset - 5, 5)); + offset += 4; + } + if (tabs["pHYs"] != null) { + wUi(data, offset, 9); + offset += 4; + wAs(data, offset, "pHYs"); + offset += 4; + wUi(data, offset, tabs["pHYs"][0]); + offset += 4; + wUi(data, offset, tabs["pHYs"][1]); + offset += 4; + data[offset] = tabs["pHYs"][2]; + offset++; + wUi(data, offset, crc(data, offset - 13, 13)); + offset += 4; + } + if (anim) { + wUi(data, offset, 8); + offset += 4; + wAs(data, offset, "acTL"); + offset += 4; + wUi(data, offset, nimg.frames.length); + offset += 4; + wUi(data, offset, tabs["loop"] != null ? tabs["loop"] : 0); + offset += 4; + wUi(data, offset, crc(data, offset - 12, 12)); + offset += 4; + } + if (nimg.ctype == 3) { + var dl = nimg.plte.length; + wUi(data, offset, dl * 3); + offset += 4; + wAs(data, offset, "PLTE"); + offset += 4; + for (var i = 0; i < dl; i++) { + var ti = i * 3, c = nimg.plte[i], r2 = c & 255, g = c >>> 8 & 255, b = c >>> 16 & 255; + data[offset + ti + 0] = r2; + data[offset + ti + 1] = g; + data[offset + ti + 2] = b; + } + offset += dl * 3; + wUi(data, offset, crc(data, offset - dl * 3 - 4, dl * 3 + 4)); + offset += 4; + if (pltAlpha) { + wUi(data, offset, dl); + offset += 4; + wAs(data, offset, "tRNS"); + offset += 4; + for (var i = 0; i < dl; i++) data[offset + i] = nimg.plte[i] >>> 24 & 255; + offset += dl; + wUi(data, offset, crc(data, offset - dl - 4, dl + 4)); + offset += 4; + } + } + var fi = 0; + for (var j = 0; j < nimg.frames.length; j++) { + var fr = nimg.frames[j]; + if (anim) { + wUi(data, offset, 26); + offset += 4; + wAs(data, offset, "fcTL"); + offset += 4; + wUi(data, offset, fi++); + offset += 4; + wUi(data, offset, fr.rect.width); + offset += 4; + wUi(data, offset, fr.rect.height); + offset += 4; + wUi(data, offset, fr.rect.x); + offset += 4; + wUi(data, offset, fr.rect.y); + offset += 4; + wUs(data, offset, dels[j]); + offset += 2; + wUs(data, offset, 1e3); + offset += 2; + data[offset] = fr.dispose; + offset++; + data[offset] = fr.blend; + offset++; + wUi(data, offset, crc(data, offset - 30, 30)); + offset += 4; + } + var imgd = fr.cimg, dl = imgd.length; + wUi(data, offset, dl + (j == 0 ? 0 : 4)); + offset += 4; + var ioff = offset; + wAs(data, offset, j == 0 ? "IDAT" : "fdAT"); + offset += 4; + if (j != 0) { + wUi(data, offset, fi++); + offset += 4; + } + data.set(imgd, offset); + offset += dl; + wUi(data, offset, crc(data, ioff, offset - ioff)); + offset += 4; + } + wUi(data, offset, 0); + offset += 4; + wAs(data, offset, "IEND"); + offset += 4; + wUi(data, offset, crc(data, offset - 4, 4)); + offset += 4; + return data.buffer; +}; +UPNG.encode.compressPNG = function(out, filter, levelZero) { + for (var i = 0; i < out.frames.length; i++) { + var frm = out.frames[i], nw = frm.rect.width, nh = frm.rect.height; + var fdata = new Uint8Array(nh * frm.bpl + nh); + frm.cimg = UPNG.encode._filterZero(frm.img, nh, frm.bpp, frm.bpl, fdata, filter, levelZero); + } +}; +UPNG.encode.compress = function(bufs, w, h, ps, prms) { + var onlyBlend = prms[0], evenCrd = prms[1], forbidPrev = prms[2], minBits = prms[3], forbidPlte = prms[4]; + var ctype = 6, depth = 8, alphaAnd = 255; + for (var j = 0; j < bufs.length; j++) { + var img = new Uint8Array(bufs[j]), ilen = img.length; + for (var i = 0; i < ilen; i += 4) alphaAnd &= img[i + 3]; + } + var gotAlpha = alphaAnd != 255; + var frms = UPNG.encode.framize(bufs, w, h, onlyBlend, evenCrd, forbidPrev); + var cmap = {}, plte = [], inds = []; + if (ps != 0) { + var nbufs = []; + for (var i = 0; i < frms.length; i++) nbufs.push(frms[i].img.buffer); + var abuf = UPNG.encode.concatRGBA(nbufs), qres = UPNG.quantize(abuf, ps); + var cof = 0, bb = new Uint8Array(qres.abuf); + for (var i = 0; i < frms.length; i++) { + var ti = frms[i].img, bln = ti.length; + inds.push(new Uint8Array(qres.inds.buffer, cof >> 2, bln >> 2)); + for (var j = 0; j < bln; j += 4) { + ti[j] = bb[cof + j]; + ti[j + 1] = bb[cof + j + 1]; + ti[j + 2] = bb[cof + j + 2]; + ti[j + 3] = bb[cof + j + 3]; + } + cof += bln; + } + for (var i = 0; i < qres.plte.length; i++) plte.push(qres.plte[i].est.rgba); + } else { + for (var j = 0; j < frms.length; j++) { + var frm = frms[j], img32 = new Uint32Array(frm.img.buffer), nw = frm.rect.width, ilen = img32.length; + var ind = new Uint8Array(ilen); + inds.push(ind); + for (var i = 0; i < ilen; i++) { + var c = img32[i]; + if (i != 0 && c == img32[i - 1]) ind[i] = ind[i - 1]; + else if (i > nw && c == img32[i - nw]) ind[i] = ind[i - nw]; + else { + var cmc = cmap[c]; + if (cmc == null) { + cmap[c] = cmc = plte.length; + plte.push(c); + if (plte.length >= 300) break; + } + ind[i] = cmc; + } + } + } + } + var cc = plte.length; + if (cc <= 256 && forbidPlte == false) { + if (cc <= 2) depth = 1; + else if (cc <= 4) depth = 2; + else if (cc <= 16) depth = 4; + else depth = 8; + depth = Math.max(depth, minBits); + } + for (var j = 0; j < frms.length; j++) { + var frm = frms[j], nx = frm.rect.x, ny = frm.rect.y, nw = frm.rect.width, nh = frm.rect.height; + var cimg = frm.img, cimg32 = new Uint32Array(cimg.buffer); + var bpl = 4 * nw, bpp = 4; + if (cc <= 256 && forbidPlte == false) { + bpl = Math.ceil(depth * nw / 8); + var nimg = new Uint8Array(bpl * nh); + var inj = inds[j]; + for (var y = 0; y < nh; y++) { + var i = y * bpl, ii = y * nw; + if (depth == 8) for (var x = 0; x < nw; x++) nimg[i + x] = inj[ii + x]; + else if (depth == 4) for (var x = 0; x < nw; x++) nimg[i + (x >> 1)] |= inj[ii + x] << 4 - (x & 1) * 4; + else if (depth == 2) for (var x = 0; x < nw; x++) nimg[i + (x >> 2)] |= inj[ii + x] << 6 - (x & 3) * 2; + else if (depth == 1) for (var x = 0; x < nw; x++) nimg[i + (x >> 3)] |= inj[ii + x] << 7 - (x & 7) * 1; + } + cimg = nimg; + ctype = 3; + bpp = 1; + } else if (gotAlpha == false && frms.length == 1) { + var nimg = new Uint8Array(nw * nh * 3), area = nw * nh; + for (var i = 0; i < area; i++) { + var ti = i * 3, qi = i * 4; + nimg[ti] = cimg[qi]; + nimg[ti + 1] = cimg[qi + 1]; + nimg[ti + 2] = cimg[qi + 2]; + } + cimg = nimg; + ctype = 2; + bpp = 3; + bpl = 3 * nw; + } + frm.img = cimg; + frm.bpl = bpl; + frm.bpp = bpp; + } + return { ctype, depth, plte, frames: frms }; +}; +UPNG.encode.framize = function(bufs, w, h, alwaysBlend, evenCrd, forbidPrev) { + var frms = []; + for (var j = 0; j < bufs.length; j++) { + var cimg = new Uint8Array(bufs[j]), cimg32 = new Uint32Array(cimg.buffer); + var nimg; + var nx = 0, ny = 0, nw = w, nh = h, blend = alwaysBlend ? 1 : 0; + if (j != 0) { + var tlim = forbidPrev || alwaysBlend || j == 1 || frms[j - 2].dispose != 0 ? 1 : 2, tstp = 0, tarea = 1e9; + for (var it = 0; it < tlim; it++) { + var pimg = new Uint8Array(bufs[j - 1 - it]), p32 = new Uint32Array(bufs[j - 1 - it]); + var mix = w, miy = h, max = -1, may = -1; + for (var y = 0; y < h; y++) for (var x = 0; x < w; x++) { + var i = y * w + x; + if (cimg32[i] != p32[i]) { + if (x < mix) mix = x; + if (x > max) max = x; + if (y < miy) miy = y; + if (y > may) may = y; + } + } + if (max == -1) mix = miy = max = may = 0; + if (evenCrd) { + if ((mix & 1) == 1) mix--; + if ((miy & 1) == 1) miy--; + } + var sarea = (max - mix + 1) * (may - miy + 1); + if (sarea < tarea) { + tarea = sarea; + tstp = it; + nx = mix; + ny = miy; + nw = max - mix + 1; + nh = may - miy + 1; + } + } + var pimg = new Uint8Array(bufs[j - 1 - tstp]); + if (tstp == 1) frms[j - 1].dispose = 2; + nimg = new Uint8Array(nw * nh * 4); + UPNG._copyTile(pimg, w, h, nimg, nw, nh, -nx, -ny, 0); + blend = UPNG._copyTile(cimg, w, h, nimg, nw, nh, -nx, -ny, 3) ? 1 : 0; + if (blend == 1) UPNG.encode._prepareDiff(cimg, w, h, nimg, { x: nx, y: ny, width: nw, height: nh }); + else UPNG._copyTile(cimg, w, h, nimg, nw, nh, -nx, -ny, 0); + } else nimg = cimg.slice(0); + frms.push({ rect: { x: nx, y: ny, width: nw, height: nh }, img: nimg, blend, dispose: 0 }); + } + if (alwaysBlend) for (var j = 0; j < frms.length; j++) { + var frm = frms[j]; + if (frm.blend == 1) continue; + var r0 = frm.rect, r1 = frms[j - 1].rect; + var miX = Math.min(r0.x, r1.x), miY = Math.min(r0.y, r1.y); + var maX = Math.max(r0.x + r0.width, r1.x + r1.width), maY = Math.max(r0.y + r0.height, r1.y + r1.height); + var r2 = { x: miX, y: miY, width: maX - miX, height: maY - miY }; + frms[j - 1].dispose = 1; + if (j - 1 != 0) + UPNG.encode._updateFrame(bufs, w, h, frms, j - 1, r2, evenCrd); + UPNG.encode._updateFrame(bufs, w, h, frms, j, r2, evenCrd); + } + var area = 0; + if (bufs.length != 1) for (var i = 0; i < frms.length; i++) { + var frm = frms[i]; + area += frm.rect.width * frm.rect.height; + } + return frms; +}; +UPNG.encode._updateFrame = function(bufs, w, h, frms, i, r2, evenCrd) { + var U8 = Uint8Array, U32 = Uint32Array; + var pimg = new U8(bufs[i - 1]), pimg32 = new U32(bufs[i - 1]), nimg = i + 1 < bufs.length ? new U8(bufs[i + 1]) : null; + var cimg = new U8(bufs[i]), cimg32 = new U32(cimg.buffer); + var mix = w, miy = h, max = -1, may = -1; + for (var y = 0; y < r2.height; y++) for (var x = 0; x < r2.width; x++) { + var cx2 = r2.x + x, cy2 = r2.y + y; + var j = cy2 * w + cx2, cc = cimg32[j]; + if (cc == 0 || frms[i - 1].dispose == 0 && pimg32[j] == cc && (nimg == null || nimg[j * 4 + 3] != 0)) { + } else { + if (cx2 < mix) mix = cx2; + if (cx2 > max) max = cx2; + if (cy2 < miy) miy = cy2; + if (cy2 > may) may = cy2; + } + } + if (max == -1) mix = miy = max = may = 0; + if (evenCrd) { + if ((mix & 1) == 1) mix--; + if ((miy & 1) == 1) miy--; + } + r2 = { x: mix, y: miy, width: max - mix + 1, height: may - miy + 1 }; + var fr = frms[i]; + fr.rect = r2; + fr.blend = 1; + fr.img = new Uint8Array(r2.width * r2.height * 4); + if (frms[i - 1].dispose == 0) { + UPNG._copyTile(pimg, w, h, fr.img, r2.width, r2.height, -r2.x, -r2.y, 0); + UPNG.encode._prepareDiff(cimg, w, h, fr.img, r2); + } else + UPNG._copyTile(cimg, w, h, fr.img, r2.width, r2.height, -r2.x, -r2.y, 0); +}; +UPNG.encode._prepareDiff = function(cimg, w, h, nimg, rec) { + UPNG._copyTile(cimg, w, h, nimg, rec.width, rec.height, -rec.x, -rec.y, 2); +}; +UPNG.encode._filterZero = function(img, h, bpp, bpl, data, filter, levelZero) { + var fls = [], ftry = [0, 1, 2, 3, 4]; + if (filter != -1) ftry = [filter]; + else if (h * bpl > 5e5 || bpp == 1) ftry = [0]; + var opts; + if (levelZero) opts = { level: 0 }; + var CMPR = levelZero && UZIP != null ? UZIP : import_pako4.default; + for (var i = 0; i < ftry.length; i++) { + for (var y = 0; y < h; y++) UPNG.encode._filterLine(data, img, y, bpl, bpp, ftry[i]); + fls.push(CMPR["deflate"](data, opts)); + } + var ti, tsize = 1e9; + for (var i = 0; i < fls.length; i++) if (fls[i].length < tsize) { + ti = i; + tsize = fls[i].length; + } + return fls[ti]; +}; +UPNG.encode._filterLine = function(data, img, y, bpl, bpp, type) { + var i = y * bpl, di = i + y, paeth = UPNG.decode._paeth; + data[di] = type; + di++; + if (type == 0) { + if (bpl < 500) for (var x = 0; x < bpl; x++) data[di + x] = img[i + x]; + else data.set(new Uint8Array(img.buffer, i, bpl), di); + } else if (type == 1) { + for (var x = 0; x < bpp; x++) data[di + x] = img[i + x]; + for (var x = bpp; x < bpl; x++) data[di + x] = img[i + x] - img[i + x - bpp] + 256 & 255; + } else if (y == 0) { + for (var x = 0; x < bpp; x++) data[di + x] = img[i + x]; + if (type == 2) for (var x = bpp; x < bpl; x++) data[di + x] = img[i + x]; + if (type == 3) for (var x = bpp; x < bpl; x++) data[di + x] = img[i + x] - (img[i + x - bpp] >> 1) + 256 & 255; + if (type == 4) for (var x = bpp; x < bpl; x++) data[di + x] = img[i + x] - paeth(img[i + x - bpp], 0, 0) + 256 & 255; + } else { + if (type == 2) { + for (var x = 0; x < bpl; x++) data[di + x] = img[i + x] + 256 - img[i + x - bpl] & 255; + } + if (type == 3) { + for (var x = 0; x < bpp; x++) data[di + x] = img[i + x] + 256 - (img[i + x - bpl] >> 1) & 255; + for (var x = bpp; x < bpl; x++) data[di + x] = img[i + x] + 256 - (img[i + x - bpl] + img[i + x - bpp] >> 1) & 255; + } + if (type == 4) { + for (var x = 0; x < bpp; x++) data[di + x] = img[i + x] + 256 - paeth(0, img[i + x - bpl], 0) & 255; + for (var x = bpp; x < bpl; x++) data[di + x] = img[i + x] + 256 - paeth(img[i + x - bpp], img[i + x - bpl], img[i + x - bpp - bpl]) & 255; + } + } +}; +UPNG.crc = { + table: function() { + var tab = new Uint32Array(256); + for (var n = 0; n < 256; n++) { + var c = n; + for (var k = 0; k < 8; k++) { + if (c & 1) c = 3988292384 ^ c >>> 1; + else c = c >>> 1; + } + tab[n] = c; + } + return tab; + }(), + update: function(c, buf, off, len) { + for (var i = 0; i < len; i++) c = UPNG.crc.table[(c ^ buf[off + i]) & 255] ^ c >>> 8; + return c; + }, + crc: function(b, o, l) { + return UPNG.crc.update(4294967295, b, o, l) ^ 4294967295; + } +}; +UPNG.quantize = function(abuf, ps) { + var oimg = new Uint8Array(abuf), nimg = oimg.slice(0), nimg32 = new Uint32Array(nimg.buffer); + var KD = UPNG.quantize.getKDtree(nimg, ps); + var root3 = KD[0], leafs = KD[1]; + var planeDst = UPNG.quantize.planeDst; + var sb = oimg, tb = nimg32, len = sb.length; + var inds = new Uint8Array(oimg.length >> 2); + for (var i = 0; i < len; i += 4) { + var r2 = sb[i] * (1 / 255), g = sb[i + 1] * (1 / 255), b = sb[i + 2] * (1 / 255), a = sb[i + 3] * (1 / 255); + var nd = UPNG.quantize.getNearest(root3, r2, g, b, a); + inds[i >> 2] = nd.ind; + tb[i >> 2] = nd.est.rgba; + } + return { abuf: nimg.buffer, inds, plte: leafs }; +}; +UPNG.quantize.getKDtree = function(nimg, ps, err) { + if (err == null) err = 1e-4; + var nimg32 = new Uint32Array(nimg.buffer); + var root3 = { i0: 0, i1: nimg.length, bst: null, est: null, tdst: 0, left: null, right: null }; + root3.bst = UPNG.quantize.stats(nimg, root3.i0, root3.i1); + root3.est = UPNG.quantize.estats(root3.bst); + var leafs = [root3]; + while (leafs.length < ps) { + var maxL = 0, mi = 0; + for (var i = 0; i < leafs.length; i++) if (leafs[i].est.L > maxL) { + maxL = leafs[i].est.L; + mi = i; + } + if (maxL < err) break; + var node = leafs[mi]; + var s0 = UPNG.quantize.splitPixels(nimg, nimg32, node.i0, node.i1, node.est.e, node.est.eMq255); + var s0wrong = node.i0 >= s0 || node.i1 <= s0; + if (s0wrong) { + node.est.L = 0; + continue; + } + var ln = { i0: node.i0, i1: s0, bst: null, est: null, tdst: 0, left: null, right: null }; + ln.bst = UPNG.quantize.stats(nimg, ln.i0, ln.i1); + ln.est = UPNG.quantize.estats(ln.bst); + var rn = { i0: s0, i1: node.i1, bst: null, est: null, tdst: 0, left: null, right: null }; + rn.bst = { R: [], m: [], N: node.bst.N - ln.bst.N }; + for (var i = 0; i < 16; i++) rn.bst.R[i] = node.bst.R[i] - ln.bst.R[i]; + for (var i = 0; i < 4; i++) rn.bst.m[i] = node.bst.m[i] - ln.bst.m[i]; + rn.est = UPNG.quantize.estats(rn.bst); + node.left = ln; + node.right = rn; + leafs[mi] = ln; + leafs.push(rn); + } + leafs.sort(function(a, b) { + return b.bst.N - a.bst.N; + }); + for (var i = 0; i < leafs.length; i++) leafs[i].ind = i; + return [root3, leafs]; +}; +UPNG.quantize.getNearest = function(nd, r2, g, b, a) { + if (nd.left == null) { + nd.tdst = UPNG.quantize.dist(nd.est.q, r2, g, b, a); + return nd; + } + var planeDst = UPNG.quantize.planeDst(nd.est, r2, g, b, a); + var node0 = nd.left, node1 = nd.right; + if (planeDst > 0) { + node0 = nd.right; + node1 = nd.left; + } + var ln = UPNG.quantize.getNearest(node0, r2, g, b, a); + if (ln.tdst <= planeDst * planeDst) return ln; + var rn = UPNG.quantize.getNearest(node1, r2, g, b, a); + return rn.tdst < ln.tdst ? rn : ln; +}; +UPNG.quantize.planeDst = function(est, r2, g, b, a) { + var e = est.e; + return e[0] * r2 + e[1] * g + e[2] * b + e[3] * a - est.eMq; +}; +UPNG.quantize.dist = function(q, r2, g, b, a) { + var d0 = r2 - q[0], d1 = g - q[1], d2 = b - q[2], d3 = a - q[3]; + return d0 * d0 + d1 * d1 + d2 * d2 + d3 * d3; +}; +UPNG.quantize.splitPixels = function(nimg, nimg32, i0, i1, e, eMq) { + var vecDot = UPNG.quantize.vecDot; + i1 -= 4; + var shfs = 0; + while (i0 < i1) { + while (vecDot(nimg, i0, e) <= eMq) i0 += 4; + while (vecDot(nimg, i1, e) > eMq) i1 -= 4; + if (i0 >= i1) break; + var t = nimg32[i0 >> 2]; + nimg32[i0 >> 2] = nimg32[i1 >> 2]; + nimg32[i1 >> 2] = t; + i0 += 4; + i1 -= 4; + } + while (vecDot(nimg, i0, e) > eMq) i0 -= 4; + return i0 + 4; +}; +UPNG.quantize.vecDot = function(nimg, i, e) { + return nimg[i] * e[0] + nimg[i + 1] * e[1] + nimg[i + 2] * e[2] + nimg[i + 3] * e[3]; +}; +UPNG.quantize.stats = function(nimg, i0, i1) { + var R = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + var m = [0, 0, 0, 0]; + var N = i1 - i0 >> 2; + for (var i = i0; i < i1; i += 4) { + var r2 = nimg[i] * (1 / 255), g = nimg[i + 1] * (1 / 255), b = nimg[i + 2] * (1 / 255), a = nimg[i + 3] * (1 / 255); + m[0] += r2; + m[1] += g; + m[2] += b; + m[3] += a; + R[0] += r2 * r2; + R[1] += r2 * g; + R[2] += r2 * b; + R[3] += r2 * a; + R[5] += g * g; + R[6] += g * b; + R[7] += g * a; + R[10] += b * b; + R[11] += b * a; + R[15] += a * a; + } + R[4] = R[1]; + R[8] = R[2]; + R[9] = R[6]; + R[12] = R[3]; + R[13] = R[7]; + R[14] = R[11]; + return { R, m, N }; +}; +UPNG.quantize.estats = function(stats) { + var R = stats.R, m = stats.m, N = stats.N; + var m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3], iN = N == 0 ? 0 : 1 / N; + var Rj = [ + R[0] - m0 * m0 * iN, + R[1] - m0 * m1 * iN, + R[2] - m0 * m2 * iN, + R[3] - m0 * m3 * iN, + R[4] - m1 * m0 * iN, + R[5] - m1 * m1 * iN, + R[6] - m1 * m2 * iN, + R[7] - m1 * m3 * iN, + R[8] - m2 * m0 * iN, + R[9] - m2 * m1 * iN, + R[10] - m2 * m2 * iN, + R[11] - m2 * m3 * iN, + R[12] - m3 * m0 * iN, + R[13] - m3 * m1 * iN, + R[14] - m3 * m2 * iN, + R[15] - m3 * m3 * iN + ]; + var A = Rj, M = UPNG.M4; + var b = [0.5, 0.5, 0.5, 0.5], mi = 0, tmi = 0; + if (N != 0) + for (var i = 0; i < 10; i++) { + b = M.multVec(A, b); + tmi = Math.sqrt(M.dot(b, b)); + b = M.sml(1 / tmi, b); + if (Math.abs(tmi - mi) < 1e-9) break; + mi = tmi; + } + var q = [m0 * iN, m1 * iN, m2 * iN, m3 * iN]; + var eMq255 = M.dot(M.sml(255, q), b); + return { + Cov: Rj, + q, + e: b, + L: mi, + eMq255, + eMq: M.dot(b, q), + rgba: (Math.round(255 * q[3]) << 24 | Math.round(255 * q[2]) << 16 | Math.round(255 * q[1]) << 8 | Math.round(255 * q[0]) << 0) >>> 0 + }; +}; +UPNG.M4 = { + multVec: function(m, v) { + return [ + m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3] * v[3], + m[4] * v[0] + m[5] * v[1] + m[6] * v[2] + m[7] * v[3], + m[8] * v[0] + m[9] * v[1] + m[10] * v[2] + m[11] * v[3], + m[12] * v[0] + m[13] * v[1] + m[14] * v[2] + m[15] * v[3] + ]; + }, + dot: function(x, y) { + return x[0] * y[0] + x[1] * y[1] + x[2] * y[2] + x[3] * y[3]; + }, + sml: function(a, y) { + return [a * y[0], a * y[1], a * y[2], a * y[3]]; + } +}; +UPNG.encode.concatRGBA = function(bufs) { + var tlen = 0; + for (var i = 0; i < bufs.length; i++) tlen += bufs[i].byteLength; + var nimg = new Uint8Array(tlen), noff = 0; + for (var i = 0; i < bufs.length; i++) { + var img = new Uint8Array(bufs[i]), il = img.length; + for (var j = 0; j < il; j += 4) { + var r2 = img[j], g = img[j + 1], b = img[j + 2], a = img[j + 3]; + if (a == 0) r2 = g = b = 0; + nimg[noff + j] = r2; + nimg[noff + j + 1] = g; + nimg[noff + j + 2] = b; + nimg[noff + j + 3] = a; + } + noff += il; + } + return nimg.buffer; +}; +var UPNG_default = UPNG; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/utils/png.js +var getImageType = function(ctype) { + if (ctype === 0) + return PngType.Greyscale; + if (ctype === 2) + return PngType.Truecolour; + if (ctype === 3) + return PngType.IndexedColour; + if (ctype === 4) + return PngType.GreyscaleWithAlpha; + if (ctype === 6) + return PngType.TruecolourWithAlpha; + throw new Error("Unknown color type: " + ctype); +}; +var splitAlphaChannel = function(rgbaChannel) { + var pixelCount = Math.floor(rgbaChannel.length / 4); + var rgbChannel = new Uint8Array(pixelCount * 3); + var alphaChannel = new Uint8Array(pixelCount * 1); + var rgbaOffset = 0; + var rgbOffset = 0; + var alphaOffset = 0; + while (rgbaOffset < rgbaChannel.length) { + rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++]; + rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++]; + rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++]; + alphaChannel[alphaOffset++] = rgbaChannel[rgbaOffset++]; + } + return { rgbChannel, alphaChannel }; +}; +var PngType; +(function(PngType2) { + PngType2["Greyscale"] = "Greyscale"; + PngType2["Truecolour"] = "Truecolour"; + PngType2["IndexedColour"] = "IndexedColour"; + PngType2["GreyscaleWithAlpha"] = "GreyscaleWithAlpha"; + PngType2["TruecolourWithAlpha"] = "TruecolourWithAlpha"; +})(PngType || (PngType = {})); +var PNG = ( + /** @class */ + function() { + function PNG2(pngData) { + var upng = UPNG_default.decode(pngData); + var frames = UPNG_default.toRGBA8(upng); + if (frames.length > 1) + throw new Error("Animated PNGs are not supported"); + var frame = new Uint8Array(frames[0]); + var _a3 = splitAlphaChannel(frame), rgbChannel = _a3.rgbChannel, alphaChannel = _a3.alphaChannel; + this.rgbChannel = rgbChannel; + var hasAlphaValues = alphaChannel.some(function(a) { + return a < 255; + }); + if (hasAlphaValues) + this.alphaChannel = alphaChannel; + this.type = getImageType(upng.ctype); + this.width = upng.width; + this.height = upng.height; + this.bitsPerComponent = 8; + } + PNG2.load = function(pngData) { + return new PNG2(pngData); + }; + return PNG2; + }() +); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/PngEmbedder.js +var PngEmbedder = ( + /** @class */ + function() { + function PngEmbedder2(png) { + this.image = png; + this.bitsPerComponent = png.bitsPerComponent; + this.width = png.width; + this.height = png.height; + this.colorSpace = "DeviceRGB"; + } + PngEmbedder2.for = function(imageData) { + return __awaiter(this, void 0, void 0, function() { + var png; + return __generator(this, function(_a3) { + png = PNG.load(imageData); + return [2, new PngEmbedder2(png)]; + }); + }); + }; + PngEmbedder2.prototype.embedIntoContext = function(context, ref) { + return __awaiter(this, void 0, void 0, function() { + var SMask, xObject; + return __generator(this, function(_a3) { + SMask = this.embedAlphaChannel(context); + xObject = context.flateStream(this.image.rgbChannel, { + Type: "XObject", + Subtype: "Image", + BitsPerComponent: this.image.bitsPerComponent, + Width: this.image.width, + Height: this.image.height, + ColorSpace: this.colorSpace, + SMask + }); + if (ref) { + context.assign(ref, xObject); + return [2, ref]; + } else { + return [2, context.register(xObject)]; + } + return [ + 2 + /*return*/ + ]; + }); + }); + }; + PngEmbedder2.prototype.embedAlphaChannel = function(context) { + if (!this.image.alphaChannel) + return void 0; + var xObject = context.flateStream(this.image.alphaChannel, { + Type: "XObject", + Subtype: "Image", + Height: this.image.height, + Width: this.image.width, + BitsPerComponent: this.image.bitsPerComponent, + ColorSpace: "DeviceGray", + Decode: [0, 1] + }); + return context.register(xObject); + }; + return PngEmbedder2; + }() +); +var PngEmbedder_default = PngEmbedder; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/streams/Stream.js +var Stream = ( + /** @class */ + function() { + function Stream2(buffer, start, length) { + this.bytes = buffer; + this.start = start || 0; + this.pos = this.start; + this.end = !!start && !!length ? start + length : this.bytes.length; + } + Object.defineProperty(Stream2.prototype, "length", { + get: function() { + return this.end - this.start; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Stream2.prototype, "isEmpty", { + get: function() { + return this.length === 0; + }, + enumerable: false, + configurable: true + }); + Stream2.prototype.getByte = function() { + if (this.pos >= this.end) { + return -1; + } + return this.bytes[this.pos++]; + }; + Stream2.prototype.getUint16 = function() { + var b0 = this.getByte(); + var b1 = this.getByte(); + if (b0 === -1 || b1 === -1) { + return -1; + } + return (b0 << 8) + b1; + }; + Stream2.prototype.getInt32 = function() { + var b0 = this.getByte(); + var b1 = this.getByte(); + var b2 = this.getByte(); + var b3 = this.getByte(); + return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; + }; + Stream2.prototype.getBytes = function(length, forceClamped) { + if (forceClamped === void 0) { + forceClamped = false; + } + var bytes = this.bytes; + var pos = this.pos; + var strEnd = this.end; + if (!length) { + var subarray = bytes.subarray(pos, strEnd); + return forceClamped ? new Uint8ClampedArray(subarray) : subarray; + } else { + var end = pos + length; + if (end > strEnd) { + end = strEnd; + } + this.pos = end; + var subarray = bytes.subarray(pos, end); + return forceClamped ? new Uint8ClampedArray(subarray) : subarray; + } + }; + Stream2.prototype.peekByte = function() { + var peekedByte = this.getByte(); + this.pos--; + return peekedByte; + }; + Stream2.prototype.peekBytes = function(length, forceClamped) { + if (forceClamped === void 0) { + forceClamped = false; + } + var bytes = this.getBytes(length, forceClamped); + this.pos -= bytes.length; + return bytes; + }; + Stream2.prototype.skip = function(n) { + if (!n) { + n = 1; + } + this.pos += n; + }; + Stream2.prototype.reset = function() { + this.pos = this.start; + }; + Stream2.prototype.moveStart = function() { + this.start = this.pos; + }; + Stream2.prototype.makeSubStream = function(start, length) { + return new Stream2(this.bytes, start, length); + }; + Stream2.prototype.decode = function() { + return this.bytes; + }; + return Stream2; + }() +); +var Stream_default = Stream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/streams/DecodeStream.js +var emptyBuffer = new Uint8Array(0); +var DecodeStream = ( + /** @class */ + function() { + function DecodeStream2(maybeMinBufferLength) { + this.pos = 0; + this.bufferLength = 0; + this.eof = false; + this.buffer = emptyBuffer; + this.minBufferLength = 512; + if (maybeMinBufferLength) { + while (this.minBufferLength < maybeMinBufferLength) { + this.minBufferLength *= 2; + } + } + } + Object.defineProperty(DecodeStream2.prototype, "isEmpty", { + get: function() { + while (!this.eof && this.bufferLength === 0) { + this.readBlock(); + } + return this.bufferLength === 0; + }, + enumerable: false, + configurable: true + }); + DecodeStream2.prototype.getByte = function() { + var pos = this.pos; + while (this.bufferLength <= pos) { + if (this.eof) { + return -1; + } + this.readBlock(); + } + return this.buffer[this.pos++]; + }; + DecodeStream2.prototype.getUint16 = function() { + var b0 = this.getByte(); + var b1 = this.getByte(); + if (b0 === -1 || b1 === -1) { + return -1; + } + return (b0 << 8) + b1; + }; + DecodeStream2.prototype.getInt32 = function() { + var b0 = this.getByte(); + var b1 = this.getByte(); + var b2 = this.getByte(); + var b3 = this.getByte(); + return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; + }; + DecodeStream2.prototype.getBytes = function(length, forceClamped) { + if (forceClamped === void 0) { + forceClamped = false; + } + var end; + var pos = this.pos; + if (length) { + this.ensureBuffer(pos + length); + end = pos + length; + while (!this.eof && this.bufferLength < end) { + this.readBlock(); + } + var bufEnd = this.bufferLength; + if (end > bufEnd) { + end = bufEnd; + } + } else { + while (!this.eof) { + this.readBlock(); + } + end = this.bufferLength; + } + this.pos = end; + var subarray = this.buffer.subarray(pos, end); + return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray; + }; + DecodeStream2.prototype.peekByte = function() { + var peekedByte = this.getByte(); + this.pos--; + return peekedByte; + }; + DecodeStream2.prototype.peekBytes = function(length, forceClamped) { + if (forceClamped === void 0) { + forceClamped = false; + } + var bytes = this.getBytes(length, forceClamped); + this.pos -= bytes.length; + return bytes; + }; + DecodeStream2.prototype.skip = function(n) { + if (!n) { + n = 1; + } + this.pos += n; + }; + DecodeStream2.prototype.reset = function() { + this.pos = 0; + }; + DecodeStream2.prototype.makeSubStream = function(start, length) { + var end = start + length; + while (this.bufferLength <= end && !this.eof) { + this.readBlock(); + } + return new Stream_default( + this.buffer, + start, + length + /* dict */ + ); + }; + DecodeStream2.prototype.decode = function() { + while (!this.eof) + this.readBlock(); + return this.buffer.subarray(0, this.bufferLength); + }; + DecodeStream2.prototype.readBlock = function() { + throw new MethodNotImplementedError(this.constructor.name, "readBlock"); + }; + DecodeStream2.prototype.ensureBuffer = function(requested) { + var buffer = this.buffer; + if (requested <= buffer.byteLength) { + return buffer; + } + var size = this.minBufferLength; + while (size < requested) { + size *= 2; + } + var buffer2 = new Uint8Array(size); + buffer2.set(buffer); + return this.buffer = buffer2; + }; + return DecodeStream2; + }() +); +var DecodeStream_default = DecodeStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/streams/Ascii85Stream.js +var isSpace = function(ch) { + return ch === 32 || ch === 9 || ch === 13 || ch === 10; +}; +var Ascii85Stream = ( + /** @class */ + function(_super) { + __extends(Ascii85Stream2, _super); + function Ascii85Stream2(stream2, maybeLength) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream2; + _this.input = new Uint8Array(5); + if (maybeLength) { + maybeLength = 0.8 * maybeLength; + } + return _this; + } + Ascii85Stream2.prototype.readBlock = function() { + var TILDA_CHAR = 126; + var Z_LOWER_CHAR = 122; + var EOF = -1; + var stream2 = this.stream; + var c = stream2.getByte(); + while (isSpace(c)) { + c = stream2.getByte(); + } + if (c === EOF || c === TILDA_CHAR) { + this.eof = true; + return; + } + var bufferLength = this.bufferLength; + var buffer; + var i; + if (c === Z_LOWER_CHAR) { + buffer = this.ensureBuffer(bufferLength + 4); + for (i = 0; i < 4; ++i) { + buffer[bufferLength + i] = 0; + } + this.bufferLength += 4; + } else { + var input = this.input; + input[0] = c; + for (i = 1; i < 5; ++i) { + c = stream2.getByte(); + while (isSpace(c)) { + c = stream2.getByte(); + } + input[i] = c; + if (c === EOF || c === TILDA_CHAR) { + break; + } + } + buffer = this.ensureBuffer(bufferLength + i - 1); + this.bufferLength += i - 1; + if (i < 5) { + for (; i < 5; ++i) { + input[i] = 33 + 84; + } + this.eof = true; + } + var t = 0; + for (i = 0; i < 5; ++i) { + t = t * 85 + (input[i] - 33); + } + for (i = 3; i >= 0; --i) { + buffer[bufferLength + i] = t & 255; + t >>= 8; + } + } + }; + return Ascii85Stream2; + }(DecodeStream_default) +); +var Ascii85Stream_default = Ascii85Stream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/streams/AsciiHexStream.js +var AsciiHexStream = ( + /** @class */ + function(_super) { + __extends(AsciiHexStream2, _super); + function AsciiHexStream2(stream2, maybeLength) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream2; + _this.firstDigit = -1; + if (maybeLength) { + maybeLength = 0.5 * maybeLength; + } + return _this; + } + AsciiHexStream2.prototype.readBlock = function() { + var UPSTREAM_BLOCK_SIZE = 8e3; + var bytes = this.stream.getBytes(UPSTREAM_BLOCK_SIZE); + if (!bytes.length) { + this.eof = true; + return; + } + var maxDecodeLength = bytes.length + 1 >> 1; + var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); + var bufferLength = this.bufferLength; + var firstDigit = this.firstDigit; + for (var i = 0, ii = bytes.length; i < ii; i++) { + var ch = bytes[i]; + var digit = void 0; + if (ch >= 48 && ch <= 57) { + digit = ch & 15; + } else if (ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102) { + digit = (ch & 15) + 9; + } else if (ch === 62) { + this.eof = true; + break; + } else { + continue; + } + if (firstDigit < 0) { + firstDigit = digit; + } else { + buffer[bufferLength++] = firstDigit << 4 | digit; + firstDigit = -1; + } + } + if (firstDigit >= 0 && this.eof) { + buffer[bufferLength++] = firstDigit << 4; + firstDigit = -1; + } + this.firstDigit = firstDigit; + this.bufferLength = bufferLength; + }; + return AsciiHexStream2; + }(DecodeStream_default) +); +var AsciiHexStream_default = AsciiHexStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/streams/FlateStream.js +var codeLenCodeMap = new Int32Array([ + 16, + 17, + 18, + 0, + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15 +]); +var lengthDecode = new Int32Array([ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 65547, + 65549, + 65551, + 65553, + 131091, + 131095, + 131099, + 131103, + 196643, + 196651, + 196659, + 196667, + 262211, + 262227, + 262243, + 262259, + 327811, + 327843, + 327875, + 327907, + 258, + 258, + 258 +]); +var distDecode = new Int32Array([ + 1, + 2, + 3, + 4, + 65541, + 65543, + 131081, + 131085, + 196625, + 196633, + 262177, + 262193, + 327745, + 327777, + 393345, + 393409, + 459009, + 459137, + 524801, + 525057, + 590849, + 591361, + 657409, + 658433, + 724993, + 727041, + 794625, + 798721, + 868353, + 876545 +]); +var fixedLitCodeTab = [new Int32Array([ + 459008, + 524368, + 524304, + 524568, + 459024, + 524400, + 524336, + 590016, + 459016, + 524384, + 524320, + 589984, + 524288, + 524416, + 524352, + 590048, + 459012, + 524376, + 524312, + 589968, + 459028, + 524408, + 524344, + 590032, + 459020, + 524392, + 524328, + 59e4, + 524296, + 524424, + 524360, + 590064, + 459010, + 524372, + 524308, + 524572, + 459026, + 524404, + 524340, + 590024, + 459018, + 524388, + 524324, + 589992, + 524292, + 524420, + 524356, + 590056, + 459014, + 524380, + 524316, + 589976, + 459030, + 524412, + 524348, + 590040, + 459022, + 524396, + 524332, + 590008, + 524300, + 524428, + 524364, + 590072, + 459009, + 524370, + 524306, + 524570, + 459025, + 524402, + 524338, + 590020, + 459017, + 524386, + 524322, + 589988, + 524290, + 524418, + 524354, + 590052, + 459013, + 524378, + 524314, + 589972, + 459029, + 524410, + 524346, + 590036, + 459021, + 524394, + 524330, + 590004, + 524298, + 524426, + 524362, + 590068, + 459011, + 524374, + 524310, + 524574, + 459027, + 524406, + 524342, + 590028, + 459019, + 524390, + 524326, + 589996, + 524294, + 524422, + 524358, + 590060, + 459015, + 524382, + 524318, + 589980, + 459031, + 524414, + 524350, + 590044, + 459023, + 524398, + 524334, + 590012, + 524302, + 524430, + 524366, + 590076, + 459008, + 524369, + 524305, + 524569, + 459024, + 524401, + 524337, + 590018, + 459016, + 524385, + 524321, + 589986, + 524289, + 524417, + 524353, + 590050, + 459012, + 524377, + 524313, + 589970, + 459028, + 524409, + 524345, + 590034, + 459020, + 524393, + 524329, + 590002, + 524297, + 524425, + 524361, + 590066, + 459010, + 524373, + 524309, + 524573, + 459026, + 524405, + 524341, + 590026, + 459018, + 524389, + 524325, + 589994, + 524293, + 524421, + 524357, + 590058, + 459014, + 524381, + 524317, + 589978, + 459030, + 524413, + 524349, + 590042, + 459022, + 524397, + 524333, + 590010, + 524301, + 524429, + 524365, + 590074, + 459009, + 524371, + 524307, + 524571, + 459025, + 524403, + 524339, + 590022, + 459017, + 524387, + 524323, + 589990, + 524291, + 524419, + 524355, + 590054, + 459013, + 524379, + 524315, + 589974, + 459029, + 524411, + 524347, + 590038, + 459021, + 524395, + 524331, + 590006, + 524299, + 524427, + 524363, + 590070, + 459011, + 524375, + 524311, + 524575, + 459027, + 524407, + 524343, + 590030, + 459019, + 524391, + 524327, + 589998, + 524295, + 524423, + 524359, + 590062, + 459015, + 524383, + 524319, + 589982, + 459031, + 524415, + 524351, + 590046, + 459023, + 524399, + 524335, + 590014, + 524303, + 524431, + 524367, + 590078, + 459008, + 524368, + 524304, + 524568, + 459024, + 524400, + 524336, + 590017, + 459016, + 524384, + 524320, + 589985, + 524288, + 524416, + 524352, + 590049, + 459012, + 524376, + 524312, + 589969, + 459028, + 524408, + 524344, + 590033, + 459020, + 524392, + 524328, + 590001, + 524296, + 524424, + 524360, + 590065, + 459010, + 524372, + 524308, + 524572, + 459026, + 524404, + 524340, + 590025, + 459018, + 524388, + 524324, + 589993, + 524292, + 524420, + 524356, + 590057, + 459014, + 524380, + 524316, + 589977, + 459030, + 524412, + 524348, + 590041, + 459022, + 524396, + 524332, + 590009, + 524300, + 524428, + 524364, + 590073, + 459009, + 524370, + 524306, + 524570, + 459025, + 524402, + 524338, + 590021, + 459017, + 524386, + 524322, + 589989, + 524290, + 524418, + 524354, + 590053, + 459013, + 524378, + 524314, + 589973, + 459029, + 524410, + 524346, + 590037, + 459021, + 524394, + 524330, + 590005, + 524298, + 524426, + 524362, + 590069, + 459011, + 524374, + 524310, + 524574, + 459027, + 524406, + 524342, + 590029, + 459019, + 524390, + 524326, + 589997, + 524294, + 524422, + 524358, + 590061, + 459015, + 524382, + 524318, + 589981, + 459031, + 524414, + 524350, + 590045, + 459023, + 524398, + 524334, + 590013, + 524302, + 524430, + 524366, + 590077, + 459008, + 524369, + 524305, + 524569, + 459024, + 524401, + 524337, + 590019, + 459016, + 524385, + 524321, + 589987, + 524289, + 524417, + 524353, + 590051, + 459012, + 524377, + 524313, + 589971, + 459028, + 524409, + 524345, + 590035, + 459020, + 524393, + 524329, + 590003, + 524297, + 524425, + 524361, + 590067, + 459010, + 524373, + 524309, + 524573, + 459026, + 524405, + 524341, + 590027, + 459018, + 524389, + 524325, + 589995, + 524293, + 524421, + 524357, + 590059, + 459014, + 524381, + 524317, + 589979, + 459030, + 524413, + 524349, + 590043, + 459022, + 524397, + 524333, + 590011, + 524301, + 524429, + 524365, + 590075, + 459009, + 524371, + 524307, + 524571, + 459025, + 524403, + 524339, + 590023, + 459017, + 524387, + 524323, + 589991, + 524291, + 524419, + 524355, + 590055, + 459013, + 524379, + 524315, + 589975, + 459029, + 524411, + 524347, + 590039, + 459021, + 524395, + 524331, + 590007, + 524299, + 524427, + 524363, + 590071, + 459011, + 524375, + 524311, + 524575, + 459027, + 524407, + 524343, + 590031, + 459019, + 524391, + 524327, + 589999, + 524295, + 524423, + 524359, + 590063, + 459015, + 524383, + 524319, + 589983, + 459031, + 524415, + 524351, + 590047, + 459023, + 524399, + 524335, + 590015, + 524303, + 524431, + 524367, + 590079 +]), 9]; +var fixedDistCodeTab = [new Int32Array([ + 327680, + 327696, + 327688, + 327704, + 327684, + 327700, + 327692, + 327708, + 327682, + 327698, + 327690, + 327706, + 327686, + 327702, + 327694, + 0, + 327681, + 327697, + 327689, + 327705, + 327685, + 327701, + 327693, + 327709, + 327683, + 327699, + 327691, + 327707, + 327687, + 327703, + 327695, + 0 +]), 5]; +var FlateStream = ( + /** @class */ + function(_super) { + __extends(FlateStream2, _super); + function FlateStream2(stream2, maybeLength) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream2; + var cmf = stream2.getByte(); + var flg = stream2.getByte(); + if (cmf === -1 || flg === -1) { + throw new Error("Invalid header in flate stream: " + cmf + ", " + flg); + } + if ((cmf & 15) !== 8) { + throw new Error("Unknown compression method in flate stream: " + cmf + ", " + flg); + } + if (((cmf << 8) + flg) % 31 !== 0) { + throw new Error("Bad FCHECK in flate stream: " + cmf + ", " + flg); + } + if (flg & 32) { + throw new Error("FDICT bit set in flate stream: " + cmf + ", " + flg); + } + _this.codeSize = 0; + _this.codeBuf = 0; + return _this; + } + FlateStream2.prototype.readBlock = function() { + var buffer; + var len; + var str = this.stream; + var hdr = this.getBits(3); + if (hdr & 1) { + this.eof = true; + } + hdr >>= 1; + if (hdr === 0) { + var b = void 0; + if ((b = str.getByte()) === -1) { + throw new Error("Bad block header in flate stream"); + } + var blockLen = b; + if ((b = str.getByte()) === -1) { + throw new Error("Bad block header in flate stream"); + } + blockLen |= b << 8; + if ((b = str.getByte()) === -1) { + throw new Error("Bad block header in flate stream"); + } + var check = b; + if ((b = str.getByte()) === -1) { + throw new Error("Bad block header in flate stream"); + } + check |= b << 8; + if (check !== (~blockLen & 65535) && (blockLen !== 0 || check !== 0)) { + throw new Error("Bad uncompressed block length in flate stream"); + } + this.codeBuf = 0; + this.codeSize = 0; + var bufferLength = this.bufferLength; + buffer = this.ensureBuffer(bufferLength + blockLen); + var end = bufferLength + blockLen; + this.bufferLength = end; + if (blockLen === 0) { + if (str.peekByte() === -1) { + this.eof = true; + } + } else { + for (var n = bufferLength; n < end; ++n) { + if ((b = str.getByte()) === -1) { + this.eof = true; + break; + } + buffer[n] = b; + } + } + return; + } + var litCodeTable; + var distCodeTable; + if (hdr === 1) { + litCodeTable = fixedLitCodeTab; + distCodeTable = fixedDistCodeTab; + } else if (hdr === 2) { + var numLitCodes = this.getBits(5) + 257; + var numDistCodes = this.getBits(5) + 1; + var numCodeLenCodes = this.getBits(4) + 4; + var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); + var i = void 0; + for (i = 0; i < numCodeLenCodes; ++i) { + codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); + } + var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); + len = 0; + i = 0; + var codes = numLitCodes + numDistCodes; + var codeLengths = new Uint8Array(codes); + var bitsLength = void 0; + var bitsOffset = void 0; + var what = void 0; + while (i < codes) { + var code = this.getCode(codeLenCodeTab); + if (code === 16) { + bitsLength = 2; + bitsOffset = 3; + what = len; + } else if (code === 17) { + bitsLength = 3; + bitsOffset = 3; + what = len = 0; + } else if (code === 18) { + bitsLength = 7; + bitsOffset = 11; + what = len = 0; + } else { + codeLengths[i++] = len = code; + continue; + } + var repeatLength = this.getBits(bitsLength) + bitsOffset; + while (repeatLength-- > 0) { + codeLengths[i++] = what; + } + } + litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); + distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); + } else { + throw new Error("Unknown block type in flate stream"); + } + buffer = this.buffer; + var limit = buffer ? buffer.length : 0; + var pos = this.bufferLength; + while (true) { + var code1 = this.getCode(litCodeTable); + if (code1 < 256) { + if (pos + 1 >= limit) { + buffer = this.ensureBuffer(pos + 1); + limit = buffer.length; + } + buffer[pos++] = code1; + continue; + } + if (code1 === 256) { + this.bufferLength = pos; + return; + } + code1 -= 257; + code1 = lengthDecode[code1]; + var code2 = code1 >> 16; + if (code2 > 0) { + code2 = this.getBits(code2); + } + len = (code1 & 65535) + code2; + code1 = this.getCode(distCodeTable); + code1 = distDecode[code1]; + code2 = code1 >> 16; + if (code2 > 0) { + code2 = this.getBits(code2); + } + var dist = (code1 & 65535) + code2; + if (pos + len >= limit) { + buffer = this.ensureBuffer(pos + len); + limit = buffer.length; + } + for (var k = 0; k < len; ++k, ++pos) { + buffer[pos] = buffer[pos - dist]; + } + } + }; + FlateStream2.prototype.getBits = function(bits) { + var str = this.stream; + var codeSize = this.codeSize; + var codeBuf = this.codeBuf; + var b; + while (codeSize < bits) { + if ((b = str.getByte()) === -1) { + throw new Error("Bad encoding in flate stream"); + } + codeBuf |= b << codeSize; + codeSize += 8; + } + b = codeBuf & (1 << bits) - 1; + this.codeBuf = codeBuf >> bits; + this.codeSize = codeSize -= bits; + return b; + }; + FlateStream2.prototype.getCode = function(table) { + var str = this.stream; + var codes = table[0]; + var maxLen = table[1]; + var codeSize = this.codeSize; + var codeBuf = this.codeBuf; + var b; + while (codeSize < maxLen) { + if ((b = str.getByte()) === -1) { + break; + } + codeBuf |= b << codeSize; + codeSize += 8; + } + var code = codes[codeBuf & (1 << maxLen) - 1]; + if (typeof codes === "number") { + console.log("FLATE:", code); + } + var codeLen = code >> 16; + var codeVal = code & 65535; + if (codeLen < 1 || codeSize < codeLen) { + throw new Error("Bad encoding in flate stream"); + } + this.codeBuf = codeBuf >> codeLen; + this.codeSize = codeSize - codeLen; + return codeVal; + }; + FlateStream2.prototype.generateHuffmanTable = function(lengths) { + var n = lengths.length; + var maxLen = 0; + var i; + for (i = 0; i < n; ++i) { + if (lengths[i] > maxLen) { + maxLen = lengths[i]; + } + } + var size = 1 << maxLen; + var codes = new Int32Array(size); + for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { + for (var val = 0; val < n; ++val) { + if (lengths[val] === len) { + var code2 = 0; + var t = code; + for (i = 0; i < len; ++i) { + code2 = code2 << 1 | t & 1; + t >>= 1; + } + for (i = code2; i < size; i += skip) { + codes[i] = len << 16 | val; + } + ++code; + } + } + } + return [codes, maxLen]; + }; + return FlateStream2; + }(DecodeStream_default) +); +var FlateStream_default = FlateStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/streams/LZWStream.js +var LZWStream = ( + /** @class */ + function(_super) { + __extends(LZWStream2, _super); + function LZWStream2(stream2, maybeLength, earlyChange) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream2; + _this.cachedData = 0; + _this.bitsCached = 0; + var maxLzwDictionarySize = 4096; + var lzwState = { + earlyChange, + codeLength: 9, + nextCode: 258, + dictionaryValues: new Uint8Array(maxLzwDictionarySize), + dictionaryLengths: new Uint16Array(maxLzwDictionarySize), + dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), + currentSequence: new Uint8Array(maxLzwDictionarySize), + currentSequenceLength: 0 + }; + for (var i = 0; i < 256; ++i) { + lzwState.dictionaryValues[i] = i; + lzwState.dictionaryLengths[i] = 1; + } + _this.lzwState = lzwState; + return _this; + } + LZWStream2.prototype.readBlock = function() { + var blockSize = 512; + var estimatedDecodedSize = blockSize * 2; + var decodedSizeDelta = blockSize; + var i; + var j; + var q; + var lzwState = this.lzwState; + if (!lzwState) { + return; + } + var earlyChange = lzwState.earlyChange; + var nextCode = lzwState.nextCode; + var dictionaryValues = lzwState.dictionaryValues; + var dictionaryLengths = lzwState.dictionaryLengths; + var dictionaryPrevCodes = lzwState.dictionaryPrevCodes; + var codeLength = lzwState.codeLength; + var prevCode = lzwState.prevCode; + var currentSequence = lzwState.currentSequence; + var currentSequenceLength = lzwState.currentSequenceLength; + var decodedLength = 0; + var currentBufferLength = this.bufferLength; + var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); + for (i = 0; i < blockSize; i++) { + var code = this.readBits(codeLength); + var hasPrev = currentSequenceLength > 0; + if (!code || code < 256) { + currentSequence[0] = code; + currentSequenceLength = 1; + } else if (code >= 258) { + if (code < nextCode) { + currentSequenceLength = dictionaryLengths[code]; + for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { + currentSequence[j] = dictionaryValues[q]; + q = dictionaryPrevCodes[q]; + } + } else { + currentSequence[currentSequenceLength++] = currentSequence[0]; + } + } else if (code === 256) { + codeLength = 9; + nextCode = 258; + currentSequenceLength = 0; + continue; + } else { + this.eof = true; + delete this.lzwState; + break; + } + if (hasPrev) { + dictionaryPrevCodes[nextCode] = prevCode; + dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; + dictionaryValues[nextCode] = currentSequence[0]; + nextCode++; + codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; + } + prevCode = code; + decodedLength += currentSequenceLength; + if (estimatedDecodedSize < decodedLength) { + do { + estimatedDecodedSize += decodedSizeDelta; + } while (estimatedDecodedSize < decodedLength); + buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); + } + for (j = 0; j < currentSequenceLength; j++) { + buffer[currentBufferLength++] = currentSequence[j]; + } + } + lzwState.nextCode = nextCode; + lzwState.codeLength = codeLength; + lzwState.prevCode = prevCode; + lzwState.currentSequenceLength = currentSequenceLength; + this.bufferLength = currentBufferLength; + }; + LZWStream2.prototype.readBits = function(n) { + var bitsCached = this.bitsCached; + var cachedData = this.cachedData; + while (bitsCached < n) { + var c = this.stream.getByte(); + if (c === -1) { + this.eof = true; + return null; + } + cachedData = cachedData << 8 | c; + bitsCached += 8; + } + this.bitsCached = bitsCached -= n; + this.cachedData = cachedData; + return cachedData >>> bitsCached & (1 << n) - 1; + }; + return LZWStream2; + }(DecodeStream_default) +); +var LZWStream_default = LZWStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/streams/RunLengthStream.js +var RunLengthStream = ( + /** @class */ + function(_super) { + __extends(RunLengthStream2, _super); + function RunLengthStream2(stream2, maybeLength) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream2; + return _this; + } + RunLengthStream2.prototype.readBlock = function() { + var repeatHeader = this.stream.getBytes(2); + if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { + this.eof = true; + return; + } + var buffer; + var bufferLength = this.bufferLength; + var n = repeatHeader[0]; + if (n < 128) { + buffer = this.ensureBuffer(bufferLength + n + 1); + buffer[bufferLength++] = repeatHeader[1]; + if (n > 0) { + var source2 = this.stream.getBytes(n); + buffer.set(source2, bufferLength); + bufferLength += n; + } + } else { + n = 257 - n; + var b = repeatHeader[1]; + buffer = this.ensureBuffer(bufferLength + n + 1); + for (var i = 0; i < n; i++) { + buffer[bufferLength++] = b; + } + } + this.bufferLength = bufferLength; + }; + return RunLengthStream2; + }(DecodeStream_default) +); +var RunLengthStream_default = RunLengthStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/streams/decode.js +var decodeStream = function(stream2, encoding, params) { + if (encoding === PDFName_default.of("FlateDecode")) { + return new FlateStream_default(stream2); + } + if (encoding === PDFName_default.of("LZWDecode")) { + var earlyChange = 1; + if (params instanceof PDFDict_default) { + var EarlyChange = params.lookup(PDFName_default.of("EarlyChange")); + if (EarlyChange instanceof PDFNumber_default) { + earlyChange = EarlyChange.asNumber(); + } + } + return new LZWStream_default(stream2, void 0, earlyChange); + } + if (encoding === PDFName_default.of("ASCII85Decode")) { + return new Ascii85Stream_default(stream2); + } + if (encoding === PDFName_default.of("ASCIIHexDecode")) { + return new AsciiHexStream_default(stream2); + } + if (encoding === PDFName_default.of("RunLengthDecode")) { + return new RunLengthStream_default(stream2); + } + throw new UnsupportedEncodingError(encoding.asString()); +}; +var decodePDFRawStream = function(_a3) { + var dict = _a3.dict, contents = _a3.contents; + var stream2 = new Stream_default(contents); + var Filter = dict.lookup(PDFName_default.of("Filter")); + var DecodeParms = dict.lookup(PDFName_default.of("DecodeParms")); + if (Filter instanceof PDFName_default) { + stream2 = decodeStream(stream2, Filter, DecodeParms); + } else if (Filter instanceof PDFArray_default) { + for (var idx = 0, len = Filter.size(); idx < len; idx++) { + stream2 = decodeStream(stream2, Filter.lookup(idx, PDFName_default), DecodeParms && DecodeParms.lookupMaybe(idx, PDFDict_default)); + } + } else if (!!Filter) { + throw new UnexpectedObjectTypeError([PDFName_default, PDFArray_default], Filter); + } + return stream2; +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/PDFPageEmbedder.js +var fullPageBoundingBox = function(page) { + var mediaBox = page.MediaBox(); + var width = mediaBox.lookup(2, PDFNumber_default).asNumber() - mediaBox.lookup(0, PDFNumber_default).asNumber(); + var height = mediaBox.lookup(3, PDFNumber_default).asNumber() - mediaBox.lookup(1, PDFNumber_default).asNumber(); + return { left: 0, bottom: 0, right: width, top: height }; +}; +var boundingBoxAdjustedMatrix = function(bb) { + return [1, 0, 0, 1, -bb.left, -bb.bottom]; +}; +var PDFPageEmbedder = ( + /** @class */ + function() { + function PDFPageEmbedder2(page, boundingBox, transformationMatrix) { + this.page = page; + var bb = boundingBox !== null && boundingBox !== void 0 ? boundingBox : fullPageBoundingBox(page); + this.width = bb.right - bb.left; + this.height = bb.top - bb.bottom; + this.boundingBox = bb; + this.transformationMatrix = transformationMatrix !== null && transformationMatrix !== void 0 ? transformationMatrix : boundingBoxAdjustedMatrix(bb); + } + PDFPageEmbedder2.for = function(page, boundingBox, transformationMatrix) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a3) { + return [2, new PDFPageEmbedder2(page, boundingBox, transformationMatrix)]; + }); + }); + }; + PDFPageEmbedder2.prototype.embedIntoContext = function(context, ref) { + return __awaiter(this, void 0, void 0, function() { + var _a3, Contents, Resources, decodedContents, _b3, left, bottom, right, top, xObject; + return __generator(this, function(_c2) { + _a3 = this.page.normalizedEntries(), Contents = _a3.Contents, Resources = _a3.Resources; + if (!Contents) + throw new MissingPageContentsEmbeddingError(); + decodedContents = this.decodeContents(Contents); + _b3 = this.boundingBox, left = _b3.left, bottom = _b3.bottom, right = _b3.right, top = _b3.top; + xObject = context.flateStream(decodedContents, { + Type: "XObject", + Subtype: "Form", + FormType: 1, + BBox: [left, bottom, right, top], + Matrix: this.transformationMatrix, + Resources + }); + if (ref) { + context.assign(ref, xObject); + return [2, ref]; + } else { + return [2, context.register(xObject)]; + } + return [ + 2 + /*return*/ + ]; + }); + }); + }; + PDFPageEmbedder2.prototype.decodeContents = function(contents) { + var newline = Uint8Array.of(CharCodes_default.Newline); + var decodedContents = []; + for (var idx = 0, len = contents.size(); idx < len; idx++) { + var stream2 = contents.lookup(idx, PDFStream_default); + var content = void 0; + if (stream2 instanceof PDFRawStream_default) { + content = decodePDFRawStream(stream2).decode(); + } else if (stream2 instanceof PDFContentStream_default) { + content = stream2.getUnencodedContents(); + } else { + throw new UnrecognizedStreamTypeError(stream2); + } + decodedContents.push(content, newline); + } + return mergeIntoTypedArray.apply(void 0, decodedContents); + }; + return PDFPageEmbedder2; + }() +); +var PDFPageEmbedder_default = PDFPageEmbedder; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/interactive/ViewerPreferences.js +var asEnum = function(rawValue, enumType) { + if (rawValue === void 0) + return void 0; + return enumType[rawValue]; +}; +var NonFullScreenPageMode; +(function(NonFullScreenPageMode2) { + NonFullScreenPageMode2["UseNone"] = "UseNone"; + NonFullScreenPageMode2["UseOutlines"] = "UseOutlines"; + NonFullScreenPageMode2["UseThumbs"] = "UseThumbs"; + NonFullScreenPageMode2["UseOC"] = "UseOC"; +})(NonFullScreenPageMode || (NonFullScreenPageMode = {})); +var ReadingDirection; +(function(ReadingDirection2) { + ReadingDirection2["L2R"] = "L2R"; + ReadingDirection2["R2L"] = "R2L"; +})(ReadingDirection || (ReadingDirection = {})); +var PrintScaling; +(function(PrintScaling2) { + PrintScaling2["None"] = "None"; + PrintScaling2["AppDefault"] = "AppDefault"; +})(PrintScaling || (PrintScaling = {})); +var Duplex; +(function(Duplex2) { + Duplex2["Simplex"] = "Simplex"; + Duplex2["DuplexFlipShortEdge"] = "DuplexFlipShortEdge"; + Duplex2["DuplexFlipLongEdge"] = "DuplexFlipLongEdge"; +})(Duplex || (Duplex = {})); +var ViewerPreferences = ( + /** @class */ + function() { + function ViewerPreferences2(dict) { + this.dict = dict; + } + ViewerPreferences2.prototype.lookupBool = function(key) { + var returnObj = this.dict.lookup(PDFName_default.of(key)); + if (returnObj instanceof PDFBool_default) + return returnObj; + return void 0; + }; + ViewerPreferences2.prototype.lookupName = function(key) { + var returnObj = this.dict.lookup(PDFName_default.of(key)); + if (returnObj instanceof PDFName_default) + return returnObj; + return void 0; + }; + ViewerPreferences2.prototype.HideToolbar = function() { + return this.lookupBool("HideToolbar"); + }; + ViewerPreferences2.prototype.HideMenubar = function() { + return this.lookupBool("HideMenubar"); + }; + ViewerPreferences2.prototype.HideWindowUI = function() { + return this.lookupBool("HideWindowUI"); + }; + ViewerPreferences2.prototype.FitWindow = function() { + return this.lookupBool("FitWindow"); + }; + ViewerPreferences2.prototype.CenterWindow = function() { + return this.lookupBool("CenterWindow"); + }; + ViewerPreferences2.prototype.DisplayDocTitle = function() { + return this.lookupBool("DisplayDocTitle"); + }; + ViewerPreferences2.prototype.NonFullScreenPageMode = function() { + return this.lookupName("NonFullScreenPageMode"); + }; + ViewerPreferences2.prototype.Direction = function() { + return this.lookupName("Direction"); + }; + ViewerPreferences2.prototype.PrintScaling = function() { + return this.lookupName("PrintScaling"); + }; + ViewerPreferences2.prototype.Duplex = function() { + return this.lookupName("Duplex"); + }; + ViewerPreferences2.prototype.PickTrayByPDFSize = function() { + return this.lookupBool("PickTrayByPDFSize"); + }; + ViewerPreferences2.prototype.PrintPageRange = function() { + var PrintPageRange = this.dict.lookup(PDFName_default.of("PrintPageRange")); + if (PrintPageRange instanceof PDFArray_default) + return PrintPageRange; + return void 0; + }; + ViewerPreferences2.prototype.NumCopies = function() { + var NumCopies = this.dict.lookup(PDFName_default.of("NumCopies")); + if (NumCopies instanceof PDFNumber_default) + return NumCopies; + return void 0; + }; + ViewerPreferences2.prototype.getHideToolbar = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.HideToolbar()) === null || _a3 === void 0 ? void 0 : _a3.asBoolean()) !== null && _b3 !== void 0 ? _b3 : false; + }; + ViewerPreferences2.prototype.getHideMenubar = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.HideMenubar()) === null || _a3 === void 0 ? void 0 : _a3.asBoolean()) !== null && _b3 !== void 0 ? _b3 : false; + }; + ViewerPreferences2.prototype.getHideWindowUI = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.HideWindowUI()) === null || _a3 === void 0 ? void 0 : _a3.asBoolean()) !== null && _b3 !== void 0 ? _b3 : false; + }; + ViewerPreferences2.prototype.getFitWindow = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.FitWindow()) === null || _a3 === void 0 ? void 0 : _a3.asBoolean()) !== null && _b3 !== void 0 ? _b3 : false; + }; + ViewerPreferences2.prototype.getCenterWindow = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.CenterWindow()) === null || _a3 === void 0 ? void 0 : _a3.asBoolean()) !== null && _b3 !== void 0 ? _b3 : false; + }; + ViewerPreferences2.prototype.getDisplayDocTitle = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.DisplayDocTitle()) === null || _a3 === void 0 ? void 0 : _a3.asBoolean()) !== null && _b3 !== void 0 ? _b3 : false; + }; + ViewerPreferences2.prototype.getNonFullScreenPageMode = function() { + var _a3, _b3; + var mode = (_a3 = this.NonFullScreenPageMode()) === null || _a3 === void 0 ? void 0 : _a3.decodeText(); + return (_b3 = asEnum(mode, NonFullScreenPageMode)) !== null && _b3 !== void 0 ? _b3 : NonFullScreenPageMode.UseNone; + }; + ViewerPreferences2.prototype.getReadingDirection = function() { + var _a3, _b3; + var direction = (_a3 = this.Direction()) === null || _a3 === void 0 ? void 0 : _a3.decodeText(); + return (_b3 = asEnum(direction, ReadingDirection)) !== null && _b3 !== void 0 ? _b3 : ReadingDirection.L2R; + }; + ViewerPreferences2.prototype.getPrintScaling = function() { + var _a3, _b3; + var scaling = (_a3 = this.PrintScaling()) === null || _a3 === void 0 ? void 0 : _a3.decodeText(); + return (_b3 = asEnum(scaling, PrintScaling)) !== null && _b3 !== void 0 ? _b3 : PrintScaling.AppDefault; + }; + ViewerPreferences2.prototype.getDuplex = function() { + var _a3; + var duplex = (_a3 = this.Duplex()) === null || _a3 === void 0 ? void 0 : _a3.decodeText(); + return asEnum(duplex, Duplex); + }; + ViewerPreferences2.prototype.getPickTrayByPDFSize = function() { + var _a3; + return (_a3 = this.PickTrayByPDFSize()) === null || _a3 === void 0 ? void 0 : _a3.asBoolean(); + }; + ViewerPreferences2.prototype.getPrintPageRange = function() { + var rng = this.PrintPageRange(); + if (!rng) + return []; + var pageRanges = []; + for (var i = 0; i < rng.size(); i += 2) { + var start = rng.lookup(i, PDFNumber_default).asNumber(); + var end = rng.lookup(i + 1, PDFNumber_default).asNumber(); + pageRanges.push({ start, end }); + } + return pageRanges; + }; + ViewerPreferences2.prototype.getNumCopies = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.NumCopies()) === null || _a3 === void 0 ? void 0 : _a3.asNumber()) !== null && _b3 !== void 0 ? _b3 : 1; + }; + ViewerPreferences2.prototype.setHideToolbar = function(hideToolbar) { + var HideToolbar = this.dict.context.obj(hideToolbar); + this.dict.set(PDFName_default.of("HideToolbar"), HideToolbar); + }; + ViewerPreferences2.prototype.setHideMenubar = function(hideMenubar) { + var HideMenubar = this.dict.context.obj(hideMenubar); + this.dict.set(PDFName_default.of("HideMenubar"), HideMenubar); + }; + ViewerPreferences2.prototype.setHideWindowUI = function(hideWindowUI) { + var HideWindowUI = this.dict.context.obj(hideWindowUI); + this.dict.set(PDFName_default.of("HideWindowUI"), HideWindowUI); + }; + ViewerPreferences2.prototype.setFitWindow = function(fitWindow) { + var FitWindow = this.dict.context.obj(fitWindow); + this.dict.set(PDFName_default.of("FitWindow"), FitWindow); + }; + ViewerPreferences2.prototype.setCenterWindow = function(centerWindow) { + var CenterWindow = this.dict.context.obj(centerWindow); + this.dict.set(PDFName_default.of("CenterWindow"), CenterWindow); + }; + ViewerPreferences2.prototype.setDisplayDocTitle = function(displayTitle) { + var DisplayDocTitle = this.dict.context.obj(displayTitle); + this.dict.set(PDFName_default.of("DisplayDocTitle"), DisplayDocTitle); + }; + ViewerPreferences2.prototype.setNonFullScreenPageMode = function(nonFullScreenPageMode) { + assertIsOneOf(nonFullScreenPageMode, "nonFullScreenPageMode", NonFullScreenPageMode); + var mode = PDFName_default.of(nonFullScreenPageMode); + this.dict.set(PDFName_default.of("NonFullScreenPageMode"), mode); + }; + ViewerPreferences2.prototype.setReadingDirection = function(readingDirection) { + assertIsOneOf(readingDirection, "readingDirection", ReadingDirection); + var direction = PDFName_default.of(readingDirection); + this.dict.set(PDFName_default.of("Direction"), direction); + }; + ViewerPreferences2.prototype.setPrintScaling = function(printScaling) { + assertIsOneOf(printScaling, "printScaling", PrintScaling); + var scaling = PDFName_default.of(printScaling); + this.dict.set(PDFName_default.of("PrintScaling"), scaling); + }; + ViewerPreferences2.prototype.setDuplex = function(duplex) { + assertIsOneOf(duplex, "duplex", Duplex); + var dup = PDFName_default.of(duplex); + this.dict.set(PDFName_default.of("Duplex"), dup); + }; + ViewerPreferences2.prototype.setPickTrayByPDFSize = function(pickTrayByPDFSize) { + var PickTrayByPDFSize = this.dict.context.obj(pickTrayByPDFSize); + this.dict.set(PDFName_default.of("PickTrayByPDFSize"), PickTrayByPDFSize); + }; + ViewerPreferences2.prototype.setPrintPageRange = function(printPageRange) { + if (!Array.isArray(printPageRange)) + printPageRange = [printPageRange]; + var flatRange = []; + for (var idx = 0, len = printPageRange.length; idx < len; idx++) { + flatRange.push(printPageRange[idx].start); + flatRange.push(printPageRange[idx].end); + } + assertEachIs(flatRange, "printPageRange", ["number"]); + var pageRanges = this.dict.context.obj(flatRange); + this.dict.set(PDFName_default.of("PrintPageRange"), pageRanges); + }; + ViewerPreferences2.prototype.setNumCopies = function(numCopies) { + assertRange(numCopies, "numCopies", 1, Number.MAX_VALUE); + assertInteger(numCopies, "numCopies"); + var NumCopies = this.dict.context.obj(numCopies); + this.dict.set(PDFName_default.of("NumCopies"), NumCopies); + }; + ViewerPreferences2.fromDict = function(dict) { + return new ViewerPreferences2(dict); + }; + ViewerPreferences2.create = function(context) { + var dict = context.obj({}); + return new ViewerPreferences2(dict); + }; + return ViewerPreferences2; + }() +); +var ViewerPreferences_default = ViewerPreferences; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroField.js +var tfRegex = /\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/; +var PDFAcroField = ( + /** @class */ + function() { + function PDFAcroField2(dict, ref) { + this.dict = dict; + this.ref = ref; + } + PDFAcroField2.prototype.T = function() { + return this.dict.lookupMaybe(PDFName_default.of("T"), PDFString_default, PDFHexString_default); + }; + PDFAcroField2.prototype.Ff = function() { + var numberOrRef = this.getInheritableAttribute(PDFName_default.of("Ff")); + return this.dict.context.lookupMaybe(numberOrRef, PDFNumber_default); + }; + PDFAcroField2.prototype.V = function() { + var valueOrRef = this.getInheritableAttribute(PDFName_default.of("V")); + return this.dict.context.lookup(valueOrRef); + }; + PDFAcroField2.prototype.Kids = function() { + return this.dict.lookupMaybe(PDFName_default.of("Kids"), PDFArray_default); + }; + PDFAcroField2.prototype.DA = function() { + var da = this.dict.lookup(PDFName_default.of("DA")); + if (da instanceof PDFString_default || da instanceof PDFHexString_default) + return da; + return void 0; + }; + PDFAcroField2.prototype.setKids = function(kids) { + this.dict.set(PDFName_default.of("Kids"), this.dict.context.obj(kids)); + }; + PDFAcroField2.prototype.getParent = function() { + var parentRef = this.dict.get(PDFName_default.of("Parent")); + if (parentRef instanceof PDFRef_default) { + var parent_1 = this.dict.lookup(PDFName_default.of("Parent"), PDFDict_default); + return new PDFAcroField2(parent_1, parentRef); + } + return void 0; + }; + PDFAcroField2.prototype.setParent = function(parent) { + if (!parent) + this.dict.delete(PDFName_default.of("Parent")); + else + this.dict.set(PDFName_default.of("Parent"), parent); + }; + PDFAcroField2.prototype.getFullyQualifiedName = function() { + var parent = this.getParent(); + if (!parent) + return this.getPartialName(); + return parent.getFullyQualifiedName() + "." + this.getPartialName(); + }; + PDFAcroField2.prototype.getPartialName = function() { + var _a3; + return (_a3 = this.T()) === null || _a3 === void 0 ? void 0 : _a3.decodeText(); + }; + PDFAcroField2.prototype.setPartialName = function(partialName) { + if (!partialName) + this.dict.delete(PDFName_default.of("T")); + else + this.dict.set(PDFName_default.of("T"), PDFHexString_default.fromText(partialName)); + }; + PDFAcroField2.prototype.setDefaultAppearance = function(appearance) { + this.dict.set(PDFName_default.of("DA"), PDFString_default.of(appearance)); + }; + PDFAcroField2.prototype.getDefaultAppearance = function() { + var DA = this.DA(); + if (DA instanceof PDFHexString_default) { + return DA.decodeText(); + } + return DA === null || DA === void 0 ? void 0 : DA.asString(); + }; + PDFAcroField2.prototype.setFontSize = function(fontSize) { + var _a3; + var name = (_a3 = this.getFullyQualifiedName()) !== null && _a3 !== void 0 ? _a3 : ""; + var da = this.getDefaultAppearance(); + if (!da) + throw new MissingDAEntryError(name); + var daMatch = findLastMatch(da, tfRegex); + if (!daMatch.match) + throw new MissingTfOperatorError(name); + var daStart = da.slice(0, daMatch.pos - daMatch.match[0].length); + var daEnd = daMatch.pos <= da.length ? da.slice(daMatch.pos) : ""; + var fontName = daMatch.match[1]; + var modifiedDa = daStart + " /" + fontName + " " + fontSize + " Tf " + daEnd; + this.setDefaultAppearance(modifiedDa); + }; + PDFAcroField2.prototype.getFlags = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.Ff()) === null || _a3 === void 0 ? void 0 : _a3.asNumber()) !== null && _b3 !== void 0 ? _b3 : 0; + }; + PDFAcroField2.prototype.setFlags = function(flags) { + this.dict.set(PDFName_default.of("Ff"), PDFNumber_default.of(flags)); + }; + PDFAcroField2.prototype.hasFlag = function(flag3) { + var flags = this.getFlags(); + return (flags & flag3) !== 0; + }; + PDFAcroField2.prototype.setFlag = function(flag3) { + var flags = this.getFlags(); + this.setFlags(flags | flag3); + }; + PDFAcroField2.prototype.clearFlag = function(flag3) { + var flags = this.getFlags(); + this.setFlags(flags & ~flag3); + }; + PDFAcroField2.prototype.setFlagTo = function(flag3, enable) { + if (enable) + this.setFlag(flag3); + else + this.clearFlag(flag3); + }; + PDFAcroField2.prototype.getInheritableAttribute = function(name) { + var attribute; + this.ascend(function(node) { + if (!attribute) + attribute = node.dict.get(name); + }); + return attribute; + }; + PDFAcroField2.prototype.ascend = function(visitor) { + visitor(this); + var parent = this.getParent(); + if (parent) + parent.ascend(visitor); + }; + return PDFAcroField2; + }() +); +var PDFAcroField_default = PDFAcroField; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/annotation/BorderStyle.js +var BorderStyle = ( + /** @class */ + function() { + function BorderStyle2(dict) { + this.dict = dict; + } + BorderStyle2.prototype.W = function() { + var W = this.dict.lookup(PDFName_default.of("W")); + if (W instanceof PDFNumber_default) + return W; + return void 0; + }; + BorderStyle2.prototype.getWidth = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.W()) === null || _a3 === void 0 ? void 0 : _a3.asNumber()) !== null && _b3 !== void 0 ? _b3 : 1; + }; + BorderStyle2.prototype.setWidth = function(width) { + var W = this.dict.context.obj(width); + this.dict.set(PDFName_default.of("W"), W); + }; + BorderStyle2.fromDict = function(dict) { + return new BorderStyle2(dict); + }; + return BorderStyle2; + }() +); +var BorderStyle_default = BorderStyle; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/annotation/PDFAnnotation.js +var PDFAnnotation = ( + /** @class */ + function() { + function PDFAnnotation2(dict) { + this.dict = dict; + } + PDFAnnotation2.prototype.Rect = function() { + return this.dict.lookup(PDFName_default.of("Rect"), PDFArray_default); + }; + PDFAnnotation2.prototype.AP = function() { + return this.dict.lookupMaybe(PDFName_default.of("AP"), PDFDict_default); + }; + PDFAnnotation2.prototype.F = function() { + var numberOrRef = this.dict.lookup(PDFName_default.of("F")); + return this.dict.context.lookupMaybe(numberOrRef, PDFNumber_default); + }; + PDFAnnotation2.prototype.getRectangle = function() { + var _a3; + var Rect = this.Rect(); + return (_a3 = Rect === null || Rect === void 0 ? void 0 : Rect.asRectangle()) !== null && _a3 !== void 0 ? _a3 : { x: 0, y: 0, width: 0, height: 0 }; + }; + PDFAnnotation2.prototype.setRectangle = function(rect) { + var x = rect.x, y = rect.y, width = rect.width, height = rect.height; + var Rect = this.dict.context.obj([x, y, x + width, y + height]); + this.dict.set(PDFName_default.of("Rect"), Rect); + }; + PDFAnnotation2.prototype.getAppearanceState = function() { + var AS = this.dict.lookup(PDFName_default.of("AS")); + if (AS instanceof PDFName_default) + return AS; + return void 0; + }; + PDFAnnotation2.prototype.setAppearanceState = function(state2) { + this.dict.set(PDFName_default.of("AS"), state2); + }; + PDFAnnotation2.prototype.setAppearances = function(appearances) { + this.dict.set(PDFName_default.of("AP"), appearances); + }; + PDFAnnotation2.prototype.ensureAP = function() { + var AP = this.AP(); + if (!AP) { + AP = this.dict.context.obj({}); + this.dict.set(PDFName_default.of("AP"), AP); + } + return AP; + }; + PDFAnnotation2.prototype.getNormalAppearance = function() { + var AP = this.ensureAP(); + var N = AP.get(PDFName_default.of("N")); + if (N instanceof PDFRef_default || N instanceof PDFDict_default) + return N; + throw new Error("Unexpected N type: " + (N === null || N === void 0 ? void 0 : N.constructor.name)); + }; + PDFAnnotation2.prototype.setNormalAppearance = function(appearance) { + var AP = this.ensureAP(); + AP.set(PDFName_default.of("N"), appearance); + }; + PDFAnnotation2.prototype.setRolloverAppearance = function(appearance) { + var AP = this.ensureAP(); + AP.set(PDFName_default.of("R"), appearance); + }; + PDFAnnotation2.prototype.setDownAppearance = function(appearance) { + var AP = this.ensureAP(); + AP.set(PDFName_default.of("D"), appearance); + }; + PDFAnnotation2.prototype.removeRolloverAppearance = function() { + var AP = this.AP(); + AP === null || AP === void 0 ? void 0 : AP.delete(PDFName_default.of("R")); + }; + PDFAnnotation2.prototype.removeDownAppearance = function() { + var AP = this.AP(); + AP === null || AP === void 0 ? void 0 : AP.delete(PDFName_default.of("D")); + }; + PDFAnnotation2.prototype.getAppearances = function() { + var AP = this.AP(); + if (!AP) + return void 0; + var N = AP.lookup(PDFName_default.of("N"), PDFDict_default, PDFStream_default); + var R = AP.lookupMaybe(PDFName_default.of("R"), PDFDict_default, PDFStream_default); + var D = AP.lookupMaybe(PDFName_default.of("D"), PDFDict_default, PDFStream_default); + return { normal: N, rollover: R, down: D }; + }; + PDFAnnotation2.prototype.getFlags = function() { + var _a3, _b3; + return (_b3 = (_a3 = this.F()) === null || _a3 === void 0 ? void 0 : _a3.asNumber()) !== null && _b3 !== void 0 ? _b3 : 0; + }; + PDFAnnotation2.prototype.setFlags = function(flags) { + this.dict.set(PDFName_default.of("F"), PDFNumber_default.of(flags)); + }; + PDFAnnotation2.prototype.hasFlag = function(flag3) { + var flags = this.getFlags(); + return (flags & flag3) !== 0; + }; + PDFAnnotation2.prototype.setFlag = function(flag3) { + var flags = this.getFlags(); + this.setFlags(flags | flag3); + }; + PDFAnnotation2.prototype.clearFlag = function(flag3) { + var flags = this.getFlags(); + this.setFlags(flags & ~flag3); + }; + PDFAnnotation2.prototype.setFlagTo = function(flag3, enable) { + if (enable) + this.setFlag(flag3); + else + this.clearFlag(flag3); + }; + PDFAnnotation2.fromDict = function(dict) { + return new PDFAnnotation2(dict); + }; + return PDFAnnotation2; + }() +); +var PDFAnnotation_default = PDFAnnotation; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/annotation/AppearanceCharacteristics.js +var AppearanceCharacteristics = ( + /** @class */ + function() { + function AppearanceCharacteristics2(dict) { + this.dict = dict; + } + AppearanceCharacteristics2.prototype.R = function() { + var R = this.dict.lookup(PDFName_default.of("R")); + if (R instanceof PDFNumber_default) + return R; + return void 0; + }; + AppearanceCharacteristics2.prototype.BC = function() { + var BC = this.dict.lookup(PDFName_default.of("BC")); + if (BC instanceof PDFArray_default) + return BC; + return void 0; + }; + AppearanceCharacteristics2.prototype.BG = function() { + var BG = this.dict.lookup(PDFName_default.of("BG")); + if (BG instanceof PDFArray_default) + return BG; + return void 0; + }; + AppearanceCharacteristics2.prototype.CA = function() { + var CA = this.dict.lookup(PDFName_default.of("CA")); + if (CA instanceof PDFHexString_default || CA instanceof PDFString_default) + return CA; + return void 0; + }; + AppearanceCharacteristics2.prototype.RC = function() { + var RC = this.dict.lookup(PDFName_default.of("RC")); + if (RC instanceof PDFHexString_default || RC instanceof PDFString_default) + return RC; + return void 0; + }; + AppearanceCharacteristics2.prototype.AC = function() { + var AC = this.dict.lookup(PDFName_default.of("AC")); + if (AC instanceof PDFHexString_default || AC instanceof PDFString_default) + return AC; + return void 0; + }; + AppearanceCharacteristics2.prototype.getRotation = function() { + var _a3; + return (_a3 = this.R()) === null || _a3 === void 0 ? void 0 : _a3.asNumber(); + }; + AppearanceCharacteristics2.prototype.getBorderColor = function() { + var BC = this.BC(); + if (!BC) + return void 0; + var components = []; + for (var idx = 0, len = BC === null || BC === void 0 ? void 0 : BC.size(); idx < len; idx++) { + var component2 = BC.get(idx); + if (component2 instanceof PDFNumber_default) + components.push(component2.asNumber()); + } + return components; + }; + AppearanceCharacteristics2.prototype.getBackgroundColor = function() { + var BG = this.BG(); + if (!BG) + return void 0; + var components = []; + for (var idx = 0, len = BG === null || BG === void 0 ? void 0 : BG.size(); idx < len; idx++) { + var component2 = BG.get(idx); + if (component2 instanceof PDFNumber_default) + components.push(component2.asNumber()); + } + return components; + }; + AppearanceCharacteristics2.prototype.getCaptions = function() { + var CA = this.CA(); + var RC = this.RC(); + var AC = this.AC(); + return { + normal: CA === null || CA === void 0 ? void 0 : CA.decodeText(), + rollover: RC === null || RC === void 0 ? void 0 : RC.decodeText(), + down: AC === null || AC === void 0 ? void 0 : AC.decodeText() + }; + }; + AppearanceCharacteristics2.prototype.setRotation = function(rotation) { + var R = this.dict.context.obj(rotation); + this.dict.set(PDFName_default.of("R"), R); + }; + AppearanceCharacteristics2.prototype.setBorderColor = function(color) { + var BC = this.dict.context.obj(color); + this.dict.set(PDFName_default.of("BC"), BC); + }; + AppearanceCharacteristics2.prototype.setBackgroundColor = function(color) { + var BG = this.dict.context.obj(color); + this.dict.set(PDFName_default.of("BG"), BG); + }; + AppearanceCharacteristics2.prototype.setCaptions = function(captions) { + var CA = PDFHexString_default.fromText(captions.normal); + this.dict.set(PDFName_default.of("CA"), CA); + if (captions.rollover) { + var RC = PDFHexString_default.fromText(captions.rollover); + this.dict.set(PDFName_default.of("RC"), RC); + } else { + this.dict.delete(PDFName_default.of("RC")); + } + if (captions.down) { + var AC = PDFHexString_default.fromText(captions.down); + this.dict.set(PDFName_default.of("AC"), AC); + } else { + this.dict.delete(PDFName_default.of("AC")); + } + }; + AppearanceCharacteristics2.fromDict = function(dict) { + return new AppearanceCharacteristics2(dict); + }; + return AppearanceCharacteristics2; + }() +); +var AppearanceCharacteristics_default = AppearanceCharacteristics; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/annotation/PDFWidgetAnnotation.js +var PDFWidgetAnnotation = ( + /** @class */ + function(_super) { + __extends(PDFWidgetAnnotation2, _super); + function PDFWidgetAnnotation2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFWidgetAnnotation2.prototype.MK = function() { + var MK = this.dict.lookup(PDFName_default.of("MK")); + if (MK instanceof PDFDict_default) + return MK; + return void 0; + }; + PDFWidgetAnnotation2.prototype.BS = function() { + var BS = this.dict.lookup(PDFName_default.of("BS")); + if (BS instanceof PDFDict_default) + return BS; + return void 0; + }; + PDFWidgetAnnotation2.prototype.DA = function() { + var da = this.dict.lookup(PDFName_default.of("DA")); + if (da instanceof PDFString_default || da instanceof PDFHexString_default) + return da; + return void 0; + }; + PDFWidgetAnnotation2.prototype.P = function() { + var P = this.dict.get(PDFName_default.of("P")); + if (P instanceof PDFRef_default) + return P; + return void 0; + }; + PDFWidgetAnnotation2.prototype.setP = function(page) { + this.dict.set(PDFName_default.of("P"), page); + }; + PDFWidgetAnnotation2.prototype.setDefaultAppearance = function(appearance) { + this.dict.set(PDFName_default.of("DA"), PDFString_default.of(appearance)); + }; + PDFWidgetAnnotation2.prototype.getDefaultAppearance = function() { + var DA = this.DA(); + if (DA instanceof PDFHexString_default) { + return DA.decodeText(); + } + return DA === null || DA === void 0 ? void 0 : DA.asString(); + }; + PDFWidgetAnnotation2.prototype.getAppearanceCharacteristics = function() { + var MK = this.MK(); + if (MK) + return AppearanceCharacteristics_default.fromDict(MK); + return void 0; + }; + PDFWidgetAnnotation2.prototype.getOrCreateAppearanceCharacteristics = function() { + var MK = this.MK(); + if (MK) + return AppearanceCharacteristics_default.fromDict(MK); + var ac = AppearanceCharacteristics_default.fromDict(this.dict.context.obj({})); + this.dict.set(PDFName_default.of("MK"), ac.dict); + return ac; + }; + PDFWidgetAnnotation2.prototype.getBorderStyle = function() { + var BS = this.BS(); + if (BS) + return BorderStyle_default.fromDict(BS); + return void 0; + }; + PDFWidgetAnnotation2.prototype.getOrCreateBorderStyle = function() { + var BS = this.BS(); + if (BS) + return BorderStyle_default.fromDict(BS); + var bs = BorderStyle_default.fromDict(this.dict.context.obj({})); + this.dict.set(PDFName_default.of("BS"), bs.dict); + return bs; + }; + PDFWidgetAnnotation2.prototype.getOnValue = function() { + var _a3; + var normal2 = (_a3 = this.getAppearances()) === null || _a3 === void 0 ? void 0 : _a3.normal; + if (normal2 instanceof PDFDict_default) { + var keys = normal2.keys(); + for (var idx = 0, len = keys.length; idx < len; idx++) { + var key = keys[idx]; + if (key !== PDFName_default.of("Off")) + return key; + } + } + return void 0; + }; + PDFWidgetAnnotation2.fromDict = function(dict) { + return new PDFWidgetAnnotation2(dict); + }; + PDFWidgetAnnotation2.create = function(context, parent) { + var dict = context.obj({ + Type: "Annot", + Subtype: "Widget", + Rect: [0, 0, 0, 0], + Parent: parent + }); + return new PDFWidgetAnnotation2(dict); + }; + return PDFWidgetAnnotation2; + }(PDFAnnotation_default) +); +var PDFWidgetAnnotation_default = PDFWidgetAnnotation; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroTerminal.js +var PDFAcroTerminal = ( + /** @class */ + function(_super) { + __extends(PDFAcroTerminal2, _super); + function PDFAcroTerminal2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroTerminal2.prototype.FT = function() { + var nameOrRef = this.getInheritableAttribute(PDFName_default.of("FT")); + return this.dict.context.lookup(nameOrRef, PDFName_default); + }; + PDFAcroTerminal2.prototype.getWidgets = function() { + var kidDicts = this.Kids(); + if (!kidDicts) + return [PDFWidgetAnnotation_default.fromDict(this.dict)]; + var widgets = new Array(kidDicts.size()); + for (var idx = 0, len = kidDicts.size(); idx < len; idx++) { + var dict = kidDicts.lookup(idx, PDFDict_default); + widgets[idx] = PDFWidgetAnnotation_default.fromDict(dict); + } + return widgets; + }; + PDFAcroTerminal2.prototype.addWidget = function(ref) { + var Kids = this.normalizedEntries().Kids; + Kids.push(ref); + }; + PDFAcroTerminal2.prototype.removeWidget = function(idx) { + var kidDicts = this.Kids(); + if (!kidDicts) { + if (idx !== 0) + throw new IndexOutOfBoundsError(idx, 0, 0); + this.setKids([]); + } else { + if (idx < 0 || idx > kidDicts.size()) { + throw new IndexOutOfBoundsError(idx, 0, kidDicts.size()); + } + kidDicts.remove(idx); + } + }; + PDFAcroTerminal2.prototype.normalizedEntries = function() { + var Kids = this.Kids(); + if (!Kids) { + Kids = this.dict.context.obj([this.ref]); + this.dict.set(PDFName_default.of("Kids"), Kids); + } + return { Kids }; + }; + PDFAcroTerminal2.fromDict = function(dict, ref) { + return new PDFAcroTerminal2(dict, ref); + }; + return PDFAcroTerminal2; + }(PDFAcroField_default) +); +var PDFAcroTerminal_default = PDFAcroTerminal; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroButton.js +var PDFAcroButton = ( + /** @class */ + function(_super) { + __extends(PDFAcroButton2, _super); + function PDFAcroButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroButton2.prototype.Opt = function() { + return this.dict.lookupMaybe(PDFName_default.of("Opt"), PDFString_default, PDFHexString_default, PDFArray_default); + }; + PDFAcroButton2.prototype.setOpt = function(opt) { + this.dict.set(PDFName_default.of("Opt"), this.dict.context.obj(opt)); + }; + PDFAcroButton2.prototype.getExportValues = function() { + var opt = this.Opt(); + if (!opt) + return void 0; + if (opt instanceof PDFString_default || opt instanceof PDFHexString_default) { + return [opt]; + } + var values2 = []; + for (var idx = 0, len = opt.size(); idx < len; idx++) { + var value = opt.lookup(idx); + if (value instanceof PDFString_default || value instanceof PDFHexString_default) { + values2.push(value); + } + } + return values2; + }; + PDFAcroButton2.prototype.removeExportValue = function(idx) { + var opt = this.Opt(); + if (!opt) + return; + if (opt instanceof PDFString_default || opt instanceof PDFHexString_default) { + if (idx !== 0) + throw new IndexOutOfBoundsError(idx, 0, 0); + this.setOpt([]); + } else { + if (idx < 0 || idx > opt.size()) { + throw new IndexOutOfBoundsError(idx, 0, opt.size()); + } + opt.remove(idx); + } + }; + PDFAcroButton2.prototype.normalizeExportValues = function() { + var _a3, _b3, _c2, _d; + var exportValues = (_a3 = this.getExportValues()) !== null && _a3 !== void 0 ? _a3 : []; + var Opt = []; + var widgets = this.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var exportVal = (_b3 = exportValues[idx]) !== null && _b3 !== void 0 ? _b3 : PDFHexString_default.fromText((_d = (_c2 = widget.getOnValue()) === null || _c2 === void 0 ? void 0 : _c2.decodeText()) !== null && _d !== void 0 ? _d : ""); + Opt.push(exportVal); + } + this.setOpt(Opt); + }; + PDFAcroButton2.prototype.addOpt = function(opt, useExistingOptIdx) { + var _a3; + this.normalizeExportValues(); + var optText = opt.decodeText(); + var existingIdx; + if (useExistingOptIdx) { + var exportValues = (_a3 = this.getExportValues()) !== null && _a3 !== void 0 ? _a3 : []; + for (var idx = 0, len = exportValues.length; idx < len; idx++) { + var exportVal = exportValues[idx]; + if (exportVal.decodeText() === optText) + existingIdx = idx; + } + } + var Opt = this.Opt(); + Opt.push(opt); + return existingIdx !== null && existingIdx !== void 0 ? existingIdx : Opt.size() - 1; + }; + PDFAcroButton2.prototype.addWidgetWithOpt = function(widget, opt, useExistingOptIdx) { + var optIdx = this.addOpt(opt, useExistingOptIdx); + var apStateValue = PDFName_default.of(String(optIdx)); + this.addWidget(widget); + return apStateValue; + }; + return PDFAcroButton2; + }(PDFAcroTerminal_default) +); +var PDFAcroButton_default = PDFAcroButton; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroCheckBox.js +var PDFAcroCheckBox = ( + /** @class */ + function(_super) { + __extends(PDFAcroCheckBox2, _super); + function PDFAcroCheckBox2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroCheckBox2.prototype.setValue = function(value) { + var _a3; + var onValue = (_a3 = this.getOnValue()) !== null && _a3 !== void 0 ? _a3 : PDFName_default.of("Yes"); + if (value !== onValue && value !== PDFName_default.of("Off")) { + throw new InvalidAcroFieldValueError(); + } + this.dict.set(PDFName_default.of("V"), value); + var widgets = this.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var state2 = widget.getOnValue() === value ? value : PDFName_default.of("Off"); + widget.setAppearanceState(state2); + } + }; + PDFAcroCheckBox2.prototype.getValue = function() { + var v = this.V(); + if (v instanceof PDFName_default) + return v; + return PDFName_default.of("Off"); + }; + PDFAcroCheckBox2.prototype.getOnValue = function() { + var widget = this.getWidgets()[0]; + return widget === null || widget === void 0 ? void 0 : widget.getOnValue(); + }; + PDFAcroCheckBox2.fromDict = function(dict, ref) { + return new PDFAcroCheckBox2(dict, ref); + }; + PDFAcroCheckBox2.create = function(context) { + var dict = context.obj({ + FT: "Btn", + Kids: [] + }); + var ref = context.register(dict); + return new PDFAcroCheckBox2(dict, ref); + }; + return PDFAcroCheckBox2; + }(PDFAcroButton_default) +); +var PDFAcroCheckBox_default = PDFAcroCheckBox; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/flags.js +var flag = function(bitIndex) { + return 1 << bitIndex; +}; +var AcroFieldFlags; +(function(AcroFieldFlags2) { + AcroFieldFlags2[AcroFieldFlags2["ReadOnly"] = flag(1 - 1)] = "ReadOnly"; + AcroFieldFlags2[AcroFieldFlags2["Required"] = flag(2 - 1)] = "Required"; + AcroFieldFlags2[AcroFieldFlags2["NoExport"] = flag(3 - 1)] = "NoExport"; +})(AcroFieldFlags || (AcroFieldFlags = {})); +var AcroButtonFlags; +(function(AcroButtonFlags2) { + AcroButtonFlags2[AcroButtonFlags2["NoToggleToOff"] = flag(15 - 1)] = "NoToggleToOff"; + AcroButtonFlags2[AcroButtonFlags2["Radio"] = flag(16 - 1)] = "Radio"; + AcroButtonFlags2[AcroButtonFlags2["PushButton"] = flag(17 - 1)] = "PushButton"; + AcroButtonFlags2[AcroButtonFlags2["RadiosInUnison"] = flag(26 - 1)] = "RadiosInUnison"; +})(AcroButtonFlags || (AcroButtonFlags = {})); +var AcroTextFlags; +(function(AcroTextFlags2) { + AcroTextFlags2[AcroTextFlags2["Multiline"] = flag(13 - 1)] = "Multiline"; + AcroTextFlags2[AcroTextFlags2["Password"] = flag(14 - 1)] = "Password"; + AcroTextFlags2[AcroTextFlags2["FileSelect"] = flag(21 - 1)] = "FileSelect"; + AcroTextFlags2[AcroTextFlags2["DoNotSpellCheck"] = flag(23 - 1)] = "DoNotSpellCheck"; + AcroTextFlags2[AcroTextFlags2["DoNotScroll"] = flag(24 - 1)] = "DoNotScroll"; + AcroTextFlags2[AcroTextFlags2["Comb"] = flag(25 - 1)] = "Comb"; + AcroTextFlags2[AcroTextFlags2["RichText"] = flag(26 - 1)] = "RichText"; +})(AcroTextFlags || (AcroTextFlags = {})); +var AcroChoiceFlags; +(function(AcroChoiceFlags2) { + AcroChoiceFlags2[AcroChoiceFlags2["Combo"] = flag(18 - 1)] = "Combo"; + AcroChoiceFlags2[AcroChoiceFlags2["Edit"] = flag(19 - 1)] = "Edit"; + AcroChoiceFlags2[AcroChoiceFlags2["Sort"] = flag(20 - 1)] = "Sort"; + AcroChoiceFlags2[AcroChoiceFlags2["MultiSelect"] = flag(22 - 1)] = "MultiSelect"; + AcroChoiceFlags2[AcroChoiceFlags2["DoNotSpellCheck"] = flag(23 - 1)] = "DoNotSpellCheck"; + AcroChoiceFlags2[AcroChoiceFlags2["CommitOnSelChange"] = flag(27 - 1)] = "CommitOnSelChange"; +})(AcroChoiceFlags || (AcroChoiceFlags = {})); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroChoice.js +var PDFAcroChoice = ( + /** @class */ + function(_super) { + __extends(PDFAcroChoice2, _super); + function PDFAcroChoice2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroChoice2.prototype.setValues = function(values2) { + if (this.hasFlag(AcroChoiceFlags.Combo) && !this.hasFlag(AcroChoiceFlags.Edit) && !this.valuesAreValid(values2)) { + throw new InvalidAcroFieldValueError(); + } + if (values2.length === 0) { + this.dict.delete(PDFName_default.of("V")); + } + if (values2.length === 1) { + this.dict.set(PDFName_default.of("V"), values2[0]); + } + if (values2.length > 1) { + if (!this.hasFlag(AcroChoiceFlags.MultiSelect)) { + throw new MultiSelectValueError(); + } + this.dict.set(PDFName_default.of("V"), this.dict.context.obj(values2)); + } + this.updateSelectedIndices(values2); + }; + PDFAcroChoice2.prototype.valuesAreValid = function(values2) { + var options = this.getOptions(); + var _loop_1 = function(idx2, len2) { + var val = values2[idx2].decodeText(); + if (!options.find(function(o) { + return val === (o.display || o.value).decodeText(); + })) { + return { value: false }; + } + }; + for (var idx = 0, len = values2.length; idx < len; idx++) { + var state_1 = _loop_1(idx, len); + if (typeof state_1 === "object") + return state_1.value; + } + return true; + }; + PDFAcroChoice2.prototype.updateSelectedIndices = function(values2) { + if (values2.length > 1) { + var indices = new Array(values2.length); + var options = this.getOptions(); + var _loop_2 = function(idx2, len2) { + var val = values2[idx2].decodeText(); + indices[idx2] = options.findIndex(function(o) { + return val === (o.display || o.value).decodeText(); + }); + }; + for (var idx = 0, len = values2.length; idx < len; idx++) { + _loop_2(idx, len); + } + this.dict.set(PDFName_default.of("I"), this.dict.context.obj(indices.sort())); + } else { + this.dict.delete(PDFName_default.of("I")); + } + }; + PDFAcroChoice2.prototype.getValues = function() { + var v = this.V(); + if (v instanceof PDFString_default || v instanceof PDFHexString_default) + return [v]; + if (v instanceof PDFArray_default) { + var values2 = []; + for (var idx = 0, len = v.size(); idx < len; idx++) { + var value = v.lookup(idx); + if (value instanceof PDFString_default || value instanceof PDFHexString_default) { + values2.push(value); + } + } + return values2; + } + return []; + }; + PDFAcroChoice2.prototype.Opt = function() { + return this.dict.lookupMaybe(PDFName_default.of("Opt"), PDFString_default, PDFHexString_default, PDFArray_default); + }; + PDFAcroChoice2.prototype.setOptions = function(options) { + var newOpt = new Array(options.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + var _a3 = options[idx], value = _a3.value, display = _a3.display; + newOpt[idx] = this.dict.context.obj([value, display || value]); + } + this.dict.set(PDFName_default.of("Opt"), this.dict.context.obj(newOpt)); + }; + PDFAcroChoice2.prototype.getOptions = function() { + var Opt = this.Opt(); + if (Opt instanceof PDFString_default || Opt instanceof PDFHexString_default) { + return [{ value: Opt, display: Opt }]; + } + if (Opt instanceof PDFArray_default) { + var res = []; + for (var idx = 0, len = Opt.size(); idx < len; idx++) { + var item = Opt.lookup(idx); + if (item instanceof PDFString_default || item instanceof PDFHexString_default) { + res.push({ value: item, display: item }); + } + if (item instanceof PDFArray_default) { + if (item.size() > 0) { + var first = item.lookup(0, PDFString_default, PDFHexString_default); + var second = item.lookupMaybe(1, PDFString_default, PDFHexString_default); + res.push({ value: first, display: second || first }); + } + } + } + return res; + } + return []; + }; + return PDFAcroChoice2; + }(PDFAcroTerminal_default) +); +var PDFAcroChoice_default = PDFAcroChoice; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroComboBox.js +var PDFAcroComboBox = ( + /** @class */ + function(_super) { + __extends(PDFAcroComboBox2, _super); + function PDFAcroComboBox2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroComboBox2.fromDict = function(dict, ref) { + return new PDFAcroComboBox2(dict, ref); + }; + PDFAcroComboBox2.create = function(context) { + var dict = context.obj({ + FT: "Ch", + Ff: AcroChoiceFlags.Combo, + Kids: [] + }); + var ref = context.register(dict); + return new PDFAcroComboBox2(dict, ref); + }; + return PDFAcroComboBox2; + }(PDFAcroChoice_default) +); +var PDFAcroComboBox_default = PDFAcroComboBox; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroNonTerminal.js +var PDFAcroNonTerminal = ( + /** @class */ + function(_super) { + __extends(PDFAcroNonTerminal2, _super); + function PDFAcroNonTerminal2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroNonTerminal2.prototype.addField = function(field) { + var Kids = this.normalizedEntries().Kids; + Kids === null || Kids === void 0 ? void 0 : Kids.push(field); + }; + PDFAcroNonTerminal2.prototype.normalizedEntries = function() { + var Kids = this.Kids(); + if (!Kids) { + Kids = this.dict.context.obj([]); + this.dict.set(PDFName_default.of("Kids"), Kids); + } + return { Kids }; + }; + PDFAcroNonTerminal2.fromDict = function(dict, ref) { + return new PDFAcroNonTerminal2(dict, ref); + }; + PDFAcroNonTerminal2.create = function(context) { + var dict = context.obj({}); + var ref = context.register(dict); + return new PDFAcroNonTerminal2(dict, ref); + }; + return PDFAcroNonTerminal2; + }(PDFAcroField_default) +); +var PDFAcroNonTerminal_default = PDFAcroNonTerminal; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroSignature.js +var PDFAcroSignature = ( + /** @class */ + function(_super) { + __extends(PDFAcroSignature2, _super); + function PDFAcroSignature2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroSignature2.fromDict = function(dict, ref) { + return new PDFAcroSignature2(dict, ref); + }; + return PDFAcroSignature2; + }(PDFAcroTerminal_default) +); +var PDFAcroSignature_default = PDFAcroSignature; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroText.js +var PDFAcroText = ( + /** @class */ + function(_super) { + __extends(PDFAcroText2, _super); + function PDFAcroText2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroText2.prototype.MaxLen = function() { + var maxLen = this.dict.lookup(PDFName_default.of("MaxLen")); + if (maxLen instanceof PDFNumber_default) + return maxLen; + return void 0; + }; + PDFAcroText2.prototype.Q = function() { + var q = this.dict.lookup(PDFName_default.of("Q")); + if (q instanceof PDFNumber_default) + return q; + return void 0; + }; + PDFAcroText2.prototype.setMaxLength = function(maxLength) { + this.dict.set(PDFName_default.of("MaxLen"), PDFNumber_default.of(maxLength)); + }; + PDFAcroText2.prototype.removeMaxLength = function() { + this.dict.delete(PDFName_default.of("MaxLen")); + }; + PDFAcroText2.prototype.getMaxLength = function() { + var _a3; + return (_a3 = this.MaxLen()) === null || _a3 === void 0 ? void 0 : _a3.asNumber(); + }; + PDFAcroText2.prototype.setQuadding = function(quadding) { + this.dict.set(PDFName_default.of("Q"), PDFNumber_default.of(quadding)); + }; + PDFAcroText2.prototype.getQuadding = function() { + var _a3; + return (_a3 = this.Q()) === null || _a3 === void 0 ? void 0 : _a3.asNumber(); + }; + PDFAcroText2.prototype.setValue = function(value) { + this.dict.set(PDFName_default.of("V"), value); + }; + PDFAcroText2.prototype.removeValue = function() { + this.dict.delete(PDFName_default.of("V")); + }; + PDFAcroText2.prototype.getValue = function() { + var v = this.V(); + if (v instanceof PDFString_default || v instanceof PDFHexString_default) + return v; + return void 0; + }; + PDFAcroText2.fromDict = function(dict, ref) { + return new PDFAcroText2(dict, ref); + }; + PDFAcroText2.create = function(context) { + var dict = context.obj({ + FT: "Tx", + Kids: [] + }); + var ref = context.register(dict); + return new PDFAcroText2(dict, ref); + }; + return PDFAcroText2; + }(PDFAcroTerminal_default) +); +var PDFAcroText_default = PDFAcroText; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroPushButton.js +var PDFAcroPushButton = ( + /** @class */ + function(_super) { + __extends(PDFAcroPushButton2, _super); + function PDFAcroPushButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroPushButton2.fromDict = function(dict, ref) { + return new PDFAcroPushButton2(dict, ref); + }; + PDFAcroPushButton2.create = function(context) { + var dict = context.obj({ + FT: "Btn", + Ff: AcroButtonFlags.PushButton, + Kids: [] + }); + var ref = context.register(dict); + return new PDFAcroPushButton2(dict, ref); + }; + return PDFAcroPushButton2; + }(PDFAcroButton_default) +); +var PDFAcroPushButton_default = PDFAcroPushButton; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroRadioButton.js +var PDFAcroRadioButton = ( + /** @class */ + function(_super) { + __extends(PDFAcroRadioButton2, _super); + function PDFAcroRadioButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroRadioButton2.prototype.setValue = function(value) { + var onValues = this.getOnValues(); + if (!onValues.includes(value) && value !== PDFName_default.of("Off")) { + throw new InvalidAcroFieldValueError(); + } + this.dict.set(PDFName_default.of("V"), value); + var widgets = this.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var state2 = widget.getOnValue() === value ? value : PDFName_default.of("Off"); + widget.setAppearanceState(state2); + } + }; + PDFAcroRadioButton2.prototype.getValue = function() { + var v = this.V(); + if (v instanceof PDFName_default) + return v; + return PDFName_default.of("Off"); + }; + PDFAcroRadioButton2.prototype.getOnValues = function() { + var widgets = this.getWidgets(); + var onValues = []; + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var onValue = widgets[idx].getOnValue(); + if (onValue) + onValues.push(onValue); + } + return onValues; + }; + PDFAcroRadioButton2.fromDict = function(dict, ref) { + return new PDFAcroRadioButton2(dict, ref); + }; + PDFAcroRadioButton2.create = function(context) { + var dict = context.obj({ + FT: "Btn", + Ff: AcroButtonFlags.Radio, + Kids: [] + }); + var ref = context.register(dict); + return new PDFAcroRadioButton2(dict, ref); + }; + return PDFAcroRadioButton2; + }(PDFAcroButton_default) +); +var PDFAcroRadioButton_default = PDFAcroRadioButton; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroListBox.js +var PDFAcroListBox = ( + /** @class */ + function(_super) { + __extends(PDFAcroListBox2, _super); + function PDFAcroListBox2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroListBox2.fromDict = function(dict, ref) { + return new PDFAcroListBox2(dict, ref); + }; + PDFAcroListBox2.create = function(context) { + var dict = context.obj({ + FT: "Ch", + Kids: [] + }); + var ref = context.register(dict); + return new PDFAcroListBox2(dict, ref); + }; + return PDFAcroListBox2; + }(PDFAcroChoice_default) +); +var PDFAcroListBox_default = PDFAcroListBox; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/utils.js +var createPDFAcroFields = function(kidDicts) { + if (!kidDicts) + return []; + var kids = []; + for (var idx = 0, len = kidDicts.size(); idx < len; idx++) { + var ref = kidDicts.get(idx); + var dict = kidDicts.lookup(idx); + if (ref instanceof PDFRef_default && dict instanceof PDFDict_default) { + kids.push([createPDFAcroField(dict, ref), ref]); + } + } + return kids; +}; +var createPDFAcroField = function(dict, ref) { + var isNonTerminal = isNonTerminalAcroField(dict); + if (isNonTerminal) + return PDFAcroNonTerminal_default.fromDict(dict, ref); + return createPDFAcroTerminal(dict, ref); +}; +var isNonTerminalAcroField = function(dict) { + var kids = dict.lookup(PDFName_default.of("Kids")); + if (kids instanceof PDFArray_default) { + for (var idx = 0, len = kids.size(); idx < len; idx++) { + var kid = kids.lookup(idx); + var kidIsField = kid instanceof PDFDict_default && kid.has(PDFName_default.of("T")); + if (kidIsField) + return true; + } + } + return false; +}; +var createPDFAcroTerminal = function(dict, ref) { + var ftNameOrRef = getInheritableAttribute(dict, PDFName_default.of("FT")); + var type = dict.context.lookup(ftNameOrRef, PDFName_default); + if (type === PDFName_default.of("Btn")) + return createPDFAcroButton(dict, ref); + if (type === PDFName_default.of("Ch")) + return createPDFAcroChoice(dict, ref); + if (type === PDFName_default.of("Tx")) + return PDFAcroText_default.fromDict(dict, ref); + if (type === PDFName_default.of("Sig")) + return PDFAcroSignature_default.fromDict(dict, ref); + return PDFAcroTerminal_default.fromDict(dict, ref); +}; +var createPDFAcroButton = function(dict, ref) { + var _a3; + var ffNumberOrRef = getInheritableAttribute(dict, PDFName_default.of("Ff")); + var ffNumber = dict.context.lookupMaybe(ffNumberOrRef, PDFNumber_default); + var flags = (_a3 = ffNumber === null || ffNumber === void 0 ? void 0 : ffNumber.asNumber()) !== null && _a3 !== void 0 ? _a3 : 0; + if (flagIsSet(flags, AcroButtonFlags.PushButton)) { + return PDFAcroPushButton_default.fromDict(dict, ref); + } else if (flagIsSet(flags, AcroButtonFlags.Radio)) { + return PDFAcroRadioButton_default.fromDict(dict, ref); + } else { + return PDFAcroCheckBox_default.fromDict(dict, ref); + } +}; +var createPDFAcroChoice = function(dict, ref) { + var _a3; + var ffNumberOrRef = getInheritableAttribute(dict, PDFName_default.of("Ff")); + var ffNumber = dict.context.lookupMaybe(ffNumberOrRef, PDFNumber_default); + var flags = (_a3 = ffNumber === null || ffNumber === void 0 ? void 0 : ffNumber.asNumber()) !== null && _a3 !== void 0 ? _a3 : 0; + if (flagIsSet(flags, AcroChoiceFlags.Combo)) { + return PDFAcroComboBox_default.fromDict(dict, ref); + } else { + return PDFAcroListBox_default.fromDict(dict, ref); + } +}; +var flagIsSet = function(flags, flag3) { + return (flags & flag3) !== 0; +}; +var getInheritableAttribute = function(startNode, name) { + var attribute; + ascend(startNode, function(node) { + if (!attribute) + attribute = node.get(name); + }); + return attribute; +}; +var ascend = function(startNode, visitor) { + visitor(startNode); + var Parent = startNode.lookupMaybe(PDFName_default.of("Parent"), PDFDict_default); + if (Parent) + ascend(Parent, visitor); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/acroform/PDFAcroForm.js +var PDFAcroForm = ( + /** @class */ + function() { + function PDFAcroForm2(dict) { + this.dict = dict; + } + PDFAcroForm2.prototype.Fields = function() { + var fields = this.dict.lookup(PDFName_default.of("Fields")); + if (fields instanceof PDFArray_default) + return fields; + return void 0; + }; + PDFAcroForm2.prototype.getFields = function() { + var Fields = this.normalizedEntries().Fields; + var fields = new Array(Fields.size()); + for (var idx = 0, len = Fields.size(); idx < len; idx++) { + var ref = Fields.get(idx); + var dict = Fields.lookup(idx, PDFDict_default); + fields[idx] = [createPDFAcroField(dict, ref), ref]; + } + return fields; + }; + PDFAcroForm2.prototype.getAllFields = function() { + var allFields = []; + var pushFields = function(fields) { + if (!fields) + return; + for (var idx = 0, len = fields.length; idx < len; idx++) { + var field = fields[idx]; + allFields.push(field); + var fieldModel = field[0]; + if (fieldModel instanceof PDFAcroNonTerminal_default) { + pushFields(createPDFAcroFields(fieldModel.Kids())); + } + } + }; + pushFields(this.getFields()); + return allFields; + }; + PDFAcroForm2.prototype.addField = function(field) { + var Fields = this.normalizedEntries().Fields; + Fields === null || Fields === void 0 ? void 0 : Fields.push(field); + }; + PDFAcroForm2.prototype.removeField = function(field) { + var parent = field.getParent(); + var fields = parent === void 0 ? this.normalizedEntries().Fields : parent.Kids(); + var index2 = fields === null || fields === void 0 ? void 0 : fields.indexOf(field.ref); + if (fields === void 0 || index2 === void 0) { + throw new Error("Tried to remove inexistent field " + field.getFullyQualifiedName()); + } + fields.remove(index2); + if (parent !== void 0 && fields.size() === 0) { + this.removeField(parent); + } + }; + PDFAcroForm2.prototype.normalizedEntries = function() { + var Fields = this.Fields(); + if (!Fields) { + Fields = this.dict.context.obj([]); + this.dict.set(PDFName_default.of("Fields"), Fields); + } + return { Fields }; + }; + PDFAcroForm2.fromDict = function(dict) { + return new PDFAcroForm2(dict); + }; + PDFAcroForm2.create = function(context) { + var dict = context.obj({ Fields: [] }); + return new PDFAcroForm2(dict); + }; + return PDFAcroForm2; + }() +); +var PDFAcroForm_default = PDFAcroForm; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/structures/PDFCatalog.js +var PDFCatalog = ( + /** @class */ + function(_super) { + __extends(PDFCatalog2, _super); + function PDFCatalog2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFCatalog2.prototype.Pages = function() { + return this.lookup(PDFName_default.of("Pages"), PDFDict_default); + }; + PDFCatalog2.prototype.AcroForm = function() { + return this.lookupMaybe(PDFName_default.of("AcroForm"), PDFDict_default); + }; + PDFCatalog2.prototype.getAcroForm = function() { + var dict = this.AcroForm(); + if (!dict) + return void 0; + return PDFAcroForm_default.fromDict(dict); + }; + PDFCatalog2.prototype.getOrCreateAcroForm = function() { + var acroForm = this.getAcroForm(); + if (!acroForm) { + acroForm = PDFAcroForm_default.create(this.context); + var acroFormRef = this.context.register(acroForm.dict); + this.set(PDFName_default.of("AcroForm"), acroFormRef); + } + return acroForm; + }; + PDFCatalog2.prototype.ViewerPreferences = function() { + return this.lookupMaybe(PDFName_default.of("ViewerPreferences"), PDFDict_default); + }; + PDFCatalog2.prototype.getViewerPreferences = function() { + var dict = this.ViewerPreferences(); + if (!dict) + return void 0; + return ViewerPreferences_default.fromDict(dict); + }; + PDFCatalog2.prototype.getOrCreateViewerPreferences = function() { + var viewerPrefs = this.getViewerPreferences(); + if (!viewerPrefs) { + viewerPrefs = ViewerPreferences_default.create(this.context); + var viewerPrefsRef = this.context.register(viewerPrefs.dict); + this.set(PDFName_default.of("ViewerPreferences"), viewerPrefsRef); + } + return viewerPrefs; + }; + PDFCatalog2.prototype.insertLeafNode = function(leafRef, index2) { + var pagesRef = this.get(PDFName_default.of("Pages")); + var maybeParentRef = this.Pages().insertLeafNode(leafRef, index2); + return maybeParentRef || pagesRef; + }; + PDFCatalog2.prototype.removeLeafNode = function(index2) { + this.Pages().removeLeafNode(index2); + }; + PDFCatalog2.withContextAndPages = function(context, pages) { + var dict = /* @__PURE__ */ new Map(); + dict.set(PDFName_default.of("Type"), PDFName_default.of("Catalog")); + dict.set(PDFName_default.of("Pages"), pages); + return new PDFCatalog2(dict, context); + }; + PDFCatalog2.fromMapWithContext = function(map, context) { + return new PDFCatalog2(map, context); + }; + return PDFCatalog2; + }(PDFDict_default) +); +var PDFCatalog_default = PDFCatalog; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/structures/PDFPageTree.js +var PDFPageTree = ( + /** @class */ + function(_super) { + __extends(PDFPageTree2, _super); + function PDFPageTree2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFPageTree2.prototype.Parent = function() { + return this.lookup(PDFName_default.of("Parent")); + }; + PDFPageTree2.prototype.Kids = function() { + return this.lookup(PDFName_default.of("Kids"), PDFArray_default); + }; + PDFPageTree2.prototype.Count = function() { + return this.lookup(PDFName_default.of("Count"), PDFNumber_default); + }; + PDFPageTree2.prototype.pushTreeNode = function(treeRef) { + var Kids = this.Kids(); + Kids.push(treeRef); + }; + PDFPageTree2.prototype.pushLeafNode = function(leafRef) { + var Kids = this.Kids(); + this.insertLeafKid(Kids.size(), leafRef); + }; + PDFPageTree2.prototype.insertLeafNode = function(leafRef, targetIndex) { + var Kids = this.Kids(); + var Count = this.Count().asNumber(); + if (targetIndex > Count) { + throw new InvalidTargetIndexError(targetIndex, Count); + } + var leafsRemainingUntilTarget = targetIndex; + for (var idx = 0, len = Kids.size(); idx < len; idx++) { + if (leafsRemainingUntilTarget === 0) { + this.insertLeafKid(idx, leafRef); + return void 0; + } + var kidRef = Kids.get(idx); + var kid = this.context.lookup(kidRef); + if (kid instanceof PDFPageTree2) { + if (kid.Count().asNumber() > leafsRemainingUntilTarget) { + return kid.insertLeafNode(leafRef, leafsRemainingUntilTarget) || kidRef; + } else { + leafsRemainingUntilTarget -= kid.Count().asNumber(); + } + } + if (kid instanceof PDFPageLeaf_default) { + leafsRemainingUntilTarget -= 1; + } + } + if (leafsRemainingUntilTarget === 0) { + this.insertLeafKid(Kids.size(), leafRef); + return void 0; + } + throw new CorruptPageTreeError(targetIndex, "insertLeafNode"); + }; + PDFPageTree2.prototype.removeLeafNode = function(targetIndex, prune) { + if (prune === void 0) { + prune = true; + } + var Kids = this.Kids(); + var Count = this.Count().asNumber(); + if (targetIndex >= Count) { + throw new InvalidTargetIndexError(targetIndex, Count); + } + var leafsRemainingUntilTarget = targetIndex; + for (var idx = 0, len = Kids.size(); idx < len; idx++) { + var kidRef = Kids.get(idx); + var kid = this.context.lookup(kidRef); + if (kid instanceof PDFPageTree2) { + if (kid.Count().asNumber() > leafsRemainingUntilTarget) { + kid.removeLeafNode(leafsRemainingUntilTarget, prune); + if (prune && kid.Kids().size() === 0) + Kids.remove(idx); + return; + } else { + leafsRemainingUntilTarget -= kid.Count().asNumber(); + } + } + if (kid instanceof PDFPageLeaf_default) { + if (leafsRemainingUntilTarget === 0) { + this.removeKid(idx); + return; + } else { + leafsRemainingUntilTarget -= 1; + } + } + } + throw new CorruptPageTreeError(targetIndex, "removeLeafNode"); + }; + PDFPageTree2.prototype.ascend = function(visitor) { + visitor(this); + var Parent = this.Parent(); + if (Parent) + Parent.ascend(visitor); + }; + PDFPageTree2.prototype.traverse = function(visitor) { + var Kids = this.Kids(); + for (var idx = 0, len = Kids.size(); idx < len; idx++) { + var kidRef = Kids.get(idx); + var kid = this.context.lookup(kidRef); + if (kid instanceof PDFPageTree2) + kid.traverse(visitor); + visitor(kid, kidRef); + } + }; + PDFPageTree2.prototype.insertLeafKid = function(kidIdx, leafRef) { + var Kids = this.Kids(); + this.ascend(function(node) { + var newCount = node.Count().asNumber() + 1; + node.set(PDFName_default.of("Count"), PDFNumber_default.of(newCount)); + }); + Kids.insert(kidIdx, leafRef); + }; + PDFPageTree2.prototype.removeKid = function(kidIdx) { + var Kids = this.Kids(); + var kid = Kids.lookup(kidIdx); + if (kid instanceof PDFPageLeaf_default) { + this.ascend(function(node) { + var newCount = node.Count().asNumber() - 1; + node.set(PDFName_default.of("Count"), PDFNumber_default.of(newCount)); + }); + } + Kids.remove(kidIdx); + }; + PDFPageTree2.withContext = function(context, parent) { + var dict = /* @__PURE__ */ new Map(); + dict.set(PDFName_default.of("Type"), PDFName_default.of("Pages")); + dict.set(PDFName_default.of("Kids"), context.obj([])); + dict.set(PDFName_default.of("Count"), context.obj(0)); + if (parent) + dict.set(PDFName_default.of("Parent"), parent); + return new PDFPageTree2(dict, context); + }; + PDFPageTree2.fromMapWithContext = function(map, context) { + return new PDFPageTree2(map, context); + }; + return PDFPageTree2; + }(PDFDict_default) +); +var PDFPageTree_default = PDFPageTree; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/syntax/Numeric.js +var IsDigit = new Uint8Array(256); +IsDigit[CharCodes_default.Zero] = 1; +IsDigit[CharCodes_default.One] = 1; +IsDigit[CharCodes_default.Two] = 1; +IsDigit[CharCodes_default.Three] = 1; +IsDigit[CharCodes_default.Four] = 1; +IsDigit[CharCodes_default.Five] = 1; +IsDigit[CharCodes_default.Six] = 1; +IsDigit[CharCodes_default.Seven] = 1; +IsDigit[CharCodes_default.Eight] = 1; +IsDigit[CharCodes_default.Nine] = 1; +var IsNumericPrefix = new Uint8Array(256); +IsNumericPrefix[CharCodes_default.Period] = 1; +IsNumericPrefix[CharCodes_default.Plus] = 1; +IsNumericPrefix[CharCodes_default.Minus] = 1; +var IsNumeric = new Uint8Array(256); +for (idx = 0, len = 256; idx < len; idx++) { + IsNumeric[idx] = IsDigit[idx] || IsNumericPrefix[idx] ? 1 : 0; +} +var idx; +var len; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/parser/BaseParser.js +var Newline = CharCodes_default.Newline; +var CarriageReturn = CharCodes_default.CarriageReturn; +var BaseParser = ( + /** @class */ + function() { + function BaseParser2(bytes, capNumbers) { + if (capNumbers === void 0) { + capNumbers = false; + } + this.bytes = bytes; + this.capNumbers = capNumbers; + } + BaseParser2.prototype.parseRawInt = function() { + var value = ""; + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (!IsDigit[byte]) + break; + value += charFromCode(this.bytes.next()); + } + var numberValue = Number(value); + if (!value || !isFinite(numberValue)) { + throw new NumberParsingError(this.bytes.position(), value); + } + return numberValue; + }; + BaseParser2.prototype.parseRawNumber = function() { + var value = ""; + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (!IsNumeric[byte]) + break; + value += charFromCode(this.bytes.next()); + if (byte === CharCodes_default.Period) + break; + } + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (!IsDigit[byte]) + break; + value += charFromCode(this.bytes.next()); + } + var numberValue = Number(value); + if (!value || !isFinite(numberValue)) { + throw new NumberParsingError(this.bytes.position(), value); + } + if (numberValue > Number.MAX_SAFE_INTEGER) { + if (this.capNumbers) { + var msg = "Parsed number that is too large for some PDF readers: " + value + ", using Number.MAX_SAFE_INTEGER instead."; + console.warn(msg); + return Number.MAX_SAFE_INTEGER; + } else { + var msg = "Parsed number that is too large for some PDF readers: " + value + ", not capping."; + console.warn(msg); + } + } + return numberValue; + }; + BaseParser2.prototype.skipWhitespace = function() { + while (!this.bytes.done() && IsWhitespace[this.bytes.peek()]) { + this.bytes.next(); + } + }; + BaseParser2.prototype.skipLine = function() { + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (byte === Newline || byte === CarriageReturn) + return; + this.bytes.next(); + } + }; + BaseParser2.prototype.skipComment = function() { + if (this.bytes.peek() !== CharCodes_default.Percent) + return false; + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (byte === Newline || byte === CarriageReturn) + return true; + this.bytes.next(); + } + return true; + }; + BaseParser2.prototype.skipWhitespaceAndComments = function() { + this.skipWhitespace(); + while (this.skipComment()) + this.skipWhitespace(); + }; + BaseParser2.prototype.matchKeyword = function(keyword) { + var initialOffset = this.bytes.offset(); + for (var idx = 0, len = keyword.length; idx < len; idx++) { + if (this.bytes.done() || this.bytes.next() !== keyword[idx]) { + this.bytes.moveTo(initialOffset); + return false; + } + } + return true; + }; + return BaseParser2; + }() +); +var BaseParser_default = BaseParser; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/parser/ByteStream.js +var ByteStream = ( + /** @class */ + function() { + function ByteStream2(bytes) { + this.idx = 0; + this.line = 0; + this.column = 0; + this.bytes = bytes; + this.length = this.bytes.length; + } + ByteStream2.prototype.moveTo = function(offset) { + this.idx = offset; + }; + ByteStream2.prototype.next = function() { + var byte = this.bytes[this.idx++]; + if (byte === CharCodes_default.Newline) { + this.line += 1; + this.column = 0; + } else { + this.column += 1; + } + return byte; + }; + ByteStream2.prototype.assertNext = function(expected) { + if (this.peek() !== expected) { + throw new NextByteAssertionError(this.position(), expected, this.peek()); + } + return this.next(); + }; + ByteStream2.prototype.peek = function() { + return this.bytes[this.idx]; + }; + ByteStream2.prototype.peekAhead = function(steps) { + return this.bytes[this.idx + steps]; + }; + ByteStream2.prototype.peekAt = function(offset) { + return this.bytes[offset]; + }; + ByteStream2.prototype.done = function() { + return this.idx >= this.length; + }; + ByteStream2.prototype.offset = function() { + return this.idx; + }; + ByteStream2.prototype.slice = function(start, end) { + return this.bytes.slice(start, end); + }; + ByteStream2.prototype.position = function() { + return { line: this.line, column: this.column, offset: this.idx }; + }; + ByteStream2.of = function(bytes) { + return new ByteStream2(bytes); + }; + ByteStream2.fromPDFRawStream = function(rawStream) { + return ByteStream2.of(decodePDFRawStream(rawStream).decode()); + }; + return ByteStream2; + }() +); +var ByteStream_default = ByteStream; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/syntax/Keywords.js +var Space = CharCodes_default.Space; +var CarriageReturn2 = CharCodes_default.CarriageReturn; +var Newline2 = CharCodes_default.Newline; +var stream = [ + CharCodes_default.s, + CharCodes_default.t, + CharCodes_default.r, + CharCodes_default.e, + CharCodes_default.a, + CharCodes_default.m +]; +var endstream = [ + CharCodes_default.e, + CharCodes_default.n, + CharCodes_default.d, + CharCodes_default.s, + CharCodes_default.t, + CharCodes_default.r, + CharCodes_default.e, + CharCodes_default.a, + CharCodes_default.m +]; +var Keywords = { + header: [ + CharCodes_default.Percent, + CharCodes_default.P, + CharCodes_default.D, + CharCodes_default.F, + CharCodes_default.Dash + ], + eof: [ + CharCodes_default.Percent, + CharCodes_default.Percent, + CharCodes_default.E, + CharCodes_default.O, + CharCodes_default.F + ], + obj: [CharCodes_default.o, CharCodes_default.b, CharCodes_default.j], + endobj: [ + CharCodes_default.e, + CharCodes_default.n, + CharCodes_default.d, + CharCodes_default.o, + CharCodes_default.b, + CharCodes_default.j + ], + xref: [CharCodes_default.x, CharCodes_default.r, CharCodes_default.e, CharCodes_default.f], + trailer: [ + CharCodes_default.t, + CharCodes_default.r, + CharCodes_default.a, + CharCodes_default.i, + CharCodes_default.l, + CharCodes_default.e, + CharCodes_default.r + ], + startxref: [ + CharCodes_default.s, + CharCodes_default.t, + CharCodes_default.a, + CharCodes_default.r, + CharCodes_default.t, + CharCodes_default.x, + CharCodes_default.r, + CharCodes_default.e, + CharCodes_default.f + ], + true: [CharCodes_default.t, CharCodes_default.r, CharCodes_default.u, CharCodes_default.e], + false: [CharCodes_default.f, CharCodes_default.a, CharCodes_default.l, CharCodes_default.s, CharCodes_default.e], + null: [CharCodes_default.n, CharCodes_default.u, CharCodes_default.l, CharCodes_default.l], + stream, + streamEOF1: __spreadArrays(stream, [Space, CarriageReturn2, Newline2]), + streamEOF2: __spreadArrays(stream, [CarriageReturn2, Newline2]), + streamEOF3: __spreadArrays(stream, [CarriageReturn2]), + streamEOF4: __spreadArrays(stream, [Newline2]), + endstream, + EOF1endstream: __spreadArrays([CarriageReturn2, Newline2], endstream), + EOF2endstream: __spreadArrays([CarriageReturn2], endstream), + EOF3endstream: __spreadArrays([Newline2], endstream) +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/parser/PDFObjectParser.js +var PDFObjectParser = ( + /** @class */ + function(_super) { + __extends(PDFObjectParser2, _super); + function PDFObjectParser2(byteStream, context, capNumbers) { + if (capNumbers === void 0) { + capNumbers = false; + } + var _this = _super.call(this, byteStream, capNumbers) || this; + _this.context = context; + return _this; + } + PDFObjectParser2.prototype.parseObject = function() { + this.skipWhitespaceAndComments(); + if (this.matchKeyword(Keywords.true)) + return PDFBool_default.True; + if (this.matchKeyword(Keywords.false)) + return PDFBool_default.False; + if (this.matchKeyword(Keywords.null)) + return PDFNull_default; + var byte = this.bytes.peek(); + if (byte === CharCodes_default.LessThan && this.bytes.peekAhead(1) === CharCodes_default.LessThan) { + return this.parseDictOrStream(); + } + if (byte === CharCodes_default.LessThan) + return this.parseHexString(); + if (byte === CharCodes_default.LeftParen) + return this.parseString(); + if (byte === CharCodes_default.ForwardSlash) + return this.parseName(); + if (byte === CharCodes_default.LeftSquareBracket) + return this.parseArray(); + if (IsNumeric[byte]) + return this.parseNumberOrRef(); + throw new PDFObjectParsingError(this.bytes.position(), byte); + }; + PDFObjectParser2.prototype.parseNumberOrRef = function() { + var firstNum = this.parseRawNumber(); + this.skipWhitespaceAndComments(); + var lookaheadStart = this.bytes.offset(); + if (IsDigit[this.bytes.peek()]) { + var secondNum = this.parseRawNumber(); + this.skipWhitespaceAndComments(); + if (this.bytes.peek() === CharCodes_default.R) { + this.bytes.assertNext(CharCodes_default.R); + return PDFRef_default.of(firstNum, secondNum); + } + } + this.bytes.moveTo(lookaheadStart); + return PDFNumber_default.of(firstNum); + }; + PDFObjectParser2.prototype.parseHexString = function() { + var value = ""; + this.bytes.assertNext(CharCodes_default.LessThan); + while (!this.bytes.done() && this.bytes.peek() !== CharCodes_default.GreaterThan) { + value += charFromCode(this.bytes.next()); + } + this.bytes.assertNext(CharCodes_default.GreaterThan); + return PDFHexString_default.of(value); + }; + PDFObjectParser2.prototype.parseString = function() { + var nestingLvl = 0; + var isEscaped = false; + var value = ""; + while (!this.bytes.done()) { + var byte = this.bytes.next(); + value += charFromCode(byte); + if (!isEscaped) { + if (byte === CharCodes_default.LeftParen) + nestingLvl += 1; + if (byte === CharCodes_default.RightParen) + nestingLvl -= 1; + } + if (byte === CharCodes_default.BackSlash) { + isEscaped = !isEscaped; + } else if (isEscaped) { + isEscaped = false; + } + if (nestingLvl === 0) { + return PDFString_default.of(value.substring(1, value.length - 1)); + } + } + throw new UnbalancedParenthesisError(this.bytes.position()); + }; + PDFObjectParser2.prototype.parseName = function() { + this.bytes.assertNext(CharCodes_default.ForwardSlash); + var name = ""; + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (IsWhitespace[byte] || IsDelimiter[byte]) + break; + name += charFromCode(byte); + this.bytes.next(); + } + return PDFName_default.of(name); + }; + PDFObjectParser2.prototype.parseArray = function() { + this.bytes.assertNext(CharCodes_default.LeftSquareBracket); + this.skipWhitespaceAndComments(); + var pdfArray = PDFArray_default.withContext(this.context); + while (this.bytes.peek() !== CharCodes_default.RightSquareBracket) { + var element2 = this.parseObject(); + pdfArray.push(element2); + this.skipWhitespaceAndComments(); + } + this.bytes.assertNext(CharCodes_default.RightSquareBracket); + return pdfArray; + }; + PDFObjectParser2.prototype.parseDict = function() { + this.bytes.assertNext(CharCodes_default.LessThan); + this.bytes.assertNext(CharCodes_default.LessThan); + this.skipWhitespaceAndComments(); + var dict = /* @__PURE__ */ new Map(); + while (!this.bytes.done() && this.bytes.peek() !== CharCodes_default.GreaterThan && this.bytes.peekAhead(1) !== CharCodes_default.GreaterThan) { + var key = this.parseName(); + var value = this.parseObject(); + dict.set(key, value); + this.skipWhitespaceAndComments(); + } + this.skipWhitespaceAndComments(); + this.bytes.assertNext(CharCodes_default.GreaterThan); + this.bytes.assertNext(CharCodes_default.GreaterThan); + var Type = dict.get(PDFName_default.of("Type")); + if (Type === PDFName_default.of("Catalog")) { + return PDFCatalog_default.fromMapWithContext(dict, this.context); + } else if (Type === PDFName_default.of("Pages")) { + return PDFPageTree_default.fromMapWithContext(dict, this.context); + } else if (Type === PDFName_default.of("Page")) { + return PDFPageLeaf_default.fromMapWithContext(dict, this.context); + } else { + return PDFDict_default.fromMapWithContext(dict, this.context); + } + }; + PDFObjectParser2.prototype.parseDictOrStream = function() { + var startPos = this.bytes.position(); + var dict = this.parseDict(); + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords.streamEOF1) && !this.matchKeyword(Keywords.streamEOF2) && !this.matchKeyword(Keywords.streamEOF3) && !this.matchKeyword(Keywords.streamEOF4) && !this.matchKeyword(Keywords.stream)) { + return dict; + } + var start = this.bytes.offset(); + var end; + var Length = dict.get(PDFName_default.of("Length")); + if (Length instanceof PDFNumber_default) { + end = start + Length.asNumber(); + this.bytes.moveTo(end); + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords.endstream)) { + this.bytes.moveTo(start); + end = this.findEndOfStreamFallback(startPos); + } + } else { + end = this.findEndOfStreamFallback(startPos); + } + var contents = this.bytes.slice(start, end); + return PDFRawStream_default.of(dict, contents); + }; + PDFObjectParser2.prototype.findEndOfStreamFallback = function(startPos) { + var nestingLvl = 1; + var end = this.bytes.offset(); + while (!this.bytes.done()) { + end = this.bytes.offset(); + if (this.matchKeyword(Keywords.stream)) { + nestingLvl += 1; + } else if (this.matchKeyword(Keywords.EOF1endstream) || this.matchKeyword(Keywords.EOF2endstream) || this.matchKeyword(Keywords.EOF3endstream) || this.matchKeyword(Keywords.endstream)) { + nestingLvl -= 1; + } else { + this.bytes.next(); + } + if (nestingLvl === 0) + break; + } + if (nestingLvl !== 0) + throw new PDFStreamParsingError(startPos); + return end; + }; + PDFObjectParser2.forBytes = function(bytes, context, capNumbers) { + return new PDFObjectParser2(ByteStream_default.of(bytes), context, capNumbers); + }; + PDFObjectParser2.forByteStream = function(byteStream, context, capNumbers) { + if (capNumbers === void 0) { + capNumbers = false; + } + return new PDFObjectParser2(byteStream, context, capNumbers); + }; + return PDFObjectParser2; + }(BaseParser_default) +); +var PDFObjectParser_default = PDFObjectParser; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/parser/PDFObjectStreamParser.js +var PDFObjectStreamParser = ( + /** @class */ + function(_super) { + __extends(PDFObjectStreamParser2, _super); + function PDFObjectStreamParser2(rawStream, shouldWaitForTick) { + var _this = _super.call(this, ByteStream_default.fromPDFRawStream(rawStream), rawStream.dict.context) || this; + var dict = rawStream.dict; + _this.alreadyParsed = false; + _this.shouldWaitForTick = shouldWaitForTick || function() { + return false; + }; + _this.firstOffset = dict.lookup(PDFName_default.of("First"), PDFNumber_default).asNumber(); + _this.objectCount = dict.lookup(PDFName_default.of("N"), PDFNumber_default).asNumber(); + return _this; + } + PDFObjectStreamParser2.prototype.parseIntoContext = function() { + return __awaiter(this, void 0, void 0, function() { + var offsetsAndObjectNumbers, idx, len, _a3, objectNumber, offset, object, ref; + return __generator(this, function(_b3) { + switch (_b3.label) { + case 0: + if (this.alreadyParsed) { + throw new ReparseError("PDFObjectStreamParser", "parseIntoContext"); + } + this.alreadyParsed = true; + offsetsAndObjectNumbers = this.parseOffsetsAndObjectNumbers(); + idx = 0, len = offsetsAndObjectNumbers.length; + _b3.label = 1; + case 1: + if (!(idx < len)) return [3, 4]; + _a3 = offsetsAndObjectNumbers[idx], objectNumber = _a3.objectNumber, offset = _a3.offset; + this.bytes.moveTo(this.firstOffset + offset); + object = this.parseObject(); + ref = PDFRef_default.of(objectNumber, 0); + this.context.assign(ref, object); + if (!this.shouldWaitForTick()) return [3, 3]; + return [4, waitForTick()]; + case 2: + _b3.sent(); + _b3.label = 3; + case 3: + idx++; + return [3, 1]; + case 4: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFObjectStreamParser2.prototype.parseOffsetsAndObjectNumbers = function() { + var offsetsAndObjectNumbers = []; + for (var idx = 0, len = this.objectCount; idx < len; idx++) { + this.skipWhitespaceAndComments(); + var objectNumber = this.parseRawInt(); + this.skipWhitespaceAndComments(); + var offset = this.parseRawInt(); + offsetsAndObjectNumbers.push({ objectNumber, offset }); + } + return offsetsAndObjectNumbers; + }; + PDFObjectStreamParser2.forStream = function(rawStream, shouldWaitForTick) { + return new PDFObjectStreamParser2(rawStream, shouldWaitForTick); + }; + return PDFObjectStreamParser2; + }(PDFObjectParser_default) +); +var PDFObjectStreamParser_default = PDFObjectStreamParser; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/parser/PDFXRefStreamParser.js +var PDFXRefStreamParser = ( + /** @class */ + function() { + function PDFXRefStreamParser2(rawStream) { + this.alreadyParsed = false; + this.dict = rawStream.dict; + this.bytes = ByteStream_default.fromPDFRawStream(rawStream); + this.context = this.dict.context; + var Size = this.dict.lookup(PDFName_default.of("Size"), PDFNumber_default); + var Index = this.dict.lookup(PDFName_default.of("Index")); + if (Index instanceof PDFArray_default) { + this.subsections = []; + for (var idx = 0, len = Index.size(); idx < len; idx += 2) { + var firstObjectNumber = Index.lookup(idx + 0, PDFNumber_default).asNumber(); + var length_1 = Index.lookup(idx + 1, PDFNumber_default).asNumber(); + this.subsections.push({ firstObjectNumber, length: length_1 }); + } + } else { + this.subsections = [{ firstObjectNumber: 0, length: Size.asNumber() }]; + } + var W = this.dict.lookup(PDFName_default.of("W"), PDFArray_default); + this.byteWidths = [-1, -1, -1]; + for (var idx = 0, len = W.size(); idx < len; idx++) { + this.byteWidths[idx] = W.lookup(idx, PDFNumber_default).asNumber(); + } + } + PDFXRefStreamParser2.prototype.parseIntoContext = function() { + if (this.alreadyParsed) { + throw new ReparseError("PDFXRefStreamParser", "parseIntoContext"); + } + this.alreadyParsed = true; + this.context.trailerInfo = { + Root: this.dict.get(PDFName_default.of("Root")), + Encrypt: this.dict.get(PDFName_default.of("Encrypt")), + Info: this.dict.get(PDFName_default.of("Info")), + ID: this.dict.get(PDFName_default.of("ID")) + }; + var entries = this.parseEntries(); + return entries; + }; + PDFXRefStreamParser2.prototype.parseEntries = function() { + var entries = []; + var _a3 = this.byteWidths, typeFieldWidth = _a3[0], offsetFieldWidth = _a3[1], genFieldWidth = _a3[2]; + for (var subsectionIdx = 0, subsectionLen = this.subsections.length; subsectionIdx < subsectionLen; subsectionIdx++) { + var _b3 = this.subsections[subsectionIdx], firstObjectNumber = _b3.firstObjectNumber, length_2 = _b3.length; + for (var objIdx = 0; objIdx < length_2; objIdx++) { + var type = 0; + for (var idx = 0, len = typeFieldWidth; idx < len; idx++) { + type = type << 8 | this.bytes.next(); + } + var offset = 0; + for (var idx = 0, len = offsetFieldWidth; idx < len; idx++) { + offset = offset << 8 | this.bytes.next(); + } + var generationNumber = 0; + for (var idx = 0, len = genFieldWidth; idx < len; idx++) { + generationNumber = generationNumber << 8 | this.bytes.next(); + } + if (typeFieldWidth === 0) + type = 1; + var objectNumber = firstObjectNumber + objIdx; + var entry = { + ref: PDFRef_default.of(objectNumber, generationNumber), + offset, + deleted: type === 0, + inObjectStream: type === 2 + }; + entries.push(entry); + } + } + return entries; + }; + PDFXRefStreamParser2.forStream = function(rawStream) { + return new PDFXRefStreamParser2(rawStream); + }; + return PDFXRefStreamParser2; + }() +); +var PDFXRefStreamParser_default = PDFXRefStreamParser; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/parser/PDFParser.js +var PDFParser = ( + /** @class */ + function(_super) { + __extends(PDFParser2, _super); + function PDFParser2(pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers) { + if (objectsPerTick === void 0) { + objectsPerTick = Infinity; + } + if (throwOnInvalidObject === void 0) { + throwOnInvalidObject = false; + } + if (capNumbers === void 0) { + capNumbers = false; + } + var _this = _super.call(this, ByteStream_default.of(pdfBytes), PDFContext_default.create(), capNumbers) || this; + _this.alreadyParsed = false; + _this.parsedObjects = 0; + _this.shouldWaitForTick = function() { + _this.parsedObjects += 1; + return _this.parsedObjects % _this.objectsPerTick === 0; + }; + _this.objectsPerTick = objectsPerTick; + _this.throwOnInvalidObject = throwOnInvalidObject; + return _this; + } + PDFParser2.prototype.parseDocument = function() { + return __awaiter(this, void 0, void 0, function() { + var prevOffset, offset; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + if (this.alreadyParsed) { + throw new ReparseError("PDFParser", "parseDocument"); + } + this.alreadyParsed = true; + this.context.header = this.parseHeader(); + _a3.label = 1; + case 1: + if (!!this.bytes.done()) return [3, 3]; + return [4, this.parseDocumentSection()]; + case 2: + _a3.sent(); + offset = this.bytes.offset(); + if (offset === prevOffset) { + throw new StalledParserError(this.bytes.position()); + } + prevOffset = offset; + return [3, 1]; + case 3: + this.maybeRecoverRoot(); + if (this.context.lookup(PDFRef_default.of(0))) { + console.warn("Removing parsed object: 0 0 R"); + this.context.delete(PDFRef_default.of(0)); + } + return [2, this.context]; + } + }); + }); + }; + PDFParser2.prototype.maybeRecoverRoot = function() { + var isValidCatalog = function(obj) { + return obj instanceof PDFDict_default && obj.lookup(PDFName_default.of("Type")) === PDFName_default.of("Catalog"); + }; + var catalog = this.context.lookup(this.context.trailerInfo.Root); + if (!isValidCatalog(catalog)) { + var indirectObjects = this.context.enumerateIndirectObjects(); + for (var idx = 0, len = indirectObjects.length; idx < len; idx++) { + var _a3 = indirectObjects[idx], ref = _a3[0], object = _a3[1]; + if (isValidCatalog(object)) { + this.context.trailerInfo.Root = ref; + } + } + } + }; + PDFParser2.prototype.parseHeader = function() { + while (!this.bytes.done()) { + if (this.matchKeyword(Keywords.header)) { + var major = this.parseRawInt(); + this.bytes.assertNext(CharCodes_default.Period); + var minor = this.parseRawInt(); + var header = PDFHeader_default.forVersion(major, minor); + this.skipBinaryHeaderComment(); + return header; + } + this.bytes.next(); + } + throw new MissingPDFHeaderError(this.bytes.position()); + }; + PDFParser2.prototype.parseIndirectObjectHeader = function() { + this.skipWhitespaceAndComments(); + var objectNumber = this.parseRawInt(); + this.skipWhitespaceAndComments(); + var generationNumber = this.parseRawInt(); + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords.obj)) { + throw new MissingKeywordError(this.bytes.position(), Keywords.obj); + } + return PDFRef_default.of(objectNumber, generationNumber); + }; + PDFParser2.prototype.matchIndirectObjectHeader = function() { + var initialOffset = this.bytes.offset(); + try { + this.parseIndirectObjectHeader(); + return true; + } catch (e) { + this.bytes.moveTo(initialOffset); + return false; + } + }; + PDFParser2.prototype.parseIndirectObject = function() { + return __awaiter(this, void 0, void 0, function() { + var ref, object; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + ref = this.parseIndirectObjectHeader(); + this.skipWhitespaceAndComments(); + object = this.parseObject(); + this.skipWhitespaceAndComments(); + this.matchKeyword(Keywords.endobj); + if (!(object instanceof PDFRawStream_default && object.dict.lookup(PDFName_default.of("Type")) === PDFName_default.of("ObjStm"))) return [3, 2]; + return [4, PDFObjectStreamParser_default.forStream(object, this.shouldWaitForTick).parseIntoContext()]; + case 1: + _a3.sent(); + return [3, 3]; + case 2: + if (object instanceof PDFRawStream_default && object.dict.lookup(PDFName_default.of("Type")) === PDFName_default.of("XRef")) { + PDFXRefStreamParser_default.forStream(object).parseIntoContext(); + } else { + this.context.assign(ref, object); + } + _a3.label = 3; + case 3: + return [2, ref]; + } + }); + }); + }; + PDFParser2.prototype.tryToParseInvalidIndirectObject = function() { + var startPos = this.bytes.position(); + var msg = "Trying to parse invalid object: " + JSON.stringify(startPos) + ")"; + if (this.throwOnInvalidObject) + throw new Error(msg); + console.warn(msg); + var ref = this.parseIndirectObjectHeader(); + console.warn("Invalid object ref: " + ref); + this.skipWhitespaceAndComments(); + var start = this.bytes.offset(); + var failed = true; + while (!this.bytes.done()) { + if (this.matchKeyword(Keywords.endobj)) { + failed = false; + } + if (!failed) + break; + this.bytes.next(); + } + if (failed) + throw new PDFInvalidObjectParsingError(startPos); + var end = this.bytes.offset() - Keywords.endobj.length; + var object = PDFInvalidObject_default.of(this.bytes.slice(start, end)); + this.context.assign(ref, object); + return ref; + }; + PDFParser2.prototype.parseIndirectObjects = function() { + return __awaiter(this, void 0, void 0, function() { + var initialOffset, e_1; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + this.skipWhitespaceAndComments(); + _a3.label = 1; + case 1: + if (!(!this.bytes.done() && IsDigit[this.bytes.peek()])) return [3, 8]; + initialOffset = this.bytes.offset(); + _a3.label = 2; + case 2: + _a3.trys.push([2, 4, , 5]); + return [4, this.parseIndirectObject()]; + case 3: + _a3.sent(); + return [3, 5]; + case 4: + e_1 = _a3.sent(); + this.bytes.moveTo(initialOffset); + this.tryToParseInvalidIndirectObject(); + return [3, 5]; + case 5: + this.skipWhitespaceAndComments(); + this.skipJibberish(); + if (!this.shouldWaitForTick()) return [3, 7]; + return [4, waitForTick()]; + case 6: + _a3.sent(); + _a3.label = 7; + case 7: + return [3, 1]; + case 8: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFParser2.prototype.maybeParseCrossRefSection = function() { + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords.xref)) + return; + this.skipWhitespaceAndComments(); + var objectNumber = -1; + var xref = PDFCrossRefSection_default.createEmpty(); + while (!this.bytes.done() && IsDigit[this.bytes.peek()]) { + var firstInt = this.parseRawInt(); + this.skipWhitespaceAndComments(); + var secondInt = this.parseRawInt(); + this.skipWhitespaceAndComments(); + var byte = this.bytes.peek(); + if (byte === CharCodes_default.n || byte === CharCodes_default.f) { + var ref = PDFRef_default.of(objectNumber, secondInt); + if (this.bytes.next() === CharCodes_default.n) { + xref.addEntry(ref, firstInt); + } else { + xref.addDeletedEntry(ref, firstInt); + } + objectNumber += 1; + } else { + objectNumber = firstInt; + } + this.skipWhitespaceAndComments(); + } + return xref; + }; + PDFParser2.prototype.maybeParseTrailerDict = function() { + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords.trailer)) + return; + this.skipWhitespaceAndComments(); + var dict = this.parseDict(); + var context = this.context; + context.trailerInfo = { + Root: dict.get(PDFName_default.of("Root")) || context.trailerInfo.Root, + Encrypt: dict.get(PDFName_default.of("Encrypt")) || context.trailerInfo.Encrypt, + Info: dict.get(PDFName_default.of("Info")) || context.trailerInfo.Info, + ID: dict.get(PDFName_default.of("ID")) || context.trailerInfo.ID + }; + }; + PDFParser2.prototype.maybeParseTrailer = function() { + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords.startxref)) + return; + this.skipWhitespaceAndComments(); + var offset = this.parseRawInt(); + this.skipWhitespace(); + this.matchKeyword(Keywords.eof); + this.skipWhitespaceAndComments(); + this.matchKeyword(Keywords.eof); + this.skipWhitespaceAndComments(); + return PDFTrailer_default.forLastCrossRefSectionOffset(offset); + }; + PDFParser2.prototype.parseDocumentSection = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + return [4, this.parseIndirectObjects()]; + case 1: + _a3.sent(); + this.maybeParseCrossRefSection(); + this.maybeParseTrailerDict(); + this.maybeParseTrailer(); + this.skipJibberish(); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFParser2.prototype.skipJibberish = function() { + this.skipWhitespaceAndComments(); + while (!this.bytes.done()) { + var initialOffset = this.bytes.offset(); + var byte = this.bytes.peek(); + var isAlphaNumeric = byte >= CharCodes_default.Space && byte <= CharCodes_default.Tilde; + if (isAlphaNumeric) { + if (this.matchKeyword(Keywords.xref) || this.matchKeyword(Keywords.trailer) || this.matchKeyword(Keywords.startxref) || this.matchIndirectObjectHeader()) { + this.bytes.moveTo(initialOffset); + break; + } + } + this.bytes.next(); + } + }; + PDFParser2.prototype.skipBinaryHeaderComment = function() { + this.skipWhitespaceAndComments(); + try { + var initialOffset = this.bytes.offset(); + this.parseIndirectObjectHeader(); + this.bytes.moveTo(initialOffset); + } catch (e) { + this.bytes.next(); + this.skipWhitespaceAndComments(); + } + }; + PDFParser2.forBytesWithOptions = function(pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers) { + return new PDFParser2(pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers); + }; + return PDFParser2; + }(PDFObjectParser_default) +); +var PDFParser_default = PDFParser; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/annotation/flags.js +var flag2 = function(bitIndex) { + return 1 << bitIndex; +}; +var AnnotationFlags; +(function(AnnotationFlags2) { + AnnotationFlags2[AnnotationFlags2["Invisible"] = flag2(1 - 1)] = "Invisible"; + AnnotationFlags2[AnnotationFlags2["Hidden"] = flag2(2 - 1)] = "Hidden"; + AnnotationFlags2[AnnotationFlags2["Print"] = flag2(3 - 1)] = "Print"; + AnnotationFlags2[AnnotationFlags2["NoZoom"] = flag2(4 - 1)] = "NoZoom"; + AnnotationFlags2[AnnotationFlags2["NoRotate"] = flag2(5 - 1)] = "NoRotate"; + AnnotationFlags2[AnnotationFlags2["NoView"] = flag2(6 - 1)] = "NoView"; + AnnotationFlags2[AnnotationFlags2["ReadOnly"] = flag2(7 - 1)] = "ReadOnly"; + AnnotationFlags2[AnnotationFlags2["Locked"] = flag2(8 - 1)] = "Locked"; + AnnotationFlags2[AnnotationFlags2["ToggleNoView"] = flag2(9 - 1)] = "ToggleNoView"; + AnnotationFlags2[AnnotationFlags2["LockedContents"] = flag2(10 - 1)] = "LockedContents"; +})(AnnotationFlags || (AnnotationFlags = {})); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/objects.js +var asPDFName = function(name) { + return name instanceof PDFName_default ? name : PDFName_default.of(name); +}; +var asPDFNumber = function(num) { + return num instanceof PDFNumber_default ? num : PDFNumber_default.of(num); +}; +var asNumber = function(num) { + return num instanceof PDFNumber_default ? num.asNumber() : num; +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/rotations.js +var RotationTypes; +(function(RotationTypes2) { + RotationTypes2["Degrees"] = "degrees"; + RotationTypes2["Radians"] = "radians"; +})(RotationTypes || (RotationTypes = {})); +var degrees = function(degreeAngle) { + assertIs(degreeAngle, "degreeAngle", ["number"]); + return { type: RotationTypes.Degrees, angle: degreeAngle }; +}; +var Radians = RotationTypes.Radians; +var Degrees = RotationTypes.Degrees; +var degreesToRadians = function(degree) { + return degree * Math.PI / 180; +}; +var radiansToDegrees = function(radian) { + return radian * 180 / Math.PI; +}; +var toRadians = function(rotation) { + return rotation.type === Radians ? rotation.angle : rotation.type === Degrees ? degreesToRadians(rotation.angle) : error("Invalid rotation: " + JSON.stringify(rotation)); +}; +var toDegrees = function(rotation) { + return rotation.type === Radians ? radiansToDegrees(rotation.angle) : rotation.type === Degrees ? rotation.angle : error("Invalid rotation: " + JSON.stringify(rotation)); +}; +var reduceRotation = function(degreeAngle) { + if (degreeAngle === void 0) { + degreeAngle = 0; + } + var quadrants = degreeAngle / 90 % 4; + if (quadrants === 0) + return 0; + if (quadrants === 1) + return 90; + if (quadrants === 2) + return 180; + if (quadrants === 3) + return 270; + return 0; +}; +var adjustDimsForRotation = function(dims, degreeAngle) { + if (degreeAngle === void 0) { + degreeAngle = 0; + } + var rotation = reduceRotation(degreeAngle); + return rotation === 90 || rotation === 270 ? { width: dims.height, height: dims.width } : { width: dims.width, height: dims.height }; +}; +var rotateRectangle = function(rectangle, borderWidth, degreeAngle) { + if (borderWidth === void 0) { + borderWidth = 0; + } + if (degreeAngle === void 0) { + degreeAngle = 0; + } + var x = rectangle.x, y = rectangle.y, w = rectangle.width, h = rectangle.height; + var r2 = reduceRotation(degreeAngle); + var b = borderWidth / 2; + if (r2 === 0) + return { x: x - b, y: y - b, width: w, height: h }; + else if (r2 === 90) + return { x: x - h + b, y: y - b, width: h, height: w }; + else if (r2 === 180) + return { x: x - w + b, y: y - h + b, width: w, height: h }; + else if (r2 === 270) + return { x: x - b, y: y - w + b, width: h, height: w }; + else + return { x: x - b, y: y - b, width: w, height: h }; +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/operators.js +var clip = function() { + return PDFOperator_default.of(PDFOperatorNames_default.ClipNonZero); +}; +var cos = Math.cos; +var sin = Math.sin; +var tan = Math.tan; +var concatTransformationMatrix = function(a, b, c, d, e, f) { + return PDFOperator_default.of(PDFOperatorNames_default.ConcatTransformationMatrix, [ + asPDFNumber(a), + asPDFNumber(b), + asPDFNumber(c), + asPDFNumber(d), + asPDFNumber(e), + asPDFNumber(f) + ]); +}; +var translate = function(xPos, yPos) { + return concatTransformationMatrix(1, 0, 0, 1, xPos, yPos); +}; +var scale = function(xPos, yPos) { + return concatTransformationMatrix(xPos, 0, 0, yPos, 0, 0); +}; +var rotateRadians = function(angle) { + return concatTransformationMatrix(cos(asNumber(angle)), sin(asNumber(angle)), -sin(asNumber(angle)), cos(asNumber(angle)), 0, 0); +}; +var rotateDegrees = function(angle) { + return rotateRadians(degreesToRadians(asNumber(angle))); +}; +var skewRadians = function(xSkewAngle, ySkewAngle) { + return concatTransformationMatrix(1, tan(asNumber(xSkewAngle)), tan(asNumber(ySkewAngle)), 1, 0, 0); +}; +var setDashPattern = function(dashArray, dashPhase) { + return PDFOperator_default.of(PDFOperatorNames_default.SetLineDashPattern, [ + "[" + dashArray.map(asPDFNumber).join(" ") + "]", + asPDFNumber(dashPhase) + ]); +}; +var LineCapStyle; +(function(LineCapStyle2) { + LineCapStyle2[LineCapStyle2["Butt"] = 0] = "Butt"; + LineCapStyle2[LineCapStyle2["Round"] = 1] = "Round"; + LineCapStyle2[LineCapStyle2["Projecting"] = 2] = "Projecting"; +})(LineCapStyle || (LineCapStyle = {})); +var setLineCap = function(style) { + return PDFOperator_default.of(PDFOperatorNames_default.SetLineCapStyle, [asPDFNumber(style)]); +}; +var LineJoinStyle; +(function(LineJoinStyle2) { + LineJoinStyle2[LineJoinStyle2["Miter"] = 0] = "Miter"; + LineJoinStyle2[LineJoinStyle2["Round"] = 1] = "Round"; + LineJoinStyle2[LineJoinStyle2["Bevel"] = 2] = "Bevel"; +})(LineJoinStyle || (LineJoinStyle = {})); +var setGraphicsState = function(state2) { + return PDFOperator_default.of(PDFOperatorNames_default.SetGraphicsStateParams, [asPDFName(state2)]); +}; +var pushGraphicsState = function() { + return PDFOperator_default.of(PDFOperatorNames_default.PushGraphicsState); +}; +var popGraphicsState = function() { + return PDFOperator_default.of(PDFOperatorNames_default.PopGraphicsState); +}; +var setLineWidth = function(width) { + return PDFOperator_default.of(PDFOperatorNames_default.SetLineWidth, [asPDFNumber(width)]); +}; +var appendBezierCurve = function(x1, y1, x2, y2, x3, y3) { + return PDFOperator_default.of(PDFOperatorNames_default.AppendBezierCurve, [ + asPDFNumber(x1), + asPDFNumber(y1), + asPDFNumber(x2), + asPDFNumber(y2), + asPDFNumber(x3), + asPDFNumber(y3) + ]); +}; +var appendQuadraticCurve = function(x1, y1, x2, y2) { + return PDFOperator_default.of(PDFOperatorNames_default.CurveToReplicateInitialPoint, [ + asPDFNumber(x1), + asPDFNumber(y1), + asPDFNumber(x2), + asPDFNumber(y2) + ]); +}; +var closePath = function() { + return PDFOperator_default.of(PDFOperatorNames_default.ClosePath); +}; +var moveTo = function(xPos, yPos) { + return PDFOperator_default.of(PDFOperatorNames_default.MoveTo, [asPDFNumber(xPos), asPDFNumber(yPos)]); +}; +var lineTo = function(xPos, yPos) { + return PDFOperator_default.of(PDFOperatorNames_default.LineTo, [asPDFNumber(xPos), asPDFNumber(yPos)]); +}; +var stroke = function() { + return PDFOperator_default.of(PDFOperatorNames_default.StrokePath); +}; +var fill = function() { + return PDFOperator_default.of(PDFOperatorNames_default.FillNonZero); +}; +var fillAndStroke = function() { + return PDFOperator_default.of(PDFOperatorNames_default.FillNonZeroAndStroke); +}; +var endPath = function() { + return PDFOperator_default.of(PDFOperatorNames_default.EndPath); +}; +var nextLine = function() { + return PDFOperator_default.of(PDFOperatorNames_default.NextLine); +}; +var showText = function(text2) { + return PDFOperator_default.of(PDFOperatorNames_default.ShowText, [text2]); +}; +var beginText = function() { + return PDFOperator_default.of(PDFOperatorNames_default.BeginText); +}; +var endText = function() { + return PDFOperator_default.of(PDFOperatorNames_default.EndText); +}; +var setFontAndSize = function(name, size) { + return PDFOperator_default.of(PDFOperatorNames_default.SetFontAndSize, [asPDFName(name), asPDFNumber(size)]); +}; +var setLineHeight = function(lineHeight) { + return PDFOperator_default.of(PDFOperatorNames_default.SetTextLineHeight, [asPDFNumber(lineHeight)]); +}; +var TextRenderingMode; +(function(TextRenderingMode2) { + TextRenderingMode2[TextRenderingMode2["Fill"] = 0] = "Fill"; + TextRenderingMode2[TextRenderingMode2["Outline"] = 1] = "Outline"; + TextRenderingMode2[TextRenderingMode2["FillAndOutline"] = 2] = "FillAndOutline"; + TextRenderingMode2[TextRenderingMode2["Invisible"] = 3] = "Invisible"; + TextRenderingMode2[TextRenderingMode2["FillAndClip"] = 4] = "FillAndClip"; + TextRenderingMode2[TextRenderingMode2["OutlineAndClip"] = 5] = "OutlineAndClip"; + TextRenderingMode2[TextRenderingMode2["FillAndOutlineAndClip"] = 6] = "FillAndOutlineAndClip"; + TextRenderingMode2[TextRenderingMode2["Clip"] = 7] = "Clip"; +})(TextRenderingMode || (TextRenderingMode = {})); +var setTextMatrix = function(a, b, c, d, e, f) { + return PDFOperator_default.of(PDFOperatorNames_default.SetTextMatrix, [ + asPDFNumber(a), + asPDFNumber(b), + asPDFNumber(c), + asPDFNumber(d), + asPDFNumber(e), + asPDFNumber(f) + ]); +}; +var rotateAndSkewTextRadiansAndTranslate = function(rotationAngle, xSkewAngle, ySkewAngle, x, y) { + return setTextMatrix(cos(asNumber(rotationAngle)), sin(asNumber(rotationAngle)) + tan(asNumber(xSkewAngle)), -sin(asNumber(rotationAngle)) + tan(asNumber(ySkewAngle)), cos(asNumber(rotationAngle)), x, y); +}; +var drawObject = function(name) { + return PDFOperator_default.of(PDFOperatorNames_default.DrawObject, [asPDFName(name)]); +}; +var setFillingGrayscaleColor = function(gray) { + return PDFOperator_default.of(PDFOperatorNames_default.NonStrokingColorGray, [asPDFNumber(gray)]); +}; +var setStrokingGrayscaleColor = function(gray) { + return PDFOperator_default.of(PDFOperatorNames_default.StrokingColorGray, [asPDFNumber(gray)]); +}; +var setFillingRgbColor = function(red, green, blue) { + return PDFOperator_default.of(PDFOperatorNames_default.NonStrokingColorRgb, [ + asPDFNumber(red), + asPDFNumber(green), + asPDFNumber(blue) + ]); +}; +var setStrokingRgbColor = function(red, green, blue) { + return PDFOperator_default.of(PDFOperatorNames_default.StrokingColorRgb, [ + asPDFNumber(red), + asPDFNumber(green), + asPDFNumber(blue) + ]); +}; +var setFillingCmykColor = function(cyan, magenta, yellow, key) { + return PDFOperator_default.of(PDFOperatorNames_default.NonStrokingColorCmyk, [ + asPDFNumber(cyan), + asPDFNumber(magenta), + asPDFNumber(yellow), + asPDFNumber(key) + ]); +}; +var setStrokingCmykColor = function(cyan, magenta, yellow, key) { + return PDFOperator_default.of(PDFOperatorNames_default.StrokingColorCmyk, [ + asPDFNumber(cyan), + asPDFNumber(magenta), + asPDFNumber(yellow), + asPDFNumber(key) + ]); +}; +var beginMarkedContent = function(tag) { + return PDFOperator_default.of(PDFOperatorNames_default.BeginMarkedContent, [asPDFName(tag)]); +}; +var endMarkedContent = function() { + return PDFOperator_default.of(PDFOperatorNames_default.EndMarkedContent); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/colors.js +var ColorTypes; +(function(ColorTypes2) { + ColorTypes2["Grayscale"] = "Grayscale"; + ColorTypes2["RGB"] = "RGB"; + ColorTypes2["CMYK"] = "CMYK"; +})(ColorTypes || (ColorTypes = {})); +var grayscale = function(gray) { + assertRange(gray, "gray", 0, 1); + return { type: ColorTypes.Grayscale, gray }; +}; +var rgb = function(red, green, blue) { + assertRange(red, "red", 0, 1); + assertRange(green, "green", 0, 1); + assertRange(blue, "blue", 0, 1); + return { type: ColorTypes.RGB, red, green, blue }; +}; +var cmyk = function(cyan, magenta, yellow, key) { + assertRange(cyan, "cyan", 0, 1); + assertRange(magenta, "magenta", 0, 1); + assertRange(yellow, "yellow", 0, 1); + assertRange(key, "key", 0, 1); + return { type: ColorTypes.CMYK, cyan, magenta, yellow, key }; +}; +var Grayscale = ColorTypes.Grayscale; +var RGB = ColorTypes.RGB; +var CMYK = ColorTypes.CMYK; +var setFillingColor = function(color) { + return color.type === Grayscale ? setFillingGrayscaleColor(color.gray) : color.type === RGB ? setFillingRgbColor(color.red, color.green, color.blue) : color.type === CMYK ? setFillingCmykColor(color.cyan, color.magenta, color.yellow, color.key) : error("Invalid color: " + JSON.stringify(color)); +}; +var setStrokingColor = function(color) { + return color.type === Grayscale ? setStrokingGrayscaleColor(color.gray) : color.type === RGB ? setStrokingRgbColor(color.red, color.green, color.blue) : color.type === CMYK ? setStrokingCmykColor(color.cyan, color.magenta, color.yellow, color.key) : error("Invalid color: " + JSON.stringify(color)); +}; +var componentsToColor = function(comps, scale2) { + if (scale2 === void 0) { + scale2 = 1; + } + return (comps === null || comps === void 0 ? void 0 : comps.length) === 1 ? grayscale(comps[0] * scale2) : (comps === null || comps === void 0 ? void 0 : comps.length) === 3 ? rgb(comps[0] * scale2, comps[1] * scale2, comps[2] * scale2) : (comps === null || comps === void 0 ? void 0 : comps.length) === 4 ? cmyk(comps[0] * scale2, comps[1] * scale2, comps[2] * scale2, comps[3] * scale2) : void 0; +}; +var colorToComponents = function(color) { + return color.type === Grayscale ? [color.gray] : color.type === RGB ? [color.red, color.green, color.blue] : color.type === CMYK ? [color.cyan, color.magenta, color.yellow, color.key] : error("Invalid color: " + JSON.stringify(color)); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/svgPath.js +var cx = 0; +var cy = 0; +var px = 0; +var py = 0; +var sx = 0; +var sy = 0; +var parameters = /* @__PURE__ */ new Map([ + ["A", 7], + ["a", 7], + ["C", 6], + ["c", 6], + ["H", 1], + ["h", 1], + ["L", 2], + ["l", 2], + ["M", 2], + ["m", 2], + ["Q", 4], + ["q", 4], + ["S", 4], + ["s", 4], + ["T", 2], + ["t", 2], + ["V", 1], + ["v", 1], + ["Z", 0], + ["z", 0] +]); +var parse = function(path3) { + var cmd; + var ret = []; + var args = []; + var curArg = ""; + var foundDecimal = false; + var params = 0; + for (var _i = 0, path_1 = path3; _i < path_1.length; _i++) { + var c = path_1[_i]; + if (parameters.has(c)) { + params = parameters.get(c); + if (cmd) { + if (curArg.length > 0) { + args[args.length] = +curArg; + } + ret[ret.length] = { cmd, args }; + args = []; + curArg = ""; + foundDecimal = false; + } + cmd = c; + } else if ([" ", ","].includes(c) || c === "-" && curArg.length > 0 && curArg[curArg.length - 1] !== "e" || c === "." && foundDecimal) { + if (curArg.length === 0) { + continue; + } + if (args.length === params) { + ret[ret.length] = { cmd, args }; + args = [+curArg]; + if (cmd === "M") { + cmd = "L"; + } + if (cmd === "m") { + cmd = "l"; + } + } else { + args[args.length] = +curArg; + } + foundDecimal = c === "."; + curArg = ["-", "."].includes(c) ? c : ""; + } else { + curArg += c; + if (c === ".") { + foundDecimal = true; + } + } + } + if (curArg.length > 0) { + if (args.length === params) { + ret[ret.length] = { cmd, args }; + args = [+curArg]; + if (cmd === "M") { + cmd = "L"; + } + if (cmd === "m") { + cmd = "l"; + } + } else { + args[args.length] = +curArg; + } + } + ret[ret.length] = { cmd, args }; + return ret; +}; +var apply = function(commands) { + cx = cy = px = py = sx = sy = 0; + var cmds = []; + for (var i = 0; i < commands.length; i++) { + var c = commands[i]; + if (c.cmd && typeof runners[c.cmd] === "function") { + var cmd = runners[c.cmd](c.args); + if (Array.isArray(cmd)) { + cmds = cmds.concat(cmd); + } else { + cmds.push(cmd); + } + } + } + return cmds; +}; +var runners = { + M: function(a) { + cx = a[0]; + cy = a[1]; + px = py = null; + sx = cx; + sy = cy; + return moveTo(cx, cy); + }, + m: function(a) { + cx += a[0]; + cy += a[1]; + px = py = null; + sx = cx; + sy = cy; + return moveTo(cx, cy); + }, + C: function(a) { + cx = a[4]; + cy = a[5]; + px = a[2]; + py = a[3]; + return appendBezierCurve(a[0], a[1], a[2], a[3], a[4], a[5]); + }, + c: function(a) { + var cmd = appendBezierCurve(a[0] + cx, a[1] + cy, a[2] + cx, a[3] + cy, a[4] + cx, a[5] + cy); + px = cx + a[2]; + py = cy + a[3]; + cx += a[4]; + cy += a[5]; + return cmd; + }, + S: function(a) { + if (px === null || py === null) { + px = cx; + py = cy; + } + var cmd = appendBezierCurve(cx - (px - cx), cy - (py - cy), a[0], a[1], a[2], a[3]); + px = a[0]; + py = a[1]; + cx = a[2]; + cy = a[3]; + return cmd; + }, + s: function(a) { + if (px === null || py === null) { + px = cx; + py = cy; + } + var cmd = appendBezierCurve(cx - (px - cx), cy - (py - cy), cx + a[0], cy + a[1], cx + a[2], cy + a[3]); + px = cx + a[0]; + py = cy + a[1]; + cx += a[2]; + cy += a[3]; + return cmd; + }, + Q: function(a) { + px = a[0]; + py = a[1]; + cx = a[2]; + cy = a[3]; + return appendQuadraticCurve(a[0], a[1], cx, cy); + }, + q: function(a) { + var cmd = appendQuadraticCurve(a[0] + cx, a[1] + cy, a[2] + cx, a[3] + cy); + px = cx + a[0]; + py = cy + a[1]; + cx += a[2]; + cy += a[3]; + return cmd; + }, + T: function(a) { + if (px === null || py === null) { + px = cx; + py = cy; + } else { + px = cx - (px - cx); + py = cy - (py - cy); + } + var cmd = appendQuadraticCurve(px, py, a[0], a[1]); + px = cx - (px - cx); + py = cy - (py - cy); + cx = a[0]; + cy = a[1]; + return cmd; + }, + t: function(a) { + if (px === null || py === null) { + px = cx; + py = cy; + } else { + px = cx - (px - cx); + py = cy - (py - cy); + } + var cmd = appendQuadraticCurve(px, py, cx + a[0], cy + a[1]); + cx += a[0]; + cy += a[1]; + return cmd; + }, + A: function(a) { + var cmds = solveArc(cx, cy, a); + cx = a[5]; + cy = a[6]; + return cmds; + }, + a: function(a) { + a[5] += cx; + a[6] += cy; + var cmds = solveArc(cx, cy, a); + cx = a[5]; + cy = a[6]; + return cmds; + }, + L: function(a) { + cx = a[0]; + cy = a[1]; + px = py = null; + return lineTo(cx, cy); + }, + l: function(a) { + cx += a[0]; + cy += a[1]; + px = py = null; + return lineTo(cx, cy); + }, + H: function(a) { + cx = a[0]; + px = py = null; + return lineTo(cx, cy); + }, + h: function(a) { + cx += a[0]; + px = py = null; + return lineTo(cx, cy); + }, + V: function(a) { + cy = a[0]; + px = py = null; + return lineTo(cx, cy); + }, + v: function(a) { + cy += a[0]; + px = py = null; + return lineTo(cx, cy); + }, + Z: function() { + var cmd = closePath(); + cx = sx; + cy = sy; + return cmd; + }, + z: function() { + var cmd = closePath(); + cx = sx; + cy = sy; + return cmd; + } +}; +var solveArc = function(x, y, coords) { + var rx = coords[0], ry = coords[1], rot = coords[2], large = coords[3], sweep = coords[4], ex = coords[5], ey = coords[6]; + var segs = arcToSegments(ex, ey, rx, ry, large, sweep, rot, x, y); + var cmds = []; + for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { + var seg = segs_1[_i]; + var bez = segmentToBezier.apply(void 0, seg); + cmds.push(appendBezierCurve.apply(void 0, bez)); + } + return cmds; +}; +var arcToSegments = function(x, y, rx, ry, large, sweep, rotateX, ox, oy) { + var th = rotateX * (Math.PI / 180); + var sinTh = Math.sin(th); + var cosTh = Math.cos(th); + rx = Math.abs(rx); + ry = Math.abs(ry); + px = cosTh * (ox - x) * 0.5 + sinTh * (oy - y) * 0.5; + py = cosTh * (oy - y) * 0.5 - sinTh * (ox - x) * 0.5; + var pl = px * px / (rx * rx) + py * py / (ry * ry); + if (pl > 1) { + pl = Math.sqrt(pl); + rx *= pl; + ry *= pl; + } + var a00 = cosTh / rx; + var a01 = sinTh / rx; + var a10 = -sinTh / ry; + var a11 = cosTh / ry; + var x0 = a00 * ox + a01 * oy; + var y0 = a10 * ox + a11 * oy; + var x1 = a00 * x + a01 * y; + var y1 = a10 * x + a11 * y; + var d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); + var sfactorSq = 1 / d - 0.25; + if (sfactorSq < 0) { + sfactorSq = 0; + } + var sfactor = Math.sqrt(sfactorSq); + if (sweep === large) { + sfactor = -sfactor; + } + var xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); + var yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); + var th0 = Math.atan2(y0 - yc, x0 - xc); + var th1 = Math.atan2(y1 - yc, x1 - xc); + var thArc = th1 - th0; + if (thArc < 0 && sweep === 1) { + thArc += 2 * Math.PI; + } else if (thArc > 0 && sweep === 0) { + thArc -= 2 * Math.PI; + } + var segments = Math.ceil(Math.abs(thArc / (Math.PI * 0.5 + 1e-3))); + var result = []; + for (var i = 0; i < segments; i++) { + var th2 = th0 + i * thArc / segments; + var th3 = th0 + (i + 1) * thArc / segments; + result[i] = [xc, yc, th2, th3, rx, ry, sinTh, cosTh]; + } + return result; +}; +var segmentToBezier = function(cx1, cy1, th0, th1, rx, ry, sinTh, cosTh) { + var a00 = cosTh * rx; + var a01 = -sinTh * ry; + var a10 = sinTh * rx; + var a11 = cosTh * ry; + var thHalf = 0.5 * (th1 - th0); + var t = 8 / 3 * Math.sin(thHalf * 0.5) * Math.sin(thHalf * 0.5) / Math.sin(thHalf); + var x1 = cx1 + Math.cos(th0) - t * Math.sin(th0); + var y1 = cy1 + Math.sin(th0) + t * Math.cos(th0); + var x3 = cx1 + Math.cos(th1); + var y3 = cy1 + Math.sin(th1); + var x2 = x3 + t * Math.sin(th1); + var y2 = y3 - t * Math.cos(th1); + var result = [ + a00 * x1 + a01 * y1, + a10 * x1 + a11 * y1, + a00 * x2 + a01 * y2, + a10 * x2 + a11 * y2, + a00 * x3 + a01 * y3, + a10 * x3 + a11 * y3 + ]; + return result; +}; +var svgPathToOperators = function(path3) { + return apply(parse(path3)); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/operations.js +var drawLinesOfText = function(lines, options) { + var operators = [ + pushGraphicsState(), + options.graphicsState && setGraphicsState(options.graphicsState), + beginText(), + setFillingColor(options.color), + setFontAndSize(options.font, options.size), + setLineHeight(options.lineHeight), + rotateAndSkewTextRadiansAndTranslate(toRadians(options.rotate), toRadians(options.xSkew), toRadians(options.ySkew), options.x, options.y) + ].filter(Boolean); + for (var idx = 0, len = lines.length; idx < len; idx++) { + operators.push(showText(lines[idx]), nextLine()); + } + operators.push(endText(), popGraphicsState()); + return operators; +}; +var drawImage = function(name, options) { + return [ + pushGraphicsState(), + options.graphicsState && setGraphicsState(options.graphicsState), + translate(options.x, options.y), + rotateRadians(toRadians(options.rotate)), + scale(options.width, options.height), + skewRadians(toRadians(options.xSkew), toRadians(options.ySkew)), + drawObject(name), + popGraphicsState() + ].filter(Boolean); +}; +var drawPage = function(name, options) { + return [ + pushGraphicsState(), + options.graphicsState && setGraphicsState(options.graphicsState), + translate(options.x, options.y), + rotateRadians(toRadians(options.rotate)), + scale(options.xScale, options.yScale), + skewRadians(toRadians(options.xSkew), toRadians(options.ySkew)), + drawObject(name), + popGraphicsState() + ].filter(Boolean); +}; +var drawLine = function(options) { + var _a3, _b3; + return [ + pushGraphicsState(), + options.graphicsState && setGraphicsState(options.graphicsState), + options.color && setStrokingColor(options.color), + setLineWidth(options.thickness), + setDashPattern((_a3 = options.dashArray) !== null && _a3 !== void 0 ? _a3 : [], (_b3 = options.dashPhase) !== null && _b3 !== void 0 ? _b3 : 0), + moveTo(options.start.x, options.start.y), + options.lineCap && setLineCap(options.lineCap), + moveTo(options.start.x, options.start.y), + lineTo(options.end.x, options.end.y), + stroke(), + popGraphicsState() + ].filter(Boolean); +}; +var drawRectangle = function(options) { + var _a3, _b3; + return [ + pushGraphicsState(), + options.graphicsState && setGraphicsState(options.graphicsState), + options.color && setFillingColor(options.color), + options.borderColor && setStrokingColor(options.borderColor), + setLineWidth(options.borderWidth), + options.borderLineCap && setLineCap(options.borderLineCap), + setDashPattern((_a3 = options.borderDashArray) !== null && _a3 !== void 0 ? _a3 : [], (_b3 = options.borderDashPhase) !== null && _b3 !== void 0 ? _b3 : 0), + translate(options.x, options.y), + rotateRadians(toRadians(options.rotate)), + skewRadians(toRadians(options.xSkew), toRadians(options.ySkew)), + moveTo(0, 0), + lineTo(0, options.height), + lineTo(options.width, options.height), + lineTo(options.width, 0), + closePath(), + // prettier-ignore + options.color && options.borderWidth ? fillAndStroke() : options.color ? fill() : options.borderColor ? stroke() : closePath(), + popGraphicsState() + ].filter(Boolean); +}; +var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3); +var drawEllipsePath = function(config) { + var x = asNumber(config.x); + var y = asNumber(config.y); + var xScale = asNumber(config.xScale); + var yScale = asNumber(config.yScale); + x -= xScale; + y -= yScale; + var ox = xScale * KAPPA; + var oy = yScale * KAPPA; + var xe = x + xScale * 2; + var ye = y + yScale * 2; + var xm = x + xScale; + var ym = y + yScale; + return [ + pushGraphicsState(), + moveTo(x, ym), + appendBezierCurve(x, ym - oy, xm - ox, y, xm, y), + appendBezierCurve(xm + ox, y, xe, ym - oy, xe, ym), + appendBezierCurve(xe, ym + oy, xm + ox, ye, xm, ye), + appendBezierCurve(xm - ox, ye, x, ym + oy, x, ym), + popGraphicsState() + ]; +}; +var drawEllipseCurves = function(config) { + var centerX = asNumber(config.x); + var centerY = asNumber(config.y); + var xScale = asNumber(config.xScale); + var yScale = asNumber(config.yScale); + var x = -xScale; + var y = -yScale; + var ox = xScale * KAPPA; + var oy = yScale * KAPPA; + var xe = x + xScale * 2; + var ye = y + yScale * 2; + var xm = x + xScale; + var ym = y + yScale; + return [ + translate(centerX, centerY), + rotateRadians(toRadians(config.rotate)), + moveTo(x, ym), + appendBezierCurve(x, ym - oy, xm - ox, y, xm, y), + appendBezierCurve(xm + ox, y, xe, ym - oy, xe, ym), + appendBezierCurve(xe, ym + oy, xm + ox, ye, xm, ye), + appendBezierCurve(xm - ox, ye, x, ym + oy, x, ym) + ]; +}; +var drawEllipse = function(options) { + var _a3, _b3, _c2; + return __spreadArrays([ + pushGraphicsState(), + options.graphicsState && setGraphicsState(options.graphicsState), + options.color && setFillingColor(options.color), + options.borderColor && setStrokingColor(options.borderColor), + setLineWidth(options.borderWidth), + options.borderLineCap && setLineCap(options.borderLineCap), + setDashPattern((_a3 = options.borderDashArray) !== null && _a3 !== void 0 ? _a3 : [], (_b3 = options.borderDashPhase) !== null && _b3 !== void 0 ? _b3 : 0) + ], options.rotate === void 0 ? drawEllipsePath({ + x: options.x, + y: options.y, + xScale: options.xScale, + yScale: options.yScale + }) : drawEllipseCurves({ + x: options.x, + y: options.y, + xScale: options.xScale, + yScale: options.yScale, + rotate: (_c2 = options.rotate) !== null && _c2 !== void 0 ? _c2 : degrees(0) + }), [ + // prettier-ignore + options.color && options.borderWidth ? fillAndStroke() : options.color ? fill() : options.borderColor ? stroke() : closePath(), + popGraphicsState() + ]).filter(Boolean); +}; +var drawSvgPath = function(path3, options) { + var _a3, _b3, _c2; + return __spreadArrays([ + pushGraphicsState(), + options.graphicsState && setGraphicsState(options.graphicsState), + translate(options.x, options.y), + rotateRadians(toRadians((_a3 = options.rotate) !== null && _a3 !== void 0 ? _a3 : degrees(0))), + // SVG path Y axis is opposite pdf-lib's + options.scale ? scale(options.scale, -options.scale) : scale(1, -1), + options.color && setFillingColor(options.color), + options.borderColor && setStrokingColor(options.borderColor), + options.borderWidth && setLineWidth(options.borderWidth), + options.borderLineCap && setLineCap(options.borderLineCap), + setDashPattern((_b3 = options.borderDashArray) !== null && _b3 !== void 0 ? _b3 : [], (_c2 = options.borderDashPhase) !== null && _c2 !== void 0 ? _c2 : 0) + ], svgPathToOperators(path3), [ + // prettier-ignore + options.color && options.borderWidth ? fillAndStroke() : options.color ? fill() : options.borderColor ? stroke() : closePath(), + popGraphicsState() + ]).filter(Boolean); +}; +var drawCheckMark = function(options) { + var size = asNumber(options.size); + var p2x = -1 + 0.75; + var p2y = -1 + 0.51; + var p3y = 1 - 0.525; + var p3x = 1 - 0.31; + var p1x = -1 + 0.325; + var p1y = -((p1x - p2x) * (p3x - p2x)) / (p3y - p2y) + p2y; + return [ + pushGraphicsState(), + options.color && setStrokingColor(options.color), + setLineWidth(options.thickness), + translate(options.x, options.y), + moveTo(p1x * size, p1y * size), + lineTo(p2x * size, p2y * size), + lineTo(p3x * size, p3y * size), + stroke(), + popGraphicsState() + ].filter(Boolean); +}; +var rotateInPlace = function(options) { + return options.rotation === 0 ? [ + translate(0, 0), + rotateDegrees(0) + ] : options.rotation === 90 ? [ + translate(options.width, 0), + rotateDegrees(90) + ] : options.rotation === 180 ? [ + translate(options.width, options.height), + rotateDegrees(180) + ] : options.rotation === 270 ? [ + translate(0, options.height), + rotateDegrees(270) + ] : []; +}; +var drawCheckBox = function(options) { + var outline = drawRectangle({ + x: options.x, + y: options.y, + width: options.width, + height: options.height, + borderWidth: options.borderWidth, + color: options.color, + borderColor: options.borderColor, + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + }); + if (!options.filled) + return outline; + var width = asNumber(options.width); + var height = asNumber(options.height); + var checkMarkSize = Math.min(width, height) / 2; + var checkMark = drawCheckMark({ + x: width / 2, + y: height / 2, + size: checkMarkSize, + thickness: options.thickness, + color: options.markColor + }); + return __spreadArrays([pushGraphicsState()], outline, checkMark, [popGraphicsState()]); +}; +var drawRadioButton = function(options) { + var width = asNumber(options.width); + var height = asNumber(options.height); + var outlineScale = Math.min(width, height) / 2; + var outline = drawEllipse({ + x: options.x, + y: options.y, + xScale: outlineScale, + yScale: outlineScale, + color: options.color, + borderColor: options.borderColor, + borderWidth: options.borderWidth + }); + if (!options.filled) + return outline; + var dot = drawEllipse({ + x: options.x, + y: options.y, + xScale: outlineScale * 0.45, + yScale: outlineScale * 0.45, + color: options.dotColor, + borderColor: void 0, + borderWidth: 0 + }); + return __spreadArrays([pushGraphicsState()], outline, dot, [popGraphicsState()]); +}; +var drawButton = function(options) { + var x = asNumber(options.x); + var y = asNumber(options.y); + var width = asNumber(options.width); + var height = asNumber(options.height); + var background = drawRectangle({ + x, + y, + width, + height, + borderWidth: options.borderWidth, + color: options.color, + borderColor: options.borderColor, + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + }); + var lines = drawTextLines(options.textLines, { + color: options.textColor, + font: options.font, + size: options.fontSize, + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + }); + return __spreadArrays([pushGraphicsState()], background, lines, [popGraphicsState()]); +}; +var drawTextLines = function(lines, options) { + var operators = [ + beginText(), + setFillingColor(options.color), + setFontAndSize(options.font, options.size) + ]; + for (var idx = 0, len = lines.length; idx < len; idx++) { + var _a3 = lines[idx], encoded = _a3.encoded, x = _a3.x, y = _a3.y; + operators.push(rotateAndSkewTextRadiansAndTranslate(toRadians(options.rotate), toRadians(options.xSkew), toRadians(options.ySkew), x, y), showText(encoded)); + } + operators.push(endText()); + return operators; +}; +var drawTextField = function(options) { + var x = asNumber(options.x); + var y = asNumber(options.y); + var width = asNumber(options.width); + var height = asNumber(options.height); + var borderWidth = asNumber(options.borderWidth); + var padding = asNumber(options.padding); + var clipX = x + borderWidth / 2 + padding; + var clipY = y + borderWidth / 2 + padding; + var clipWidth = width - (borderWidth / 2 + padding) * 2; + var clipHeight = height - (borderWidth / 2 + padding) * 2; + var clippingArea = [ + moveTo(clipX, clipY), + lineTo(clipX, clipY + clipHeight), + lineTo(clipX + clipWidth, clipY + clipHeight), + lineTo(clipX + clipWidth, clipY), + closePath(), + clip(), + endPath() + ]; + var background = drawRectangle({ + x, + y, + width, + height, + borderWidth: options.borderWidth, + color: options.color, + borderColor: options.borderColor, + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + }); + var lines = drawTextLines(options.textLines, { + color: options.textColor, + font: options.font, + size: options.fontSize, + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + }); + var markedContent = __spreadArrays([ + beginMarkedContent("Tx"), + pushGraphicsState() + ], lines, [ + popGraphicsState(), + endMarkedContent() + ]); + return __spreadArrays([ + pushGraphicsState() + ], background, clippingArea, markedContent, [ + popGraphicsState() + ]); +}; +var drawOptionList = function(options) { + var x = asNumber(options.x); + var y = asNumber(options.y); + var width = asNumber(options.width); + var height = asNumber(options.height); + var lineHeight = asNumber(options.lineHeight); + var borderWidth = asNumber(options.borderWidth); + var padding = asNumber(options.padding); + var clipX = x + borderWidth / 2 + padding; + var clipY = y + borderWidth / 2 + padding; + var clipWidth = width - (borderWidth / 2 + padding) * 2; + var clipHeight = height - (borderWidth / 2 + padding) * 2; + var clippingArea = [ + moveTo(clipX, clipY), + lineTo(clipX, clipY + clipHeight), + lineTo(clipX + clipWidth, clipY + clipHeight), + lineTo(clipX + clipWidth, clipY), + closePath(), + clip(), + endPath() + ]; + var background = drawRectangle({ + x, + y, + width, + height, + borderWidth: options.borderWidth, + color: options.color, + borderColor: options.borderColor, + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + }); + var highlights = []; + for (var idx = 0, len = options.selectedLines.length; idx < len; idx++) { + var line = options.textLines[options.selectedLines[idx]]; + highlights.push.apply(highlights, drawRectangle({ + x: line.x - padding, + y: line.y - (lineHeight - line.height) / 2, + width: width - borderWidth, + height: line.height + (lineHeight - line.height) / 2, + borderWidth: 0, + color: options.selectedColor, + borderColor: void 0, + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + })); + } + var lines = drawTextLines(options.textLines, { + color: options.textColor, + font: options.font, + size: options.fontSize, + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + }); + var markedContent = __spreadArrays([ + beginMarkedContent("Tx"), + pushGraphicsState() + ], lines, [ + popGraphicsState(), + endMarkedContent() + ]); + return __spreadArrays([ + pushGraphicsState() + ], background, highlights, clippingArea, markedContent, [ + popGraphicsState() + ]); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/errors.js +var EncryptedPDFError = ( + /** @class */ + function(_super) { + __extends(EncryptedPDFError2, _super); + function EncryptedPDFError2() { + var _this = this; + var msg = "Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways."; + _this = _super.call(this, msg) || this; + return _this; + } + return EncryptedPDFError2; + }(Error) +); +var FontkitNotRegisteredError = ( + /** @class */ + function(_super) { + __extends(FontkitNotRegisteredError2, _super); + function FontkitNotRegisteredError2() { + var _this = this; + var msg = "Input to `PDFDocument.embedFont` was a custom font, but no `fontkit` instance was found. You must register a `fontkit` instance with `PDFDocument.registerFontkit(...)` before embedding custom fonts."; + _this = _super.call(this, msg) || this; + return _this; + } + return FontkitNotRegisteredError2; + }(Error) +); +var ForeignPageError = ( + /** @class */ + function(_super) { + __extends(ForeignPageError2, _super); + function ForeignPageError2() { + var _this = this; + var msg = "A `page` passed to `PDFDocument.addPage` or `PDFDocument.insertPage` was from a different (foreign) PDF document. If you want to copy pages from one PDFDocument to another, you must use `PDFDocument.copyPages(...)` to copy the pages before adding or inserting them."; + _this = _super.call(this, msg) || this; + return _this; + } + return ForeignPageError2; + }(Error) +); +var RemovePageFromEmptyDocumentError = ( + /** @class */ + function(_super) { + __extends(RemovePageFromEmptyDocumentError2, _super); + function RemovePageFromEmptyDocumentError2() { + var _this = this; + var msg = "PDFDocument has no pages so `PDFDocument.removePage` cannot be called"; + _this = _super.call(this, msg) || this; + return _this; + } + return RemovePageFromEmptyDocumentError2; + }(Error) +); +var NoSuchFieldError = ( + /** @class */ + function(_super) { + __extends(NoSuchFieldError2, _super); + function NoSuchFieldError2(name) { + var _this = this; + var msg = 'PDFDocument has no form field with the name "' + name + '"'; + _this = _super.call(this, msg) || this; + return _this; + } + return NoSuchFieldError2; + }(Error) +); +var UnexpectedFieldTypeError = ( + /** @class */ + function(_super) { + __extends(UnexpectedFieldTypeError2, _super); + function UnexpectedFieldTypeError2(name, expected, actual) { + var _a3, _b3; + var _this = this; + var expectedType = expected === null || expected === void 0 ? void 0 : expected.name; + var actualType = (_b3 = (_a3 = actual === null || actual === void 0 ? void 0 : actual.constructor) === null || _a3 === void 0 ? void 0 : _a3.name) !== null && _b3 !== void 0 ? _b3 : actual; + var msg = 'Expected field "' + name + '" to be of type ' + expectedType + ", " + ("but it is actually of type " + actualType); + _this = _super.call(this, msg) || this; + return _this; + } + return UnexpectedFieldTypeError2; + }(Error) +); +var MissingOnValueCheckError = ( + /** @class */ + function(_super) { + __extends(MissingOnValueCheckError2, _super); + function MissingOnValueCheckError2(onValue) { + var _this = this; + var msg = 'Failed to select check box due to missing onValue: "' + onValue + '"'; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingOnValueCheckError2; + }(Error) +); +var FieldAlreadyExistsError = ( + /** @class */ + function(_super) { + __extends(FieldAlreadyExistsError2, _super); + function FieldAlreadyExistsError2(name) { + var _this = this; + var msg = 'A field already exists with the specified name: "' + name + '"'; + _this = _super.call(this, msg) || this; + return _this; + } + return FieldAlreadyExistsError2; + }(Error) +); +var InvalidFieldNamePartError = ( + /** @class */ + function(_super) { + __extends(InvalidFieldNamePartError2, _super); + function InvalidFieldNamePartError2(namePart) { + var _this = this; + var msg = 'Field name contains invalid component: "' + namePart + '"'; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidFieldNamePartError2; + }(Error) +); +var FieldExistsAsNonTerminalError = ( + /** @class */ + function(_super) { + __extends(FieldExistsAsNonTerminalError2, _super); + function FieldExistsAsNonTerminalError2(name) { + var _this = this; + var msg = 'A non-terminal field already exists with the specified name: "' + name + '"'; + _this = _super.call(this, msg) || this; + return _this; + } + return FieldExistsAsNonTerminalError2; + }(Error) +); +var RichTextFieldReadError = ( + /** @class */ + function(_super) { + __extends(RichTextFieldReadError2, _super); + function RichTextFieldReadError2(fieldName) { + var _this = this; + var msg = "Reading rich text fields is not supported: Attempted to read rich text field: " + fieldName; + _this = _super.call(this, msg) || this; + return _this; + } + return RichTextFieldReadError2; + }(Error) +); +var CombedTextLayoutError = ( + /** @class */ + function(_super) { + __extends(CombedTextLayoutError2, _super); + function CombedTextLayoutError2(lineLength, cellCount) { + var _this = this; + var msg = "Failed to layout combed text as lineLength=" + lineLength + " is greater than cellCount=" + cellCount; + _this = _super.call(this, msg) || this; + return _this; + } + return CombedTextLayoutError2; + }(Error) +); +var ExceededMaxLengthError = ( + /** @class */ + function(_super) { + __extends(ExceededMaxLengthError2, _super); + function ExceededMaxLengthError2(textLength, maxLength, name) { + var _this = this; + var msg = "Attempted to set text with length=" + textLength + " for TextField with maxLength=" + maxLength + " and name=" + name; + _this = _super.call(this, msg) || this; + return _this; + } + return ExceededMaxLengthError2; + }(Error) +); +var InvalidMaxLengthError = ( + /** @class */ + function(_super) { + __extends(InvalidMaxLengthError2, _super); + function InvalidMaxLengthError2(textLength, maxLength, name) { + var _this = this; + var msg = "Attempted to set maxLength=" + maxLength + ", which is less than " + textLength + ", the length of this field's current value (name=" + name + ")"; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidMaxLengthError2; + }(Error) +); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/text/alignment.js +var TextAlignment; +(function(TextAlignment2) { + TextAlignment2[TextAlignment2["Left"] = 0] = "Left"; + TextAlignment2[TextAlignment2["Center"] = 1] = "Center"; + TextAlignment2[TextAlignment2["Right"] = 2] = "Right"; +})(TextAlignment || (TextAlignment = {})); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/text/layout.js +var MIN_FONT_SIZE = 4; +var MAX_FONT_SIZE = 500; +var computeFontSize = function(lines, font, bounds, multiline) { + if (multiline === void 0) { + multiline = false; + } + var fontSize = MIN_FONT_SIZE; + while (fontSize < MAX_FONT_SIZE) { + var linesUsed = 0; + for (var lineIdx = 0, lineLen = lines.length; lineIdx < lineLen; lineIdx++) { + linesUsed += 1; + var line = lines[lineIdx]; + var words = line.split(" "); + var spaceInLineRemaining = bounds.width; + for (var idx = 0, len = words.length; idx < len; idx++) { + var isLastWord = idx === len - 1; + var word = isLastWord ? words[idx] : words[idx] + " "; + var widthOfWord = font.widthOfTextAtSize(word, fontSize); + spaceInLineRemaining -= widthOfWord; + if (spaceInLineRemaining <= 0) { + linesUsed += 1; + spaceInLineRemaining = bounds.width - widthOfWord; + } + } + } + if (!multiline && linesUsed > lines.length) + return fontSize - 1; + var height = font.heightAtSize(fontSize); + var lineHeight = height + height * 0.2; + var totalHeight = lineHeight * linesUsed; + if (totalHeight > Math.abs(bounds.height)) + return fontSize - 1; + fontSize += 1; + } + return fontSize; +}; +var computeCombedFontSize = function(line, font, bounds, cellCount) { + var cellWidth = bounds.width / cellCount; + var cellHeight = bounds.height; + var fontSize = MIN_FONT_SIZE; + var chars3 = charSplit(line); + while (fontSize < MAX_FONT_SIZE) { + for (var idx = 0, len = chars3.length; idx < len; idx++) { + var c = chars3[idx]; + var tooLong = font.widthOfTextAtSize(c, fontSize) > cellWidth * 0.75; + if (tooLong) + return fontSize - 1; + } + var height = font.heightAtSize(fontSize, { descender: false }); + if (height > cellHeight) + return fontSize - 1; + fontSize += 1; + } + return fontSize; +}; +var lastIndexOfWhitespace = function(line) { + for (var idx = line.length; idx > 0; idx--) { + if (/\s/.test(line[idx])) + return idx; + } + return void 0; +}; +var splitOutLines = function(input, maxWidth, font, fontSize) { + var _a3; + var lastWhitespaceIdx = input.length; + while (lastWhitespaceIdx > 0) { + var line = input.substring(0, lastWhitespaceIdx); + var encoded = font.encodeText(line); + var width = font.widthOfTextAtSize(line, fontSize); + if (width < maxWidth) { + var remainder = input.substring(lastWhitespaceIdx) || void 0; + return { line, encoded, width, remainder }; + } + lastWhitespaceIdx = (_a3 = lastIndexOfWhitespace(line)) !== null && _a3 !== void 0 ? _a3 : 0; + } + return { + line: input, + encoded: font.encodeText(input), + width: font.widthOfTextAtSize(input, fontSize), + remainder: void 0 + }; +}; +var layoutMultilineText = function(text2, _a3) { + var alignment = _a3.alignment, fontSize = _a3.fontSize, font = _a3.font, bounds = _a3.bounds; + var lines = lineSplit(cleanText(text2)); + if (fontSize === void 0 || fontSize === 0) { + fontSize = computeFontSize(lines, font, bounds, true); + } + var height = font.heightAtSize(fontSize); + var lineHeight = height + height * 0.2; + var textLines = []; + var minX = bounds.x; + var minY = bounds.y; + var maxX = bounds.x + bounds.width; + var maxY = bounds.y + bounds.height; + var y = bounds.y + bounds.height; + for (var idx = 0, len = lines.length; idx < len; idx++) { + var prevRemainder = lines[idx]; + while (prevRemainder !== void 0) { + var _b3 = splitOutLines(prevRemainder, bounds.width, font, fontSize), line = _b3.line, encoded = _b3.encoded, width = _b3.width, remainder = _b3.remainder; + var x = alignment === TextAlignment.Left ? bounds.x : alignment === TextAlignment.Center ? bounds.x + bounds.width / 2 - width / 2 : alignment === TextAlignment.Right ? bounds.x + bounds.width - width : bounds.x; + y -= lineHeight; + if (x < minX) + minX = x; + if (y < minY) + minY = y; + if (x + width > maxX) + maxX = x + width; + if (y + height > maxY) + maxY = y + height; + textLines.push({ text: line, encoded, width, height, x, y }); + prevRemainder = remainder === null || remainder === void 0 ? void 0 : remainder.trim(); + } + } + return { + fontSize, + lineHeight, + lines: textLines, + bounds: { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY + } + }; +}; +var layoutCombedText = function(text2, _a3) { + var fontSize = _a3.fontSize, font = _a3.font, bounds = _a3.bounds, cellCount = _a3.cellCount; + var line = mergeLines(cleanText(text2)); + if (line.length > cellCount) { + throw new CombedTextLayoutError(line.length, cellCount); + } + if (fontSize === void 0 || fontSize === 0) { + fontSize = computeCombedFontSize(line, font, bounds, cellCount); + } + var cellWidth = bounds.width / cellCount; + var height = font.heightAtSize(fontSize, { descender: false }); + var y = bounds.y + (bounds.height / 2 - height / 2); + var cells = []; + var minX = bounds.x; + var minY = bounds.y; + var maxX = bounds.x + bounds.width; + var maxY = bounds.y + bounds.height; + var cellOffset = 0; + var charOffset = 0; + while (cellOffset < cellCount) { + var _b3 = charAtIndex(line, charOffset), char = _b3[0], charLength = _b3[1]; + var encoded = font.encodeText(char); + var width = font.widthOfTextAtSize(char, fontSize); + var cellCenter = bounds.x + (cellWidth * cellOffset + cellWidth / 2); + var x = cellCenter - width / 2; + if (x < minX) + minX = x; + if (y < minY) + minY = y; + if (x + width > maxX) + maxX = x + width; + if (y + height > maxY) + maxY = y + height; + cells.push({ text: line, encoded, width, height, x, y }); + cellOffset += 1; + charOffset += charLength; + } + return { + fontSize, + cells, + bounds: { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY + } + }; +}; +var layoutSinglelineText = function(text2, _a3) { + var alignment = _a3.alignment, fontSize = _a3.fontSize, font = _a3.font, bounds = _a3.bounds; + var line = mergeLines(cleanText(text2)); + if (fontSize === void 0 || fontSize === 0) { + fontSize = computeFontSize([line], font, bounds); + } + var encoded = font.encodeText(line); + var width = font.widthOfTextAtSize(line, fontSize); + var height = font.heightAtSize(fontSize, { descender: false }); + var x = alignment === TextAlignment.Left ? bounds.x : alignment === TextAlignment.Center ? bounds.x + bounds.width / 2 - width / 2 : alignment === TextAlignment.Right ? bounds.x + bounds.width - width : bounds.x; + var y = bounds.y + (bounds.height / 2 - height / 2); + return { + fontSize, + line: { text: line, encoded, width, height, x, y }, + bounds: { x, y, width, height } + }; +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/appearances.js +var normalizeAppearance = function(appearance) { + if ("normal" in appearance) + return appearance; + return { normal: appearance }; +}; +var tfRegex2 = /\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/; +var getDefaultFontSize = function(field) { + var _a3, _b3; + var da = (_a3 = field.getDefaultAppearance()) !== null && _a3 !== void 0 ? _a3 : ""; + var daMatch = (_b3 = findLastMatch(da, tfRegex2).match) !== null && _b3 !== void 0 ? _b3 : []; + var defaultFontSize = Number(daMatch[2]); + return isFinite(defaultFontSize) ? defaultFontSize : void 0; +}; +var colorRegex = /(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/; +var getDefaultColor = function(field) { + var _a3; + var da = (_a3 = field.getDefaultAppearance()) !== null && _a3 !== void 0 ? _a3 : ""; + var daMatch = findLastMatch(da, colorRegex).match; + var _b3 = daMatch !== null && daMatch !== void 0 ? daMatch : [], c1 = _b3[1], c2 = _b3[2], c3 = _b3[3], c4 = _b3[4], colorSpace = _b3[5]; + if (colorSpace === "g" && c1) { + return grayscale(Number(c1)); + } + if (colorSpace === "rg" && c1 && c2 && c3) { + return rgb(Number(c1), Number(c2), Number(c3)); + } + if (colorSpace === "k" && c1 && c2 && c3 && c4) { + return cmyk(Number(c1), Number(c2), Number(c3), Number(c4)); + } + return void 0; +}; +var updateDefaultAppearance = function(field, color, font, fontSize) { + var _a3; + if (fontSize === void 0) { + fontSize = 0; + } + var da = [ + setFillingColor(color).toString(), + setFontAndSize((_a3 = font === null || font === void 0 ? void 0 : font.name) !== null && _a3 !== void 0 ? _a3 : "dummy__noop", fontSize).toString() + ].join("\n"); + field.setDefaultAppearance(da); +}; +var defaultCheckBoxAppearanceProvider = function(checkBox, widget) { + var _a3, _b3, _c2; + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(checkBox.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var borderWidth = (_a3 = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a3 !== void 0 ? _a3 : 0; + var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _d = adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height; + var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation })); + var black = rgb(0, 0, 0); + var borderColor = (_b3 = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor())) !== null && _b3 !== void 0 ? _b3 : black; + var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var downBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8); + var textColor = (_c2 = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c2 !== void 0 ? _c2 : black; + if (widgetColor) { + updateDefaultAppearance(widget, textColor); + } else { + updateDefaultAppearance(checkBox.acroField, textColor); + } + var options = { + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + thickness: 1.5, + borderWidth, + borderColor, + markColor: textColor + }; + return { + normal: { + on: __spreadArrays(rotate, drawCheckBox(__assign(__assign({}, options), { color: normalBackgroundColor, filled: true }))), + off: __spreadArrays(rotate, drawCheckBox(__assign(__assign({}, options), { color: normalBackgroundColor, filled: false }))) + }, + down: { + on: __spreadArrays(rotate, drawCheckBox(__assign(__assign({}, options), { color: downBackgroundColor, filled: true }))), + off: __spreadArrays(rotate, drawCheckBox(__assign(__assign({}, options), { color: downBackgroundColor, filled: false }))) + } + }; +}; +var defaultRadioGroupAppearanceProvider = function(radioGroup, widget) { + var _a3, _b3, _c2; + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(radioGroup.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var borderWidth = (_a3 = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a3 !== void 0 ? _a3 : 0; + var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _d = adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height; + var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation })); + var black = rgb(0, 0, 0); + var borderColor = (_b3 = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor())) !== null && _b3 !== void 0 ? _b3 : black; + var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var downBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8); + var textColor = (_c2 = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c2 !== void 0 ? _c2 : black; + if (widgetColor) { + updateDefaultAppearance(widget, textColor); + } else { + updateDefaultAppearance(radioGroup.acroField, textColor); + } + var options = { + x: width / 2, + y: height / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth, + borderColor, + dotColor: textColor + }; + return { + normal: { + on: __spreadArrays(rotate, drawRadioButton(__assign(__assign({}, options), { color: normalBackgroundColor, filled: true }))), + off: __spreadArrays(rotate, drawRadioButton(__assign(__assign({}, options), { color: normalBackgroundColor, filled: false }))) + }, + down: { + on: __spreadArrays(rotate, drawRadioButton(__assign(__assign({}, options), { color: downBackgroundColor, filled: true }))), + off: __spreadArrays(rotate, drawRadioButton(__assign(__assign({}, options), { color: downBackgroundColor, filled: false }))) + } + }; +}; +var defaultButtonAppearanceProvider = function(button, widget, font) { + var _a3, _b3, _c2, _d, _e; + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(button.acroField); + var widgetFontSize = getDefaultFontSize(widget); + var fieldFontSize = getDefaultFontSize(button.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var captions = ap === null || ap === void 0 ? void 0 : ap.getCaptions(); + var normalText = (_a3 = captions === null || captions === void 0 ? void 0 : captions.normal) !== null && _a3 !== void 0 ? _a3 : ""; + var downText = (_c2 = (_b3 = captions === null || captions === void 0 ? void 0 : captions.down) !== null && _b3 !== void 0 ? _b3 : normalText) !== null && _c2 !== void 0 ? _c2 : ""; + var borderWidth = (_d = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _d !== void 0 ? _d : 0; + var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _f = adjustDimsForRotation(rectangle, rotation), width = _f.width, height = _f.height; + var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation })); + var black = rgb(0, 0, 0); + var borderColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor()); + var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var downBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8); + var bounds = { + x: borderWidth, + y: borderWidth, + width: width - borderWidth * 2, + height: height - borderWidth * 2 + }; + var normalLayout = layoutSinglelineText(normalText, { + alignment: TextAlignment.Center, + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font, + bounds + }); + var downLayout = layoutSinglelineText(downText, { + alignment: TextAlignment.Center, + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font, + bounds + }); + var fontSize = Math.min(normalLayout.fontSize, downLayout.fontSize); + var textColor = (_e = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _e !== void 0 ? _e : black; + if (widgetColor || widgetFontSize !== void 0) { + updateDefaultAppearance(widget, textColor, font, fontSize); + } else { + updateDefaultAppearance(button.acroField, textColor, font, fontSize); + } + var options = { + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth, + borderColor, + textColor, + font: font.name, + fontSize + }; + return { + normal: __spreadArrays(rotate, drawButton(__assign(__assign({}, options), { color: normalBackgroundColor, textLines: [normalLayout.line] }))), + down: __spreadArrays(rotate, drawButton(__assign(__assign({}, options), { color: downBackgroundColor, textLines: [downLayout.line] }))) + }; +}; +var defaultTextFieldAppearanceProvider = function(textField, widget, font) { + var _a3, _b3, _c2, _d; + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(textField.acroField); + var widgetFontSize = getDefaultFontSize(widget); + var fieldFontSize = getDefaultFontSize(textField.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var text2 = (_a3 = textField.getText()) !== null && _a3 !== void 0 ? _a3 : ""; + var borderWidth = (_b3 = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b3 !== void 0 ? _b3 : 0; + var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _e = adjustDimsForRotation(rectangle, rotation), width = _e.width, height = _e.height; + var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation })); + var black = rgb(0, 0, 0); + var borderColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor()); + var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var textLines; + var fontSize; + var padding = textField.isCombed() ? 0 : 1; + var bounds = { + x: borderWidth + padding, + y: borderWidth + padding, + width: width - (borderWidth + padding) * 2, + height: height - (borderWidth + padding) * 2 + }; + if (textField.isMultiline()) { + var layout = layoutMultilineText(text2, { + alignment: textField.getAlignment(), + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font, + bounds + }); + textLines = layout.lines; + fontSize = layout.fontSize; + } else if (textField.isCombed()) { + var layout = layoutCombedText(text2, { + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font, + bounds, + cellCount: (_c2 = textField.getMaxLength()) !== null && _c2 !== void 0 ? _c2 : 0 + }); + textLines = layout.cells; + fontSize = layout.fontSize; + } else { + var layout = layoutSinglelineText(text2, { + alignment: textField.getAlignment(), + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font, + bounds + }); + textLines = [layout.line]; + fontSize = layout.fontSize; + } + var textColor = (_d = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _d !== void 0 ? _d : black; + if (widgetColor || widgetFontSize !== void 0) { + updateDefaultAppearance(widget, textColor, font, fontSize); + } else { + updateDefaultAppearance(textField.acroField, textColor, font, fontSize); + } + var options = { + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0, + borderColor, + textColor, + font: font.name, + fontSize, + color: normalBackgroundColor, + textLines, + padding + }; + return __spreadArrays(rotate, drawTextField(options)); +}; +var defaultDropdownAppearanceProvider = function(dropdown, widget, font) { + var _a3, _b3, _c2; + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(dropdown.acroField); + var widgetFontSize = getDefaultFontSize(widget); + var fieldFontSize = getDefaultFontSize(dropdown.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var text2 = (_a3 = dropdown.getSelected()[0]) !== null && _a3 !== void 0 ? _a3 : ""; + var borderWidth = (_b3 = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b3 !== void 0 ? _b3 : 0; + var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _d = adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height; + var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation })); + var black = rgb(0, 0, 0); + var borderColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor()); + var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var padding = 1; + var bounds = { + x: borderWidth + padding, + y: borderWidth + padding, + width: width - (borderWidth + padding) * 2, + height: height - (borderWidth + padding) * 2 + }; + var _e = layoutSinglelineText(text2, { + alignment: TextAlignment.Left, + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font, + bounds + }), line = _e.line, fontSize = _e.fontSize; + var textColor = (_c2 = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c2 !== void 0 ? _c2 : black; + if (widgetColor || widgetFontSize !== void 0) { + updateDefaultAppearance(widget, textColor, font, fontSize); + } else { + updateDefaultAppearance(dropdown.acroField, textColor, font, fontSize); + } + var options = { + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0, + borderColor, + textColor, + font: font.name, + fontSize, + color: normalBackgroundColor, + textLines: [line], + padding + }; + return __spreadArrays(rotate, drawTextField(options)); +}; +var defaultOptionListAppearanceProvider = function(optionList, widget, font) { + var _a3, _b3; + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(optionList.acroField); + var widgetFontSize = getDefaultFontSize(widget); + var fieldFontSize = getDefaultFontSize(optionList.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var borderWidth = (_a3 = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a3 !== void 0 ? _a3 : 0; + var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _c2 = adjustDimsForRotation(rectangle, rotation), width = _c2.width, height = _c2.height; + var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation })); + var black = rgb(0, 0, 0); + var borderColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor()); + var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var options = optionList.getOptions(); + var selected = optionList.getSelected(); + if (optionList.isSorted()) + options.sort(); + var text2 = ""; + for (var idx = 0, len = options.length; idx < len; idx++) { + text2 += options[idx]; + if (idx < len - 1) + text2 += "\n"; + } + var padding = 1; + var bounds = { + x: borderWidth + padding, + y: borderWidth + padding, + width: width - (borderWidth + padding) * 2, + height: height - (borderWidth + padding) * 2 + }; + var _d = layoutMultilineText(text2, { + alignment: TextAlignment.Left, + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font, + bounds + }), lines = _d.lines, fontSize = _d.fontSize, lineHeight = _d.lineHeight; + var selectedLines = []; + for (var idx = 0, len = lines.length; idx < len; idx++) { + var line = lines[idx]; + if (selected.includes(line.text)) + selectedLines.push(idx); + } + var blue = rgb(153 / 255, 193 / 255, 218 / 255); + var textColor = (_b3 = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _b3 !== void 0 ? _b3 : black; + if (widgetColor || widgetFontSize !== void 0) { + updateDefaultAppearance(widget, textColor, font, fontSize); + } else { + updateDefaultAppearance(optionList.acroField, textColor, font, fontSize); + } + return __spreadArrays(rotate, drawOptionList({ + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0, + borderColor, + textColor, + font: font.name, + fontSize, + color: normalBackgroundColor, + textLines: lines, + lineHeight, + selectedColor: blue, + selectedLines, + padding + })); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFEmbeddedPage.js +var PDFEmbeddedPage = ( + /** @class */ + function() { + function PDFEmbeddedPage2(ref, doc, embedder) { + this.alreadyEmbedded = false; + assertIs(ref, "ref", [[PDFRef_default, "PDFRef"]]); + assertIs(doc, "doc", [[PDFDocument_default, "PDFDocument"]]); + assertIs(embedder, "embedder", [[PDFPageEmbedder_default, "PDFPageEmbedder"]]); + this.ref = ref; + this.doc = doc; + this.width = embedder.width; + this.height = embedder.height; + this.embedder = embedder; + } + PDFEmbeddedPage2.prototype.scale = function(factor) { + assertIs(factor, "factor", ["number"]); + return { width: this.width * factor, height: this.height * factor }; + }; + PDFEmbeddedPage2.prototype.size = function() { + return this.scale(1); + }; + PDFEmbeddedPage2.prototype.embed = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + if (!!this.alreadyEmbedded) return [3, 2]; + return [4, this.embedder.embedIntoContext(this.doc.context, this.ref)]; + case 1: + _a3.sent(); + this.alreadyEmbedded = true; + _a3.label = 2; + case 2: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFEmbeddedPage2.of = function(ref, doc, embedder) { + return new PDFEmbeddedPage2(ref, doc, embedder); + }; + return PDFEmbeddedPage2; + }() +); +var PDFEmbeddedPage_default = PDFEmbeddedPage; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFFont.js +var PDFFont = ( + /** @class */ + function() { + function PDFFont2(ref, doc, embedder) { + this.modified = true; + assertIs(ref, "ref", [[PDFRef_default, "PDFRef"]]); + assertIs(doc, "doc", [[PDFDocument_default, "PDFDocument"]]); + assertIs(embedder, "embedder", [ + [CustomFontEmbedder_default, "CustomFontEmbedder"], + [StandardFontEmbedder_default, "StandardFontEmbedder"] + ]); + this.ref = ref; + this.doc = doc; + this.name = embedder.fontName; + this.embedder = embedder; + } + PDFFont2.prototype.encodeText = function(text2) { + assertIs(text2, "text", ["string"]); + this.modified = true; + return this.embedder.encodeText(text2); + }; + PDFFont2.prototype.widthOfTextAtSize = function(text2, size) { + assertIs(text2, "text", ["string"]); + assertIs(size, "size", ["number"]); + return this.embedder.widthOfTextAtSize(text2, size); + }; + PDFFont2.prototype.heightAtSize = function(size, options) { + var _a3; + assertIs(size, "size", ["number"]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.descender, "options.descender", ["boolean"]); + return this.embedder.heightOfFontAtSize(size, { + descender: (_a3 = options === null || options === void 0 ? void 0 : options.descender) !== null && _a3 !== void 0 ? _a3 : true + }); + }; + PDFFont2.prototype.sizeAtHeight = function(height) { + assertIs(height, "height", ["number"]); + return this.embedder.sizeOfFontAtHeight(height); + }; + PDFFont2.prototype.getCharacterSet = function() { + if (this.embedder instanceof StandardFontEmbedder_default) { + return this.embedder.encoding.supportedCodePoints; + } else { + return this.embedder.font.characterSet; + } + }; + PDFFont2.prototype.embed = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + if (!this.modified) return [3, 2]; + return [4, this.embedder.embedIntoContext(this.doc.context, this.ref)]; + case 1: + _a3.sent(); + this.modified = false; + _a3.label = 2; + case 2: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFFont2.of = function(ref, doc, embedder) { + return new PDFFont2(ref, doc, embedder); + }; + return PDFFont2; + }() +); +var PDFFont_default = PDFFont; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFImage.js +var PDFImage = ( + /** @class */ + function() { + function PDFImage2(ref, doc, embedder) { + assertIs(ref, "ref", [[PDFRef_default, "PDFRef"]]); + assertIs(doc, "doc", [[PDFDocument_default, "PDFDocument"]]); + assertIs(embedder, "embedder", [ + [JpegEmbedder_default, "JpegEmbedder"], + [PngEmbedder_default, "PngEmbedder"] + ]); + this.ref = ref; + this.doc = doc; + this.width = embedder.width; + this.height = embedder.height; + this.embedder = embedder; + } + PDFImage2.prototype.scale = function(factor) { + assertIs(factor, "factor", ["number"]); + return { width: this.width * factor, height: this.height * factor }; + }; + PDFImage2.prototype.scaleToFit = function(width, height) { + assertIs(width, "width", ["number"]); + assertIs(height, "height", ["number"]); + var imgWidthScale = width / this.width; + var imgHeightScale = height / this.height; + var scale2 = Math.min(imgWidthScale, imgHeightScale); + return this.scale(scale2); + }; + PDFImage2.prototype.size = function() { + return this.scale(1); + }; + PDFImage2.prototype.embed = function() { + return __awaiter(this, void 0, void 0, function() { + var _a3, doc, ref; + return __generator(this, function(_b3) { + switch (_b3.label) { + case 0: + if (!this.embedder) + return [ + 2 + /*return*/ + ]; + if (!this.embedTask) { + _a3 = this, doc = _a3.doc, ref = _a3.ref; + this.embedTask = this.embedder.embedIntoContext(doc.context, ref); + } + return [4, this.embedTask]; + case 1: + _b3.sent(); + this.embedder = void 0; + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFImage2.of = function(ref, doc, embedder) { + return new PDFImage2(ref, doc, embedder); + }; + return PDFImage2; + }() +); +var PDFImage_default = PDFImage; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/image/alignment.js +var ImageAlignment; +(function(ImageAlignment2) { + ImageAlignment2[ImageAlignment2["Left"] = 0] = "Left"; + ImageAlignment2[ImageAlignment2["Center"] = 1] = "Center"; + ImageAlignment2[ImageAlignment2["Right"] = 2] = "Right"; +})(ImageAlignment || (ImageAlignment = {})); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFField.js +var assertFieldAppearanceOptions = function(options) { + assertOrUndefined(options === null || options === void 0 ? void 0 : options.x, "options.x", ["number"]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.y, "options.y", ["number"]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.width, "options.width", ["number"]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.height, "options.height", ["number"]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.textColor, "options.textColor", [ + [Object, "Color"] + ]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.backgroundColor, "options.backgroundColor", [ + [Object, "Color"] + ]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.borderColor, "options.borderColor", [ + [Object, "Color"] + ]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.borderWidth, "options.borderWidth", ["number"]); + assertOrUndefined(options === null || options === void 0 ? void 0 : options.rotate, "options.rotate", [[Object, "Rotation"]]); +}; +var PDFField = ( + /** @class */ + function() { + function PDFField2(acroField, ref, doc) { + assertIs(acroField, "acroField", [[PDFAcroTerminal_default, "PDFAcroTerminal"]]); + assertIs(ref, "ref", [[PDFRef_default, "PDFRef"]]); + assertIs(doc, "doc", [[PDFDocument_default, "PDFDocument"]]); + this.acroField = acroField; + this.ref = ref; + this.doc = doc; + } + PDFField2.prototype.getName = function() { + var _a3; + return (_a3 = this.acroField.getFullyQualifiedName()) !== null && _a3 !== void 0 ? _a3 : ""; + }; + PDFField2.prototype.isReadOnly = function() { + return this.acroField.hasFlag(AcroFieldFlags.ReadOnly); + }; + PDFField2.prototype.enableReadOnly = function() { + this.acroField.setFlagTo(AcroFieldFlags.ReadOnly, true); + }; + PDFField2.prototype.disableReadOnly = function() { + this.acroField.setFlagTo(AcroFieldFlags.ReadOnly, false); + }; + PDFField2.prototype.isRequired = function() { + return this.acroField.hasFlag(AcroFieldFlags.Required); + }; + PDFField2.prototype.enableRequired = function() { + this.acroField.setFlagTo(AcroFieldFlags.Required, true); + }; + PDFField2.prototype.disableRequired = function() { + this.acroField.setFlagTo(AcroFieldFlags.Required, false); + }; + PDFField2.prototype.isExported = function() { + return !this.acroField.hasFlag(AcroFieldFlags.NoExport); + }; + PDFField2.prototype.enableExporting = function() { + this.acroField.setFlagTo(AcroFieldFlags.NoExport, false); + }; + PDFField2.prototype.disableExporting = function() { + this.acroField.setFlagTo(AcroFieldFlags.NoExport, true); + }; + PDFField2.prototype.needsAppearancesUpdate = function() { + throw new MethodNotImplementedError(this.constructor.name, "needsAppearancesUpdate"); + }; + PDFField2.prototype.defaultUpdateAppearances = function(_font) { + throw new MethodNotImplementedError(this.constructor.name, "defaultUpdateAppearances"); + }; + PDFField2.prototype.markAsDirty = function() { + this.doc.getForm().markFieldAsDirty(this.ref); + }; + PDFField2.prototype.markAsClean = function() { + this.doc.getForm().markFieldAsClean(this.ref); + }; + PDFField2.prototype.isDirty = function() { + return this.doc.getForm().fieldIsDirty(this.ref); + }; + PDFField2.prototype.createWidget = function(options) { + var _a3; + var textColor = options.textColor; + var backgroundColor = options.backgroundColor; + var borderColor = options.borderColor; + var borderWidth = options.borderWidth; + var degreesAngle = toDegrees(options.rotate); + var caption = options.caption; + var x = options.x; + var y = options.y; + var width = options.width + borderWidth; + var height = options.height + borderWidth; + var hidden = Boolean(options.hidden); + var pageRef = options.page; + assertMultiple(degreesAngle, "degreesAngle", 90); + var widget = PDFWidgetAnnotation_default.create(this.doc.context, this.ref); + var rect = rotateRectangle({ x, y, width, height }, borderWidth, degreesAngle); + widget.setRectangle(rect); + if (pageRef) + widget.setP(pageRef); + var ac = widget.getOrCreateAppearanceCharacteristics(); + if (backgroundColor) { + ac.setBackgroundColor(colorToComponents(backgroundColor)); + } + ac.setRotation(degreesAngle); + if (caption) + ac.setCaptions({ normal: caption }); + if (borderColor) + ac.setBorderColor(colorToComponents(borderColor)); + var bs = widget.getOrCreateBorderStyle(); + if (borderWidth !== void 0) + bs.setWidth(borderWidth); + widget.setFlagTo(AnnotationFlags.Print, true); + widget.setFlagTo(AnnotationFlags.Hidden, hidden); + widget.setFlagTo(AnnotationFlags.Invisible, false); + if (textColor) { + var da = (_a3 = this.acroField.getDefaultAppearance()) !== null && _a3 !== void 0 ? _a3 : ""; + var newDa = da + "\n" + setFillingColor(textColor).toString(); + this.acroField.setDefaultAppearance(newDa); + } + return widget; + }; + PDFField2.prototype.updateWidgetAppearanceWithFont = function(widget, font, _a3) { + var normal2 = _a3.normal, rollover = _a3.rollover, down = _a3.down; + this.updateWidgetAppearances(widget, { + normal: this.createAppearanceStream(widget, normal2, font), + rollover: rollover && this.createAppearanceStream(widget, rollover, font), + down: down && this.createAppearanceStream(widget, down, font) + }); + }; + PDFField2.prototype.updateOnOffWidgetAppearance = function(widget, onValue, _a3) { + var normal2 = _a3.normal, rollover = _a3.rollover, down = _a3.down; + this.updateWidgetAppearances(widget, { + normal: this.createAppearanceDict(widget, normal2, onValue), + rollover: rollover && this.createAppearanceDict(widget, rollover, onValue), + down: down && this.createAppearanceDict(widget, down, onValue) + }); + }; + PDFField2.prototype.updateWidgetAppearances = function(widget, _a3) { + var normal2 = _a3.normal, rollover = _a3.rollover, down = _a3.down; + widget.setNormalAppearance(normal2); + if (rollover) { + widget.setRolloverAppearance(rollover); + } else { + widget.removeRolloverAppearance(); + } + if (down) { + widget.setDownAppearance(down); + } else { + widget.removeDownAppearance(); + } + }; + PDFField2.prototype.createAppearanceStream = function(widget, appearance, font) { + var _a3; + var context = this.acroField.dict.context; + var _b3 = widget.getRectangle(), width = _b3.width, height = _b3.height; + var Resources = font && { Font: (_a3 = {}, _a3[font.name] = font.ref, _a3) }; + var stream2 = context.formXObject(appearance, { + Resources, + BBox: context.obj([0, 0, width, height]), + Matrix: context.obj([1, 0, 0, 1, 0, 0]) + }); + var streamRef = context.register(stream2); + return streamRef; + }; + PDFField2.prototype.createImageAppearanceStream = function(widget, image, alignment) { + var _a3; + var _b3; + var context = this.acroField.dict.context; + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var borderWidth = (_b3 = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b3 !== void 0 ? _b3 : 0; + var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation })); + var adj = adjustDimsForRotation(rectangle, rotation); + var imageDims = image.scaleToFit(adj.width - borderWidth * 2, adj.height - borderWidth * 2); + var options = { + x: borderWidth, + y: borderWidth, + width: imageDims.width, + height: imageDims.height, + // + rotate: degrees(0), + xSkew: degrees(0), + ySkew: degrees(0) + }; + if (alignment === ImageAlignment.Center) { + options.x += (adj.width - borderWidth * 2) / 2 - imageDims.width / 2; + options.y += (adj.height - borderWidth * 2) / 2 - imageDims.height / 2; + } else if (alignment === ImageAlignment.Right) { + options.x = adj.width - borderWidth - imageDims.width; + options.y = adj.height - borderWidth - imageDims.height; + } + var imageName = this.doc.context.addRandomSuffix("Image", 10); + var appearance = __spreadArrays(rotate, drawImage(imageName, options)); + var Resources = { XObject: (_a3 = {}, _a3[imageName] = image.ref, _a3) }; + var stream2 = context.formXObject(appearance, { + Resources, + BBox: context.obj([0, 0, rectangle.width, rectangle.height]), + Matrix: context.obj([1, 0, 0, 1, 0, 0]) + }); + return context.register(stream2); + }; + PDFField2.prototype.createAppearanceDict = function(widget, appearance, onValue) { + var context = this.acroField.dict.context; + var onStreamRef = this.createAppearanceStream(widget, appearance.on); + var offStreamRef = this.createAppearanceStream(widget, appearance.off); + var appearanceDict = context.obj({}); + appearanceDict.set(onValue, onStreamRef); + appearanceDict.set(PDFName_default.of("Off"), offStreamRef); + return appearanceDict; + }; + return PDFField2; + }() +); +var PDFField_default = PDFField; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFCheckBox.js +var PDFCheckBox = ( + /** @class */ + function(_super) { + __extends(PDFCheckBox2, _super); + function PDFCheckBox2(acroCheckBox, ref, doc) { + var _this = _super.call(this, acroCheckBox, ref, doc) || this; + assertIs(acroCheckBox, "acroCheckBox", [ + [PDFAcroCheckBox_default, "PDFAcroCheckBox"] + ]); + _this.acroField = acroCheckBox; + return _this; + } + PDFCheckBox2.prototype.check = function() { + var _a3; + var onValue = (_a3 = this.acroField.getOnValue()) !== null && _a3 !== void 0 ? _a3 : PDFName_default.of("Yes"); + this.markAsDirty(); + this.acroField.setValue(onValue); + }; + PDFCheckBox2.prototype.uncheck = function() { + this.markAsDirty(); + this.acroField.setValue(PDFName_default.of("Off")); + }; + PDFCheckBox2.prototype.isChecked = function() { + var onValue = this.acroField.getOnValue(); + return !!onValue && onValue === this.acroField.getValue(); + }; + PDFCheckBox2.prototype.addToPage = function(page, options) { + var _a3, _b3, _c2, _d, _e, _f; + assertIs(page, "page", [[PDFPage_default, "PDFPage"]]); + assertFieldAppearanceOptions(options); + if (!options) + options = {}; + if (!("textColor" in options)) + options.textColor = rgb(0, 0, 0); + if (!("backgroundColor" in options)) + options.backgroundColor = rgb(1, 1, 1); + if (!("borderColor" in options)) + options.borderColor = rgb(0, 0, 0); + if (!("borderWidth" in options)) + options.borderWidth = 1; + var widget = this.createWidget({ + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : 0, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : 0, + width: (_c2 = options.width) !== null && _c2 !== void 0 ? _c2 : 50, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 50, + textColor: options.textColor, + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0, + rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : degrees(0), + hidden: options.hidden, + page: page.ref + }); + var widgetRef = this.doc.context.register(widget.dict); + this.acroField.addWidget(widgetRef); + widget.setAppearanceState(PDFName_default.of("Off")); + this.updateWidgetAppearance(widget, PDFName_default.of("Yes")); + page.node.addAnnot(widgetRef); + }; + PDFCheckBox2.prototype.needsAppearancesUpdate = function() { + var _a3; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var state2 = widget.getAppearanceState(); + var normal2 = (_a3 = widget.getAppearances()) === null || _a3 === void 0 ? void 0 : _a3.normal; + if (!(normal2 instanceof PDFDict_default)) + return true; + if (state2 && !normal2.has(state2)) + return true; + } + return false; + }; + PDFCheckBox2.prototype.defaultUpdateAppearances = function() { + this.updateAppearances(); + }; + PDFCheckBox2.prototype.updateAppearances = function(provider) { + var _a3; + assertOrUndefined(provider, "provider", [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var onValue = (_a3 = widget.getOnValue()) !== null && _a3 !== void 0 ? _a3 : PDFName_default.of("Yes"); + if (!onValue) + continue; + this.updateWidgetAppearance(widget, onValue, provider); + } + this.markAsClean(); + }; + PDFCheckBox2.prototype.updateWidgetAppearance = function(widget, onValue, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : defaultCheckBoxAppearanceProvider; + var appearances = normalizeAppearance(apProvider(this, widget)); + this.updateOnOffWidgetAppearance(widget, onValue, appearances); + }; + PDFCheckBox2.of = function(acroCheckBox, ref, doc) { + return new PDFCheckBox2(acroCheckBox, ref, doc); + }; + return PDFCheckBox2; + }(PDFField_default) +); +var PDFCheckBox_default = PDFCheckBox; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFDropdown.js +var PDFDropdown = ( + /** @class */ + function(_super) { + __extends(PDFDropdown2, _super); + function PDFDropdown2(acroComboBox, ref, doc) { + var _this = _super.call(this, acroComboBox, ref, doc) || this; + assertIs(acroComboBox, "acroComboBox", [ + [PDFAcroComboBox_default, "PDFAcroComboBox"] + ]); + _this.acroField = acroComboBox; + return _this; + } + PDFDropdown2.prototype.getOptions = function() { + var rawOptions = this.acroField.getOptions(); + var options = new Array(rawOptions.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + var _a3 = rawOptions[idx], display = _a3.display, value = _a3.value; + options[idx] = (display !== null && display !== void 0 ? display : value).decodeText(); + } + return options; + }; + PDFDropdown2.prototype.getSelected = function() { + var values2 = this.acroField.getValues(); + var selected = new Array(values2.length); + for (var idx = 0, len = values2.length; idx < len; idx++) { + selected[idx] = values2[idx].decodeText(); + } + return selected; + }; + PDFDropdown2.prototype.setOptions = function(options) { + assertIs(options, "options", [Array]); + var optionObjects = new Array(options.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + optionObjects[idx] = { value: PDFHexString_default.fromText(options[idx]) }; + } + this.acroField.setOptions(optionObjects); + }; + PDFDropdown2.prototype.addOptions = function(options) { + assertIs(options, "options", ["string", Array]); + var optionsArr = Array.isArray(options) ? options : [options]; + var existingOptions = this.acroField.getOptions(); + var newOptions = new Array(optionsArr.length); + for (var idx = 0, len = optionsArr.length; idx < len; idx++) { + newOptions[idx] = { value: PDFHexString_default.fromText(optionsArr[idx]) }; + } + this.acroField.setOptions(existingOptions.concat(newOptions)); + }; + PDFDropdown2.prototype.select = function(options, merge2) { + if (merge2 === void 0) { + merge2 = false; + } + assertIs(options, "options", ["string", Array]); + assertIs(merge2, "merge", ["boolean"]); + var optionsArr = Array.isArray(options) ? options : [options]; + var validOptions = this.getOptions(); + var hasCustomOption = optionsArr.find(function(option) { + return !validOptions.includes(option); + }); + if (hasCustomOption) + this.enableEditing(); + this.markAsDirty(); + if (optionsArr.length > 1 || optionsArr.length === 1 && merge2) { + this.enableMultiselect(); + } + var values2 = new Array(optionsArr.length); + for (var idx = 0, len = optionsArr.length; idx < len; idx++) { + values2[idx] = PDFHexString_default.fromText(optionsArr[idx]); + } + if (merge2) { + var existingValues = this.acroField.getValues(); + this.acroField.setValues(existingValues.concat(values2)); + } else { + this.acroField.setValues(values2); + } + }; + PDFDropdown2.prototype.clear = function() { + this.markAsDirty(); + this.acroField.setValues([]); + }; + PDFDropdown2.prototype.setFontSize = function(fontSize) { + assertPositive(fontSize, "fontSize"); + this.acroField.setFontSize(fontSize); + this.markAsDirty(); + }; + PDFDropdown2.prototype.isEditable = function() { + return this.acroField.hasFlag(AcroChoiceFlags.Edit); + }; + PDFDropdown2.prototype.enableEditing = function() { + this.acroField.setFlagTo(AcroChoiceFlags.Edit, true); + }; + PDFDropdown2.prototype.disableEditing = function() { + this.acroField.setFlagTo(AcroChoiceFlags.Edit, false); + }; + PDFDropdown2.prototype.isSorted = function() { + return this.acroField.hasFlag(AcroChoiceFlags.Sort); + }; + PDFDropdown2.prototype.enableSorting = function() { + this.acroField.setFlagTo(AcroChoiceFlags.Sort, true); + }; + PDFDropdown2.prototype.disableSorting = function() { + this.acroField.setFlagTo(AcroChoiceFlags.Sort, false); + }; + PDFDropdown2.prototype.isMultiselect = function() { + return this.acroField.hasFlag(AcroChoiceFlags.MultiSelect); + }; + PDFDropdown2.prototype.enableMultiselect = function() { + this.acroField.setFlagTo(AcroChoiceFlags.MultiSelect, true); + }; + PDFDropdown2.prototype.disableMultiselect = function() { + this.acroField.setFlagTo(AcroChoiceFlags.MultiSelect, false); + }; + PDFDropdown2.prototype.isSpellChecked = function() { + return !this.acroField.hasFlag(AcroChoiceFlags.DoNotSpellCheck); + }; + PDFDropdown2.prototype.enableSpellChecking = function() { + this.acroField.setFlagTo(AcroChoiceFlags.DoNotSpellCheck, false); + }; + PDFDropdown2.prototype.disableSpellChecking = function() { + this.acroField.setFlagTo(AcroChoiceFlags.DoNotSpellCheck, true); + }; + PDFDropdown2.prototype.isSelectOnClick = function() { + return this.acroField.hasFlag(AcroChoiceFlags.CommitOnSelChange); + }; + PDFDropdown2.prototype.enableSelectOnClick = function() { + this.acroField.setFlagTo(AcroChoiceFlags.CommitOnSelChange, true); + }; + PDFDropdown2.prototype.disableSelectOnClick = function() { + this.acroField.setFlagTo(AcroChoiceFlags.CommitOnSelChange, false); + }; + PDFDropdown2.prototype.addToPage = function(page, options) { + var _a3, _b3, _c2, _d, _e, _f, _g; + assertIs(page, "page", [[PDFPage_default, "PDFPage"]]); + assertFieldAppearanceOptions(options); + if (!options) + options = {}; + if (!("textColor" in options)) + options.textColor = rgb(0, 0, 0); + if (!("backgroundColor" in options)) + options.backgroundColor = rgb(1, 1, 1); + if (!("borderColor" in options)) + options.borderColor = rgb(0, 0, 0); + if (!("borderWidth" in options)) + options.borderWidth = 1; + var widget = this.createWidget({ + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : 0, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : 0, + width: (_c2 = options.width) !== null && _c2 !== void 0 ? _c2 : 200, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 50, + textColor: options.textColor, + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0, + rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : degrees(0), + hidden: options.hidden, + page: page.ref + }); + var widgetRef = this.doc.context.register(widget.dict); + this.acroField.addWidget(widgetRef); + var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont(); + this.updateWidgetAppearance(widget, font); + page.node.addAnnot(widgetRef); + }; + PDFDropdown2.prototype.needsAppearancesUpdate = function() { + var _a3; + if (this.isDirty()) + return true; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var hasAppearances = ((_a3 = widget.getAppearances()) === null || _a3 === void 0 ? void 0 : _a3.normal) instanceof PDFStream_default; + if (!hasAppearances) + return true; + } + return false; + }; + PDFDropdown2.prototype.defaultUpdateAppearances = function(font) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + this.updateAppearances(font); + }; + PDFDropdown2.prototype.updateAppearances = function(font, provider) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + assertOrUndefined(provider, "provider", [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + this.updateWidgetAppearance(widget, font, provider); + } + this.markAsClean(); + }; + PDFDropdown2.prototype.updateWidgetAppearance = function(widget, font, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : defaultDropdownAppearanceProvider; + var appearances = normalizeAppearance(apProvider(this, widget, font)); + this.updateWidgetAppearanceWithFont(widget, font, appearances); + }; + PDFDropdown2.of = function(acroComboBox, ref, doc) { + return new PDFDropdown2(acroComboBox, ref, doc); + }; + return PDFDropdown2; + }(PDFField_default) +); +var PDFDropdown_default = PDFDropdown; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFOptionList.js +var PDFOptionList = ( + /** @class */ + function(_super) { + __extends(PDFOptionList2, _super); + function PDFOptionList2(acroListBox, ref, doc) { + var _this = _super.call(this, acroListBox, ref, doc) || this; + assertIs(acroListBox, "acroListBox", [[PDFAcroListBox_default, "PDFAcroListBox"]]); + _this.acroField = acroListBox; + return _this; + } + PDFOptionList2.prototype.getOptions = function() { + var rawOptions = this.acroField.getOptions(); + var options = new Array(rawOptions.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + var _a3 = rawOptions[idx], display = _a3.display, value = _a3.value; + options[idx] = (display !== null && display !== void 0 ? display : value).decodeText(); + } + return options; + }; + PDFOptionList2.prototype.getSelected = function() { + var values2 = this.acroField.getValues(); + var selected = new Array(values2.length); + for (var idx = 0, len = values2.length; idx < len; idx++) { + selected[idx] = values2[idx].decodeText(); + } + return selected; + }; + PDFOptionList2.prototype.setOptions = function(options) { + assertIs(options, "options", [Array]); + this.markAsDirty(); + var optionObjects = new Array(options.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + optionObjects[idx] = { value: PDFHexString_default.fromText(options[idx]) }; + } + this.acroField.setOptions(optionObjects); + }; + PDFOptionList2.prototype.addOptions = function(options) { + assertIs(options, "options", ["string", Array]); + this.markAsDirty(); + var optionsArr = Array.isArray(options) ? options : [options]; + var existingOptions = this.acroField.getOptions(); + var newOptions = new Array(optionsArr.length); + for (var idx = 0, len = optionsArr.length; idx < len; idx++) { + newOptions[idx] = { value: PDFHexString_default.fromText(optionsArr[idx]) }; + } + this.acroField.setOptions(existingOptions.concat(newOptions)); + }; + PDFOptionList2.prototype.select = function(options, merge2) { + if (merge2 === void 0) { + merge2 = false; + } + assertIs(options, "options", ["string", Array]); + assertIs(merge2, "merge", ["boolean"]); + var optionsArr = Array.isArray(options) ? options : [options]; + var validOptions = this.getOptions(); + assertIsSubset(optionsArr, "option", validOptions); + this.markAsDirty(); + if (optionsArr.length > 1 || optionsArr.length === 1 && merge2) { + this.enableMultiselect(); + } + var values2 = new Array(optionsArr.length); + for (var idx = 0, len = optionsArr.length; idx < len; idx++) { + values2[idx] = PDFHexString_default.fromText(optionsArr[idx]); + } + if (merge2) { + var existingValues = this.acroField.getValues(); + this.acroField.setValues(existingValues.concat(values2)); + } else { + this.acroField.setValues(values2); + } + }; + PDFOptionList2.prototype.clear = function() { + this.markAsDirty(); + this.acroField.setValues([]); + }; + PDFOptionList2.prototype.setFontSize = function(fontSize) { + assertPositive(fontSize, "fontSize"); + this.acroField.setFontSize(fontSize); + this.markAsDirty(); + }; + PDFOptionList2.prototype.isSorted = function() { + return this.acroField.hasFlag(AcroChoiceFlags.Sort); + }; + PDFOptionList2.prototype.enableSorting = function() { + this.acroField.setFlagTo(AcroChoiceFlags.Sort, true); + }; + PDFOptionList2.prototype.disableSorting = function() { + this.acroField.setFlagTo(AcroChoiceFlags.Sort, false); + }; + PDFOptionList2.prototype.isMultiselect = function() { + return this.acroField.hasFlag(AcroChoiceFlags.MultiSelect); + }; + PDFOptionList2.prototype.enableMultiselect = function() { + this.acroField.setFlagTo(AcroChoiceFlags.MultiSelect, true); + }; + PDFOptionList2.prototype.disableMultiselect = function() { + this.acroField.setFlagTo(AcroChoiceFlags.MultiSelect, false); + }; + PDFOptionList2.prototype.isSelectOnClick = function() { + return this.acroField.hasFlag(AcroChoiceFlags.CommitOnSelChange); + }; + PDFOptionList2.prototype.enableSelectOnClick = function() { + this.acroField.setFlagTo(AcroChoiceFlags.CommitOnSelChange, true); + }; + PDFOptionList2.prototype.disableSelectOnClick = function() { + this.acroField.setFlagTo(AcroChoiceFlags.CommitOnSelChange, false); + }; + PDFOptionList2.prototype.addToPage = function(page, options) { + var _a3, _b3, _c2, _d, _e, _f, _g; + assertIs(page, "page", [[PDFPage_default, "PDFPage"]]); + assertFieldAppearanceOptions(options); + if (!options) + options = {}; + if (!("textColor" in options)) + options.textColor = rgb(0, 0, 0); + if (!("backgroundColor" in options)) + options.backgroundColor = rgb(1, 1, 1); + if (!("borderColor" in options)) + options.borderColor = rgb(0, 0, 0); + if (!("borderWidth" in options)) + options.borderWidth = 1; + var widget = this.createWidget({ + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : 0, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : 0, + width: (_c2 = options.width) !== null && _c2 !== void 0 ? _c2 : 200, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 100, + textColor: options.textColor, + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0, + rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : degrees(0), + hidden: options.hidden, + page: page.ref + }); + var widgetRef = this.doc.context.register(widget.dict); + this.acroField.addWidget(widgetRef); + var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont(); + this.updateWidgetAppearance(widget, font); + page.node.addAnnot(widgetRef); + }; + PDFOptionList2.prototype.needsAppearancesUpdate = function() { + var _a3; + if (this.isDirty()) + return true; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var hasAppearances = ((_a3 = widget.getAppearances()) === null || _a3 === void 0 ? void 0 : _a3.normal) instanceof PDFStream_default; + if (!hasAppearances) + return true; + } + return false; + }; + PDFOptionList2.prototype.defaultUpdateAppearances = function(font) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + this.updateAppearances(font); + }; + PDFOptionList2.prototype.updateAppearances = function(font, provider) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + assertOrUndefined(provider, "provider", [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + this.updateWidgetAppearance(widget, font, provider); + } + this.markAsClean(); + }; + PDFOptionList2.prototype.updateWidgetAppearance = function(widget, font, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : defaultOptionListAppearanceProvider; + var appearances = normalizeAppearance(apProvider(this, widget, font)); + this.updateWidgetAppearanceWithFont(widget, font, appearances); + }; + PDFOptionList2.of = function(acroListBox, ref, doc) { + return new PDFOptionList2(acroListBox, ref, doc); + }; + return PDFOptionList2; + }(PDFField_default) +); +var PDFOptionList_default = PDFOptionList; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFRadioGroup.js +var PDFRadioGroup = ( + /** @class */ + function(_super) { + __extends(PDFRadioGroup2, _super); + function PDFRadioGroup2(acroRadioButton, ref, doc) { + var _this = _super.call(this, acroRadioButton, ref, doc) || this; + assertIs(acroRadioButton, "acroRadioButton", [ + [PDFAcroRadioButton_default, "PDFAcroRadioButton"] + ]); + _this.acroField = acroRadioButton; + return _this; + } + PDFRadioGroup2.prototype.getOptions = function() { + var exportValues = this.acroField.getExportValues(); + if (exportValues) { + var exportOptions = new Array(exportValues.length); + for (var idx = 0, len = exportValues.length; idx < len; idx++) { + exportOptions[idx] = exportValues[idx].decodeText(); + } + return exportOptions; + } + var onValues = this.acroField.getOnValues(); + var onOptions = new Array(onValues.length); + for (var idx = 0, len = onOptions.length; idx < len; idx++) { + onOptions[idx] = onValues[idx].decodeText(); + } + return onOptions; + }; + PDFRadioGroup2.prototype.getSelected = function() { + var value = this.acroField.getValue(); + if (value === PDFName_default.of("Off")) + return void 0; + var exportValues = this.acroField.getExportValues(); + if (exportValues) { + var onValues = this.acroField.getOnValues(); + for (var idx = 0, len = onValues.length; idx < len; idx++) { + if (onValues[idx] === value) + return exportValues[idx].decodeText(); + } + } + return value.decodeText(); + }; + PDFRadioGroup2.prototype.select = function(option) { + assertIs(option, "option", ["string"]); + var validOptions = this.getOptions(); + assertIsOneOf(option, "option", validOptions); + this.markAsDirty(); + var onValues = this.acroField.getOnValues(); + var exportValues = this.acroField.getExportValues(); + if (exportValues) { + for (var idx = 0, len = exportValues.length; idx < len; idx++) { + if (exportValues[idx].decodeText() === option) { + this.acroField.setValue(onValues[idx]); + } + } + } else { + for (var idx = 0, len = onValues.length; idx < len; idx++) { + var value = onValues[idx]; + if (value.decodeText() === option) + this.acroField.setValue(value); + } + } + }; + PDFRadioGroup2.prototype.clear = function() { + this.markAsDirty(); + this.acroField.setValue(PDFName_default.of("Off")); + }; + PDFRadioGroup2.prototype.isOffToggleable = function() { + return !this.acroField.hasFlag(AcroButtonFlags.NoToggleToOff); + }; + PDFRadioGroup2.prototype.enableOffToggling = function() { + this.acroField.setFlagTo(AcroButtonFlags.NoToggleToOff, false); + }; + PDFRadioGroup2.prototype.disableOffToggling = function() { + this.acroField.setFlagTo(AcroButtonFlags.NoToggleToOff, true); + }; + PDFRadioGroup2.prototype.isMutuallyExclusive = function() { + return !this.acroField.hasFlag(AcroButtonFlags.RadiosInUnison); + }; + PDFRadioGroup2.prototype.enableMutualExclusion = function() { + this.acroField.setFlagTo(AcroButtonFlags.RadiosInUnison, false); + }; + PDFRadioGroup2.prototype.disableMutualExclusion = function() { + this.acroField.setFlagTo(AcroButtonFlags.RadiosInUnison, true); + }; + PDFRadioGroup2.prototype.addOptionToPage = function(option, page, options) { + var _a3, _b3, _c2, _d, _e, _f, _g, _h, _j; + assertIs(option, "option", ["string"]); + assertIs(page, "page", [[PDFPage_default, "PDFPage"]]); + assertFieldAppearanceOptions(options); + var widget = this.createWidget({ + x: (_a3 = options === null || options === void 0 ? void 0 : options.x) !== null && _a3 !== void 0 ? _a3 : 0, + y: (_b3 = options === null || options === void 0 ? void 0 : options.y) !== null && _b3 !== void 0 ? _b3 : 0, + width: (_c2 = options === null || options === void 0 ? void 0 : options.width) !== null && _c2 !== void 0 ? _c2 : 50, + height: (_d = options === null || options === void 0 ? void 0 : options.height) !== null && _d !== void 0 ? _d : 50, + textColor: (_e = options === null || options === void 0 ? void 0 : options.textColor) !== null && _e !== void 0 ? _e : rgb(0, 0, 0), + backgroundColor: (_f = options === null || options === void 0 ? void 0 : options.backgroundColor) !== null && _f !== void 0 ? _f : rgb(1, 1, 1), + borderColor: (_g = options === null || options === void 0 ? void 0 : options.borderColor) !== null && _g !== void 0 ? _g : rgb(0, 0, 0), + borderWidth: (_h = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _h !== void 0 ? _h : 1, + rotate: (_j = options === null || options === void 0 ? void 0 : options.rotate) !== null && _j !== void 0 ? _j : degrees(0), + hidden: options === null || options === void 0 ? void 0 : options.hidden, + page: page.ref + }); + var widgetRef = this.doc.context.register(widget.dict); + var apStateValue = this.acroField.addWidgetWithOpt(widgetRef, PDFHexString_default.fromText(option), !this.isMutuallyExclusive()); + widget.setAppearanceState(PDFName_default.of("Off")); + this.updateWidgetAppearance(widget, apStateValue); + page.node.addAnnot(widgetRef); + }; + PDFRadioGroup2.prototype.needsAppearancesUpdate = function() { + var _a3; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var state2 = widget.getAppearanceState(); + var normal2 = (_a3 = widget.getAppearances()) === null || _a3 === void 0 ? void 0 : _a3.normal; + if (!(normal2 instanceof PDFDict_default)) + return true; + if (state2 && !normal2.has(state2)) + return true; + } + return false; + }; + PDFRadioGroup2.prototype.defaultUpdateAppearances = function() { + this.updateAppearances(); + }; + PDFRadioGroup2.prototype.updateAppearances = function(provider) { + assertOrUndefined(provider, "provider", [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var onValue = widget.getOnValue(); + if (!onValue) + continue; + this.updateWidgetAppearance(widget, onValue, provider); + } + }; + PDFRadioGroup2.prototype.updateWidgetAppearance = function(widget, onValue, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : defaultRadioGroupAppearanceProvider; + var appearances = normalizeAppearance(apProvider(this, widget)); + this.updateOnOffWidgetAppearance(widget, onValue, appearances); + }; + PDFRadioGroup2.of = function(acroRadioButton, ref, doc) { + return new PDFRadioGroup2(acroRadioButton, ref, doc); + }; + return PDFRadioGroup2; + }(PDFField_default) +); +var PDFRadioGroup_default = PDFRadioGroup; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFSignature.js +var PDFSignature = ( + /** @class */ + function(_super) { + __extends(PDFSignature2, _super); + function PDFSignature2(acroSignature, ref, doc) { + var _this = _super.call(this, acroSignature, ref, doc) || this; + assertIs(acroSignature, "acroSignature", [ + [PDFAcroSignature_default, "PDFAcroSignature"] + ]); + _this.acroField = acroSignature; + return _this; + } + PDFSignature2.prototype.needsAppearancesUpdate = function() { + return false; + }; + PDFSignature2.of = function(acroSignature, ref, doc) { + return new PDFSignature2(acroSignature, ref, doc); + }; + return PDFSignature2; + }(PDFField_default) +); +var PDFSignature_default = PDFSignature; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFTextField.js +var PDFTextField = ( + /** @class */ + function(_super) { + __extends(PDFTextField2, _super); + function PDFTextField2(acroText, ref, doc) { + var _this = _super.call(this, acroText, ref, doc) || this; + assertIs(acroText, "acroText", [[PDFAcroText_default, "PDFAcroText"]]); + _this.acroField = acroText; + return _this; + } + PDFTextField2.prototype.getText = function() { + var value = this.acroField.getValue(); + if (!value && this.isRichFormatted()) { + throw new RichTextFieldReadError(this.getName()); + } + return value === null || value === void 0 ? void 0 : value.decodeText(); + }; + PDFTextField2.prototype.setText = function(text2) { + assertOrUndefined(text2, "text", ["string"]); + var maxLength = this.getMaxLength(); + if (maxLength !== void 0 && text2 && text2.length > maxLength) { + throw new ExceededMaxLengthError(text2.length, maxLength, this.getName()); + } + this.markAsDirty(); + this.disableRichFormatting(); + if (text2) { + this.acroField.setValue(PDFHexString_default.fromText(text2)); + } else { + this.acroField.removeValue(); + } + }; + PDFTextField2.prototype.getAlignment = function() { + var quadding = this.acroField.getQuadding(); + return quadding === 0 ? TextAlignment.Left : quadding === 1 ? TextAlignment.Center : quadding === 2 ? TextAlignment.Right : TextAlignment.Left; + }; + PDFTextField2.prototype.setAlignment = function(alignment) { + assertIsOneOf(alignment, "alignment", TextAlignment); + this.markAsDirty(); + this.acroField.setQuadding(alignment); + }; + PDFTextField2.prototype.getMaxLength = function() { + return this.acroField.getMaxLength(); + }; + PDFTextField2.prototype.setMaxLength = function(maxLength) { + assertRangeOrUndefined(maxLength, "maxLength", 0, Number.MAX_SAFE_INTEGER); + this.markAsDirty(); + if (maxLength === void 0) { + this.acroField.removeMaxLength(); + } else { + var text2 = this.getText(); + if (text2 && text2.length > maxLength) { + throw new InvalidMaxLengthError(text2.length, maxLength, this.getName()); + } + this.acroField.setMaxLength(maxLength); + } + }; + PDFTextField2.prototype.removeMaxLength = function() { + this.markAsDirty(); + this.acroField.removeMaxLength(); + }; + PDFTextField2.prototype.setImage = function(image) { + var fieldAlignment = this.getAlignment(); + var alignment = fieldAlignment === TextAlignment.Center ? ImageAlignment.Center : fieldAlignment === TextAlignment.Right ? ImageAlignment.Right : ImageAlignment.Left; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var streamRef = this.createImageAppearanceStream(widget, image, alignment); + this.updateWidgetAppearances(widget, { normal: streamRef }); + } + this.markAsClean(); + }; + PDFTextField2.prototype.setFontSize = function(fontSize) { + assertPositive(fontSize, "fontSize"); + this.acroField.setFontSize(fontSize); + this.markAsDirty(); + }; + PDFTextField2.prototype.isMultiline = function() { + return this.acroField.hasFlag(AcroTextFlags.Multiline); + }; + PDFTextField2.prototype.enableMultiline = function() { + this.markAsDirty(); + this.acroField.setFlagTo(AcroTextFlags.Multiline, true); + }; + PDFTextField2.prototype.disableMultiline = function() { + this.markAsDirty(); + this.acroField.setFlagTo(AcroTextFlags.Multiline, false); + }; + PDFTextField2.prototype.isPassword = function() { + return this.acroField.hasFlag(AcroTextFlags.Password); + }; + PDFTextField2.prototype.enablePassword = function() { + this.acroField.setFlagTo(AcroTextFlags.Password, true); + }; + PDFTextField2.prototype.disablePassword = function() { + this.acroField.setFlagTo(AcroTextFlags.Password, false); + }; + PDFTextField2.prototype.isFileSelector = function() { + return this.acroField.hasFlag(AcroTextFlags.FileSelect); + }; + PDFTextField2.prototype.enableFileSelection = function() { + this.acroField.setFlagTo(AcroTextFlags.FileSelect, true); + }; + PDFTextField2.prototype.disableFileSelection = function() { + this.acroField.setFlagTo(AcroTextFlags.FileSelect, false); + }; + PDFTextField2.prototype.isSpellChecked = function() { + return !this.acroField.hasFlag(AcroTextFlags.DoNotSpellCheck); + }; + PDFTextField2.prototype.enableSpellChecking = function() { + this.acroField.setFlagTo(AcroTextFlags.DoNotSpellCheck, false); + }; + PDFTextField2.prototype.disableSpellChecking = function() { + this.acroField.setFlagTo(AcroTextFlags.DoNotSpellCheck, true); + }; + PDFTextField2.prototype.isScrollable = function() { + return !this.acroField.hasFlag(AcroTextFlags.DoNotScroll); + }; + PDFTextField2.prototype.enableScrolling = function() { + this.acroField.setFlagTo(AcroTextFlags.DoNotScroll, false); + }; + PDFTextField2.prototype.disableScrolling = function() { + this.acroField.setFlagTo(AcroTextFlags.DoNotScroll, true); + }; + PDFTextField2.prototype.isCombed = function() { + return this.acroField.hasFlag(AcroTextFlags.Comb) && !this.isMultiline() && !this.isPassword() && !this.isFileSelector() && this.getMaxLength() !== void 0; + }; + PDFTextField2.prototype.enableCombing = function() { + if (this.getMaxLength() === void 0) { + var msg = "PDFTextFields must have a max length in order to be combed"; + console.warn(msg); + } + this.markAsDirty(); + this.disableMultiline(); + this.disablePassword(); + this.disableFileSelection(); + this.acroField.setFlagTo(AcroTextFlags.Comb, true); + }; + PDFTextField2.prototype.disableCombing = function() { + this.markAsDirty(); + this.acroField.setFlagTo(AcroTextFlags.Comb, false); + }; + PDFTextField2.prototype.isRichFormatted = function() { + return this.acroField.hasFlag(AcroTextFlags.RichText); + }; + PDFTextField2.prototype.enableRichFormatting = function() { + this.acroField.setFlagTo(AcroTextFlags.RichText, true); + }; + PDFTextField2.prototype.disableRichFormatting = function() { + this.acroField.setFlagTo(AcroTextFlags.RichText, false); + }; + PDFTextField2.prototype.addToPage = function(page, options) { + var _a3, _b3, _c2, _d, _e, _f, _g; + assertIs(page, "page", [[PDFPage_default, "PDFPage"]]); + assertFieldAppearanceOptions(options); + if (!options) + options = {}; + if (!("textColor" in options)) + options.textColor = rgb(0, 0, 0); + if (!("backgroundColor" in options)) + options.backgroundColor = rgb(1, 1, 1); + if (!("borderColor" in options)) + options.borderColor = rgb(0, 0, 0); + if (!("borderWidth" in options)) + options.borderWidth = 1; + var widget = this.createWidget({ + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : 0, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : 0, + width: (_c2 = options.width) !== null && _c2 !== void 0 ? _c2 : 200, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 50, + textColor: options.textColor, + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0, + rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : degrees(0), + hidden: options.hidden, + page: page.ref + }); + var widgetRef = this.doc.context.register(widget.dict); + this.acroField.addWidget(widgetRef); + var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont(); + this.updateWidgetAppearance(widget, font); + page.node.addAnnot(widgetRef); + }; + PDFTextField2.prototype.needsAppearancesUpdate = function() { + var _a3; + if (this.isDirty()) + return true; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var hasAppearances = ((_a3 = widget.getAppearances()) === null || _a3 === void 0 ? void 0 : _a3.normal) instanceof PDFStream_default; + if (!hasAppearances) + return true; + } + return false; + }; + PDFTextField2.prototype.defaultUpdateAppearances = function(font) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + this.updateAppearances(font); + }; + PDFTextField2.prototype.updateAppearances = function(font, provider) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + assertOrUndefined(provider, "provider", [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + this.updateWidgetAppearance(widget, font, provider); + } + this.markAsClean(); + }; + PDFTextField2.prototype.updateWidgetAppearance = function(widget, font, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : defaultTextFieldAppearanceProvider; + var appearances = normalizeAppearance(apProvider(this, widget, font)); + this.updateWidgetAppearanceWithFont(widget, font, appearances); + }; + PDFTextField2.of = function(acroText, ref, doc) { + return new PDFTextField2(acroText, ref, doc); + }; + return PDFTextField2; + }(PDFField_default) +); +var PDFTextField_default = PDFTextField; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/StandardFonts.js +var StandardFonts; +(function(StandardFonts2) { + StandardFonts2["Courier"] = "Courier"; + StandardFonts2["CourierBold"] = "Courier-Bold"; + StandardFonts2["CourierOblique"] = "Courier-Oblique"; + StandardFonts2["CourierBoldOblique"] = "Courier-BoldOblique"; + StandardFonts2["Helvetica"] = "Helvetica"; + StandardFonts2["HelveticaBold"] = "Helvetica-Bold"; + StandardFonts2["HelveticaOblique"] = "Helvetica-Oblique"; + StandardFonts2["HelveticaBoldOblique"] = "Helvetica-BoldOblique"; + StandardFonts2["TimesRoman"] = "Times-Roman"; + StandardFonts2["TimesRomanBold"] = "Times-Bold"; + StandardFonts2["TimesRomanItalic"] = "Times-Italic"; + StandardFonts2["TimesRomanBoldItalic"] = "Times-BoldItalic"; + StandardFonts2["Symbol"] = "Symbol"; + StandardFonts2["ZapfDingbats"] = "ZapfDingbats"; +})(StandardFonts || (StandardFonts = {})); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFForm.js +var PDFForm = ( + /** @class */ + function() { + function PDFForm2(acroForm, doc) { + var _this = this; + this.embedDefaultFont = function() { + return _this.doc.embedStandardFont(StandardFonts.Helvetica); + }; + assertIs(acroForm, "acroForm", [[PDFAcroForm_default, "PDFAcroForm"]]); + assertIs(doc, "doc", [[PDFDocument_default, "PDFDocument"]]); + this.acroForm = acroForm; + this.doc = doc; + this.dirtyFields = /* @__PURE__ */ new Set(); + this.defaultFontCache = Cache_default.populatedBy(this.embedDefaultFont); + } + PDFForm2.prototype.hasXFA = function() { + return this.acroForm.dict.has(PDFName_default.of("XFA")); + }; + PDFForm2.prototype.deleteXFA = function() { + this.acroForm.dict.delete(PDFName_default.of("XFA")); + }; + PDFForm2.prototype.getFields = function() { + var allFields = this.acroForm.getAllFields(); + var fields = []; + for (var idx = 0, len = allFields.length; idx < len; idx++) { + var _a3 = allFields[idx], acroField = _a3[0], ref = _a3[1]; + var field = convertToPDFField(acroField, ref, this.doc); + if (field) + fields.push(field); + } + return fields; + }; + PDFForm2.prototype.getFieldMaybe = function(name) { + assertIs(name, "name", ["string"]); + var fields = this.getFields(); + for (var idx = 0, len = fields.length; idx < len; idx++) { + var field = fields[idx]; + if (field.getName() === name) + return field; + } + return void 0; + }; + PDFForm2.prototype.getField = function(name) { + assertIs(name, "name", ["string"]); + var field = this.getFieldMaybe(name); + if (field) + return field; + throw new NoSuchFieldError(name); + }; + PDFForm2.prototype.getButton = function(name) { + assertIs(name, "name", ["string"]); + var field = this.getField(name); + if (field instanceof PDFButton_default) + return field; + throw new UnexpectedFieldTypeError(name, PDFButton_default, field); + }; + PDFForm2.prototype.getCheckBox = function(name) { + assertIs(name, "name", ["string"]); + var field = this.getField(name); + if (field instanceof PDFCheckBox_default) + return field; + throw new UnexpectedFieldTypeError(name, PDFCheckBox_default, field); + }; + PDFForm2.prototype.getDropdown = function(name) { + assertIs(name, "name", ["string"]); + var field = this.getField(name); + if (field instanceof PDFDropdown_default) + return field; + throw new UnexpectedFieldTypeError(name, PDFDropdown_default, field); + }; + PDFForm2.prototype.getOptionList = function(name) { + assertIs(name, "name", ["string"]); + var field = this.getField(name); + if (field instanceof PDFOptionList_default) + return field; + throw new UnexpectedFieldTypeError(name, PDFOptionList_default, field); + }; + PDFForm2.prototype.getRadioGroup = function(name) { + assertIs(name, "name", ["string"]); + var field = this.getField(name); + if (field instanceof PDFRadioGroup_default) + return field; + throw new UnexpectedFieldTypeError(name, PDFRadioGroup_default, field); + }; + PDFForm2.prototype.getSignature = function(name) { + assertIs(name, "name", ["string"]); + var field = this.getField(name); + if (field instanceof PDFSignature_default) + return field; + throw new UnexpectedFieldTypeError(name, PDFSignature_default, field); + }; + PDFForm2.prototype.getTextField = function(name) { + assertIs(name, "name", ["string"]); + var field = this.getField(name); + if (field instanceof PDFTextField_default) + return field; + throw new UnexpectedFieldTypeError(name, PDFTextField_default, field); + }; + PDFForm2.prototype.createButton = function(name) { + assertIs(name, "name", ["string"]); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var button = PDFAcroPushButton_default.create(this.doc.context); + button.setPartialName(nameParts.terminal); + addFieldToParent(parent, [button, button.ref], nameParts.terminal); + return PDFButton_default.of(button, button.ref, this.doc); + }; + PDFForm2.prototype.createCheckBox = function(name) { + assertIs(name, "name", ["string"]); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var checkBox = PDFAcroCheckBox_default.create(this.doc.context); + checkBox.setPartialName(nameParts.terminal); + addFieldToParent(parent, [checkBox, checkBox.ref], nameParts.terminal); + return PDFCheckBox_default.of(checkBox, checkBox.ref, this.doc); + }; + PDFForm2.prototype.createDropdown = function(name) { + assertIs(name, "name", ["string"]); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var comboBox = PDFAcroComboBox_default.create(this.doc.context); + comboBox.setPartialName(nameParts.terminal); + addFieldToParent(parent, [comboBox, comboBox.ref], nameParts.terminal); + return PDFDropdown_default.of(comboBox, comboBox.ref, this.doc); + }; + PDFForm2.prototype.createOptionList = function(name) { + assertIs(name, "name", ["string"]); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var listBox = PDFAcroListBox_default.create(this.doc.context); + listBox.setPartialName(nameParts.terminal); + addFieldToParent(parent, [listBox, listBox.ref], nameParts.terminal); + return PDFOptionList_default.of(listBox, listBox.ref, this.doc); + }; + PDFForm2.prototype.createRadioGroup = function(name) { + assertIs(name, "name", ["string"]); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var radioButton = PDFAcroRadioButton_default.create(this.doc.context); + radioButton.setPartialName(nameParts.terminal); + addFieldToParent(parent, [radioButton, radioButton.ref], nameParts.terminal); + return PDFRadioGroup_default.of(radioButton, radioButton.ref, this.doc); + }; + PDFForm2.prototype.createTextField = function(name) { + assertIs(name, "name", ["string"]); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var text2 = PDFAcroText_default.create(this.doc.context); + text2.setPartialName(nameParts.terminal); + addFieldToParent(parent, [text2, text2.ref], nameParts.terminal); + return PDFTextField_default.of(text2, text2.ref, this.doc); + }; + PDFForm2.prototype.flatten = function(options) { + if (options === void 0) { + options = { updateFieldAppearances: true }; + } + if (options.updateFieldAppearances) { + this.updateFieldAppearances(); + } + var fields = this.getFields(); + for (var i = 0, lenFields = fields.length; i < lenFields; i++) { + var field = fields[i]; + var widgets = field.acroField.getWidgets(); + for (var j = 0, lenWidgets = widgets.length; j < lenWidgets; j++) { + var widget = widgets[j]; + var page = this.findWidgetPage(widget); + var widgetRef = this.findWidgetAppearanceRef(field, widget); + var xObjectKey = page.node.newXObject("FlatWidget", widgetRef); + var rectangle = widget.getRectangle(); + var operators = __spreadArrays([ + pushGraphicsState(), + translate(rectangle.x, rectangle.y) + ], rotateInPlace(__assign(__assign({}, rectangle), { rotation: 0 })), [ + drawObject(xObjectKey), + popGraphicsState() + ]).filter(Boolean); + page.pushOperators.apply(page, operators); + } + this.removeField(field); + } + }; + PDFForm2.prototype.removeField = function(field) { + var widgets = field.acroField.getWidgets(); + var pages = /* @__PURE__ */ new Set(); + for (var i = 0, len = widgets.length; i < len; i++) { + var widget = widgets[i]; + var widgetRef = this.findWidgetAppearanceRef(field, widget); + var page = this.findWidgetPage(widget); + pages.add(page); + page.node.removeAnnot(widgetRef); + } + pages.forEach(function(page2) { + return page2.node.removeAnnot(field.ref); + }); + this.acroForm.removeField(field.acroField); + var fieldKids = field.acroField.normalizedEntries().Kids; + var kidsCount = fieldKids.size(); + for (var childIndex = 0; childIndex < kidsCount; childIndex++) { + var child2 = fieldKids.get(childIndex); + if (child2 instanceof PDFRef_default) { + this.doc.context.delete(child2); + } + } + this.doc.context.delete(field.ref); + }; + PDFForm2.prototype.updateFieldAppearances = function(font) { + assertOrUndefined(font, "font", [[PDFFont_default, "PDFFont"]]); + font = font !== null && font !== void 0 ? font : this.getDefaultFont(); + var fields = this.getFields(); + for (var idx = 0, len = fields.length; idx < len; idx++) { + var field = fields[idx]; + if (field.needsAppearancesUpdate()) { + field.defaultUpdateAppearances(font); + } + } + }; + PDFForm2.prototype.markFieldAsDirty = function(fieldRef) { + assertOrUndefined(fieldRef, "fieldRef", [[PDFRef_default, "PDFRef"]]); + this.dirtyFields.add(fieldRef); + }; + PDFForm2.prototype.markFieldAsClean = function(fieldRef) { + assertOrUndefined(fieldRef, "fieldRef", [[PDFRef_default, "PDFRef"]]); + this.dirtyFields.delete(fieldRef); + }; + PDFForm2.prototype.fieldIsDirty = function(fieldRef) { + assertOrUndefined(fieldRef, "fieldRef", [[PDFRef_default, "PDFRef"]]); + return this.dirtyFields.has(fieldRef); + }; + PDFForm2.prototype.getDefaultFont = function() { + return this.defaultFontCache.access(); + }; + PDFForm2.prototype.findWidgetPage = function(widget) { + var pageRef = widget.P(); + var page = this.doc.getPages().find(function(x) { + return x.ref === pageRef; + }); + if (page === void 0) { + var widgetRef = this.doc.context.getObjectRef(widget.dict); + if (widgetRef === void 0) { + throw new Error("Could not find PDFRef for PDFObject"); + } + page = this.doc.findPageForAnnotationRef(widgetRef); + if (page === void 0) { + throw new Error("Could not find page for PDFRef " + widgetRef); + } + } + return page; + }; + PDFForm2.prototype.findWidgetAppearanceRef = function(field, widget) { + var _a3; + var refOrDict = widget.getNormalAppearance(); + if (refOrDict instanceof PDFDict_default && (field instanceof PDFCheckBox_default || field instanceof PDFRadioGroup_default)) { + var value = field.acroField.getValue(); + var ref = (_a3 = refOrDict.get(value)) !== null && _a3 !== void 0 ? _a3 : refOrDict.get(PDFName_default.of("Off")); + if (ref instanceof PDFRef_default) { + refOrDict = ref; + } + } + if (!(refOrDict instanceof PDFRef_default)) { + var name_1 = field.getName(); + throw new Error("Failed to extract appearance ref for: " + name_1); + } + return refOrDict; + }; + PDFForm2.prototype.findOrCreateNonTerminals = function(partialNames) { + var nonTerminal = [ + this.acroForm + ]; + for (var idx = 0, len = partialNames.length; idx < len; idx++) { + var namePart = partialNames[idx]; + if (!namePart) + throw new InvalidFieldNamePartError(namePart); + var parent_1 = nonTerminal[0], parentRef = nonTerminal[1]; + var res = this.findNonTerminal(namePart, parent_1); + if (res) { + nonTerminal = res; + } else { + var node = PDFAcroNonTerminal_default.create(this.doc.context); + node.setPartialName(namePart); + node.setParent(parentRef); + var nodeRef = this.doc.context.register(node.dict); + parent_1.addField(nodeRef); + nonTerminal = [node, nodeRef]; + } + } + return nonTerminal; + }; + PDFForm2.prototype.findNonTerminal = function(partialName, parent) { + var fields = parent instanceof PDFAcroForm_default ? this.acroForm.getFields() : createPDFAcroFields(parent.Kids()); + for (var idx = 0, len = fields.length; idx < len; idx++) { + var _a3 = fields[idx], field = _a3[0], ref = _a3[1]; + if (field.getPartialName() === partialName) { + if (field instanceof PDFAcroNonTerminal_default) + return [field, ref]; + throw new FieldAlreadyExistsError(partialName); + } + } + return void 0; + }; + PDFForm2.of = function(acroForm, doc) { + return new PDFForm2(acroForm, doc); + }; + return PDFForm2; + }() +); +var PDFForm_default = PDFForm; +var convertToPDFField = function(field, ref, doc) { + if (field instanceof PDFAcroPushButton_default) + return PDFButton_default.of(field, ref, doc); + if (field instanceof PDFAcroCheckBox_default) + return PDFCheckBox_default.of(field, ref, doc); + if (field instanceof PDFAcroComboBox_default) + return PDFDropdown_default.of(field, ref, doc); + if (field instanceof PDFAcroListBox_default) + return PDFOptionList_default.of(field, ref, doc); + if (field instanceof PDFAcroText_default) + return PDFTextField_default.of(field, ref, doc); + if (field instanceof PDFAcroRadioButton_default) { + return PDFRadioGroup_default.of(field, ref, doc); + } + if (field instanceof PDFAcroSignature_default) { + return PDFSignature_default.of(field, ref, doc); + } + return void 0; +}; +var splitFieldName = function(fullyQualifiedName) { + if (fullyQualifiedName.length === 0) { + throw new Error("PDF field names must not be empty strings"); + } + var parts = fullyQualifiedName.split("."); + for (var idx = 0, len = parts.length; idx < len; idx++) { + if (parts[idx] === "") { + throw new Error('Periods in PDF field names must be separated by at least one character: "' + fullyQualifiedName + '"'); + } + } + if (parts.length === 1) + return { nonTerminal: [], terminal: parts[0] }; + return { + nonTerminal: parts.slice(0, parts.length - 1), + terminal: parts[parts.length - 1] + }; +}; +var addFieldToParent = function(_a3, _b3, partialName) { + var parent = _a3[0], parentRef = _a3[1]; + var field = _b3[0], fieldRef = _b3[1]; + var entries = parent.normalizedEntries(); + var fields = createPDFAcroFields("Kids" in entries ? entries.Kids : entries.Fields); + for (var idx = 0, len = fields.length; idx < len; idx++) { + if (fields[idx][0].getPartialName() === partialName) { + throw new FieldAlreadyExistsError(partialName); + } + } + parent.addField(fieldRef); + field.setParent(parentRef); +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/sizes.js +var PageSizes = { + "4A0": [4767.87, 6740.79], + "2A0": [3370.39, 4767.87], + A0: [2383.94, 3370.39], + A1: [1683.78, 2383.94], + A2: [1190.55, 1683.78], + A3: [841.89, 1190.55], + A4: [595.28, 841.89], + A5: [419.53, 595.28], + A6: [297.64, 419.53], + A7: [209.76, 297.64], + A8: [147.4, 209.76], + A9: [104.88, 147.4], + A10: [73.7, 104.88], + B0: [2834.65, 4008.19], + B1: [2004.09, 2834.65], + B2: [1417.32, 2004.09], + B3: [1000.63, 1417.32], + B4: [708.66, 1000.63], + B5: [498.9, 708.66], + B6: [354.33, 498.9], + B7: [249.45, 354.33], + B8: [175.75, 249.45], + B9: [124.72, 175.75], + B10: [87.87, 124.72], + C0: [2599.37, 3676.54], + C1: [1836.85, 2599.37], + C2: [1298.27, 1836.85], + C3: [918.43, 1298.27], + C4: [649.13, 918.43], + C5: [459.21, 649.13], + C6: [323.15, 459.21], + C7: [229.61, 323.15], + C8: [161.57, 229.61], + C9: [113.39, 161.57], + C10: [79.37, 113.39], + RA0: [2437.8, 3458.27], + RA1: [1729.13, 2437.8], + RA2: [1218.9, 1729.13], + RA3: [864.57, 1218.9], + RA4: [609.45, 864.57], + SRA0: [2551.18, 3628.35], + SRA1: [1814.17, 2551.18], + SRA2: [1275.59, 1814.17], + SRA3: [907.09, 1275.59], + SRA4: [637.8, 907.09], + Executive: [521.86, 756], + Folio: [612, 936], + Legal: [612, 1008], + Letter: [612, 792], + Tabloid: [792, 1224] +}; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFDocumentOptions.js +var ParseSpeeds; +(function(ParseSpeeds2) { + ParseSpeeds2[ParseSpeeds2["Fastest"] = Infinity] = "Fastest"; + ParseSpeeds2[ParseSpeeds2["Fast"] = 1500] = "Fast"; + ParseSpeeds2[ParseSpeeds2["Medium"] = 500] = "Medium"; + ParseSpeeds2[ParseSpeeds2["Slow"] = 100] = "Slow"; +})(ParseSpeeds || (ParseSpeeds = {})); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFEmbeddedFile.js +var PDFEmbeddedFile = ( + /** @class */ + function() { + function PDFEmbeddedFile2(ref, doc, embedder) { + this.alreadyEmbedded = false; + this.ref = ref; + this.doc = doc; + this.embedder = embedder; + } + PDFEmbeddedFile2.prototype.embed = function() { + return __awaiter(this, void 0, void 0, function() { + var ref, Names, EmbeddedFiles, EFNames, AF; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + if (!!this.alreadyEmbedded) return [3, 2]; + return [4, this.embedder.embedIntoContext(this.doc.context, this.ref)]; + case 1: + ref = _a3.sent(); + if (!this.doc.catalog.has(PDFName_default.of("Names"))) { + this.doc.catalog.set(PDFName_default.of("Names"), this.doc.context.obj({})); + } + Names = this.doc.catalog.lookup(PDFName_default.of("Names"), PDFDict_default); + if (!Names.has(PDFName_default.of("EmbeddedFiles"))) { + Names.set(PDFName_default.of("EmbeddedFiles"), this.doc.context.obj({})); + } + EmbeddedFiles = Names.lookup(PDFName_default.of("EmbeddedFiles"), PDFDict_default); + if (!EmbeddedFiles.has(PDFName_default.of("Names"))) { + EmbeddedFiles.set(PDFName_default.of("Names"), this.doc.context.obj([])); + } + EFNames = EmbeddedFiles.lookup(PDFName_default.of("Names"), PDFArray_default); + EFNames.push(PDFHexString_default.fromText(this.embedder.fileName)); + EFNames.push(ref); + if (!this.doc.catalog.has(PDFName_default.of("AF"))) { + this.doc.catalog.set(PDFName_default.of("AF"), this.doc.context.obj([])); + } + AF = this.doc.catalog.lookup(PDFName_default.of("AF"), PDFArray_default); + AF.push(ref); + this.alreadyEmbedded = true; + _a3.label = 2; + case 2: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFEmbeddedFile2.of = function(ref, doc, embedder) { + return new PDFEmbeddedFile2(ref, doc, embedder); + }; + return PDFEmbeddedFile2; + }() +); +var PDFEmbeddedFile_default = PDFEmbeddedFile; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFJavaScript.js +var PDFJavaScript = ( + /** @class */ + function() { + function PDFJavaScript2(ref, doc, embedder) { + this.alreadyEmbedded = false; + this.ref = ref; + this.doc = doc; + this.embedder = embedder; + } + PDFJavaScript2.prototype.embed = function() { + return __awaiter(this, void 0, void 0, function() { + var _a3, catalog, context, ref, Names, Javascript, JSNames; + return __generator(this, function(_b3) { + switch (_b3.label) { + case 0: + if (!!this.alreadyEmbedded) return [3, 2]; + _a3 = this.doc, catalog = _a3.catalog, context = _a3.context; + return [4, this.embedder.embedIntoContext(this.doc.context, this.ref)]; + case 1: + ref = _b3.sent(); + if (!catalog.has(PDFName_default.of("Names"))) { + catalog.set(PDFName_default.of("Names"), context.obj({})); + } + Names = catalog.lookup(PDFName_default.of("Names"), PDFDict_default); + if (!Names.has(PDFName_default.of("JavaScript"))) { + Names.set(PDFName_default.of("JavaScript"), context.obj({})); + } + Javascript = Names.lookup(PDFName_default.of("JavaScript"), PDFDict_default); + if (!Javascript.has(PDFName_default.of("Names"))) { + Javascript.set(PDFName_default.of("Names"), context.obj([])); + } + JSNames = Javascript.lookup(PDFName_default.of("Names"), PDFArray_default); + JSNames.push(PDFHexString_default.fromText(this.embedder.scriptName)); + JSNames.push(ref); + this.alreadyEmbedded = true; + _b3.label = 2; + case 2: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFJavaScript2.of = function(ref, doc, embedder) { + return new PDFJavaScript2(ref, doc, embedder); + }; + return PDFJavaScript2; + }() +); +var PDFJavaScript_default = PDFJavaScript; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/core/embedders/JavaScriptEmbedder.js +var JavaScriptEmbedder = ( + /** @class */ + function() { + function JavaScriptEmbedder2(script, scriptName) { + this.script = script; + this.scriptName = scriptName; + } + JavaScriptEmbedder2.for = function(script, scriptName) { + return new JavaScriptEmbedder2(script, scriptName); + }; + JavaScriptEmbedder2.prototype.embedIntoContext = function(context, ref) { + return __awaiter(this, void 0, void 0, function() { + var jsActionDict; + return __generator(this, function(_a3) { + jsActionDict = context.obj({ + Type: "Action", + S: "JavaScript", + JS: PDFHexString_default.fromText(this.script) + }); + if (ref) { + context.assign(ref, jsActionDict); + return [2, ref]; + } else { + return [2, context.register(jsActionDict)]; + } + return [ + 2 + /*return*/ + ]; + }); + }); + }; + return JavaScriptEmbedder2; + }() +); +var JavaScriptEmbedder_default = JavaScriptEmbedder; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFDocument.js +var PDFDocument = ( + /** @class */ + function() { + function PDFDocument2(context, ignoreEncryption, updateMetadata) { + var _this = this; + this.defaultWordBreaks = [" "]; + this.computePages = function() { + var pages = []; + _this.catalog.Pages().traverse(function(node, ref) { + if (node instanceof PDFPageLeaf_default) { + var page = _this.pageMap.get(node); + if (!page) { + page = PDFPage_default.of(node, ref, _this); + _this.pageMap.set(node, page); + } + pages.push(page); + } + }); + return pages; + }; + this.getOrCreateForm = function() { + var acroForm = _this.catalog.getOrCreateAcroForm(); + return PDFForm_default.of(acroForm, _this); + }; + assertIs(context, "context", [[PDFContext_default, "PDFContext"]]); + assertIs(ignoreEncryption, "ignoreEncryption", ["boolean"]); + this.context = context; + this.catalog = context.lookup(context.trailerInfo.Root); + this.isEncrypted = !!context.lookup(context.trailerInfo.Encrypt); + this.pageCache = Cache_default.populatedBy(this.computePages); + this.pageMap = /* @__PURE__ */ new Map(); + this.formCache = Cache_default.populatedBy(this.getOrCreateForm); + this.fonts = []; + this.images = []; + this.embeddedPages = []; + this.embeddedFiles = []; + this.javaScripts = []; + if (!ignoreEncryption && this.isEncrypted) + throw new EncryptedPDFError(); + if (updateMetadata) + this.updateInfoDict(); + } + PDFDocument2.load = function(pdf, options) { + if (options === void 0) { + options = {}; + } + return __awaiter(this, void 0, void 0, function() { + var _a3, ignoreEncryption, _b3, parseSpeed, _c2, throwOnInvalidObject, _d, updateMetadata, _e, capNumbers, bytes, context; + return __generator(this, function(_f) { + switch (_f.label) { + case 0: + _a3 = options.ignoreEncryption, ignoreEncryption = _a3 === void 0 ? false : _a3, _b3 = options.parseSpeed, parseSpeed = _b3 === void 0 ? ParseSpeeds.Slow : _b3, _c2 = options.throwOnInvalidObject, throwOnInvalidObject = _c2 === void 0 ? false : _c2, _d = options.updateMetadata, updateMetadata = _d === void 0 ? true : _d, _e = options.capNumbers, capNumbers = _e === void 0 ? false : _e; + assertIs(pdf, "pdf", ["string", Uint8Array, ArrayBuffer]); + assertIs(ignoreEncryption, "ignoreEncryption", ["boolean"]); + assertIs(parseSpeed, "parseSpeed", ["number"]); + assertIs(throwOnInvalidObject, "throwOnInvalidObject", ["boolean"]); + bytes = toUint8Array(pdf); + return [4, PDFParser_default.forBytesWithOptions(bytes, parseSpeed, throwOnInvalidObject, capNumbers).parseDocument()]; + case 1: + context = _f.sent(); + return [2, new PDFDocument2(context, ignoreEncryption, updateMetadata)]; + } + }); + }); + }; + PDFDocument2.create = function(options) { + if (options === void 0) { + options = {}; + } + return __awaiter(this, void 0, void 0, function() { + var _a3, updateMetadata, context, pageTree, pageTreeRef, catalog; + return __generator(this, function(_b3) { + _a3 = options.updateMetadata, updateMetadata = _a3 === void 0 ? true : _a3; + context = PDFContext_default.create(); + pageTree = PDFPageTree_default.withContext(context); + pageTreeRef = context.register(pageTree); + catalog = PDFCatalog_default.withContextAndPages(context, pageTreeRef); + context.trailerInfo.Root = context.register(catalog); + return [2, new PDFDocument2(context, false, updateMetadata)]; + }); + }); + }; + PDFDocument2.prototype.registerFontkit = function(fontkit) { + this.fontkit = fontkit; + }; + PDFDocument2.prototype.getForm = function() { + var form = this.formCache.access(); + if (form.hasXFA()) { + console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"); + form.deleteXFA(); + } + return form; + }; + PDFDocument2.prototype.getTitle = function() { + var title = this.getInfoDict().lookup(PDFName_default.Title); + if (!title) + return void 0; + assertIsLiteralOrHexString(title); + return title.decodeText(); + }; + PDFDocument2.prototype.getAuthor = function() { + var author = this.getInfoDict().lookup(PDFName_default.Author); + if (!author) + return void 0; + assertIsLiteralOrHexString(author); + return author.decodeText(); + }; + PDFDocument2.prototype.getSubject = function() { + var subject = this.getInfoDict().lookup(PDFName_default.Subject); + if (!subject) + return void 0; + assertIsLiteralOrHexString(subject); + return subject.decodeText(); + }; + PDFDocument2.prototype.getKeywords = function() { + var keywords = this.getInfoDict().lookup(PDFName_default.Keywords); + if (!keywords) + return void 0; + assertIsLiteralOrHexString(keywords); + return keywords.decodeText(); + }; + PDFDocument2.prototype.getCreator = function() { + var creator = this.getInfoDict().lookup(PDFName_default.Creator); + if (!creator) + return void 0; + assertIsLiteralOrHexString(creator); + return creator.decodeText(); + }; + PDFDocument2.prototype.getProducer = function() { + var producer = this.getInfoDict().lookup(PDFName_default.Producer); + if (!producer) + return void 0; + assertIsLiteralOrHexString(producer); + return producer.decodeText(); + }; + PDFDocument2.prototype.getCreationDate = function() { + var creationDate = this.getInfoDict().lookup(PDFName_default.CreationDate); + if (!creationDate) + return void 0; + assertIsLiteralOrHexString(creationDate); + return creationDate.decodeDate(); + }; + PDFDocument2.prototype.getModificationDate = function() { + var modificationDate = this.getInfoDict().lookup(PDFName_default.ModDate); + if (!modificationDate) + return void 0; + assertIsLiteralOrHexString(modificationDate); + return modificationDate.decodeDate(); + }; + PDFDocument2.prototype.setTitle = function(title, options) { + assertIs(title, "title", ["string"]); + var key = PDFName_default.of("Title"); + this.getInfoDict().set(key, PDFHexString_default.fromText(title)); + if (options === null || options === void 0 ? void 0 : options.showInWindowTitleBar) { + var prefs = this.catalog.getOrCreateViewerPreferences(); + prefs.setDisplayDocTitle(true); + } + }; + PDFDocument2.prototype.setAuthor = function(author) { + assertIs(author, "author", ["string"]); + var key = PDFName_default.of("Author"); + this.getInfoDict().set(key, PDFHexString_default.fromText(author)); + }; + PDFDocument2.prototype.setSubject = function(subject) { + assertIs(subject, "author", ["string"]); + var key = PDFName_default.of("Subject"); + this.getInfoDict().set(key, PDFHexString_default.fromText(subject)); + }; + PDFDocument2.prototype.setKeywords = function(keywords) { + assertIs(keywords, "keywords", [Array]); + var key = PDFName_default.of("Keywords"); + this.getInfoDict().set(key, PDFHexString_default.fromText(keywords.join(" "))); + }; + PDFDocument2.prototype.setCreator = function(creator) { + assertIs(creator, "creator", ["string"]); + var key = PDFName_default.of("Creator"); + this.getInfoDict().set(key, PDFHexString_default.fromText(creator)); + }; + PDFDocument2.prototype.setProducer = function(producer) { + assertIs(producer, "creator", ["string"]); + var key = PDFName_default.of("Producer"); + this.getInfoDict().set(key, PDFHexString_default.fromText(producer)); + }; + PDFDocument2.prototype.setLanguage = function(language) { + assertIs(language, "language", ["string"]); + var key = PDFName_default.of("Lang"); + this.catalog.set(key, PDFString_default.of(language)); + }; + PDFDocument2.prototype.setCreationDate = function(creationDate) { + assertIs(creationDate, "creationDate", [[Date, "Date"]]); + var key = PDFName_default.of("CreationDate"); + this.getInfoDict().set(key, PDFString_default.fromDate(creationDate)); + }; + PDFDocument2.prototype.setModificationDate = function(modificationDate) { + assertIs(modificationDate, "modificationDate", [[Date, "Date"]]); + var key = PDFName_default.of("ModDate"); + this.getInfoDict().set(key, PDFString_default.fromDate(modificationDate)); + }; + PDFDocument2.prototype.getPageCount = function() { + if (this.pageCount === void 0) + this.pageCount = this.getPages().length; + return this.pageCount; + }; + PDFDocument2.prototype.getPages = function() { + return this.pageCache.access(); + }; + PDFDocument2.prototype.getPage = function(index2) { + var pages = this.getPages(); + assertRange(index2, "index", 0, pages.length - 1); + return pages[index2]; + }; + PDFDocument2.prototype.getPageIndices = function() { + return range(0, this.getPageCount()); + }; + PDFDocument2.prototype.removePage = function(index2) { + var pageCount = this.getPageCount(); + if (this.pageCount === 0) + throw new RemovePageFromEmptyDocumentError(); + assertRange(index2, "index", 0, pageCount - 1); + this.catalog.removeLeafNode(index2); + this.pageCount = pageCount - 1; + }; + PDFDocument2.prototype.addPage = function(page) { + assertIs(page, "page", ["undefined", [PDFPage_default, "PDFPage"], Array]); + return this.insertPage(this.getPageCount(), page); + }; + PDFDocument2.prototype.insertPage = function(index2, page) { + var pageCount = this.getPageCount(); + assertRange(index2, "index", 0, pageCount); + assertIs(page, "page", ["undefined", [PDFPage_default, "PDFPage"], Array]); + if (!page || Array.isArray(page)) { + var dims = Array.isArray(page) ? page : PageSizes.A4; + page = PDFPage_default.create(this); + page.setSize.apply(page, dims); + } else if (page.doc !== this) { + throw new ForeignPageError(); + } + var parentRef = this.catalog.insertLeafNode(page.ref, index2); + page.node.setParent(parentRef); + this.pageMap.set(page.node, page); + this.pageCache.invalidate(); + this.pageCount = pageCount + 1; + return page; + }; + PDFDocument2.prototype.copyPages = function(srcDoc, indices) { + return __awaiter(this, void 0, void 0, function() { + var copier, srcPages, copiedPages, idx, len, srcPage, copiedPage, ref; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + assertIs(srcDoc, "srcDoc", [[PDFDocument2, "PDFDocument"]]); + assertIs(indices, "indices", [Array]); + return [4, srcDoc.flush()]; + case 1: + _a3.sent(); + copier = PDFObjectCopier_default.for(srcDoc.context, this.context); + srcPages = srcDoc.getPages(); + copiedPages = new Array(indices.length); + for (idx = 0, len = indices.length; idx < len; idx++) { + srcPage = srcPages[indices[idx]]; + copiedPage = copier.copy(srcPage.node); + ref = this.context.register(copiedPage); + copiedPages[idx] = PDFPage_default.of(copiedPage, ref, this); + } + return [2, copiedPages]; + } + }); + }); + }; + PDFDocument2.prototype.copy = function() { + return __awaiter(this, void 0, void 0, function() { + var pdfCopy, contentPages, idx, len; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + return [4, PDFDocument2.create()]; + case 1: + pdfCopy = _a3.sent(); + return [4, pdfCopy.copyPages(this, this.getPageIndices())]; + case 2: + contentPages = _a3.sent(); + for (idx = 0, len = contentPages.length; idx < len; idx++) { + pdfCopy.addPage(contentPages[idx]); + } + if (this.getAuthor() !== void 0) { + pdfCopy.setAuthor(this.getAuthor()); + } + if (this.getCreationDate() !== void 0) { + pdfCopy.setCreationDate(this.getCreationDate()); + } + if (this.getCreator() !== void 0) { + pdfCopy.setCreator(this.getCreator()); + } + if (this.getModificationDate() !== void 0) { + pdfCopy.setModificationDate(this.getModificationDate()); + } + if (this.getProducer() !== void 0) { + pdfCopy.setProducer(this.getProducer()); + } + if (this.getSubject() !== void 0) { + pdfCopy.setSubject(this.getSubject()); + } + if (this.getTitle() !== void 0) { + pdfCopy.setTitle(this.getTitle()); + } + pdfCopy.defaultWordBreaks = this.defaultWordBreaks; + return [2, pdfCopy]; + } + }); + }); + }; + PDFDocument2.prototype.addJavaScript = function(name, script) { + assertIs(name, "name", ["string"]); + assertIs(script, "script", ["string"]); + var embedder = JavaScriptEmbedder_default.for(script, name); + var ref = this.context.nextRef(); + var javaScript = PDFJavaScript_default.of(ref, this, embedder); + this.javaScripts.push(javaScript); + }; + PDFDocument2.prototype.attach = function(attachment, name, options) { + if (options === void 0) { + options = {}; + } + return __awaiter(this, void 0, void 0, function() { + var bytes, embedder, ref, embeddedFile; + return __generator(this, function(_a3) { + assertIs(attachment, "attachment", ["string", Uint8Array, ArrayBuffer]); + assertIs(name, "name", ["string"]); + assertOrUndefined(options.mimeType, "mimeType", ["string"]); + assertOrUndefined(options.description, "description", ["string"]); + assertOrUndefined(options.creationDate, "options.creationDate", [Date]); + assertOrUndefined(options.modificationDate, "options.modificationDate", [ + Date + ]); + assertIsOneOfOrUndefined(options.afRelationship, "options.afRelationship", AFRelationship); + bytes = toUint8Array(attachment); + embedder = FileEmbedder_default.for(bytes, name, options); + ref = this.context.nextRef(); + embeddedFile = PDFEmbeddedFile_default.of(ref, this, embedder); + this.embeddedFiles.push(embeddedFile); + return [ + 2 + /*return*/ + ]; + }); + }); + }; + PDFDocument2.prototype.embedFont = function(font, options) { + if (options === void 0) { + options = {}; + } + return __awaiter(this, void 0, void 0, function() { + var _a3, subset, customName, features, embedder, bytes, fontkit, _b3, ref, pdfFont; + return __generator(this, function(_c2) { + switch (_c2.label) { + case 0: + _a3 = options.subset, subset = _a3 === void 0 ? false : _a3, customName = options.customName, features = options.features; + assertIs(font, "font", ["string", Uint8Array, ArrayBuffer]); + assertIs(subset, "subset", ["boolean"]); + if (!isStandardFont(font)) return [3, 1]; + embedder = StandardFontEmbedder_default.for(font, customName); + return [3, 7]; + case 1: + if (!canBeConvertedToUint8Array(font)) return [3, 6]; + bytes = toUint8Array(font); + fontkit = this.assertFontkit(); + if (!subset) return [3, 3]; + return [4, CustomFontSubsetEmbedder_default.for(fontkit, bytes, customName, features)]; + case 2: + _b3 = _c2.sent(); + return [3, 5]; + case 3: + return [4, CustomFontEmbedder_default.for(fontkit, bytes, customName, features)]; + case 4: + _b3 = _c2.sent(); + _c2.label = 5; + case 5: + embedder = _b3; + return [3, 7]; + case 6: + throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`"); + case 7: + ref = this.context.nextRef(); + pdfFont = PDFFont_default.of(ref, this, embedder); + this.fonts.push(pdfFont); + return [2, pdfFont]; + } + }); + }); + }; + PDFDocument2.prototype.embedStandardFont = function(font, customName) { + assertIs(font, "font", ["string"]); + if (!isStandardFont(font)) { + throw new TypeError("`font` must be one of type `StandardFonts`"); + } + var embedder = StandardFontEmbedder_default.for(font, customName); + var ref = this.context.nextRef(); + var pdfFont = PDFFont_default.of(ref, this, embedder); + this.fonts.push(pdfFont); + return pdfFont; + }; + PDFDocument2.prototype.embedJpg = function(jpg) { + return __awaiter(this, void 0, void 0, function() { + var bytes, embedder, ref, pdfImage; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + assertIs(jpg, "jpg", ["string", Uint8Array, ArrayBuffer]); + bytes = toUint8Array(jpg); + return [4, JpegEmbedder_default.for(bytes)]; + case 1: + embedder = _a3.sent(); + ref = this.context.nextRef(); + pdfImage = PDFImage_default.of(ref, this, embedder); + this.images.push(pdfImage); + return [2, pdfImage]; + } + }); + }); + }; + PDFDocument2.prototype.embedPng = function(png) { + return __awaiter(this, void 0, void 0, function() { + var bytes, embedder, ref, pdfImage; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + assertIs(png, "png", ["string", Uint8Array, ArrayBuffer]); + bytes = toUint8Array(png); + return [4, PngEmbedder_default.for(bytes)]; + case 1: + embedder = _a3.sent(); + ref = this.context.nextRef(); + pdfImage = PDFImage_default.of(ref, this, embedder); + this.images.push(pdfImage); + return [2, pdfImage]; + } + }); + }); + }; + PDFDocument2.prototype.embedPdf = function(pdf, indices) { + if (indices === void 0) { + indices = [0]; + } + return __awaiter(this, void 0, void 0, function() { + var srcDoc, _a3, srcPages; + return __generator(this, function(_b3) { + switch (_b3.label) { + case 0: + assertIs(pdf, "pdf", [ + "string", + Uint8Array, + ArrayBuffer, + [PDFDocument2, "PDFDocument"] + ]); + assertIs(indices, "indices", [Array]); + if (!(pdf instanceof PDFDocument2)) return [3, 1]; + _a3 = pdf; + return [3, 3]; + case 1: + return [4, PDFDocument2.load(pdf)]; + case 2: + _a3 = _b3.sent(); + _b3.label = 3; + case 3: + srcDoc = _a3; + srcPages = pluckIndices(srcDoc.getPages(), indices); + return [2, this.embedPages(srcPages)]; + } + }); + }); + }; + PDFDocument2.prototype.embedPage = function(page, boundingBox, transformationMatrix) { + return __awaiter(this, void 0, void 0, function() { + var embeddedPage; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + assertIs(page, "page", [[PDFPage_default, "PDFPage"]]); + return [4, this.embedPages([page], [boundingBox], [transformationMatrix])]; + case 1: + embeddedPage = _a3.sent()[0]; + return [2, embeddedPage]; + } + }); + }); + }; + PDFDocument2.prototype.embedPages = function(pages, boundingBoxes, transformationMatrices) { + if (boundingBoxes === void 0) { + boundingBoxes = []; + } + if (transformationMatrices === void 0) { + transformationMatrices = []; + } + return __awaiter(this, void 0, void 0, function() { + var idx, len, currPage, nextPage, context, maybeCopyPage, embeddedPages, idx, len, page, box, matrix, embedder, ref; + var _a3; + return __generator(this, function(_b3) { + switch (_b3.label) { + case 0: + if (pages.length === 0) + return [2, []]; + for (idx = 0, len = pages.length - 1; idx < len; idx++) { + currPage = pages[idx]; + nextPage = pages[idx + 1]; + if (currPage.node.context !== nextPage.node.context) { + throw new PageEmbeddingMismatchedContextError(); + } + } + context = pages[0].node.context; + maybeCopyPage = context === this.context ? function(p) { + return p; + } : PDFObjectCopier_default.for(context, this.context).copy; + embeddedPages = new Array(pages.length); + idx = 0, len = pages.length; + _b3.label = 1; + case 1: + if (!(idx < len)) return [3, 4]; + page = maybeCopyPage(pages[idx].node); + box = boundingBoxes[idx]; + matrix = transformationMatrices[idx]; + return [4, PDFPageEmbedder_default.for(page, box, matrix)]; + case 2: + embedder = _b3.sent(); + ref = this.context.nextRef(); + embeddedPages[idx] = PDFEmbeddedPage_default.of(ref, this, embedder); + _b3.label = 3; + case 3: + idx++; + return [3, 1]; + case 4: + (_a3 = this.embeddedPages).push.apply(_a3, embeddedPages); + return [2, embeddedPages]; + } + }); + }); + }; + PDFDocument2.prototype.flush = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + return [4, this.embedAll(this.fonts)]; + case 1: + _a3.sent(); + return [4, this.embedAll(this.images)]; + case 2: + _a3.sent(); + return [4, this.embedAll(this.embeddedPages)]; + case 3: + _a3.sent(); + return [4, this.embedAll(this.embeddedFiles)]; + case 4: + _a3.sent(); + return [4, this.embedAll(this.javaScripts)]; + case 5: + _a3.sent(); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFDocument2.prototype.save = function(options) { + if (options === void 0) { + options = {}; + } + return __awaiter(this, void 0, void 0, function() { + var _a3, useObjectStreams, _b3, addDefaultPage, _c2, objectsPerTick, _d, updateFieldAppearances, form, Writer; + return __generator(this, function(_e) { + switch (_e.label) { + case 0: + _a3 = options.useObjectStreams, useObjectStreams = _a3 === void 0 ? true : _a3, _b3 = options.addDefaultPage, addDefaultPage = _b3 === void 0 ? true : _b3, _c2 = options.objectsPerTick, objectsPerTick = _c2 === void 0 ? 50 : _c2, _d = options.updateFieldAppearances, updateFieldAppearances = _d === void 0 ? true : _d; + assertIs(useObjectStreams, "useObjectStreams", ["boolean"]); + assertIs(addDefaultPage, "addDefaultPage", ["boolean"]); + assertIs(objectsPerTick, "objectsPerTick", ["number"]); + assertIs(updateFieldAppearances, "updateFieldAppearances", ["boolean"]); + if (addDefaultPage && this.getPageCount() === 0) + this.addPage(); + if (updateFieldAppearances) { + form = this.formCache.getValue(); + if (form) + form.updateFieldAppearances(); + } + return [4, this.flush()]; + case 1: + _e.sent(); + Writer = useObjectStreams ? PDFStreamWriter_default : PDFWriter_default; + return [2, Writer.forContext(this.context, objectsPerTick).serializeToBuffer()]; + } + }); + }); + }; + PDFDocument2.prototype.saveAsBase64 = function(options) { + if (options === void 0) { + options = {}; + } + return __awaiter(this, void 0, void 0, function() { + var _a3, dataUri, otherOptions, bytes, base64; + return __generator(this, function(_b3) { + switch (_b3.label) { + case 0: + _a3 = options.dataUri, dataUri = _a3 === void 0 ? false : _a3, otherOptions = __rest(options, ["dataUri"]); + assertIs(dataUri, "dataUri", ["boolean"]); + return [4, this.save(otherOptions)]; + case 1: + bytes = _b3.sent(); + base64 = encodeToBase64(bytes); + return [2, dataUri ? "data:application/pdf;base64," + base64 : base64]; + } + }); + }); + }; + PDFDocument2.prototype.findPageForAnnotationRef = function(ref) { + var pages = this.getPages(); + for (var idx = 0, len = pages.length; idx < len; idx++) { + var page = pages[idx]; + var annotations = page.node.Annots(); + if ((annotations === null || annotations === void 0 ? void 0 : annotations.indexOf(ref)) !== void 0) { + return page; + } + } + return void 0; + }; + PDFDocument2.prototype.embedAll = function(embeddables) { + return __awaiter(this, void 0, void 0, function() { + var idx, len; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + idx = 0, len = embeddables.length; + _a3.label = 1; + case 1: + if (!(idx < len)) return [3, 4]; + return [4, embeddables[idx].embed()]; + case 2: + _a3.sent(); + _a3.label = 3; + case 3: + idx++; + return [3, 1]; + case 4: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + PDFDocument2.prototype.updateInfoDict = function() { + var pdfLib = "pdf-lib (https://github.com/Hopding/pdf-lib)"; + var now = /* @__PURE__ */ new Date(); + var info = this.getInfoDict(); + this.setProducer(pdfLib); + this.setModificationDate(now); + if (!info.get(PDFName_default.of("Creator"))) + this.setCreator(pdfLib); + if (!info.get(PDFName_default.of("CreationDate"))) + this.setCreationDate(now); + }; + PDFDocument2.prototype.getInfoDict = function() { + var existingInfo = this.context.lookup(this.context.trailerInfo.Info); + if (existingInfo instanceof PDFDict_default) + return existingInfo; + var newInfo = this.context.obj({}); + this.context.trailerInfo.Info = this.context.register(newInfo); + return newInfo; + }; + PDFDocument2.prototype.assertFontkit = function() { + if (!this.fontkit) + throw new FontkitNotRegisteredError(); + return this.fontkit; + }; + return PDFDocument2; + }() +); +var PDFDocument_default = PDFDocument; +function assertIsLiteralOrHexString(pdfObject) { + if (!(pdfObject instanceof PDFHexString_default) && !(pdfObject instanceof PDFString_default)) { + throw new UnexpectedObjectTypeError([PDFHexString_default, PDFString_default], pdfObject); + } +} + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFPageOptions.js +var BlendMode; +(function(BlendMode2) { + BlendMode2["Normal"] = "Normal"; + BlendMode2["Multiply"] = "Multiply"; + BlendMode2["Screen"] = "Screen"; + BlendMode2["Overlay"] = "Overlay"; + BlendMode2["Darken"] = "Darken"; + BlendMode2["Lighten"] = "Lighten"; + BlendMode2["ColorDodge"] = "ColorDodge"; + BlendMode2["ColorBurn"] = "ColorBurn"; + BlendMode2["HardLight"] = "HardLight"; + BlendMode2["SoftLight"] = "SoftLight"; + BlendMode2["Difference"] = "Difference"; + BlendMode2["Exclusion"] = "Exclusion"; +})(BlendMode || (BlendMode = {})); + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/PDFPage.js +var PDFPage = ( + /** @class */ + function() { + function PDFPage2(leafNode, ref, doc) { + this.fontSize = 24; + this.fontColor = rgb(0, 0, 0); + this.lineHeight = 24; + this.x = 0; + this.y = 0; + assertIs(leafNode, "leafNode", [[PDFPageLeaf_default, "PDFPageLeaf"]]); + assertIs(ref, "ref", [[PDFRef_default, "PDFRef"]]); + assertIs(doc, "doc", [[PDFDocument_default, "PDFDocument"]]); + this.node = leafNode; + this.ref = ref; + this.doc = doc; + } + PDFPage2.prototype.setRotation = function(angle) { + var degreesAngle = toDegrees(angle); + assertMultiple(degreesAngle, "degreesAngle", 90); + this.node.set(PDFName_default.of("Rotate"), this.doc.context.obj(degreesAngle)); + }; + PDFPage2.prototype.getRotation = function() { + var Rotate = this.node.Rotate(); + return degrees(Rotate ? Rotate.asNumber() : 0); + }; + PDFPage2.prototype.setSize = function(width, height) { + assertIs(width, "width", ["number"]); + assertIs(height, "height", ["number"]); + var mediaBox = this.getMediaBox(); + this.setMediaBox(mediaBox.x, mediaBox.y, width, height); + var cropBox = this.getCropBox(); + var bleedBox = this.getBleedBox(); + var trimBox = this.getTrimBox(); + var artBox = this.getArtBox(); + var hasCropBox = this.node.CropBox(); + var hasBleedBox = this.node.BleedBox(); + var hasTrimBox = this.node.TrimBox(); + var hasArtBox = this.node.ArtBox(); + if (hasCropBox && rectanglesAreEqual(cropBox, mediaBox)) { + this.setCropBox(mediaBox.x, mediaBox.y, width, height); + } + if (hasBleedBox && rectanglesAreEqual(bleedBox, mediaBox)) { + this.setBleedBox(mediaBox.x, mediaBox.y, width, height); + } + if (hasTrimBox && rectanglesAreEqual(trimBox, mediaBox)) { + this.setTrimBox(mediaBox.x, mediaBox.y, width, height); + } + if (hasArtBox && rectanglesAreEqual(artBox, mediaBox)) { + this.setArtBox(mediaBox.x, mediaBox.y, width, height); + } + }; + PDFPage2.prototype.setWidth = function(width) { + assertIs(width, "width", ["number"]); + this.setSize(width, this.getSize().height); + }; + PDFPage2.prototype.setHeight = function(height) { + assertIs(height, "height", ["number"]); + this.setSize(this.getSize().width, height); + }; + PDFPage2.prototype.setMediaBox = function(x, y, width, height) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + assertIs(width, "width", ["number"]); + assertIs(height, "height", ["number"]); + var mediaBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(PDFName_default.MediaBox, mediaBox); + }; + PDFPage2.prototype.setCropBox = function(x, y, width, height) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + assertIs(width, "width", ["number"]); + assertIs(height, "height", ["number"]); + var cropBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(PDFName_default.CropBox, cropBox); + }; + PDFPage2.prototype.setBleedBox = function(x, y, width, height) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + assertIs(width, "width", ["number"]); + assertIs(height, "height", ["number"]); + var bleedBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(PDFName_default.BleedBox, bleedBox); + }; + PDFPage2.prototype.setTrimBox = function(x, y, width, height) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + assertIs(width, "width", ["number"]); + assertIs(height, "height", ["number"]); + var trimBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(PDFName_default.TrimBox, trimBox); + }; + PDFPage2.prototype.setArtBox = function(x, y, width, height) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + assertIs(width, "width", ["number"]); + assertIs(height, "height", ["number"]); + var artBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(PDFName_default.ArtBox, artBox); + }; + PDFPage2.prototype.getSize = function() { + var _a3 = this.getMediaBox(), width = _a3.width, height = _a3.height; + return { width, height }; + }; + PDFPage2.prototype.getWidth = function() { + return this.getSize().width; + }; + PDFPage2.prototype.getHeight = function() { + return this.getSize().height; + }; + PDFPage2.prototype.getMediaBox = function() { + var mediaBox = this.node.MediaBox(); + return mediaBox.asRectangle(); + }; + PDFPage2.prototype.getCropBox = function() { + var _a3; + var cropBox = this.node.CropBox(); + return (_a3 = cropBox === null || cropBox === void 0 ? void 0 : cropBox.asRectangle()) !== null && _a3 !== void 0 ? _a3 : this.getMediaBox(); + }; + PDFPage2.prototype.getBleedBox = function() { + var _a3; + var bleedBox = this.node.BleedBox(); + return (_a3 = bleedBox === null || bleedBox === void 0 ? void 0 : bleedBox.asRectangle()) !== null && _a3 !== void 0 ? _a3 : this.getCropBox(); + }; + PDFPage2.prototype.getTrimBox = function() { + var _a3; + var trimBox = this.node.TrimBox(); + return (_a3 = trimBox === null || trimBox === void 0 ? void 0 : trimBox.asRectangle()) !== null && _a3 !== void 0 ? _a3 : this.getCropBox(); + }; + PDFPage2.prototype.getArtBox = function() { + var _a3; + var artBox = this.node.ArtBox(); + return (_a3 = artBox === null || artBox === void 0 ? void 0 : artBox.asRectangle()) !== null && _a3 !== void 0 ? _a3 : this.getCropBox(); + }; + PDFPage2.prototype.translateContent = function(x, y) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + this.node.normalize(); + this.getContentStream(); + var start = this.createContentStream(pushGraphicsState(), translate(x, y)); + var startRef = this.doc.context.register(start); + var end = this.createContentStream(popGraphicsState()); + var endRef = this.doc.context.register(end); + this.node.wrapContentStreams(startRef, endRef); + }; + PDFPage2.prototype.scale = function(x, y) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + this.setSize(this.getWidth() * x, this.getHeight() * y); + this.scaleContent(x, y); + this.scaleAnnotations(x, y); + }; + PDFPage2.prototype.scaleContent = function(x, y) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + this.node.normalize(); + this.getContentStream(); + var start = this.createContentStream(pushGraphicsState(), scale(x, y)); + var startRef = this.doc.context.register(start); + var end = this.createContentStream(popGraphicsState()); + var endRef = this.doc.context.register(end); + this.node.wrapContentStreams(startRef, endRef); + }; + PDFPage2.prototype.scaleAnnotations = function(x, y) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + var annots = this.node.Annots(); + if (!annots) + return; + for (var idx = 0; idx < annots.size(); idx++) { + var annot = annots.lookup(idx); + if (annot instanceof PDFDict_default) + this.scaleAnnot(annot, x, y); + } + }; + PDFPage2.prototype.resetPosition = function() { + this.getContentStream(false); + this.x = 0; + this.y = 0; + }; + PDFPage2.prototype.setFont = function(font) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + this.font = font; + this.fontKey = this.node.newFontDictionary(this.font.name, this.font.ref); + }; + PDFPage2.prototype.setFontSize = function(fontSize) { + assertIs(fontSize, "fontSize", ["number"]); + this.fontSize = fontSize; + }; + PDFPage2.prototype.setFontColor = function(fontColor) { + assertIs(fontColor, "fontColor", [[Object, "Color"]]); + this.fontColor = fontColor; + }; + PDFPage2.prototype.setLineHeight = function(lineHeight) { + assertIs(lineHeight, "lineHeight", ["number"]); + this.lineHeight = lineHeight; + }; + PDFPage2.prototype.getPosition = function() { + return { x: this.x, y: this.y }; + }; + PDFPage2.prototype.getX = function() { + return this.x; + }; + PDFPage2.prototype.getY = function() { + return this.y; + }; + PDFPage2.prototype.moveTo = function(x, y) { + assertIs(x, "x", ["number"]); + assertIs(y, "y", ["number"]); + this.x = x; + this.y = y; + }; + PDFPage2.prototype.moveDown = function(yDecrease) { + assertIs(yDecrease, "yDecrease", ["number"]); + this.y -= yDecrease; + }; + PDFPage2.prototype.moveUp = function(yIncrease) { + assertIs(yIncrease, "yIncrease", ["number"]); + this.y += yIncrease; + }; + PDFPage2.prototype.moveLeft = function(xDecrease) { + assertIs(xDecrease, "xDecrease", ["number"]); + this.x -= xDecrease; + }; + PDFPage2.prototype.moveRight = function(xIncrease) { + assertIs(xIncrease, "xIncrease", ["number"]); + this.x += xIncrease; + }; + PDFPage2.prototype.pushOperators = function() { + var operator = []; + for (var _i = 0; _i < arguments.length; _i++) { + operator[_i] = arguments[_i]; + } + assertEachIs(operator, "operator", [[PDFOperator_default, "PDFOperator"]]); + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operator); + }; + PDFPage2.prototype.drawText = function(text2, options) { + var _a3, _b3, _c2, _d, _e, _f, _g; + if (options === void 0) { + options = {}; + } + assertIs(text2, "text", ["string"]); + assertOrUndefined(options.color, "options.color", [[Object, "Color"]]); + assertRangeOrUndefined(options.opacity, "opacity.opacity", 0, 1); + assertOrUndefined(options.font, "options.font", [[PDFFont_default, "PDFFont"]]); + assertOrUndefined(options.size, "options.size", ["number"]); + assertOrUndefined(options.rotate, "options.rotate", [[Object, "Rotation"]]); + assertOrUndefined(options.xSkew, "options.xSkew", [[Object, "Rotation"]]); + assertOrUndefined(options.ySkew, "options.ySkew", [[Object, "Rotation"]]); + assertOrUndefined(options.x, "options.x", ["number"]); + assertOrUndefined(options.y, "options.y", ["number"]); + assertOrUndefined(options.lineHeight, "options.lineHeight", ["number"]); + assertOrUndefined(options.maxWidth, "options.maxWidth", ["number"]); + assertOrUndefined(options.wordBreaks, "options.wordBreaks", [Array]); + assertIsOneOfOrUndefined(options.blendMode, "options.blendMode", BlendMode); + var _h = this.setOrEmbedFont(options.font), oldFont = _h.oldFont, newFont = _h.newFont, newFontKey = _h.newFontKey; + var fontSize = options.size || this.fontSize; + var wordBreaks = options.wordBreaks || this.doc.defaultWordBreaks; + var textWidth = function(t) { + return newFont.widthOfTextAtSize(t, fontSize); + }; + var lines = options.maxWidth === void 0 ? lineSplit(cleanText(text2)) : breakTextIntoLines(text2, wordBreaks, options.maxWidth, textWidth); + var encodedLines = new Array(lines.length); + for (var idx = 0, len = lines.length; idx < len; idx++) { + encodedLines[idx] = newFont.encodeText(lines[idx]); + } + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + blendMode: options.blendMode + }); + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, drawLinesOfText(encodedLines, { + color: (_a3 = options.color) !== null && _a3 !== void 0 ? _a3 : this.fontColor, + font: newFontKey, + size: fontSize, + rotate: (_b3 = options.rotate) !== null && _b3 !== void 0 ? _b3 : degrees(0), + xSkew: (_c2 = options.xSkew) !== null && _c2 !== void 0 ? _c2 : degrees(0), + ySkew: (_d = options.ySkew) !== null && _d !== void 0 ? _d : degrees(0), + x: (_e = options.x) !== null && _e !== void 0 ? _e : this.x, + y: (_f = options.y) !== null && _f !== void 0 ? _f : this.y, + lineHeight: (_g = options.lineHeight) !== null && _g !== void 0 ? _g : this.lineHeight, + graphicsState: graphicsStateKey + })); + if (options.font) { + if (oldFont) + this.setFont(oldFont); + else + this.resetFont(); + } + }; + PDFPage2.prototype.drawImage = function(image, options) { + var _a3, _b3, _c2, _d, _e, _f, _g; + if (options === void 0) { + options = {}; + } + assertIs(image, "image", [[PDFImage_default, "PDFImage"]]); + assertOrUndefined(options.x, "options.x", ["number"]); + assertOrUndefined(options.y, "options.y", ["number"]); + assertOrUndefined(options.width, "options.width", ["number"]); + assertOrUndefined(options.height, "options.height", ["number"]); + assertOrUndefined(options.rotate, "options.rotate", [[Object, "Rotation"]]); + assertOrUndefined(options.xSkew, "options.xSkew", [[Object, "Rotation"]]); + assertOrUndefined(options.ySkew, "options.ySkew", [[Object, "Rotation"]]); + assertRangeOrUndefined(options.opacity, "opacity.opacity", 0, 1); + assertIsOneOfOrUndefined(options.blendMode, "options.blendMode", BlendMode); + var xObjectKey = this.node.newXObject("Image", image.ref); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + blendMode: options.blendMode + }); + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, drawImage(xObjectKey, { + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : this.x, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : this.y, + width: (_c2 = options.width) !== null && _c2 !== void 0 ? _c2 : image.size().width, + height: (_d = options.height) !== null && _d !== void 0 ? _d : image.size().height, + rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : degrees(0), + xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : degrees(0), + ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : degrees(0), + graphicsState: graphicsStateKey + })); + }; + PDFPage2.prototype.drawPage = function(embeddedPage, options) { + var _a3, _b3, _c2, _d, _e; + if (options === void 0) { + options = {}; + } + assertIs(embeddedPage, "embeddedPage", [ + [PDFEmbeddedPage_default, "PDFEmbeddedPage"] + ]); + assertOrUndefined(options.x, "options.x", ["number"]); + assertOrUndefined(options.y, "options.y", ["number"]); + assertOrUndefined(options.xScale, "options.xScale", ["number"]); + assertOrUndefined(options.yScale, "options.yScale", ["number"]); + assertOrUndefined(options.width, "options.width", ["number"]); + assertOrUndefined(options.height, "options.height", ["number"]); + assertOrUndefined(options.rotate, "options.rotate", [[Object, "Rotation"]]); + assertOrUndefined(options.xSkew, "options.xSkew", [[Object, "Rotation"]]); + assertOrUndefined(options.ySkew, "options.ySkew", [[Object, "Rotation"]]); + assertRangeOrUndefined(options.opacity, "opacity.opacity", 0, 1); + assertIsOneOfOrUndefined(options.blendMode, "options.blendMode", BlendMode); + var xObjectKey = this.node.newXObject("EmbeddedPdfPage", embeddedPage.ref); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + blendMode: options.blendMode + }); + var xScale = options.width !== void 0 ? options.width / embeddedPage.width : options.xScale !== void 0 ? options.xScale : 1; + var yScale = options.height !== void 0 ? options.height / embeddedPage.height : options.yScale !== void 0 ? options.yScale : 1; + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, drawPage(xObjectKey, { + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : this.x, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : this.y, + xScale, + yScale, + rotate: (_c2 = options.rotate) !== null && _c2 !== void 0 ? _c2 : degrees(0), + xSkew: (_d = options.xSkew) !== null && _d !== void 0 ? _d : degrees(0), + ySkew: (_e = options.ySkew) !== null && _e !== void 0 ? _e : degrees(0), + graphicsState: graphicsStateKey + })); + }; + PDFPage2.prototype.drawSvgPath = function(path3, options) { + var _a3, _b3, _c2, _d, _e, _f, _g, _h, _j; + if (options === void 0) { + options = {}; + } + assertIs(path3, "path", ["string"]); + assertOrUndefined(options.x, "options.x", ["number"]); + assertOrUndefined(options.y, "options.y", ["number"]); + assertOrUndefined(options.scale, "options.scale", ["number"]); + assertOrUndefined(options.rotate, "options.rotate", [[Object, "Rotation"]]); + assertOrUndefined(options.borderWidth, "options.borderWidth", ["number"]); + assertOrUndefined(options.color, "options.color", [[Object, "Color"]]); + assertRangeOrUndefined(options.opacity, "opacity.opacity", 0, 1); + assertOrUndefined(options.borderColor, "options.borderColor", [ + [Object, "Color"] + ]); + assertOrUndefined(options.borderDashArray, "options.borderDashArray", [ + Array + ]); + assertOrUndefined(options.borderDashPhase, "options.borderDashPhase", [ + "number" + ]); + assertIsOneOfOrUndefined(options.borderLineCap, "options.borderLineCap", LineCapStyle); + assertRangeOrUndefined(options.borderOpacity, "options.borderOpacity", 0, 1); + assertIsOneOfOrUndefined(options.blendMode, "options.blendMode", BlendMode); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + borderOpacity: options.borderOpacity, + blendMode: options.blendMode + }); + if (!("color" in options) && !("borderColor" in options)) { + options.borderColor = rgb(0, 0, 0); + } + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, drawSvgPath(path3, { + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : this.x, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : this.y, + scale: options.scale, + rotate: (_c2 = options.rotate) !== null && _c2 !== void 0 ? _c2 : degrees(0), + color: (_d = options.color) !== null && _d !== void 0 ? _d : void 0, + borderColor: (_e = options.borderColor) !== null && _e !== void 0 ? _e : void 0, + borderWidth: (_f = options.borderWidth) !== null && _f !== void 0 ? _f : 0, + borderDashArray: (_g = options.borderDashArray) !== null && _g !== void 0 ? _g : void 0, + borderDashPhase: (_h = options.borderDashPhase) !== null && _h !== void 0 ? _h : void 0, + borderLineCap: (_j = options.borderLineCap) !== null && _j !== void 0 ? _j : void 0, + graphicsState: graphicsStateKey + })); + }; + PDFPage2.prototype.drawLine = function(options) { + var _a3, _b3, _c2, _d, _e; + assertIs(options.start, "options.start", [ + [Object, "{ x: number, y: number }"] + ]); + assertIs(options.end, "options.end", [ + [Object, "{ x: number, y: number }"] + ]); + assertIs(options.start.x, "options.start.x", ["number"]); + assertIs(options.start.y, "options.start.y", ["number"]); + assertIs(options.end.x, "options.end.x", ["number"]); + assertIs(options.end.y, "options.end.y", ["number"]); + assertOrUndefined(options.thickness, "options.thickness", ["number"]); + assertOrUndefined(options.color, "options.color", [[Object, "Color"]]); + assertOrUndefined(options.dashArray, "options.dashArray", [Array]); + assertOrUndefined(options.dashPhase, "options.dashPhase", ["number"]); + assertIsOneOfOrUndefined(options.lineCap, "options.lineCap", LineCapStyle); + assertRangeOrUndefined(options.opacity, "opacity.opacity", 0, 1); + assertIsOneOfOrUndefined(options.blendMode, "options.blendMode", BlendMode); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + borderOpacity: options.opacity, + blendMode: options.blendMode + }); + if (!("color" in options)) { + options.color = rgb(0, 0, 0); + } + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, drawLine({ + start: options.start, + end: options.end, + thickness: (_a3 = options.thickness) !== null && _a3 !== void 0 ? _a3 : 1, + color: (_b3 = options.color) !== null && _b3 !== void 0 ? _b3 : void 0, + dashArray: (_c2 = options.dashArray) !== null && _c2 !== void 0 ? _c2 : void 0, + dashPhase: (_d = options.dashPhase) !== null && _d !== void 0 ? _d : void 0, + lineCap: (_e = options.lineCap) !== null && _e !== void 0 ? _e : void 0, + graphicsState: graphicsStateKey + })); + }; + PDFPage2.prototype.drawRectangle = function(options) { + var _a3, _b3, _c2, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; + if (options === void 0) { + options = {}; + } + assertOrUndefined(options.x, "options.x", ["number"]); + assertOrUndefined(options.y, "options.y", ["number"]); + assertOrUndefined(options.width, "options.width", ["number"]); + assertOrUndefined(options.height, "options.height", ["number"]); + assertOrUndefined(options.rotate, "options.rotate", [[Object, "Rotation"]]); + assertOrUndefined(options.xSkew, "options.xSkew", [[Object, "Rotation"]]); + assertOrUndefined(options.ySkew, "options.ySkew", [[Object, "Rotation"]]); + assertOrUndefined(options.borderWidth, "options.borderWidth", ["number"]); + assertOrUndefined(options.color, "options.color", [[Object, "Color"]]); + assertRangeOrUndefined(options.opacity, "opacity.opacity", 0, 1); + assertOrUndefined(options.borderColor, "options.borderColor", [ + [Object, "Color"] + ]); + assertOrUndefined(options.borderDashArray, "options.borderDashArray", [ + Array + ]); + assertOrUndefined(options.borderDashPhase, "options.borderDashPhase", [ + "number" + ]); + assertIsOneOfOrUndefined(options.borderLineCap, "options.borderLineCap", LineCapStyle); + assertRangeOrUndefined(options.borderOpacity, "options.borderOpacity", 0, 1); + assertIsOneOfOrUndefined(options.blendMode, "options.blendMode", BlendMode); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + borderOpacity: options.borderOpacity, + blendMode: options.blendMode + }); + if (!("color" in options) && !("borderColor" in options)) { + options.color = rgb(0, 0, 0); + } + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, drawRectangle({ + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : this.x, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : this.y, + width: (_c2 = options.width) !== null && _c2 !== void 0 ? _c2 : 150, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 100, + rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : degrees(0), + xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : degrees(0), + ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : degrees(0), + borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0, + color: (_j = options.color) !== null && _j !== void 0 ? _j : void 0, + borderColor: (_k = options.borderColor) !== null && _k !== void 0 ? _k : void 0, + borderDashArray: (_l = options.borderDashArray) !== null && _l !== void 0 ? _l : void 0, + borderDashPhase: (_m = options.borderDashPhase) !== null && _m !== void 0 ? _m : void 0, + graphicsState: graphicsStateKey, + borderLineCap: (_o = options.borderLineCap) !== null && _o !== void 0 ? _o : void 0 + })); + }; + PDFPage2.prototype.drawSquare = function(options) { + if (options === void 0) { + options = {}; + } + var size = options.size; + assertOrUndefined(size, "size", ["number"]); + this.drawRectangle(__assign(__assign({}, options), { width: size, height: size })); + }; + PDFPage2.prototype.drawEllipse = function(options) { + var _a3, _b3, _c2, _d, _e, _f, _g, _h, _j, _k, _l; + if (options === void 0) { + options = {}; + } + assertOrUndefined(options.x, "options.x", ["number"]); + assertOrUndefined(options.y, "options.y", ["number"]); + assertOrUndefined(options.xScale, "options.xScale", ["number"]); + assertOrUndefined(options.yScale, "options.yScale", ["number"]); + assertOrUndefined(options.rotate, "options.rotate", [[Object, "Rotation"]]); + assertOrUndefined(options.color, "options.color", [[Object, "Color"]]); + assertRangeOrUndefined(options.opacity, "opacity.opacity", 0, 1); + assertOrUndefined(options.borderColor, "options.borderColor", [ + [Object, "Color"] + ]); + assertRangeOrUndefined(options.borderOpacity, "options.borderOpacity", 0, 1); + assertOrUndefined(options.borderWidth, "options.borderWidth", ["number"]); + assertOrUndefined(options.borderDashArray, "options.borderDashArray", [ + Array + ]); + assertOrUndefined(options.borderDashPhase, "options.borderDashPhase", [ + "number" + ]); + assertIsOneOfOrUndefined(options.borderLineCap, "options.borderLineCap", LineCapStyle); + assertIsOneOfOrUndefined(options.blendMode, "options.blendMode", BlendMode); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + borderOpacity: options.borderOpacity, + blendMode: options.blendMode + }); + if (!("color" in options) && !("borderColor" in options)) { + options.color = rgb(0, 0, 0); + } + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, drawEllipse({ + x: (_a3 = options.x) !== null && _a3 !== void 0 ? _a3 : this.x, + y: (_b3 = options.y) !== null && _b3 !== void 0 ? _b3 : this.y, + xScale: (_c2 = options.xScale) !== null && _c2 !== void 0 ? _c2 : 100, + yScale: (_d = options.yScale) !== null && _d !== void 0 ? _d : 100, + rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : void 0, + color: (_f = options.color) !== null && _f !== void 0 ? _f : void 0, + borderColor: (_g = options.borderColor) !== null && _g !== void 0 ? _g : void 0, + borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0, + borderDashArray: (_j = options.borderDashArray) !== null && _j !== void 0 ? _j : void 0, + borderDashPhase: (_k = options.borderDashPhase) !== null && _k !== void 0 ? _k : void 0, + borderLineCap: (_l = options.borderLineCap) !== null && _l !== void 0 ? _l : void 0, + graphicsState: graphicsStateKey + })); + }; + PDFPage2.prototype.drawCircle = function(options) { + if (options === void 0) { + options = {}; + } + var _a3 = options.size, size = _a3 === void 0 ? 100 : _a3; + assertOrUndefined(size, "size", ["number"]); + this.drawEllipse(__assign(__assign({}, options), { xScale: size, yScale: size })); + }; + PDFPage2.prototype.setOrEmbedFont = function(font) { + var oldFont = this.font; + var oldFontKey = this.fontKey; + if (font) + this.setFont(font); + else + this.getFont(); + var newFont = this.font; + var newFontKey = this.fontKey; + return { oldFont, oldFontKey, newFont, newFontKey }; + }; + PDFPage2.prototype.getFont = function() { + if (!this.font || !this.fontKey) { + var font = this.doc.embedStandardFont(StandardFonts.Helvetica); + this.setFont(font); + } + return [this.font, this.fontKey]; + }; + PDFPage2.prototype.resetFont = function() { + this.font = void 0; + this.fontKey = void 0; + }; + PDFPage2.prototype.getContentStream = function(useExisting) { + if (useExisting === void 0) { + useExisting = true; + } + if (useExisting && this.contentStream) + return this.contentStream; + this.contentStream = this.createContentStream(); + this.contentStreamRef = this.doc.context.register(this.contentStream); + this.node.addContentStream(this.contentStreamRef); + return this.contentStream; + }; + PDFPage2.prototype.createContentStream = function() { + var operators = []; + for (var _i = 0; _i < arguments.length; _i++) { + operators[_i] = arguments[_i]; + } + var dict = this.doc.context.obj({}); + var contentStream = PDFContentStream_default.of(dict, operators); + return contentStream; + }; + PDFPage2.prototype.maybeEmbedGraphicsState = function(options) { + var opacity = options.opacity, borderOpacity = options.borderOpacity, blendMode = options.blendMode; + if (opacity === void 0 && borderOpacity === void 0 && blendMode === void 0) { + return void 0; + } + var graphicsState = this.doc.context.obj({ + Type: "ExtGState", + ca: opacity, + CA: borderOpacity, + BM: blendMode + }); + var key = this.node.newExtGState("GS", graphicsState); + return key; + }; + PDFPage2.prototype.scaleAnnot = function(annot, x, y) { + var selectors = ["RD", "CL", "Vertices", "QuadPoints", "L", "Rect"]; + for (var idx = 0, len = selectors.length; idx < len; idx++) { + var list = annot.lookup(PDFName_default.of(selectors[idx])); + if (list instanceof PDFArray_default) + list.scalePDFNumbers(x, y); + } + var inkLists = annot.lookup(PDFName_default.of("InkList")); + if (inkLists instanceof PDFArray_default) { + for (var idx = 0, len = inkLists.size(); idx < len; idx++) { + var arr = inkLists.lookup(idx); + if (arr instanceof PDFArray_default) + arr.scalePDFNumbers(x, y); + } + } + }; + PDFPage2.of = function(leafNode, ref, doc) { + return new PDFPage2(leafNode, ref, doc); + }; + PDFPage2.create = function(doc) { + assertIs(doc, "doc", [[PDFDocument_default, "PDFDocument"]]); + var dummyRef = PDFRef_default.of(-1); + var pageLeaf = PDFPageLeaf_default.withContextAndParent(doc.context, dummyRef); + var pageRef = doc.context.register(pageLeaf); + return new PDFPage2(pageLeaf, pageRef, doc); + }; + return PDFPage2; + }() +); +var PDFPage_default = PDFPage; + +// node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/form/PDFButton.js +var PDFButton = ( + /** @class */ + function(_super) { + __extends(PDFButton2, _super); + function PDFButton2(acroPushButton, ref, doc) { + var _this = _super.call(this, acroPushButton, ref, doc) || this; + assertIs(acroPushButton, "acroButton", [ + [PDFAcroPushButton_default, "PDFAcroPushButton"] + ]); + _this.acroField = acroPushButton; + return _this; + } + PDFButton2.prototype.setImage = function(image, alignment) { + if (alignment === void 0) { + alignment = ImageAlignment.Center; + } + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var streamRef = this.createImageAppearanceStream(widget, image, alignment); + this.updateWidgetAppearances(widget, { normal: streamRef }); + } + this.markAsClean(); + }; + PDFButton2.prototype.setFontSize = function(fontSize) { + assertPositive(fontSize, "fontSize"); + this.acroField.setFontSize(fontSize); + this.markAsDirty(); + }; + PDFButton2.prototype.addToPage = function(text2, page, options) { + var _a3, _b3, _c2, _d, _e, _f, _g, _h, _j, _k, _l; + assertOrUndefined(text2, "text", ["string"]); + assertOrUndefined(page, "page", [[PDFPage_default, "PDFPage"]]); + assertFieldAppearanceOptions(options); + var widget = this.createWidget({ + x: ((_a3 = options === null || options === void 0 ? void 0 : options.x) !== null && _a3 !== void 0 ? _a3 : 0) - ((_b3 = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _b3 !== void 0 ? _b3 : 0) / 2, + y: ((_c2 = options === null || options === void 0 ? void 0 : options.y) !== null && _c2 !== void 0 ? _c2 : 0) - ((_d = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _d !== void 0 ? _d : 0) / 2, + width: (_e = options === null || options === void 0 ? void 0 : options.width) !== null && _e !== void 0 ? _e : 100, + height: (_f = options === null || options === void 0 ? void 0 : options.height) !== null && _f !== void 0 ? _f : 50, + textColor: (_g = options === null || options === void 0 ? void 0 : options.textColor) !== null && _g !== void 0 ? _g : rgb(0, 0, 0), + backgroundColor: (_h = options === null || options === void 0 ? void 0 : options.backgroundColor) !== null && _h !== void 0 ? _h : rgb(0.75, 0.75, 0.75), + borderColor: options === null || options === void 0 ? void 0 : options.borderColor, + borderWidth: (_j = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _j !== void 0 ? _j : 0, + rotate: (_k = options === null || options === void 0 ? void 0 : options.rotate) !== null && _k !== void 0 ? _k : degrees(0), + caption: text2, + hidden: options === null || options === void 0 ? void 0 : options.hidden, + page: page.ref + }); + var widgetRef = this.doc.context.register(widget.dict); + this.acroField.addWidget(widgetRef); + var font = (_l = options === null || options === void 0 ? void 0 : options.font) !== null && _l !== void 0 ? _l : this.doc.getForm().getDefaultFont(); + this.updateWidgetAppearance(widget, font); + page.node.addAnnot(widgetRef); + }; + PDFButton2.prototype.needsAppearancesUpdate = function() { + var _a3; + if (this.isDirty()) + return true; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var hasAppearances = ((_a3 = widget.getAppearances()) === null || _a3 === void 0 ? void 0 : _a3.normal) instanceof PDFStream_default; + if (!hasAppearances) + return true; + } + return false; + }; + PDFButton2.prototype.defaultUpdateAppearances = function(font) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + this.updateAppearances(font); + }; + PDFButton2.prototype.updateAppearances = function(font, provider) { + assertIs(font, "font", [[PDFFont_default, "PDFFont"]]); + assertOrUndefined(provider, "provider", [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + this.updateWidgetAppearance(widget, font, provider); + } + }; + PDFButton2.prototype.updateWidgetAppearance = function(widget, font, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : defaultButtonAppearanceProvider; + var appearances = normalizeAppearance(apProvider(this, widget, font)); + this.updateWidgetAppearanceWithFont(widget, font, appearances); + }; + PDFButton2.of = function(acroPushButton, ref, doc) { + return new PDFButton2(acroPushButton, ref, doc); + }; + return PDFButton2; + }(PDFField_default) +); +var PDFButton_default = PDFButton; + +// src/utils.ts +var import_obsidian = require("obsidian"); +var TreeNode = class { + constructor(key, title, level) { + this.children = []; + this.key = key; + this.title = title; + this.level = level; + this.children = []; + } +}; +function getHeadingTree(doc = document) { + const headings = doc.querySelectorAll("h1, h2, h3, h4, h5, h6"); + const root3 = new TreeNode("", "Root", 0); + let prev = root3; + headings.forEach((heading) => { + var _a3; + if (heading.style.display == "none") { + return; + } + const level = parseInt(heading.tagName.slice(1)); + const link2 = heading.querySelector("a.md-print-anchor"); + const regexMatch = /^af:\/\/(.+)$/.exec((_a3 = link2 == null ? void 0 : link2.href) != null ? _a3 : ""); + if (!regexMatch) { + return; + } + const newNode = new TreeNode(regexMatch[1], heading.innerText, level); + while (prev.level >= level) { + prev = prev.parent; + } + prev.children.push(newNode); + newNode.parent = prev; + prev = newNode; + }); + return root3; +} +function modifyDest(doc) { + const data = /* @__PURE__ */ new Map(); + doc.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((heading, i) => { + const link2 = document.createElement("a"); + const flag3 = `${heading.tagName.toLowerCase()}-${i}`; + link2.href = `af://${flag3}`; + link2.className = "md-print-anchor"; + heading.appendChild(link2); + data.set(heading.dataset.heading, flag3); + }); + return data; +} +function convertMapKeysToLowercase(map) { + return new Map(Array.from(map).map(([key, value]) => [key == null ? void 0 : key.toLowerCase(), value])); +} +function fixAnchors(doc, dest, basename) { + const lowerDest = convertMapKeysToLowercase(dest); + doc.querySelectorAll("a.internal-link").forEach((el, i) => { + var _a3, _b3, _c2; + const [title, anchor] = (_b3 = (_a3 = el.dataset.href) == null ? void 0 : _a3.split("#")) != null ? _b3 : []; + if (anchor == null ? void 0 : anchor.startsWith("^")) { + el.href = (_c2 = el.dataset.href) == null ? void 0 : _c2.toLowerCase(); + } + if ((anchor == null ? void 0 : anchor.length) > 0) { + if ((title == null ? void 0 : title.length) > 0 && title != basename) { + return; + } + const flag3 = dest.get(anchor) || lowerDest.get(anchor == null ? void 0 : anchor.toLowerCase()); + if (flag3 && !anchor.startsWith("^")) { + el.href = `an://${flag3}`; + } + } + }); +} +var px2mm = (px2) => { + return Math.round(px2 * 0.26458333333719); +}; +var mm2px = (mm) => { + return Math.round(mm * 3.779527559); +}; +function traverseFolder(path3) { + if (path3 instanceof import_obsidian.TFile) { + if (path3.extension == "md") { + return [path3]; + } else { + return []; + } + } + const arr = []; + for (const item of path3.children) { + arr.push(...traverseFolder(item)); + } + return arr; +} +function copyAttributes(node, attributes) { + Array.from(attributes).forEach((attr2) => { + node.setAttribute(attr2.name, attr2.value); + }); +} +function isNumber(str) { + return !isNaN(parseFloat(str)); +} +function safeParseInt(str, default_ = 0) { + try { + const num = parseInt(String(str)); + return isNaN(num) ? default_ : num; + } catch (e) { + return default_; + } +} +function safeParseFloat(str, default_ = 0) { + try { + const num = parseFloat(String(str)); + return isNaN(num) ? default_ : num; + } catch (e) { + return default_; + } +} + +// src/pdf.ts +async function getDestPosition(pdfDoc) { + const pages = pdfDoc.getPages(); + const links = {}; + pages.forEach((page, pageIndex) => { + var _a3, _b3; + const annotations = page.node.Annots(); + if (!annotations) { + return; + } + const numAnnotations = (_a3 = annotations == null ? void 0 : annotations.size()) != null ? _a3 : 0; + for (let annotIndex = 0; annotIndex < numAnnotations; annotIndex++) { + try { + const annotation = annotations.lookup(annotIndex, PDFDict_default); + const subtype = annotation.get(PDFName_default.of("Subtype")); + if ((subtype == null ? void 0 : subtype.toString()) === "/Link") { + const linkDict = annotation.get(PDFName_default.of("A")); + const uri = linkDict == null ? void 0 : linkDict.get(PDFName_default.of("URI")).toString(); + console.debug("uri", uri); + const regexMatch = /^\(af:\/\/(.+)\)$/.exec(uri || ""); + if (regexMatch) { + const rect = (_b3 = annotation.get(PDFName_default.of("Rect"))) == null ? void 0 : _b3.asRectangle(); + const linkUrl = regexMatch[1]; + const yPos = rect.y; + links[linkUrl] = [pageIndex, yPos]; + } + } + } catch (err) { + console.error(err); + } + } + }); + return links; +} +async function setAnchors(pdfDoc, links) { + const pages = pdfDoc.getPages(); + pages.forEach((page, _) => { + var _a3; + const annots = page.node.Annots(); + if (!annots) { + return; + } + const numAnnotations = (_a3 = annots == null ? void 0 : annots.size()) != null ? _a3 : 0; + for (let idx = 0; idx < numAnnotations; idx++) { + try { + const linkAnnotRef = annots.get(idx); + const linkAnnot = annots.lookup(idx, PDFDict_default); + const subtype = linkAnnot.get(PDFName_default.of("Subtype")); + if ((subtype == null ? void 0 : subtype.toString()) === "/Link") { + const linkDict = linkAnnot.get(PDFName_default.of("A")); + const uri = linkDict == null ? void 0 : linkDict.get(PDFName_default.of("URI")).toString(); + console.debug("uri", uri); + const regexMatch = /^\(an:\/\/(.+)\)$/.exec(uri || ""); + const key = regexMatch == null ? void 0 : regexMatch[1]; + if (key && (links == null ? void 0 : links[key])) { + const [pageIdx, yPos] = links[key]; + const newAnnot = pdfDoc.context.obj({ + Type: "Annot", + Subtype: "Link", + Rect: linkAnnot.lookup(PDFName_default.of("Rect")), + Border: linkAnnot.lookup(PDFName_default.of("Border")), + C: linkAnnot.lookup(PDFName_default.of("C")), + Dest: [pages[pageIdx].ref, "XYZ", null, yPos, null] + }); + pdfDoc.context.assign(linkAnnotRef, newAnnot); + } + } + } catch (err) { + console.error(err); + } + } + }); + return links; +} +function generateOutlines(root3, positions, maxLevel = 6) { + var _a3, _b3; + const _outline = (node) => { + var _a4, _b4; + if (node.level > maxLevel) { + return; + } + const [pageIdx, pos] = (_a4 = positions == null ? void 0 : positions[node.key]) != null ? _a4 : [0, 0]; + const outline = { + title: node.title, + to: [pageIdx, 0, pos], + open: false, + children: [] + }; + if (((_b4 = node.children) == null ? void 0 : _b4.length) > 0) { + for (const item of node.children) { + const child2 = _outline(item); + if (child2) { + outline.children.push(child2); + } + } + } + return outline; + }; + return (_b3 = (_a3 = _outline(root3)) == null ? void 0 : _a3.children) != null ? _b3 : []; +} +var walk = (outlines, callback) => { + for (const outline of outlines) { + const ret = callback(outline); + if ("children" in outline && ret !== false) walk(outline.children, callback); + } +}; +var flatten = (outlines) => { + const result = []; + walk(outlines, (outline) => void result.push(outline)); + return result; +}; +var getOpeningCount = (outlines) => { + let count = 0; + walk(outlines, (outline) => { + count += 1; + return !("open" in outline && !outline.open); + }); + return count; +}; +var setOutline = async (doc, outlines) => { + const rootRef = doc.context.nextRef(); + const refMap = /* @__PURE__ */ new WeakMap(); + for (const outline of flatten(outlines)) { + refMap.set(outline, doc.context.nextRef()); + } + const pageRefs = (() => { + const refs = []; + doc.catalog.Pages().traverse((kid, ref) => { + var _a3; + if (((_a3 = kid.get(kid.context.obj("Type"))) == null ? void 0 : _a3.toString()) === "/Page") { + refs.push(ref); + } + }); + return refs; + })(); + const createOutline = (outlines2, parent) => { + const { length } = outlines2; + for (let i = 0; i < length; i += 1) { + const outline = outlines2[i]; + const outlineRef = refMap.get(outline); + const destOrAction = (() => { + if (typeof outline.to === "number") { + return { Dest: [pageRefs[outline.to], "Fit"] }; + } else if (Array.isArray(outline.to)) { + return { + Dest: [pageRefs[outline.to[0]], "XYZ", outline.to[1], outline.to[2], null] + }; + } + return {}; + })(); + const childrenDict = (() => { + if ("children" in outline && outline.children.length > 0) { + createOutline(outline.children, outlineRef); + return { + First: refMap.get(outline.children[0]), + Last: refMap.get(outline.children[outline.children.length - 1]), + Count: getOpeningCount(outline.children) * (outline.open ? 1 : -1) + }; + } + return {}; + })(); + doc.context.assign( + outlineRef, + doc.context.obj({ + Title: PDFHexString_default.fromText(outline.title), + Parent: parent, + ...i > 0 ? { Prev: refMap.get(outlines2[i - 1]) } : {}, + ...i < length - 1 ? { Next: refMap.get(outlines2[i + 1]) } : {}, + ...childrenDict, + ...destOrAction, + F: (outline.italic ? 1 : 0) | (outline.bold ? 2 : 0) + }) + ); + } + }; + createOutline(outlines, rootRef); + const rootCount = getOpeningCount(outlines); + doc.context.assign( + rootRef, + doc.context.obj({ + Type: "Outlines", + ...rootCount > 0 ? { + First: refMap.get(outlines[0]), + Last: refMap.get(outlines[outlines.length - 1]) + } : {}, + Count: rootCount + }) + ); + doc.catalog.set(doc.context.obj("Outlines"), rootRef); +}; +async function editPDF(data, { headings, maxLevel, frontMatter, displayMetadata }) { + const pdfDoc = await PDFDocument_default.load(data); + const posistions = await getDestPosition(pdfDoc); + setAnchors(pdfDoc, posistions); + const outlines = generateOutlines(headings, posistions, maxLevel); + setOutline(pdfDoc, outlines); + if (displayMetadata) { + setMetadata(pdfDoc, frontMatter != null ? frontMatter : {}); + } + data = await pdfDoc.save(); + return data; +} +function setMetadata(pdfDoc, { title, author, keywords, subject, creator, created_at, updated_at }) { + if (title) { + pdfDoc.setTitle(title, { showInWindowTitleBar: true }); + } + if (author) { + if (Array.isArray(author)) { + pdfDoc.setAuthor(author.join(", ")); + } else { + pdfDoc.setAuthor(author.toString()); + } + } + if (keywords) { + pdfDoc.setKeywords(typeof keywords == "string" ? [keywords] : keywords); + } + if (subject) { + pdfDoc.setSubject(subject); + } + pdfDoc.setCreator(creator != null ? creator : "Obsidian"); + pdfDoc.setProducer("Obsidian"); + pdfDoc.setCreationDate(new Date(created_at != null ? created_at : /* @__PURE__ */ new Date())); + pdfDoc.setModificationDate(new Date(updated_at != null ? updated_at : /* @__PURE__ */ new Date())); +} +async function exportToPDF(outputFile, config, w, { doc, frontMatter }) { + var _a3, _b3, _c2; + console.log("output pdf:", outputFile); + let pageSize = config["pageSize"]; + if (config["pageSize"] == "Custom" && config["pageWidth"] && config["pageHeight"]) { + pageSize = { + width: safeParseFloat(config["pageWidth"], 210) / 25.4, + height: safeParseFloat(config["pageHeight"], 297) / 25.4 + }; + } + let scale2 = (_a3 = config == null ? void 0 : config["scale"]) != null ? _a3 : 100; + if (scale2 > 200 || scale2 < 10) { + scale2 = 100; + } + const printOptions = { + landscape: config == null ? void 0 : config["landscape"], + printBackground: config == null ? void 0 : config["printBackground"], + generateTaggedPDF: config == null ? void 0 : config["generateTaggedPDF"], + pageSize, + scale: scale2 / 100, + margins: { + marginType: "default" + }, + displayHeaderFooter: config["displayHeader"] || config["displayFooter"], + headerTemplate: config["displayHeader"] ? (_b3 = frontMatter == null ? void 0 : frontMatter["headerTemplate"]) != null ? _b3 : config["headerTemplate"] : "", + footerTemplate: config["displayFooter"] ? (_c2 = frontMatter == null ? void 0 : frontMatter["footerTemplate"]) != null ? _c2 : config["footerTemplate"] : "" + }; + if (config.marginType == "0") { + printOptions["margins"] = { + marginType: "custom", + top: 0, + bottom: 0, + left: 0, + right: 0 + }; + } else if (config.marginType == "1") { + printOptions["margins"] = { + marginType: "default" + }; + } else if (config.marginType == "2") { + printOptions["margins"] = { + marginType: "custom", + top: 0.1, + bottom: 0.1, + left: 0.1, + right: 0.1 + }; + } else if (config.marginType == "3") { + printOptions["margins"] = { + marginType: "custom", + top: safeParseFloat(config["marginTop"], 0) / 25.4, + bottom: safeParseFloat(config["marginBottom"], 0) / 25.4, + left: safeParseFloat(config["marginLeft"], 0) / 25.4, + right: safeParseFloat(config["marginRight"], 0) / 25.4 + }; + } + try { + let data = await w.printToPDF(printOptions); + data = await editPDF(data, { + headings: getHeadingTree(doc), + frontMatter, + displayMetadata: config == null ? void 0 : config.displayMetadata, + maxLevel: safeParseInt(config == null ? void 0 : config.maxLevel, 6) + }); + await fs.writeFile(outputFile, data); + if (config.open) { + import_electron.default.remote.shell.openPath(outputFile); + } + } catch (error2) { + console.error(error2); + } +} +async function getOutputFile(filename, isTimestamp) { + const result = await import_electron.default.remote.dialog.showSaveDialog({ + title: "Export to PDF", + defaultPath: filename + (isTimestamp ? "-" + Date.now() : "") + ".pdf", + filters: [ + { name: "All Files", extensions: ["*"] }, + { name: "PDF", extensions: ["pdf"] } + ], + properties: ["showOverwriteConfirmation", "createDirectory"] + }); + if (result.canceled) { + return; + } + return result.filePath; +} +async function getOutputPath(filename, isTimestamp) { + const result = await import_electron.default.remote.dialog.showOpenDialog({ + title: "Export to PDF", + defaultPath: filename, + properties: ["openDirectory"] + }); + if (result.canceled) { + return; + } + return result.filePaths[0]; +} + +// src/render.ts +var import_obsidian3 = require("obsidian"); +function getAllStyles() { + const cssTexts = []; + Array.from(document.styleSheets).forEach((sheet) => { + var _a3, _b3, _c2; + const id = (_a3 = sheet.ownerNode) == null ? void 0 : _a3.id; + if (id == null ? void 0 : id.startsWith("svelte-")) { + return; + } + const href = (_b3 = sheet.ownerNode) == null ? void 0 : _b3.href; + const division = `/* ----------${id ? `id:${id}` : href ? `href:${href}` : ""}---------- */`; + cssTexts.push(division); + try { + Array.from((_c2 = sheet == null ? void 0 : sheet.cssRules) != null ? _c2 : []).forEach((rule) => { + cssTexts.push(rule.cssText); + }); + } catch (error2) { + console.error(error2); + } + }); + cssTexts.push(...getPatchStyle()); + return cssTexts; +} +var CSS_PATCH = ` +/* ---------- css patch ---------- */ + +body { + overflow: auto !important; +} +@media print { + .print .markdown-preview-view { + height: auto !important; + } + .md-print-anchor, .blockid { + white-space: pre !important; + border-left: none !important; + border-right: none !important; + border-top: none !important; + border-bottom: none !important; + display: inline-block !important; + position: absolute !important; + width: 1px !important; + height: 1px !important; + right: 0 !important; + outline: 0 !important; + background: 0 0 !important; + text-decoration: initial !important; + text-shadow: initial !important; + } +} +@media print { + table { + break-inside: auto; + } + tr { + break-inside: avoid; + break-after: auto; + } +} + +img.__canvas__ { + width: 100% !important; + height: 100% !important; +} +`; +function getPatchStyle() { + return [CSS_PATCH, ...getPrintStyle()]; +} +function getPrintStyle() { + const cssTexts = []; + Array.from(document.styleSheets).forEach((sheet) => { + var _a3; + try { + const cssRules = (_a3 = sheet == null ? void 0 : sheet.cssRules) != null ? _a3 : []; + Array.from(cssRules).forEach((rule) => { + if (rule.constructor.name == "CSSMediaRule") { + if (rule.conditionText === "print") { + const res = rule.cssText.replace(/@media print\s*\{(.+)\}/gms, "$1"); + cssTexts.push(res); + } + } + }); + } catch (error2) { + console.error(error2); + } + }); + return cssTexts; +} +function generateDocId(n) { + return Array.from({ length: n }, () => (16 * Math.random() | 0).toString(16)).join(""); +} +function getFrontMatter(app, file) { + var _a3; + const cache = app.metadataCache.getFileCache(file); + return (_a3 = cache == null ? void 0 : cache.frontmatter) != null ? _a3 : {}; +} +async function renderMarkdown({ app, file, config, extra }) { + var _a3, _b3, _c2, _d, _e, _f, _g, _h; + const startTime = (/* @__PURE__ */ new Date()).getTime(); + const ws = app.workspace; + const leaf = ws.getLeaf(true); + await leaf.openFile(file); + const view = leaf.view; + const data = (_d = (_b3 = view == null ? void 0 : view.data) != null ? _b3 : (_a3 = ws == null ? void 0 : ws.getActiveFileView()) == null ? void 0 : _a3.data) != null ? _d : (_c2 = ws.activeEditor) == null ? void 0 : _c2.data; + if (!data) { + new import_obsidian3.Notice("data is empty!"); + } + const frontMatter = getFrontMatter(app, file); + const cssclasses = []; + for (const [key, val] of Object.entries(frontMatter)) { + if (key.toLowerCase() == "cssclass" || key.toLowerCase() == "cssclasses") { + if (Array.isArray(val)) { + cssclasses.push(...val); + } else { + cssclasses.push(val); + } + } + } + const comp = new import_obsidian3.Component(); + comp.load(); + const printEl = document.body.createDiv("print"); + const viewEl = printEl.createDiv({ + cls: "markdown-preview-view markdown-rendered " + cssclasses.join(" ") + }); + app.vault.cachedRead(file); + viewEl.toggleClass("rtl", app.vault.getConfig("rightToLeft")); + viewEl.toggleClass("show-properties", "hidden" !== app.vault.getConfig("propertiesInDocument")); + const title = (_f = (_e = extra == null ? void 0 : extra.title) != null ? _e : frontMatter == null ? void 0 : frontMatter.title) != null ? _f : file.basename; + viewEl.createEl("h1", { text: title }, (e) => { + var _a4; + e.addClass("__title__"); + e.style.display = config.showTitle ? "block" : "none"; + e.id = (_a4 = extra == null ? void 0 : extra.id) != null ? _a4 : ""; + }); + const cache = app.metadataCache.getFileCache(file); + const blocks = new Map(Object.entries((_g = cache == null ? void 0 : cache.blocks) != null ? _g : {})); + const lines = ((_h = data == null ? void 0 : data.split("\n")) != null ? _h : []).map((line, i) => { + for (const { + id, + position: { start, end } + } of blocks.values()) { + const blockid = `^${id}`; + if (line.includes(blockid) && i >= start.line && i <= end.line) { + blocks.delete(id); + return line.replace(blockid, ` ${blockid}`); + } + } + return line; + }); + [...blocks.values()].forEach(({ id, position: { start, end } }) => { + const idx = start.line; + lines[idx] = ` + +` + lines[idx]; + }); + const fragment = { + children: void 0, + appendChild(e) { + this.children = e == null ? void 0 : e.children; + throw new Error("exit"); + } + }; + const promises = []; + try { + await import_obsidian3.MarkdownRenderer.render(app, lines.join("\n"), fragment, file.path, comp); + } catch (error2) { + } + const el = createFragment(); + Array.from(fragment.children).forEach((item) => { + el.createDiv({}, (t) => { + return t.appendChild(item); + }); + }); + viewEl.appendChild(el); + await import_obsidian3.MarkdownRenderer.postProcess(app, { + docId: generateDocId(16), + sourcePath: file.path, + frontmatter: {}, + promises, + addChild: function(e) { + return comp.addChild(e); + }, + getSectionInfo: function() { + return null; + }, + containerEl: viewEl, + el: viewEl, + displayMode: true + }); + await Promise.all(promises); + printEl.findAll("a.internal-link").forEach((el2) => { + var _a4, _b4; + const [title2, anchor] = (_b4 = (_a4 = el2.dataset.href) == null ? void 0 : _a4.split("#")) != null ? _b4 : []; + if ((!title2 || (title2 == null ? void 0 : title2.length) == 0 || title2 == file.basename) && (anchor == null ? void 0 : anchor.startsWith("^"))) { + return; + } + el2.removeAttribute("href"); + }); + try { + await fixWaitRender(data, viewEl); + } catch (error2) { + console.warn("wait timeout"); + } + fixCanvasToImage(viewEl); + const doc = document.implementation.createHTMLDocument("document"); + doc.body.appendChild(printEl.cloneNode(true)); + printEl.detach(); + comp.unload(); + printEl.remove(); + doc.title = title; + leaf.detach(); + console.log(`md render time:${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`); + return { doc, frontMatter, file }; +} +function fixDoc(doc, title) { + const dest = modifyDest(doc); + fixAnchors(doc, dest, title); + encodeEmbeds(doc); + return doc; +} +function encodeEmbeds(doc) { + const spans = Array.from(doc.querySelectorAll("span.markdown-embed")).reverse(); + spans.forEach((span) => span.innerHTML = encodeURIComponent(span.innerHTML)); +} +async function fixWaitRender(data, viewEl) { + if (data.includes("```dataview") || data.includes("```gEvent") || data.includes("![[")) { + await sleep(2e3); + } + try { + await waitForDomChange(viewEl); + } catch (error2) { + await sleep(1e3); + } +} +function fixCanvasToImage(el) { + for (const canvas of Array.from(el.querySelectorAll("canvas"))) { + const data = canvas.toDataURL(); + const img = document.createElement("img"); + img.src = data; + copyAttributes(img, canvas.attributes); + img.className = "__canvas__"; + canvas.replaceWith(img); + } +} +function createWebview(scale2 = 1.25) { + const webview = document.createElement("webview"); + webview.src = `app://obsidian.md/help.html`; + webview.setAttribute( + "style", + `height:calc(${scale2} * 100%); + width: calc(${scale2} * 100%); + transform: scale(${1 / scale2}, ${1 / scale2}); + transform-origin: top left; + border: 1px solid #f2f2f2; + ` + ); + webview.nodeintegration = true; + return webview; +} +function waitForDomChange(target, timeout = 2e3, interval = 200) { + return new Promise((resolve, reject) => { + let timer; + const observer = new MutationObserver((m) => { + clearTimeout(timer); + timer = setTimeout(() => { + observer.disconnect(); + resolve(true); + }, interval); + }); + observer.observe(target, { + childList: true, + subtree: true, + attributes: true, + characterData: true + }); + setTimeout(() => { + observer.disconnect(); + reject(new Error(`timeout ${timeout}ms`)); + }, timeout); + }); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/version.js +var PUBLIC_VERSION = "5"; + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/disclose-version.js +var _a, _b, _c; +if (typeof window !== "undefined") { + ((_c = (_b = (_a = window.__svelte) != null ? _a : window.__svelte = {}).v) != null ? _c : _b.v = /* @__PURE__ */ new Set()).add(PUBLIC_VERSION); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/constants.js +var EACH_ITEM_REACTIVE = 1; +var EACH_INDEX_REACTIVE = 1 << 1; +var EACH_IS_CONTROLLED = 1 << 2; +var EACH_IS_ANIMATED = 1 << 3; +var EACH_ITEM_IMMUTABLE = 1 << 4; +var PROPS_IS_IMMUTABLE = 1; +var PROPS_IS_RUNES = 1 << 1; +var PROPS_IS_UPDATED = 1 << 2; +var PROPS_IS_BINDABLE = 1 << 3; +var PROPS_IS_LAZY_INITIAL = 1 << 4; +var TRANSITION_OUT = 1 << 1; +var TRANSITION_GLOBAL = 1 << 2; +var TEMPLATE_FRAGMENT = 1; +var TEMPLATE_USE_IMPORT_NODE = 1 << 1; +var HYDRATION_START = "["; +var HYDRATION_START_ELSE = "[!"; +var HYDRATION_END = "]"; +var HYDRATION_ERROR = {}; +var ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1; +var UNINITIALIZED = Symbol(); +var FILENAME = Symbol("filename"); +var HMR = Symbol("hmr"); +var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml"; +var NAMESPACE_SVG = "http://www.w3.org/2000/svg"; + +// node_modules/.pnpm/esm-env@1.2.2/node_modules/esm-env/dev-fallback.js +var _a2, _b2; +var node_env = (_b2 = (_a2 = globalThis.process) == null ? void 0 : _a2.env) == null ? void 0 : _b2.NODE_ENV; +var dev_fallback_default = node_env && !node_env.toLowerCase().startsWith("prod"); + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/shared/utils.js +var is_array = Array.isArray; +var index_of = Array.prototype.indexOf; +var array_from = Array.from; +var object_keys = Object.keys; +var define_property = Object.defineProperty; +var get_descriptor = Object.getOwnPropertyDescriptor; +var get_descriptors = Object.getOwnPropertyDescriptors; +var object_prototype = Object.prototype; +var array_prototype = Array.prototype; +var get_prototype_of = Object.getPrototypeOf; +var is_extensible = Object.isExtensible; +function is_function(thing) { + return typeof thing === "function"; +} +var noop = () => { +}; +function run_all(arr) { + for (var i = 0; i < arr.length; i++) { + arr[i](); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/constants.js +var DERIVED = 1 << 1; +var EFFECT = 1 << 2; +var RENDER_EFFECT = 1 << 3; +var BLOCK_EFFECT = 1 << 4; +var BRANCH_EFFECT = 1 << 5; +var ROOT_EFFECT = 1 << 6; +var BOUNDARY_EFFECT = 1 << 7; +var UNOWNED = 1 << 8; +var DISCONNECTED = 1 << 9; +var CLEAN = 1 << 10; +var DIRTY = 1 << 11; +var MAYBE_DIRTY = 1 << 12; +var INERT = 1 << 13; +var DESTROYED = 1 << 14; +var EFFECT_RAN = 1 << 15; +var EFFECT_TRANSPARENT = 1 << 16; +var LEGACY_DERIVED_PROP = 1 << 17; +var INSPECT_EFFECT = 1 << 18; +var HEAD_EFFECT = 1 << 19; +var EFFECT_HAS_DERIVED = 1 << 20; +var EFFECT_IS_UPDATING = 1 << 21; +var STATE_SYMBOL = Symbol("$state"); +var LEGACY_PROPS = Symbol("legacy props"); +var LOADING_ATTR_SYMBOL = Symbol(""); + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/errors.js +function derived_references_self() { + if (dev_fallback_default) { + const error2 = new Error(`derived_references_self +A derived value cannot reference itself recursively +https://svelte.dev/e/derived_references_self`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/derived_references_self`); + } +} +function effect_update_depth_exceeded() { + if (dev_fallback_default) { + const error2 = new Error(`effect_update_depth_exceeded +Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops +https://svelte.dev/e/effect_update_depth_exceeded`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`); + } +} +function hydration_failed() { + if (dev_fallback_default) { + const error2 = new Error(`hydration_failed +Failed to hydrate the application +https://svelte.dev/e/hydration_failed`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/hydration_failed`); + } +} +function invalid_snippet() { + if (dev_fallback_default) { + const error2 = new Error(`invalid_snippet +Could not \`{@render}\` snippet due to the expression being \`null\` or \`undefined\`. Consider using optional chaining \`{@render snippet?.()}\` +https://svelte.dev/e/invalid_snippet`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/invalid_snippet`); + } +} +function props_invalid_value(key) { + if (dev_fallback_default) { + const error2 = new Error(`props_invalid_value +Cannot do \`bind:${key}={undefined}\` when \`${key}\` has a fallback value +https://svelte.dev/e/props_invalid_value`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/props_invalid_value`); + } +} +function props_rest_readonly(property) { + if (dev_fallback_default) { + const error2 = new Error(`props_rest_readonly +Rest element properties of \`$props()\` such as \`${property}\` are readonly +https://svelte.dev/e/props_rest_readonly`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/props_rest_readonly`); + } +} +function rune_outside_svelte(rune) { + if (dev_fallback_default) { + const error2 = new Error(`rune_outside_svelte +The \`${rune}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files +https://svelte.dev/e/rune_outside_svelte`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/rune_outside_svelte`); + } +} +function state_descriptors_fixed() { + if (dev_fallback_default) { + const error2 = new Error(`state_descriptors_fixed +Property descriptors defined on \`$state\` objects must contain \`value\` and always be \`enumerable\`, \`configurable\` and \`writable\`. +https://svelte.dev/e/state_descriptors_fixed`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/state_descriptors_fixed`); + } +} +function state_prototype_fixed() { + if (dev_fallback_default) { + const error2 = new Error(`state_prototype_fixed +Cannot set prototype of \`$state\` object +https://svelte.dev/e/state_prototype_fixed`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/state_prototype_fixed`); + } +} +function state_unsafe_mutation() { + if (dev_fallback_default) { + const error2 = new Error(`state_unsafe_mutation +Updating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without \`$state\` +https://svelte.dev/e/state_unsafe_mutation`); + error2.name = "Svelte error"; + throw error2; + } else { + throw new Error(`https://svelte.dev/e/state_unsafe_mutation`); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/warnings.js +var bold = "font-weight: bold"; +var normal = "font-weight: normal"; +function hydration_attribute_changed(attribute, html2, value) { + if (dev_fallback_default) { + console.warn(`%c[svelte] hydration_attribute_changed +%cThe \`${attribute}\` attribute on \`${html2}\` changed its value between server and client renders. The client value, \`${value}\`, will be ignored in favour of the server value +https://svelte.dev/e/hydration_attribute_changed`, bold, normal); + } else { + console.warn(`https://svelte.dev/e/hydration_attribute_changed`); + } +} +function hydration_mismatch(location) { + if (dev_fallback_default) { + console.warn(`%c[svelte] hydration_mismatch +%c${location ? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}` : "Hydration failed because the initial UI does not match what was rendered on the server"} +https://svelte.dev/e/hydration_mismatch`, bold, normal); + } else { + console.warn(`https://svelte.dev/e/hydration_mismatch`); + } +} +function lifecycle_double_unmount() { + if (dev_fallback_default) { + console.warn(`%c[svelte] lifecycle_double_unmount +%cTried to unmount a component that was not mounted +https://svelte.dev/e/lifecycle_double_unmount`, bold, normal); + } else { + console.warn(`https://svelte.dev/e/lifecycle_double_unmount`); + } +} +function state_proxy_equality_mismatch(operator) { + if (dev_fallback_default) { + console.warn(`%c[svelte] state_proxy_equality_mismatch +%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${operator}\` will produce unexpected results +https://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal); + } else { + console.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/hydration.js +var hydrating = false; +function set_hydrating(value) { + hydrating = value; +} +var hydrate_node; +function set_hydrate_node(node) { + if (node === null) { + hydration_mismatch(); + throw HYDRATION_ERROR; + } + return hydrate_node = node; +} +function hydrate_next() { + return set_hydrate_node( + /** @type {TemplateNode} */ + get_next_sibling(hydrate_node) + ); +} +function reset(node) { + if (!hydrating) return; + if (get_next_sibling(hydrate_node) !== null) { + hydration_mismatch(); + throw HYDRATION_ERROR; + } + hydrate_node = node; +} +function remove_nodes() { + var depth = 0; + var node = hydrate_node; + while (true) { + if (node.nodeType === 8) { + var data = ( + /** @type {Comment} */ + node.data + ); + if (data === HYDRATION_END) { + if (depth === 0) return node; + depth -= 1; + } else if (data === HYDRATION_START || data === HYDRATION_START_ELSE) { + depth += 1; + } + } + var next2 = ( + /** @type {TemplateNode} */ + get_next_sibling(node) + ); + node.remove(); + node = next2; + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dev/tracing.js +var tracing_expressions = null; +function get_stack(label) { + let error2 = Error(); + const stack2 = error2.stack; + if (stack2) { + const lines = stack2.split("\n"); + const new_lines = ["\n"]; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + if (line === "Error") { + continue; + } + if (line.includes("validate_each_keys")) { + return null; + } + if (line.includes("svelte/src/internal")) { + continue; + } + new_lines.push(line); + } + if (new_lines.length === 1) { + return null; + } + define_property(error2, "stack", { + value: new_lines.join("\n") + }); + define_property(error2, "name", { + // 'Error' suffix is required for stack traces to be rendered properly + value: `${label}Error` + }); + } + return error2; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/flags/index.js +var legacy_mode_flag = false; +var tracing_mode_flag = false; + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/proxy.js +function proxy(value) { + if (typeof value !== "object" || value === null || STATE_SYMBOL in value) { + return value; + } + const prototype = get_prototype_of(value); + if (prototype !== object_prototype && prototype !== array_prototype) { + return value; + } + var sources = /* @__PURE__ */ new Map(); + var is_proxied_array = is_array(value); + var version = state(0); + var stack2 = dev_fallback_default && tracing_mode_flag ? get_stack("CreatedAt") : null; + var reaction = active_reaction; + var with_parent = (fn) => { + var previous_reaction = active_reaction; + set_active_reaction(reaction); + var result = fn(); + set_active_reaction(previous_reaction); + return result; + }; + if (is_proxied_array) { + sources.set("length", state( + /** @type {any[]} */ + value.length, + stack2 + )); + } + return new Proxy( + /** @type {any} */ + value, + { + defineProperty(_, prop2, descriptor) { + if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) { + state_descriptors_fixed(); + } + var s = sources.get(prop2); + if (s === void 0) { + s = with_parent(() => state(descriptor.value, stack2)); + sources.set(prop2, s); + } else { + set( + s, + with_parent(() => proxy(descriptor.value)) + ); + } + return true; + }, + deleteProperty(target, prop2) { + var s = sources.get(prop2); + if (s === void 0) { + if (prop2 in target) { + sources.set( + prop2, + with_parent(() => state(UNINITIALIZED, stack2)) + ); + } + } else { + if (is_proxied_array && typeof prop2 === "string") { + var ls = ( + /** @type {Source} */ + sources.get("length") + ); + var n = Number(prop2); + if (Number.isInteger(n) && n < ls.v) { + set(ls, n); + } + } + set(s, UNINITIALIZED); + update_version(version); + } + return true; + }, + get(target, prop2, receiver) { + var _a3; + if (prop2 === STATE_SYMBOL) { + return value; + } + var s = sources.get(prop2); + var exists = prop2 in target; + if (s === void 0 && (!exists || ((_a3 = get_descriptor(target, prop2)) == null ? void 0 : _a3.writable))) { + s = with_parent(() => state(proxy(exists ? target[prop2] : UNINITIALIZED), stack2)); + sources.set(prop2, s); + } + if (s !== void 0) { + var v = get(s); + return v === UNINITIALIZED ? void 0 : v; + } + return Reflect.get(target, prop2, receiver); + }, + getOwnPropertyDescriptor(target, prop2) { + var descriptor = Reflect.getOwnPropertyDescriptor(target, prop2); + if (descriptor && "value" in descriptor) { + var s = sources.get(prop2); + if (s) descriptor.value = get(s); + } else if (descriptor === void 0) { + var source2 = sources.get(prop2); + var value2 = source2 == null ? void 0 : source2.v; + if (source2 !== void 0 && value2 !== UNINITIALIZED) { + return { + enumerable: true, + configurable: true, + value: value2, + writable: true + }; + } + } + return descriptor; + }, + has(target, prop2) { + var _a3; + if (prop2 === STATE_SYMBOL) { + return true; + } + var s = sources.get(prop2); + var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop2); + if (s !== void 0 || active_effect !== null && (!has || ((_a3 = get_descriptor(target, prop2)) == null ? void 0 : _a3.writable))) { + if (s === void 0) { + s = with_parent(() => state(has ? proxy(target[prop2]) : UNINITIALIZED, stack2)); + sources.set(prop2, s); + } + var value2 = get(s); + if (value2 === UNINITIALIZED) { + return false; + } + } + return has; + }, + set(target, prop2, value2, receiver) { + var _a3; + var s = sources.get(prop2); + var has = prop2 in target; + if (is_proxied_array && prop2 === "length") { + for (var i = value2; i < /** @type {Source} */ + s.v; i += 1) { + var other_s = sources.get(i + ""); + if (other_s !== void 0) { + set(other_s, UNINITIALIZED); + } else if (i in target) { + other_s = with_parent(() => state(UNINITIALIZED, stack2)); + sources.set(i + "", other_s); + } + } + } + if (s === void 0) { + if (!has || ((_a3 = get_descriptor(target, prop2)) == null ? void 0 : _a3.writable)) { + s = with_parent(() => state(void 0, stack2)); + set( + s, + with_parent(() => proxy(value2)) + ); + sources.set(prop2, s); + } + } else { + has = s.v !== UNINITIALIZED; + set( + s, + with_parent(() => proxy(value2)) + ); + } + var descriptor = Reflect.getOwnPropertyDescriptor(target, prop2); + if (descriptor == null ? void 0 : descriptor.set) { + descriptor.set.call(receiver, value2); + } + if (!has) { + if (is_proxied_array && typeof prop2 === "string") { + var ls = ( + /** @type {Source} */ + sources.get("length") + ); + var n = Number(prop2); + if (Number.isInteger(n) && n >= ls.v) { + set(ls, n + 1); + } + } + update_version(version); + } + return true; + }, + ownKeys(target) { + get(version); + var own_keys = Reflect.ownKeys(target).filter((key2) => { + var source3 = sources.get(key2); + return source3 === void 0 || source3.v !== UNINITIALIZED; + }); + for (var [key, source2] of sources) { + if (source2.v !== UNINITIALIZED && !(key in target)) { + own_keys.push(key); + } + } + return own_keys; + }, + setPrototypeOf() { + state_prototype_fixed(); + } + } + ); +} +function update_version(signal, d = 1) { + set(signal, signal.v + d); +} +function get_proxied_value(value) { + try { + if (value !== null && typeof value === "object" && STATE_SYMBOL in value) { + return value[STATE_SYMBOL]; + } + } catch (e) { + } + return value; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dev/equality.js +function init_array_prototype_warnings() { + const array_prototype2 = Array.prototype; + const cleanup = Array.__svelte_cleanup; + if (cleanup) { + cleanup(); + } + const { indexOf, lastIndexOf, includes } = array_prototype2; + array_prototype2.indexOf = function(item, from_index) { + const index2 = indexOf.call(this, item, from_index); + if (index2 === -1) { + for (let i = from_index != null ? from_index : 0; i < this.length; i += 1) { + if (get_proxied_value(this[i]) === item) { + state_proxy_equality_mismatch("array.indexOf(...)"); + break; + } + } + } + return index2; + }; + array_prototype2.lastIndexOf = function(item, from_index) { + const index2 = lastIndexOf.call(this, item, from_index != null ? from_index : this.length - 1); + if (index2 === -1) { + for (let i = 0; i <= (from_index != null ? from_index : this.length - 1); i += 1) { + if (get_proxied_value(this[i]) === item) { + state_proxy_equality_mismatch("array.lastIndexOf(...)"); + break; + } + } + } + return index2; + }; + array_prototype2.includes = function(item, from_index) { + const has = includes.call(this, item, from_index); + if (!has) { + for (let i = 0; i < this.length; i += 1) { + if (get_proxied_value(this[i]) === item) { + state_proxy_equality_mismatch("array.includes(...)"); + break; + } + } + } + return has; + }; + Array.__svelte_cleanup = () => { + array_prototype2.indexOf = indexOf; + array_prototype2.lastIndexOf = lastIndexOf; + array_prototype2.includes = includes; + }; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/operations.js +var $window; +var $document; +var is_firefox; +var first_child_getter; +var next_sibling_getter; +function init_operations() { + if ($window !== void 0) { + return; + } + $window = window; + $document = document; + is_firefox = /Firefox/.test(navigator.userAgent); + var element_prototype = Element.prototype; + var node_prototype = Node.prototype; + var text_prototype = Text.prototype; + first_child_getter = get_descriptor(node_prototype, "firstChild").get; + next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get; + if (is_extensible(element_prototype)) { + element_prototype.__click = void 0; + element_prototype.__className = void 0; + element_prototype.__attributes = null; + element_prototype.__style = void 0; + element_prototype.__e = void 0; + } + if (is_extensible(text_prototype)) { + text_prototype.__t = void 0; + } + if (dev_fallback_default) { + element_prototype.__svelte_meta = null; + init_array_prototype_warnings(); + } +} +function create_text(value = "") { + return document.createTextNode(value); +} +// @__NO_SIDE_EFFECTS__ +function get_first_child(node) { + return first_child_getter.call(node); +} +// @__NO_SIDE_EFFECTS__ +function get_next_sibling(node) { + return next_sibling_getter.call(node); +} +function child(node, is_text) { + if (!hydrating) { + return /* @__PURE__ */ get_first_child(node); + } + var child2 = ( + /** @type {TemplateNode} */ + /* @__PURE__ */ get_first_child(hydrate_node) + ); + if (child2 === null) { + child2 = hydrate_node.appendChild(create_text()); + } else if (is_text && child2.nodeType !== 3) { + var text2 = create_text(); + child2 == null ? void 0 : child2.before(text2); + set_hydrate_node(text2); + return text2; + } + set_hydrate_node(child2); + return child2; +} +function first_child(fragment, is_text) { + var _a3, _b3; + if (!hydrating) { + var first = ( + /** @type {DocumentFragment} */ + /* @__PURE__ */ get_first_child( + /** @type {Node} */ + fragment + ) + ); + if (first instanceof Comment && first.data === "") return /* @__PURE__ */ get_next_sibling(first); + return first; + } + if (is_text && ((_a3 = hydrate_node) == null ? void 0 : _a3.nodeType) !== 3) { + var text2 = create_text(); + (_b3 = hydrate_node) == null ? void 0 : _b3.before(text2); + set_hydrate_node(text2); + return text2; + } + return hydrate_node; +} +function sibling(node, count = 1, is_text = false) { + let next_sibling = hydrating ? hydrate_node : node; + var last_sibling; + while (count--) { + last_sibling = next_sibling; + next_sibling = /** @type {TemplateNode} */ + /* @__PURE__ */ get_next_sibling(next_sibling); + } + if (!hydrating) { + return next_sibling; + } + var type = next_sibling == null ? void 0 : next_sibling.nodeType; + if (is_text && type !== 3) { + var text2 = create_text(); + if (next_sibling === null) { + last_sibling == null ? void 0 : last_sibling.after(text2); + } else { + next_sibling.before(text2); + } + set_hydrate_node(text2); + return text2; + } + set_hydrate_node(next_sibling); + return ( + /** @type {TemplateNode} */ + next_sibling + ); +} +function clear_text_content(node) { + node.textContent = ""; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/reactivity/equality.js +function equals(value) { + return value === this.v; +} +function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function"; +} +function safe_equals(value) { + return !safe_not_equal(value, this.v); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/reactivity/deriveds.js +// @__NO_SIDE_EFFECTS__ +function derived(fn) { + var flags = DERIVED | DIRTY; + var parent_derived = active_reaction !== null && (active_reaction.f & DERIVED) !== 0 ? ( + /** @type {Derived} */ + active_reaction + ) : null; + if (active_effect === null || parent_derived !== null && (parent_derived.f & UNOWNED) !== 0) { + flags |= UNOWNED; + } else { + active_effect.f |= EFFECT_HAS_DERIVED; + } + const signal = { + ctx: component_context, + deps: null, + effects: null, + equals, + f: flags, + fn, + reactions: null, + rv: 0, + v: ( + /** @type {V} */ + null + ), + wv: 0, + parent: parent_derived != null ? parent_derived : active_effect + }; + if (dev_fallback_default && tracing_mode_flag) { + signal.created = get_stack("CreatedAt"); + } + return signal; +} +// @__NO_SIDE_EFFECTS__ +function derived_safe_equal(fn) { + const signal = /* @__PURE__ */ derived(fn); + signal.equals = safe_equals; + return signal; +} +function destroy_derived_effects(derived2) { + var effects = derived2.effects; + if (effects !== null) { + derived2.effects = null; + for (var i = 0; i < effects.length; i += 1) { + destroy_effect( + /** @type {Effect} */ + effects[i] + ); + } + } +} +var stack = []; +function get_derived_parent_effect(derived2) { + var parent = derived2.parent; + while (parent !== null) { + if ((parent.f & DERIVED) === 0) { + return ( + /** @type {Effect} */ + parent + ); + } + parent = parent.parent; + } + return null; +} +function execute_derived(derived2) { + var value; + var prev_active_effect = active_effect; + set_active_effect(get_derived_parent_effect(derived2)); + if (dev_fallback_default) { + let prev_inspect_effects = inspect_effects; + set_inspect_effects(/* @__PURE__ */ new Set()); + try { + if (stack.includes(derived2)) { + derived_references_self(); + } + stack.push(derived2); + destroy_derived_effects(derived2); + value = update_reaction(derived2); + } finally { + set_active_effect(prev_active_effect); + set_inspect_effects(prev_inspect_effects); + stack.pop(); + } + } else { + try { + destroy_derived_effects(derived2); + value = update_reaction(derived2); + } finally { + set_active_effect(prev_active_effect); + } + } + return value; +} +function update_derived(derived2) { + var value = execute_derived(derived2); + var status = (skip_reaction || (derived2.f & UNOWNED) !== 0) && derived2.deps !== null ? MAYBE_DIRTY : CLEAN; + set_signal_status(derived2, status); + if (!derived2.equals(value)) { + derived2.v = value; + derived2.wv = increment_write_version(); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/reactivity/effects.js +function push_effect(effect2, parent_effect) { + var parent_last = parent_effect.last; + if (parent_last === null) { + parent_effect.last = parent_effect.first = effect2; + } else { + parent_last.next = effect2; + effect2.prev = parent_last; + parent_effect.last = effect2; + } +} +function create_effect(type, fn, sync, push2 = true) { + var _a3; + var parent = active_effect; + if (dev_fallback_default) { + while (parent !== null && (parent.f & INSPECT_EFFECT) !== 0) { + parent = parent.parent; + } + } + var effect2 = { + ctx: component_context, + deps: null, + nodes_start: null, + nodes_end: null, + f: type | DIRTY, + first: null, + fn, + last: null, + next: null, + parent, + prev: null, + teardown: null, + transitions: null, + wv: 0 + }; + if (dev_fallback_default) { + effect2.component_function = dev_current_component_function; + } + if (sync) { + try { + update_effect(effect2); + effect2.f |= EFFECT_RAN; + } catch (e) { + destroy_effect(effect2); + throw e; + } + } else if (fn !== null) { + schedule_effect(effect2); + } + var inert = sync && effect2.deps === null && effect2.first === null && effect2.nodes_start === null && effect2.teardown === null && (effect2.f & (EFFECT_HAS_DERIVED | BOUNDARY_EFFECT)) === 0; + if (!inert && push2) { + if (parent !== null) { + push_effect(effect2, parent); + } + if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0) { + var derived2 = ( + /** @type {Derived} */ + active_reaction + ); + ((_a3 = derived2.effects) != null ? _a3 : derived2.effects = []).push(effect2); + } + } + return effect2; +} +function teardown(fn) { + const effect2 = create_effect(RENDER_EFFECT, null, false); + set_signal_status(effect2, CLEAN); + effect2.teardown = fn; + return effect2; +} +function effect_root(fn) { + const effect2 = create_effect(ROOT_EFFECT, fn, true); + return () => { + destroy_effect(effect2); + }; +} +function component_root(fn) { + const effect2 = create_effect(ROOT_EFFECT, fn, true); + return (options = {}) => { + return new Promise((fulfil) => { + if (options.outro) { + pause_effect(effect2, () => { + destroy_effect(effect2); + fulfil(void 0); + }); + } else { + destroy_effect(effect2); + fulfil(void 0); + } + }); + }; +} +function effect(fn) { + return create_effect(EFFECT, fn, false); +} +function render_effect(fn) { + return create_effect(RENDER_EFFECT, fn, true); +} +function template_effect(fn, thunks = [], d = derived) { + const deriveds = thunks.map(d); + const effect2 = () => fn(...deriveds.map(get)); + if (dev_fallback_default) { + define_property(effect2, "name", { + value: "{expression}" + }); + } + return block(effect2); +} +function block(fn, flags = 0) { + return create_effect(RENDER_EFFECT | BLOCK_EFFECT | flags, fn, true); +} +function branch(fn, push2 = true) { + return create_effect(RENDER_EFFECT | BRANCH_EFFECT, fn, true, push2); +} +function execute_effect_teardown(effect2) { + var teardown2 = effect2.teardown; + if (teardown2 !== null) { + const previously_destroying_effect = is_destroying_effect; + const previous_reaction = active_reaction; + set_is_destroying_effect(true); + set_active_reaction(null); + try { + teardown2.call(null); + } finally { + set_is_destroying_effect(previously_destroying_effect); + set_active_reaction(previous_reaction); + } + } +} +function destroy_effect_children(signal, remove_dom = false) { + var effect2 = signal.first; + signal.first = signal.last = null; + while (effect2 !== null) { + var next2 = effect2.next; + if ((effect2.f & ROOT_EFFECT) !== 0) { + effect2.parent = null; + } else { + destroy_effect(effect2, remove_dom); + } + effect2 = next2; + } +} +function destroy_block_effect_children(signal) { + var effect2 = signal.first; + while (effect2 !== null) { + var next2 = effect2.next; + if ((effect2.f & BRANCH_EFFECT) === 0) { + destroy_effect(effect2); + } + effect2 = next2; + } +} +function destroy_effect(effect2, remove_dom = true) { + var removed = false; + if ((remove_dom || (effect2.f & HEAD_EFFECT) !== 0) && effect2.nodes_start !== null) { + var node = effect2.nodes_start; + var end = effect2.nodes_end; + while (node !== null) { + var next2 = node === end ? null : ( + /** @type {TemplateNode} */ + get_next_sibling(node) + ); + node.remove(); + node = next2; + } + removed = true; + } + destroy_effect_children(effect2, remove_dom && !removed); + remove_reactions(effect2, 0); + set_signal_status(effect2, DESTROYED); + var transitions = effect2.transitions; + if (transitions !== null) { + for (const transition2 of transitions) { + transition2.stop(); + } + } + execute_effect_teardown(effect2); + var parent = effect2.parent; + if (parent !== null && parent.first !== null) { + unlink_effect(effect2); + } + if (dev_fallback_default) { + effect2.component_function = null; + } + effect2.next = effect2.prev = effect2.teardown = effect2.ctx = effect2.deps = effect2.fn = effect2.nodes_start = effect2.nodes_end = null; +} +function unlink_effect(effect2) { + var parent = effect2.parent; + var prev = effect2.prev; + var next2 = effect2.next; + if (prev !== null) prev.next = next2; + if (next2 !== null) next2.prev = prev; + if (parent !== null) { + if (parent.first === effect2) parent.first = next2; + if (parent.last === effect2) parent.last = prev; + } +} +function pause_effect(effect2, callback) { + var transitions = []; + pause_children(effect2, transitions, true); + run_out_transitions(transitions, () => { + destroy_effect(effect2); + if (callback) callback(); + }); +} +function run_out_transitions(transitions, fn) { + var remaining = transitions.length; + if (remaining > 0) { + var check = () => --remaining || fn(); + for (var transition2 of transitions) { + transition2.out(check); + } + } else { + fn(); + } +} +function pause_children(effect2, transitions, local) { + if ((effect2.f & INERT) !== 0) return; + effect2.f ^= INERT; + if (effect2.transitions !== null) { + for (const transition2 of effect2.transitions) { + if (transition2.is_global || local) { + transitions.push(transition2); + } + } + } + var child2 = effect2.first; + while (child2 !== null) { + var sibling2 = child2.next; + var transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || (child2.f & BRANCH_EFFECT) !== 0; + pause_children(child2, transitions, transparent ? local : false); + child2 = sibling2; + } +} +function resume_effect(effect2) { + resume_children(effect2, true); +} +function resume_children(effect2, local) { + if ((effect2.f & INERT) === 0) return; + effect2.f ^= INERT; + if ((effect2.f & CLEAN) === 0) { + effect2.f ^= CLEAN; + } + if (check_dirtiness(effect2)) { + set_signal_status(effect2, DIRTY); + schedule_effect(effect2); + } + var child2 = effect2.first; + while (child2 !== null) { + var sibling2 = child2.next; + var transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || (child2.f & BRANCH_EFFECT) !== 0; + resume_children(child2, transparent ? local : false); + child2 = sibling2; + } + if (effect2.transitions !== null) { + for (const transition2 of effect2.transitions) { + if (transition2.is_global || local) { + transition2.in(); + } + } + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/task.js +var micro_tasks = []; +var idle_tasks = []; +function run_micro_tasks() { + var tasks = micro_tasks; + micro_tasks = []; + run_all(tasks); +} +function run_idle_tasks() { + var tasks = idle_tasks; + idle_tasks = []; + run_all(tasks); +} +function queue_micro_task(fn) { + if (micro_tasks.length === 0) { + queueMicrotask(run_micro_tasks); + } + micro_tasks.push(fn); +} +function flush_tasks() { + if (micro_tasks.length > 0) { + run_micro_tasks(); + } + if (idle_tasks.length > 0) { + run_idle_tasks(); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/runtime.js +var handled_errors = /* @__PURE__ */ new WeakSet(); +var is_throwing_error = false; +var is_flushing = false; +var last_scheduled_effect = null; +var is_updating_effect = false; +var is_destroying_effect = false; +function set_is_destroying_effect(value) { + is_destroying_effect = value; +} +var queued_root_effects = []; +var dev_effect_stack = []; +var active_reaction = null; +var untracking = false; +function set_active_reaction(reaction) { + active_reaction = reaction; +} +var active_effect = null; +function set_active_effect(effect2) { + active_effect = effect2; +} +var reaction_sources = null; +function push_reaction_value(value) { + if (active_reaction !== null && active_reaction.f & EFFECT_IS_UPDATING) { + if (reaction_sources === null) { + reaction_sources = [value]; + } else { + reaction_sources.push(value); + } + } +} +var new_deps = null; +var skipped_deps = 0; +var untracked_writes = null; +function set_untracked_writes(value) { + untracked_writes = value; +} +var write_version = 1; +var read_version = 0; +var skip_reaction = false; +var captured_signals = null; +function increment_write_version() { + return ++write_version; +} +function check_dirtiness(reaction) { + var _a3, _b3; + var flags = reaction.f; + if ((flags & DIRTY) !== 0) { + return true; + } + if ((flags & MAYBE_DIRTY) !== 0) { + var dependencies = reaction.deps; + var is_unowned = (flags & UNOWNED) !== 0; + if (dependencies !== null) { + var i; + var dependency; + var is_disconnected = (flags & DISCONNECTED) !== 0; + var is_unowned_connected = is_unowned && active_effect !== null && !skip_reaction; + var length = dependencies.length; + if (is_disconnected || is_unowned_connected) { + var derived2 = ( + /** @type {Derived} */ + reaction + ); + var parent = derived2.parent; + for (i = 0; i < length; i++) { + dependency = dependencies[i]; + if (is_disconnected || !((_a3 = dependency == null ? void 0 : dependency.reactions) == null ? void 0 : _a3.includes(derived2))) { + ((_b3 = dependency.reactions) != null ? _b3 : dependency.reactions = []).push(derived2); + } + } + if (is_disconnected) { + derived2.f ^= DISCONNECTED; + } + if (is_unowned_connected && parent !== null && (parent.f & UNOWNED) === 0) { + derived2.f ^= UNOWNED; + } + } + for (i = 0; i < length; i++) { + dependency = dependencies[i]; + if (check_dirtiness( + /** @type {Derived} */ + dependency + )) { + update_derived( + /** @type {Derived} */ + dependency + ); + } + if (dependency.wv > reaction.wv) { + return true; + } + } + } + if (!is_unowned || active_effect !== null && !skip_reaction) { + set_signal_status(reaction, CLEAN); + } + } + return false; +} +function propagate_error(error2, effect2) { + var current = effect2; + while (current !== null) { + if ((current.f & BOUNDARY_EFFECT) !== 0) { + try { + current.fn(error2); + return; + } catch (e) { + current.f ^= BOUNDARY_EFFECT; + } + } + current = current.parent; + } + is_throwing_error = false; + throw error2; +} +function should_rethrow_error(effect2) { + return (effect2.f & DESTROYED) === 0 && (effect2.parent === null || (effect2.parent.f & BOUNDARY_EFFECT) === 0); +} +function handle_error(error2, effect2, previous_effect, component_context2) { + var _a3, _b3; + if (is_throwing_error) { + if (previous_effect === null) { + is_throwing_error = false; + } + if (should_rethrow_error(effect2)) { + throw error2; + } + return; + } + if (previous_effect !== null) { + is_throwing_error = true; + } + if (!dev_fallback_default || component_context2 === null || !(error2 instanceof Error) || handled_errors.has(error2)) { + propagate_error(error2, effect2); + return; + } + handled_errors.add(error2); + const component_stack = []; + const effect_name = (_a3 = effect2.fn) == null ? void 0 : _a3.name; + if (effect_name) { + component_stack.push(effect_name); + } + let current_context = component_context2; + while (current_context !== null) { + if (dev_fallback_default) { + var filename = (_b3 = current_context.function) == null ? void 0 : _b3[FILENAME]; + if (filename) { + const file = filename.split("/").pop(); + component_stack.push(file); + } + } + current_context = current_context.p; + } + const indent = is_firefox ? " " : " "; + define_property(error2, "message", { + value: error2.message + ` +${component_stack.map((name) => ` +${indent}in ${name}`).join("")} +` + }); + define_property(error2, "component_stack", { + value: component_stack + }); + const stack2 = error2.stack; + if (stack2) { + const lines = stack2.split("\n"); + const new_lines = []; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + if (line.includes("svelte/src/internal")) { + continue; + } + new_lines.push(line); + } + define_property(error2, "stack", { + value: new_lines.join("\n") + }); + } + propagate_error(error2, effect2); + if (should_rethrow_error(effect2)) { + throw error2; + } +} +function schedule_possible_effect_self_invalidation(signal, effect2, root3 = true) { + var reactions = signal.reactions; + if (reactions === null) return; + for (var i = 0; i < reactions.length; i++) { + var reaction = reactions[i]; + if (reaction_sources == null ? void 0 : reaction_sources.includes(signal)) continue; + if ((reaction.f & DERIVED) !== 0) { + schedule_possible_effect_self_invalidation( + /** @type {Derived} */ + reaction, + effect2, + false + ); + } else if (effect2 === reaction) { + if (root3) { + set_signal_status(reaction, DIRTY); + } else if ((reaction.f & CLEAN) !== 0) { + set_signal_status(reaction, MAYBE_DIRTY); + } + schedule_effect( + /** @type {Effect} */ + reaction + ); + } + } +} +function update_reaction(reaction) { + var _a3, _b3; + var previous_deps = new_deps; + var previous_skipped_deps = skipped_deps; + var previous_untracked_writes = untracked_writes; + var previous_reaction = active_reaction; + var previous_skip_reaction = skip_reaction; + var previous_reaction_sources = reaction_sources; + var previous_component_context = component_context; + var previous_untracking = untracking; + var flags = reaction.f; + new_deps = /** @type {null | Value[]} */ + null; + skipped_deps = 0; + untracked_writes = null; + skip_reaction = (flags & UNOWNED) !== 0 && (untracking || !is_updating_effect || active_reaction === null); + active_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null; + reaction_sources = null; + set_component_context(reaction.ctx); + untracking = false; + read_version++; + reaction.f |= EFFECT_IS_UPDATING; + try { + var result = ( + /** @type {Function} */ + (0, reaction.fn)() + ); + var deps = reaction.deps; + if (new_deps !== null) { + var i; + remove_reactions(reaction, skipped_deps); + if (deps !== null && skipped_deps > 0) { + deps.length = skipped_deps + new_deps.length; + for (i = 0; i < new_deps.length; i++) { + deps[skipped_deps + i] = new_deps[i]; + } + } else { + reaction.deps = deps = new_deps; + } + if (!skip_reaction) { + for (i = skipped_deps; i < deps.length; i++) { + ((_b3 = (_a3 = deps[i]).reactions) != null ? _b3 : _a3.reactions = []).push(reaction); + } + } + } else if (deps !== null && skipped_deps < deps.length) { + remove_reactions(reaction, skipped_deps); + deps.length = skipped_deps; + } + if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0) { + for (i = 0; i < /** @type {Source[]} */ + untracked_writes.length; i++) { + schedule_possible_effect_self_invalidation( + untracked_writes[i], + /** @type {Effect} */ + reaction + ); + } + } + if (previous_reaction !== reaction) { + read_version++; + if (untracked_writes !== null) { + if (previous_untracked_writes === null) { + previous_untracked_writes = untracked_writes; + } else { + previous_untracked_writes.push(.../** @type {Source[]} */ + untracked_writes); + } + } + } + return result; + } finally { + new_deps = previous_deps; + skipped_deps = previous_skipped_deps; + untracked_writes = previous_untracked_writes; + active_reaction = previous_reaction; + skip_reaction = previous_skip_reaction; + reaction_sources = previous_reaction_sources; + set_component_context(previous_component_context); + untracking = previous_untracking; + reaction.f ^= EFFECT_IS_UPDATING; + } +} +function remove_reaction(signal, dependency) { + let reactions = dependency.reactions; + if (reactions !== null) { + var index2 = index_of.call(reactions, signal); + if (index2 !== -1) { + var new_length = reactions.length - 1; + if (new_length === 0) { + reactions = dependency.reactions = null; + } else { + reactions[index2] = reactions[new_length]; + reactions.pop(); + } + } + } + if (reactions === null && (dependency.f & DERIVED) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear + // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps` + // allows us to skip the expensive work of disconnecting and immediately reconnecting it + (new_deps === null || !new_deps.includes(dependency))) { + set_signal_status(dependency, MAYBE_DIRTY); + if ((dependency.f & (UNOWNED | DISCONNECTED)) === 0) { + dependency.f ^= DISCONNECTED; + } + destroy_derived_effects( + /** @type {Derived} **/ + dependency + ); + remove_reactions( + /** @type {Derived} **/ + dependency, + 0 + ); + } +} +function remove_reactions(signal, start_index) { + var dependencies = signal.deps; + if (dependencies === null) return; + for (var i = start_index; i < dependencies.length; i++) { + remove_reaction(signal, dependencies[i]); + } +} +function update_effect(effect2) { + var flags = effect2.f; + if ((flags & DESTROYED) !== 0) { + return; + } + set_signal_status(effect2, CLEAN); + var previous_effect = active_effect; + var previous_component_context = component_context; + var was_updating_effect = is_updating_effect; + active_effect = effect2; + is_updating_effect = true; + if (dev_fallback_default) { + var previous_component_fn = dev_current_component_function; + set_dev_current_component_function(effect2.component_function); + } + try { + if ((flags & BLOCK_EFFECT) !== 0) { + destroy_block_effect_children(effect2); + } else { + destroy_effect_children(effect2); + } + execute_effect_teardown(effect2); + var teardown2 = update_reaction(effect2); + effect2.teardown = typeof teardown2 === "function" ? teardown2 : null; + effect2.wv = write_version; + var deps = effect2.deps; + if (dev_fallback_default && tracing_mode_flag && (effect2.f & DIRTY) !== 0 && deps !== null) { + for (let i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (dep.trace_need_increase) { + dep.wv = increment_write_version(); + dep.trace_need_increase = void 0; + dep.trace_v = void 0; + } + } + } + if (dev_fallback_default) { + dev_effect_stack.push(effect2); + } + } catch (error2) { + handle_error(error2, effect2, previous_effect, previous_component_context || effect2.ctx); + } finally { + is_updating_effect = was_updating_effect; + active_effect = previous_effect; + if (dev_fallback_default) { + set_dev_current_component_function(previous_component_fn); + } + } +} +function log_effect_stack() { + console.error( + "Last ten effects were: ", + dev_effect_stack.slice(-10).map((d) => d.fn) + ); + dev_effect_stack = []; +} +function infinite_loop_guard() { + try { + effect_update_depth_exceeded(); + } catch (error2) { + if (dev_fallback_default) { + define_property(error2, "stack", { + value: "" + }); + } + if (last_scheduled_effect !== null) { + if (dev_fallback_default) { + try { + handle_error(error2, last_scheduled_effect, null, null); + } catch (e) { + log_effect_stack(); + throw e; + } + } else { + handle_error(error2, last_scheduled_effect, null, null); + } + } else { + if (dev_fallback_default) { + log_effect_stack(); + } + throw error2; + } + } +} +function flush_queued_root_effects() { + var was_updating_effect = is_updating_effect; + try { + var flush_count = 0; + is_updating_effect = true; + while (queued_root_effects.length > 0) { + if (flush_count++ > 1e3) { + infinite_loop_guard(); + } + var root_effects = queued_root_effects; + var length = root_effects.length; + queued_root_effects = []; + for (var i = 0; i < length; i++) { + var collected_effects = process_effects(root_effects[i]); + flush_queued_effects(collected_effects); + } + old_values.clear(); + } + } finally { + is_flushing = false; + is_updating_effect = was_updating_effect; + last_scheduled_effect = null; + if (dev_fallback_default) { + dev_effect_stack = []; + } + } +} +function flush_queued_effects(effects) { + var length = effects.length; + if (length === 0) return; + for (var i = 0; i < length; i++) { + var effect2 = effects[i]; + if ((effect2.f & (DESTROYED | INERT)) === 0) { + try { + if (check_dirtiness(effect2)) { + update_effect(effect2); + if (effect2.deps === null && effect2.first === null && effect2.nodes_start === null) { + if (effect2.teardown === null) { + unlink_effect(effect2); + } else { + effect2.fn = null; + } + } + } + } catch (error2) { + handle_error(error2, effect2, null, effect2.ctx); + } + } + } +} +function schedule_effect(signal) { + if (!is_flushing) { + is_flushing = true; + queueMicrotask(flush_queued_root_effects); + } + var effect2 = last_scheduled_effect = signal; + while (effect2.parent !== null) { + effect2 = effect2.parent; + var flags = effect2.f; + if ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) { + if ((flags & CLEAN) === 0) return; + effect2.f ^= CLEAN; + } + } + queued_root_effects.push(effect2); +} +function process_effects(root3) { + var effects = []; + var effect2 = root3; + while (effect2 !== null) { + var flags = effect2.f; + var is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0; + var is_skippable_branch = is_branch && (flags & CLEAN) !== 0; + if (!is_skippable_branch && (flags & INERT) === 0) { + if ((flags & EFFECT) !== 0) { + effects.push(effect2); + } else if (is_branch) { + effect2.f ^= CLEAN; + } else { + var previous_active_reaction = active_reaction; + try { + active_reaction = effect2; + if (check_dirtiness(effect2)) { + update_effect(effect2); + } + } catch (error2) { + handle_error(error2, effect2, null, effect2.ctx); + } finally { + active_reaction = previous_active_reaction; + } + } + var child2 = effect2.first; + if (child2 !== null) { + effect2 = child2; + continue; + } + } + var parent = effect2.parent; + effect2 = effect2.next; + while (effect2 === null && parent !== null) { + effect2 = parent.next; + parent = parent.parent; + } + } + return effects; +} +function flushSync(fn) { + var result; + if (fn) { + is_flushing = true; + flush_queued_root_effects(); + result = fn(); + } + flush_tasks(); + while (queued_root_effects.length > 0) { + is_flushing = true; + flush_queued_root_effects(); + flush_tasks(); + } + return ( + /** @type {T} */ + result + ); +} +function get(signal) { + var flags = signal.f; + var is_derived = (flags & DERIVED) !== 0; + if (captured_signals !== null) { + captured_signals.add(signal); + } + if (active_reaction !== null && !untracking) { + if (!(reaction_sources == null ? void 0 : reaction_sources.includes(signal))) { + var deps = active_reaction.deps; + if (signal.rv < read_version) { + signal.rv = read_version; + if (new_deps === null && deps !== null && deps[skipped_deps] === signal) { + skipped_deps++; + } else if (new_deps === null) { + new_deps = [signal]; + } else if (!skip_reaction || !new_deps.includes(signal)) { + new_deps.push(signal); + } + } + } + } else if (is_derived && /** @type {Derived} */ + signal.deps === null && /** @type {Derived} */ + signal.effects === null) { + var derived2 = ( + /** @type {Derived} */ + signal + ); + var parent = derived2.parent; + if (parent !== null && (parent.f & UNOWNED) === 0) { + derived2.f ^= UNOWNED; + } + } + if (is_derived) { + derived2 = /** @type {Derived} */ + signal; + if (check_dirtiness(derived2)) { + update_derived(derived2); + } + } + if (dev_fallback_default && tracing_mode_flag && tracing_expressions !== null && active_reaction !== null && tracing_expressions.reaction === active_reaction) { + if (signal.debug) { + signal.debug(); + } else if (signal.created) { + var entry = tracing_expressions.entries.get(signal); + if (entry === void 0) { + entry = { read: [] }; + tracing_expressions.entries.set(signal, entry); + } + entry.read.push(get_stack("TracedAt")); + } + } + if (is_destroying_effect && old_values.has(signal)) { + return old_values.get(signal); + } + return signal.v; +} +function untrack(fn) { + var previous_untracking = untracking; + try { + untracking = true; + return fn(); + } finally { + untracking = previous_untracking; + } +} +var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN); +function set_signal_status(signal, status) { + signal.f = signal.f & STATUS_MASK | status; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/reactivity/sources.js +var inspect_effects = /* @__PURE__ */ new Set(); +var old_values = /* @__PURE__ */ new Map(); +function set_inspect_effects(v) { + inspect_effects = v; +} +function source(v, stack2) { + var signal = { + f: 0, + // TODO ideally we could skip this altogether, but it causes type errors + v, + reactions: null, + equals, + rv: 0, + wv: 0 + }; + if (dev_fallback_default && tracing_mode_flag) { + signal.created = stack2 != null ? stack2 : get_stack("CreatedAt"); + signal.debug = null; + } + return signal; +} +// @__NO_SIDE_EFFECTS__ +function state(v, stack2) { + const s = source(v, stack2); + push_reaction_value(s); + return s; +} +// @__NO_SIDE_EFFECTS__ +function mutable_source(initial_value, immutable = false) { + var _a3, _b3; + const s = source(initial_value); + if (!immutable) { + s.equals = safe_equals; + } + if (legacy_mode_flag && component_context !== null && component_context.l !== null) { + ((_b3 = (_a3 = component_context.l).s) != null ? _b3 : _a3.s = []).push(s); + } + return s; +} +function set(source2, value, should_proxy = false) { + var _a3; + if (active_reaction !== null && !untracking && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT)) !== 0 && !((_a3 = reaction_sources) == null ? void 0 : _a3.includes(source2))) { + state_unsafe_mutation(); + } + let new_value = should_proxy ? proxy(value) : value; + return internal_set(source2, new_value); +} +function internal_set(source2, value) { + var _a3; + if (!source2.equals(value)) { + var old_value = source2.v; + if (is_destroying_effect) { + old_values.set(source2, value); + } else { + old_values.set(source2, old_value); + } + source2.v = value; + if (dev_fallback_default && tracing_mode_flag) { + source2.updated = get_stack("UpdatedAt"); + if (active_effect != null) { + source2.trace_need_increase = true; + (_a3 = source2.trace_v) != null ? _a3 : source2.trace_v = old_value; + } + } + if ((source2.f & DERIVED) !== 0) { + if ((source2.f & DIRTY) !== 0) { + execute_derived( + /** @type {Derived} */ + source2 + ); + } + set_signal_status(source2, (source2.f & UNOWNED) === 0 ? CLEAN : MAYBE_DIRTY); + } + source2.wv = increment_write_version(); + mark_reactions(source2, DIRTY); + if (is_runes() && active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) { + if (untracked_writes === null) { + set_untracked_writes([source2]); + } else { + untracked_writes.push(source2); + } + } + if (dev_fallback_default && inspect_effects.size > 0) { + const inspects = Array.from(inspect_effects); + for (const effect2 of inspects) { + if ((effect2.f & CLEAN) !== 0) { + set_signal_status(effect2, MAYBE_DIRTY); + } + if (check_dirtiness(effect2)) { + update_effect(effect2); + } + } + inspect_effects.clear(); + } + } + return value; +} +function mark_reactions(signal, status) { + var reactions = signal.reactions; + if (reactions === null) return; + var runes = is_runes(); + var length = reactions.length; + for (var i = 0; i < length; i++) { + var reaction = reactions[i]; + var flags = reaction.f; + if ((flags & DIRTY) !== 0) continue; + if (!runes && reaction === active_effect) continue; + if (dev_fallback_default && (flags & INSPECT_EFFECT) !== 0) { + inspect_effects.add(reaction); + continue; + } + set_signal_status(reaction, status); + if ((flags & (CLEAN | UNOWNED)) !== 0) { + if ((flags & DERIVED) !== 0) { + mark_reactions( + /** @type {Derived} */ + reaction, + MAYBE_DIRTY + ); + } else { + schedule_effect( + /** @type {Effect} */ + reaction + ); + } + } + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/context.js +var component_context = null; +function set_component_context(context) { + component_context = context; +} +var dev_current_component_function = null; +function set_dev_current_component_function(fn) { + dev_current_component_function = fn; +} +function push(props, runes = false, fn) { + var ctx = component_context = { + p: component_context, + c: null, + d: false, + e: null, + m: false, + s: props, + x: null, + l: null + }; + if (legacy_mode_flag && !runes) { + component_context.l = { + s: null, + u: null, + r1: [], + r2: source(false) + }; + } + teardown(() => { + ctx.d = true; + }); + if (dev_fallback_default) { + component_context.function = fn; + dev_current_component_function = fn; + } +} +function pop(component2) { + var _a3, _b3; + const context_stack_item = component_context; + if (context_stack_item !== null) { + if (component2 !== void 0) { + context_stack_item.x = component2; + } + const component_effects = context_stack_item.e; + if (component_effects !== null) { + var previous_effect = active_effect; + var previous_reaction = active_reaction; + context_stack_item.e = null; + try { + for (var i = 0; i < component_effects.length; i++) { + var component_effect = component_effects[i]; + set_active_effect(component_effect.effect); + set_active_reaction(component_effect.reaction); + effect(component_effect.fn); + } + } finally { + set_active_effect(previous_effect); + set_active_reaction(previous_reaction); + } + } + component_context = context_stack_item.p; + if (dev_fallback_default) { + dev_current_component_function = (_b3 = (_a3 = context_stack_item.p) == null ? void 0 : _a3.function) != null ? _b3 : null; + } + context_stack_item.m = true; + } + return component2 || /** @type {T} */ + {}; +} +function is_runes() { + return !legacy_mode_flag || component_context !== null && component_context.l === null; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/utils.js +function is_capture_event(name) { + return name.endsWith("capture") && name !== "gotpointercapture" && name !== "lostpointercapture"; +} +var DELEGATED_EVENTS = [ + "beforeinput", + "click", + "change", + "dblclick", + "contextmenu", + "focusin", + "focusout", + "input", + "keydown", + "keyup", + "mousedown", + "mousemove", + "mouseout", + "mouseover", + "mouseup", + "pointerdown", + "pointermove", + "pointerout", + "pointerover", + "pointerup", + "touchend", + "touchmove", + "touchstart" +]; +function is_delegated(event_name) { + return DELEGATED_EVENTS.includes(event_name); +} +var DOM_BOOLEAN_ATTRIBUTES = [ + "allowfullscreen", + "async", + "autofocus", + "autoplay", + "checked", + "controls", + "default", + "disabled", + "formnovalidate", + "hidden", + "indeterminate", + "inert", + "ismap", + "loop", + "multiple", + "muted", + "nomodule", + "novalidate", + "open", + "playsinline", + "readonly", + "required", + "reversed", + "seamless", + "selected", + "webkitdirectory", + "defer", + "disablepictureinpicture", + "disableremoteplayback" +]; +var ATTRIBUTE_ALIASES = { + // no `class: 'className'` because we handle that separately + formnovalidate: "formNoValidate", + ismap: "isMap", + nomodule: "noModule", + playsinline: "playsInline", + readonly: "readOnly", + defaultvalue: "defaultValue", + defaultchecked: "defaultChecked", + srcobject: "srcObject", + novalidate: "noValidate", + allowfullscreen: "allowFullscreen", + disablepictureinpicture: "disablePictureInPicture", + disableremoteplayback: "disableRemotePlayback" +}; +function normalize_attribute(name) { + var _a3; + name = name.toLowerCase(); + return (_a3 = ATTRIBUTE_ALIASES[name]) != null ? _a3 : name; +} +var DOM_PROPERTIES = [ + ...DOM_BOOLEAN_ATTRIBUTES, + "formNoValidate", + "isMap", + "noModule", + "playsInline", + "readOnly", + "value", + "volume", + "defaultValue", + "defaultChecked", + "srcObject", + "noValidate", + "allowFullscreen", + "disablePictureInPicture", + "disableRemotePlayback" +]; +var PASSIVE_EVENTS = ["touchstart", "touchmove"]; +function is_passive_event(name) { + return PASSIVE_EVENTS.includes(name); +} +var RAW_TEXT_ELEMENTS = ( + /** @type {const} */ + ["textarea", "script", "style", "title"] +); +function is_raw_text_element(name) { + return RAW_TEXT_ELEMENTS.includes( + /** @type {RAW_TEXT_ELEMENTS[number]} */ + name + ); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dev/css.js +var all_styles = /* @__PURE__ */ new Map(); +function register_style(hash2, style) { + var styles = all_styles.get(hash2); + if (!styles) { + styles = /* @__PURE__ */ new Set(); + all_styles.set(hash2, styles); + } + styles.add(style); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/elements/misc.js +function autofocus(dom, value) { + if (value) { + const body = document.body; + dom.autofocus = true; + queue_micro_task(() => { + if (document.activeElement === body) { + dom.focus(); + } + }); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js +function without_reactive_context(fn) { + var previous_reaction = active_reaction; + var previous_effect = active_effect; + set_active_reaction(null); + set_active_effect(null); + try { + return fn(); + } finally { + set_active_reaction(previous_reaction); + set_active_effect(previous_effect); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/elements/events.js +var all_registered_events = /* @__PURE__ */ new Set(); +var root_event_handles = /* @__PURE__ */ new Set(); +function create_event(event_name, dom, handler, options = {}) { + function target_handler(event2) { + if (!options.capture) { + handle_event_propagation.call(dom, event2); + } + if (!event2.cancelBubble) { + return without_reactive_context(() => { + return handler == null ? void 0 : handler.call(this, event2); + }); + } + } + if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") { + queue_micro_task(() => { + dom.addEventListener(event_name, target_handler, options); + }); + } else { + dom.addEventListener(event_name, target_handler, options); + } + return target_handler; +} +function delegate(events) { + for (var i = 0; i < events.length; i++) { + all_registered_events.add(events[i]); + } + for (var fn of root_event_handles) { + fn(events); + } +} +function handle_event_propagation(event2) { + var _a3; + var handler_element = this; + var owner_document = ( + /** @type {Node} */ + handler_element.ownerDocument + ); + var event_name = event2.type; + var path3 = ((_a3 = event2.composedPath) == null ? void 0 : _a3.call(event2)) || []; + var current_target = ( + /** @type {null | Element} */ + path3[0] || event2.target + ); + var path_idx = 0; + var handled_at = event2.__root; + if (handled_at) { + var at_idx = path3.indexOf(handled_at); + if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */ + window)) { + event2.__root = handler_element; + return; + } + var handler_idx = path3.indexOf(handler_element); + if (handler_idx === -1) { + return; + } + if (at_idx <= handler_idx) { + path_idx = at_idx; + } + } + current_target = /** @type {Element} */ + path3[path_idx] || event2.target; + if (current_target === handler_element) return; + define_property(event2, "currentTarget", { + configurable: true, + get() { + return current_target || owner_document; + } + }); + var previous_reaction = active_reaction; + var previous_effect = active_effect; + set_active_reaction(null); + set_active_effect(null); + try { + var throw_error; + var other_errors = []; + while (current_target !== null) { + var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */ + current_target.host || null; + try { + var delegated = current_target["__" + event_name]; + if (delegated != null && (!/** @type {any} */ + current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well + // -> the target could not have been disabled because it emits the event in the first place + event2.target === current_target)) { + if (is_array(delegated)) { + var [fn, ...data] = delegated; + fn.apply(current_target, [event2, ...data]); + } else { + delegated.call(current_target, event2); + } + } + } catch (error2) { + if (throw_error) { + other_errors.push(error2); + } else { + throw_error = error2; + } + } + if (event2.cancelBubble || parent_element === handler_element || parent_element === null) { + break; + } + current_target = parent_element; + } + if (throw_error) { + for (let error2 of other_errors) { + queueMicrotask(() => { + throw error2; + }); + } + throw throw_error; + } + } finally { + event2.__root = handler_element; + delete event2.currentTarget; + set_active_reaction(previous_reaction); + set_active_effect(previous_effect); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/blocks/svelte-head.js +var head_anchor; +function reset_head_anchor() { + head_anchor = void 0; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/reconciler.js +function create_fragment_from_html(html2) { + var elem = document.createElement("template"); + elem.innerHTML = html2; + return elem.content; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/template.js +function assign_nodes(start, end) { + var effect2 = ( + /** @type {Effect} */ + active_effect + ); + if (effect2.nodes_start === null) { + effect2.nodes_start = start; + effect2.nodes_end = end; + } +} +// @__NO_SIDE_EFFECTS__ +function template(content, flags) { + var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0; + var use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0; + var node; + var has_start = !content.startsWith(""); + return () => { + if (hydrating) { + assign_nodes(hydrate_node, null); + return hydrate_node; + } + if (node === void 0) { + node = create_fragment_from_html(has_start ? content : "" + content); + if (!is_fragment) node = /** @type {Node} */ + get_first_child(node); + } + var clone = ( + /** @type {TemplateNode} */ + use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true) + ); + if (is_fragment) { + var start = ( + /** @type {TemplateNode} */ + get_first_child(clone) + ); + var end = ( + /** @type {TemplateNode} */ + clone.lastChild + ); + assign_nodes(start, end); + } else { + assign_nodes(clone, clone); + } + return clone; + }; +} +// @__NO_SIDE_EFFECTS__ +function ns_template(content, flags, ns = "svg") { + var has_start = !content.startsWith(""); + var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0; + var wrapped = `<${ns}>${has_start ? content : "" + content}`; + var node; + return () => { + if (hydrating) { + assign_nodes(hydrate_node, null); + return hydrate_node; + } + if (!node) { + var fragment = ( + /** @type {DocumentFragment} */ + create_fragment_from_html(wrapped) + ); + var root3 = ( + /** @type {Element} */ + get_first_child(fragment) + ); + if (is_fragment) { + node = document.createDocumentFragment(); + while (get_first_child(root3)) { + node.appendChild( + /** @type {Node} */ + get_first_child(root3) + ); + } + } else { + node = /** @type {Element} */ + get_first_child(root3); + } + } + var clone = ( + /** @type {TemplateNode} */ + node.cloneNode(true) + ); + if (is_fragment) { + var start = ( + /** @type {TemplateNode} */ + get_first_child(clone) + ); + var end = ( + /** @type {TemplateNode} */ + clone.lastChild + ); + assign_nodes(start, end); + } else { + assign_nodes(clone, clone); + } + return clone; + }; +} +function comment() { + if (hydrating) { + assign_nodes(hydrate_node, null); + return hydrate_node; + } + var frag = document.createDocumentFragment(); + var start = document.createComment(""); + var anchor = create_text(); + frag.append(start, anchor); + assign_nodes(start, anchor); + return frag; +} +function append(anchor, dom) { + if (hydrating) { + active_effect.nodes_end = hydrate_node; + hydrate_next(); + return; + } + if (anchor === null) { + return; + } + anchor.before( + /** @type {Node} */ + dom + ); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/render.js +var should_intro = true; +function set_should_intro(value) { + should_intro = value; +} +function set_text(text2, value) { + var _a3; + var str = value == null ? "" : typeof value === "object" ? value + "" : value; + if (str !== ((_a3 = text2.__t) != null ? _a3 : text2.__t = text2.nodeValue)) { + text2.__t = str; + text2.nodeValue = str + ""; + } +} +function mount(component2, options) { + return _mount(component2, options); +} +function hydrate(component2, options) { + var _a3; + init_operations(); + options.intro = (_a3 = options.intro) != null ? _a3 : false; + const target = options.target; + const was_hydrating = hydrating; + const previous_hydrate_node = hydrate_node; + try { + var anchor = ( + /** @type {TemplateNode} */ + get_first_child(target) + ); + while (anchor && (anchor.nodeType !== 8 || /** @type {Comment} */ + anchor.data !== HYDRATION_START)) { + anchor = /** @type {TemplateNode} */ + get_next_sibling(anchor); + } + if (!anchor) { + throw HYDRATION_ERROR; + } + set_hydrating(true); + set_hydrate_node( + /** @type {Comment} */ + anchor + ); + hydrate_next(); + const instance = _mount(component2, { ...options, anchor }); + if (hydrate_node === null || hydrate_node.nodeType !== 8 || /** @type {Comment} */ + hydrate_node.data !== HYDRATION_END) { + hydration_mismatch(); + throw HYDRATION_ERROR; + } + set_hydrating(false); + return ( + /** @type {Exports} */ + instance + ); + } catch (error2) { + if (error2 === HYDRATION_ERROR) { + if (options.recover === false) { + hydration_failed(); + } + init_operations(); + clear_text_content(target); + set_hydrating(false); + return mount(component2, options); + } + throw error2; + } finally { + set_hydrating(was_hydrating); + set_hydrate_node(previous_hydrate_node); + reset_head_anchor(); + } +} +var document_listeners = /* @__PURE__ */ new Map(); +function _mount(Component2, { target, anchor, props = {}, events, context, intro = true }) { + init_operations(); + var registered_events = /* @__PURE__ */ new Set(); + var event_handle = (events2) => { + for (var i = 0; i < events2.length; i++) { + var event_name = events2[i]; + if (registered_events.has(event_name)) continue; + registered_events.add(event_name); + var passive2 = is_passive_event(event_name); + target.addEventListener(event_name, handle_event_propagation, { passive: passive2 }); + var n = document_listeners.get(event_name); + if (n === void 0) { + document.addEventListener(event_name, handle_event_propagation, { passive: passive2 }); + document_listeners.set(event_name, 1); + } else { + document_listeners.set(event_name, n + 1); + } + } + }; + event_handle(array_from(all_registered_events)); + root_event_handles.add(event_handle); + var component2 = void 0; + var unmount2 = component_root(() => { + var anchor_node = anchor != null ? anchor : target.appendChild(create_text()); + branch(() => { + if (context) { + push({}); + var ctx = ( + /** @type {ComponentContext} */ + component_context + ); + ctx.c = context; + } + if (events) { + props.$$events = events; + } + if (hydrating) { + assign_nodes( + /** @type {TemplateNode} */ + anchor_node, + null + ); + } + should_intro = intro; + component2 = Component2(anchor_node, props) || {}; + should_intro = true; + if (hydrating) { + active_effect.nodes_end = hydrate_node; + } + if (context) { + pop(); + } + }); + return () => { + var _a3; + for (var event_name of registered_events) { + target.removeEventListener(event_name, handle_event_propagation); + var n = ( + /** @type {number} */ + document_listeners.get(event_name) + ); + if (--n === 0) { + document.removeEventListener(event_name, handle_event_propagation); + document_listeners.delete(event_name); + } else { + document_listeners.set(event_name, n); + } + } + root_event_handles.delete(event_handle); + if (anchor_node !== anchor) { + (_a3 = anchor_node.parentNode) == null ? void 0 : _a3.removeChild(anchor_node); + } + }; + }); + mounted_components.set(component2, unmount2); + return component2; +} +var mounted_components = /* @__PURE__ */ new WeakMap(); +function unmount(component2, options) { + const fn = mounted_components.get(component2); + if (fn) { + mounted_components.delete(component2); + return fn(options); + } + if (dev_fallback_default) { + lifecycle_double_unmount(); + } + return Promise.resolve(); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/blocks/if.js +function if_block(node, fn, [root_index, hydrate_index] = [0, 0]) { + if (hydrating && root_index === 0) { + hydrate_next(); + } + var anchor = node; + var consequent_effect = null; + var alternate_effect = null; + var condition = UNINITIALIZED; + var flags = root_index > 0 ? EFFECT_TRANSPARENT : 0; + var has_branch = false; + const set_branch = (fn2, flag3 = true) => { + has_branch = true; + update_branch(flag3, fn2); + }; + const update_branch = (new_condition, fn2) => { + if (condition === (condition = new_condition)) return; + let mismatch = false; + if (hydrating && hydrate_index !== -1) { + if (root_index === 0) { + const data = ( + /** @type {Comment} */ + anchor.data + ); + if (data === HYDRATION_START) { + hydrate_index = 0; + } else if (data === HYDRATION_START_ELSE) { + hydrate_index = Infinity; + } else { + hydrate_index = parseInt(data.substring(1)); + if (hydrate_index !== hydrate_index) { + hydrate_index = condition ? Infinity : -1; + } + } + } + const is_else = hydrate_index > root_index; + if (!!condition === is_else) { + anchor = remove_nodes(); + set_hydrate_node(anchor); + set_hydrating(false); + mismatch = true; + hydrate_index = -1; + } + } + if (condition) { + if (consequent_effect) { + resume_effect(consequent_effect); + } else if (fn2) { + consequent_effect = branch(() => fn2(anchor)); + } + if (alternate_effect) { + pause_effect(alternate_effect, () => { + alternate_effect = null; + }); + } + } else { + if (alternate_effect) { + resume_effect(alternate_effect); + } else if (fn2) { + alternate_effect = branch(() => fn2(anchor, [root_index + 1, hydrate_index])); + } + if (consequent_effect) { + pause_effect(consequent_effect, () => { + consequent_effect = null; + }); + } + } + if (mismatch) { + set_hydrating(true); + } + }; + block(() => { + has_branch = false; + fn(set_branch); + if (!has_branch) { + update_branch(null, null); + } + }, flags); + if (hydrating) { + anchor = hydrate_node; + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/blocks/each.js +var current_each_item = null; +function set_current_each_item(item) { + current_each_item = item; +} +function index(_, i) { + return i; +} +function pause_effects(state2, items, controlled_anchor, items_map) { + var transitions = []; + var length = items.length; + for (var i = 0; i < length; i++) { + pause_children(items[i].e, transitions, true); + } + var is_controlled = length > 0 && transitions.length === 0 && controlled_anchor !== null; + if (is_controlled) { + var parent_node = ( + /** @type {Element} */ + /** @type {Element} */ + controlled_anchor.parentNode + ); + clear_text_content(parent_node); + parent_node.append( + /** @type {Element} */ + controlled_anchor + ); + items_map.clear(); + link(state2, items[0].prev, items[length - 1].next); + } + run_out_transitions(transitions, () => { + for (var i2 = 0; i2 < length; i2++) { + var item = items[i2]; + if (!is_controlled) { + items_map.delete(item.k); + link(state2, item.prev, item.next); + } + destroy_effect(item.e, !is_controlled); + } + }); +} +function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) { + var anchor = node; + var state2 = { flags, items: /* @__PURE__ */ new Map(), first: null }; + var is_controlled = (flags & EACH_IS_CONTROLLED) !== 0; + if (is_controlled) { + var parent_node = ( + /** @type {Element} */ + node + ); + anchor = hydrating ? set_hydrate_node( + /** @type {Comment | Text} */ + get_first_child(parent_node) + ) : parent_node.appendChild(create_text()); + } + if (hydrating) { + hydrate_next(); + } + var fallback2 = null; + var was_empty = false; + var each_array = derived_safe_equal(() => { + var collection = get_collection(); + return is_array(collection) ? collection : collection == null ? [] : array_from(collection); + }); + block(() => { + var array = get(each_array); + var length = array.length; + if (was_empty && length === 0) { + return; + } + was_empty = length === 0; + let mismatch = false; + if (hydrating) { + var is_else = ( + /** @type {Comment} */ + anchor.data === HYDRATION_START_ELSE + ); + if (is_else !== (length === 0)) { + anchor = remove_nodes(); + set_hydrate_node(anchor); + set_hydrating(false); + mismatch = true; + } + } + if (hydrating) { + var prev = null; + var item; + for (var i = 0; i < length; i++) { + if (hydrate_node.nodeType === 8 && /** @type {Comment} */ + hydrate_node.data === HYDRATION_END) { + anchor = /** @type {Comment} */ + hydrate_node; + mismatch = true; + set_hydrating(false); + break; + } + var value = array[i]; + var key = get_key(value, i); + item = create_item( + hydrate_node, + state2, + prev, + null, + value, + key, + i, + render_fn, + flags, + get_collection + ); + state2.items.set(key, item); + prev = item; + } + if (length > 0) { + set_hydrate_node(remove_nodes()); + } + } + if (!hydrating) { + reconcile(array, state2, anchor, render_fn, flags, get_key, get_collection); + } + if (fallback_fn !== null) { + if (length === 0) { + if (fallback2) { + resume_effect(fallback2); + } else { + fallback2 = branch(() => fallback_fn(anchor)); + } + } else if (fallback2 !== null) { + pause_effect(fallback2, () => { + fallback2 = null; + }); + } + } + if (mismatch) { + set_hydrating(true); + } + get(each_array); + }); + if (hydrating) { + anchor = hydrate_node; + } +} +function reconcile(array, state2, anchor, render_fn, flags, get_key, get_collection) { + var _a3, _b3, _c2, _d; + var is_animated = (flags & EACH_IS_ANIMATED) !== 0; + var should_update = (flags & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0; + var length = array.length; + var items = state2.items; + var first = state2.first; + var current = first; + var seen; + var prev = null; + var to_animate; + var matched = []; + var stashed = []; + var value; + var key; + var item; + var i; + if (is_animated) { + for (i = 0; i < length; i += 1) { + value = array[i]; + key = get_key(value, i); + item = items.get(key); + if (item !== void 0) { + (_a3 = item.a) == null ? void 0 : _a3.measure(); + (to_animate != null ? to_animate : to_animate = /* @__PURE__ */ new Set()).add(item); + } + } + } + for (i = 0; i < length; i += 1) { + value = array[i]; + key = get_key(value, i); + item = items.get(key); + if (item === void 0) { + var child_anchor = current ? ( + /** @type {TemplateNode} */ + current.e.nodes_start + ) : anchor; + prev = create_item( + child_anchor, + state2, + prev, + prev === null ? state2.first : prev.next, + value, + key, + i, + render_fn, + flags, + get_collection + ); + items.set(key, prev); + matched = []; + stashed = []; + current = prev.next; + continue; + } + if (should_update) { + update_item(item, value, i, flags); + } + if ((item.e.f & INERT) !== 0) { + resume_effect(item.e); + if (is_animated) { + (_b3 = item.a) == null ? void 0 : _b3.unfix(); + (to_animate != null ? to_animate : to_animate = /* @__PURE__ */ new Set()).delete(item); + } + } + if (item !== current) { + if (seen !== void 0 && seen.has(item)) { + if (matched.length < stashed.length) { + var start = stashed[0]; + var j; + prev = start.prev; + var a = matched[0]; + var b = matched[matched.length - 1]; + for (j = 0; j < matched.length; j += 1) { + move(matched[j], start, anchor); + } + for (j = 0; j < stashed.length; j += 1) { + seen.delete(stashed[j]); + } + link(state2, a.prev, b.next); + link(state2, prev, a); + link(state2, b, start); + current = start; + prev = b; + i -= 1; + matched = []; + stashed = []; + } else { + seen.delete(item); + move(item, current, anchor); + link(state2, item.prev, item.next); + link(state2, item, prev === null ? state2.first : prev.next); + link(state2, prev, item); + prev = item; + } + continue; + } + matched = []; + stashed = []; + while (current !== null && current.k !== key) { + if ((current.e.f & INERT) === 0) { + (seen != null ? seen : seen = /* @__PURE__ */ new Set()).add(current); + } + stashed.push(current); + current = current.next; + } + if (current === null) { + continue; + } + item = current; + } + matched.push(item); + prev = item; + current = item.next; + } + if (current !== null || seen !== void 0) { + var to_destroy = seen === void 0 ? [] : array_from(seen); + while (current !== null) { + if ((current.e.f & INERT) === 0) { + to_destroy.push(current); + } + current = current.next; + } + var destroy_length = to_destroy.length; + if (destroy_length > 0) { + var controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null; + if (is_animated) { + for (i = 0; i < destroy_length; i += 1) { + (_c2 = to_destroy[i].a) == null ? void 0 : _c2.measure(); + } + for (i = 0; i < destroy_length; i += 1) { + (_d = to_destroy[i].a) == null ? void 0 : _d.fix(); + } + } + pause_effects(state2, to_destroy, controlled_anchor, items); + } + } + if (is_animated) { + queue_micro_task(() => { + var _a4; + if (to_animate === void 0) return; + for (item of to_animate) { + (_a4 = item.a) == null ? void 0 : _a4.apply(); + } + }); + } + active_effect.first = state2.first && state2.first.e; + active_effect.last = prev && prev.e; +} +function update_item(item, value, index2, type) { + if ((type & EACH_ITEM_REACTIVE) !== 0) { + internal_set(item.v, value); + } + if ((type & EACH_INDEX_REACTIVE) !== 0) { + internal_set( + /** @type {Value} */ + item.i, + index2 + ); + } else { + item.i = index2; + } +} +function create_item(anchor, state2, prev, next2, value, key, index2, render_fn, flags, get_collection) { + var previous_each_item = current_each_item; + var reactive = (flags & EACH_ITEM_REACTIVE) !== 0; + var mutable = (flags & EACH_ITEM_IMMUTABLE) === 0; + var v = reactive ? mutable ? mutable_source(value) : source(value) : value; + var i = (flags & EACH_INDEX_REACTIVE) === 0 ? index2 : source(index2); + if (dev_fallback_default && reactive) { + v.debug = () => { + var collection_index = typeof i === "number" ? index2 : i.v; + get_collection()[collection_index]; + }; + } + var item = { + i, + v, + k: key, + a: null, + // @ts-expect-error + e: null, + prev, + next: next2 + }; + current_each_item = item; + try { + item.e = branch(() => render_fn(anchor, v, i, get_collection), hydrating); + item.e.prev = prev && prev.e; + item.e.next = next2 && next2.e; + if (prev === null) { + state2.first = item; + } else { + prev.next = item; + prev.e.next = item.e; + } + if (next2 !== null) { + next2.prev = item; + next2.e.prev = item.e; + } + return item; + } finally { + current_each_item = previous_each_item; + } +} +function move(item, next2, anchor) { + var end = item.next ? ( + /** @type {TemplateNode} */ + item.next.e.nodes_start + ) : anchor; + var dest = next2 ? ( + /** @type {TemplateNode} */ + next2.e.nodes_start + ) : anchor; + var node = ( + /** @type {TemplateNode} */ + item.e.nodes_start + ); + while (node !== end) { + var next_node = ( + /** @type {TemplateNode} */ + get_next_sibling(node) + ); + dest.before(node); + node = next_node; + } +} +function link(state2, prev, next2) { + if (prev === null) { + state2.first = next2; + } else { + prev.next = next2; + prev.e.next = next2 && next2.e; + } + if (next2 !== null) { + next2.prev = prev; + next2.e.prev = prev && prev.e; + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/blocks/snippet.js +function snippet(node, get_snippet, ...args) { + var anchor = node; + var snippet2 = noop; + var snippet_effect; + block(() => { + if (snippet2 === (snippet2 = get_snippet())) return; + if (snippet_effect) { + destroy_effect(snippet_effect); + snippet_effect = null; + } + if (dev_fallback_default && snippet2 == null) { + invalid_snippet(); + } + snippet_effect = branch(() => ( + /** @type {SnippetFn} */ + snippet2(anchor, ...args) + )); + }, EFFECT_TRANSPARENT); + if (hydrating) { + anchor = hydrate_node; + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/blocks/svelte-element.js +function element(node, get_tag, is_svg, render_fn, get_namespace, location) { + var _a3; + let was_hydrating = hydrating; + if (hydrating) { + hydrate_next(); + } + var filename = dev_fallback_default && location && ((_a3 = component_context) == null ? void 0 : _a3.function[FILENAME]); + var tag; + var current_tag; + var element2 = null; + if (hydrating && hydrate_node.nodeType === 1) { + element2 = /** @type {Element} */ + hydrate_node; + hydrate_next(); + } + var anchor = ( + /** @type {TemplateNode} */ + hydrating ? hydrate_node : node + ); + var effect2; + var each_item_block = current_each_item; + block(() => { + const next_tag = get_tag() || null; + var ns = get_namespace ? get_namespace() : is_svg || next_tag === "svg" ? NAMESPACE_SVG : null; + if (next_tag === tag) return; + var previous_each_item = current_each_item; + set_current_each_item(each_item_block); + if (effect2) { + if (next_tag === null) { + pause_effect(effect2, () => { + effect2 = null; + current_tag = null; + }); + } else if (next_tag === current_tag) { + resume_effect(effect2); + } else { + destroy_effect(effect2); + set_should_intro(false); + } + } + if (next_tag && next_tag !== current_tag) { + effect2 = branch(() => { + element2 = hydrating ? ( + /** @type {Element} */ + element2 + ) : ns ? document.createElementNS(ns, next_tag) : document.createElement(next_tag); + if (dev_fallback_default && location) { + element2.__svelte_meta = { + loc: { + file: filename, + line: location[0], + column: location[1] + } + }; + } + assign_nodes(element2, element2); + if (render_fn) { + if (hydrating && is_raw_text_element(next_tag)) { + element2.append(document.createComment("")); + } + var child_anchor = ( + /** @type {TemplateNode} */ + hydrating ? get_first_child(element2) : element2.appendChild(create_text()) + ); + if (hydrating) { + if (child_anchor === null) { + set_hydrating(false); + } else { + set_hydrate_node(child_anchor); + } + } + render_fn(element2, child_anchor); + } + active_effect.nodes_end = element2; + anchor.before(element2); + }); + } + tag = next_tag; + if (tag) current_tag = tag; + set_should_intro(true); + set_current_each_item(previous_each_item); + }, EFFECT_TRANSPARENT); + if (was_hydrating) { + set_hydrating(true); + set_hydrate_node(anchor); + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/css.js +function append_styles(anchor, css) { + queue_micro_task(() => { + var _a3; + var root3 = anchor.getRootNode(); + var target = ( + /** @type {ShadowRoot} */ + root3.host ? ( + /** @type {ShadowRoot} */ + root3 + ) : ( + /** @type {Document} */ + (_a3 = root3.head) != null ? _a3 : ( + /** @type {Document} */ + root3.ownerDocument.head + ) + ) + ); + if (!target.querySelector("#" + css.hash)) { + const style = document.createElement("style"); + style.id = css.hash; + style.textContent = css.code; + target.appendChild(style); + if (dev_fallback_default) { + register_style(css.hash, style); + } + } + }); +} + +// node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs +function r(e) { + var t, f, n = ""; + if ("string" == typeof e || "number" == typeof e) n += e; + else if ("object" == typeof e) if (Array.isArray(e)) { + var o = e.length; + for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); + } else for (f in e) e[f] && (n && (n += " "), n += f); + return n; +} +function clsx() { + for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); + return n; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/shared/attributes.js +function clsx2(value) { + if (typeof value === "object") { + return clsx(value); + } else { + return value != null ? value : ""; + } +} +var whitespace = [..." \n\r\f\xA0\v\uFEFF"]; +function to_class(value, hash2, directives) { + var classname = value == null ? "" : "" + value; + if (hash2) { + classname = classname ? classname + " " + hash2 : hash2; + } + if (directives) { + for (var key in directives) { + if (directives[key]) { + classname = classname ? classname + " " + key : key; + } else if (classname.length) { + var len = key.length; + var a = 0; + while ((a = classname.indexOf(key, a)) >= 0) { + var b = a + len; + if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) { + classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1); + } else { + a = b; + } + } + } + } + } + return classname === "" ? null : classname; +} +function append_styles2(styles, important = false) { + var separator = important ? " !important;" : ";"; + var css = ""; + for (var key in styles) { + var value = styles[key]; + if (value != null && value !== "") { + css += " " + key + ": " + value + separator; + } + } + return css; +} +function to_css_name(name) { + if (name[0] !== "-" || name[1] !== "-") { + return name.toLowerCase(); + } + return name; +} +function to_style(value, styles) { + if (styles) { + var new_style = ""; + var normal_styles; + var important_styles; + if (Array.isArray(styles)) { + normal_styles = styles[0]; + important_styles = styles[1]; + } else { + normal_styles = styles; + } + if (value) { + value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim(); + var in_str = false; + var in_apo = 0; + var in_comment = false; + var reserved_names = []; + if (normal_styles) { + reserved_names.push(...Object.keys(normal_styles).map(to_css_name)); + } + if (important_styles) { + reserved_names.push(...Object.keys(important_styles).map(to_css_name)); + } + var start_index = 0; + var name_index = -1; + const len = value.length; + for (var i = 0; i < len; i++) { + var c = value[i]; + if (in_comment) { + if (c === "/" && value[i - 1] === "*") { + in_comment = false; + } + } else if (in_str) { + if (in_str === c) { + in_str = false; + } + } else if (c === "/" && value[i + 1] === "*") { + in_comment = true; + } else if (c === '"' || c === "'") { + in_str = c; + } else if (c === "(") { + in_apo++; + } else if (c === ")") { + in_apo--; + } + if (!in_comment && in_str === false && in_apo === 0) { + if (c === ":" && name_index === -1) { + name_index = i; + } else if (c === ";" || i === len - 1) { + if (name_index !== -1) { + var name = to_css_name(value.substring(start_index, name_index).trim()); + if (!reserved_names.includes(name)) { + if (c !== ";") { + i++; + } + var property = value.substring(start_index, i).trim(); + new_style += " " + property + ";"; + } + } + start_index = i + 1; + name_index = -1; + } + } + } + } + if (normal_styles) { + new_style += append_styles2(normal_styles); + } + if (important_styles) { + new_style += append_styles2(important_styles, true); + } + new_style = new_style.trim(); + return new_style === "" ? null : new_style; + } + return value == null ? null : String(value); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/elements/class.js +function set_class(dom, is_html, value, hash2, prev_classes, next_classes) { + var prev = dom.__className; + if (hydrating || prev !== value || prev === void 0) { + var next_class_name = to_class(value, hash2, next_classes); + if (!hydrating || next_class_name !== dom.getAttribute("class")) { + if (next_class_name == null) { + dom.removeAttribute("class"); + } else if (is_html) { + dom.className = next_class_name; + } else { + dom.setAttribute("class", next_class_name); + } + } + dom.__className = value; + } else if (next_classes && prev_classes !== next_classes) { + for (var key in next_classes) { + var is_present = !!next_classes[key]; + if (prev_classes == null || is_present !== !!prev_classes[key]) { + dom.classList.toggle(key, is_present); + } + } + } + return next_classes; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/elements/style.js +function update_styles(dom, prev = {}, next2, priority) { + for (var key in next2) { + var value = next2[key]; + if (prev[key] !== value) { + if (next2[key] == null) { + dom.style.removeProperty(key); + } else { + dom.style.setProperty(key, value, priority); + } + } + } +} +function set_style(dom, value, prev_styles, next_styles) { + var prev = dom.__style; + if (hydrating || prev !== value) { + var next_style_attr = to_style(value, next_styles); + if (!hydrating || next_style_attr !== dom.getAttribute("style")) { + if (next_style_attr == null) { + dom.removeAttribute("style"); + } else { + dom.style.cssText = next_style_attr; + } + } + dom.__style = value; + } else if (next_styles) { + if (Array.isArray(next_styles)) { + update_styles(dom, prev_styles == null ? void 0 : prev_styles[0], next_styles[0]); + update_styles(dom, prev_styles == null ? void 0 : prev_styles[1], next_styles[1], "important"); + } else { + update_styles(dom, prev_styles, next_styles); + } + } + return next_styles; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/elements/attributes.js +var CLASS = Symbol("class"); +var STYLE = Symbol("style"); +var IS_CUSTOM_ELEMENT = Symbol("is custom element"); +var IS_HTML = Symbol("is html"); +function set_selected(element2, selected) { + if (selected) { + if (!element2.hasAttribute("selected")) { + element2.setAttribute("selected", ""); + } + } else { + element2.removeAttribute("selected"); + } +} +function set_attribute(element2, attribute, value, skip_warning) { + var attributes = get_attributes(element2); + if (hydrating) { + attributes[attribute] = element2.getAttribute(attribute); + if (attribute === "src" || attribute === "srcset" || attribute === "href" && element2.nodeName === "LINK") { + if (!skip_warning) { + check_src_in_dev_hydration(element2, attribute, value != null ? value : ""); + } + return; + } + } + if (attributes[attribute] === (attributes[attribute] = value)) return; + if (attribute === "loading") { + element2[LOADING_ATTR_SYMBOL] = value; + } + if (value == null) { + element2.removeAttribute(attribute); + } else if (typeof value !== "string" && get_setters(element2).includes(attribute)) { + element2[attribute] = value; + } else { + element2.setAttribute(attribute, value); + } +} +function set_attributes(element2, prev, next2, css_hash, skip_warning = false) { + var _a3; + var attributes = get_attributes(element2); + var is_custom_element = attributes[IS_CUSTOM_ELEMENT]; + var preserve_attribute_case = !attributes[IS_HTML]; + let is_hydrating_custom_element = hydrating && is_custom_element; + if (is_hydrating_custom_element) { + set_hydrating(false); + } + var current = prev || {}; + var is_option_element = element2.tagName === "OPTION"; + for (var key in prev) { + if (!(key in next2)) { + next2[key] = null; + } + } + if (next2.class) { + next2.class = clsx2(next2.class); + } else if (css_hash || next2[CLASS]) { + next2.class = null; + } + if (next2[STYLE]) { + (_a3 = next2.style) != null ? _a3 : next2.style = null; + } + var setters = get_setters(element2); + for (const key2 in next2) { + let value = next2[key2]; + if (is_option_element && key2 === "value" && value == null) { + element2.value = element2.__value = ""; + current[key2] = value; + continue; + } + if (key2 === "class") { + var is_html = element2.namespaceURI === "http://www.w3.org/1999/xhtml"; + set_class(element2, is_html, value, css_hash, prev == null ? void 0 : prev[CLASS], next2[CLASS]); + current[key2] = value; + current[CLASS] = next2[CLASS]; + continue; + } + if (key2 === "style") { + set_style(element2, value, prev == null ? void 0 : prev[STYLE], next2[STYLE]); + current[key2] = value; + current[STYLE] = next2[STYLE]; + continue; + } + var prev_value = current[key2]; + if (value === prev_value) continue; + current[key2] = value; + var prefix = key2[0] + key2[1]; + if (prefix === "$$") continue; + if (prefix === "on") { + const opts = {}; + const event_handle_key = "$$" + key2; + let event_name = key2.slice(2); + var delegated = is_delegated(event_name); + if (is_capture_event(event_name)) { + event_name = event_name.slice(0, -7); + opts.capture = true; + } + if (!delegated && prev_value) { + if (value != null) continue; + element2.removeEventListener(event_name, current[event_handle_key], opts); + current[event_handle_key] = null; + } + if (value != null) { + if (!delegated) { + let handle = function(evt) { + current[key2].call(this, evt); + }; + current[event_handle_key] = create_event(event_name, element2, handle, opts); + } else { + element2[`__${event_name}`] = value; + delegate([event_name]); + } + } else if (delegated) { + element2[`__${event_name}`] = void 0; + } + } else if (key2 === "style") { + set_attribute(element2, key2, value); + } else if (key2 === "autofocus") { + autofocus( + /** @type {HTMLElement} */ + element2, + Boolean(value) + ); + } else if (!is_custom_element && (key2 === "__value" || key2 === "value" && value != null)) { + element2.value = element2.__value = value; + } else if (key2 === "selected" && is_option_element) { + set_selected( + /** @type {HTMLOptionElement} */ + element2, + value + ); + } else { + var name = key2; + if (!preserve_attribute_case) { + name = normalize_attribute(name); + } + var is_default = name === "defaultValue" || name === "defaultChecked"; + if (value == null && !is_custom_element && !is_default) { + attributes[key2] = null; + if (name === "value" || name === "checked") { + let input = ( + /** @type {HTMLInputElement} */ + element2 + ); + const use_default = prev === void 0; + if (name === "value") { + let previous = input.defaultValue; + input.removeAttribute(name); + input.defaultValue = previous; + input.value = input.__value = use_default ? previous : null; + } else { + let previous = input.defaultChecked; + input.removeAttribute(name); + input.defaultChecked = previous; + input.checked = use_default ? previous : false; + } + } else { + element2.removeAttribute(key2); + } + } else if (is_default || setters.includes(name) && (is_custom_element || typeof value !== "string")) { + element2[name] = value; + } else if (typeof value !== "function") { + set_attribute(element2, name, value, skip_warning); + } + } + } + if (is_hydrating_custom_element) { + set_hydrating(true); + } + return current; +} +function get_attributes(element2) { + var _a3; + return ( + /** @type {Record} **/ + // @ts-expect-error + (_a3 = element2.__attributes) != null ? _a3 : element2.__attributes = { + [IS_CUSTOM_ELEMENT]: element2.nodeName.includes("-"), + [IS_HTML]: element2.namespaceURI === NAMESPACE_HTML + } + ); +} +var setters_cache = /* @__PURE__ */ new Map(); +function get_setters(element2) { + var setters = setters_cache.get(element2.nodeName); + if (setters) return setters; + setters_cache.set(element2.nodeName, setters = []); + var descriptors; + var proto = element2; + var element_proto = Element.prototype; + while (element_proto !== proto) { + descriptors = get_descriptors(proto); + for (var key in descriptors) { + if (descriptors[key].set) { + setters.push(key); + } + } + proto = get_prototype_of(proto); + } + return setters; +} +function check_src_in_dev_hydration(element2, attribute, value) { + var _a3; + if (!dev_fallback_default) return; + if (attribute === "srcset" && srcset_url_equal(element2, value)) return; + if (src_url_equal((_a3 = element2.getAttribute(attribute)) != null ? _a3 : "", value)) return; + hydration_attribute_changed( + attribute, + element2.outerHTML.replace(element2.innerHTML, element2.innerHTML && "..."), + String(value) + ); +} +function src_url_equal(element_src, url) { + if (element_src === url) return true; + return new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href; +} +function split_srcset(srcset) { + return srcset.split(",").map((src) => src.trim().split(" ").filter(Boolean)); +} +function srcset_url_equal(element2, srcset) { + var element_urls = split_srcset(element2.srcset); + var urls = split_srcset(srcset); + return urls.length === element_urls.length && urls.every( + ([url, width], i) => width === element_urls[i][1] && // We need to test both ways because Vite will create an a full URL with + // `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the + // relative URLs inside srcset are not automatically resolved to absolute URLs by + // browsers (in contrast to img.src). This means both SSR and DOM code could + // contain relative or absolute URLs. + (src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0])) + ); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/index-client.js +if (dev_fallback_default) { + let throw_rune_error = function(rune) { + if (!(rune in globalThis)) { + let value; + Object.defineProperty(globalThis, rune, { + configurable: true, + // eslint-disable-next-line getter-return + get: () => { + if (value !== void 0) { + return value; + } + rune_outside_svelte(rune); + }, + set: (v) => { + value = v; + } + }); + } + }; + throw_rune_error("$state"); + throw_rune_error("$effect"); + throw_rune_error("$derived"); + throw_rune_error("$inspect"); + throw_rune_error("$props"); + throw_rune_error("$bindable"); +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/reactivity/store.js +var is_store_binding = false; +var IS_UNMOUNTED = Symbol(); +function capture_store_binding(fn) { + var previous_is_store_binding = is_store_binding; + try { + is_store_binding = false; + return [fn(), is_store_binding]; + } finally { + is_store_binding = previous_is_store_binding; + } +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/reactivity/props.js +var rest_props_handler = { + get(target, key) { + if (target.exclude.includes(key)) return; + return target.props[key]; + }, + set(target, key) { + if (dev_fallback_default) { + props_rest_readonly(`${target.name}.${String(key)}`); + } + return false; + }, + getOwnPropertyDescriptor(target, key) { + if (target.exclude.includes(key)) return; + if (key in target.props) { + return { + enumerable: true, + configurable: true, + value: target.props[key] + }; + } + }, + has(target, key) { + if (target.exclude.includes(key)) return false; + return key in target.props; + }, + ownKeys(target) { + return Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key)); + } +}; +// @__NO_SIDE_EFFECTS__ +function rest_props(props, exclude, name) { + return new Proxy( + dev_fallback_default ? { props, exclude, name, other: {}, to_proxy: [] } : { props, exclude }, + rest_props_handler + ); +} +var spread_props_handler = { + get(target, key) { + let i = target.props.length; + while (i--) { + let p = target.props[i]; + if (is_function(p)) p = p(); + if (typeof p === "object" && p !== null && key in p) return p[key]; + } + }, + set(target, key, value) { + let i = target.props.length; + while (i--) { + let p = target.props[i]; + if (is_function(p)) p = p(); + const desc = get_descriptor(p, key); + if (desc && desc.set) { + desc.set(value); + return true; + } + } + return false; + }, + getOwnPropertyDescriptor(target, key) { + let i = target.props.length; + while (i--) { + let p = target.props[i]; + if (is_function(p)) p = p(); + if (typeof p === "object" && p !== null && key in p) { + const descriptor = get_descriptor(p, key); + if (descriptor && !descriptor.configurable) { + descriptor.configurable = true; + } + return descriptor; + } + } + }, + has(target, key) { + if (key === STATE_SYMBOL || key === LEGACY_PROPS) return false; + for (let p of target.props) { + if (is_function(p)) p = p(); + if (p != null && key in p) return true; + } + return false; + }, + ownKeys(target) { + const keys = []; + for (let p of target.props) { + if (is_function(p)) p = p(); + for (const key in p) { + if (!keys.includes(key)) keys.push(key); + } + } + return keys; + } +}; +function spread_props(...props) { + return new Proxy({ props }, spread_props_handler); +} +function has_destroyed_component_ctx(current_value) { + var _a3, _b3; + return (_b3 = (_a3 = current_value.ctx) == null ? void 0 : _a3.d) != null ? _b3 : false; +} +function prop(props, key, flags, fallback2) { + var _a3, _b3; + var immutable = (flags & PROPS_IS_IMMUTABLE) !== 0; + var runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0; + var bindable = (flags & PROPS_IS_BINDABLE) !== 0; + var lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0; + var is_store_sub = false; + var prop_value; + if (bindable) { + [prop_value, is_store_sub] = capture_store_binding(() => ( + /** @type {V} */ + props[key] + )); + } else { + prop_value = /** @type {V} */ + props[key]; + } + var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props; + var setter = bindable && ((_b3 = (_a3 = get_descriptor(props, key)) == null ? void 0 : _a3.set) != null ? _b3 : is_entry_props && key in props && ((v) => props[key] = v)) || void 0; + var fallback_value = ( + /** @type {V} */ + fallback2 + ); + var fallback_dirty = true; + var fallback_used = false; + var get_fallback = () => { + fallback_used = true; + if (fallback_dirty) { + fallback_dirty = false; + if (lazy) { + fallback_value = untrack( + /** @type {() => V} */ + fallback2 + ); + } else { + fallback_value = /** @type {V} */ + fallback2; + } + } + return fallback_value; + }; + if (prop_value === void 0 && fallback2 !== void 0) { + if (setter && runes) { + props_invalid_value(key); + } + prop_value = get_fallback(); + if (setter) setter(prop_value); + } + var getter; + if (runes) { + getter = () => { + var value = ( + /** @type {V} */ + props[key] + ); + if (value === void 0) return get_fallback(); + fallback_dirty = true; + fallback_used = false; + return value; + }; + } else { + var derived_getter = (immutable ? derived : derived_safe_equal)( + () => ( + /** @type {V} */ + props[key] + ) + ); + derived_getter.f |= LEGACY_DERIVED_PROP; + getter = () => { + var value = get(derived_getter); + if (value !== void 0) fallback_value = /** @type {V} */ + void 0; + return value === void 0 ? fallback_value : value; + }; + } + if ((flags & PROPS_IS_UPDATED) === 0) { + return getter; + } + if (setter) { + var legacy_parent = props.$$legacy; + return function(value, mutation) { + if (arguments.length > 0) { + if (!runes || !mutation || legacy_parent || is_store_sub) { + setter(mutation ? getter() : value); + } + return value; + } else { + return getter(); + } + }; + } + var from_child = false; + var was_from_child = false; + var inner_current_value = mutable_source(prop_value); + var current_value = derived(() => { + var parent_value = getter(); + var child_value = get(inner_current_value); + if (from_child) { + from_child = false; + was_from_child = true; + return child_value; + } + was_from_child = false; + return inner_current_value.v = parent_value; + }); + if (bindable) { + get(current_value); + } + if (!immutable) current_value.equals = safe_equals; + return function(value, mutation) { + if (captured_signals !== null) { + from_child = was_from_child; + getter(); + get(inner_current_value); + } + if (arguments.length > 0) { + const new_value = mutation ? get(current_value) : runes && bindable ? proxy(value) : value; + if (!current_value.equals(new_value)) { + from_child = true; + set(inner_current_value, new_value); + if (fallback_used && fallback_value !== void 0) { + fallback_value = new_value; + } + if (has_destroyed_component_ctx(current_value)) { + return value; + } + untrack(() => get(current_value)); + } + return value; + } + if (has_destroyed_component_ctx(current_value)) { + return current_value.v; + } + return get(current_value); + }; +} + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/legacy/legacy-client.js +function createClassComponent(options) { + return new Svelte4Component(options); +} +var _events, _instance; +var Svelte4Component = class { + /** + * @param {ComponentConstructorOptions & { + * component: any; + * }} options + */ + constructor(options) { + /** @type {any} */ + __privateAdd(this, _events); + /** @type {Record} */ + __privateAdd(this, _instance); + var _a3, _b3; + var sources = /* @__PURE__ */ new Map(); + var add_source = (key, value) => { + var s = mutable_source(value); + sources.set(key, s); + return s; + }; + const props = new Proxy( + { ...options.props || {}, $$events: {} }, + { + get(target, prop2) { + var _a4; + return get((_a4 = sources.get(prop2)) != null ? _a4 : add_source(prop2, Reflect.get(target, prop2))); + }, + has(target, prop2) { + var _a4; + if (prop2 === LEGACY_PROPS) return true; + get((_a4 = sources.get(prop2)) != null ? _a4 : add_source(prop2, Reflect.get(target, prop2))); + return Reflect.has(target, prop2); + }, + set(target, prop2, value) { + var _a4; + set((_a4 = sources.get(prop2)) != null ? _a4 : add_source(prop2, value), value); + return Reflect.set(target, prop2, value); + } + } + ); + __privateSet(this, _instance, (options.hydrate ? hydrate : mount)(options.component, { + target: options.target, + anchor: options.anchor, + props, + context: options.context, + intro: (_a3 = options.intro) != null ? _a3 : false, + recover: options.recover + })); + if (!((_b3 = options == null ? void 0 : options.props) == null ? void 0 : _b3.$$host) || options.sync === false) { + flushSync(); + } + __privateSet(this, _events, props.$$events); + for (const key of Object.keys(__privateGet(this, _instance))) { + if (key === "$set" || key === "$destroy" || key === "$on") continue; + define_property(this, key, { + get() { + return __privateGet(this, _instance)[key]; + }, + /** @param {any} value */ + set(value) { + __privateGet(this, _instance)[key] = value; + }, + enumerable: true + }); + } + __privateGet(this, _instance).$set = /** @param {Record} next */ + (next2) => { + Object.assign(props, next2); + }; + __privateGet(this, _instance).$destroy = () => { + unmount(__privateGet(this, _instance)); + }; + } + /** @param {Record} props */ + $set(props) { + __privateGet(this, _instance).$set(props); + } + /** + * @param {string} event + * @param {(...args: any[]) => any} callback + * @returns {any} + */ + $on(event2, callback) { + __privateGet(this, _events)[event2] = __privateGet(this, _events)[event2] || []; + const cb = (...args) => callback.call(this, ...args); + __privateGet(this, _events)[event2].push(cb); + return () => { + __privateGet(this, _events)[event2] = __privateGet(this, _events)[event2].filter( + /** @param {any} fn */ + (fn) => fn !== cb + ); + }; + } + $destroy() { + __privateGet(this, _instance).$destroy(); + } +}; +_events = new WeakMap(); +_instance = new WeakMap(); + +// node_modules/.pnpm/svelte@5.26.2/node_modules/svelte/src/internal/client/dom/elements/custom-element.js +var SvelteElement; +if (typeof HTMLElement === "function") { + SvelteElement = class extends HTMLElement { + /** + * @param {*} $$componentCtor + * @param {*} $$slots + * @param {*} use_shadow_dom + */ + constructor($$componentCtor, $$slots, use_shadow_dom) { + super(); + /** The Svelte component constructor */ + __publicField(this, "$$ctor"); + /** Slots */ + __publicField(this, "$$s"); + /** @type {any} The Svelte component instance */ + __publicField(this, "$$c"); + /** Whether or not the custom element is connected */ + __publicField(this, "$$cn", false); + /** @type {Record} Component props data */ + __publicField(this, "$$d", {}); + /** `true` if currently in the process of reflecting component props back to attributes */ + __publicField(this, "$$r", false); + /** @type {Record} Props definition (name, reflected, type etc) */ + __publicField(this, "$$p_d", {}); + /** @type {Record} Event listeners */ + __publicField(this, "$$l", {}); + /** @type {Map} Event listener unsubscribe functions */ + __publicField(this, "$$l_u", /* @__PURE__ */ new Map()); + /** @type {any} The managed render effect for reflecting attributes */ + __publicField(this, "$$me"); + this.$$ctor = $$componentCtor; + this.$$s = $$slots; + if (use_shadow_dom) { + this.attachShadow({ mode: "open" }); + } + } + /** + * @param {string} type + * @param {EventListenerOrEventListenerObject} listener + * @param {boolean | AddEventListenerOptions} [options] + */ + addEventListener(type, listener, options) { + this.$$l[type] = this.$$l[type] || []; + this.$$l[type].push(listener); + if (this.$$c) { + const unsub = this.$$c.$on(type, listener); + this.$$l_u.set(listener, unsub); + } + super.addEventListener(type, listener, options); + } + /** + * @param {string} type + * @param {EventListenerOrEventListenerObject} listener + * @param {boolean | AddEventListenerOptions} [options] + */ + removeEventListener(type, listener, options) { + super.removeEventListener(type, listener, options); + if (this.$$c) { + const unsub = this.$$l_u.get(listener); + if (unsub) { + unsub(); + this.$$l_u.delete(listener); + } + } + } + async connectedCallback() { + this.$$cn = true; + if (!this.$$c) { + let create_slot = function(name) { + return (anchor) => { + const slot2 = document.createElement("slot"); + if (name !== "default") slot2.name = name; + append(anchor, slot2); + }; + }; + await Promise.resolve(); + if (!this.$$cn || this.$$c) { + return; + } + const $$slots = {}; + const existing_slots = get_custom_elements_slots(this); + for (const name of this.$$s) { + if (name in existing_slots) { + if (name === "default" && !this.$$d.children) { + this.$$d.children = create_slot(name); + $$slots.default = true; + } else { + $$slots[name] = create_slot(name); + } + } + } + for (const attribute of this.attributes) { + const name = this.$$g_p(attribute.name); + if (!(name in this.$$d)) { + this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp"); + } + } + for (const key in this.$$p_d) { + if (!(key in this.$$d) && this[key] !== void 0) { + this.$$d[key] = this[key]; + delete this[key]; + } + } + this.$$c = createClassComponent({ + component: this.$$ctor, + target: this.shadowRoot || this, + props: { + ...this.$$d, + $$slots, + $$host: this + } + }); + this.$$me = effect_root(() => { + render_effect(() => { + var _a3; + this.$$r = true; + for (const key of object_keys(this.$$c)) { + if (!((_a3 = this.$$p_d[key]) == null ? void 0 : _a3.reflect)) continue; + this.$$d[key] = this.$$c[key]; + const attribute_value = get_custom_element_value( + key, + this.$$d[key], + this.$$p_d, + "toAttribute" + ); + if (attribute_value == null) { + this.removeAttribute(this.$$p_d[key].attribute || key); + } else { + this.setAttribute(this.$$p_d[key].attribute || key, attribute_value); + } + } + this.$$r = false; + }); + }); + for (const type in this.$$l) { + for (const listener of this.$$l[type]) { + const unsub = this.$$c.$on(type, listener); + this.$$l_u.set(listener, unsub); + } + } + this.$$l = {}; + } + } + // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte + // and setting attributes through setAttribute etc, this is helpful + /** + * @param {string} attr + * @param {string} _oldValue + * @param {string} newValue + */ + attributeChangedCallback(attr2, _oldValue, newValue) { + var _a3; + if (this.$$r) return; + attr2 = this.$$g_p(attr2); + this.$$d[attr2] = get_custom_element_value(attr2, newValue, this.$$p_d, "toProp"); + (_a3 = this.$$c) == null ? void 0 : _a3.$set({ [attr2]: this.$$d[attr2] }); + } + disconnectedCallback() { + this.$$cn = false; + Promise.resolve().then(() => { + if (!this.$$cn && this.$$c) { + this.$$c.$destroy(); + this.$$me(); + this.$$c = void 0; + } + }); + } + /** + * @param {string} attribute_name + */ + $$g_p(attribute_name) { + return object_keys(this.$$p_d).find( + (key) => this.$$p_d[key].attribute === attribute_name || !this.$$p_d[key].attribute && key.toLowerCase() === attribute_name + ) || attribute_name; + } + }; +} +function get_custom_element_value(prop2, value, props_definition, transform) { + var _a3; + const type = (_a3 = props_definition[prop2]) == null ? void 0 : _a3.type; + value = type === "Boolean" && typeof value !== "boolean" ? value != null : value; + if (!transform || !props_definition[prop2]) { + return value; + } else if (transform === "toAttribute") { + switch (type) { + case "Object": + case "Array": + return value == null ? null : JSON.stringify(value); + case "Boolean": + return value ? "" : null; + case "Number": + return value == null ? null : value; + default: + return value; + } + } else { + switch (type) { + case "Object": + case "Array": + return value && JSON.parse(value); + case "Boolean": + return value; + // conversion already handled above + case "Number": + return value != null ? +value : value; + default: + return value; + } + } +} +function get_custom_elements_slots(element2) { + const result = {}; + element2.childNodes.forEach((node) => { + result[ + /** @type {Element} node */ + node.slot || "default" + ] = true; + }); + return result; +} + +// node_modules/.pnpm/@lucide+svelte@0.487.0_svelte@5.26.2/node_modules/@lucide/svelte/dist/defaultAttributes.js +var defaultAttributes = { + xmlns: "http://www.w3.org/2000/svg", + width: 24, + height: 24, + viewBox: "0 0 24 24", + fill: "none", + stroke: "currentColor", + "stroke-width": 2, + "stroke-linecap": "round", + "stroke-linejoin": "round" +}; +var defaultAttributes_default = defaultAttributes; + +// node_modules/.pnpm/@lucide+svelte@0.487.0_svelte@5.26.2/node_modules/@lucide/svelte/dist/Icon.svelte +var root = ns_template(``); +function Icon($$anchor, $$props) { + push($$props, true); + const color = prop($$props, "color", 3, "currentColor"), size = prop($$props, "size", 3, 24), strokeWidth = prop($$props, "strokeWidth", 3, 2), absoluteStrokeWidth = prop($$props, "absoluteStrokeWidth", 3, false), iconNode = prop($$props, "iconNode", 19, () => []), props = rest_props($$props, [ + "$$slots", + "$$events", + "$$legacy", + "name", + "color", + "size", + "strokeWidth", + "absoluteStrokeWidth", + "iconNode", + "children" + ]); + var svg = root(); + let attributes; + var node = child(svg); + each(node, 17, iconNode, index, ($$anchor2, $$item) => { + let tag = () => get($$item)[0]; + let attrs = () => get($$item)[1]; + var fragment = comment(); + var node_1 = first_child(fragment); + element(node_1, tag, true, ($$element, $$anchor3) => { + let attributes_1; + template_effect(() => attributes_1 = set_attributes($$element, attributes_1, { ...attrs() })); + }); + append($$anchor2, fragment); + }); + var node_2 = sibling(node); + snippet(node_2, () => { + var _a3; + return (_a3 = $$props.children) != null ? _a3 : noop; + }); + reset(svg); + template_effect( + ($0) => attributes = set_attributes(svg, attributes, { + ...defaultAttributes_default, + ...props, + width: size(), + height: size(), + stroke: color(), + "stroke-width": $0, + class: [ + "lucide-icon lucide", + $$props.name && `lucide-${$$props.name}`, + $$props.class + ] + }), + [ + () => absoluteStrokeWidth() ? Number(strokeWidth()) * 24 / Number(size()) : strokeWidth() + ] + ); + append($$anchor, svg); + pop(); +} + +// node_modules/.pnpm/@lucide+svelte@0.487.0_svelte@5.26.2/node_modules/@lucide/svelte/dist/icons/loader.svelte +function Loader($$anchor, $$props) { + push($$props, true); + let props = rest_props($$props, ["$$slots", "$$events", "$$legacy"]); + const iconNode = [ + ["path", { "d": "M12 2v4" }], + ["path", { "d": "m16.2 7.8 2.9-2.9" }], + ["path", { "d": "M18 12h4" }], + ["path", { "d": "m16.2 16.2 2.9 2.9" }], + ["path", { "d": "M12 18v4" }], + ["path", { "d": "m4.9 19.1 2.9-2.9" }], + ["path", { "d": "M2 12h4" }], + ["path", { "d": "m4.9 4.9 2.9 2.9" }] + ]; + Icon($$anchor, spread_props({ name: "loader" }, () => props, { + iconNode, + children: ($$anchor2, $$slotProps) => { + var fragment_1 = comment(); + var node = first_child(fragment_1); + snippet(node, () => { + var _a3; + return (_a3 = $$props.children) != null ? _a3 : noop; + }); + append($$anchor2, fragment_1); + }, + $$slots: { default: true } + })); + pop(); +} + +// node_modules/.pnpm/@lucide+svelte@0.487.0_svelte@5.26.2/node_modules/@lucide/svelte/dist/icons/square-check-big.svelte +function Square_check_big($$anchor, $$props) { + push($$props, true); + let props = rest_props($$props, ["$$slots", "$$events", "$$legacy"]); + const iconNode = [ + [ + "path", + { + "d": "M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5" + } + ], + ["path", { "d": "m9 11 3 3L22 4" }] + ]; + Icon($$anchor, spread_props({ name: "square-check-big" }, () => props, { + iconNode, + children: ($$anchor2, $$slotProps) => { + var fragment_1 = comment(); + var node = first_child(fragment_1); + snippet(node, () => { + var _a3; + return (_a3 = $$props.children) != null ? _a3 : noop; + }); + append($$anchor2, fragment_1); + }, + $$slots: { default: true } + })); + pop(); +} + +// src/Progress.svelte +var root_1 = template(`
`); +var root2 = template(`
Rendering...
`); +var $$css = { + hash: "svelte-1ynmm81", + code: ".progress.svelte-1ynmm81 {font-size:14px;}" +}; +function Progress($$anchor, $$props) { + push($$props, true); + append_styles($$anchor, $$css); + let renderStates = proxy([]); + function initRenderStates(data) { + data.forEach((param) => { + renderStates.push({ status: 0, filename: param.file.name }); + }); + } + function updateRenderStates(i) { + renderStates[i].status = 1; + } + var div = root2(); + var node = sibling(child(div), 2); + each(node, 17, () => renderStates, index, ($$anchor2, item) => { + var div_1 = root_1(); + var node_1 = child(div_1); + { + var consequent = ($$anchor3) => { + Square_check_big($$anchor3, { size: "14" }); + }; + var alternate = ($$anchor3) => { + Loader($$anchor3, { size: "14" }); + }; + if_block(node_1, ($$render) => { + if (get(item).status) $$render(consequent); + else $$render(alternate, false); + }); + } + var text2 = sibling(node_1); + reset(div_1); + template_effect(() => { + var _a3; + return set_text(text2, ` ${(_a3 = get(item).filename) != null ? _a3 : ""}`); + }); + append($$anchor2, div_1); + }); + reset(div); + append($$anchor, div); + return pop({ initRenderStates, updateRenderStates }); +} + +// node_modules/.pnpm/yocto-queue@1.2.1/node_modules/yocto-queue/index.js +var Node2 = class { + constructor(value) { + __publicField(this, "value"); + __publicField(this, "next"); + this.value = value; + } +}; +var _head, _tail, _size; +var Queue = class { + constructor() { + __privateAdd(this, _head); + __privateAdd(this, _tail); + __privateAdd(this, _size); + this.clear(); + } + enqueue(value) { + const node = new Node2(value); + if (__privateGet(this, _head)) { + __privateGet(this, _tail).next = node; + __privateSet(this, _tail, node); + } else { + __privateSet(this, _head, node); + __privateSet(this, _tail, node); + } + __privateWrapper(this, _size)._++; + } + dequeue() { + const current = __privateGet(this, _head); + if (!current) { + return; + } + __privateSet(this, _head, __privateGet(this, _head).next); + __privateWrapper(this, _size)._--; + return current.value; + } + peek() { + if (!__privateGet(this, _head)) { + return; + } + return __privateGet(this, _head).value; + } + clear() { + __privateSet(this, _head, void 0); + __privateSet(this, _tail, void 0); + __privateSet(this, _size, 0); + } + get size() { + return __privateGet(this, _size); + } + *[Symbol.iterator]() { + let current = __privateGet(this, _head); + while (current) { + yield current.value; + current = current.next; + } + } + *drain() { + while (__privateGet(this, _head)) { + yield this.dequeue(); + } + } +}; +_head = new WeakMap(); +_tail = new WeakMap(); +_size = new WeakMap(); + +// node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js +function pLimit(concurrency) { + validateConcurrency(concurrency); + const queue = new Queue(); + let activeCount = 0; + const resumeNext = () => { + if (activeCount < concurrency && queue.size > 0) { + queue.dequeue()(); + activeCount++; + } + }; + const next2 = () => { + activeCount--; + resumeNext(); + }; + const run2 = async (function_, resolve, arguments_) => { + const result = (async () => function_(...arguments_))(); + resolve(result); + try { + await result; + } catch (e) { + } + next2(); + }; + const enqueue = (function_, resolve, arguments_) => { + new Promise((internalResolve) => { + queue.enqueue(internalResolve); + }).then( + run2.bind(void 0, function_, resolve, arguments_) + ); + (async () => { + await Promise.resolve(); + if (activeCount < concurrency) { + resumeNext(); + } + })(); + }; + const generator = (function_, ...arguments_) => new Promise((resolve) => { + enqueue(function_, resolve, arguments_); + }); + Object.defineProperties(generator, { + activeCount: { + get: () => activeCount + }, + pendingCount: { + get: () => queue.size + }, + clearQueue: { + value() { + queue.clear(); + } + }, + concurrency: { + get: () => concurrency, + set(newConcurrency) { + validateConcurrency(newConcurrency); + concurrency = newConcurrency; + queueMicrotask(() => { + while (activeCount < concurrency && queue.size > 0) { + resumeNext(); + } + }); + } + } + }); + return generator; +} +function validateConcurrency(concurrency) { + if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) { + throw new TypeError("Expected `concurrency` to be a number from 1 and up"); + } +} + +// src/modal.ts +function fullWidthButton(button) { + button.buttonEl.setAttribute("style", `margin: "0 auto"; width: -webkit-fill-available`); +} +function setInputWidth(inputEl) { + inputEl.setAttribute("style", `width: 100px;`); +} +var ExportConfigModal = class extends import_obsidian4.Modal { + constructor(plugin, file, multiplePdf) { + var _a3, _b3, _c2, _d, _e; + super(plugin.app); + this.canceled = true; + this.plugin = plugin; + this.file = file; + this.completed = false; + this.i18n = i18n_default.current; + this.docs = []; + this.scale = 0.75; + this.webviews = []; + this.multiplePdf = multiplePdf; + this.config = { + pageSize: "A4", + marginType: "1", + showTitle: (_a3 = plugin.settings.showTitle) != null ? _a3 : true, + open: true, + scale: 100, + landscape: false, + marginTop: "10", + marginBottom: "10", + marginLeft: "10", + marginRight: "10", + displayHeader: (_b3 = plugin.settings.displayHeader) != null ? _b3 : true, + displayFooter: (_c2 = plugin.settings.displayHeader) != null ? _c2 : true, + cssSnippet: "0", + ...(_e = (_d = plugin.settings) == null ? void 0 : _d.prevConfig) != null ? _e : {} + }; + } + getFileCache(file) { + return this.app.metadataCache.getFileCache(file); + } + async getAllFiles() { + const app = this.plugin.app; + const data = []; + const docs = []; + if (this.file instanceof import_obsidian4.TFolder) { + const files = traverseFolder(this.file); + for (const file of files) { + data.push({ + app, + file, + config: this.config + }); + } + } else { + const { doc, frontMatter, file } = await renderMarkdown({ app, file: this.file, config: this.config }); + docs.push({ doc, frontMatter, file }); + if (frontMatter.toc) { + const files = this.parseToc(doc); + for (const item of files) { + data.push({ + app, + file: item.file, + config: this.config, + extra: item + }); + } + } + } + return { data, docs }; + } + async renderFiles(data, docs, cb) { + const concurrency = safeParseInt(this.plugin.settings.concurrency) || 5; + const limit = pLimit(concurrency); + const inputs = data.map( + (param, i) => limit(async () => { + const res = await renderMarkdown(param); + cb == null ? void 0 : cb(i); + return res; + }) + ); + let _docs = [...docs != null ? docs : [], ...await Promise.all(inputs)]; + if (this.file instanceof import_obsidian4.TFile) { + const leaf = this.app.workspace.getLeaf(); + await leaf.openFile(this.file); + } + if (!this.multiplePdf) { + _docs = this.mergeDoc(_docs); + } + this.docs = _docs.map(({ doc, ...rest }) => { + return { ...rest, doc: fixDoc(doc, doc.title) }; + }); + } + parseToc(doc) { + var _a3, _b3; + const cache = this.getFileCache(this.file); + const files = (_b3 = (_a3 = cache == null ? void 0 : cache.links) == null ? void 0 : _a3.map(({ link: link2, displayText }) => { + const id = crypto.randomUUID(); + const elem = doc.querySelector(`a[data-href="${link2}"]`); + if (elem) { + elem.href = `#${id}`; + } + return { + title: displayText, + file: this.app.metadataCache.getFirstLinkpathDest(link2, this.file.path), + id + }; + }).filter((item) => item.file instanceof import_obsidian4.TFile)) != null ? _b3 : []; + return files; + } + mergeDoc(docs) { + const { doc: doc0, frontMatter, file } = docs[0]; + const sections = []; + for (const { doc } of docs) { + const element2 = doc.querySelector(".markdown-preview-view"); + if (element2) { + const section = doc0.createElement("section"); + Array.from(element2.children).forEach((child2) => { + section.appendChild(doc0.importNode(child2, true)); + }); + sections.push(section); + } + } + const root3 = doc0.querySelector(".markdown-preview-view"); + if (root3) { + root3.innerHTML = ""; + } + sections.forEach((section) => { + root3 == null ? void 0 : root3.appendChild(section); + }); + return [{ doc: doc0, frontMatter, file }]; + } + calcPageSize(element2, config) { + var _a3, _b3, _c2; + const { pageSize, pageWidth } = config != null ? config : this.config; + const el = element2 != null ? element2 : this.previewDiv; + const width = (_c2 = (_b3 = (_a3 = PageSize) == null ? void 0 : _a3[pageSize]) == null ? void 0 : _b3[0]) != null ? _c2 : safeParseFloat(pageWidth, 210); + const scale2 = Math.floor(mm2px(width) / el.offsetWidth * 100) / 100; + this.webviews.forEach((wb) => { + wb.style.transform = `scale(${1 / scale2},${1 / scale2})`; + wb.style.width = `calc(${scale2} * 100%)`; + wb.style.height = `calc(${scale2} * 100%)`; + }); + this.scale = scale2; + return scale2; + } + async calcWebviewSize() { + await sleep(500); + this.webviews.forEach(async (e, i) => { + var _a3; + const [width, height] = await e.executeJavaScript("[document.body.offsetWidth, document.body.offsetHeight]"); + const sizeEl = (_a3 = e.parentNode) == null ? void 0 : _a3.querySelector(".print-size"); + if (sizeEl) { + sizeEl.innerHTML = `${width}\xD7${height}px +${px2mm(width)}\xD7${px2mm(height)}mm`; + } + }); + } + async togglePrintSize() { + var _a3; + (_a3 = document.querySelectorAll(".print-size")) == null ? void 0 : _a3.forEach((sizeEl) => { + if (this.config["pageSize"] == "Custom") { + sizeEl.style.visibility = "visible"; + } else { + sizeEl.style.visibility = "hidden"; + } + }); + } + makeWebviewJs(doc) { + return ` + document.body.innerHTML = decodeURIComponent(\`${encodeURIComponent(doc.body.innerHTML)}\`); + document.head.innerHTML = decodeURIComponent(\`${encodeURIComponent(document.head.innerHTML)}\`); + + // Function to recursively decode and replace innerHTML of span.markdown-embed elements + function decodeAndReplaceEmbed(element) { + // Replace the innerHTML with the decoded content + element.innerHTML = decodeURIComponent(element.innerHTML); + // Check if the new content contains further span.markdown-embed elements + const newEmbeds = element.querySelectorAll("span.markdown-embed"); + newEmbeds.forEach(decodeAndReplaceEmbed); + } + + // Start the process with all span.markdown-embed elements in the document + document.querySelectorAll("span.markdown-embed").forEach(decodeAndReplaceEmbed); + + document.body.setAttribute("class", \`${document.body.getAttribute("class")}\`) + document.body.setAttribute("style", \`${document.body.getAttribute("style")}\`) + document.body.addClass("theme-light"); + document.body.removeClass("theme-dark"); + document.title = \`${doc.title}\`; + `; + } + /** + * append webview + * @param e HTMLDivElement + * @param render Rerender or not + */ + async appendWebview(e, doc) { + const webview = createWebview(this.scale); + const preview = e.appendChild(webview); + this.webviews.push(preview); + this.preview = preview; + preview.addEventListener("dom-ready", async (e2) => { + this.completed = true; + getAllStyles().forEach(async (css) => { + await preview.insertCSS(css); + }); + if (this.config.cssSnippet && this.config.cssSnippet != "0") { + try { + const cssSnippet = await fs2.readFile(this.config.cssSnippet, { encoding: "utf8" }); + const printCss = cssSnippet.replaceAll(/@media print\s*{([^}]+)}/g, "$1"); + await preview.insertCSS(printCss); + await preview.insertCSS(cssSnippet); + } catch (error2) { + console.warn(error2); + } + } + await preview.executeJavaScript(this.makeWebviewJs(doc)); + getPatchStyle().forEach(async (css) => { + await preview.insertCSS(css); + }); + }); + } + async appendWebviews(el, render = true) { + var _a3; + el.empty(); + if (render) { + this.svelte = mount(Progress, { + target: el, + props: { + startCount: 5 + } + }); + const { data, docs } = await this.getAllFiles(); + this.svelte.initRenderStates(data); + await this.renderFiles(data, docs, this.svelte.updateRenderStates); + } + el.empty(); + await Promise.all( + (_a3 = this.docs) == null ? void 0 : _a3.map(async ({ doc }, i) => { + if (this.multiplePdf) { + el.createDiv({ + text: `${i + 1}-${doc.title}`, + attr: { class: "filename" } + }); + } + const div = el.createDiv({ attr: { class: "webview-wrapper" } }); + div.createDiv({ attr: { class: "print-size" } }); + await this.appendWebview(div, doc); + }) + ); + await this.calcWebviewSize(); + } + async onOpen() { + var _a3, _b3, _c2; + this.contentEl.empty(); + this.containerEl.style.setProperty("--dialog-width", "60vw"); + this.titleEl.setText("Export to PDF"); + const wrapper = this.contentEl.createDiv({ attr: { id: "better-export-pdf" } }); + const title = (_c2 = (_a3 = this.file) == null ? void 0 : _a3.basename) != null ? _c2 : (_b3 = this.file) == null ? void 0 : _b3.name; + this.previewDiv = wrapper.createDiv({ attr: { class: "pdf-preview" } }, async (el) => { + el.empty(); + const resizeObserver = new ResizeObserver(() => { + this.calcPageSize(el); + }); + resizeObserver.observe(el); + await this.appendWebviews(el); + this.togglePrintSize(); + }); + const contentEl = wrapper.createDiv({ attr: { class: "setting-wrapper" } }); + contentEl.addEventListener("keyup", (event2) => { + if (event2.key === "Enter") { + handleExport(); + } + }); + this.generateForm(contentEl); + const handleExport = async () => { + var _a4, _b4; + this.plugin.settings.prevConfig = this.config; + await this.plugin.saveSettings(); + if (this.config["pageSize"] == "Custom") { + if (!isNumber((_a4 = this.config["pageWidth"]) != null ? _a4 : "") || !isNumber((_b4 = this.config["pageHeight"]) != null ? _b4 : "")) { + alert("When the page size is Custom, the Width/Height cannot be empty."); + return; + } + } + if (this.multiplePdf) { + const outputPath = await getOutputPath(title); + console.log("output:", outputPath); + if (outputPath) { + await Promise.all( + this.webviews.map(async (wb, i) => { + await exportToPDF( + `${outputPath}/${this.docs[i].file.basename}.pdf`, + { ...this.plugin.settings, ...this.config }, + wb, + this.docs[i] + ); + }) + ); + this.close(); + } + } else { + const outputFile = await getOutputFile(title, this.plugin.settings.isTimestamp); + if (outputFile) { + await exportToPDF(outputFile, { ...this.plugin.settings, ...this.config }, this.webviews[0], this.docs[0]); + this.close(); + } + } + }; + new import_obsidian4.Setting(contentEl).setHeading().addButton((button) => { + button.setButtonText("Export").onClick(handleExport); + button.setCta(); + fullWidthButton(button); + }); + new import_obsidian4.Setting(contentEl).setHeading().addButton((button) => { + button.setButtonText("Refresh").onClick(async () => { + await this.appendWebviews(this.previewDiv); + }); + fullWidthButton(button); + }); + const debugEl = new import_obsidian4.Setting(contentEl).setHeading().addButton((button) => { + button.setButtonText("Debug").onClick(async () => { + var _a4; + (_a4 = this.preview) == null ? void 0 : _a4.openDevTools(); + }); + fullWidthButton(button); + }); + debugEl.settingEl.hidden = !this.plugin.settings.debug; + } + generateForm(contentEl) { + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.filenameAsTitle).addToggle( + (toggle) => toggle.setTooltip("Include file name as title").setValue(this.config["showTitle"]).onChange(async (value) => { + this.config["showTitle"] = value; + this.webviews.forEach((wv, i) => { + var _a3, _b3; + wv.executeJavaScript(` + var _title = document.querySelector("h1.__title__"); + if (_title) { + _title.style.display = "${value ? "block" : "none"}"; + } + `); + const _title = (_b3 = (_a3 = this.docs[i]) == null ? void 0 : _a3.doc) == null ? void 0 : _b3.querySelector("h1.__title__"); + if (_title) { + _title.style.display = value ? "block" : "none"; + } + }); + }) + ); + const pageSizes = [ + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6", + "Legal", + "Letter", + "Tabloid", + "Ledger", + "Custom" + ]; + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.pageSize).addDropdown((dropdown) => { + dropdown.addOptions(Object.fromEntries(pageSizes.map((size) => [size, size]))).setValue(this.config.pageSize).onChange(async (value) => { + this.config["pageSize"] = value; + if (value == "Custom") { + sizeEl.settingEl.hidden = false; + } else { + sizeEl.settingEl.hidden = true; + } + this.togglePrintSize(); + this.calcPageSize(); + await this.calcWebviewSize(); + }); + }); + const sizeEl = new import_obsidian4.Setting(contentEl).setName("Width/Height").addText((text2) => { + setInputWidth(text2.inputEl); + text2.setPlaceholder("width").setValue(this.config["pageWidth"]).onChange( + (0, import_obsidian4.debounce)( + async (value) => { + this.config["pageWidth"] = value; + this.calcPageSize(); + await this.calcWebviewSize(); + }, + 500, + true + ) + ); + }).addText((text2) => { + setInputWidth(text2.inputEl); + text2.setPlaceholder("height").setValue(this.config["pageHeight"]).onChange((value) => { + this.config["pageHeight"] = value; + }); + }); + sizeEl.settingEl.hidden = this.config["pageSize"] !== "Custom"; + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.margin).setDesc("The unit is millimeters.").addDropdown((dropdown) => { + dropdown.addOption("0", "None").addOption("1", "Default").addOption("2", "Small").addOption("3", "Custom").setValue(this.config["marginType"]).onChange(async (value) => { + this.config["marginType"] = value; + if (value == "3") { + topEl.settingEl.hidden = false; + btmEl.settingEl.hidden = false; + } else { + topEl.settingEl.hidden = true; + btmEl.settingEl.hidden = true; + } + }); + }); + const topEl = new import_obsidian4.Setting(contentEl).setName("Top/Bottom").addText((text2) => { + setInputWidth(text2.inputEl); + text2.setPlaceholder("margin top").setValue(this.config["marginTop"]).onChange((value) => { + this.config["marginTop"] = value; + }); + }).addText((text2) => { + setInputWidth(text2.inputEl); + text2.setPlaceholder("margin bottom").setValue(this.config["marginBottom"]).onChange((value) => { + this.config["marginBottom"] = value; + }); + }); + topEl.settingEl.hidden = this.config["marginType"] != "3"; + const btmEl = new import_obsidian4.Setting(contentEl).setName("Left/Right").addText((text2) => { + setInputWidth(text2.inputEl); + text2.setPlaceholder("margin left").setValue(this.config["marginLeft"]).onChange((value) => { + this.config["marginLeft"] = value; + }); + }).addText((text2) => { + setInputWidth(text2.inputEl); + text2.setPlaceholder("margin right").setValue(this.config["marginRight"]).onChange((value) => { + this.config["marginRight"] = value; + }); + }); + btmEl.settingEl.hidden = this.config["marginType"] != "3"; + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.downscalePercent).addSlider((slider) => { + slider.setLimits(0, 100, 1).setValue(this.config["scale"]).onChange(async (value) => { + this.config["scale"] = value; + slider.showTooltip(); + }); + }); + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.landscape).addToggle( + (toggle) => toggle.setTooltip("landscape").setValue(this.config["landscape"]).onChange(async (value) => { + this.config["landscape"] = value; + }) + ); + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.displayHeader).addToggle( + (toggle) => toggle.setTooltip("Display header").setValue(this.config["displayHeader"]).onChange(async (value) => { + this.config["displayHeader"] = value; + }) + ); + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.displayFooter).addToggle( + (toggle) => toggle.setTooltip("Display footer").setValue(this.config["displayFooter"]).onChange(async (value) => { + this.config["displayFooter"] = value; + }) + ); + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.openAfterExport).addToggle( + (toggle) => toggle.setTooltip("Open the exported file after exporting.").setValue(this.config["open"]).onChange(async (value) => { + this.config["open"] = value; + }) + ); + const snippets = this.cssSnippets(); + if (Object.keys(snippets).length > 0 && this.plugin.settings.enabledCss) { + new import_obsidian4.Setting(contentEl).setName(this.i18n.exportDialog.cssSnippets).addDropdown((dropdown) => { + dropdown.addOption("0", "Not select").addOptions(snippets).setValue(this.config["cssSnippet"]).onChange(async (value) => { + this.config["cssSnippet"] = value; + await this.appendWebviews(this.previewDiv, false); + }); + }); + } + } + onClose() { + const { contentEl } = this; + contentEl.empty(); + if (this.svelte) { + unmount(this.svelte); + } + } + cssSnippets() { + var _a3, _b3; + const { snippets, enabledSnippets } = (_b3 = (_a3 = this.app) == null ? void 0 : _a3.customCss) != null ? _b3 : {}; + const basePath = this.app.vault.adapter.basePath; + return Object.fromEntries( + snippets == null ? void 0 : snippets.filter((item) => !enabledSnippets.has(item)).map((name) => { + const file = import_path.default.join(basePath, ".obsidian/snippets", name + ".css"); + return [file, name]; + }) + ); + } +}; + +// src/setting.ts +var import_obsidian5 = require("obsidian"); +function setAttributes(element2, attributes) { + for (const key in attributes) { + element2.setAttribute(key, attributes[key]); + } +} +var renderBuyMeACoffeeBadge = (contentEl, width = 175) => { + const linkEl = contentEl.createEl("a", { + href: "https://www.buymeacoffee.com/l1xnan" + }); + const imgEl = linkEl.createEl("img"); + imgEl.src = "https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=nathangeorge&button_colour=6a8696&font_colour=ffffff&font_family=Poppins&outline_colour=000000&coffee_colour=FFDD00"; + imgEl.alt = "Buy me a coffee"; + imgEl.width = width; +}; +var ConfigSettingTab = class extends import_obsidian5.PluginSettingTab { + constructor(app, plugin) { + super(app, plugin); + this.plugin = plugin; + this.i18n = i18n_default.current; + } + display() { + const { containerEl } = this; + containerEl.empty(); + const supportDesc = new DocumentFragment(); + supportDesc.createDiv({ + text: "Support the continued development of this plugin." + }); + new import_obsidian5.Setting(containerEl).setDesc(supportDesc); + renderBuyMeACoffeeBadge(containerEl); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.showTitle).addToggle( + (toggle) => toggle.setTooltip(this.i18n.settings.showTitle).setValue(this.plugin.settings.showTitle).onChange(async (value) => { + this.plugin.settings.showTitle = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.displayHeader).addToggle( + (toggle) => toggle.setTooltip("Display header").setValue(this.plugin.settings.displayHeader).onChange(async (value) => { + this.plugin.settings.displayHeader = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.displayFooter).addToggle( + (toggle) => toggle.setTooltip("Display footer").setValue(this.plugin.settings.displayFooter).onChange(async (value) => { + this.plugin.settings.displayFooter = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.printBackground).setDesc("Whether to print background graphics").addToggle( + (toggle) => toggle.setValue(this.plugin.settings.printBackground).onChange(async (value) => { + this.plugin.settings.printBackground = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian5.Setting(containerEl).setName("Generate tagged PDF").setDesc( + "Whether or not to generate a tagged (accessible) PDF. Defaults to false. As this property is experimental, the generated PDF may not adhere fully to PDF/UA and WCAG standards." + ).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.generateTaggedPDF).onChange(async (value) => { + this.plugin.settings.generateTaggedPDF = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.maxLevel).addDropdown((dropdown) => { + dropdown.addOptions(Object.fromEntries(["1", "2", "3", "4", "5", "6"].map((level) => [level, `h${level}`]))).setValue(this.plugin.settings.maxLevel).onChange(async (value) => { + this.plugin.settings.maxLevel = value; + this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.displayMetadata).setDesc("Add frontMatter(title, author, keywords, subject creator, etc) to pdf metadata").addToggle( + (toggle) => toggle.setValue(this.plugin.settings.displayMetadata).onChange(async (value) => { + this.plugin.settings.displayMetadata = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian5.Setting(containerEl).setName("Advanced").setHeading(); + const headerContentAreaSetting = new import_obsidian5.Setting(containerEl); + headerContentAreaSetting.settingEl.setAttribute("style", "display: grid; grid-template-columns: 1fr;"); + headerContentAreaSetting.setName(this.i18n.settings.headerTemplate).setDesc( + 'HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: date (formatted print date), title (document title), url (document location), pageNumber (current page number) and totalPages (total pages in the document). For example, would generate span containing the title.' + ); + const hederContentArea = new import_obsidian5.TextAreaComponent(headerContentAreaSetting.controlEl); + setAttributes(hederContentArea.inputEl, { + style: "margin-top: 12px; width: 100%; height: 6vh;" + }); + hederContentArea.setValue(this.plugin.settings.headerTemplate).onChange(async (value) => { + this.plugin.settings.headerTemplate = value; + this.plugin.saveSettings(); + }); + const footerContentAreaSetting = new import_obsidian5.Setting(containerEl); + footerContentAreaSetting.settingEl.setAttribute("style", "display: grid; grid-template-columns: 1fr;"); + footerContentAreaSetting.setName(this.i18n.settings.footerTemplate).setDesc("HTML template for the print footer. Should use the same format as the headerTemplate."); + const footerContentArea = new import_obsidian5.TextAreaComponent(footerContentAreaSetting.controlEl); + setAttributes(footerContentArea.inputEl, { + style: "margin-top: 12px; width: 100%; height: 6vh;" + }); + footerContentArea.setValue(this.plugin.settings.footerTemplate).onChange(async (value) => { + this.plugin.settings.footerTemplate = value; + this.plugin.saveSettings(); + }); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.isTimestamp).setDesc("Add timestamp to output file name").addToggle((cb) => { + cb.setValue(this.plugin.settings.isTimestamp).onChange(async (value) => { + this.plugin.settings.isTimestamp = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.enabledCss).setDesc("Select the css snippet that are not enabled").addToggle((cb) => { + cb.setValue(this.plugin.settings.enabledCss).onChange(async (value) => { + this.plugin.settings.enabledCss = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.concurrency).setDesc("Limit the number of concurrent renders").addText((cb) => { + var _a3; + const concurrency = (_a3 = this.plugin.settings) == null ? void 0 : _a3.concurrency; + cb.setValue((concurrency == null ? void 0 : concurrency.length) > 0 ? concurrency : "5").onChange(async (value) => { + this.plugin.settings.concurrency = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName("Debug").setHeading(); + new import_obsidian5.Setting(containerEl).setName(this.i18n.settings.debugMode).setDesc("This is useful for troubleshooting.").addToggle((cb) => { + cb.setValue(this.plugin.settings.debug).onChange(async (value) => { + this.plugin.settings.debug = value; + await this.plugin.saveSettings(); + }); + }); + } +}; + +// src/main.ts +var fs3 = __toESM(require("fs/promises")); +var import_path2 = __toESM(require("path")); +var isDev = false; +var DEFAULT_SETTINGS = { + showTitle: true, + maxLevel: "6", + displayHeader: true, + displayFooter: true, + headerTemplate: `
`, + footerTemplate: `
/
`, + printBackground: false, + generateTaggedPDF: false, + displayMetadata: false, + debug: false, + isTimestamp: false, + enabledCss: false, + concurrency: "5" +}; +var BetterExportPdfPlugin3 = class extends import_obsidian6.Plugin { + constructor(app, manifest) { + super(app, manifest); + this.i18n = i18n_default.current; + } + async onload() { + await this.loadSettings(); + this.registerCommand(); + this.registerSetting(); + this.registerEvents(); + } + registerCommand() { + this.addCommand({ + id: "export-current-file-to-pdf", + name: this.i18n.exportCurrentFile, + checkCallback: (checking) => { + const view = this.app.workspace.getActiveViewOfType(import_obsidian6.MarkdownView); + const file = view == null ? void 0 : view.file; + if (!file) { + return false; + } + if (checking) { + return true; + } + new ExportConfigModal(this, file).open(); + return true; + } + }); + } + registerSetting() { + this.addSettingTab(new ConfigSettingTab(this.app, this)); + } + registerEvents() { + this.registerEvent( + this.app.workspace.on("file-menu", (menu, file) => { + let title = file instanceof import_obsidian6.TFolder ? "Export folder to PDF" : "Better Export PDF"; + if (isDev) { + title = `${title} (dev)`; + } + menu.addItem((item) => { + item.setTitle(title).setIcon("download").setSection("action").onClick(async () => { + new ExportConfigModal(this, file).open(); + }); + }); + }) + ); + this.registerEvent( + this.app.workspace.on("file-menu", (menu, file) => { + if (file instanceof import_obsidian6.TFolder) { + let title = "Export to PDF..."; + if (isDev) { + title = `${title} (dev)`; + } + menu.addItem((item) => { + item.setTitle(title).setIcon("lucide-folder-down").setSection("action"); + const subMenu = item.setSubmenu(); + subMenu.addItem( + (item2) => item2.setTitle("Export each file to PDF").setIcon("lucide-file-stack").onClick(async () => { + new ExportConfigModal(this, file, true).open(); + }) + ); + subMenu.addItem( + (item2) => item2.setTitle("Generate TOC.md file").setIcon("lucide-file-text").onClick(async () => { + await this.generateToc(file); + }) + ); + }); + } + }) + ); + } + async generateToc(root3) { + const basePath = this.app.vault.adapter.basePath; + const toc = import_path2.default.join(basePath, root3.path, "_TOC_.md"); + const content = `--- +toc: true +title: ${root3.name} +--- +`; + await fs3.writeFile(toc, content); + if (root3 instanceof import_obsidian6.TFolder) { + const files = traverseFolder(root3); + for (const file of files) { + if (file.name == "_TOC_.md") { + continue; + } + await fs3.appendFile(toc, `[[${file.path}]] +`); + } + } + } + onunload() { + } + async loadSettings() { + this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); + } + async saveSettings() { + await this.saveData(this.settings); + } + changeConfig() { + var _a3; + const theme = "obsidian" === ((_a3 = this.app.vault) == null ? void 0 : _a3.getConfig("theme")); + if (theme) { + document.body.addClass("theme-light"); + document.body.removeClass("theme-dark"); + } + document.body.removeClass("theme-dark"); + const node = document.body.createDiv("print"); + const reset2 = function() { + node.detach(); + if (theme) { + document.body.removeClass("theme-light"); + document.body.addClass("theme-dark"); + } + }; + node.addEventListener("click", reset2); + const el = document.body.createDiv("print"); + const el2 = el.createDiv("markdown-preview-view markdown-rendered"); + el2.toggleClass("rtl", this.app.vault.getConfig("rightToLeft")); + el2.toggleClass("show-frontmatter", this.app.vault.getConfig("showFrontmatter")); + el2.createEl("h1", { + text: "xxxxx" + // a.basename + }); + } +}; +/*! Bundled license information: + +tslib/tslib.es6.js: + (*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** *) + +@lucide/svelte/dist/defaultAttributes.js: + (** + * @license @lucide/svelte v0.487.0 - ISC + * + * ISC License + * + * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + *) + +@lucide/svelte/dist/icons/loader.svelte: + (** + * @license @lucide/svelte v0.487.0 - ISC + * + * ISC License + * + * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + *) + +@lucide/svelte/dist/icons/square-check-big.svelte: + (** + * @license @lucide/svelte v0.487.0 - ISC + * + * ISC License + * + * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + *) + +@lucide/svelte/dist/icons/index.js: + (** + * @license @lucide/svelte v0.487.0 - ISC + * + * ISC License + * + * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + *) +*/ + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/better-export-pdf/manifest.json b/.obsidian/plugins/better-export-pdf/manifest.json new file mode 100644 index 0000000..dd47ea5 --- /dev/null +++ b/.obsidian/plugins/better-export-pdf/manifest.json @@ -0,0 +1,11 @@ +{ + "id": "better-export-pdf", + "name": "Better Export PDF", + "version": "1.11.0", + "minAppVersion": "0.15.0", + "description": "Export your notes to PDF, support export preview, add bookmarks outline and header/footer.", + "author": "l1xnan", + "authorUrl": "https://github.com/l1xnan", + "fundingUrl": "https://www.buymeacoffee.com/l1xnan", + "isDesktopOnly": true +} diff --git a/.obsidian/plugins/better-export-pdf/styles.css b/.obsidian/plugins/better-export-pdf/styles.css new file mode 100644 index 0000000..be734df --- /dev/null +++ b/.obsidian/plugins/better-export-pdf/styles.css @@ -0,0 +1,67 @@ +#better-export-pdf { + display: flex; + flex-direction: row; + height: 75vh; +} + +#better-export-pdf .pdf-preview { + flex: auto; + position: relative; + display: flex; + flex-direction: column; + overflow-x: hidden; + overflow-y: scroll; + align-content: flex-start; +} + +#better-export-pdf .pdf-preview .webview-wrapper { + position: relative; + height: 100%; + width: 100%; +} + +#better-export-pdf .pdf-preview .print-size { + position: absolute; + right: 8px; + top: 8px; + z-index: 99; + font-size: 0.6rem; + white-space: pre-wrap; + text-align: right; + visibility: hidden; +} + +#better-export-pdf .pdf-preview > div { + flex: 1; + height: 100%; + width: 100%; +} +#better-export-pdf .pdf-preview > div.progress { + flex: none; + height: auto; + width: 100%; + text-align: left; +} + +#better-export-pdf .pdf-preview .filename { + font-size: 0.75rem; + color: var(--color-base-60); +} +#better-export-pdf .pdf-preview .filename:not(:first-child) { + padding-top: calc(var(--p-spacing)); +} + +#better-export-pdf webview { + flex: 1; + height: 100%; + width: 100%; +} + +#better-export-pdf .setting-wrapper { + width: 320px; + margin-left: 16px; +} + +#better-export-pdf .setting-wrapper .setting-item[hidden] { + display: none; +} diff --git a/.obsidian/plugins/longform/data.json b/.obsidian/plugins/longform/data.json new file mode 100644 index 0000000..4718d56 --- /dev/null +++ b/.obsidian/plugins/longform/data.json @@ -0,0 +1,1397 @@ +{ + "version": 3, + "projects": {}, + "selectedDraftVaultPath": "Stories/The Reed Remembers Her/Index.md", + "userScriptFolder": null, + "sessionStorage": "data", + "sessions": [ + { + "start": "2025-08-01T06:45:13.571Z", + "total": 46440, + "drafts": { + "Stories/The Reed Remembers Her/Index.md": { + "total": 0, + "scenes": { + "1.1 Drifting Embers": 0 + } + }, + "Stories/Crown of Blood/Index.md": { + "total": 46440, + "scenes": { + "C1S1 Snow on the towers and siege": 569, + "C1S2 Marcas preparing for the Siege": 444, + "C1S3 - Telaryn talking to her father": 424, + "C1S4 - Telaryn and Alisha": 415, + "C1S5 - The King rides": 777, + "C2S1 - The king is slain": 485, + "C2S2 - The gates are broken": 544, + "C2S3 - Arguing before the court": 1950, + "C3S1 - To the Hall of Kings": 635, + "C3S2 - Alisha refuses to be left behind": 382, + "C3S3 - Whispers in Stone": 412, + "C3S4 - Blood That Binds": 496, + "C3S5 - The Old Gate": 414, + "Interlude - Cinder in the Halls": 492, + "C4S1 - Foothills": 462, + "C4S2 - Steel in Snow": 584, + "C4S3 - The Last Watch": 833, + "C4S4 - The Choice": 795, + "C4S5 - Winter's Edge": 656, + "Interlude - What the Dead Remember": 1147, + "C4.1S1 - The Weight of Survival": 372, + "C4.1S2 - The Broken Garison": 593, + "C4.1S3 - Dreams beneath the ice": 829, + "C4.2S1 - Wounds in Silence": 639, + "C4.2S2 - Glimpse of the Past": 529, + "C4.2S3 - Nightfall Confession": 420, + "C4.2S4 - Foreshadowed Change": 411, + "C4.3S1 - Dust-Laden Past": 620, + "C4.3S2 - Sword of Fireless Flame": 539, + "C4.3S3 - Candle before the forgotten": 321, + "C4.4S1 - Morning Drills": 461, + "C4.4S2 - Ghosts of the Journey": 503, + "C4.4S3 - A Quiet Talk": 492, + "C4.4S4 - Banner in the Wind": 397, + "C4.5S1 - Scouts Return": 349, + "C4.5S2 - Decision atop the Walls": 595, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 466, + "Interlude - The Cold Trail": 440, + "C5S1 - The Veyari": 911, + "C5S2 - The Blood and the Stone": 455, + "C5S3 - What stirs below": 356, + "C6S1 - Erased Histories": 403, + "C6S2 - The Last to Remember": 690, + "C6S3 - The Fregment's Path": 452, + "C6S4 - Embers and Distance": 466, + "C6S4 - Whispers in the nIght": 363, + "C6S5 - The Leaving": 568, + "C7S1 - Transition": 233, + "C7S2 - Movement Reported": 394, + "C7S3 - Trap above the cloudline": 489, + "C7S4 - Avalanche Rite": 753, + "C7S5 - Aftermath": 608, + "C8S1 - Mouth of the Mountain": 442, + "C8S2 - Awaken the Gate": 828, + "C8S3 - Into the Darkness": 752, + "Interlude - The Limits of Discipline": 915, + "C9S1 - Deeper into the Keep": 649, + "C9S2 - Exploring the Keep": 828, + "C9S3 - Blood and Broken Sigil": 586, + "C10S1 - Descent": 486, + "C10S2 - The Whispering Blade": 488, + "C10S3 - Moment of Choice": 447, + "C10S4 - Drawing Ashmire": 407, + "Interlude - Raw Power": 412, + "C11S1 - The Price": 656, + "C11S2 - The Killing": 608, + "C11S3 - The Power": 729, + "C12S1 - She Returns": 1364, + "C12S2 - Aftermath": 512, + "C12S3 - Alishas Gone": 540, + "C12S4 - Now what": 381, + "C13S1 - Return to village": 847, + "C13S2 - Atop the mountai": 682, + "C13S3 - The Debate": 626, + "C13S4 - Bargain with the Storm": 640, + "C13S5 - Conquest of Spirits": 499, + "C13S6 - Reckogning": 463, + "C13S7 - The Banner Rises": 814, + "Epilogue - The Sound Before the Storm": 806 + } + } + } + }, + { + "start": "2025-07-31T15:29:52.407Z", + "total": 0, + "drafts": { + "Stories/The Reed Remembers Her/Index.md": { + "total": 0, + "scenes": { + "1.1 Drifting Embers": 0 + } + }, + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0, + "Epilogue - The Sound Before the Storm": 0 + } + } + } + }, + { + "start": "2025-07-30T04:40:03.359Z", + "total": 0, + "drafts": { + "Stories/The Reed Remembers Her/Index.md": { + "total": 0, + "scenes": { + "1.1 Drifting Embers": 0 + } + }, + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0, + "Epilogue - The Sound Before the Storm": 0 + } + } + } + }, + { + "start": "2025-07-27T06:42:21.682Z", + "total": 0, + "drafts": { + "Stories/The Reed Remembers Her/Index.md": { + "total": 0, + "scenes": { + "1.1 Drifting Embers": 0 + } + }, + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0, + "Epilogue - The Sound Before the Storm": 0 + } + } + } + }, + { + "start": "2025-07-08T19:19:42.848Z", + "total": 10406, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0, + "Epilogue - The Sound Before the Storm": 0 + } + }, + "Stories/The Reed Remembers Her/Index.md": { + "total": 10406, + "scenes": { + "1.1 Drifting Embers": 10406 + } + } + } + }, + { + "start": "2025-06-26T21:09:39.682Z", + "total": 0, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0, + "Epilogue - The Sound Before the Storm": 0 + } + } + } + }, + { + "start": "2025-06-24T21:36:14.219Z", + "total": 0, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0, + "Epilogue - The Sound Before the Storm": 0 + } + } + } + }, + { + "start": "2025-06-20T13:45:07.186Z", + "total": 0, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0, + "Epilogue - The Sound Before the Storm": 0 + } + } + } + }, + { + "start": "2025-06-18T13:37:23.715Z", + "total": 807, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 807, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0, + "Epilogue - The Sound Before the Storm": 807 + } + } + } + }, + { + "start": "2025-06-17T11:35:14.669Z", + "total": 0, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 0, + "C13S1 - Return to village": 0, + "C13S2 - Atop the mountai": 0, + "C13S3 - The Debate": 0, + "C13S4 - Bargain with the Storm": 0, + "C13S5 - Conquest of Spirits": 0, + "C13S6 - Reckogning": 0, + "C13S7 - The Banner Rises": 0 + } + } + } + }, + { + "start": "2025-06-13T22:02:58.993Z", + "total": 4952, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 4952, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 0, + "C8S3 - Into the Darkness": 0, + "Interlude - The Limits of Discipline": 0, + "C9S1 - Deeper into the Keep": 0, + "C9S2 - Exploring the Keep": 0, + "C9S3 - Blood and Broken Sigil": 0, + "C10S1 - Descent": 0, + "C10S2 - The Whispering Blade": 0, + "C10S3 - Moment of Choice": 0, + "C10S4 - Drawing Ashmire": 0, + "Interlude - Raw Power": 0, + "C11S1 - The Price": 0, + "C11S2 - The Killing": 0, + "C11S3 - The Power": 0, + "C12S1 - She Returns": 0, + "C12S2 - Aftermath": 0, + "C12S3 - Alishas Gone": 0, + "C12S4 - Now what": 381, + "C13S1 - Return to village": 847, + "C13S2 - Atop the mountai": 682, + "C13S3 - The Debate": 626, + "C13S4 - Bargain with the Storm": 640, + "C13S5 - Conquest of Spirits": 499, + "C13S6 - Reckogning": 463, + "C13S7 - The Banner Rises": 814 + } + } + } + }, + { + "start": "2025-06-13T07:30:08.957Z", + "total": 11295, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 11295, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 0, + "C6S4 - Whispers in the nIght": 0, + "C6S5 - The Leaving": 0, + "C7S1 - Transition": 0, + "C7S2 - Movement Reported": 0, + "C7S3 - Trap above the cloudline": 0, + "C7S4 - Avalanche Rite": 0, + "C7S5 - Aftermath": 0, + "C8S1 - Mouth of the Mountain": 0, + "C8S2 - Awaken the Gate": 828, + "C8S3 - Into the Darkness": 754, + "Interlude - The Limits of Discipline": 915, + "C9S1 - Deeper into the Keep": 649, + "C9S2 - Exploring the Keep": 867, + "C9S3 - Blood and Broken Sigil": 586, + "C10S1 - Descent": 486, + "C10S2 - The Whispering Blade": 534, + "C10S3 - Moment of Choice": 447, + "C10S4 - Drawing Ashmire": 407, + "Interlude - Raw Power": 412, + "C11S1 - The Price": 656, + "C11S2 - The Killing": 608, + "C11S3 - The Power": 730, + "C12S1 - She Returns": 1364, + "C12S2 - Aftermath": 512, + "C12S3 - Alishas Gone": 540 + } + } + } + }, + { + "start": "2025-06-12T08:43:41.847Z", + "total": 4387, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 4387, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 0, + "C4.1S2 - The Broken Garison": 0, + "C4.1S3 - Dreams beneath the ice": 0, + "C4.2S1 - Wounds in Silence": 0, + "C4.2S2 - Glimpse of the Past": 0, + "C4.2S3 - Nightfall Confession": 0, + "C4.2S4 - Foreshadowed Change": 0, + "C4.3S1 - Dust-Laden Past": 0, + "C4.3S2 - Sword of Fireless Flame": 0, + "C4.3S3 - Candle before the forgotten": 0, + "C4.4S1 - Morning Drills": 0, + "C4.4S2 - Ghosts of the Journey": 0, + "C4.4S3 - A Quiet Talk": 0, + "C4.4S4 - Banner in the Wind": 0, + "C4.5S1 - Scouts Return": 0, + "C4.5S2 - Decision atop the Walls": 0, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 0, + "Interlude - The Cold Trail": 0, + "C5S1 - The Veyari": 0, + "C5S2 - The Blood and the Stone": 0, + "C5S3 - What stirs below": 0, + "C6S1 - Erased Histories": 0, + "C6S2 - The Last to Remember": 0, + "C6S3 - The Fregment's Path": 0, + "C6S4 - Embers and Distance": 466, + "C6S4 - Whispers in the nIght": 363, + "C6S5 - The Leaving": 600, + "C7S1 - Transition": 257, + "C7S2 - Movement Reported": 394, + "C7S3 - Trap above the cloudline": 489, + "C7S4 - Avalanche Rite": 753, + "C7S5 - Aftermath": 623, + "C8S1 - Mouth of the Mountain": 442 + } + } + } + }, + { + "start": "2025-06-11T09:44:57.160Z", + "total": 12268, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 12268, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 0, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 0, + "C4S2 - Steel in Snow": 0, + "C4S3 - The Last Watch": 0, + "C4S4 - The Choice": 0, + "C4S5 - Winter's Edge": 0, + "Interlude - What the Dead Remember": 0, + "C4.1S1 - The Weight of Survival": 372, + "C4.1S2 - The Broken Garison": 594, + "C4.1S3 - Dreams beneath the ice": 834, + "C4.2S1 - Wounds in Silence": 639, + "C4.2S2 - Glimpse of the Past": 529, + "C4.2S3 - Nightfall Confession": 426, + "C4.2S4 - Foreshadowed Change": 421, + "C4.3S1 - Dust-Laden Past": 620, + "C4.3S2 - Sword of Fireless Flame": 539, + "C4.3S3 - Candle before the forgotten": 323, + "C4.4S1 - Morning Drills": 461, + "C4.4S2 - Ghosts of the Journey": 503, + "C4.4S3 - A Quiet Talk": 492, + "C4.4S4 - Banner in the Wind": 397, + "C4.5S1 - Scouts Return": 349, + "C4.5S2 - Decision atop the Walls": 595, + "C4.5S3 - Gathering the Loyals": 0, + "C4.5S4 - The Chosen Few": 466, + "Interlude - The Cold Trail": 441, + "C5S1 - The Veyari": 911, + "C5S2 - The Blood and the Stone": 455, + "C5S3 - What stirs below": 356, + "C6S1 - Erased Histories": 403, + "C6S2 - The Last to Remember": 690, + "C6S3 - The Fregment's Path": 452 + } + } + } + }, + { + "start": "2025-06-10T11:50:27.334Z", + "total": 4891, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 4891, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 0, + "C3S2 - Alisha refuses to be left behind": 0, + "C3S3 - Whispers in Stone": 0, + "C3S4 - Blood That Binds": 0, + "C3S5 - The Old Gate": 414, + "Interlude - Cinder in the Halls": 0, + "C4S1 - Foothills": 462, + "C4S2 - Steel in Snow": 584, + "C4S3 - The Last Watch": 833, + "C4S4 - The Choice": 795, + "C4S5 - Winter's Edge": 656, + "Interlude - What the Dead Remember": 1147 + } + } + } + }, + { + "start": "2025-06-09T21:13:18.466Z", + "total": 2832, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 2832, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0, + "C3S1 - To the Hall of Kings": 635, + "C3S2 - Alisha refuses to be left behind": 382, + "C3S3 - Whispers in Stone": 412, + "C2S4 - Blood That Binds": 496, + "C2S5 - The Old Gate": 414, + "Interlude - Cinder in the Halls": 493 + } + } + } + }, + { + "start": "2025-06-05T00:18:41.801Z", + "total": 0, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": { + "C1S1 Snow on the towers and siege": 0, + "C1S2 Marcas preparing for the Siege": 0, + "C1S3 - Telaryn talking to her father": 0, + "C1S4 - Telaryn and Alisha": 0, + "C1S5 - The King rides": 0, + "C2S1 - The king is slain": 0, + "C2S2 - The gates are broken": 0, + "C2S3 - Arguing before the court": 0 + } + } + } + }, + { + "start": "2025-05-31T20:48:56.813Z", + "total": 5617, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 5617, + "scenes": { + "C1S1 Snow on the towers and siege": 576, + "C1S2 Marcas preparing for the Siege": 445, + "C1S3 - Telaryn talking to her father": 424, + "C1S4 - Telaryn and Alisha": 415, + "C1S5 - The King rides": 778, + "C2S1 - The king is slain": 485, + "C2S2 - The gates are broken": 544, + "C2S3 - Arguing before the court": 1950 + } + } + } + }, + { + "start": "2025-05-30T06:28:18.636Z", + "total": 0, + "drafts": { + "Stories/Crown of Blood/Index.md": { + "total": 0, + "scenes": {} + } + } + } + ], + "showWordCountInStatusBar": true, + "startNewSessionEachDay": true, + "sessionGoal": 500, + "applyGoalTo": "all", + "notifyOnGoal": true, + "countDeletionsForGoal": false, + "keepSessionCount": 30, + "sessionFile": "longform-sessions.json", + "numberScenes": false, + "sceneTemplate": null, + "waitForSync": false, + "fallbackWaitEnabled": true, + "fallbackWaitTime": 5, + "workflows": { + "Default Workflow": { + "name": "Default Workflow", + "description": "A starter workflow. Feel free to edit, rename, or delete it and create your own.", + "steps": [ + { + "id": "strip-frontmatter", + "optionValues": {} + }, + { + "id": "remove-links", + "optionValues": { + "remove-wikilinks": true, + "remove-external-links": true + } + }, + { + "id": "prepend-title", + "optionValues": { + "format": "$3{#} $1", + "separator": "\n\n" + } + }, + { + "id": "concatenate-text", + "optionValues": { + "separator": "\\n\\n---\\n\\n" + } + }, + { + "id": "write-to-note", + "optionValues": { + "target": "manuscript.md", + "open-after": true + } + } + ] + } + } +} \ No newline at end of file diff --git a/.obsidian/plugins/longform/main.js b/.obsidian/plugins/longform/main.js new file mode 100644 index 0000000..5604b62 --- /dev/null +++ b/.obsidian/plugins/longform/main.js @@ -0,0 +1,38670 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ROLLUP +if you want to view the source visit the plugins github repository +*/ + +'use strict'; + +var obsidian = require('obsidian'); + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + +function isObject$8(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} + +var isObject_1 = isObject$8; + +/** Detect free variable `global` from Node.js. */ + +var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; + +var _freeGlobal = freeGlobal$1; + +var freeGlobal = _freeGlobal; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root$9 = freeGlobal || freeSelf || Function('return this')(); + +var _root = root$9; + +var root$8 = _root; + +/** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ +var now$1 = function() { + return root$8.Date.now(); +}; + +var now_1 = now$1; + +/** Used to match a single whitespace character. */ + +var reWhitespace = /\s/; + +/** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ +function trimmedEndIndex$1(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; +} + +var _trimmedEndIndex = trimmedEndIndex$1; + +var trimmedEndIndex = _trimmedEndIndex; + +/** Used to match leading whitespace. */ +var reTrimStart = /^\s+/; + +/** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ +function baseTrim$1(string) { + return string + ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; +} + +var _baseTrim = baseTrim$1; + +var root$7 = _root; + +/** Built-in value references. */ +var Symbol$6 = root$7.Symbol; + +var _Symbol = Symbol$6; + +var Symbol$5 = _Symbol; + +/** Used for built-in method references. */ +var objectProto$d = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$a = objectProto$d.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString$1 = objectProto$d.toString; + +/** Built-in value references. */ +var symToStringTag$1 = Symbol$5 ? Symbol$5.toStringTag : undefined; + +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag$1(value) { + var isOwn = hasOwnProperty$a.call(value, symToStringTag$1), + tag = value[symToStringTag$1]; + + try { + value[symToStringTag$1] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString$1.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag$1] = tag; + } else { + delete value[symToStringTag$1]; + } + } + return result; +} + +var _getRawTag = getRawTag$1; + +/** Used for built-in method references. */ + +var objectProto$c = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto$c.toString; + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString$1(value) { + return nativeObjectToString.call(value); +} + +var _objectToString = objectToString$1; + +var Symbol$4 = _Symbol, + getRawTag = _getRawTag, + objectToString = _objectToString; + +/** `Object#toString` result references. */ +var nullTag = '[object Null]', + undefinedTag = '[object Undefined]'; + +/** Built-in value references. */ +var symToStringTag = Symbol$4 ? Symbol$4.toStringTag : undefined; + +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag$6(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + +var _baseGetTag = baseGetTag$6; + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + +function isObjectLike$7(value) { + return value != null && typeof value == 'object'; +} + +var isObjectLike_1 = isObjectLike$7; + +var baseGetTag$5 = _baseGetTag, + isObjectLike$6 = isObjectLike_1; + +/** `Object#toString` result references. */ +var symbolTag$2 = '[object Symbol]'; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol$4(value) { + return typeof value == 'symbol' || + (isObjectLike$6(value) && baseGetTag$5(value) == symbolTag$2); +} + +var isSymbol_1 = isSymbol$4; + +var baseTrim = _baseTrim, + isObject$7 = isObject_1, + isSymbol$3 = isSymbol_1; + +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber$2(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol$3(value)) { + return NAN; + } + if (isObject$7(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject$7(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = baseTrim(value); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +var toNumber_1 = toNumber$2; + +var isObject$6 = isObject_1, + now = now_1, + toNumber$1 = toNumber_1; + +/** Error message constants. */ +var FUNC_ERROR_TEXT$2 = 'Expected a function'; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax$1 = Math.max, + nativeMin = Math.min; + +/** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ +function debounce$1(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT$2); + } + wait = toNumber$1(wait) || 0; + if (isObject$6(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax$1(toNumber$1(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; +} + +var debounce_1 = debounce$1; + +var toNumber = toNumber_1; + +/** Used as references for various `Number` constants. */ +var INFINITY$2 = 1 / 0, + MAX_INTEGER = 1.7976931348623157e+308; + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite$1(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY$2 || value === -INFINITY$2) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +var toFinite_1 = toFinite$1; + +var toFinite = toFinite_1; + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger$1(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +var toInteger_1 = toInteger$1; + +var toInteger = toInteger_1; + +/** Error message constants. */ +var FUNC_ERROR_TEXT$1 = 'Expected a function'; + +/** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery(element).on('click', _.before(5, addContactToList)); + * // => Allows adding up to 4 contacts to the list. + */ +function before$1(n, func) { + var result; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT$1); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined; + } + return result; + }; +} + +var before_1 = before$1; + +var before = before_1; + +/** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first invocation. The `func` is + * invoked with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // => `createApplication` is invoked once + */ +function once(func) { + return before(2, func); +} + +var once_1 = once; + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ + +var isArray$8 = Array.isArray; + +var isArray_1 = isArray$8; + +var isArray$7 = isArray_1, + isSymbol$2 = isSymbol_1; + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey$1(value, object) { + if (isArray$7(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol$2(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); +} + +var _isKey = isKey$1; + +var baseGetTag$4 = _baseGetTag, + isObject$5 = isObject_1; + +/** `Object#toString` result references. */ +var asyncTag = '[object AsyncFunction]', + funcTag$2 = '[object Function]', + genTag$1 = '[object GeneratorFunction]', + proxyTag = '[object Proxy]'; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction$2(value) { + if (!isObject$5(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag$4(value); + return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag; +} + +var isFunction_1 = isFunction$2; + +var root$6 = _root; + +/** Used to detect overreaching core-js shims. */ +var coreJsData$1 = root$6['__core-js_shared__']; + +var _coreJsData = coreJsData$1; + +var coreJsData = _coreJsData; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked$1(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +var _isMasked = isMasked$1; + +/** Used for built-in method references. */ + +var funcProto$2 = Function.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString$2 = funcProto$2.toString; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ +function toSource$2(func) { + if (func != null) { + try { + return funcToString$2.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +var _toSource = toSource$2; + +var isFunction$1 = isFunction_1, + isMasked = _isMasked, + isObject$4 = isObject_1, + toSource$1 = _toSource; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used for built-in method references. */ +var funcProto$1 = Function.prototype, + objectProto$b = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString$1 = funcProto$1.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty$9 = objectProto$b.hasOwnProperty; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString$1.call(hasOwnProperty$9).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative$1(value) { + if (!isObject$4(value) || isMasked(value)) { + return false; + } + var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource$1(value)); +} + +var _baseIsNative = baseIsNative$1; + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + +function getValue$1(object, key) { + return object == null ? undefined : object[key]; +} + +var _getValue = getValue$1; + +var baseIsNative = _baseIsNative, + getValue = _getValue; + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative$7(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +var _getNative = getNative$7; + +var getNative$6 = _getNative; + +/* Built-in method references that are verified to be native. */ +var nativeCreate$4 = getNative$6(Object, 'create'); + +var _nativeCreate = nativeCreate$4; + +var nativeCreate$3 = _nativeCreate; + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear$1() { + this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {}; + this.size = 0; +} + +var _hashClear = hashClear$1; + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + +function hashDelete$1(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} + +var _hashDelete = hashDelete$1; + +var nativeCreate$2 = _nativeCreate; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; + +/** Used for built-in method references. */ +var objectProto$a = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$8 = objectProto$a.hasOwnProperty; + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet$1(key) { + var data = this.__data__; + if (nativeCreate$2) { + var result = data[key]; + return result === HASH_UNDEFINED$1 ? undefined : result; + } + return hasOwnProperty$8.call(data, key) ? data[key] : undefined; +} + +var _hashGet = hashGet$1; + +var nativeCreate$1 = _nativeCreate; + +/** Used for built-in method references. */ +var objectProto$9 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$7 = objectProto$9.hasOwnProperty; + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas$1(key) { + var data = this.__data__; + return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$7.call(data, key); +} + +var _hashHas = hashHas$1; + +var nativeCreate = _nativeCreate; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet$1(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +var _hashSet = hashSet$1; + +var hashClear = _hashClear, + hashDelete = _hashDelete, + hashGet = _hashGet, + hashHas = _hashHas, + hashSet = _hashSet; + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash$1(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `Hash`. +Hash$1.prototype.clear = hashClear; +Hash$1.prototype['delete'] = hashDelete; +Hash$1.prototype.get = hashGet; +Hash$1.prototype.has = hashHas; +Hash$1.prototype.set = hashSet; + +var _Hash = Hash$1; + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + +function listCacheClear$1() { + this.__data__ = []; + this.size = 0; +} + +var _listCacheClear = listCacheClear$1; + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + +function eq$2(value, other) { + return value === other || (value !== value && other !== other); +} + +var eq_1 = eq$2; + +var eq$1 = eq_1; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf$4(array, key) { + var length = array.length; + while (length--) { + if (eq$1(array[length][0], key)) { + return length; + } + } + return -1; +} + +var _assocIndexOf = assocIndexOf$4; + +var assocIndexOf$3 = _assocIndexOf; + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete$1(key) { + var data = this.__data__, + index = assocIndexOf$3(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; +} + +var _listCacheDelete = listCacheDelete$1; + +var assocIndexOf$2 = _assocIndexOf; + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet$1(key) { + var data = this.__data__, + index = assocIndexOf$2(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +var _listCacheGet = listCacheGet$1; + +var assocIndexOf$1 = _assocIndexOf; + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas$1(key) { + return assocIndexOf$1(this.__data__, key) > -1; +} + +var _listCacheHas = listCacheHas$1; + +var assocIndexOf = _assocIndexOf; + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet$1(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +var _listCacheSet = listCacheSet$1; + +var listCacheClear = _listCacheClear, + listCacheDelete = _listCacheDelete, + listCacheGet = _listCacheGet, + listCacheHas = _listCacheHas, + listCacheSet = _listCacheSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache$4(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `ListCache`. +ListCache$4.prototype.clear = listCacheClear; +ListCache$4.prototype['delete'] = listCacheDelete; +ListCache$4.prototype.get = listCacheGet; +ListCache$4.prototype.has = listCacheHas; +ListCache$4.prototype.set = listCacheSet; + +var _ListCache = ListCache$4; + +var getNative$5 = _getNative, + root$5 = _root; + +/* Built-in method references that are verified to be native. */ +var Map$4 = getNative$5(root$5, 'Map'); + +var _Map = Map$4; + +var Hash = _Hash, + ListCache$3 = _ListCache, + Map$3 = _Map; + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear$1() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map$3 || ListCache$3), + 'string': new Hash + }; +} + +var _mapCacheClear = mapCacheClear$1; + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ + +function isKeyable$1(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +var _isKeyable = isKeyable$1; + +var isKeyable = _isKeyable; + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData$4(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +var _getMapData = getMapData$4; + +var getMapData$3 = _getMapData; + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete$1(key) { + var result = getMapData$3(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; +} + +var _mapCacheDelete = mapCacheDelete$1; + +var getMapData$2 = _getMapData; + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet$1(key) { + return getMapData$2(this, key).get(key); +} + +var _mapCacheGet = mapCacheGet$1; + +var getMapData$1 = _getMapData; + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas$1(key) { + return getMapData$1(this, key).has(key); +} + +var _mapCacheHas = mapCacheHas$1; + +var getMapData = _getMapData; + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet$1(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} + +var _mapCacheSet = mapCacheSet$1; + +var mapCacheClear = _mapCacheClear, + mapCacheDelete = _mapCacheDelete, + mapCacheGet = _mapCacheGet, + mapCacheHas = _mapCacheHas, + mapCacheSet = _mapCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache$2(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `MapCache`. +MapCache$2.prototype.clear = mapCacheClear; +MapCache$2.prototype['delete'] = mapCacheDelete; +MapCache$2.prototype.get = mapCacheGet; +MapCache$2.prototype.has = mapCacheHas; +MapCache$2.prototype.set = mapCacheSet; + +var _MapCache = MapCache$2; + +var MapCache$1 = _MapCache; + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ +function memoize$1(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize$1.Cache || MapCache$1); + return memoized; +} + +// Expose `MapCache`. +memoize$1.Cache = MapCache$1; + +var memoize_1 = memoize$1; + +var memoize = memoize_1; + +/** Used as the maximum memoize cache size. */ +var MAX_MEMOIZE_SIZE = 500; + +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ +function memoizeCapped$1(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; +} + +var _memoizeCapped = memoizeCapped$1; + +var memoizeCapped = _memoizeCapped; + +/** Used to match property names within property paths. */ +var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ +var stringToPath$1 = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +}); + +var _stringToPath = stringToPath$1; + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + +function arrayMap$2(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +var _arrayMap = arrayMap$2; + +var Symbol$3 = _Symbol, + arrayMap$1 = _arrayMap, + isArray$6 = isArray_1, + isSymbol$1 = isSymbol_1; + +/** Used as references for various `Number` constants. */ +var INFINITY$1 = 1 / 0; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto$1 = Symbol$3 ? Symbol$3.prototype : undefined, + symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString$1(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray$6(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap$1(value, baseToString$1) + ''; + } + if (isSymbol$1(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result; +} + +var _baseToString = baseToString$1; + +var baseToString = _baseToString; + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString$1(value) { + return value == null ? '' : baseToString(value); +} + +var toString_1 = toString$1; + +var isArray$5 = isArray_1, + isKey = _isKey, + stringToPath = _stringToPath, + toString = toString_1; + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ +function castPath$6(value, object) { + if (isArray$5(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); +} + +var _castPath = castPath$6; + +var isSymbol = isSymbol_1; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ +function toKey$4(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +var _toKey = toKey$4; + +var castPath$5 = _castPath, + toKey$3 = _toKey; + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet$2(object, path) { + path = castPath$5(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey$3(path[index++])]; + } + return (index && index == length) ? object : undefined; +} + +var _baseGet = baseGet$2; + +var getNative$4 = _getNative; + +var defineProperty$2 = (function() { + try { + var func = getNative$4(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}()); + +var _defineProperty$1 = defineProperty$2; + +var defineProperty$1 = _defineProperty$1; + +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue$2(object, key, value) { + if (key == '__proto__' && defineProperty$1) { + defineProperty$1(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +var _baseAssignValue = baseAssignValue$2; + +var baseAssignValue$1 = _baseAssignValue, + eq = eq_1; + +/** Used for built-in method references. */ +var objectProto$8 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$6 = objectProto$8.hasOwnProperty; + +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue$3(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty$6.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue$1(object, key, value); + } +} + +var _assignValue = assignValue$3; + +/** Used as references for various `Number` constants. */ + +var MAX_SAFE_INTEGER$1 = 9007199254740991; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex$3(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER$1 : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); +} + +var _isIndex = isIndex$3; + +var assignValue$2 = _assignValue, + castPath$4 = _castPath, + isIndex$2 = _isIndex, + isObject$3 = isObject_1, + toKey$2 = _toKey; + +/** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ +function baseSet$1(object, path, value, customizer) { + if (!isObject$3(object)) { + return object; + } + path = castPath$4(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey$2(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject$3(objValue) + ? objValue + : (isIndex$2(path[index + 1]) ? [] : {}); + } + } + assignValue$2(nested, key, newValue); + nested = nested[key]; + } + return object; +} + +var _baseSet = baseSet$1; + +var baseGet$1 = _baseGet, + baseSet = _baseSet, + castPath$3 = _castPath; + +/** + * The base implementation of `_.pickBy` without support for iteratee shorthands. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @param {Function} predicate The function invoked per property. + * @returns {Object} Returns the new object. + */ +function basePickBy$1(object, paths, predicate) { + var index = -1, + length = paths.length, + result = {}; + + while (++index < length) { + var path = paths[index], + value = baseGet$1(object, path); + + if (predicate(value, path)) { + baseSet(result, castPath$3(path, object), value); + } + } + return result; +} + +var _basePickBy = basePickBy$1; + +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + +function baseHasIn$1(object, key) { + return object != null && key in Object(object); +} + +var _baseHasIn = baseHasIn$1; + +var baseGetTag$3 = _baseGetTag, + isObjectLike$5 = isObjectLike_1; + +/** `Object#toString` result references. */ +var argsTag$2 = '[object Arguments]'; + +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments$1(value) { + return isObjectLike$5(value) && baseGetTag$3(value) == argsTag$2; +} + +var _baseIsArguments = baseIsArguments$1; + +var baseIsArguments = _baseIsArguments, + isObjectLike$4 = isObjectLike_1; + +/** Used for built-in method references. */ +var objectProto$7 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$5 = objectProto$7.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable; + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments$3 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike$4(value) && hasOwnProperty$5.call(value, 'callee') && + !propertyIsEnumerable$1.call(value, 'callee'); +}; + +var isArguments_1 = isArguments$3; + +/** Used as references for various `Number` constants. */ + +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength$3(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +var isLength_1 = isLength$3; + +var castPath$2 = _castPath, + isArguments$2 = isArguments_1, + isArray$4 = isArray_1, + isIndex$1 = _isIndex, + isLength$2 = isLength_1, + toKey$1 = _toKey; + +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ +function hasPath$1(object, path, hasFunc) { + path = castPath$2(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey$1(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength$2(length) && isIndex$1(key, length) && + (isArray$4(object) || isArguments$2(object)); +} + +var _hasPath = hasPath$1; + +var baseHasIn = _baseHasIn, + hasPath = _hasPath; + +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ +function hasIn$1(object, path) { + return object != null && hasPath(object, path, baseHasIn); +} + +var hasIn_1 = hasIn$1; + +var basePickBy = _basePickBy, + hasIn = hasIn_1; + +/** + * The base implementation of `_.pick` without support for individual + * property identifiers. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. + */ +function basePick$1(object, paths) { + return basePickBy(object, paths, function(value, path) { + return hasIn(object, path); + }); +} + +var _basePick = basePick$1; + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ + +function arrayPush$3(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} + +var _arrayPush = arrayPush$3; + +var Symbol$2 = _Symbol, + isArguments$1 = isArguments_1, + isArray$3 = isArray_1; + +/** Built-in value references. */ +var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : undefined; + +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable$1(value) { + return isArray$3(value) || isArguments$1(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); +} + +var _isFlattenable = isFlattenable$1; + +var arrayPush$2 = _arrayPush, + isFlattenable = _isFlattenable; + +/** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ +function baseFlatten$1(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten$1(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush$2(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; +} + +var _baseFlatten = baseFlatten$1; + +var baseFlatten = _baseFlatten; + +/** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ +function flatten$1(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; +} + +var flatten_1 = flatten$1; + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + +function apply$1(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +var _apply = apply$1; + +var apply = _apply; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest$1(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} + +var _overRest = overRest$1; + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ + +function constant$1(value) { + return function() { + return value; + }; +} + +var constant_1 = constant$1; + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ + +function identity$1(value) { + return value; +} + +var identity_1 = identity$1; + +var constant = constant_1, + defineProperty = _defineProperty$1, + identity = identity_1; + +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString$1 = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); +}; + +var _baseSetToString = baseSetToString$1; + +/** Used to detect hot functions by number of calls within a span of milliseconds. */ + +var HOT_COUNT = 800, + HOT_SPAN = 16; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeNow = Date.now; + +/** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ +function shortOut$1(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; +} + +var _shortOut = shortOut$1; + +var baseSetToString = _baseSetToString, + shortOut = _shortOut; + +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString$1 = shortOut(baseSetToString); + +var _setToString = setToString$1; + +var flatten = flatten_1, + overRest = _overRest, + setToString = _setToString; + +/** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ +function flatRest$2(func) { + return setToString(overRest(func, undefined, flatten), func + ''); +} + +var _flatRest = flatRest$2; + +var basePick = _basePick, + flatRest$1 = _flatRest; + +/** + * Creates an object composed of the picked `object` properties. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ +var pick = flatRest$1(function(object, paths) { + return object == null ? {} : basePick(object, paths); +}); + +var pick_1 = pick; + +function noop() { } +function assign(tar, src) { + // @ts-ignore + for (const k in src) + tar[k] = src[k]; + return tar; +} +function run(fn) { + return fn(); +} +function blank_object() { + return Object.create(null); +} +function run_all(fns) { + fns.forEach(run); +} +function is_function(thing) { + return typeof thing === 'function'; +} +function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); +} +function is_empty(obj) { + return Object.keys(obj).length === 0; +} +function subscribe(store, ...callbacks) { + if (store == null) { + return noop; + } + const unsub = store.subscribe(...callbacks); + return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; +} +function get_store_value(store) { + let value; + subscribe(store, _ => value = _)(); + return value; +} +function component_subscribe(component, store, callback) { + component.$$.on_destroy.push(subscribe(store, callback)); +} +function create_slot(definition, ctx, $$scope, fn) { + if (definition) { + const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); + return definition[0](slot_ctx); + } +} +function get_slot_context(definition, ctx, $$scope, fn) { + return definition[1] && fn + ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) + : $$scope.ctx; +} +function get_slot_changes(definition, $$scope, dirty, fn) { + if (definition[2] && fn) { + const lets = definition[2](fn(dirty)); + if ($$scope.dirty === undefined) { + return lets; + } + if (typeof lets === 'object') { + const merged = []; + const len = Math.max($$scope.dirty.length, lets.length); + for (let i = 0; i < len; i += 1) { + merged[i] = $$scope.dirty[i] | lets[i]; + } + return merged; + } + return $$scope.dirty | lets; + } + return $$scope.dirty; +} +function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) { + if (slot_changes) { + const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); + slot.p(slot_context, slot_changes); + } +} +function get_all_dirty_from_scope($$scope) { + if ($$scope.ctx.length > 32) { + const dirty = []; + const length = $$scope.ctx.length / 32; + for (let i = 0; i < length; i++) { + dirty[i] = -1; + } + return dirty; + } + return -1; +} +function exclude_internal_props(props) { + const result = {}; + for (const k in props) + if (k[0] !== '$') + result[k] = props[k]; + return result; +} +function null_to_empty(value) { + return value == null ? '' : value; +} +function set_store_value(store, ret, value) { + store.set(value); + return ret; +} +function action_destroyer(action_result) { + return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; +} +function append(target, node) { + target.appendChild(node); +} +function append_styles(target, style_sheet_id, styles) { + const append_styles_to = get_root_for_style(target); + if (!append_styles_to.getElementById(style_sheet_id)) { + const style = element('style'); + style.id = style_sheet_id; + style.textContent = styles; + append_stylesheet(append_styles_to, style); + } +} +function get_root_for_style(node) { + if (!node) + return document; + const root = node.getRootNode ? node.getRootNode() : node.ownerDocument; + if (root && root.host) { + return root; + } + return node.ownerDocument; +} +function append_stylesheet(node, style) { + append(node.head || node, style); +} +function insert(target, node, anchor) { + target.insertBefore(node, anchor || null); +} +function detach(node) { + node.parentNode.removeChild(node); +} +function destroy_each(iterations, detaching) { + for (let i = 0; i < iterations.length; i += 1) { + if (iterations[i]) + iterations[i].d(detaching); + } +} +function element(name) { + return document.createElement(name); +} +function svg_element(name) { + return document.createElementNS('http://www.w3.org/2000/svg', name); +} +function text(data) { + return document.createTextNode(data); +} +function space() { + return text(' '); +} +function empty() { + return text(''); +} +function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return () => node.removeEventListener(event, handler, options); +} +function prevent_default(fn) { + return function (event) { + event.preventDefault(); + // @ts-ignore + return fn.call(this, event); + }; +} +function attr(node, attribute, value) { + if (value == null) + node.removeAttribute(attribute); + else if (node.getAttribute(attribute) !== value) + node.setAttribute(attribute, value); +} +function set_attributes(node, attributes) { + // @ts-ignore + const descriptors = Object.getOwnPropertyDescriptors(node.__proto__); + for (const key in attributes) { + if (attributes[key] == null) { + node.removeAttribute(key); + } + else if (key === 'style') { + node.style.cssText = attributes[key]; + } + else if (key === '__value') { + node.value = node[key] = attributes[key]; + } + else if (descriptors[key] && descriptors[key].set) { + node[key] = attributes[key]; + } + else { + attr(node, key, attributes[key]); + } + } +} +function children(element) { + return Array.from(element.childNodes); +} +function set_data(text, data) { + data = '' + data; + if (text.wholeText !== data) + text.data = data; +} +function set_input_value(input, value) { + input.value = value == null ? '' : value; +} +function set_style(node, key, value, important) { + if (value === null) { + node.style.removeProperty(key); + } + else { + node.style.setProperty(key, value, important ? 'important' : ''); + } +} +function select_option(select, value) { + for (let i = 0; i < select.options.length; i += 1) { + const option = select.options[i]; + if (option.__value === value) { + option.selected = true; + return; + } + } + select.selectedIndex = -1; // no option should be selected +} +function select_value(select) { + const selected_option = select.querySelector(':checked') || select.options[0]; + return selected_option && selected_option.__value; +} +function toggle_class(element, name, toggle) { + element.classList[toggle ? 'add' : 'remove'](name); +} +function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { + const e = document.createEvent('CustomEvent'); + e.initCustomEvent(type, bubbles, cancelable, detail); + return e; +} + +let current_component; +function set_current_component(component) { + current_component = component; +} +function get_current_component() { + if (!current_component) + throw new Error('Function called outside component initialization'); + return current_component; +} +function onMount(fn) { + get_current_component().$$.on_mount.push(fn); +} +function onDestroy(fn) { + get_current_component().$$.on_destroy.push(fn); +} +function createEventDispatcher() { + const component = get_current_component(); + return (type, detail, { cancelable = false } = {}) => { + const callbacks = component.$$.callbacks[type]; + if (callbacks) { + // TODO are there situations where events could be dispatched + // in a server (non-DOM) environment? + const event = custom_event(type, detail, { cancelable }); + callbacks.slice().forEach(fn => { + fn.call(component, event); + }); + return !event.defaultPrevented; + } + return true; + }; +} +function getContext(key) { + return get_current_component().$$.context.get(key); +} +// TODO figure out if we still want to support +// shorthand events, or if we want to implement +// a real bubbling mechanism +function bubble(component, event) { + const callbacks = component.$$.callbacks[event.type]; + if (callbacks) { + // @ts-ignore + callbacks.slice().forEach(fn => fn.call(this, event)); + } +} + +const dirty_components = []; +const binding_callbacks = []; +const render_callbacks = []; +const flush_callbacks = []; +const resolved_promise = Promise.resolve(); +let update_scheduled = false; +function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } +} +function add_render_callback(fn) { + render_callbacks.push(fn); +} +function add_flush_callback(fn) { + flush_callbacks.push(fn); +} +// flush() calls callbacks in this order: +// 1. All beforeUpdate callbacks, in order: parents before children +// 2. All bind:this callbacks, in reverse order: children before parents. +// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT +// for afterUpdates called during the initial onMount, which are called in +// reverse order: children before parents. +// Since callbacks might update component values, which could trigger another +// call to flush(), the following steps guard against this: +// 1. During beforeUpdate, any updated components will be added to the +// dirty_components array and will cause a reentrant call to flush(). Because +// the flush index is kept outside the function, the reentrant call will pick +// up where the earlier call left off and go through all dirty components. The +// current_component value is saved and restored so that the reentrant call will +// not interfere with the "parent" flush() call. +// 2. bind:this callbacks cannot trigger new flush() calls. +// 3. During afterUpdate, any updated components will NOT have their afterUpdate +// callback called a second time; the seen_callbacks set, outside the flush() +// function, guarantees this behavior. +const seen_callbacks = new Set(); +let flushidx = 0; // Do *not* move this inside the flush() function +function flush() { + const saved_component = current_component; + do { + // first, call beforeUpdate functions + // and update components + while (flushidx < dirty_components.length) { + const component = dirty_components[flushidx]; + flushidx++; + set_current_component(component); + update(component.$$); + } + set_current_component(null); + dirty_components.length = 0; + flushidx = 0; + while (binding_callbacks.length) + binding_callbacks.pop()(); + // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + for (let i = 0; i < render_callbacks.length; i += 1) { + const callback = render_callbacks[i]; + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + render_callbacks.length = 0; + } while (dirty_components.length); + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + update_scheduled = false; + seen_callbacks.clear(); + set_current_component(saved_component); +} +function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + const dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } +} +const outroing = new Set(); +let outros; +function group_outros() { + outros = { + r: 0, + c: [], + p: outros // parent group + }; +} +function check_outros() { + if (!outros.r) { + run_all(outros.c); + } + outros = outros.p; +} +function transition_in(block, local) { + if (block && block.i) { + outroing.delete(block); + block.i(local); + } +} +function transition_out(block, local, detach, callback) { + if (block && block.o) { + if (outroing.has(block)) + return; + outroing.add(block); + outros.c.push(() => { + outroing.delete(block); + if (callback) { + if (detach) + block.d(1); + callback(); + } + }); + block.o(local); + } + else if (callback) { + callback(); + } +} +function outro_and_destroy_block(block, lookup) { + transition_out(block, 1, 1, () => { + lookup.delete(block.key); + }); +} +function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) { + let o = old_blocks.length; + let n = list.length; + let i = o; + const old_indexes = {}; + while (i--) + old_indexes[old_blocks[i].key] = i; + const new_blocks = []; + const new_lookup = new Map(); + const deltas = new Map(); + i = n; + while (i--) { + const child_ctx = get_context(ctx, list, i); + const key = get_key(child_ctx); + let block = lookup.get(key); + if (!block) { + block = create_each_block(key, child_ctx); + block.c(); + } + else if (dynamic) { + block.p(child_ctx, dirty); + } + new_lookup.set(key, new_blocks[i] = block); + if (key in old_indexes) + deltas.set(key, Math.abs(i - old_indexes[key])); + } + const will_move = new Set(); + const did_move = new Set(); + function insert(block) { + transition_in(block, 1); + block.m(node, next); + lookup.set(block.key, block); + next = block.first; + n--; + } + while (o && n) { + const new_block = new_blocks[n - 1]; + const old_block = old_blocks[o - 1]; + const new_key = new_block.key; + const old_key = old_block.key; + if (new_block === old_block) { + // do nothing + next = new_block.first; + o--; + n--; + } + else if (!new_lookup.has(old_key)) { + // remove old block + destroy(old_block, lookup); + o--; + } + else if (!lookup.has(new_key) || will_move.has(new_key)) { + insert(new_block); + } + else if (did_move.has(old_key)) { + o--; + } + else if (deltas.get(new_key) > deltas.get(old_key)) { + did_move.add(new_key); + insert(new_block); + } + else { + will_move.add(old_key); + o--; + } + } + while (o--) { + const old_block = old_blocks[o]; + if (!new_lookup.has(old_block.key)) + destroy(old_block, lookup); + } + while (n) + insert(new_blocks[n - 1]); + return new_blocks; +} + +function get_spread_update(levels, updates) { + const update = {}; + const to_null_out = {}; + const accounted_for = { $$scope: 1 }; + let i = levels.length; + while (i--) { + const o = levels[i]; + const n = updates[i]; + if (n) { + for (const key in o) { + if (!(key in n)) + to_null_out[key] = 1; + } + for (const key in n) { + if (!accounted_for[key]) { + update[key] = n[key]; + accounted_for[key] = 1; + } + } + levels[i] = n; + } + else { + for (const key in o) { + accounted_for[key] = 1; + } + } + } + for (const key in to_null_out) { + if (!(key in update)) + update[key] = undefined; + } + return update; +} + +function bind(component, name, callback) { + const index = component.$$.props[name]; + if (index !== undefined) { + component.$$.bound[index] = callback; + callback(component.$$.ctx[index]); + } +} +function create_component(block) { + block && block.c(); +} +function mount_component(component, target, anchor, customElement) { + const { fragment, on_mount, on_destroy, after_update } = component.$$; + fragment && fragment.m(target, anchor); + if (!customElement) { + // onMount happens before the initial afterUpdate + add_render_callback(() => { + const new_on_destroy = on_mount.map(run).filter(is_function); + if (on_destroy) { + on_destroy.push(...new_on_destroy); + } + else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + component.$$.on_mount = []; + }); + } + after_update.forEach(add_render_callback); +} +function destroy_component(component, detaching) { + const $$ = component.$$; + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); + // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } +} +function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31)); +} +function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) { + const parent_component = current_component; + set_current_component(component); + const $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props, + update: noop, + not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + on_disconnect: [], + before_update: [], + after_update: [], + context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), + // everything else + callbacks: blank_object(), + dirty, + skip_bound: false, + root: options.target || parent_component.$$.root + }; + append_styles && append_styles($$.root); + let ready = false; + $$.ctx = instance + ? instance(component, options.props || {}, (i, ret, ...rest) => { + const value = rest.length ? rest[0] : ret; + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) + $$.bound[i](value); + if (ready) + make_dirty(component, i); + } + return ret; + }) + : []; + $$.update(); + ready = true; + run_all($$.before_update); + // `false` as a special case of no DOM component + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + if (options.target) { + if (options.hydrate) { + const nodes = children(options.target); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } + else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + if (options.intro) + transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor, options.customElement); + flush(); + } + set_current_component(parent_component); +} +/** + * Base class for Svelte components. Used when dev=false. + */ +class SvelteComponent { + $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + $on(type, callback) { + const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); + callbacks.push(callback); + return () => { + const index = callbacks.indexOf(callback); + if (index !== -1) + callbacks.splice(index, 1); + }; + } + $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } +} + +const subscriber_queue = []; +/** + * Creates a `Readable` store that allows reading by subscription. + * @param value initial value + * @param {StartStopNotifier}start start and stop notifications for subscriptions + */ +function readable(value, start) { + return { + subscribe: writable(value, start).subscribe + }; +} +/** + * Create a `Writable` store that allows both updating and reading by subscription. + * @param {*=}value initial value + * @param {StartStopNotifier=}start start and stop notifications for subscriptions + */ +function writable(value, start = noop) { + let stop; + const subscribers = new Set(); + function set(new_value) { + if (safe_not_equal(value, new_value)) { + value = new_value; + if (stop) { // store is ready + const run_queue = !subscriber_queue.length; + for (const subscriber of subscribers) { + subscriber[1](); + subscriber_queue.push(subscriber, value); + } + if (run_queue) { + for (let i = 0; i < subscriber_queue.length; i += 2) { + subscriber_queue[i][0](subscriber_queue[i + 1]); + } + subscriber_queue.length = 0; + } + } + } + } + function update(fn) { + set(fn(value)); + } + function subscribe(run, invalidate = noop) { + const subscriber = [run, invalidate]; + subscribers.add(subscriber); + if (subscribers.size === 1) { + stop = start(set) || noop; + } + run(value); + return () => { + subscribers.delete(subscriber); + if (subscribers.size === 0) { + stop(); + stop = null; + } + }; + } + return { set, update, subscribe }; +} +function derived(stores, fn, initial_value) { + const single = !Array.isArray(stores); + const stores_array = single + ? [stores] + : stores; + const auto = fn.length < 2; + return readable(initial_value, (set) => { + let inited = false; + const values = []; + let pending = 0; + let cleanup = noop; + const sync = () => { + if (pending) { + return; + } + cleanup(); + const result = fn(single ? values[0] : values, set); + if (auto) { + set(result); + } + else { + cleanup = is_function(result) ? result : noop; + } + }; + const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => { + values[i] = value; + pending &= ~(1 << i); + if (inited) { + sync(); + } + }, () => { + pending |= (1 << i); + })); + inited = true; + sync(); + return function stop() { + run_all(unsubscribers); + cleanup(); + }; + }); +} + +function projectFolderPath(draft, vault) { + return vault.getAbstractFileByPath(draft.vaultPath).parent.path; +} +function sceneFolderPath(draft, vault) { + const root = vault.getAbstractFileByPath(draft.vaultPath).parent.path; + return obsidian.normalizePath(`${root}/${draft.sceneFolder}`); +} +function scenePathForFolder(sceneName, folderPath) { + return obsidian.normalizePath(`${folderPath}/${sceneName}.md`); +} +function scenePath(sceneName, draft, vault) { + const sceneFolder = sceneFolderPath(draft, vault); + return scenePathForFolder(sceneName, sceneFolder); +} +function findScene(path, drafts) { + for (const draft of drafts) { + if (draft.format === "scenes") { + const parentPath = draft.vaultPath.split("/").slice(0, -1).join("/"); + if (parentPath !== "" && !parentPath) { + continue; + } + const index = draft.scenes.findIndex((s) => obsidian.normalizePath(`${parentPath}/${draft.sceneFolder}/${s.title}.md`) === + path); + if (index >= 0) { + return { draft, index, currentIndent: draft.scenes[index].indent }; + } + } + } + return null; +} +function draftForPath(path, drafts) { + for (const draft of drafts) { + if (draft.vaultPath === path) { + return draft; + } + else { + const found = findScene(path, drafts); + if (found) { + return found.draft; + } + } + } + return null; +} +function scenePathForLocation(location, path, drafts, vault) { + for (const draft of drafts) { + if (draft.format === "scenes") { + const root = vault.getAbstractFileByPath(draft.vaultPath).parent.path; + const index = draft.scenes.findIndex((s) => obsidian.normalizePath(`${root}/${draft.sceneFolder}/${s.title}.md`) === path); + if (index >= 0) { + if (location.position === "next" && index < draft.scenes.length - 1) { + if (!location.maintainIndent) { + const nextScene = draft.scenes[index + 1]; + return obsidian.normalizePath(`${root}/${draft.sceneFolder}/${nextScene.title}.md`); + } + else { + const indent = draft.scenes[index].indent; + const nextSceneAtIndent = draft.scenes + .slice(index + 1) + .find((s) => s.indent === indent); + if (nextSceneAtIndent) { + return obsidian.normalizePath(`${root}/${draft.sceneFolder}/${nextSceneAtIndent.title}.md`); + } + } + } + else if (location.position === "previous" && index > 0) { + if (!location.maintainIndent) { + const previousScene = draft.scenes[index - 1]; + return obsidian.normalizePath(`${root}/${draft.sceneFolder}/${previousScene.title}.md`); + } + else { + const indent = draft.scenes[index].indent; + const previousSceneAtIndent = draft.scenes + .slice(0, index) + .find((s) => s.indent === indent); + if (previousSceneAtIndent) { + return obsidian.normalizePath(`${root}/${draft.sceneFolder}/${previousSceneAtIndent.title}.md`); + } + } + } + } + } + } + return null; +} + +var lodash = {exports: {}}; + +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +(function (module, exports) { +(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined$1; + + /** Used as the semantic version number. */ + var VERSION = '4.17.21'; + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** Error message constants. */ + var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', + FUNC_ERROR_TEXT = 'Expected a function', + INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** Used to compose bitmasks for function metadata. */ + var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_BOUND_FLAG = 4, + WRAP_CURRY_FLAG = 8, + WRAP_CURRY_RIGHT_FLAG = 16, + WRAP_PARTIAL_FLAG = 32, + WRAP_PARTIAL_RIGHT_FLAG = 64, + WRAP_ARY_FLAG = 128, + WRAP_REARG_FLAG = 256, + WRAP_FLIP_FLAG = 512; + + /** Used as default options for `_.truncate`. */ + var DEFAULT_TRUNC_LENGTH = 30, + DEFAULT_TRUNC_OMISSION = '...'; + + /** Used to detect hot functions by number of calls within a span of milliseconds. */ + var HOT_COUNT = 800, + HOT_SPAN = 16; + + /** Used to indicate the type of lazy iteratees. */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2, + LAZY_WHILE_FLAG = 3; + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + + /** Used as references for the maximum length and index of an array. */ + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + + /** Used to associate wrap methods with their bit flags. */ + var wrapFlags = [ + ['ary', WRAP_ARY_FLAG], + ['bind', WRAP_BIND_FLAG], + ['bindKey', WRAP_BIND_KEY_FLAG], + ['curry', WRAP_CURRY_FLAG], + ['curryRight', WRAP_CURRY_RIGHT_FLAG], + ['flip', WRAP_FLIP_FLAG], + ['partial', WRAP_PARTIAL_FLAG], + ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], + ['rearg', WRAP_REARG_FLAG] + ]; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + domExcTag = '[object DOMException]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]', + weakSetTag = '[object WeakSet]'; + + var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + + /** Used to match empty string literals in compiled template source. */ + var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + + /** Used to match HTML entities and HTML characters. */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reUnescapedHtml = /[&<>"']/g, + reHasEscapedHtml = RegExp(reEscapedHtml.source), + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + + /** Used to match template delimiters. */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); + + /** Used to match leading whitespace. */ + var reTrimStart = /^\s+/; + + /** Used to match a single whitespace character. */ + var reWhitespace = /\s/; + + /** Used to match wrap detail comments. */ + var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + + /** Used to match words composed of alphanumeric characters. */ + var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + + /** + * Used to validate the `validate` option in `_.template` variable. + * + * Forbids characters which could potentially change the meaning of the function argument definition: + * - "()," (modification of function parameters) + * - "=" (default value) + * - "[]{}" (destructuring of function parameters) + * - "/" (beginning of a comment) + * - whitespace + */ + var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). + */ + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** Used to match Latin Unicode letters (excluding mathematical operators). */ + var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + + /** Used to ensure capturing order of template delimiters. */ + var reNoMatch = /($^)/; + + /** Used to match unescaped characters in compiled string literals. */ + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + + /** Used to compose unicode character classes. */ + var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + + /** Used to compose unicode capture groups. */ + var rsApos = "['\u2019]", + rsAstral = '[' + rsAstralRange + ']', + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + + /** Used to compose unicode regexes. */ + var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', + rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', + rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + + /** Used to match apostrophes. */ + var reApos = RegExp(rsApos, 'g'); + + /** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ + var reComboMark = RegExp(rsCombo, 'g'); + + /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ + var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + + /** Used to match complex or compound words. */ + var reUnicodeWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', + rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, + rsUpper + '+' + rsOptContrUpper, + rsOrdUpper, + rsOrdLower, + rsDigits, + rsEmoji + ].join('|'), 'g'); + + /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ + var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + + /** Used to detect strings that need a more robust regexp to match words. */ + var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + + /** Used to assign default `context` object properties. */ + var contextProps = [ + 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', + 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', + 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', + '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' + ]; + + /** Used to make template sourceURLs easier to identify. */ + var templateCounter = -1; + + /** Used to identify `toStringTag` values of typed arrays. */ + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; + + /** Used to identify `toStringTag` values supported by `_.clone`. */ + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = cloneableTags[funcTag] = + cloneableTags[weakMapTag] = false; + + /** Used to map Latin Unicode letters to basic Latin letters. */ + var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 's' + }; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + /** Used to map HTML entities to characters. */ + var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" + }; + + /** Used to escape characters for inclusion in compiled string literals. */ + var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + /** Built-in method references without a dependency on `root`. */ + var freeParseFloat = parseFloat, + freeParseInt = parseInt; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + /** Detect free variable `exports`. */ + var freeExports = exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports; + + /** Detect free variable `process` from Node.js. */ + var freeProcess = moduleExports && freeGlobal.process; + + /** Used to access faster Node.js helpers. */ + var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} + }()); + + /* Node.js helper references. */ + var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, + nodeIsDate = nodeUtil && nodeUtil.isDate, + nodeIsMap = nodeUtil && nodeUtil.isMap, + nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, + nodeIsSet = nodeUtil && nodeUtil.isSet, + nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + + /*--------------------------------------------------------------------------*/ + + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + + /** + * A specialized version of `baseAggregator` for arrays. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + var value = array[index]; + setter(accumulator, value, iteratee(value), array); + } + return accumulator; + } + + /** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEach(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.forEachRight` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEachRight(array, iteratee) { + var length = array == null ? 0 : array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.every` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + */ + function arrayEvery(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; + } + + /** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; + } + + /** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; + } + + /** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + /** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ + function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; + } + + /** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array == null ? 0 : array.length; + + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; + } + + /** + * A specialized version of `_.reduceRight` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduceRight(array, iteratee, accumulator, initAccum) { + var length = array == null ? 0 : array.length; + if (initAccum && length) { + accumulator = array[--length]; + } + while (length--) { + accumulator = iteratee(accumulator, array[length], length, array); + } + return accumulator; + } + + /** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + + /** + * Gets the size of an ASCII `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + var asciiSize = baseProperty('length'); + + /** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function asciiToArray(string) { + return string.split(''); + } + + /** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function asciiWords(string) { + return string.match(reAsciiWord) || []; + } + + /** + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the found element or its key, else `undefined`. + */ + function baseFindKey(collection, predicate, eachFunc) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = key; + return false; + } + }); + return result; + } + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); + } + + /** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ + function baseIsNaN(value) { + return value !== value; + } + + /** + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. + */ + function baseMean(array, iteratee) { + var length = array == null ? 0 : array.length; + return length ? (baseSum(array, iteratee) / length) : NAN; + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined$1 : object[key]; + }; + } + + /** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyOf(object) { + return function(key) { + return object == null ? undefined$1 : object[key]; + }; + } + + /** + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ + function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initAccum + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. + * + * @private + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. + */ + function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; + } + + /** + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ + function baseSum(array, iteratee) { + var result, + index = -1, + length = array.length; + + while (++index < length) { + var current = iteratee(array[index]); + if (current !== undefined$1) { + result = result === undefined$1 ? current : (result + current); + } + } + return result; + } + + /** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ + function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + + /** + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the key-value pairs. + */ + function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); + } + + /** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function baseTrim(string) { + return string + ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; + } + + /** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ + function baseUnary(func) { + return function(value) { + return func(value); + }; + } + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); + } + + /** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function cacheHas(cache, key) { + return cache.has(key); + } + + /** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ + function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ + function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ + function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + ++result; + } + } + return result; + } + + /** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ + var deburrLetter = basePropertyOf(deburredLetters); + + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + var escapeHtmlChar = basePropertyOf(htmlEscapes); + + /** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; + } + + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined$1 : object[key]; + } + + /** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ + function hasUnicode(string) { + return reHasUnicode.test(string); + } + + /** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ + function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); + } + + /** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ + function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; + } + + /** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ + function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; + } + + /** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ + function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; + } + + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; + } + + /** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ + function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = value; + }); + return result; + } + + /** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ + function setToPairs(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; + } + + /** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; + } + + /** + * Gets the number of symbols in `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the string size. + */ + function stringSize(string) { + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); + } + + /** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ + function trimmedEndIndex(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; + } + + /** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ + var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + + /** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + ++result; + } + return result; + } + + /** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function unicodeToArray(string) { + return string.match(reUnicode) || []; + } + + /** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function unicodeWords(string) { + return string.match(reUnicodeWord) || []; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Create a new pristine `lodash` function using the `context` object. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Util + * @param {Object} [context=root] The context object. + * @returns {Function} Returns a new `lodash` function. + * @example + * + * _.mixin({ 'foo': _.constant('foo') }); + * + * var lodash = _.runInContext(); + * lodash.mixin({ 'bar': lodash.constant('bar') }); + * + * _.isFunction(_.foo); + * // => true + * _.isFunction(_.bar); + * // => false + * + * lodash.isFunction(lodash.foo); + * // => false + * lodash.isFunction(lodash.bar); + * // => true + * + * // Create a suped-up `defer` in Node.js. + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + */ + var runInContext = (function runInContext(context) { + context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); + + /** Built-in constructor references. */ + var Array = context.Array, + Date = context.Date, + Error = context.Error, + Function = context.Function, + Math = context.Math, + Object = context.Object, + RegExp = context.RegExp, + String = context.String, + TypeError = context.TypeError; + + /** Used for built-in method references. */ + var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + + /** Used to detect overreaching core-js shims. */ + var coreJsData = context['__core-js_shared__']; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Used to infer the `Object` constructor. */ + var objectCtorString = funcToString.call(Object); + + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = root._; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Built-in value references. */ + var Buffer = moduleExports ? context.Buffer : undefined$1, + Symbol = context.Symbol, + Uint8Array = context.Uint8Array, + allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1, + getPrototype = overArg(Object.getPrototypeOf, Object), + objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined$1, + symIterator = Symbol ? Symbol.iterator : undefined$1, + symToStringTag = Symbol ? Symbol.toStringTag : undefined$1; + + var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }()); + + /** Mocked built-ins. */ + var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, + ctxNow = Date && Date.now !== root.Date.now && Date.now, + ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil, + nativeFloor = Math.floor, + nativeGetSymbols = Object.getOwnPropertySymbols, + nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined$1, + nativeIsFinite = context.isFinite, + nativeJoin = arrayProto.join, + nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max, + nativeMin = Math.min, + nativeNow = Date.now, + nativeParseInt = context.parseInt, + nativeRandom = Math.random, + nativeReverse = arrayProto.reverse; + + /* Built-in method references that are verified to be native. */ + var DataView = getNative(context, 'DataView'), + Map = getNative(context, 'Map'), + Promise = getNative(context, 'Promise'), + Set = getNative(context, 'Set'), + WeakMap = getNative(context, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); + + /** Used to store function metadata. */ + var metaMap = WeakMap && new WeakMap; + + /** Used to lookup unminified function names. */ + var realNames = {}; + + /** Used to detect maps, sets, and weakmaps. */ + var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = Symbol ? Symbol.prototype : undefined$1, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, + symbolToString = symbolProto ? symbolProto.toString : undefined$1; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps `value` to enable implicit method + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. + * + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. + * + * The execution of chained methods is lazy, that is, it's deferred until + * `_#value` is implicitly or explicitly called. + * + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, + * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, + * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, + * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, + * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, + * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, + * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, + * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, + * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, + * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, + * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, + * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` + * + * @name _ + * @constructor + * @category Seq + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2, 3]); + * + * // Returns an unwrapped value. + * wrapped.reduce(_.add); + * // => 6 + * + * // Returns a wrapped value. + * var squares = wrapped.map(square); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); + } + + /** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. + */ + var baseCreate = (function() { + function object() {} + return function(proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object; + object.prototype = undefined$1; + return result; + }; + }()); + + /** + * The function whose prototype chain sequence wrappers inherit from. + * + * @private + */ + function baseLodash() { + // No operation performed. + } + + /** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable explicit method chain sequences. + */ + function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + this.__index__ = 0; + this.__values__ = undefined$1; + } + + /** + * By default, the template delimiters used by lodash are like those in + * embedded Ruby (ERB) as well as ES2015 template strings. Change the + * following template settings to use alternative delimiters. + * + * @static + * @memberOf _ + * @type {Object} + */ + lodash.templateSettings = { + + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'escape': reEscape, + + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'evaluate': reEvaluate, + + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'interpolate': reInterpolate, + + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type {string} + */ + 'variable': '', + + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type {Object} + */ + 'imports': { + + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type {Function} + */ + '_': lodash + } + }; + + // Ensure wrappers are instances of `baseLodash`. + lodash.prototype = baseLodash.prototype; + lodash.prototype.constructor = lodash; + + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. + * + * @private + * @constructor + * @param {*} value The value to wrap. + */ + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = MAX_ARRAY_LENGTH; + this.__views__ = []; + } + + /** + * Creates a clone of the lazy wrapper object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = copyArray(this.__actions__); + result.__dir__ = this.__dir__; + result.__filtered__ = this.__filtered__; + result.__iteratees__ = copyArray(this.__iteratees__); + result.__takeCount__ = this.__takeCount__; + result.__views__ = copyArray(this.__views__); + return result; + } + + /** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ + function lazyReverse() { + if (this.__filtered__) { + var result = new LazyWrapper(this); + result.__dir__ = -1; + result.__filtered__ = true; + } else { + result = this.clone(); + result.__dir__ *= -1; + } + return result; + } + + /** + * Extracts the unwrapped value from its lazy wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ + function lazyValue() { + var array = this.__wrapped__.value(), + dir = this.__dir__, + isArr = isArray(array), + isRight = dir < 0, + arrLength = isArr ? array.length : 0, + view = getView(0, arrLength, this.__views__), + start = view.start, + end = view.end, + length = end - start, + index = isRight ? end : (start - 1), + iteratees = this.__iteratees__, + iterLength = iteratees.length, + resIndex = 0, + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || (!isRight && arrLength == length && takeCount == length)) { + return baseWrapperValue(array, this.__actions__); + } + var result = []; + + outer: + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + result[resIndex++] = value; + } + return result; + } + + // Ensure `LazyWrapper` is an instance of `baseLodash`. + LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype.constructor = LazyWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; + } + + /** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined$1 : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined$1; + } + + /** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined$1) : hasOwnProperty.call(data, key); + } + + /** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined$1) ? HASH_UNDEFINED : value; + return this; + } + + // Add methods to `Hash`. + Hash.prototype.clear = hashClear; + Hash.prototype['delete'] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + + /** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + + /** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined$1 : data[index][1]; + } + + /** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + + /** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ + function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + + // Add methods to `ListCache`. + ListCache.prototype.clear = listCacheClear; + ListCache.prototype['delete'] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ + function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; + } + + /** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + + /** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + + /** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ + function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; + } + + // Add methods to `MapCache`. + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype['delete'] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ + function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } + } + + /** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; + } + + /** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ + function setCacheHas(value) { + return this.__data__.has(value); + } + + // Add methods to `SetCache`. + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; + } + + /** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ + function stackClear() { + this.__data__ = new ListCache; + this.size = 0; + } + + /** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; + } + + /** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function stackGet(key) { + return this.__data__.get(key); + } + + /** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function stackHas(key) { + return this.__data__.has(key); + } + + /** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ + function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; + } + + // Add methods to `Stack`. + Stack.prototype.clear = stackClear; + Stack.prototype['delete'] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; + } + + /** + * A specialized version of `_.sample` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. + */ + function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined$1; + } + + /** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); + } + + /** + * A specialized version of `_.shuffle` for arrays. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); + } + + /** + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignMergeValue(object, key, value) { + if ((value !== undefined$1 && !eq(object[key], value)) || + (value === undefined$1 && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined$1 && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + + /** + * Aggregates elements of `collection` on `accumulator` with keys transformed + * by `iteratee` and values set by `setter`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function baseAggregator(collection, setter, iteratee, accumulator) { + baseEach(collection, function(value, key, collection) { + setter(accumulator, value, iteratee(value), collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); + } + + /** + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); + } + + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + + /** + * The base implementation of `_.at` without support for individual paths. + * + * @private + * @param {Object} object The object to iterate over. + * @param {string[]} paths The property paths to pick. + * @returns {Array} Returns the picked elements. + */ + function baseAt(object, paths) { + var index = -1, + length = paths.length, + result = Array(length), + skip = object == null; + + while (++index < length) { + result[index] = skip ? undefined$1 : get(object, paths[index]); + } + return result; + } + + /** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ + function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined$1) { + number = number <= upper ? number : upper; + } + if (lower !== undefined$1) { + number = number >= lower ? number : lower; + } + } + return number; + } + + /** + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, bitmask, customizer, key, object, stack) { + var result, + isDeep = bitmask & CLONE_DEEP_FLAG, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + if (customizer) { + result = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result !== undefined$1) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return copyArray(value, result); + } + } else { + var tag = getTag(value), + isFunc = tag == funcTag || tag == genTag; + + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + result = (isFlat || isFunc) ? {} : initCloneObject(value); + if (!isDeep) { + return isFlat + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, isDeep); + } + } + // Check for circular references and return its corresponding clone. + stack || (stack = new Stack); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); + + if (isSet(value)) { + value.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); + } else if (isMap(value)) { + value.forEach(function(subValue, key) { + result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + } + + var keysFunc = isFull + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); + + var props = isArr ? undefined$1 : keysFunc(value); + arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + // Recursively populate clone (susceptible to call stack limits). + assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; + } + + /** + * The base implementation of `_.conforms` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property predicates to conform to. + * @returns {Function} Returns the new spec function. + */ + function baseConforms(source) { + var props = keys(source); + return function(object) { + return baseConformsTo(object, source, props); + }; + } + + /** + * The base implementation of `_.conformsTo` which accepts `props` to check. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + */ + function baseConformsTo(object, source, props) { + var length = props.length; + if (object == null) { + return !length; + } + object = Object(object); + while (length--) { + var key = props[length], + predicate = source[key], + value = object[key]; + + if ((value === undefined$1 && !(key in object)) || !predicate(value)) { + return false; + } + } + return true; + } + + /** + * The base implementation of `_.delay` and `_.defer` which accepts `args` + * to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Array} args The arguments to provide to `func`. + * @returns {number|Object} Returns the timer id or timeout object. + */ + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined$1, args); }, wait); + } + + /** + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + */ + function baseDifference(array, values, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + isCommon = true, + length = array.length, + result = [], + valuesLength = values.length; + + if (!length) { + return result; + } + if (iteratee) { + values = arrayMap(values, baseUnary(iteratee)); + } + if (comparator) { + includes = arrayIncludesWith; + isCommon = false; + } + else if (values.length >= LARGE_ARRAY_SIZE) { + includes = cacheHas; + isCommon = false; + values = new SetCache(values); + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; + } + } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + /** + * The base implementation of `_.forEachRight` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEachRight = createBaseEach(baseForOwnRight, true); + + /** + * The base implementation of `_.every` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ + function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; + } + + /** + * The base implementation of methods like `_.max` and `_.min` which accepts a + * `comparator` to determine the extremum value. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The iteratee invoked per iteration. + * @param {Function} comparator The comparator used to compare values. + * @returns {*} Returns the extremum value. + */ + function baseExtremum(array, iteratee, comparator) { + var index = -1, + length = array.length; + + while (++index < length) { + var value = array[index], + current = iteratee(value); + + if (current != null && (computed === undefined$1 + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { + var computed = current, + result = value; + } + } + return result; + } + + /** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ + function baseFill(array, value, start, end) { + var length = array.length; + + start = toInteger(start); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined$1 || end > length) ? length : toInteger(end); + if (end < 0) { + end += length; + } + end = start > end ? 0 : toLength(end); + while (start < end) { + array[start++] = value; + } + return array; + } + + /** + * The base implementation of `_.filter` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; + } + + /** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; + } + + /** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + /** + * This function is like `baseFor` except that it iterates over properties + * in the opposite order. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseForRight = createBaseFor(true); + + /** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); + } + + /** + * The base implementation of `_.forOwnRight` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwnRight(object, iteratee) { + return object && baseForRight(object, iteratee, keys); + } + + /** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from `props`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the function names. + */ + function baseFunctions(object, props) { + return arrayFilter(props, function(key) { + return isFunction(object[key]); + }); + } + + /** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined$1; + } + + /** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); + } + + /** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + function baseGetTag(value) { + if (value == null) { + return value === undefined$1 ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); + } + + /** + * The base implementation of `_.gt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + */ + function baseGt(value, other) { + return value > other; + } + + /** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); + } + + /** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHasIn(object, key) { + return object != null && key in Object(object); + } + + /** + * The base implementation of `_.inRange` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to check. + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + */ + function baseInRange(number, start, end) { + return number >= nativeMin(start, end) && number < nativeMax(start, end); + } + + /** + * The base implementation of methods like `_.intersection`, without support + * for iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. + */ + function baseIntersection(arrays, iteratee, comparator) { + var includes = comparator ? arrayIncludesWith : arrayIncludes, + length = arrays[0].length, + othLength = arrays.length, + othIndex = othLength, + caches = Array(othLength), + maxLength = Infinity, + result = []; + + while (othIndex--) { + var array = arrays[othIndex]; + if (othIndex && iteratee) { + array = arrayMap(array, baseUnary(iteratee)); + } + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) + ? new SetCache(othIndex && array) + : undefined$1; + } + array = arrays[0]; + + var index = -1, + seen = caches[0]; + + outer: + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) + )) { + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) + ) { + continue outer; + } + } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.invert` and `_.invertBy` which inverts + * `object` with values transformed by `iteratee` and set by `setter`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform values. + * @param {Object} accumulator The initial inverted object. + * @returns {Function} Returns `accumulator`. + */ + function baseInverter(object, setter, iteratee, accumulator) { + baseForOwn(object, function(value, key, object) { + setter(accumulator, iteratee(value), key, object); + }); + return accumulator; + } + + /** + * The base implementation of `_.invoke` without support for individual + * method arguments. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ + function baseInvoke(object, path, args) { + path = castPath(path, object); + object = parent(object, path); + var func = object == null ? object : object[toKey(last(path))]; + return func == null ? undefined$1 : apply(func, object, args); + } + + /** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ + function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; + } + + /** + * The base implementation of `_.isArrayBuffer` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + */ + function baseIsArrayBuffer(value) { + return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; + } + + /** + * The base implementation of `_.isDate` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + */ + function baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; + } + + /** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + } + + /** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag : getTag(object), + othTag = othIsArr ? arrayTag : getTag(other); + + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); + } + + /** + * The base implementation of `_.isMap` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + */ + function baseIsMap(value) { + return isObjectLike(value) && getTag(value) == mapTag; + } + + /** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined$1 && !(key in object)) { + return false; + } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined$1 + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { + return false; + } + } + } + return true; + } + + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + + /** + * The base implementation of `_.isRegExp` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + */ + function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; + } + + /** + * The base implementation of `_.isSet` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + */ + function baseIsSet(value) { + return isObjectLike(value) && getTag(value) == setTag; + } + + /** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ + function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + } + + /** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); + } + + /** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.lt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + */ + function baseLt(value, other) { + return value < other; + } + + /** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + /** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; + } + + /** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined$1 && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; + } + + /** + * The base implementation of `_.merge` without support for multiple sources. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function(srcValue, key) { + stack || (stack = new Stack); + if (isObject(srcValue)) { + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } + else { + var newValue = customizer + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined$1; + + if (newValue === undefined$1) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); + } + + /** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key), + srcValue = safeGet(source, key), + stacked = stack.get(srcValue); + + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined$1; + + var isCommon = newValue === undefined$1; + + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); + + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } + else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } + else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } + else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } + else { + newValue = []; + } + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } + else if (!isObject(objValue) || isFunction(objValue)) { + newValue = initCloneObject(srcValue); + } + } + else { + isCommon = false; + } + } + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); + } + + /** + * The base implementation of `_.nth` which doesn't coerce arguments. + * + * @private + * @param {Array} array The array to query. + * @param {number} n The index of the element to return. + * @returns {*} Returns the nth element of `array`. + */ + function baseNth(array, n) { + var length = array.length; + if (!length) { + return; + } + n += n < 0 ? length : 0; + return isIndex(n, length) ? array[n] : undefined$1; + } + + /** + * The base implementation of `_.orderBy` without param guards. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {string[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ + function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + + var index = -1; + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + + var result = baseMap(collection, function(value, key, collection) { + var criteria = arrayMap(iteratees, function(iteratee) { + return iteratee(value); + }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); + } + + /** + * The base implementation of `_.pick` without support for individual + * property identifiers. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, paths) { + return basePickBy(object, paths, function(value, path) { + return hasIn(object, path); + }); + } + + /** + * The base implementation of `_.pickBy` without support for iteratee shorthands. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @param {Function} predicate The function invoked per property. + * @returns {Object} Returns the new object. + */ + function basePickBy(object, paths, predicate) { + var index = -1, + length = paths.length, + result = {}; + + while (++index < length) { + var path = paths[index], + value = baseGet(object, path); + + if (predicate(value, path)) { + baseSet(result, castPath(path, object), value); + } + } + return result; + } + + /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; + } + + /** + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + */ + function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (array === values) { + values = copyArray(values); + } + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * indexes or capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, + lastIndex = length - 1; + + while (length--) { + var index = indexes[length]; + if (length == lastIndex || index !== previous) { + var previous = index; + if (isIndex(index)) { + splice.call(array, index, 1); + } else { + baseUnset(array, index); + } + } + } + return array; + } + + /** + * The base implementation of `_.random` without support for returning + * floating-point numbers. + * + * @private + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the random number. + */ + function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + } + + /** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ + function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; + } + return result; + } + + /** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ + function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; + } + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); + } + + /** + * The base implementation of `_.sample`. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + */ + function baseSample(collection) { + return arraySample(values(collection)); + } + + /** + * The base implementation of `_.sampleSize` without param guards. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); + } + + /** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined$1; + if (newValue === undefined$1) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; + } + + /** + * The base implementation of `setData` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; + }; + + /** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); + }; + + /** + * The base implementation of `_.shuffle`. + * + * @private + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function baseShuffle(collection) { + return shuffleSelf(values(collection)); + } + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; + } + + /** + * The base implementation of `_.some` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; + } + + /** + * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which + * performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndex(array, value, retHighest) { + var low = 0, + high = array == null ? low : array.length; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if (computed !== null && !isSymbol(computed) && + (retHighest ? (computed <= value) : (computed < value))) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return baseSortedIndexBy(array, value, identity, retHighest); + } + + /** + * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` + * which invokes `iteratee` for `value` and each element of `array` to compute + * their sort ranking. The iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The iteratee invoked per element. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndexBy(array, value, iteratee, retHighest) { + var low = 0, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, + valIsNull = value === null, + valIsSymbol = isSymbol(value), + valIsUndefined = value === undefined$1; + + while (low < high) { + var mid = nativeFloor((low + high) / 2), + computed = iteratee(array[mid]), + othIsDefined = computed !== undefined$1, + othIsNull = computed === null, + othIsReflexive = computed === computed, + othIsSymbol = isSymbol(computed); + + if (valIsNaN) { + var setLow = retHighest || othIsReflexive; + } else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } else if (othIsNull || othIsSymbol) { + setLow = false; + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); + } + + /** + * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseSortedUniq(array, iteratee) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + if (!index || !eq(computed, seen)) { + var seen = computed; + result[resIndex++] = value === 0 ? 0 : value; + } + } + return result; + } + + /** + * The base implementation of `_.toNumber` which doesn't ensure correct + * conversions of binary, hexadecimal, or octal string values. + * + * @private + * @param {*} value The value to process. + * @returns {number} Returns the number. + */ + function baseToNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; + } + + /** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } + else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache; + } + else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.unset`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The property path to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + */ + function baseUnset(object, path) { + path = castPath(path, object); + object = parent(object, path); + return object == null || delete object[toKey(last(path))]; + } + + /** + * The base implementation of `_.update`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); + } + + /** + * The base implementation of methods like `_.dropWhile` and `_.takeWhile` + * without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ + function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && + predicate(array[index], index, array)) {} + + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); + } + + /** + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. + * + * @private + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to perform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ + function baseWrapperValue(value, actions) { + var result = value; + if (result instanceof LazyWrapper) { + result = result.value(); + } + return arrayReduce(actions, function(result, action) { + return action.func.apply(action.thisArg, arrayPush([result], action.args)); + }, result); + } + + /** + * The base implementation of methods like `_.xor`, without support for + * iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. + */ + function baseXor(arrays, iteratee, comparator) { + var length = arrays.length; + if (length < 2) { + return length ? baseUniq(arrays[0]) : []; + } + var index = -1, + result = Array(length); + + while (++index < length) { + var array = arrays[index], + othIndex = -1; + + while (++othIndex < length) { + if (othIndex != index) { + result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); + } + } + } + return baseUniq(baseFlatten(result, 1), iteratee, comparator); + } + + /** + * This base implementation of `_.zipObject` which assigns values using `assignFunc`. + * + * @private + * @param {Array} props The property identifiers. + * @param {Array} values The property values. + * @param {Function} assignFunc The function to assign values. + * @returns {Object} Returns the new object. + */ + function baseZipObject(props, values, assignFunc) { + var index = -1, + length = props.length, + valsLength = values.length, + result = {}; + + while (++index < length) { + var value = index < valsLength ? values[index] : undefined$1; + assignFunc(result, props[index], value); + } + return result; + } + + /** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ + function castArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; + } + + /** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ + function castFunction(value) { + return typeof value == 'function' ? value : identity; + } + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + + /** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + var castRest = baseRest; + + /** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ + function castSlice(array, start, end) { + var length = array.length; + end = end === undefined$1 ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); + } + + /** + * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). + * + * @private + * @param {number|Object} id The timer id or timeout object of the timer to clear. + */ + var clearTimeout = ctxClearTimeout || function(id) { + return root.clearTimeout(id); + }; + + /** + * Creates a clone of `buffer`. + * + * @private + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. + */ + function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, + result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + + buffer.copy(result); + return result; + } + + /** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ + function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + return result; + } + + /** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + + /** + * Creates a clone of `regexp`. + * + * @private + * @param {Object} regexp The regexp to clone. + * @returns {Object} Returns the cloned regexp. + */ + function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + + /** + * Creates a clone of the `symbol` object. + * + * @private + * @param {Object} symbol The symbol object to clone. + * @returns {Object} Returns the cloned symbol object. + */ + function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + } + + /** + * Creates a clone of `typedArray`. + * + * @private + * @param {Object} typedArray The typed array to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned typed array. + */ + function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + + /** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined$1, + valIsNull = value === null, + valIsReflexive = value === value, + valIsSymbol = isSymbol(value); + + var othIsDefined = other !== undefined$1, + othIsNull = other === null, + othIsReflexive = other === other, + othIsSymbol = isSymbol(other); + + if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || + (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || + (valIsNull && othIsDefined && othIsReflexive) || + (!valIsDefined && othIsReflexive) || + !valIsReflexive) { + return 1; + } + if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || + (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || + (othIsNull && valIsDefined && valIsReflexive) || + (!othIsDefined && valIsReflexive) || + !othIsReflexive) { + return -1; + } + } + return 0; + } + + /** + * Used by `_.orderBy` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, + * specify an order of "desc" for descending or "asc" for ascending sort order + * of corresponding values. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {boolean[]|string[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = compareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order = orders[index]; + return result * (order == 'desc' ? -1 : 1); + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; + } + + /** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; + } + + /** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; + } + + /** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ + function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + + /** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ + function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined$1; + + if (newValue === undefined$1) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; + } + + /** + * Copies own symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbols(source, object) { + return copyObject(source, getSymbols(source), object); + } + + /** + * Copies own and inherited symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbolsIn(source, object) { + return copyObject(source, getSymbolsIn(source), object); + } + + /** + * Creates a function like `_.groupBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} [initializer] The accumulator object initializer. + * @returns {Function} Returns the new aggregator function. + */ + function createAggregator(setter, initializer) { + return function(collection, iteratee) { + var func = isArray(collection) ? arrayAggregator : baseAggregator, + accumulator = initializer ? initializer() : {}; + + return func(collection, setter, getIteratee(iteratee, 2), accumulator); + }; + } + + /** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined$1, + guard = length > 2 ? sources[2] : undefined$1; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined$1; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined$1 : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); + } + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + /** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createBind(func, bitmask, thisArg) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; + } + + /** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ + function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = hasUnicode(string) + ? stringToArray(string) + : undefined$1; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; + } + + /** + * Creates a function like `_.camelCase`. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ + function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); + }; + } + + /** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ + function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; + } + + /** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined$1, + args, holders, undefined$1, undefined$1, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; + } + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} findIndexFunc The function to find the collection index. + * @returns {Function} Returns the new find function. + */ + function createFind(findIndexFunc) { + return function(collection, predicate, fromIndex) { + var iterable = Object(collection); + if (!isArrayLike(collection)) { + var iteratee = getIteratee(predicate, 3); + collection = keys(collection); + predicate = function(key) { return iteratee(iterable[key], key, iterable); }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined$1; + }; + } + + /** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ + function createFlow(fromRight) { + return flatRest(function(funcs) { + var length = funcs.length, + index = length, + prereq = LodashWrapper.prototype.thru; + + if (fromRight) { + funcs.reverse(); + } + while (index--) { + var func = funcs[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (prereq && !wrapper && getFuncName(func) == 'wrapper') { + var wrapper = new LodashWrapper([], true); + } + } + index = wrapper ? index : length; + while (++index < length) { + func = funcs[index]; + + var funcName = getFuncName(func), + data = funcName == 'wrapper' ? getData(func) : undefined$1; + + if (data && isLaziable(data[0]) && + data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && + !data[4].length && data[9] == 1 + ) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = (func.length == 1 && isLaziable(func)) + ? wrapper[funcName]() + : wrapper.thru(func); + } + } + return function() { + var args = arguments, + value = args[0]; + + if (wrapper && args.length == 1 && isArray(value)) { + return wrapper.plant(value).value(); + } + var index = 0, + result = length ? funcs[index].apply(this, args) : value; + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }); + } + + /** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & WRAP_ARY_FLAG, + isBind = bitmask & WRAP_BIND_FLAG, + isBindKey = bitmask & WRAP_BIND_KEY_FLAG, + isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), + isFlip = bitmask & WRAP_FLIP_FLAG, + Ctor = isBindKey ? undefined$1 : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; + } + + /** + * Creates a function like `_.invertBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} toIteratee The function to resolve iteratees. + * @returns {Function} Returns the new inverter function. + */ + function createInverter(setter, toIteratee) { + return function(object, iteratee) { + return baseInverter(object, setter, toIteratee(iteratee), {}); + }; + } + + /** + * Creates a function that performs a mathematical operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @param {number} [defaultValue] The value used for `undefined` arguments. + * @returns {Function} Returns the new mathematical operation function. + */ + function createMathOperation(operator, defaultValue) { + return function(value, other) { + var result; + if (value === undefined$1 && other === undefined$1) { + return defaultValue; + } + if (value !== undefined$1) { + result = value; + } + if (other !== undefined$1) { + if (result === undefined$1) { + return other; + } + if (typeof value == 'string' || typeof other == 'string') { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result = operator(value, other); + } + return result; + }; + } + + /** + * Creates a function like `_.over`. + * + * @private + * @param {Function} arrayFunc The function to iterate over iteratees. + * @returns {Function} Returns the new over function. + */ + function createOver(arrayFunc) { + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + return baseRest(function(args) { + var thisArg = this; + return arrayFunc(iteratees, function(iteratee) { + return apply(iteratee, thisArg, args); + }); + }); + }); + } + + /** + * Creates the padding for `string` based on `length`. The `chars` string + * is truncated if the number of characters exceeds `length`. + * + * @private + * @param {number} length The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padding for `string`. + */ + function createPadding(length, chars) { + chars = chars === undefined$1 ? ' ' : baseToString(chars); + + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); + return hasUnicode(chars) + ? castSlice(stringToArray(result), 0, length).join('') + : result.slice(0, length); + } + + /** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ + function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; + } + + /** + * Creates a `_.range` or `_.rangeRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new range function. + */ + function createRange(fromRight) { + return function(start, end, step) { + if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { + end = step = undefined$1; + } + // Ensure the sign of `-0` is preserved. + start = toFinite(start); + if (end === undefined$1) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + step = step === undefined$1 ? (start < end ? 1 : -1) : toFinite(step); + return baseRange(start, end, step, fromRight); + }; + } + + /** + * Creates a function that performs a relational operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @returns {Function} Returns the new relational operation function. + */ + function createRelationalOperation(operator) { + return function(value, other) { + if (!(typeof value == 'string' && typeof other == 'string')) { + value = toNumber(value); + other = toNumber(other); + } + return operator(value, other); + }; + } + + /** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & WRAP_CURRY_FLAG, + newHolders = isCurry ? holders : undefined$1, + newHoldersRight = isCurry ? undefined$1 : holders, + newPartials = isCurry ? partials : undefined$1, + newPartialsRight = isCurry ? undefined$1 : partials; + + bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); + + if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { + bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); + } + var newData = [ + func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, + newHoldersRight, argPos, ary, arity + ]; + + var result = wrapFunc.apply(undefined$1, newData); + if (isLaziable(func)) { + setData(result, newData); + } + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); + } + + /** + * Creates a function like `_.round`. + * + * @private + * @param {string} methodName The name of the `Math` method to use when rounding. + * @returns {Function} Returns the new round function. + */ + function createRound(methodName) { + var func = Math[methodName]; + return function(number, precision) { + number = toNumber(number); + precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); + if (precision && nativeIsFinite(number)) { + // Shift with exponential notation to avoid floating-point issues. + // See [MDN](https://mdn.io/round#Examples) for more details. + var pair = (toString(number) + 'e').split('e'), + value = func(pair[0] + 'e' + (+pair[1] + precision)); + + pair = (toString(value) + 'e').split('e'); + return +(pair[0] + 'e' + (+pair[1] - precision)); + } + return func(number); + }; + } + + /** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ + var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { + return new Set(values); + }; + + /** + * Creates a `_.toPairs` or `_.toPairsIn` function. + * + * @private + * @param {Function} keysFunc The function to get the keys of a given object. + * @returns {Function} Returns the new pairs function. + */ + function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; + } + + /** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); + partials = holders = undefined$1; + } + ary = ary === undefined$1 ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined$1 ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined$1; + } + var data = isBindKey ? undefined$1 : getData(func); + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + if (data) { + mergeData(newData, data); + } + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] === undefined$1 + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { + bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == WRAP_BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined$1, newData); + } + var setter = data ? baseSetData : setData; + return setWrapToString(setter(result, newData), func, bitmask); + } + + /** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ + function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined$1 || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; + } + + /** + * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source + * objects into destination objects that are passed thru. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to merge. + * @param {Object} object The parent object of `objValue`. + * @param {Object} source The parent object of `srcValue`. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + * @returns {*} Returns the value to assign. + */ + function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject(objValue) && isObject(srcValue)) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, objValue); + baseMerge(objValue, srcValue, undefined$1, customDefaultsMerge, stack); + stack['delete'](srcValue); + } + return objValue; + } + + /** + * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain + * objects. + * + * @private + * @param {*} value The value to inspect. + * @param {string} key The key of the property to inspect. + * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. + */ + function customOmitClone(value) { + return isPlainObject(value) ? undefined$1 : value; + } + + /** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ + function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; + } + var index = -1, + result = true, + seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined$1; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined$1) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + return result; + } + + /** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; + } + + /** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined$1 + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; + } + + /** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + function flatRest(func) { + return setToString(overRest(func, undefined$1, flatten), func + ''); + } + + /** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); + } + + /** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); + } + + /** + * Gets metadata for `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {*} Returns the metadata for `func`. + */ + var getData = !metaMap ? noop : function(func) { + return metaMap.get(func); + }; + + /** + * Gets the name of `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {string} Returns the function name. + */ + function getFuncName(func) { + var result = (func.name + ''), + array = realNames[result], + length = hasOwnProperty.call(realNames, result) ? array.length : 0; + + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result; + } + + /** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ + function getHolder(func) { + var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; + return object.placeholder; + } + + /** + * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, + * this function returns the custom method, otherwise it returns `baseIteratee`. + * If arguments are provided, the chosen function is invoked with them and + * its result is returned. + * + * @private + * @param {*} [value] The value to convert to an iteratee. + * @param {number} [arity] The arity of the created iteratee. + * @returns {Function} Returns the chosen function or its result. + */ + function getIteratee() { + var result = lodash.iteratee || iteratee; + result = result === iteratee ? baseIteratee : result; + return arguments.length ? result(arguments[0], arguments[1]) : result; + } + + /** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; + } + + /** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; + } + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined$1; + } + + /** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ + function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined$1; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + + /** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); + }; + + /** + * Creates an array of the own and inherited enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { + var result = []; + while (object) { + arrayPush(result, getSymbols(object)); + object = getPrototype(object); + } + return result; + }; + + /** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + var getTag = baseGetTag; + + // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. + if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? value.constructor : undefined$1, + ctorString = Ctor ? toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } + } + return result; + }; + } + + /** + * Gets the view, applying any `transforms` to the `start` and `end` positions. + * + * @private + * @param {number} start The start of the view. + * @param {number} end The end of the view. + * @param {Array} transforms The transformations to apply to the view. + * @returns {Object} Returns an object containing the `start` and `end` + * positions of the view. + */ + function getView(start, end, transforms) { + var index = -1, + length = transforms.length; + + while (++index < length) { + var data = transforms[index], + size = data.size; + + switch (data.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + return { 'start': start, 'end': end }; + } + + /** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ + function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; + } + + /** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ + function hasPath(object, path, hasFunc) { + path = castPath(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); + } + + /** + * Initializes an array clone. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the initialized clone. + */ + function initCloneArray(array) { + var length = array.length, + result = new array.constructor(length); + + // Add properties assigned by `RegExp#exec`. + if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { + result.index = array.index; + result.input = array.input; + } + return result; + } + + /** + * Initializes an object clone. + * + * @private + * @param {Object} object The object to clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneObject(object) { + return (typeof object.constructor == 'function' && !isPrototype(object)) + ? baseCreate(getPrototype(object)) + : {}; + } + + /** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. + * + * @private + * @param {Object} object The object to clone. + * @param {string} tag The `toStringTag` of the object to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneByTag(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag: + return cloneArrayBuffer(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case dataViewTag: + return cloneDataView(object, isDeep); + + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + return cloneTypedArray(object, isDeep); + + case mapTag: + return new Ctor; + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + return cloneRegExp(object); + + case setTag: + return new Ctor; + + case symbolTag: + return cloneSymbol(object); + } + } + + /** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ + function insertWrapDetails(source, details) { + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); + } + + /** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); + } + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); + } + + /** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; + } + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); + } + + /** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ + function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); + } + + /** + * Checks if `func` has a lazy counterpart. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, + * else `false`. + */ + function isLaziable(func) { + var funcName = getFuncName(func), + other = lodash[funcName]; + + if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { + return false; + } + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; + } + + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); + } + + /** + * Checks if `func` is capable of being masked. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `func` is maskable, else `false`. + */ + var isMaskable = coreJsData ? isFunction : stubFalse; + + /** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ + function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; + } + + /** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ + function isStrictComparable(value) { + return value === value && !isObject(value); + } + + /** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined$1 || (key in Object(object))); + }; + } + + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + + /** + * Merges the function metadata of `source` into `data`. + * + * Merging metadata reduces the number of wrappers used to invoke a function. + * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` + * may be applied regardless of execution order. Methods like `_.ary` and + * `_.rearg` modify function arguments, making the order in which they are + * executed important, preventing the merging of metadata. However, we make + * an exception for a safe combined case where curried functions have `_.ary` + * and or `_.rearg` applied. + * + * @private + * @param {Array} data The destination metadata. + * @param {Array} source The source metadata. + * @returns {Array} Returns `data`. + */ + function mergeData(data, source) { + var bitmask = data[1], + srcBitmask = source[1], + newBitmask = bitmask | srcBitmask, + isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + + var isCombo = + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + + // Exit early if metadata can't be merged. + if (!(isCommon || isCombo)) { + return data; + } + // Use source `thisArg` if available. + if (srcBitmask & WRAP_BIND_FLAG) { + data[2] = source[2]; + // Set when currying a bound function. + newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; + } + // Compose partial arguments. + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : value; + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; + } + // Compose partial right arguments. + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; + } + // Use source `argPos` if available. + value = source[7]; + if (value) { + data[7] = value; + } + // Use source `ary` if it's smaller. + if (srcBitmask & WRAP_ARY_FLAG) { + data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); + } + // Use source `arity` if one is not provided. + if (data[9] == null) { + data[9] = source[9]; + } + // Use source `func` and merge bitmasks. + data[0] = source[0]; + data[1] = newBitmask; + + return data; + } + + /** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; + } + + /** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ + function objectToString(value) { + return nativeObjectToString.call(value); + } + + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined$1 ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; + } + + /** + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. + */ + function parent(object, path) { + return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); + } + + /** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ + function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined$1; + } + return array; + } + + /** + * Gets the value at `key`, unless `key` is "__proto__" or "constructor". + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function safeGet(object, key) { + if (key === 'constructor' && typeof object[key] === 'function') { + return; + } + + if (key == '__proto__') { + return; + } + + return object[key]; + } + + /** + * Sets metadata for `func`. + * + * **Note:** If this function becomes hot, i.e. is invoked a lot in a short + * period of time, it will trip its breaker and transition to an identity + * function to avoid garbage collection pauses in V8. See + * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) + * for more details. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var setData = shortOut(baseSetData); + + /** + * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @returns {number|Object} Returns the timer id or timeout object. + */ + var setTimeout = ctxSetTimeout || function(func, wait) { + return root.setTimeout(func, wait); + }; + + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = shortOut(baseSetToString); + + /** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ + function setWrapToString(wrapper, reference, bitmask) { + var source = (reference + ''); + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); + } + + /** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ + function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined$1, arguments); + }; + } + + /** + * A specialized version of `_.shuffle` which mutates and sets the size of `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @param {number} [size=array.length] The size of `array`. + * @returns {Array} Returns `array`. + */ + function shuffleSelf(array, size) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + size = size === undefined$1 ? length : size; + while (++index < size) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + array.length = size; + return array; + } + + /** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + }); + + /** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; + } + + /** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ + function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); + } + + /** + * Creates a clone of `wrapper`. + * + * @private + * @param {Object} wrapper The wrapper to clone. + * @returns {Object} Returns the cloned wrapper. + */ + function wrapperClone(wrapper) { + if (wrapper instanceof LazyWrapper) { + return wrapper.clone(); + } + var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); + result.__actions__ = copyArray(wrapper.__actions__); + result.__index__ = wrapper.__index__; + result.__values__ = wrapper.__values__; + return result; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of elements split into groups the length of `size`. + * If `array` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the new array of chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ + function chunk(array, size, guard) { + if ((guard ? isIterateeCall(array, size, guard) : size === undefined$1)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } + var length = array == null ? 0 : array.length; + if (!length || size < 1) { + return []; + } + var index = 0, + resIndex = 0, + result = Array(nativeCeil(length / size)); + + while (index < length) { + result[resIndex++] = baseSlice(array, index, (index += size)); + } + return result; + } + + /** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ + function compact(array) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), + array = arguments[0], + index = length; + + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); + } + + /** + * Creates an array of `array` values not included in the other given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * **Note:** Unlike `_.pullAll`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.without, _.xor + * @example + * + * _.difference([2, 1], [2, 3]); + * // => [1] + */ + var difference = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `iteratee` which + * is invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * **Note:** Unlike `_.pullAllBy`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2] + * + * // The `_.property` iteratee shorthand. + * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var differenceBy = baseRest(function(array, values) { + var iteratee = last(values); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined$1; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `comparator` + * which is invoked to compare elements of `array` to `values`. The order and + * references of result values are determined by the first array. The comparator + * is invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.pullAllWith`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + var differenceWith = baseRest(function(array, values) { + var comparator = last(values); + if (isArrayLikeObject(comparator)) { + comparator = undefined$1; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined$1, comparator) + : []; + }); + + /** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function drop(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined$1) ? 1 : toInteger(n); + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function dropRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined$1) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.dropRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney'] + * + * // The `_.matches` iteratee shorthand. + * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropRightWhile(users, ['active', false]); + * // => objects for ['barney'] + * + * // The `_.property` iteratee shorthand. + * _.dropRightWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true, true) + : []; + } + + /** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.dropWhile(users, function(o) { return !o.active; }); + * // => objects for ['pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.dropWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropWhile(users, ['active', false]); + * // => objects for ['pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.dropWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true) + : []; + } + + /** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + */ + function fill(array, value, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); + } + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ + function findIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, getIteratee(predicate, 3), index); + } + + /** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); + * // => 2 + * + * // The `_.matches` iteratee shorthand. + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastIndex(users, ['active', false]); + * // => 2 + * + * // The `_.property` iteratee shorthand. + * _.findLastIndex(users, 'active'); + * // => 0 + */ + function findLastIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined$1) { + index = toInteger(fromIndex); + index = fromIndex < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); + } + return baseFindIndex(array, getIteratee(predicate, 3), index, true); + } + + /** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ + function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; + } + + /** + * Recursively flattens `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ + function flattenDeep(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, INFINITY) : []; + } + + /** + * Recursively flatten `array` up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Array + * @param {Array} array The array to flatten. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * var array = [1, [2, [3, [4]], 5]]; + * + * _.flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * _.flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ + function flattenDepth(array, depth) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + depth = depth === undefined$1 ? 1 : toInteger(depth); + return baseFlatten(array, depth); + } + + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['a', 1], ['b', 2]]); + * // => { 'a': 1, 'b': 2 } + */ + function fromPairs(pairs) { + var index = -1, + length = pairs == null ? 0 : pairs.length, + result = {}; + + while (++index < length) { + var pair = pairs[index]; + result[pair[0]] = pair[1]; + } + return result; + } + + /** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias first + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.head([1, 2, 3]); + * // => 1 + * + * _.head([]); + * // => undefined + */ + function head(array) { + return (array && array.length) ? array[0] : undefined$1; + } + + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // Search from the `fromIndex`. + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + function indexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseIndexOf(array, value, index); + } + + /** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ + function initial(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 0, -1) : []; + } + + /** + * Creates an array of unique values that are included in all given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersection([2, 1], [2, 3]); + * // => [2] + */ + var intersection = baseRest(function(arrays) { + var mapped = arrayMap(arrays, castArrayLikeObject); + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + * + * // The `_.property` iteratee shorthand. + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + var intersectionBy = baseRest(function(arrays) { + var iteratee = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + if (iteratee === last(mapped)) { + iteratee = undefined$1; + } else { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `comparator` + * which is invoked to compare elements of `arrays`. The order and references + * of result values are determined by the first array. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + var intersectionWith = baseRest(function(arrays) { + var comparator = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + comparator = typeof comparator == 'function' ? comparator : undefined$1; + if (comparator) { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, undefined$1, comparator) + : []; + }); + + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to convert. + * @param {string} [separator=','] The element separator. + * @returns {string} Returns the joined string. + * @example + * + * _.join(['a', 'b', 'c'], '~'); + * // => 'a~b~c' + */ + function join(array, separator) { + return array == null ? '' : nativeJoin.call(array, separator); + } + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ + function last(array) { + var length = array == null ? 0 : array.length; + return length ? array[length - 1] : undefined$1; + } + + /** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // Search from the `fromIndex`. + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + */ + function lastIndexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length; + if (fromIndex !== undefined$1) { + index = toInteger(fromIndex); + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); + } + + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth + * element from the end is returned. + * + * @static + * @memberOf _ + * @since 4.11.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=0] The index of the element to return. + * @returns {*} Returns the nth element of `array`. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * + * _.nth(array, 1); + * // => 'b' + * + * _.nth(array, -2); + * // => 'c'; + */ + function nth(array, n) { + return (array && array.length) ? baseNth(array, toInteger(n)) : undefined$1; + } + + /** + * Removes all given values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` + * to remove elements from an array by predicate. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pull(array, 'a', 'c'); + * console.log(array); + * // => ['b', 'b'] + */ + var pull = baseRest(pullAll); + + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pullAll(array, ['a', 'c']); + * console.log(array); + * // => ['b', 'b'] + */ + function pullAll(array, values) { + return (array && array.length && values && values.length) + ? basePullAll(array, values) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + function pullAllBy(array, values, iteratee) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, getIteratee(iteratee, 2)) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `comparator` which + * is invoked to compare elements of `array` to `values`. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + function pullAllWith(array, values, comparator) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, undefined$1, comparator) + : array; + } + + /** + * Removes elements from `array` corresponding to `indexes` and returns an + * array of removed elements. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * var pulled = _.pullAt(array, [1, 3]); + * + * console.log(array); + * // => ['a', 'c'] + * + * console.log(pulled); + * // => ['b', 'd'] + */ + var pullAt = flatRest(function(array, indexes) { + var length = array == null ? 0 : array.length, + result = baseAt(array, indexes); + + basePullAt(array, arrayMap(indexes, function(index) { + return isIndex(index, length) ? +index : index; + }).sort(compareAscending)); + + return result; + }); + + /** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). + * + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ + function remove(array, predicate) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = getIteratee(predicate, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; + } + + /** + * Reverses `array` so that the first element becomes the last, the second + * element becomes the second to last, and so on. + * + * **Note:** This method mutates `array` and is based on + * [`Array#reverse`](https://mdn.io/Array/reverse). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function reverse(array) { + return array == null ? array : nativeReverse.call(array); + } + + /** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function slice(array, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + else { + start = start == null ? 0 : toInteger(start); + end = end === undefined$1 ? length : toInteger(end); + } + return baseSlice(array, start, end); + } + + /** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + */ + function sortedIndex(array, value) { + return baseSortedIndex(array, value); + } + + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); + * // => 0 + */ + function sortedIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); + } + + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([4, 5, 5, 5, 6], 5); + * // => 1 + */ + function sortedIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value); + if (index < length && eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 5, 5, 5, 6], 5); + * // => 4 + */ + function sortedLastIndex(array, value) { + return baseSortedIndex(array, value, true); + } + + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 1 + * + * // The `_.property` iteratee shorthand. + * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); + * // => 1 + */ + function sortedLastIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); + } + + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); + * // => 3 + */ + function sortedLastIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value, true) - 1; + if (eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + function sortedUniq(array) { + return (array && array.length) + ? baseSortedUniq(array) + : []; + } + + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.3] + */ + function sortedUniqBy(array, iteratee) { + return (array && array.length) + ? baseSortedUniq(array, getIteratee(iteratee, 2)) + : []; + } + + /** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.tail([1, 2, 3]); + * // => [2, 3] + */ + function tail(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 1, length) : []; + } + + /** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ + function take(array, n, guard) { + if (!(array && array.length)) { + return []; + } + n = (guard || n === undefined$1) ? 1 : toInteger(n); + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ + function takeRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined$1) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.takeRightWhile(users, 'active'); + * // => [] + */ + function takeRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), false, true) + : []; + } + + /** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matches` iteratee shorthand. + * _.takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * // The `_.property` iteratee shorthand. + * _.takeWhile(users, 'active'); + * // => [] + */ + function takeWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3)) + : []; + } + + /** + * Creates an array of unique values, in order, from all given arrays using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([2], [1, 2]); + * // => [2, 1] + */ + var union = baseRest(function(arrays) { + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); + }); + + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which uniqueness is computed. Result values are chosen from the first + * array in which the value occurs. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + var unionBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined$1; + } + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. Result values are chosen from + * the first array in which the value occurs. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var unionWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined$1; + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined$1, comparator); + }); + + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. The order of result values is determined by the order they occur + * in the array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ + function uniq(array) { + return (array && array.length) ? baseUniq(array) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The order of result values is determined by the + * order they occur in the array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + function uniqBy(array, iteratee) { + return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The order of result values is + * determined by the order they occur in the array.The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + function uniqWith(array, comparator) { + comparator = typeof comparator == 'function' ? comparator : undefined$1; + return (array && array.length) ? baseUniq(array, undefined$1, comparator) : []; + } + + /** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-zip + * configuration. + * + * @static + * @memberOf _ + * @since 1.2.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + * + * _.unzip(zipped); + * // => [['a', 'b'], [1, 2], [true, false]] + */ + function unzip(array) { + if (!(array && array.length)) { + return []; + } + var length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLikeObject(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + return baseTimes(length, function(index) { + return arrayMap(array, baseProperty(index)); + }); + } + + /** + * This method is like `_.unzip` except that it accepts `iteratee` to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee=_.identity] The function to combine + * regrouped values. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee) { + if (!(array && array.length)) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + return arrayMap(result, function(group) { + return apply(iteratee, undefined$1, group); + }); + } + + /** + * Creates an array excluding all given values using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.pull`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.xor + * @example + * + * _.without([2, 1, 2, 3], 1, 2); + * // => [3] + */ + var without = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, values) + : []; + }); + + /** + * Creates an array of unique values that is the + * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the given arrays. The order of result values is determined by the order + * they occur in the arrays. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.without + * @example + * + * _.xor([2, 1], [2, 3]); + * // => [1, 3] + */ + var xor = baseRest(function(arrays) { + return baseXor(arrayFilter(arrays, isArrayLikeObject)); + }); + + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which by which they're compared. The order of result values is determined + * by the order they occur in the arrays. The iteratee is invoked with one + * argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2, 3.4] + * + * // The `_.property` iteratee shorthand. + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var xorBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined$1; + } + return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The order of result values is + * determined by the order they occur in the arrays. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var xorWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined$1; + return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined$1, comparator); + }); + + /** + * Creates an array of grouped elements, the first of which contains the + * first elements of the given arrays, the second of which contains the + * second elements of the given arrays, and so on. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + */ + var zip = baseRest(unzip); + + /** + * This method is like `_.fromPairs` except that it accepts two arrays, + * one of property identifiers and one of corresponding values. + * + * @static + * @memberOf _ + * @since 0.4.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject(['a', 'b'], [1, 2]); + * // => { 'a': 1, 'b': 2 } + */ + function zipObject(props, values) { + return baseZipObject(props || [], values || [], assignValue); + } + + /** + * This method is like `_.zipObject` except that it supports property paths. + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); + * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ + function zipObjectDeep(props, values) { + return baseZipObject(props || [], values || [], baseSet); + } + + /** + * This method is like `_.zip` except that it accepts `iteratee` to specify + * how grouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee=_.identity] The function to combine + * grouped values. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { + * return a + b + c; + * }); + * // => [111, 222] + */ + var zipWith = baseRest(function(arrays) { + var length = arrays.length, + iteratee = length > 1 ? arrays[length - 1] : undefined$1; + + iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined$1; + return unzipWith(arrays, iteratee); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Seq + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _ + * .chain(users) + * .sortBy('age') + * .map(function(o) { + * return o.user + ' is ' + o.age; + * }) + * .head() + * .value(); + * // => 'pebbles is 1' + */ + function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; + } + + /** + * This method invokes `interceptor` and returns `value`. The interceptor + * is invoked with one argument; (value). The purpose of this method is to + * "tap into" a method chain sequence in order to modify intermediate results. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * // Mutate input array. + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ + function tap(value, interceptor) { + interceptor(value); + return value; + } + + /** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * The purpose of this method is to "pass thru" values replacing intermediate + * results in a method chain sequence. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ + function thru(value, interceptor) { + return interceptor(value); + } + + /** + * This method is the wrapper version of `_.at`. + * + * @name at + * @memberOf _ + * @since 1.0.0 + * @category Seq + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _(object).at(['a[0].b.c', 'a[1]']).value(); + * // => [3, 4] + */ + var wrapperAt = flatRest(function(paths) { + var length = paths.length, + start = length ? paths[0] : 0, + value = this.__wrapped__, + interceptor = function(object) { return baseAt(object, paths); }; + + if (length > 1 || this.__actions__.length || + !(value instanceof LazyWrapper) || !isIndex(start)) { + return this.thru(interceptor); + } + value = value.slice(start, +start + (length ? 1 : 0)); + value.__actions__.push({ + 'func': thru, + 'args': [interceptor], + 'thisArg': undefined$1 + }); + return new LodashWrapper(value, this.__chain__).thru(function(array) { + if (length && !array.length) { + array.push(undefined$1); + } + return array; + }); + }); + + /** + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. + * + * @name chain + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // A sequence without explicit chaining. + * _(users).head(); + * // => { 'user': 'barney', 'age': 36 } + * + * // A sequence with explicit chaining. + * _(users) + * .chain() + * .head() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ + function wrapperChain() { + return chain(this); + } + + /** + * Executes the chain sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapped = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapped = wrapped.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapped.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ + function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); + } + + /** + * Gets the next value on a wrapped object following the + * [iterator protocol](https://mdn.io/iteration_protocols#iterator). + * + * @name next + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the next iterator value. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped.next(); + * // => { 'done': false, 'value': 1 } + * + * wrapped.next(); + * // => { 'done': false, 'value': 2 } + * + * wrapped.next(); + * // => { 'done': true, 'value': undefined } + */ + function wrapperNext() { + if (this.__values__ === undefined$1) { + this.__values__ = toArray(this.value()); + } + var done = this.__index__ >= this.__values__.length, + value = done ? undefined$1 : this.__values__[this.__index__++]; + + return { 'done': done, 'value': value }; + } + + /** + * Enables the wrapper to be iterable. + * + * @name Symbol.iterator + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the wrapper object. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped[Symbol.iterator]() === wrapped; + * // => true + * + * Array.from(wrapped); + * // => [1, 2] + */ + function wrapperToIterator() { + return this; + } + + /** + * Creates a clone of the chain sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @param {*} value The value to plant. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2]).map(square); + * var other = wrapped.plant([3, 4]); + * + * other.value(); + * // => [9, 16] + * + * wrapped.value(); + * // => [1, 4] + */ + function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + clone.__index__ = 0; + clone.__values__ = undefined$1; + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; + } + + /** + * This method is the wrapper version of `_.reverse`. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + var wrapped = value; + if (this.__actions__.length) { + wrapped = new LazyWrapper(this); + } + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ + 'func': thru, + 'args': [reverse], + 'thisArg': undefined$1 + }); + return new LodashWrapper(wrapped, this.__chain__); + } + return this.thru(reverse); + } + + /** + * Executes the chain sequence to resolve the unwrapped value. + * + * @name value + * @memberOf _ + * @since 0.1.0 + * @alias toJSON, valueOf + * @category Seq + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the number of times the key was returned by `iteratee`. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': 1, '6': 2 } + * + * // The `_.property` iteratee shorthand. + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ + var countBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + ++result[key]; + } else { + baseAssignValue(result, key, 1); + } + }); + + /** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * Iteration is stopped once `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * **Note:** This method returns `true` for + * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because + * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of + * elements of empty collections. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.every(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.every(users, 'active'); + * // => false + */ + function every(collection, predicate, guard) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined$1; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * **Note:** Unlike `_.remove`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.reject + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, { 'age': 36, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.filter(users, 'active'); + * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] + */ + function filter(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */ + var find = createFind(findIndex); + + /** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=collection.length-1] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ + var findLast = createFind(findLastIndex); + + /** + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee), 1); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMapDeep(collection, iteratee) { + return baseFlatten(map(collection, iteratee), INFINITY); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + function flatMapDepth(collection, iteratee, depth) { + depth = depth === undefined$1 ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee), depth); + } + + /** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forEach(collection, iteratee) { + var func = isArray(collection) ? arrayEach : baseEach; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @alias eachRight + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEach + * @example + * + * _.forEachRight([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `2` then `1`. + */ + function forEachRight(collection, iteratee) { + var func = isArray(collection) ? arrayEachRight : baseEachRight; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The order of grouped values + * is determined by the order they occur in `collection`. The corresponding + * value of each key is an array of elements responsible for generating the + * key. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': [4.2], '6': [6.1, 6.3] } + * + * // The `_.property` iteratee shorthand. + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ + var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + baseAssignValue(result, key, [value]); + } + }); + + /** + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * is used for equality comparisons. If `fromIndex` is negative, it's used as + * the offset from the end of `collection`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {boolean} Returns `true` if `value` is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'a': 1, 'b': 2 }, 1); + * // => true + * + * _.includes('abcd', 'bc'); + * // => true + */ + function includes(collection, value, fromIndex, guard) { + collection = isArrayLike(collection) ? collection : values(collection); + fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; + + var length = collection.length; + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); + } + return isString(collection) + ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) + : (!!length && baseIndexOf(collection, value, fromIndex) > -1); + } + + /** + * Invokes the method at `path` of each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `path` is a function, it's invoked + * for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke each method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invokeMap([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + var invokeMap = baseRest(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); + }); + return result; + }); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the last element responsible for generating the key. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var array = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.keyBy(array, function(o) { + * return String.fromCharCode(o.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.keyBy(array, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + */ + var keyBy = createAggregator(function(result, value, key) { + baseAssignValue(result, key, value); + }); + + /** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] + * The iteratees to sort by. + * @param {string[]} [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // Sort by `user` in ascending order and by `age` in descending order. + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + */ + function orderBy(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + orders = guard ? undefined$1 : orders; + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseOrderBy(collection, iteratees, orders); + } + + /** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, the second of which + * contains elements `predicate` returns falsey for. The predicate is + * invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * _.partition(users, function(o) { return o.active; }); + * // => objects for [['fred'], ['barney', 'pebbles']] + * + * // The `_.matches` iteratee shorthand. + * _.partition(users, { 'age': 1, 'active': false }); + * // => objects for [['pebbles'], ['barney', 'fred']] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.partition(users, ['active', false]); + * // => objects for [['barney', 'pebbles'], ['fred']] + * + * // The `_.property` iteratee shorthand. + * _.partition(users, 'active'); + * // => objects for [['fred'], ['barney', 'pebbles']] + */ + var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); + }, function() { return [[], []]; }); + + /** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` thru `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not given, the first element of `collection` is used as the initial + * value. The iteratee is invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, + * and `sortBy` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduceRight + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }, 0); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * return result; + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + */ + function reduce(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduce : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); + } + + /** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduce + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ + function reduceRight(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduceRight : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); + } + + /** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.filter + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * _.reject(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.reject(users, { 'age': 40, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.reject(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.reject(users, 'active'); + * // => objects for ['barney'] + */ + function reject(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, negate(getIteratee(predicate, 3))); + } + + /** + * Gets a random element from `collection`. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + */ + function sample(collection) { + var func = isArray(collection) ? arraySample : baseSample; + return func(collection); + } + + /** + * Gets `n` random elements at unique keys from `collection` up to the + * size of `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @param {number} [n=1] The number of elements to sample. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the random elements. + * @example + * + * _.sampleSize([1, 2, 3], 2); + * // => [3, 1] + * + * _.sampleSize([1, 2, 3], 4); + * // => [2, 3, 1] + */ + function sampleSize(collection, n, guard) { + if ((guard ? isIterateeCall(collection, n, guard) : n === undefined$1)) { + n = 1; + } else { + n = toInteger(n); + } + var func = isArray(collection) ? arraySampleSize : baseSampleSize; + return func(collection, n); + } + + /** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ + function shuffle(collection) { + var func = isArray(collection) ? arrayShuffle : baseShuffle; + return func(collection); + } + + /** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable string keyed properties for objects. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the collection size. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ + function size(collection) { + if (collection == null) { + return 0; + } + if (isArrayLike(collection)) { + return isString(collection) ? stringSize(collection) : collection.length; + } + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; + } + return baseKeys(collection).length; + } + + /** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * Iteration is stopped once `predicate` returns truthy. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.some(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.some(users, 'active'); + * // => true + */ + function some(collection, predicate, guard) { + var func = isArray(collection) ? arraySome : baseSome; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined$1; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection thru each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[])} [iteratees=[_.identity]] + * The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 30 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] + */ + var sortBy = baseRest(function(collection, iteratees) { + if (collection == null) { + return []; + } + var length = iteratees.length; + if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { + iteratees = []; + } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { + iteratees = [iteratees[0]]; + } + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ + var now = ctxNow || function() { + return root.Date.now(); + }; + + /*------------------------------------------------------------------------*/ + + /** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {number} n The number of calls before `func` is invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var saves = ['profile', 'settings']; + * + * var done = _.after(saves.length, function() { + * console.log('done saving!'); + * }); + * + * _.forEach(saves, function(type) { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ + function after(n, func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; + } + + /** + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ + function ary(func, n, guard) { + n = guard ? undefined$1 : n; + n = (func && n == null) ? func.length : n; + return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n); + } + + /** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery(element).on('click', _.before(5, addContactToList)); + * // => Allows adding up to 4 contacts to the list. + */ + function before(n, func) { + var result; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined$1; + } + return result; + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and `partials` prepended to the arguments it receives. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // Bound with placeholders. + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ + var bind = baseRest(function(func, thisArg, partials) { + var bitmask = WRAP_BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bind)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(func, bitmask, thisArg, partials, holders); + }); + + /** + * Creates a function that invokes the method at `object[key]` with `partials` + * prepended to the arguments it receives. + * + * This method differs from `_.bind` by allowing bound functions to reference + * methods that may be redefined or don't yet exist. See + * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * for more details. + * + * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Function + * @param {Object} object The object to invoke the method on. + * @param {string} key The key of the method. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var object = { + * 'user': 'fred', + * 'greet': function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * }; + * + * var bound = _.bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function(greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ + var bindKey = baseRest(function(object, key, partials) { + var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bindKey)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(key, bitmask, object, partials, holders); + }); + + /** + * Creates a function that accepts arguments of `func` and either invokes + * `func` returning its result, if at least `arity` number of arguments have + * been provided, or returns a function that accepts the remaining `func` + * arguments, and so on. The arity of `func` may be specified if `func.length` + * is not sufficient. + * + * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curry(abc); + * + * curried(1)(2)(3); + * // => [1, 2, 3] + * + * curried(1, 2)(3); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ + function curry(func, arity, guard) { + arity = guard ? undefined$1 : arity; + var result = createWrap(func, WRAP_CURRY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity); + result.placeholder = curry.placeholder; + return result; + } + + /** + * This method is like `_.curry` except that arguments are applied to `func` + * in the manner of `_.partialRight` instead of `_.partial`. + * + * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curryRight(abc); + * + * curried(3)(2)(1); + * // => [1, 2, 3] + * + * curried(2, 3)(1); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ + function curryRight(func, arity, guard) { + arity = guard ? undefined$1 : arity; + var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity); + result.placeholder = curryRight.placeholder; + return result; + } + + /** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ + function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined$1; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined$1 || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined$1; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined$1; + return result; + } + + function cancel() { + if (timerId !== undefined$1) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined$1; + } + + function flush() { + return timerId === undefined$1 ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined$1) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined$1) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + + /** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // => Logs 'deferred' after one millisecond. + */ + var defer = baseRest(function(func, args) { + return baseDelay(func, 1, args); + }); + + /** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => Logs 'later' after one second. + */ + var delay = baseRest(function(func, wait, args) { + return baseDelay(func, toNumber(wait) || 0, args); + }); + + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to flip arguments for. + * @returns {Function} Returns the new flipped function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + function flip(func) { + return createWrap(func, WRAP_FLIP_FLAG); + } + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; + } + + // Expose `MapCache`. + memoize.Cache = MapCache; + + /** + * Creates a function that negates the result of the predicate `func`. The + * `func` predicate is invoked with the `this` binding and arguments of the + * created function. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new negated function. + * @example + * + * function isEven(n) { + * return n % 2 == 0; + * } + * + * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); + * // => [1, 3, 5] + */ + function negate(predicate) { + if (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + var args = arguments; + switch (args.length) { + case 0: return !predicate.call(this); + case 1: return !predicate.call(this, args[0]); + case 2: return !predicate.call(this, args[0], args[1]); + case 3: return !predicate.call(this, args[0], args[1], args[2]); + } + return !predicate.apply(this, args); + }; + } + + /** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first invocation. The `func` is + * invoked with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // => `createApplication` is invoked once + */ + function once(func) { + return before(2, func); + } + + /** + * Creates a function that invokes `func` with its arguments transformed. + * + * @static + * @since 4.0.0 + * @memberOf _ + * @category Function + * @param {Function} func The function to wrap. + * @param {...(Function|Function[])} [transforms=[_.identity]] + * The argument transforms. + * @returns {Function} Returns the new function. + * @example + * + * function doubled(n) { + * return n * 2; + * } + * + * function square(n) { + * return n * n; + * } + * + * var func = _.overArgs(function(x, y) { + * return [x, y]; + * }, [square, doubled]); + * + * func(9, 3); + * // => [81, 6] + * + * func(10, 5); + * // => [100, 10] + */ + var overArgs = castRest(function(func, transforms) { + transforms = (transforms.length == 1 && isArray(transforms[0])) + ? arrayMap(transforms[0], baseUnary(getIteratee())) + : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); + + var funcsLength = transforms.length; + return baseRest(function(args) { + var index = -1, + length = nativeMin(args.length, funcsLength); + + while (++index < length) { + args[index] = transforms[index].call(this, args[index]); + } + return apply(func, this, args); + }); + }); + + /** + * Creates a function that invokes `func` with `partials` prepended to the + * arguments it receives. This method is like `_.bind` except it does **not** + * alter the `this` binding. + * + * The `_.partial.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 0.2.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var sayHelloTo = _.partial(greet, 'hello'); + * sayHelloTo('fred'); + * // => 'hello fred' + * + * // Partially applied with placeholders. + * var greetFred = _.partial(greet, _, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + */ + var partial = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partial)); + return createWrap(func, WRAP_PARTIAL_FLAG, undefined$1, partials, holders); + }); + + /** + * This method is like `_.partial` except that partially applied arguments + * are appended to the arguments it receives. + * + * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var greetFred = _.partialRight(greet, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + * + * // Partially applied with placeholders. + * var sayHelloTo = _.partialRight(greet, 'hello', _); + * sayHelloTo('fred'); + * // => 'hello fred' + */ + var partialRight = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partialRight)); + return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined$1, partials, holders); + }); + + /** + * Creates a function that invokes `func` with arguments arranged according + * to the specified `indexes` where the argument value at the first index is + * provided as the first argument, the argument value at the second index is + * provided as the second argument, and so on. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to rearrange arguments for. + * @param {...(number|number[])} indexes The arranged argument indexes. + * @returns {Function} Returns the new function. + * @example + * + * var rearged = _.rearg(function(a, b, c) { + * return [a, b, c]; + * }, [2, 0, 1]); + * + * rearged('b', 'c', 'a') + * // => ['a', 'b', 'c'] + */ + var rearg = flatRest(function(func, indexes) { + return createWrap(func, WRAP_REARG_FLAG, undefined$1, undefined$1, undefined$1, indexes); + }); + + /** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as + * an array. + * + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.rest(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ + function rest(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start === undefined$1 ? start : toInteger(start); + return baseRest(func, start); + } + + /** + * Creates a function that invokes `func` with the `this` binding of the + * create function and an array of arguments much like + * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). + * + * **Note:** This method is based on the + * [spread operator](https://mdn.io/spread_operator). + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Function + * @param {Function} func The function to spread arguments over. + * @param {number} [start=0] The start position of the spread. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ + function spread(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start == null ? 0 : nativeMax(toInteger(start), 0); + return baseRest(function(args) { + var array = args[start], + otherArgs = castSlice(args, 0, start); + + if (array) { + arrayPush(otherArgs, array); + } + return apply(func, this, otherArgs); + }); + } + + /** + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed `func` invocations and a `flush` method to + * immediately invoke them. Provide `options` to indicate whether `func` + * should be invoked on the leading and/or trailing edge of the `wait` + * timeout. The `func` is invoked with the last arguments provided to the + * throttled function. Subsequent calls to the throttled function return the + * result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the throttled function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=true] + * Specify invoking on the leading edge of the timeout. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // Avoid excessively updating the position while scrolling. + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. + * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); + * jQuery(element).on('click', throttled); + * + * // Cancel the trailing throttled invocation. + * jQuery(window).on('popstate', throttled.cancel); + */ + function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing + }); + } + + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + function unary(func) { + return ary(func, 1); + } + + /** + * Creates a function that provides `value` to `wrapper` as its first + * argument. Any additional arguments provided to the function are appended + * to those provided to the `wrapper`. The wrapper is invoked with the `this` + * binding of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {*} value The value to wrap. + * @param {Function} [wrapper=identity] The wrapper function. + * @returns {Function} Returns the new function. + * @example + * + * var p = _.wrap(_.escape, function(func, text) { + * return '

' + func(text) + '

'; + * }); + * + * p('fred, barney, & pebbles'); + * // => '

fred, barney, & pebbles

' + */ + function wrap(value, wrapper) { + return partial(castFunction(wrapper), value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ + function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; + } + + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @see _.cloneDeep + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + function clone(value) { + return baseClone(value, CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.clone` except that it accepts `customizer` which + * is invoked to produce the cloned value. If `customizer` returns `undefined`, + * cloning is handled by the method instead. The `customizer` is invoked with + * up to four arguments; (value [, index|key, object, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the cloned value. + * @see _.cloneDeepWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(false); + * } + * } + * + * var el = _.cloneWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 0 + */ + function cloneWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined$1; + return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @see _.clone + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */ + function cloneDeep(value) { + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.cloneWith` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the deep cloned value. + * @see _.cloneWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * } + * + * var el = _.cloneDeepWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 20 + */ + function cloneDeepWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined$1; + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * Checks if `object` conforms to `source` by invoking the predicate + * properties of `source` with the corresponding property values of `object`. + * + * **Note:** This method is equivalent to `_.conforms` when `source` is + * partially applied. + * + * @static + * @memberOf _ + * @since 4.14.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); + * // => true + * + * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); + * // => false + */ + function conformsTo(object, source) { + return source == null || baseConformsTo(object, source, keys(source)); + } + + /** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + function eq(value, other) { + return value === other || (value !== value && other !== other); + } + + /** + * Checks if `value` is greater than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + * @see _.lt + * @example + * + * _.gt(3, 1); + * // => true + * + * _.gt(3, 3); + * // => false + * + * _.gt(1, 3); + * // => false + */ + var gt = createRelationalOperation(baseGt); + + /** + * Checks if `value` is greater than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than or equal to + * `other`, else `false`. + * @see _.lte + * @example + * + * _.gte(3, 1); + * // => true + * + * _.gte(3, 3); + * // => true + * + * _.gte(1, 3); + * // => false + */ + var gte = createRelationalOperation(function(value, other) { + return value >= other; + }); + + /** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); + }; + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ + var isArray = Array.isArray; + + /** + * Checks if `value` is classified as an `ArrayBuffer` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + * @example + * + * _.isArrayBuffer(new ArrayBuffer(2)); + * // => true + * + * _.isArrayBuffer(new Array(2)); + * // => false + */ + var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; + + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); + } + + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); + } + + /** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ + function isBoolean(value) { + return value === true || value === false || + (isObjectLike(value) && baseGetTag(value) == boolTag); + } + + /** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ + var isBuffer = nativeIsBuffer || stubFalse; + + /** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ + var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + + /** + * Checks if `value` is likely a DOM element. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @example + * + * _.isElement(document.body); + * // => true + * + * _.isElement(''); + * // => false + */ + function isElement(value) { + return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); + } + + /** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ + function isEmpty(value) { + if (value == null) { + return true; + } + if (isArrayLike(value) && + (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || + isBuffer(value) || isTypedArray(value) || isArguments(value))) { + return !value.length; + } + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + if (isPrototype(value)) { + return !baseKeys(value).length; + } + for (var key in value) { + if (hasOwnProperty.call(value, key)) { + return false; + } + } + return true; + } + + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are compared by strict equality, i.e. `===`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + function isEqual(value, other) { + return baseIsEqual(value, other); + } + + /** + * This method is like `_.isEqual` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with up to + * six arguments: (objValue, othValue [, index|key, object, other, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + function isEqualWith(value, other, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined$1; + var result = customizer ? customizer(value, other) : undefined$1; + return result === undefined$1 ? baseIsEqual(value, other, undefined$1, customizer) : !!result; + } + + /** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ + function isError(value) { + if (!isObjectLike(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || + (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); + } + + /** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(3); + * // => true + * + * _.isFinite(Number.MIN_VALUE); + * // => true + * + * _.isFinite(Infinity); + * // => false + * + * _.isFinite('3'); + * // => false + */ + function isFinite(value) { + return typeof value == 'number' && nativeIsFinite(value); + } + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + function isInteger(value) { + return typeof value == 'number' && value == toInteger(value); + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); + } + + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + function isObjectLike(value) { + return value != null && typeof value == 'object'; + } + + /** + * Checks if `value` is classified as a `Map` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + * @example + * + * _.isMap(new Map); + * // => true + * + * _.isMap(new WeakMap); + * // => false + */ + var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; + + /** + * Performs a partial deep comparison between `object` and `source` to + * determine if `object` contains equivalent property values. + * + * **Note:** This method is equivalent to `_.matches` when `source` is + * partially applied. + * + * Partial comparisons will match empty array and empty object `source` + * values against any array or object value, respectively. See `_.isEqual` + * for a list of supported value comparisons. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.isMatch(object, { 'b': 2 }); + * // => true + * + * _.isMatch(object, { 'b': 1 }); + * // => false + */ + function isMatch(object, source) { + return object === source || baseIsMatch(object, source, getMatchData(source)); + } + + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with five + * arguments: (objValue, srcValue, index|key, object, source). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + function isMatchWith(object, source, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined$1; + return baseIsMatch(object, source, getMatchData(source), customizer); + } + + /** + * Checks if `value` is `NaN`. + * + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @example + * + * _.isNaN(NaN); + * // => true + * + * _.isNaN(new Number(NaN)); + * // => true + * + * isNaN(undefined); + * // => true + * + * _.isNaN(undefined); + * // => false + */ + function isNaN(value) { + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. + return isNumber(value) && value != +value; + } + + /** + * Checks if `value` is a pristine native function. + * + * **Note:** This method can't reliably detect native functions in the presence + * of the core-js package because core-js circumvents this kind of detection. + * Despite multiple requests, the core-js maintainer has made it clear: any + * attempt to fix the detection will be obstructed. As a result, we're left + * with little choice but to throw an error. Unfortunately, this also affects + * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), + * which rely on core-js. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (isMaskable(value)) { + throw new Error(CORE_ERROR_TEXT); + } + return baseIsNative(value); + } + + /** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `null`, else `false`. + * @example + * + * _.isNull(null); + * // => true + * + * _.isNull(void 0); + * // => false + */ + function isNull(value) { + return value === null; + } + + /** + * Checks if `value` is `null` or `undefined`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + function isNil(value) { + return value == null; + } + + /** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a number, else `false`. + * @example + * + * _.isNumber(3); + * // => true + * + * _.isNumber(Number.MIN_VALUE); + * // => true + * + * _.isNumber(Infinity); + * // => true + * + * _.isNumber('3'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || + (isObjectLike(value) && baseGetTag(value) == numberTag); + } + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ + function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; + } + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on + * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + function isSafeInteger(value) { + return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is classified as a `Set` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + * @example + * + * _.isSet(new Set); + * // => true + * + * _.isSet(new WeakSet); + * // => false + */ + var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + } + + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); + } + + /** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + + /** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ + function isUndefined(value) { + return value === undefined$1; + } + + /** + * Checks if `value` is classified as a `WeakMap` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. + * @example + * + * _.isWeakMap(new WeakMap); + * // => true + * + * _.isWeakMap(new Map); + * // => false + */ + function isWeakMap(value) { + return isObjectLike(value) && getTag(value) == weakMapTag; + } + + /** + * Checks if `value` is classified as a `WeakSet` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. + * @example + * + * _.isWeakSet(new WeakSet); + * // => true + * + * _.isWeakSet(new Set); + * // => false + */ + function isWeakSet(value) { + return isObjectLike(value) && baseGetTag(value) == weakSetTag; + } + + /** + * Checks if `value` is less than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + * @see _.gt + * @example + * + * _.lt(1, 3); + * // => true + * + * _.lt(3, 3); + * // => false + * + * _.lt(3, 1); + * // => false + */ + var lt = createRelationalOperation(baseLt); + + /** + * Checks if `value` is less than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than or equal to + * `other`, else `false`. + * @see _.gte + * @example + * + * _.lte(1, 3); + * // => true + * + * _.lte(3, 3); + * // => true + * + * _.lte(3, 1); + * // => false + */ + var lte = createRelationalOperation(function(value, other) { + return value <= other; + }); + + /** + * Converts `value` to an array. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * _.toArray({ 'a': 1, 'b': 2 }); + * // => [1, 2] + * + * _.toArray('abc'); + * // => ['a', 'b', 'c'] + * + * _.toArray(1); + * // => [] + * + * _.toArray(null); + * // => [] + */ + function toArray(value) { + if (!value) { + return []; + } + if (isArrayLike(value)) { + return isString(value) ? stringToArray(value) : copyArray(value); + } + if (symIterator && value[symIterator]) { + return iteratorToArray(value[symIterator]()); + } + var tag = getTag(value), + func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); + + return func(value); + } + + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + + /** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ + function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; + } + + /** + * Converts `value` to an integer suitable for use as the length of an + * array-like object. + * + * **Note:** This method is based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toLength(3.2); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3.2'); + * // => 3 + */ + function toLength(value) { + return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; + } + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = baseTrim(value); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); + } + + /** + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ + function toPlainObject(value) { + return copyObject(value, keysIn(value)); + } + + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toSafeInteger(3.2); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3.2'); + * // => 3 + */ + function toSafeInteger(value) { + return value + ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) + : (value === 0 ? value : 0); + } + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString(value) { + return value == null ? '' : baseToString(value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ + var assign = createAssigner(function(object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } + }); + + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ + var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); + }); + + /** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); + }); + + /** + * This method is like `_.assign` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignInWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keys(source), object, customizer); + }); + + /** + * Creates an array of values corresponding to `paths` of `object`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Array} Returns the picked values. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _.at(object, ['a[0].b.c', 'a[1]']); + * // => [3, 4] + */ + var at = flatRest(baseAt); + + /** + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ + function create(prototype, properties) { + var result = baseCreate(prototype); + return properties == null ? result : baseAssign(result, properties); + } + + /** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var defaults = baseRest(function(object, sources) { + object = Object(object); + + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined$1; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + + if (value === undefined$1 || + (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { + object[key] = source[key]; + } + } + } + + return object; + }); + + /** + * This method is like `_.defaults` except that it recursively assigns + * default properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaults + * @example + * + * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); + * // => { 'a': { 'b': 2, 'c': 3 } } + */ + var defaultsDeep = baseRest(function(args) { + args.push(undefined$1, customDefaultsMerge); + return apply(mergeWith, undefined$1, args); + }); + + /** + * This method is like `_.find` except that it returns the key of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findKey(users, function(o) { return o.age < 40; }); + * // => 'barney' (iteration order is not guaranteed) + * + * // The `_.matches` iteratee shorthand. + * _.findKey(users, { 'age': 1, 'active': true }); + * // => 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findKey(users, 'active'); + * // => 'barney' + */ + function findKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); + } + + /** + * This method is like `_.findKey` except that it iterates over elements of + * a collection in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findLastKey(users, function(o) { return o.age < 40; }); + * // => returns 'pebbles' assuming `_.findKey` returns 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.findLastKey(users, { 'age': 36, 'active': true }); + * // => 'barney' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findLastKey(users, 'active'); + * // => 'pebbles' + */ + function findLastKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); + } + + /** + * Iterates over own and inherited enumerable string keyed properties of an + * object and invokes `iteratee` for each property. The iteratee is invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forInRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forIn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). + */ + function forIn(object, iteratee) { + return object == null + ? object + : baseFor(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * This method is like `_.forIn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forIn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forInRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. + */ + function forInRight(object, iteratee) { + return object == null + ? object + : baseForRight(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * Iterates over own enumerable string keyed properties of an object and + * invokes `iteratee` for each property. The iteratee is invoked with three + * arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwnRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forOwn(object, iteratee) { + return object && baseForOwn(object, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forOwn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwnRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. + */ + function forOwnRight(object, iteratee) { + return object && baseForOwnRight(object, getIteratee(iteratee, 3)); + } + + /** + * Creates an array of function property names from own enumerable properties + * of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functionsIn + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] + */ + function functions(object) { + return object == null ? [] : baseFunctions(object, keys(object)); + } + + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functions + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ + function functionsIn(object) { + return object == null ? [] : baseFunctions(object, keysIn(object)); + } + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined$1 : baseGet(object, path); + return result === undefined$1 ? defaultValue : result; + } + + /** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + function has(object, path) { + return object != null && hasPath(object, path, baseHas); + } + + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); + } + + /** + * Creates an object composed of the inverted keys and values of `object`. + * If `object` contains duplicate values, subsequent values overwrite + * property assignments of previous values. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Object + * @param {Object} object The object to invert. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invert(object); + * // => { '1': 'c', '2': 'b' } + */ + var invert = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + result[value] = key; + }, constant(identity)); + + /** + * This method is like `_.invert` except that the inverted object is generated + * from the results of running each element of `object` thru `iteratee`. The + * corresponding inverted value of each inverted key is an array of keys + * responsible for generating the inverted value. The iteratee is invoked + * with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Object + * @param {Object} object The object to invert. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invertBy(object); + * // => { '1': ['a', 'c'], '2': ['b'] } + * + * _.invertBy(object, function(value) { + * return 'group' + value; + * }); + * // => { 'group1': ['a', 'c'], 'group2': ['b'] } + */ + var invertBy = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } + }, getIteratee); + + /** + * Invokes the method at `path` of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + * @example + * + * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; + * + * _.invoke(object, 'a[0].b.c.slice', 1, 3); + * // => [2, 3] + */ + var invoke = baseRest(baseInvoke); + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + } + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + } + + /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * string keyed property of `object` thru `iteratee`. The iteratee is invoked + * with three arguments: (value, key, object). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapValues + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + function mapKeys(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, iteratee(value, key, object), value); + }); + return result; + } + + /** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapKeys + * @example + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * _.mapValues(users, function(o) { return o.age; }); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * + * // The `_.property` iteratee shorthand. + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */ + function mapValues(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, key, iteratee(value, key, object)); + }); + return result; + } + + /** + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively. Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var object = { + * 'a': [{ 'b': 2 }, { 'd': 4 }] + * }; + * + * var other = { + * 'a': [{ 'c': 3 }, { 'e': 5 }] + * }; + * + * _.merge(object, other); + * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } + */ + var merge = createAssigner(function(object, source, srcIndex) { + baseMerge(object, source, srcIndex); + }); + + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined`, merging is handled by the + * method instead. The `customizer` is invoked with six arguments: + * (objValue, srcValue, key, object, source, stack). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { 'a': [1], 'b': [2] }; + * var other = { 'a': [3], 'b': [4] }; + * + * _.mergeWith(object, other, customizer); + * // => { 'a': [1, 3], 'b': [2, 4] } + */ + var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { + baseMerge(object, source, srcIndex, customizer); + }); + + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable property paths of `object` that are not omitted. + * + * **Note:** This method is considerably slower than `_.pick`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to omit. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + var omit = flatRest(function(object, paths) { + var result = {}; + if (object == null) { + return result; + } + var isDeep = false; + paths = arrayMap(paths, function(path) { + path = castPath(path, object); + isDeep || (isDeep = path.length > 1); + return path; + }); + copyObject(object, getAllKeysIn(object), result); + if (isDeep) { + result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + } + var length = paths.length; + while (length--) { + baseUnset(result, paths[length]); + } + return result; + }); + + /** + * The opposite of `_.pickBy`; this method creates an object composed of + * the own and inherited enumerable string keyed properties of `object` that + * `predicate` doesn't return truthy for. The predicate is invoked with two + * arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + function omitBy(object, predicate) { + return pickBy(object, negate(getIteratee(predicate))); + } + + /** + * Creates an object composed of the picked `object` properties. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + var pick = flatRest(function(object, paths) { + return object == null ? {} : basePick(object, paths); + }); + + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + function pickBy(object, predicate) { + if (object == null) { + return {}; + } + var props = arrayMap(getAllKeysIn(object), function(prop) { + return [prop]; + }); + predicate = getIteratee(predicate); + return basePickBy(object, props, function(value, path) { + return predicate(value, path[0]); + }); + } + + /** + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; + * + * _.result(object, 'a[0].b.c1'); + * // => 3 + * + * _.result(object, 'a[0].b.c2'); + * // => 4 + * + * _.result(object, 'a[0].b.c3', 'default'); + * // => 'default' + * + * _.result(object, 'a[0].b.c3', _.constant('default')); + * // => 'default' + */ + function result(object, path, defaultValue) { + path = castPath(path, object); + + var index = -1, + length = path.length; + + // Ensure the loop is entered when path is empty. + if (!length) { + length = 1; + object = undefined$1; + } + while (++index < length) { + var value = object == null ? undefined$1 : object[toKey(path[index])]; + if (value === undefined$1) { + index = length; + value = defaultValue; + } + object = isFunction(value) ? value.call(object) : value; + } + return object; + } + + /** + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, + * it's created. Arrays are created for missing index properties while objects + * are created for all other missing properties. Use `_.setWith` to customize + * `path` creation. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, ['x', '0', 'y', 'z'], 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + return object == null ? object : baseSet(object, path, value); + } + + /** + * This method is like `_.set` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.setWith(object, '[0][1]', 'a', Object); + * // => { '0': { '1': 'a' } } + */ + function setWith(object, path, value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined$1; + return object == null ? object : baseSet(object, path, value, customizer); + } + + /** + * Creates an array of own enumerable string keyed-value pairs for `object` + * which can be consumed by `_.fromPairs`. If `object` is a map or set, its + * entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entries + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairs(new Foo); + * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) + */ + var toPairs = createToPairs(keys); + + /** + * Creates an array of own and inherited enumerable string keyed-value pairs + * for `object` which can be consumed by `_.fromPairs`. If `object` is a map + * or set, its entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entriesIn + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairsIn(new Foo); + * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) + */ + var toPairsIn = createToPairs(keysIn); + + /** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }, []); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ + function transform(object, iteratee, accumulator) { + var isArr = isArray(object), + isArrLike = isArr || isBuffer(object) || isTypedArray(object); + + iteratee = getIteratee(iteratee, 4); + if (accumulator == null) { + var Ctor = object && object.constructor; + if (isArrLike) { + accumulator = isArr ? new Ctor : []; + } + else if (isObject(object)) { + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + } + else { + accumulator = {}; + } + } + (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; + } + + /** + * Removes the property at `path` of `object`. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 7 } }] }; + * _.unset(object, 'a[0].b.c'); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + * + * _.unset(object, ['a', '0', 'b', 'c']); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + */ + function unset(object, path) { + return object == null ? true : baseUnset(object, path); + } + + /** + * This method is like `_.set` except that accepts `updater` to produce the + * value to set. Use `_.updateWith` to customize `path` creation. The `updater` + * is invoked with one argument: (value). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.update(object, 'a[0].b.c', function(n) { return n * n; }); + * console.log(object.a[0].b.c); + * // => 9 + * + * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); + * console.log(object.x[0].y.z); + * // => 0 + */ + function update(object, path, updater) { + return object == null ? object : baseUpdate(object, path, castFunction(updater)); + } + + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + function updateWith(object, path, updater, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined$1; + return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); + } + + /** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ + function values(object) { + return object == null ? [] : baseValues(object, keys(object)); + } + + /** + * Creates an array of the own and inherited enumerable string keyed property + * values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.valuesIn(new Foo); + * // => [1, 2, 3] (iteration order is not guaranteed) + */ + function valuesIn(object) { + return object == null ? [] : baseValues(object, keysIn(object)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Number + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + function clamp(number, lower, upper) { + if (upper === undefined$1) { + upper = lower; + lower = undefined$1; + } + if (upper !== undefined$1) { + upper = toNumber(upper); + upper = upper === upper ? upper : 0; + } + if (lower !== undefined$1) { + lower = toNumber(lower); + lower = lower === lower ? lower : 0; + } + return baseClamp(toNumber(number), lower, upper); + } + + /** + * Checks if `n` is between `start` and up to, but not including, `end`. If + * `end` is not specified, it's set to `start` with `start` then set to `0`. + * If `start` is greater than `end` the params are swapped to support + * negative ranges. + * + * @static + * @memberOf _ + * @since 3.3.0 + * @category Number + * @param {number} number The number to check. + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + * @see _.range, _.rangeRight + * @example + * + * _.inRange(3, 2, 4); + * // => true + * + * _.inRange(4, 8); + * // => true + * + * _.inRange(4, 2); + * // => false + * + * _.inRange(2, 2); + * // => false + * + * _.inRange(1.2, 2); + * // => true + * + * _.inRange(5.2, 4); + * // => false + * + * _.inRange(-3, -2, -6); + * // => true + */ + function inRange(number, start, end) { + start = toFinite(start); + if (end === undefined$1) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + number = toNumber(number); + return baseInRange(number, start, end); + } + + /** + * Produces a random number between the inclusive `lower` and `upper` bounds. + * If only one argument is provided a number between `0` and the given number + * is returned. If `floating` is `true`, or either `lower` or `upper` are + * floats, a floating-point number is returned instead of an integer. + * + * **Note:** JavaScript follows the IEEE-754 standard for resolving + * floating-point values which can produce unexpected results. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Number + * @param {number} [lower=0] The lower bound. + * @param {number} [upper=1] The upper bound. + * @param {boolean} [floating] Specify returning a floating-point number. + * @returns {number} Returns the random number. + * @example + * + * _.random(0, 5); + * // => an integer between 0 and 5 + * + * _.random(5); + * // => also an integer between 0 and 5 + * + * _.random(5, true); + * // => a floating-point number between 0 and 5 + * + * _.random(1.2, 5.2); + * // => a floating-point number between 1.2 and 5.2 + */ + function random(lower, upper, floating) { + if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { + upper = floating = undefined$1; + } + if (floating === undefined$1) { + if (typeof upper == 'boolean') { + floating = upper; + upper = undefined$1; + } + else if (typeof lower == 'boolean') { + floating = lower; + lower = undefined$1; + } + } + if (lower === undefined$1 && upper === undefined$1) { + lower = 0; + upper = 1; + } + else { + lower = toFinite(lower); + if (upper === undefined$1) { + upper = lower; + lower = 0; + } else { + upper = toFinite(upper); + } + } + if (lower > upper) { + var temp = lower; + lower = upper; + upper = temp; + } + if (floating || lower % 1 || upper % 1) { + var rand = nativeRandom(); + return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); + } + return baseRandom(lower, upper); + } + + /*------------------------------------------------------------------------*/ + + /** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar--'); + * // => 'fooBar' + * + * _.camelCase('__FOO_BAR__'); + * // => 'fooBar' + */ + var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? capitalize(word) : word); + }); + + /** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ + function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); + } + + /** + * Deburrs `string` by converting + * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) + * letters to basic Latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ + function deburr(string) { + string = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); + } + + /** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search up to. + * @returns {boolean} Returns `true` if `string` ends with `target`, + * else `false`. + * @example + * + * _.endsWith('abc', 'c'); + * // => true + * + * _.endsWith('abc', 'b'); + * // => false + * + * _.endsWith('abc', 'b', 2); + * // => true + */ + function endsWith(string, target, position) { + string = toString(string); + target = baseToString(target); + + var length = string.length; + position = position === undefined$1 + ? length + : baseClamp(toInteger(position), 0, length); + + var end = position; + position -= target.length; + return position >= 0 && string.slice(position, end) == target; + } + + /** + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. + * + * **Note:** No other characters are escaped. To escape additional + * characters use a third-party library like [_he_](https://mths.be/he). + * + * Though the ">" character is escaped for symmetry, characters like + * ">" and "/" don't need escaping in HTML and have no special meaning + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * (under "semi-related fun fact") for more details. + * + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ + function escape(string) { + string = toString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; + } + + /** + * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", + * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https://lodash\.com/\)' + */ + function escapeRegExp(string) { + string = toString(string); + return (string && reHasRegExpChar.test(string)) + ? string.replace(reRegExpChar, '\\$&') + : string; + } + + /** + * Converts `string` to + * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the kebab cased string. + * @example + * + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' + * + * _.kebabCase('fooBar'); + * // => 'foo-bar' + * + * _.kebabCase('__FOO_BAR__'); + * // => 'foo-bar' + */ + var kebabCase = createCompounder(function(result, word, index) { + return result + (index ? '-' : '') + word.toLowerCase(); + }); + + /** + * Converts `string`, as space separated words, to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.lowerCase('--Foo-Bar--'); + * // => 'foo bar' + * + * _.lowerCase('fooBar'); + * // => 'foo bar' + * + * _.lowerCase('__FOO_BAR__'); + * // => 'foo bar' + */ + var lowerCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + word.toLowerCase(); + }); + + /** + * Converts the first character of `string` to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.lowerFirst('Fred'); + * // => 'fred' + * + * _.lowerFirst('FRED'); + * // => 'fRED' + */ + var lowerFirst = createCaseFirst('toLowerCase'); + + /** + * Pads `string` on the left and right sides if it's shorter than `length`. + * Padding characters are truncated if they can't be evenly divided by `length`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.pad('abc', 8); + * // => ' abc ' + * + * _.pad('abc', 8, '_-'); + * // => '_-abc_-_' + * + * _.pad('abc', 3); + * // => 'abc' + */ + function pad(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + if (!length || strLength >= length) { + return string; + } + var mid = (length - strLength) / 2; + return ( + createPadding(nativeFloor(mid), chars) + + string + + createPadding(nativeCeil(mid), chars) + ); + } + + /** + * Pads `string` on the right side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padEnd('abc', 6); + * // => 'abc ' + * + * _.padEnd('abc', 6, '_-'); + * // => 'abc_-_' + * + * _.padEnd('abc', 3); + * // => 'abc' + */ + function padEnd(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (string + createPadding(length - strLength, chars)) + : string; + } + + /** + * Pads `string` on the left side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padStart('abc', 6); + * // => ' abc' + * + * _.padStart('abc', 6, '_-'); + * // => '_-_abc' + * + * _.padStart('abc', 3); + * // => 'abc' + */ + function padStart(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (createPadding(length - strLength, chars) + string) + : string; + } + + /** + * Converts `string` to an integer of the specified radix. If `radix` is + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a + * hexadecimal, in which case a `radix` of `16` is used. + * + * **Note:** This method aligns with the + * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category String + * @param {string} string The string to convert. + * @param {number} [radix=10] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {number} Returns the converted integer. + * @example + * + * _.parseInt('08'); + * // => 8 + * + * _.map(['6', '08', '10'], _.parseInt); + * // => [6, 8, 10] + */ + function parseInt(string, radix, guard) { + if (guard || radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } + return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); + } + + /** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=1] The number of times to repeat the string. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ + function repeat(string, n, guard) { + if ((guard ? isIterateeCall(string, n, guard) : n === undefined$1)) { + n = 1; + } else { + n = toInteger(n); + } + return baseRepeat(toString(string), n); + } + + /** + * Replaces matches for `pattern` in `string` with `replacement`. + * + * **Note:** This method is based on + * [`String#replace`](https://mdn.io/String/replace). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to modify. + * @param {RegExp|string} pattern The pattern to replace. + * @param {Function|string} replacement The match replacement. + * @returns {string} Returns the modified string. + * @example + * + * _.replace('Hi Fred', 'Fred', 'Barney'); + * // => 'Hi Barney' + */ + function replace() { + var args = arguments, + string = toString(args[0]); + + return args.length < 3 ? string : string.replace(args[1], args[2]); + } + + /** + * Converts `string` to + * [snake case](https://en.wikipedia.org/wiki/Snake_case). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the snake cased string. + * @example + * + * _.snakeCase('Foo Bar'); + * // => 'foo_bar' + * + * _.snakeCase('fooBar'); + * // => 'foo_bar' + * + * _.snakeCase('--FOO-BAR--'); + * // => 'foo_bar' + */ + var snakeCase = createCompounder(function(result, word, index) { + return result + (index ? '_' : '') + word.toLowerCase(); + }); + + /** + * Splits `string` by `separator`. + * + * **Note:** This method is based on + * [`String#split`](https://mdn.io/String/split). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to split. + * @param {RegExp|string} separator The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * @example + * + * _.split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ + function split(string, separator, limit) { + if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { + separator = limit = undefined$1; + } + limit = limit === undefined$1 ? MAX_ARRAY_LENGTH : limit >>> 0; + if (!limit) { + return []; + } + string = toString(string); + if (string && ( + typeof separator == 'string' || + (separator != null && !isRegExp(separator)) + )) { + separator = baseToString(separator); + if (!separator && hasUnicode(string)) { + return castSlice(stringToArray(string), 0, limit); + } + } + return string.split(separator, limit); + } + + /** + * Converts `string` to + * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * + * @static + * @memberOf _ + * @since 3.1.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the start cased string. + * @example + * + * _.startCase('--foo-bar--'); + * // => 'Foo Bar' + * + * _.startCase('fooBar'); + * // => 'Foo Bar' + * + * _.startCase('__FOO_BAR__'); + * // => 'FOO BAR' + */ + var startCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + upperFirst(word); + }); + + /** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=0] The position to search from. + * @returns {boolean} Returns `true` if `string` starts with `target`, + * else `false`. + * @example + * + * _.startsWith('abc', 'a'); + * // => true + * + * _.startsWith('abc', 'b'); + * // => false + * + * _.startsWith('abc', 'b', 1); + * // => true + */ + function startsWith(string, target, position) { + string = toString(string); + position = position == null + ? 0 + : baseClamp(toInteger(position), 0, string.length); + + target = baseToString(target); + return string.slice(position, position + target.length) == target; + } + + /** + * Creates a compiled template function that can interpolate data properties + * in "interpolate" delimiters, HTML-escape interpolated data properties in + * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data + * properties may be accessed as free variables in the template. If a setting + * object is given, it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='lodash.templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the compiled template function. + * @example + * + * // Use the "interpolate" delimiter to create a compiled template. + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // Use the HTML "escape" delimiter to escape data property values. + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': '