@vouchfor/embeds 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/{browser-1b4c09f1.js → browser-f8654733.js} +2 -2
- package/dist/es/{browser-1b4c09f1.js.map → browser-f8654733.js.map} +1 -1
- package/dist/es/embeds.js +1 -1
- package/dist/es/{index-37e10211.js → index-65006a92.js} +2153 -2150
- package/dist/es/index-65006a92.js.map +1 -0
- package/dist/iife/dialog-embed/{browser-aef6773c.js → browser-b36b6e3e.js} +2 -2
- package/dist/iife/dialog-embed/{browser-aef6773c.js.map → browser-b36b6e3e.js.map} +1 -1
- package/dist/iife/dialog-embed/embed.iife.js +83 -83
- package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
- package/dist/iife/dialog-embed/embed.js +1 -1
- package/dist/iife/dialog-embed/{index-98ee90b7.js → index-72887ffc.js} +2420 -2404
- package/dist/iife/dialog-embed/index-72887ffc.js.map +1 -0
- package/dist/iife/embeds.iife.js +82 -82
- package/dist/iife/embeds.iife.js.map +1 -1
- package/dist/iife/player-embed/{browser-3fc50faa.js → browser-69a47b14.js} +2 -2
- package/dist/iife/player-embed/{browser-3fc50faa.js.map → browser-69a47b14.js.map} +1 -1
- package/dist/iife/player-embed/embed.iife.js +80 -80
- package/dist/iife/player-embed/embed.iife.js.map +1 -1
- package/dist/iife/player-embed/embed.js +1 -1
- package/dist/iife/player-embed/{index-ec0750d4.js → index-854590ba.js} +2389 -2373
- package/dist/iife/player-embed/index-854590ba.js.map +1 -0
- package/package.json +2 -2
- package/dist/es/index-37e10211.js.map +0 -1
- package/dist/iife/dialog-embed/index-98ee90b7.js.map +0 -1
- package/dist/iife/player-embed/index-ec0750d4.js.map +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
var I = Object.defineProperty;
|
2
2
|
var q = (o, e, t) => e in o ? I(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
3
3
|
var U = (o, e, t) => (q(o, typeof e != "symbol" ? e + "" : e, t), t);
|
4
|
-
import { c as G, g as H } from "./index-
|
4
|
+
import { c as G, g as H } from "./index-72887ffc.js";
|
5
5
|
function J(o, e) {
|
6
6
|
for (var t = 0; t < e.length; t++) {
|
7
7
|
const r = e[t];
|
@@ -430,4 +430,4 @@ const me = /* @__PURE__ */ H(_), be = /* @__PURE__ */ J({
|
|
430
430
|
export {
|
431
431
|
be as b
|
432
432
|
};
|
433
|
-
//# sourceMappingURL=browser-
|
433
|
+
//# sourceMappingURL=browser-b36b6e3e.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"browser-aef6773c.js","sources":["../../../../../node_modules/path-browserify/index.js","../../../../../node_modules/skia-canvas/lib/io.js","../../../../../node_modules/skia-canvas/lib/browser.js"],"sourcesContent":["// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n","\"use strict\"\n\nconst {basename, extname} = require('path')\n\n//\n// Mime type <-> File extension mappings\n//\n\nclass Format{\n constructor(){\n let isWeb = (() => typeof global=='undefined')(),\n png = \"image/png\",\n jpg = \"image/jpeg\",\n jpeg = \"image/jpeg\",\n webp = \"image/webp\",\n pdf = \"application/pdf\",\n svg = \"image/svg+xml\"\n\n Object.assign(this, {\n toMime: this.toMime.bind(this),\n fromMime: this.fromMime.bind(this),\n expected: isWeb ? `\"png\", \"jpg\", or \"webp\"`\n : `\"png\", \"jpg\", \"pdf\", or \"svg\"`,\n formats: isWeb ? {png, jpg, jpeg, webp}\n : {png, jpg, jpeg, pdf, svg},\n mimes: isWeb ? {[png]: \"png\", [jpg]: \"jpg\", [webp]: \"webp\"}\n : {[png]: \"png\", [jpg]: \"jpg\", [pdf]: \"pdf\", [svg]: \"svg\"},\n })\n }\n\n toMime(ext){\n return this.formats[(ext||'').replace(/^\\./, '').toLowerCase()]\n }\n\n fromMime(mime){\n return this.mimes[mime]\n }\n}\n\n//\n// Validation of the options dict shared by the Canvas saveAs, toBuffer, and toDataURL methods\n//\n\nfunction options(pages, {filename='', extension='', format, page, quality, matte, density, outline, archive}={}){\n var {fromMime, toMime, expected} = new Format(),\n archive = archive || 'canvas',\n ext = format || extension.replace(/@\\d+x$/i,'') || extname(filename),\n format = fromMime(toMime(ext) || ext),\n mime = toMime(format),\n pp = pages.length\n\n if(!ext) throw new Error(`Cannot determine image format (use a filename extension or 'format' argument)`)\n if (!format) throw new Error(`Unsupported file format \"${ext}\" (expected ${expected})`)\n if (!pp) throw new RangeError(`Canvas has no associated contexts (try calling getContext or newPage first)`)\n\n let padding, isSequence, pattern = filename.replace(/{(\\d*)}/g, (_, width) => {\n isSequence = true\n width = parseInt(width, 10)\n padding = isFinite(width) ? width : isFinite(padding) ? padding : -1\n return \"{}\"\n })\n\n // allow negative indexing if a specific page is specified\n let idx = page > 0 ? page - 1\n : page < 0 ? pp + page\n : undefined;\n\n if (isFinite(idx) && idx < 0 || idx >= pp) throw new RangeError(\n pp == 1 ? `Canvas only has a ‘page 1’ (${idx} is out of bounds)`\n : `Canvas has pages 1–${pp} (${idx} is out of bounds)`\n )\n\n pages = isFinite(idx) ? [pages[idx]]\n : isSequence || format=='pdf' ? pages\n : pages.slice(-1) // default to the 'current' context\n\n if (quality===undefined){\n quality = 0.92\n }else{\n if (typeof quality!='number' || !isFinite(quality) || quality<0 || quality>1){\n throw new TypeError(\"The quality option must be an number in the 0.0–1.0 range\")\n }\n }\n\n if (density===undefined){\n let m = (extension || basename(filename, ext)).match(/@(\\d+)x$/i)\n density = m ? parseInt(m[1], 10) : 1\n }else if (typeof density!='number' || !Number.isInteger(density) || density<1){\n throw new TypeError(\"The density option must be a non-negative integer\")\n }\n\n if (outline===undefined){\n outline = true\n }else if (format == 'svg'){\n outline = !!outline\n }\n\n return {filename, pattern, format, mime, pages, padding, quality, matte, density, outline, archive}\n}\n\n//\n// Zip (pace Phil Katz & q.v. https://github.com/jimmywarting/StreamSaver.js)\n//\n\nclass Crc32 {\n static for(data){\n return new Crc32().append(data).get()\n }\n\n constructor(){ this.crc = -1 }\n\n get(){ return ~this.crc }\n\n append(data){\n var crc = this.crc | 0,\n table = this.table\n for (var offset = 0, len = data.length | 0; offset < len; offset++) {\n crc = (crc >>> 8) ^ table[(crc ^ data[offset]) & 0xFF]\n }\n this.crc = crc\n return this\n }\n\n}\n\nCrc32.prototype.table = (() => {\n var i, j, t, table = []\n for (i = 0; i < 256; i++) {\n t = i\n for (j = 0; j < 8; j++) {\n t = (t & 1)\n ? (t >>> 1) ^ 0xEDB88320\n : t >>> 1\n }\n table[i] = t\n }\n return table\n})()\n\nfunction calloc(size){\n let array = new Uint8Array(size),\n view = new DataView(array.buffer),\n buf = {\n array, view, size,\n set8(at, to){ view.setUint8(at, to); return buf },\n set16(at, to){ view.setUint16(at, to, true); return buf },\n set32(at, to){ view.setUint32(at, to, true); return buf },\n bytes(at, to){ array.set(to, at); return buf },\n }\n return buf\n}\n\nclass Zip{\n static encoder = new TextEncoder()\n\n constructor(directory){\n let now = new Date()\n Object.assign(this, {\n directory,\n offset: 0,\n files: [],\n time: (((now.getHours() << 6) | now.getMinutes()) << 5) | now.getSeconds() / 2,\n date: ((((now.getFullYear() - 1980) << 4) | (now.getMonth() + 1)) << 5) | now.getDate(),\n })\n this.add(directory)\n }\n\n async add(filename, blob){\n let folder = !blob,\n name = Zip.encoder.encode(`${this.directory}/${folder ? '' : filename}`),\n data = new Uint8Array(folder ? 0 : await blob.arrayBuffer()),\n preamble = 30 + name.length,\n descriptor = preamble + data.length,\n postamble = 16,\n {offset} = this\n\n let header = calloc(26)\n .set32(0, 0x08080014) // zip version\n .set16(6, this.time) // time\n .set16(8, this.date) // date\n .set32(10, Crc32.for(data)) // checksum\n .set32(14, data.length) // compressed size (w/ zero compression)\n .set32(18, data.length) // un-compressed size\n .set16(22, name.length) // filename length (utf8 bytes)\n offset += preamble\n\n let payload = calloc(preamble + data.length + postamble)\n .set32(0, 0x04034b50) // local header signature\n .bytes(4, header.array) // ...header fields...\n .bytes(30, name) // filename\n .bytes(preamble, data) // blob bytes\n offset += data.length\n\n payload\n .set32(descriptor, 0x08074b50) // signature\n .bytes(descriptor + 4, header.array.slice(10,22)) // length & filemame\n offset += postamble\n\n this.files.push({offset, folder, name, header, payload})\n this.offset = offset\n }\n\n toBuffer(){\n // central directory record\n let length = this.files.reduce((len, {name}) => 46 + name.length + len, 0),\n cdr = calloc(length + 22),\n index = 0\n\n for (var {offset, name, header, folder} of this.files){\n cdr.set32(index, 0x02014b50) // archive file signature\n .set16(index + 4, 0x0014) // version\n .bytes(index + 6, header.array) // ...header fields...\n .set8(index + 38, folder ? 0x10 : 0) // is_dir flag\n .set32(index + 42, offset) // file offset\n .bytes(index + 46, name) // filename\n index += 46 + name.length\n }\n cdr.set32(index, 0x06054b50) // signature\n .set16(index + 8, this.files.length) // № files per-segment\n .set16(index + 10, this.files.length) // № files this segment\n .set32(index + 12, length) // central directory length\n .set32(index + 16, this.offset) // file-offset of directory\n\n // concatenated zipfile data\n let output = new Uint8Array(this.offset + cdr.size),\n cursor = 0;\n\n for (var {payload} of this.files){\n output.set(payload.array, cursor)\n cursor += payload.size\n }\n output.set(cdr.array, cursor)\n\n return output\n }\n\n get blob(){\n return new Blob([this.toBuffer()], {type:\"application/zip\"})\n }\n}\n\n\n//\n// Browser helpers for converting canvas elements to blobs/buffers/files/zips\n//\n\nconst asBlob = (canvas, mime, quality, matte) => {\n if (matte){\n let {width, height} = canvas,\n comp = Object.assign(document.createElement('canvas'), {width, height}),\n ctx = comp.getContext(\"2d\")\n ctx.fillStyle = matte\n ctx.fillRect(0, 0, width, height)\n ctx.drawImage(canvas, 0, 0)\n canvas = comp\n }\n\n return new Promise((res, rej) => canvas.toBlob(res, mime, quality))\n}\n\nconst asBuffer = (...args) => asBlob(...args).then(b => b.arrayBuffer())\n\nconst asDownload = async (canvas, mime, quality, matte, filename) => {\n _download(filename, await asBlob(canvas, mime, quality, matte))\n}\n\nconst asZipDownload = async (pages, mime, quality, matte, archive, pattern, padding) => {\n let filenames = i => pattern.replace('{}', String(i+1).padStart(padding, '0')),\n folder = basename(archive, '.zip') || 'archive',\n zip = new Zip(folder)\n\n await Promise.all(pages.map(async (page, i) => {\n let filename = filenames(i) // serialize filename(s) before awaiting\n await zip.add(filename, await asBlob(page, mime, quality, matte))\n }))\n\n _download(`${folder}.zip`, zip.blob)\n}\n\nconst _download = (filename, blob) => {\n const href = window.URL.createObjectURL(blob),\n link = document.createElement('a')\n link.style.display = 'none'\n link.href = href\n link.setAttribute('download', filename)\n if (typeof link.download === 'undefined') {\n link.setAttribute('target', '_blank')\n }\n document.body.appendChild(link)\n link.click()\n document.body.removeChild(link)\n setTimeout(() => window.URL.revokeObjectURL(href), 100)\n}\n\nconst atScale = (pages, density, matte) => pages.map(page => {\n if (density == 1 && !matte) return page.canvas\n\n let scaled = document.createElement('canvas'),\n ctx = scaled.getContext(\"2d\"),\n src = page.canvas ? page.canvas : page\n scaled.width = src.width * density\n scaled.height = src.height * density\n if (matte){\n ctx.fillStyle = matte\n ctx.fillRect(0, 0, scaled.width, scaled.height)\n }\n ctx.scale(density, density)\n ctx.drawImage(src, 0, 0)\n return scaled\n})\n\nmodule.exports = {asBuffer, asDownload, asZipDownload, atScale, options}\n","\"use strict\"\n\nconst {asBuffer, asDownload, asZipDownload, atScale, options} = require('./io')\n\n//\n// Browser equivalents of the skia-canvas convenience initializers and polyfills for\n// the Canvas object’s newPage & export methods\n//\n\nconst _toURL_ = Symbol.for(\"toDataURL\")\n\nconst loadImage = src => {\n let img = Object.assign(new Image(), {crossOrigin:'Anonymous', src})\n return img.decode().then(() => img)\n}\n\nclass Canvas{\n constructor(width, height){\n let elt = document.createElement('canvas'),\n pages = []\n\n Object.defineProperty(elt, \"async\", {value:true, writable:false, enumerable:true})\n\n for (var [prop, get] of Object.entries({\n png: () => asBuffer(elt, 'image/png'),\n jpg: () => asBuffer(elt, 'image/jpeg'),\n pages: () => pages.concat(elt).map(c => c.getContext(\"2d\")),\n })) Object.defineProperty(elt, prop, {get})\n\n return Object.assign(elt, {\n width, height,\n\n newPage(...size){\n var {width, height} = elt,\n page = Object.assign(document.createElement('canvas'), {width, height})\n page.getContext(\"2d\").drawImage(elt, 0, 0)\n pages.push(page)\n\n var [width, height] = size.length ? size : [width, height]\n return Object.assign(elt, {width, height}).getContext(\"2d\")\n },\n\n saveAs(filename, args){\n args = typeof args=='number' ? {quality:args} : args\n let opts = options(this.pages, {filename, ...args}),\n {pattern, padding, mime, quality, matte, density, archive} = opts,\n pages = atScale(opts.pages, density);\n return padding==undefined ? asDownload(pages[0], mime, quality, matte, filename)\n : asZipDownload(pages, mime, quality, matte, archive, pattern, padding)\n },\n\n toBuffer(extension=\"png\", args={}){\n args = typeof args=='number' ? {quality:args} : args\n let opts = options(this.pages, {extension, ...args}),\n {mime, quality, matte, pages, density} = opts,\n canvas = atScale(pages, density, matte)[0]\n return asBuffer(canvas, mime, quality, matte)\n },\n\n [_toURL_]: elt.toDataURL.bind(elt),\n toDataURL(extension=\"png\", args={}){\n args = typeof args=='number' ? {quality:args} : args\n let opts = options(this.pages, {extension, ...args}),\n {mime, quality, matte, pages, density} = opts,\n canvas = atScale(pages, density, matte)[0],\n url = canvas[canvas===elt ? _toURL_ : 'toDataURL'](mime, quality);\n return Promise.resolve(url)\n }\n })\n }\n}\n\nconst {CanvasRenderingContext2D, CanvasGradient, CanvasPattern,\n Image, ImageData, Path2D, DOMMatrix, DOMRect, DOMPoint} = window;\n\nmodule.exports = {\n Canvas, loadImage,\n CanvasRenderingContext2D, CanvasGradient, CanvasPattern,\n Image, ImageData, Path2D, DOMMatrix, DOMRect, DOMPoint\n}"],"names":["assertPath","path","normalizeStringPosix","allowAboveRoot","res","lastSegmentLength","lastSlash","dots","code","i","lastSlashIndex","_format","sep","pathObject","dir","base","posix","resolvedPath","resolvedAbsolute","cwd","isAbsolute","trailingSeparator","joined","arg","from","to","fromStart","fromEnd","fromLen","toStart","toEnd","toLen","length","lastCommonSep","fromCode","toCode","out","hasRoot","end","matchedSlash","ext","start","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","ret","pathBrowserify","basename","extname","require$$0","Format","isWeb","global","png","jpg","jpeg","webp","pdf","svg","mime","options","pages","filename","extension","format","page","quality","matte","density","outline","archive","fromMime","toMime","expected","pp","padding","isSequence","pattern","_","width","idx","m","Crc32","data","crc","table","offset","len","j","calloc","size","array","view","buf","at","_Zip","directory","now","blob","folder","name","preamble","descriptor","postamble","header","payload","cdr","index","output","cursor","__publicField","Zip","asBlob","canvas","height","comp","ctx","rej","asBuffer","args","b","asDownload","_download","asZipDownload","filenames","zip","href","link","atScale","scaled","src","io","_toURL_","loadImage","img","Image","Canvas","elt","prop","get","c","opts","url","CanvasRenderingContext2D","CanvasGradient","CanvasPattern","ImageData","Path2D","DOMMatrix","DOMRect","DOMPoint","browser"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,SAASA,EAAWC,GAAM;AACxB,MAAI,OAAOA,KAAS;AAClB,UAAM,IAAI,UAAU,qCAAqC,KAAK,UAAUA,CAAI,CAAC;AAEjF;AAGA,SAASC,EAAqBD,GAAME,GAAgB;AAMlD,WALIC,IAAM,IACNC,IAAoB,GACpBC,IAAY,IACZC,IAAO,GACPC,GACKC,IAAI,GAAGA,KAAKR,EAAK,QAAQ,EAAEQ,GAAG;AACrC,QAAIA,IAAIR,EAAK;AACX,MAAAO,IAAOP,EAAK,WAAWQ,CAAC;AAAA,SACrB;AAAA,UAAID,MAAS;A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AAO,GAAS,OAAAC,GAAO,OAAAN,GAAO,SAAAO,EAAO,IAAIyE,GACzC5B,IAASe,EAAQnE,GAAOO,GAASD,CAAK,EAAE,CAAC,GACzC2E,IAAM7B,EAAOA,MAASwB,IAAML,IAAU,WAAW,EAAEzE,GAAMO,CAAO;AACpE,eAAO,QAAQ,QAAQ4E,CAAG;AAAA,MAC3B;AAAA,IACP,CAAK;AAAA,EACF;AACH;AAEA,MAAM;AAAA,EAAC,0BAAAC;AAAA,EAA0B,gBAAAC;AAAA,EAAgB,eAAAC;AAAA,EAC1C,OAAAV;AAAA,EAAO,WAAAW;AAAA,EAAW,QAAAC;AAAA,EAAQ,WAAAC;AAAA,EAAW,SAAAC;AAAA,EAAS,UAAAC;AAAQ,IAAI;AAEjE,IAAAC,IAAiB;AAAA,EACf,QAAAf;AAAA,EAAQ,WAAAH;AAAA,EACR,0BAAAU;AAAA,EAA0B,gBAAAC;AAAA,EAAgB,eAAAC;AAAA,EAC1C,OAAAV;AAAA,EAAO,WAAAW;AAAA,EAAW,QAAAC;AAAA,EAAQ,WAAAC;AAAA,EAAW,SAAAC;AAAA,EAAS,UAAAC;AAChD;;;;;","x_google_ignoreList":[0,1,2]}
|
1
|
+
{"version":3,"file":"browser-b36b6e3e.js","sources":["../../../../../node_modules/path-browserify/index.js","../../../../../node_modules/skia-canvas/lib/io.js","../../../../../node_modules/skia-canvas/lib/browser.js"],"sourcesContent":["// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n","\"use strict\"\n\nconst {basename, extname} = require('path')\n\n//\n// Mime type <-> File extension mappings\n//\n\nclass Format{\n constructor(){\n let isWeb = (() => typeof global=='undefined')(),\n png = \"image/png\",\n jpg = \"image/jpeg\",\n jpeg = \"image/jpeg\",\n webp = \"image/webp\",\n pdf = \"application/pdf\",\n svg = \"image/svg+xml\"\n\n Object.assign(this, {\n toMime: this.toMime.bind(this),\n fromMime: this.fromMime.bind(this),\n expected: isWeb ? `\"png\", \"jpg\", or \"webp\"`\n : `\"png\", \"jpg\", \"pdf\", or \"svg\"`,\n formats: isWeb ? {png, jpg, jpeg, webp}\n : {png, jpg, jpeg, pdf, svg},\n mimes: isWeb ? {[png]: \"png\", [jpg]: \"jpg\", [webp]: \"webp\"}\n : {[png]: \"png\", [jpg]: \"jpg\", [pdf]: \"pdf\", [svg]: \"svg\"},\n })\n }\n\n toMime(ext){\n return this.formats[(ext||'').replace(/^\\./, '').toLowerCase()]\n }\n\n fromMime(mime){\n return this.mimes[mime]\n }\n}\n\n//\n// Validation of the options dict shared by the Canvas saveAs, toBuffer, and toDataURL methods\n//\n\nfunction options(pages, {filename='', extension='', format, page, quality, matte, density, outline, archive}={}){\n var {fromMime, toMime, expected} = new Format(),\n archive = archive || 'canvas',\n ext = format || extension.replace(/@\\d+x$/i,'') || extname(filename),\n format = fromMime(toMime(ext) || ext),\n mime = toMime(format),\n pp = pages.length\n\n if(!ext) throw new Error(`Cannot determine image format (use a filename extension or 'format' argument)`)\n if (!format) throw new Error(`Unsupported file format \"${ext}\" (expected ${expected})`)\n if (!pp) throw new RangeError(`Canvas has no associated contexts (try calling getContext or newPage first)`)\n\n let padding, isSequence, pattern = filename.replace(/{(\\d*)}/g, (_, width) => {\n isSequence = true\n width = parseInt(width, 10)\n padding = isFinite(width) ? width : isFinite(padding) ? padding : -1\n return \"{}\"\n })\n\n // allow negative indexing if a specific page is specified\n let idx = page > 0 ? page - 1\n : page < 0 ? pp + page\n : undefined;\n\n if (isFinite(idx) && idx < 0 || idx >= pp) throw new RangeError(\n pp == 1 ? `Canvas only has a ‘page 1’ (${idx} is out of bounds)`\n : `Canvas has pages 1–${pp} (${idx} is out of bounds)`\n )\n\n pages = isFinite(idx) ? [pages[idx]]\n : isSequence || format=='pdf' ? pages\n : pages.slice(-1) // default to the 'current' context\n\n if (quality===undefined){\n quality = 0.92\n }else{\n if (typeof quality!='number' || !isFinite(quality) || quality<0 || quality>1){\n throw new TypeError(\"The quality option must be an number in the 0.0–1.0 range\")\n }\n }\n\n if (density===undefined){\n let m = (extension || basename(filename, ext)).match(/@(\\d+)x$/i)\n density = m ? parseInt(m[1], 10) : 1\n }else if (typeof density!='number' || !Number.isInteger(density) || density<1){\n throw new TypeError(\"The density option must be a non-negative integer\")\n }\n\n if (outline===undefined){\n outline = true\n }else if (format == 'svg'){\n outline = !!outline\n }\n\n return {filename, pattern, format, mime, pages, padding, quality, matte, density, outline, archive}\n}\n\n//\n// Zip (pace Phil Katz & q.v. https://github.com/jimmywarting/StreamSaver.js)\n//\n\nclass Crc32 {\n static for(data){\n return new Crc32().append(data).get()\n }\n\n constructor(){ this.crc = -1 }\n\n get(){ return ~this.crc }\n\n append(data){\n var crc = this.crc | 0,\n table = this.table\n for (var offset = 0, len = data.length | 0; offset < len; offset++) {\n crc = (crc >>> 8) ^ table[(crc ^ data[offset]) & 0xFF]\n }\n this.crc = crc\n return this\n }\n\n}\n\nCrc32.prototype.table = (() => {\n var i, j, t, table = []\n for (i = 0; i < 256; i++) {\n t = i\n for (j = 0; j < 8; j++) {\n t = (t & 1)\n ? (t >>> 1) ^ 0xEDB88320\n : t >>> 1\n }\n table[i] = t\n }\n return table\n})()\n\nfunction calloc(size){\n let array = new Uint8Array(size),\n view = new DataView(array.buffer),\n buf = {\n array, view, size,\n set8(at, to){ view.setUint8(at, to); return buf },\n set16(at, to){ view.setUint16(at, to, true); return buf },\n set32(at, to){ view.setUint32(at, to, true); return buf },\n bytes(at, to){ array.set(to, at); return buf },\n }\n return buf\n}\n\nclass Zip{\n static encoder = new TextEncoder()\n\n constructor(directory){\n let now = new Date()\n Object.assign(this, {\n directory,\n offset: 0,\n files: [],\n time: (((now.getHours() << 6) | now.getMinutes()) << 5) | now.getSeconds() / 2,\n date: ((((now.getFullYear() - 1980) << 4) | (now.getMonth() + 1)) << 5) | now.getDate(),\n })\n this.add(directory)\n }\n\n async add(filename, blob){\n let folder = !blob,\n name = Zip.encoder.encode(`${this.directory}/${folder ? '' : filename}`),\n data = new Uint8Array(folder ? 0 : await blob.arrayBuffer()),\n preamble = 30 + name.length,\n descriptor = preamble + data.length,\n postamble = 16,\n {offset} = this\n\n let header = calloc(26)\n .set32(0, 0x08080014) // zip version\n .set16(6, this.time) // time\n .set16(8, this.date) // date\n .set32(10, Crc32.for(data)) // checksum\n .set32(14, data.length) // compressed size (w/ zero compression)\n .set32(18, data.length) // un-compressed size\n .set16(22, name.length) // filename length (utf8 bytes)\n offset += preamble\n\n let payload = calloc(preamble + data.length + postamble)\n .set32(0, 0x04034b50) // local header signature\n .bytes(4, header.array) // ...header fields...\n .bytes(30, name) // filename\n .bytes(preamble, data) // blob bytes\n offset += data.length\n\n payload\n .set32(descriptor, 0x08074b50) // signature\n .bytes(descriptor + 4, header.array.slice(10,22)) // length & filemame\n offset += postamble\n\n this.files.push({offset, folder, name, header, payload})\n this.offset = offset\n }\n\n toBuffer(){\n // central directory record\n let length = this.files.reduce((len, {name}) => 46 + name.length + len, 0),\n cdr = calloc(length + 22),\n index = 0\n\n for (var {offset, name, header, folder} of this.files){\n cdr.set32(index, 0x02014b50) // archive file signature\n .set16(index + 4, 0x0014) // version\n .bytes(index + 6, header.array) // ...header fields...\n .set8(index + 38, folder ? 0x10 : 0) // is_dir flag\n .set32(index + 42, offset) // file offset\n .bytes(index + 46, name) // filename\n index += 46 + name.length\n }\n cdr.set32(index, 0x06054b50) // signature\n .set16(index + 8, this.files.length) // № files per-segment\n .set16(index + 10, this.files.length) // № files this segment\n .set32(index + 12, length) // central directory length\n .set32(index + 16, this.offset) // file-offset of directory\n\n // concatenated zipfile data\n let output = new Uint8Array(this.offset + cdr.size),\n cursor = 0;\n\n for (var {payload} of this.files){\n output.set(payload.array, cursor)\n cursor += payload.size\n }\n output.set(cdr.array, cursor)\n\n return output\n }\n\n get blob(){\n return new Blob([this.toBuffer()], {type:\"application/zip\"})\n }\n}\n\n\n//\n// Browser helpers for converting canvas elements to blobs/buffers/files/zips\n//\n\nconst asBlob = (canvas, mime, quality, matte) => {\n if (matte){\n let {width, height} = canvas,\n comp = Object.assign(document.createElement('canvas'), {width, height}),\n ctx = comp.getContext(\"2d\")\n ctx.fillStyle = matte\n ctx.fillRect(0, 0, width, height)\n ctx.drawImage(canvas, 0, 0)\n canvas = comp\n }\n\n return new Promise((res, rej) => canvas.toBlob(res, mime, quality))\n}\n\nconst asBuffer = (...args) => asBlob(...args).then(b => b.arrayBuffer())\n\nconst asDownload = async (canvas, mime, quality, matte, filename) => {\n _download(filename, await asBlob(canvas, mime, quality, matte))\n}\n\nconst asZipDownload = async (pages, mime, quality, matte, archive, pattern, padding) => {\n let filenames = i => pattern.replace('{}', String(i+1).padStart(padding, '0')),\n folder = basename(archive, '.zip') || 'archive',\n zip = new Zip(folder)\n\n await Promise.all(pages.map(async (page, i) => {\n let filename = filenames(i) // serialize filename(s) before awaiting\n await zip.add(filename, await asBlob(page, mime, quality, matte))\n }))\n\n _download(`${folder}.zip`, zip.blob)\n}\n\nconst _download = (filename, blob) => {\n const href = window.URL.createObjectURL(blob),\n link = document.createElement('a')\n link.style.display = 'none'\n link.href = href\n link.setAttribute('download', filename)\n if (typeof link.download === 'undefined') {\n link.setAttribute('target', '_blank')\n }\n document.body.appendChild(link)\n link.click()\n document.body.removeChild(link)\n setTimeout(() => window.URL.revokeObjectURL(href), 100)\n}\n\nconst atScale = (pages, density, matte) => pages.map(page => {\n if (density == 1 && !matte) return page.canvas\n\n let scaled = document.createElement('canvas'),\n ctx = scaled.getContext(\"2d\"),\n src = page.canvas ? page.canvas : page\n scaled.width = src.width * density\n scaled.height = src.height * density\n if (matte){\n ctx.fillStyle = matte\n ctx.fillRect(0, 0, scaled.width, scaled.height)\n }\n ctx.scale(density, density)\n ctx.drawImage(src, 0, 0)\n return scaled\n})\n\nmodule.exports = {asBuffer, asDownload, asZipDownload, atScale, options}\n","\"use strict\"\n\nconst {asBuffer, asDownload, asZipDownload, atScale, options} = require('./io')\n\n//\n// Browser equivalents of the skia-canvas convenience initializers and polyfills for\n// the Canvas object’s newPage & export methods\n//\n\nconst _toURL_ = Symbol.for(\"toDataURL\")\n\nconst loadImage = src => {\n let img = Object.assign(new Image(), {crossOrigin:'Anonymous', src})\n return img.decode().then(() => img)\n}\n\nclass Canvas{\n constructor(width, height){\n let elt = document.createElement('canvas'),\n pages = []\n\n Object.defineProperty(elt, \"async\", {value:true, writable:false, enumerable:true})\n\n for (var [prop, get] of Object.entries({\n png: () => asBuffer(elt, 'image/png'),\n jpg: () => asBuffer(elt, 'image/jpeg'),\n pages: () => pages.concat(elt).map(c => c.getContext(\"2d\")),\n })) Object.defineProperty(elt, prop, {get})\n\n return Object.assign(elt, {\n width, height,\n\n newPage(...size){\n var {width, height} = elt,\n page = Object.assign(document.createElement('canvas'), {width, height})\n page.getContext(\"2d\").drawImage(elt, 0, 0)\n pages.push(page)\n\n var [width, height] = size.length ? size : [width, height]\n return Object.assign(elt, {width, height}).getContext(\"2d\")\n },\n\n saveAs(filename, args){\n args = typeof args=='number' ? {quality:args} : args\n let opts = options(this.pages, {filename, ...args}),\n {pattern, padding, mime, quality, matte, density, archive} = opts,\n pages = atScale(opts.pages, density);\n return padding==undefined ? asDownload(pages[0], mime, quality, matte, filename)\n : asZipDownload(pages, mime, quality, matte, archive, pattern, padding)\n },\n\n toBuffer(extension=\"png\", args={}){\n args = typeof args=='number' ? {quality:args} : args\n let opts = options(this.pages, {extension, ...args}),\n {mime, quality, matte, pages, density} = opts,\n canvas = atScale(pages, density, matte)[0]\n return asBuffer(canvas, mime, quality, matte)\n },\n\n [_toURL_]: elt.toDataURL.bind(elt),\n toDataURL(extension=\"png\", args={}){\n args = typeof args=='number' ? {quality:args} : args\n let opts = options(this.pages, {extension, ...args}),\n {mime, quality, matte, pages, density} = opts,\n canvas = atScale(pages, density, matte)[0],\n url = canvas[canvas===elt ? _toURL_ : 'toDataURL'](mime, quality);\n return Promise.resolve(url)\n }\n })\n }\n}\n\nconst {CanvasRenderingContext2D, CanvasGradient, CanvasPattern,\n Image, ImageData, Path2D, DOMMatrix, DOMRect, DOMPoint} = window;\n\nmodule.exports = {\n Canvas, loadImage,\n CanvasRenderingContext2D, CanvasGradient, CanvasPattern,\n Image, ImageData, Path2D, DOMMatrix, DOMRect, DOMPoint\n}"],"names":["assertPath","path","normalizeStringPosix","allowAboveRoot","res","lastSegmentLength","lastSlash","dots","code","i","lastSlashIndex","_format","sep","pathObject","dir","base","posix","resolvedPath","resolvedAbsolute","cwd","isAbsolute","trailingSeparator","joined","arg","from","to","fromStart","fromEnd","fromLen","toStart","toEnd","toLen","length","lastCommonSep","fromCode","toCode","out","hasRoot","end","matchedSlash","ext","start","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","ret","pathBrowserify","basename","extname","require$$0","Format","isWeb","global","png","jpg","jpeg","webp","pdf","svg","mime","options","pages","filename","extension","format","page","quality","matte","density","outline","archive","fromMime","toMime","expected","pp","padding","isSequence","pattern","_","width","idx","m","Crc32","data","crc","table","offset","len","j","calloc","size","array","view","buf","at","_Zip","directory","now","blob","folder","name","preamble","descriptor","postamble","header","payload","cdr","index","output","cursor","__publicField","Zip","asBlob","canvas","height","comp","ctx","rej","asBuffer","args","b","asDownload","_download","asZipDownload","filenames","zip","href","link","atScale","scaled","src","io","_toURL_","loadImage","img","Image","Canvas","elt","prop","get","c","opts","url","CanvasRenderingContext2D","CanvasGradient","CanvasPattern","ImageData","Path2D","DO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