into a string.\n *\n * @param {BaseNameOrCode} [base=this.multibaseName] - Base encoding to use.\n * @returns {string}\n */\n toString (base) {\n return this.toBaseEncodedString(base)\n }\n\n /**\n * Serialize to a plain object.\n *\n * @returns {SerializedCID}\n */\n toJSON () {\n return {\n codec: this.codec,\n version: this.version,\n hash: this.multihash\n }\n }\n\n /**\n * Compare equality with another CID.\n *\n * @param {CID} other\n * @returns {boolean}\n */\n equals (other) {\n return this.codec === other.codec &&\n this.version === other.version &&\n uint8ArrayEquals(this.multihash, other.multihash)\n }\n\n /**\n * Test if the given input is a valid CID object.\n * Throws if it is not.\n *\n * @param {any} other - The other CID.\n * @returns {void}\n */\n static validateCID (other) {\n const errorMsg = CIDUtil.checkCIDComponents(other)\n if (errorMsg) {\n throw new Error(errorMsg)\n }\n }\n\n /**\n * Check if object is a CID instance\n *\n * @param {any} value\n * @returns {value is CID}\n */\n static isCID (value) {\n return value instanceof CID || Boolean(value && value[symbol])\n }\n}\n\nCID.codecs = codecs\n\nmodule.exports = CID\n","/**\n * Multihash implementation in JavaScript.\n *\n * @module multihash\n */\n'use strict'\n\nconst multibase = require('multibase')\nconst varint = require('varint')\nconst { names } = require('./constants')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\nconst uint8ArrayConcat = require('uint8arrays/concat')\n\nconst codes = /** @type {import('./types').CodeNameMap} */({})\n\n// eslint-disable-next-line guard-for-in\nfor (const key in names) {\n const name = /** @type {HashName} */(key)\n codes[names[name]] = name\n}\n\n/**\n * Convert the given multihash to a hex encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toHexString (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(hash, 'base16')\n}\n\n/**\n * Convert the given hex encoded string to a multihash.\n *\n * @param {string} hash\n * @returns {Uint8Array}\n */\nfunction fromHexString (hash) {\n return uint8ArrayFromString(hash, 'base16')\n}\n\n/**\n * Convert the given multihash to a base58 encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toB58String (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1)\n}\n\n/**\n * Convert the given base58 encoded string to a multihash.\n *\n * @param {string|Uint8Array} hash\n * @returns {Uint8Array}\n */\nfunction fromB58String (hash) {\n const encoded = hash instanceof Uint8Array\n ? uint8ArrayToString(hash)\n : hash\n\n return multibase.decode('z' + encoded)\n}\n\n/**\n * Decode a hash from the given multihash.\n *\n * @param {Uint8Array} bytes\n * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result\n */\nfunction decode (bytes) {\n if (!(bytes instanceof Uint8Array)) {\n throw new Error('multihash must be a Uint8Array')\n }\n\n if (bytes.length < 2) {\n throw new Error('multihash too short. must be > 2 bytes.')\n }\n\n const code = /** @type {HashCode} */(varint.decode(bytes))\n if (!isValidCode(code)) {\n throw new Error(`multihash unknown function code: 0x${code.toString(16)}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n const len = varint.decode(bytes)\n if (len < 0) {\n throw new Error(`multihash invalid length: ${len}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n if (bytes.length !== len) {\n throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`)\n }\n\n return {\n code,\n name: codes[code],\n length: len,\n digest: bytes\n }\n}\n\n/**\n * Encode a hash digest along with the specified function code.\n *\n * > **Note:** the length is derived from the length of the digest itself.\n *\n * @param {Uint8Array} digest\n * @param {HashName | HashCode} code\n * @param {number} [length]\n * @returns {Uint8Array}\n */\nfunction encode (digest, code, length) {\n if (!digest || code === undefined) {\n throw new Error('multihash encode requires at least two args: digest, code')\n }\n\n // ensure it's a hashfunction code.\n const hashfn = coerceCode(code)\n\n if (!(digest instanceof Uint8Array)) {\n throw new Error('digest should be a Uint8Array')\n }\n\n if (length == null) {\n length = digest.length\n }\n\n if (length && digest.length !== length) {\n throw new Error('digest length should be equal to specified length.')\n }\n\n const hash = varint.encode(hashfn)\n const len = varint.encode(length)\n return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length)\n}\n\n/**\n * Converts a hash function name into the matching code.\n * If passed a number it will return the number if it's a valid code.\n *\n * @param {HashName | number} name\n * @returns {number}\n */\nfunction coerceCode (name) {\n let code = name\n\n if (typeof name === 'string') {\n if (names[name] === undefined) {\n throw new Error(`Unrecognized hash function named: ${name}`)\n }\n code = names[name]\n }\n\n if (typeof code !== 'number') {\n throw new Error(`Hash function code should be a number. Got: ${code}`)\n }\n\n // @ts-ignore\n if (codes[code] === undefined && !isAppCode(code)) {\n throw new Error(`Unrecognized function code: ${code}`)\n }\n\n return code\n}\n\n/**\n * Checks if a code is part of the app range\n *\n * @param {number} code\n * @returns {boolean}\n */\nfunction isAppCode (code) {\n return code > 0 && code < 0x10\n}\n\n/**\n * Checks whether a multihash code is valid.\n *\n * @param {HashCode} code\n * @returns {boolean}\n */\nfunction isValidCode (code) {\n if (isAppCode(code)) {\n return true\n }\n\n if (codes[code]) {\n return true\n }\n\n return false\n}\n\n/**\n * Check if the given buffer is a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {void}\n * @throws {Error}\n */\nfunction validate (multihash) {\n decode(multihash) // throws if bad.\n}\n\n/**\n * Returns a prefix from a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n * @throws {Error}\n */\nfunction prefix (multihash) {\n validate(multihash)\n\n return multihash.subarray(0, 2)\n}\n\nmodule.exports = {\n names,\n codes: Object.freeze(codes),\n toHexString,\n fromHexString,\n toB58String,\n fromB58String,\n decode,\n encode,\n coerceCode,\n isAppCode,\n validate,\n prefix,\n isValidCode\n}\n\n/**\n * @typedef { import(\"./constants\").HashCode } HashCode\n * @typedef { import(\"./constants\").HashName } HashName\n */\n","module.exports = {\n encode: require('./encode.js')\n , decode: require('./decode.js')\n , encodingLength: require('./length.js')\n}\n","'use strict'\n\nconst varint = require('varint')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\n\nmodule.exports = {\n numberToUint8Array,\n uint8ArrayToNumber,\n varintUint8ArrayEncode,\n varintEncode\n}\n\nfunction uint8ArrayToNumber (buf) {\n return parseInt(uint8ArrayToString(buf, 'base16'), 16)\n}\n\nfunction numberToUint8Array (num) {\n let hexString = num.toString(16)\n if (hexString.length % 2 === 1) {\n hexString = '0' + hexString\n }\n return uint8ArrayFromString(hexString, 'base16')\n}\n\nfunction varintUint8ArrayEncode (input) {\n return Uint8Array.from(varint.encode(uint8ArrayToNumber(input)))\n}\n\nfunction varintEncode (num) {\n return Uint8Array.from(varint.encode(num))\n}\n","'use strict'\n\nconst { names } = require('multibase/src/constants')\nconst { TextEncoder } = require('web-encoding')\nconst utf8Encoder = new TextEncoder()\n\n/**\n * Interperets each character in a string as a byte and\n * returns a Uint8Array of those bytes.\n *\n * @param {String} string The string to turn into an array\n * @returns {Uint8Array}\n */\nfunction asciiStringToUint8Array (string) {\n const array = new Uint8Array(string.length)\n\n for (let i = 0; i < string.length; i++) {\n array[i] = string.charCodeAt(i)\n }\n\n return array\n}\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {String} string\n * @param {String} [encoding=utf8] utf8, base16, base64, base64urlpad, etc\n * @returns {Uint8Array}\n * @see {@link https://www.npmjs.com/package/multibase|multibase} for supported encodings other than `utf8`\n */\nfunction fromString (string, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Encoder.encode(string)\n }\n\n if (encoding === 'ascii') {\n return asciiStringToUint8Array(string)\n }\n\n const codec = names[encoding]\n\n if (!codec) {\n throw new Error('Unknown base')\n }\n\n return codec.decode(string)\n}\n\nmodule.exports = fromString\n","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeReflectConstruct = require(\"./isNativeReflectConstruct\");\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;","function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nmodule.exports = _isNativeReflectConstruct;","/**\n * Multihash implementation in JavaScript.\n */\n'use strict'\n\nconst multibase = require('multibase')\nconst varint = require('varint')\nconst { names } = require('./constants')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\nconst uint8ArrayConcat = require('uint8arrays/concat')\n\nconst codes = /** @type {import('./types').CodeNameMap} */({})\n\n// eslint-disable-next-line guard-for-in\nfor (const key in names) {\n const name = /** @type {HashName} */(key)\n codes[names[name]] = name\n}\nObject.freeze(codes)\n\n/**\n * Convert the given multihash to a hex encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toHexString (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(hash, 'base16')\n}\n\n/**\n * Convert the given hex encoded string to a multihash.\n *\n * @param {string} hash\n * @returns {Uint8Array}\n */\nfunction fromHexString (hash) {\n return uint8ArrayFromString(hash, 'base16')\n}\n\n/**\n * Convert the given multihash to a base58 encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toB58String (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1)\n}\n\n/**\n * Convert the given base58 encoded string to a multihash.\n *\n * @param {string|Uint8Array} hash\n * @returns {Uint8Array}\n */\nfunction fromB58String (hash) {\n const encoded = hash instanceof Uint8Array\n ? uint8ArrayToString(hash)\n : hash\n\n return multibase.decode('z' + encoded)\n}\n\n/**\n * Decode a hash from the given multihash.\n *\n * @param {Uint8Array} bytes\n * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result\n */\nfunction decode (bytes) {\n if (!(bytes instanceof Uint8Array)) {\n throw new Error('multihash must be a Uint8Array')\n }\n\n if (bytes.length < 2) {\n throw new Error('multihash too short. must be > 2 bytes.')\n }\n\n const code = /** @type {HashCode} */(varint.decode(bytes))\n if (!isValidCode(code)) {\n throw new Error(`multihash unknown function code: 0x${code.toString(16)}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n const len = varint.decode(bytes)\n if (len < 0) {\n throw new Error(`multihash invalid length: ${len}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n if (bytes.length !== len) {\n throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`)\n }\n\n return {\n code,\n name: codes[code],\n length: len,\n digest: bytes\n }\n}\n\n/**\n * Encode a hash digest along with the specified function code.\n *\n * > **Note:** the length is derived from the length of the digest itself.\n *\n * @param {Uint8Array} digest\n * @param {HashName | HashCode} code\n * @param {number} [length]\n * @returns {Uint8Array}\n */\nfunction encode (digest, code, length) {\n if (!digest || code === undefined) {\n throw new Error('multihash encode requires at least two args: digest, code')\n }\n\n // ensure it's a hashfunction code.\n const hashfn = coerceCode(code)\n\n if (!(digest instanceof Uint8Array)) {\n throw new Error('digest should be a Uint8Array')\n }\n\n if (length == null) {\n length = digest.length\n }\n\n if (length && digest.length !== length) {\n throw new Error('digest length should be equal to specified length.')\n }\n\n const hash = varint.encode(hashfn)\n const len = varint.encode(length)\n return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length)\n}\n\n/**\n * Converts a hash function name into the matching code.\n * If passed a number it will return the number if it's a valid code.\n *\n * @param {HashName | number} name\n * @returns {number}\n */\nfunction coerceCode (name) {\n let code = name\n\n if (typeof name === 'string') {\n if (names[name] === undefined) {\n throw new Error(`Unrecognized hash function named: ${name}`)\n }\n code = names[name]\n }\n\n if (typeof code !== 'number') {\n throw new Error(`Hash function code should be a number. Got: ${code}`)\n }\n\n // @ts-ignore\n if (codes[code] === undefined && !isAppCode(code)) {\n throw new Error(`Unrecognized function code: ${code}`)\n }\n\n return code\n}\n\n/**\n * Checks if a code is part of the app range\n *\n * @param {number} code\n * @returns {boolean}\n */\nfunction isAppCode (code) {\n return code > 0 && code < 0x10\n}\n\n/**\n * Checks whether a multihash code is valid.\n *\n * @param {HashCode} code\n * @returns {boolean}\n */\nfunction isValidCode (code) {\n if (isAppCode(code)) {\n return true\n }\n\n if (codes[code]) {\n return true\n }\n\n return false\n}\n\n/**\n * Check if the given buffer is a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {void}\n * @throws {Error}\n */\nfunction validate (multihash) {\n decode(multihash) // throws if bad.\n}\n\n/**\n * Returns a prefix from a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n * @throws {Error}\n */\nfunction prefix (multihash) {\n validate(multihash)\n\n return multihash.subarray(0, 2)\n}\n\nmodule.exports = {\n names,\n codes,\n toHexString,\n fromHexString,\n toB58String,\n fromB58String,\n decode,\n encode,\n coerceCode,\n isAppCode,\n validate,\n prefix,\n isValidCode\n}\n\n/**\n * @typedef { import(\"./constants\").HashCode } HashCode\n * @typedef { import(\"./constants\").HashName } HashName\n */\n","'use strict'\n\nconst { encoding: getCodec } = require('multibase')\nconst { TextEncoder } = require('web-encoding')\nconst utf8Encoder = new TextEncoder()\n\n/**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n/**\n * Interprets each character in a string as a byte and\n * returns a Uint8Array of those bytes.\n *\n * @param {string} string - The string to turn into an array\n */\nfunction asciiStringToUint8Array (string) {\n const array = new Uint8Array(string.length)\n\n for (let i = 0; i < string.length; i++) {\n array[i] = string.charCodeAt(i)\n }\n\n return array\n}\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {string} string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - utf8, base16, base64, base64urlpad, etc\n * @returns {Uint8Array}\n */\nfunction fromString (string, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Encoder.encode(string)\n }\n\n if (encoding === 'ascii') {\n return asciiStringToUint8Array(string)\n }\n\n return getCodec(encoding).decode(string)\n}\n\nmodule.exports = fromString\n","'use strict'\n\nconst varint = require('varint')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\n\nmodule.exports = {\n numberToUint8Array,\n uint8ArrayToNumber,\n varintUint8ArrayEncode,\n varintEncode\n}\n\n/**\n * @param {Uint8Array} buf\n */\nfunction uint8ArrayToNumber (buf) {\n return parseInt(uint8ArrayToString(buf, 'base16'), 16)\n}\n\n/**\n * @param {number} num\n */\nfunction numberToUint8Array (num) {\n let hexString = num.toString(16)\n if (hexString.length % 2 === 1) {\n hexString = '0' + hexString\n }\n return uint8ArrayFromString(hexString, 'base16')\n}\n\n/**\n * @param {Uint8Array} input\n */\nfunction varintUint8ArrayEncode (input) {\n return Uint8Array.from(varint.encode(uint8ArrayToNumber(input)))\n}\n\n/**\n * @param {number} num\n */\nfunction varintEncode (num) {\n return Uint8Array.from(varint.encode(num))\n}\n","'use strict'\n\nconst isReactNative =\n typeof navigator !== 'undefined' &&\n navigator.product === 'ReactNative'\n\nfunction getDefaultBase () {\n if (isReactNative) {\n return 'http://localhost'\n }\n\n return self.location.protocol + '//' + self.location.host\n}\n\nconst URL = self.URL\nconst defaultBase = getDefaultBase()\n\nclass URLWithLegacySupport {\n constructor (url = '', base = defaultBase) {\n this.super = new URL(url, base)\n this.path = this.pathname + this.search\n this.auth =\n this.username && this.password\n ? this.username + ':' + this.password\n : null\n\n this.query =\n this.search && this.search.startsWith('?')\n ? this.search.slice(1)\n : null\n }\n\n get hash () {\n return this.super.hash\n }\n\n get host () {\n return this.super.host\n }\n\n get hostname () {\n return this.super.hostname\n }\n\n get href () {\n return this.super.href\n }\n\n get origin () {\n return this.super.origin\n }\n\n get password () {\n return this.super.password\n }\n\n get pathname () {\n return this.super.pathname\n }\n\n get port () {\n return this.super.port\n }\n\n get protocol () {\n return this.super.protocol\n }\n\n get search () {\n return this.super.search\n }\n\n get searchParams () {\n return this.super.searchParams\n }\n\n get username () {\n return this.super.username\n }\n\n set hash (hash) {\n this.super.hash = hash\n }\n\n set host (host) {\n this.super.host = host\n }\n\n set hostname (hostname) {\n this.super.hostname = hostname\n }\n\n set href (href) {\n this.super.href = href\n }\n\n set password (password) {\n this.super.password = password\n }\n\n set pathname (pathname) {\n this.super.pathname = pathname\n }\n\n set port (port) {\n this.super.port = port\n }\n\n set protocol (protocol) {\n this.super.protocol = protocol\n }\n\n set search (search) {\n this.super.search = search\n }\n\n set username (username) {\n this.super.username = username\n }\n\n /**\n * @param {any} o\n */\n static createObjectURL (o) {\n return URL.createObjectURL(o)\n }\n\n /**\n * @param {string} o\n */\n static revokeObjectURL (o) {\n URL.revokeObjectURL(o)\n }\n\n toJSON () {\n return this.super.toJSON()\n }\n\n toString () {\n return this.super.toString()\n }\n\n format () {\n return this.toString()\n }\n}\n\n/**\n * @param {string | import('url').UrlObject} obj\n */\nfunction format (obj) {\n if (typeof obj === 'string') {\n const url = new URL(obj)\n\n return url.toString()\n }\n\n if (!(obj instanceof URL)) {\n const userPass =\n // @ts-ignore its not supported in node but we normalise\n obj.username && obj.password\n // @ts-ignore its not supported in node but we normalise\n ? `${obj.username}:${obj.password}@`\n : ''\n const auth = obj.auth ? obj.auth + '@' : ''\n const port = obj.port ? ':' + obj.port : ''\n const protocol = obj.protocol ? obj.protocol + '//' : ''\n const host = obj.host || ''\n const hostname = obj.hostname || ''\n const search = obj.search || (obj.query ? '?' + obj.query : '')\n const hash = obj.hash || ''\n const pathname = obj.pathname || ''\n // @ts-ignore - path is not supported in node but we normalise\n const path = obj.path || pathname + search\n\n return `${protocol}${userPass || auth}${\n host || hostname + port\n }${path}${hash}`\n }\n}\n\nmodule.exports = {\n URLWithLegacySupport,\n URLSearchParams: self.URLSearchParams,\n defaultBase,\n format\n}\n","module.exports = function(originalModule) {\n\tif (!originalModule.webpackPolyfill) {\n\t\tvar module = Object.create(originalModule);\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"exports\", {\n\t\t\tenumerable: true\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nvar isCallingCanDrop = false;\nexport var DropTargetMonitorImpl = /*#__PURE__*/function () {\n function DropTargetMonitorImpl(manager) {\n _classCallCheck(this, DropTargetMonitorImpl);\n\n this.targetId = null;\n this.internalMonitor = manager.getMonitor();\n }\n\n _createClass(DropTargetMonitorImpl, [{\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(targetId) {\n this.targetId = targetId;\n }\n }, {\n key: \"getHandlerId\",\n value: function getHandlerId() {\n return this.targetId;\n }\n }, {\n key: \"subscribeToStateChange\",\n value: function subscribeToStateChange(listener, options) {\n return this.internalMonitor.subscribeToStateChange(listener, options);\n }\n }, {\n key: \"canDrop\",\n value: function canDrop() {\n // Cut out early if the target id has not been set. This should prevent errors\n // where the user has an older version of dnd-core like in\n // https://github.com/react-dnd/react-dnd/issues/1310\n if (!this.targetId) {\n return false;\n }\n\n invariant(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');\n\n try {\n isCallingCanDrop = true;\n return this.internalMonitor.canDropOnTarget(this.targetId);\n } finally {\n isCallingCanDrop = false;\n }\n }\n }, {\n key: \"isOver\",\n value: function isOver(options) {\n if (!this.targetId) {\n return false;\n }\n\n return this.internalMonitor.isOverTarget(this.targetId, options);\n }\n }, {\n key: \"getItemType\",\n value: function getItemType() {\n return this.internalMonitor.getItemType();\n }\n }, {\n key: \"getItem\",\n value: function getItem() {\n return this.internalMonitor.getItem();\n }\n }, {\n key: \"getDropResult\",\n value: function getDropResult() {\n return this.internalMonitor.getDropResult();\n }\n }, {\n key: \"didDrop\",\n value: function didDrop() {\n return this.internalMonitor.didDrop();\n }\n }, {\n key: \"getInitialClientOffset\",\n value: function getInitialClientOffset() {\n return this.internalMonitor.getInitialClientOffset();\n }\n }, {\n key: \"getInitialSourceClientOffset\",\n value: function getInitialSourceClientOffset() {\n return this.internalMonitor.getInitialSourceClientOffset();\n }\n }, {\n key: \"getSourceClientOffset\",\n value: function getSourceClientOffset() {\n return this.internalMonitor.getSourceClientOffset();\n }\n }, {\n key: \"getClientOffset\",\n value: function getClientOffset() {\n return this.internalMonitor.getClientOffset();\n }\n }, {\n key: \"getDifferenceFromInitialOffset\",\n value: function getDifferenceFromInitialOffset() {\n return this.internalMonitor.getDifferenceFromInitialOffset();\n }\n }]);\n\n return DropTargetMonitorImpl;\n}();","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { shallowEqual } from '@react-dnd/shallowequal';\nimport { wrapConnectorHooks } from './wrapConnectorHooks';\nimport { isRef } from '../utils/isRef';\nexport var TargetConnector = /*#__PURE__*/function () {\n function TargetConnector(backend) {\n var _this = this;\n\n _classCallCheck(this, TargetConnector);\n\n this.hooks = wrapConnectorHooks({\n dropTarget: function dropTarget(node, options) {\n _this.clearDropTarget();\n\n _this.dropTargetOptions = options;\n\n if (isRef(node)) {\n _this.dropTargetRef = node;\n } else {\n _this.dropTargetNode = node;\n }\n\n _this.reconnect();\n }\n });\n this.handlerId = null; // The drop target may either be attached via ref or connect function\n\n this.dropTargetRef = null;\n this.dropTargetOptionsInternal = null;\n this.lastConnectedHandlerId = null;\n this.lastConnectedDropTarget = null;\n this.lastConnectedDropTargetOptions = null;\n this.backend = backend;\n }\n\n _createClass(TargetConnector, [{\n key: \"reconnect\",\n value: function reconnect() {\n // if nothing has changed then don't resubscribe\n var didChange = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();\n\n if (didChange) {\n this.disconnectDropTarget();\n }\n\n var dropTarget = this.dropTarget;\n\n if (!this.handlerId) {\n return;\n }\n\n if (!dropTarget) {\n this.lastConnectedDropTarget = dropTarget;\n return;\n }\n\n if (didChange) {\n this.lastConnectedHandlerId = this.handlerId;\n this.lastConnectedDropTarget = dropTarget;\n this.lastConnectedDropTargetOptions = this.dropTargetOptions;\n this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);\n }\n }\n }, {\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(newHandlerId) {\n if (newHandlerId === this.handlerId) {\n return;\n }\n\n this.handlerId = newHandlerId;\n this.reconnect();\n }\n }, {\n key: \"didHandlerIdChange\",\n value: function didHandlerIdChange() {\n return this.lastConnectedHandlerId !== this.handlerId;\n }\n }, {\n key: \"didDropTargetChange\",\n value: function didDropTargetChange() {\n return this.lastConnectedDropTarget !== this.dropTarget;\n }\n }, {\n key: \"didOptionsChange\",\n value: function didOptionsChange() {\n return !shallowEqual(this.lastConnectedDropTargetOptions, this.dropTargetOptions);\n }\n }, {\n key: \"disconnectDropTarget\",\n value: function disconnectDropTarget() {\n if (this.unsubscribeDropTarget) {\n this.unsubscribeDropTarget();\n this.unsubscribeDropTarget = undefined;\n }\n }\n }, {\n key: \"clearDropTarget\",\n value: function clearDropTarget() {\n this.dropTargetRef = null;\n this.dropTargetNode = null;\n }\n }, {\n key: \"connectTarget\",\n get: function get() {\n return this.dropTarget;\n }\n }, {\n key: \"dropTargetOptions\",\n get: function get() {\n return this.dropTargetOptionsInternal;\n },\n set: function set(options) {\n this.dropTargetOptionsInternal = options;\n }\n }, {\n key: \"dropTarget\",\n get: function get() {\n return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;\n }\n }]);\n\n return TargetConnector;\n}();","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nexport function isRef(obj) {\n return (// eslint-disable-next-line no-prototype-builtins\n obj !== null && _typeof(obj) === 'object' && Object.prototype.hasOwnProperty.call(obj, 'current')\n );\n}","/**\n * Implementation of the [multibase](https://github.com/multiformats/multibase) specification.\n *\n */\n'use strict'\n\nconst constants = require('./constants')\nconst { encodeText, decodeText, concat } = require('./util')\n\n/** @typedef {import('./base')} Base */\n/** @typedef {import(\"./types\").BaseNameOrCode} BaseNameOrCode */\n/** @typedef {import(\"./types\").BaseCode} BaseCode */\n/** @typedef {import(\"./types\").BaseName} BaseName */\n\n/**\n * Create a new Uint8Array with the multibase varint+code.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be prefixed with multibase.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction multibase (nameOrCode, buf) {\n if (!buf) {\n throw new Error('requires an encoded Uint8Array')\n }\n const { name, codeBuf } = encoding(nameOrCode)\n validEncode(name, buf)\n\n return concat([codeBuf, buf], codeBuf.length + buf.length)\n}\n\n/**\n * Encode data with the specified base and add the multibase prefix.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be encoded.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction encode (nameOrCode, buf) {\n const enc = encoding(nameOrCode)\n const data = encodeText(enc.encode(buf))\n\n return concat([enc.codeBuf, data], enc.codeBuf.length + data.length)\n}\n\n/**\n * Takes a Uint8Array or string encoded with multibase header, decodes it and\n * returns the decoded buffer\n *\n * @param {Uint8Array|string} data\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction decode (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n const prefix = data[0]\n\n // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet\n if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) {\n data = data.toLowerCase()\n }\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.decode(data.substring(1))\n}\n\n/**\n * Is the given data multibase encoded?\n *\n * @param {Uint8Array|string} data\n * @returns {false | string}\n */\nfunction isEncoded (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n // Ensure bufOrString is a string\n if (Object.prototype.toString.call(data) !== '[object String]') {\n return false\n }\n\n try {\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.name\n } catch (err) {\n return false\n }\n}\n\n/**\n * Validate encoded data\n *\n * @param {BaseNameOrCode} name\n * @param {Uint8Array} buf\n * @returns {void}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction validEncode (name, buf) {\n const enc = encoding(name)\n enc.decode(decodeText(buf))\n}\n\n/**\n * Get the encoding by name or code\n *\n * @param {BaseNameOrCode} nameOrCode\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encoding (nameOrCode) {\n if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) {\n return constants.names[/** @type {BaseName} */(nameOrCode)]\n } else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) {\n return constants.codes[/** @type {BaseCode} */(nameOrCode)]\n } else {\n throw new Error(`Unsupported encoding: ${nameOrCode}`)\n }\n}\n\n/**\n * Get encoding from data\n *\n * @param {string|Uint8Array} data\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encodingFromData (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n return encoding(/** @type {BaseCode} */(data[0]))\n}\n\nexports = module.exports = multibase\nexports.encode = encode\nexports.decode = decode\nexports.isEncoded = isEncoded\nexports.encoding = encoding\nexports.encodingFromData = encodingFromData\nexports.names = Object.freeze(constants.names)\nexports.codes = Object.freeze(constants.codes)\n","'use strict'\n\nconst varint = require('varint')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\n\nmodule.exports = {\n numberToUint8Array,\n uint8ArrayToNumber,\n varintUint8ArrayEncode,\n varintEncode\n}\n\nfunction uint8ArrayToNumber (buf) {\n return parseInt(uint8ArrayToString(buf, 'base16'), 16)\n}\n\nfunction numberToUint8Array (num) {\n let hexString = num.toString(16)\n if (hexString.length % 2 === 1) {\n hexString = '0' + hexString\n }\n return uint8ArrayFromString(hexString, 'base16')\n}\n\nfunction varintUint8ArrayEncode (input) {\n return Uint8Array.from(varint.encode(uint8ArrayToNumber(input)))\n}\n\nfunction varintEncode (num) {\n return Uint8Array.from(varint.encode(num))\n}\n","function _AwaitValue(value) {\n this.wrapped = value;\n}\n\nmodule.exports = _AwaitValue;","/* eslint-disable no-undef */\n'use strict'\n\nconst { fetch, Request, Headers } = require('./http/fetch')\nconst { TimeoutError, HTTPError } = require('./http/error')\nconst merge = require('merge-options').bind({ ignoreUndefined: true })\nconst { URL, URLSearchParams } = require('iso-url')\nconst TextDecoder = require('./text-decoder')\nconst { AbortController } = require('native-abort-controller')\nconst anySignal = require('any-signal')\n\n/**\n * @typedef {import('electron-fetch').Response} Response\n * @typedef {import('stream').Readable} NodeReadableStream\n * @typedef {import('stream').Duplex} NodeDuplexStream\n * @typedef {import('./types').HTTPOptions} HTTPOptions\n */\n\n/**\n * @template TResponse\n * @param {Promise} promise\n * @param {number | undefined} ms\n * @param {AbortController} abortController\n * @returns {Promise}\n */\nconst timeout = (promise, ms, abortController) => {\n if (ms === undefined) {\n return promise\n }\n\n const start = Date.now()\n\n const timedOut = () => {\n const time = Date.now() - start\n\n return time >= ms\n }\n\n return new Promise((resolve, reject) => {\n const timeoutID = setTimeout(() => {\n if (timedOut()) {\n reject(new TimeoutError())\n abortController.abort()\n }\n }, ms)\n\n /**\n * @param {(value: any) => void } next\n */\n const after = (next) => {\n /**\n * @param {any} res\n */\n const fn = (res) => {\n clearTimeout(timeoutID)\n\n if (timedOut()) {\n reject(new TimeoutError())\n return\n }\n\n next(res)\n }\n return fn\n }\n\n promise\n .then(after(resolve), after(reject))\n })\n}\n\nconst defaults = {\n throwHttpErrors: true,\n credentials: 'same-origin'\n}\n\nclass HTTP {\n /**\n *\n * @param {HTTPOptions} options\n */\n constructor (options = {}) {\n /** @type {HTTPOptions} */\n this.opts = merge(defaults, options)\n }\n\n /**\n * Fetch\n *\n * @param {string | Request} resource\n * @param {HTTPOptions} options\n * @returns {Promise}\n */\n async fetch (resource, options = {}) {\n /** @type {HTTPOptions} */\n const opts = merge(this.opts, options)\n const headers = new Headers(opts.headers)\n\n // validate resource type\n if (typeof resource !== 'string' && !(resource instanceof URL || resource instanceof Request)) {\n throw new TypeError('`resource` must be a string, URL, or Request')\n }\n\n const url = new URL(resource.toString(), opts.base)\n\n const {\n searchParams,\n transformSearchParams,\n json\n } = opts\n\n if (searchParams) {\n if (typeof transformSearchParams === 'function') {\n // @ts-ignore\n url.search = transformSearchParams(new URLSearchParams(opts.searchParams))\n } else {\n // @ts-ignore\n url.search = new URLSearchParams(opts.searchParams)\n }\n }\n\n if (json) {\n opts.body = JSON.stringify(opts.json)\n headers.set('content-type', 'application/json')\n }\n\n const abortController = new AbortController()\n // @ts-ignore\n const signal = anySignal([abortController.signal, opts.signal])\n\n const response = await timeout(\n fetch(\n url.toString(),\n {\n ...opts,\n signal,\n timeout: undefined,\n headers\n }\n ),\n opts.timeout,\n abortController\n )\n\n if (!response.ok && opts.throwHttpErrors) {\n if (opts.handleError) {\n await opts.handleError(response)\n }\n throw new HTTPError(response)\n }\n\n response.iterator = function () {\n return fromStream(response.body)\n }\n\n response.ndjson = async function * () {\n for await (const chunk of ndjson(response.iterator())) {\n if (options.transform) {\n yield options.transform(chunk)\n } else {\n yield chunk\n }\n }\n }\n\n return response\n }\n\n /**\n * @param {string | Request} resource\n * @param {HTTPOptions} options\n * @returns {Promise}\n */\n post (resource, options = {}) {\n return this.fetch(resource, { ...options, method: 'POST' })\n }\n\n /**\n * @param {string | Request} resource\n * @param {HTTPOptions} options\n * @returns {Promise}\n */\n get (resource, options = {}) {\n return this.fetch(resource, { ...options, method: 'GET' })\n }\n\n /**\n * @param {string | Request} resource\n * @param {HTTPOptions} options\n * @returns {Promise}\n */\n put (resource, options = {}) {\n return this.fetch(resource, { ...options, method: 'PUT' })\n }\n\n /**\n * @param {string | Request} resource\n * @param {HTTPOptions} options\n * @returns {Promise}\n */\n delete (resource, options = {}) {\n return this.fetch(resource, { ...options, method: 'DELETE' })\n }\n\n /**\n * @param {string | Request} resource\n * @param {HTTPOptions} options\n * @returns {Promise}\n */\n options (resource, options = {}) {\n return this.fetch(resource, { ...options, method: 'OPTIONS' })\n }\n}\n\n/**\n * Parses NDJSON chunks from an iterator\n *\n * @param {AsyncIterable} source\n * @returns {AsyncIterable}\n */\nconst ndjson = async function * (source) {\n const decoder = new TextDecoder()\n let buf = ''\n\n for await (const chunk of source) {\n buf += decoder.decode(chunk, { stream: true })\n const lines = buf.split(/\\r?\\n/)\n\n for (let i = 0; i < lines.length - 1; i++) {\n const l = lines[i].trim()\n if (l.length > 0) {\n yield JSON.parse(l)\n }\n }\n buf = lines[lines.length - 1]\n }\n buf += decoder.decode()\n buf = buf.trim()\n if (buf.length !== 0) {\n yield JSON.parse(buf)\n }\n}\n\n/**\n * Stream to AsyncIterable\n *\n * @template TChunk\n * @param {ReadableStream | NodeReadableStream | null} source\n * @returns {AsyncIterable}\n */\nconst fromStream = (source) => {\n // Workaround for https://github.com/node-fetch/node-fetch/issues/766\n if (isNodeReadableStream(source)) {\n const iter = source[Symbol.asyncIterator]()\n return {\n [Symbol.asyncIterator] () {\n return {\n next: iter.next.bind(iter),\n return (value) {\n source.destroy()\n if (typeof iter.return === 'function') {\n return iter.return()\n }\n return Promise.resolve({ done: true, value })\n }\n }\n }\n }\n }\n\n if (isWebReadableStream(source)) {\n const reader = source.getReader()\n return (async function * () {\n try {\n while (true) {\n // Read from the stream\n const { done, value } = await reader.read()\n // Exit if we're done\n if (done) return\n // Else yield the chunk\n if (value) {\n yield value\n }\n }\n } finally {\n reader.releaseLock()\n }\n })()\n }\n\n if (isAsyncIterable(source)) {\n return source\n }\n\n throw new TypeError('Body can\\'t be converted to AsyncIterable')\n}\n\n/**\n * Check if it's an AsyncIterable\n *\n * @template {unknown} TChunk\n * @template {any} Other\n * @param {Other|AsyncIterable} value\n * @returns {value is AsyncIterable}\n */\nconst isAsyncIterable = (value) => {\n return typeof value === 'object' &&\n value !== null &&\n typeof /** @type {any} */(value)[Symbol.asyncIterator] === 'function'\n}\n\n/**\n * Check for web readable stream\n *\n * @template {unknown} TChunk\n * @template {any} Other\n * @param {Other|ReadableStream} value\n * @returns {value is ReadableStream}\n */\nconst isWebReadableStream = (value) => {\n return value && typeof /** @type {any} */(value).getReader === 'function'\n}\n\n/**\n * @param {any} value\n * @returns {value is NodeReadableStream}\n */\nconst isNodeReadableStream = (value) =>\n Object.prototype.hasOwnProperty.call(value, 'readable') &&\n Object.prototype.hasOwnProperty.call(value, 'writable')\n\nHTTP.HTTPError = HTTPError\nHTTP.TimeoutError = TimeoutError\nHTTP.streamToAsyncIterator = fromStream\n\n/**\n * @param {string | Request} resource\n * @param {HTTPOptions} [options]\n * @returns {Promise}\n */\nHTTP.post = (resource, options) => new HTTP(options).post(resource, options)\n\n/**\n * @param {string | Request} resource\n * @param {HTTPOptions} [options]\n * @returns {Promise}\n */\nHTTP.get = (resource, options) => new HTTP(options).get(resource, options)\n\n/**\n * @param {string | Request} resource\n * @param {HTTPOptions} [options]\n * @returns {Promise}\n */\nHTTP.put = (resource, options) => new HTTP(options).put(resource, options)\n\n/**\n * @param {string | Request} resource\n * @param {HTTPOptions} [options]\n * @returns {Promise}\n */\nHTTP.delete = (resource, options) => new HTTP(options).delete(resource, options)\n\n/**\n * @param {string | Request} resource\n * @param {HTTPOptions} [options]\n * @returns {Promise}\n */\nHTTP.options = (resource, options) => new HTTP(options).options(resource, options)\n\nmodule.exports = HTTP\n","'use strict'\n\nclass TimeoutError extends Error {\n constructor (message = 'Request timed out') {\n super(message)\n this.name = 'TimeoutError'\n }\n}\nexports.TimeoutError = TimeoutError\n\nclass AbortError extends Error {\n constructor (message = 'The operation was aborted.') {\n super(message)\n this.name = 'AbortError'\n }\n}\nexports.AbortError = AbortError\n\nclass HTTPError extends Error {\n /**\n * @param {import('electron-fetch').Response} response\n */\n constructor (response) {\n super(response.statusText)\n this.name = 'HTTPError'\n this.response = response\n }\n}\nexports.HTTPError = HTTPError\n","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeFunction = require(\"./isNativeFunction\");\n\nvar construct = require(\"./construct\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper;","'use strict'\nconst isElectron = require('is-electron')\n\nconst IS_ENV_WITH_DOM = typeof window === 'object' && typeof document === 'object' && document.nodeType === 9\nconst IS_ELECTRON = isElectron()\nconst IS_BROWSER = IS_ENV_WITH_DOM && !IS_ELECTRON\nconst IS_ELECTRON_MAIN = IS_ELECTRON && !IS_ENV_WITH_DOM\nconst IS_ELECTRON_RENDERER = IS_ELECTRON && IS_ENV_WITH_DOM\nconst IS_NODE = typeof require === 'function' && typeof process !== 'undefined' && typeof process.release !== 'undefined' && process.release.name === 'node' && !IS_ELECTRON\n// @ts-ignore - we either ignore worker scope or dom scope\nconst IS_WEBWORKER = typeof importScripts === 'function' && typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope\nconst IS_TEST = typeof process !== 'undefined' && typeof process.env !== 'undefined' && process.env.NODE_ENV === 'test'\n\nmodule.exports = {\n isTest: IS_TEST,\n isElectron: IS_ELECTRON,\n isElectronMain: IS_ELECTRON_MAIN,\n isElectronRenderer: IS_ELECTRON_RENDERER,\n isNode: IS_NODE,\n /**\n * Detects browser main thread **NOT** web worker or service worker\n */\n isBrowser: IS_BROWSER,\n isWebWorker: IS_WEBWORKER,\n isEnvWithDom: IS_ENV_WITH_DOM\n}\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar origDefineProperty = Object.defineProperty;\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar arePropertyDescriptorsSupported = function () {\n\tvar obj = {};\n\ttry {\n\t\torigDefineProperty(obj, 'x', { enumerable: false, value: obj });\n\t\t// eslint-disable-next-line no-unused-vars, no-restricted-syntax\n\t\tfor (var _ in obj) { // jscs:ignore disallowUnusedVariables\n\t\t\treturn false;\n\t\t}\n\t\treturn obj.x === obj;\n\t} catch (e) { /* this is IE 8. */\n\t\treturn false;\n\t}\n};\nvar supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object && (!isFunction(predicate) || !predicate())) {\n\t\treturn;\n\t}\n\tif (supportsDescriptors) {\n\t\torigDefineProperty(object, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: value,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\tobject[name] = value;\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","/* eslint no-negated-condition: 0, no-new-func: 0 */\n\n'use strict';\n\nif (typeof self !== 'undefined') {\n\tmodule.exports = self;\n} else if (typeof window !== 'undefined') {\n\tmodule.exports = window;\n} else {\n\tmodule.exports = Function('return this')();\n}\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\n\t\treturn implementation;\n\t}\n\treturn global;\n};\n","'use strict';\n\nmodule.exports = value => {\n\tif (Object.prototype.toString.call(value) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === null || prototype === Object.prototype;\n};\n","'use strict';\n\nconst defaultBase = self.location && self.location.protocol + '//' + self.location.host;\nconst URL = self.URL;\n\nclass URLWithLegacySupport {\n constructor(url = '', base = defaultBase) {\n this.super = new URL(url, base);\n this.path = this.pathname + this.search;\n this.auth =\n this.username && this.password ?\n this.username + ':' + this.password :\n null;\n\n this.query =\n this.search && this.search.startsWith('?') ?\n this.search.slice(1) :\n null;\n }\n\n get hash() {\n return this.super.hash;\n }\n get host() {\n return this.super.host;\n }\n get hostname() {\n return this.super.hostname;\n }\n get href() {\n return this.super.href;\n }\n get origin() {\n return this.super.origin;\n }\n get password() {\n return this.super.password;\n }\n get pathname() {\n return this.super.pathname;\n }\n get port() {\n return this.super.port;\n }\n get protocol() {\n return this.super.protocol;\n }\n get search() {\n return this.super.search;\n }\n get searchParams() {\n return this.super.searchParams;\n }\n get username() {\n return this.super.username;\n }\n\n set hash(hash) {\n this.super.hash = hash;\n }\n set host(host) {\n this.super.host = host;\n }\n set hostname(hostname) {\n this.super.hostname = hostname;\n }\n set href(href) {\n this.super.href = href;\n }\n set origin(origin) {\n this.super.origin = origin;\n }\n set password(password) {\n this.super.password = password;\n }\n set pathname(pathname) {\n this.super.pathname = pathname;\n }\n set port(port) {\n this.super.port = port;\n }\n set protocol(protocol) {\n this.super.protocol = protocol;\n }\n set search(search) {\n this.super.search = search;\n }\n set searchParams(searchParams) {\n this.super.searchParams = searchParams;\n }\n set username(username) {\n this.super.username = username;\n }\n\n createObjectURL(o) {\n return this.super.createObjectURL(o);\n }\n revokeObjectURL(o) {\n this.super.revokeObjectURL(o);\n }\n toJSON() {\n return this.super.toJSON();\n }\n toString() {\n return this.super.toString();\n }\n format() {\n return this.toString();\n }\n}\n\nfunction format(obj) {\n if (typeof obj === 'string') {\n const url = new URL(obj);\n\n return url.toString();\n }\n\n if (!(obj instanceof URL)) {\n const userPass =\n obj.username && obj.password ?\n `${obj.username}:${obj.password}@` :\n '';\n const auth = obj.auth ? obj.auth + '@' : '';\n const port = obj.port ? ':' + obj.port : '';\n const protocol = obj.protocol ? obj.protocol + '//' : '';\n const host = obj.host || '';\n const hostname = obj.hostname || '';\n const search = obj.search || (obj.query ? '?' + obj.query : '');\n const hash = obj.hash || '';\n const pathname = obj.pathname || '';\n const path = obj.path || pathname + search;\n\n return `${protocol}${userPass || auth}${host ||\n hostname + port}${path}${hash}`;\n }\n}\n\nmodule.exports = {\n URLWithLegacySupport,\n URLSearchParams: self.URLSearchParams,\n defaultBase,\n format\n};\n","'use strict'\n\nlet impl\n\nif (globalThis.AbortController && globalThis.AbortSignal) {\n impl = globalThis\n} else {\n impl = require('abort-controller')\n}\n\nmodule.exports = {\n AbortController: impl.AbortController,\n AbortSignal: impl.AbortSignal\n}\n","/*globals self, window */\n\"use strict\"\n\n/*eslint-disable @mysticatea/prettier */\nconst { AbortController, AbortSignal } =\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window :\n /* otherwise */ undefined\n/*eslint-enable @mysticatea/prettier */\n\nmodule.exports = AbortController\nmodule.exports.AbortSignal = AbortSignal\nmodule.exports.default = AbortController\n","'use strict'\n\nconst CID = require('cids')\nconst toCamel = require('./lib/object-to-camel')\nconst configure = require('./lib/configure')\nconst multipartRequest = require('./lib/multipart-request')\nconst toUrlSearchParams = require('./lib/to-url-search-params')\nconst abortSignal = require('./lib/abort-signal')\nconst { AbortController } = require('native-abort-controller')\n\n/**\n * @typedef {import('ipfs-utils/src/types').ProgressFn} IPFSUtilsHttpUploadProgressFn\n * @typedef {import('ipfs-core-types/src/root').AddProgressFn} IPFSCoreAddProgressFn\n */\n\nmodule.exports = configure((api) => {\n /**\n * @type {import('.').Implements}\n */\n async function * addAll (source, options = {}) {\n // allow aborting requests on body errors\n const controller = new AbortController()\n const signal = abortSignal(controller.signal, options.signal)\n const { headers, body, total, parts } =\n await multipartRequest(source, controller, options.headers)\n\n // In browser response body only starts streaming once upload is\n // complete, at which point all the progress updates are invalid. If\n // length of the content is computable we can interpret progress from\n // `{ total, loaded}` passed to `onUploadProgress` and `multipart.total`\n // in which case we disable progress updates to be written out.\n const [progressFn, onUploadProgress] = typeof options.progress === 'function'\n ? createProgressHandler(total, parts, options.progress)\n : [undefined, undefined]\n\n const res = await api.post('add', {\n searchParams: toUrlSearchParams({\n 'stream-channels': true,\n ...options,\n progress: Boolean(progressFn)\n }),\n timeout: options.timeout,\n onUploadProgress,\n signal,\n headers,\n body\n })\n\n for await (let file of res.ndjson()) {\n file = toCamel(file)\n\n if (file.hash !== undefined) {\n yield toCoreInterface(file)\n } else if (progressFn) {\n progressFn(file.bytes || 0, file.name)\n }\n }\n }\n return addAll\n})\n\n/**\n * Returns simple progress callback when content length isn't computable or a\n * progress event handler that calculates progress from upload progress events.\n *\n * @param {number} total\n * @param {{name:string, start:number, end:number}[]|null} parts\n * @param {IPFSCoreAddProgressFn} progress\n * @returns {[IPFSCoreAddProgressFn|undefined, IPFSUtilsHttpUploadProgressFn|undefined]}\n */\nconst createProgressHandler = (total, parts, progress) =>\n parts ? [undefined, createOnUploadProgress(total, parts, progress)] : [progress, undefined]\n\n/**\n * Creates a progress handler that interpolates progress from upload progress\n * events and total size of the content that is added.\n *\n * @param {number} size - actual content size\n * @param {{name:string, start:number, end:number}[]} parts\n * @param {IPFSCoreAddProgressFn} progress\n * @returns {IPFSUtilsHttpUploadProgressFn}\n */\nconst createOnUploadProgress = (size, parts, progress) => {\n let index = 0\n const count = parts.length\n return ({ loaded, total }) => {\n // Derive position from the current progress.\n const position = Math.floor(loaded / total * size)\n while (index < count) {\n const { start, end, name } = parts[index]\n // If within current part range report progress and break the loop\n if (position < end) {\n progress(position - start, name)\n break\n // If passed current part range report final byte for the chunk and\n // move to next one.\n } else {\n progress(end - start, name)\n index += 1\n }\n }\n }\n}\n\n/**\n * @param {any} input\n * @returns {import('ipfs-core-types/src/files').UnixFSEntry}\n */\nfunction toCoreInterface ({ name, hash, size, mode, mtime, mtimeNsecs }) {\n const output = {\n path: name,\n cid: new CID(hash),\n size: parseInt(size)\n }\n\n if (mode != null) {\n output.mode = parseInt(mode, 8)\n }\n\n if (mtime != null) {\n output.mtime = {\n secs: mtime,\n nsecs: mtimeNsecs || 0\n }\n }\n\n // @ts-ignore\n return output\n}\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","'use strict'\n\n/**\n * @template T\n * @typedef {Object} Peek\n * @property {() => IteratorResult} peek\n */\n\n/**\n * @template T\n * @typedef {Object} AsyncPeek\n * @property {() => Promise>} peek\n */\n\n/**\n * @template T\n * @typedef {Object} Push\n * @property {(value:T) => void} push\n */\n\n/**\n * @template T\n * @typedef {Iterable & Peek & Push & Iterator} Peekable\n */\n\n/**\n * @template T\n * @typedef {AsyncIterable & AsyncPeek & Push & AsyncIterator} AsyncPeekable\n */\n\n/**\n * @template {Iterable | AsyncIterable} I\n * @param {I} iterable\n * @returns {I extends Iterable\n * ? Peekable\n * : I extends AsyncIterable\n * ? AsyncPeekable\n * : never\n * }\n */\nfunction peekableIterator (iterable) {\n // @ts-ignore\n const [iterator, symbol] = iterable[Symbol.asyncIterator]\n // @ts-ignore\n ? [iterable[Symbol.asyncIterator](), Symbol.asyncIterator]\n // @ts-ignore\n : [iterable[Symbol.iterator](), Symbol.iterator]\n\n /** @type {any[]} */\n const queue = []\n\n // @ts-ignore\n return {\n peek: () => {\n return iterator.next()\n },\n push: (value) => {\n queue.push(value)\n },\n next: () => {\n if (queue.length) {\n return {\n done: false,\n value: queue.shift()\n }\n }\n\n return iterator.next()\n },\n [symbol] () {\n return this\n }\n }\n}\n\nmodule.exports = peekableIterator\n","'use strict'\n\n/**\n * Turns a browser readable stream into an async iterable. Async iteration over\n * returned iterable will lock give stream, preventing any other consumer from\n * acquiring a reader. The lock will be released if iteration loop is broken. To\n * prevent stream cancelling optional `{ preventCancel: true }` could be passed\n * as a second argument.\n * @template T\n * @param {ReadableStream} stream\n * @param {Object} [options]\n * @param {boolean} [options.preventCancel=boolean]\n * @returns {AsyncIterable}\n */\nasync function * browserReadableStreamToIt (stream, options = {}) {\n const reader = stream.getReader()\n\n try {\n while (true) {\n const result = await reader.read()\n\n if (result.done) {\n return\n }\n\n yield result.value\n }\n } finally {\n if (options.preventCancel !== true) {\n reader.cancel()\n }\n\n reader.releaseLock()\n }\n}\n\nmodule.exports = browserReadableStreamToIt\n","'use strict'\n\nconst { BigNumber } = require('bignumber.js')\nconst CID = require('cids')\nconst configure = require('../lib/configure')\nconst toUrlSearchParams = require('../lib/to-url-search-params')\n\nmodule.exports = configure(api => {\n /**\n * @type {import('..').Implements}\n */\n async function stat (options = {}) {\n const res = await api.post('bitswap/stat', {\n searchParams: toUrlSearchParams(options),\n timeout: options.timeout,\n signal: options.signal,\n headers: options.headers\n })\n\n return toCoreInterface(await res.json())\n }\n return stat\n})\n\nfunction toCoreInterface (res) {\n return {\n provideBufLen: res.ProvideBufLen,\n wantlist: (res.Wantlist || []).map(k => new CID(k['/'])),\n peers: (res.Peers || []),\n blocksReceived: new BigNumber(res.BlocksReceived),\n dataReceived: new BigNumber(res.DataReceived),\n blocksSent: new BigNumber(res.BlocksSent),\n dataSent: new BigNumber(res.DataSent),\n dupBlksReceived: new BigNumber(res.DupBlksReceived),\n dupDataReceived: new BigNumber(res.DupDataReceived)\n }\n}\n","'use strict'\n\nconst Block = require('ipld-block')\nconst CID = require('cids')\nconst configure = require('../lib/configure')\nconst toUrlSearchParams = require('../lib/to-url-search-params')\n\nmodule.exports = configure(api => {\n /**\n * @type {import('..').Implements}\n */\n async function get (cid, options = {}) {\n // @ts-ignore - CID|string seems to confuse typedef\n cid = new CID(cid)\n\n const res = await api.post('block/get', {\n timeout: options.timeout,\n signal: options.signal,\n searchParams: toUrlSearchParams({\n arg: cid.toString(),\n ...options\n }),\n headers: options.headers\n })\n\n return new Block(new Uint8Array(await res.arrayBuffer()), cid)\n }\n return get\n})\n","'use strict'\n\nconst dagPB = require('ipld-dag-pb')\nconst dagCBOR = require('ipld-dag-cbor')\nconst raw = require('ipld-raw')\nconst multicodec = require('multicodec')\n\nconst noop = () => {}\n\n/**\n * @typedef {import('cids')} CID\n */\n\n/**\n * Return an object containing supported IPLD Formats\n *\n * @param {object} [options] - IPLD options passed to the http client constructor\n * @param {Array} [options.formats] - A list of IPLD Formats to use\n * @param {Function} [options.loadFormat] - An async function that can load a format when passed a codec number\n * @returns {Function}\n */\nmodule.exports = ({ formats = [], loadFormat = noop } = {}) => {\n formats = formats || []\n loadFormat = loadFormat || noop\n\n const configuredFormats = {\n [multicodec.DAG_PB]: dagPB,\n [multicodec.DAG_CBOR]: dagCBOR,\n [multicodec.RAW]: raw\n }\n\n formats.forEach(format => {\n configuredFormats[format.codec] = format\n })\n\n /**\n * Attempts to load an IPLD format for the passed CID\n *\n * @param {import('multicodec').CodecName} codec - The code to load the format for\n * @returns {Promise} - An IPLD format\n */\n const loadResolver = async (codec) => {\n // @ts-ignore - codec is a string and not a CodecName\n const number = multicodec.getNumber(codec)\n const format = configuredFormats[number] || await loadFormat(codec)\n\n if (!format) {\n throw Object.assign(\n new Error(`Missing IPLD format \"${codec}\"`),\n { missingMulticodec: codec }\n )\n }\n\n return format\n }\n\n return loadResolver\n}\n","'use strict'\n\nconst withIs = require('class-is')\nconst sortLinks = require('./sortLinks')\nconst DAGLink = require('../dag-link/dagLink')\nconst { serializeDAGNode } = require('../serialize.js')\nconst toDAGLink = require('./toDagLink')\nconst addLink = require('./addLink')\nconst rmLink = require('./rmLink')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\nconst uint8ArrayToString = require('uint8arrays/to-string')\n\nclass DAGNode {\n constructor (data, links = [], serializedSize = null) {\n if (!data) {\n data = new Uint8Array(0)\n }\n if (typeof data === 'string') {\n data = uint8ArrayFromString(data)\n }\n\n if (!(data instanceof Uint8Array)) {\n throw new Error('Passed \\'data\\' is not a Uint8Array or a String!')\n }\n\n if (serializedSize !== null && typeof serializedSize !== 'number') {\n throw new Error('Passed \\'serializedSize\\' must be a number!')\n }\n\n links = links.map((link) => {\n return DAGLink.isDAGLink(link)\n ? link\n : DAGLink.util.createDagLinkFromB58EncodedHash(link)\n })\n sortLinks(links)\n\n Object.defineProperties(this, {\n Data: { value: data, writable: false, enumerable: true },\n Links: { value: links, writable: false, enumerable: true },\n _serializedSize: { value: serializedSize, writable: true, enumerable: false },\n _size: { value: null, writable: true, enumerable: false }\n })\n }\n\n toJSON () {\n if (!this._json) {\n this._json = Object.freeze({\n data: this.Data,\n links: this.Links.map((l) => l.toJSON()),\n size: this.size\n })\n }\n\n return Object.assign({}, this._json)\n }\n\n toString () {\n return `DAGNode `\n }\n\n _invalidateCached () {\n this._serializedSize = null\n this._size = null\n }\n\n addLink (link) {\n this._invalidateCached()\n return addLink(this, link)\n }\n\n rmLink (link) {\n this._invalidateCached()\n return rmLink(this, link)\n }\n\n // @returns {Promise.}\n toDAGLink (options) {\n return toDAGLink(this, options)\n }\n\n serialize () {\n return serializeDAGNode(this)\n }\n\n get size () {\n if (this._size === null) {\n if (this._serializedSize === null) {\n this._serializedSize = this.serialize().length\n }\n this._size = this.Links.reduce((sum, l) => sum + l.Tsize, this._serializedSize)\n }\n\n return this._size\n }\n\n set size (size) {\n throw new Error(\"Can't set property: 'size' is immutable\")\n }\n}\n\nexports = module.exports = withIs(DAGNode, { className: 'DAGNode', symbolName: '@ipld/js-ipld-dag-pb/dagnode' })\n","'use strict'\n\nconst sort = require('stable')\nconst uint8ArrayCompare = require('uint8arrays/compare')\n\nconst linkSort = (a, b) => {\n const buf1 = a.nameAsBuffer\n const buf2 = b.nameAsBuffer\n\n return uint8ArrayCompare(buf1, buf2)\n}\n\n/**\n * Sorts links in place (mutating given array)\n * @param {Array} links\n * @returns {void}\n */\nconst sortLinks = (links) => {\n sort.inplace(links, linkSort)\n}\n\nmodule.exports = sortLinks\n","'use strict'\n\nconst baseX = require('@multiformats/base-x')\nconst Base = require('./base.js')\nconst { rfc4648 } = require('./rfc4648')\nconst { decodeText, encodeText } = require('./util')\n\n/** @typedef {import('./types').CodecFactory} CodecFactory */\n/** @typedef {import('./types').Codec} Codec */\n/** @typedef {import('./types').BaseName} BaseName */\n/** @typedef {import('./types').BaseCode} BaseCode */\n\n/** @type {CodecFactory} */\nconst identity = () => {\n return {\n encode: decodeText,\n decode: encodeText\n }\n}\n\n/**\n *\n * name, code, implementation, alphabet\n *\n * @type {Array<[BaseName, BaseCode, CodecFactory, string]>}\n */\nconst constants = [\n ['identity', '\\x00', identity, ''],\n ['base2', '0', rfc4648(1), '01'],\n ['base8', '7', rfc4648(3), '01234567'],\n ['base10', '9', baseX, '0123456789'],\n ['base16', 'f', rfc4648(4), '0123456789abcdef'],\n ['base16upper', 'F', rfc4648(4), '0123456789ABCDEF'],\n ['base32hex', 'v', rfc4648(5), '0123456789abcdefghijklmnopqrstuv'],\n ['base32hexupper', 'V', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'],\n ['base32hexpad', 't', rfc4648(5), '0123456789abcdefghijklmnopqrstuv='],\n ['base32hexpadupper', 'T', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='],\n ['base32', 'b', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567'],\n ['base32upper', 'B', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'],\n ['base32pad', 'c', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567='],\n ['base32padupper', 'C', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='],\n ['base32z', 'h', rfc4648(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'],\n ['base36', 'k', baseX, '0123456789abcdefghijklmnopqrstuvwxyz'],\n ['base36upper', 'K', baseX, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'],\n ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'],\n ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'],\n ['base64', 'm', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'],\n ['base64pad', 'M', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='],\n ['base64url', 'u', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'],\n ['base64urlpad', 'U', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=']\n]\n\n/** @type {Record} */\nconst names = constants.reduce((prev, tupple) => {\n prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3])\n return prev\n}, /** @type {Record} */({}))\n\n/** @type {Record} */\nconst codes = constants.reduce((prev, tupple) => {\n prev[tupple[1]] = names[tupple[0]]\n return prev\n}, /** @type {Record} */({}))\n\nmodule.exports = {\n names,\n codes\n}\n","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","'use strict'\n\nconst protons = require('protons')\nconst proto = protons(require('./dag.proto.js'))\nconst DAGLink = require('./dag-link/dagLink')\n\nexports = module.exports\n\nconst toProtoBuf = (node) => {\n const pbn = {}\n\n if (node.Data && node.Data.byteLength > 0) {\n pbn.Data = node.Data\n } else {\n // NOTE: this has to be null in order to match go-ipfs serialization\n // `null !== new Uint8Array(0)`\n pbn.Data = null\n }\n\n if (node.Links && node.Links.length > 0) {\n pbn.Links = node.Links\n .map((link) => ({\n Hash: link.Hash.bytes,\n Name: link.Name,\n Tsize: link.Tsize\n }))\n } else {\n pbn.Links = null\n }\n\n return pbn\n}\n\n/**\n * Serialize internal representation into a binary PB block.\n *\n * @param {Object} node - Internal representation of a PB block\n * @returns {Uint8Array} - The encoded binary representation\n */\nconst serializeDAGNode = (node) => {\n const data = node.Data\n const links = node.Links || []\n\n const serialized = proto.PBNode.encode(toProtoBuf({\n Data: data,\n Links: links\n }))\n\n return serialized\n}\n\n// Serialize an object where the `Links` might not be a `DAGLink` instance yet\nconst serializeDAGNodeLike = (data, links = []) => {\n const node = { Data: data }\n node.Links = links.map((link) => {\n return DAGLink.isDAGLink(link)\n ? link\n : DAGLink.util.createDagLinkFromB58EncodedHash(link)\n })\n return serializeDAGNode(node)\n}\n\nexports.serializeDAGNode = serializeDAGNode\nexports.serializeDAGNodeLike = serializeDAGNodeLike\n","'use strict'\n\nvar schema = require('protocol-buffers-schema')\nvar compile = require('./compile')\n\nvar flatten = function (values) {\n if (!values) return null\n var result = {}\n Object.keys(values).forEach(function (k) {\n result[k] = values[k].value\n })\n return result\n}\n\nmodule.exports = function (proto, opts) {\n if (!opts) opts = {}\n if (!proto) throw new Error('Pass in a .proto string or a protobuf-schema parsed object')\n\n var sch = (typeof proto === 'object' && !(proto instanceof Uint8Array)) ? proto : schema.parse(proto)\n\n // to not make toString,toJSON enumarable we make a fire-and-forget prototype\n var Messages = function () {\n var self = this\n\n compile(sch, opts.encodings || {}).forEach(function (m) {\n self[m.name] = flatten(m.values) || m\n })\n }\n\n Messages.prototype.toString = function () {\n return schema.stringify(sch)\n }\n\n Messages.prototype.toJSON = function () {\n return sch\n }\n\n return new Messages()\n}\n","'use strict'\n\nmodule.exports = `// An IPFS MerkleDAG Link\nmessage PBLink {\n\n // multihash of the target object\n optional bytes Hash = 1;\n\n // utf string name. should be unique per object\n optional string Name = 2;\n\n // cumulative size of target object\n optional uint64 Tsize = 3;\n}\n\n// An IPFS MerkleDAG Node\nmessage PBNode {\n\n // refs to other objects\n repeated PBLink Links = 2;\n\n // opaque user data\n optional bytes Data = 1;\n}`\n","'use strict'\n\nconst CID = require('cids')\nconst multicodec = require('multicodec')\nconst multihashing = require('multihashing-async')\n\nexports = module.exports\n\nexports.codec = multicodec.DAG_PB\nexports.defaultHashAlg = multicodec.SHA2_256\n\n/**\n * Calculate the CID of the binary blob.\n *\n * @param {Object} binaryBlob - Encoded IPLD Node\n * @param {Object} [userOptions] - Options to create the CID\n * @param {number} [userOptions.cidVersion=1] - CID version number\n * @param {string} [UserOptions.hashAlg] - Defaults to the defaultHashAlg of the format\n * @returns {Promise.}\n */\nconst cid = async (binaryBlob, userOptions) => {\n const defaultOptions = { cidVersion: 1, hashAlg: exports.defaultHashAlg }\n const options = Object.assign(defaultOptions, userOptions)\n\n const multihash = await multihashing(binaryBlob, options.hashAlg)\n const codecName = multicodec.print[exports.codec]\n const cid = new CID(options.cidVersion, codecName, multihash)\n\n return cid\n}\n\nexports.cid = cid\n","module.exports = {\n encode: require('./encode.js')\n , decode: require('./decode.js')\n , encodingLength: require('./length.js')\n}\n","'use strict'\n\nconst varint = require('varint')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\n\nmodule.exports = {\n numberToUint8Array,\n uint8ArrayToNumber,\n varintUint8ArrayEncode,\n varintEncode\n}\n\nfunction uint8ArrayToNumber (buf) {\n return parseInt(uint8ArrayToString(buf, 'base16'), 16)\n}\n\nfunction numberToUint8Array (num) {\n let hexString = num.toString(16)\n if (hexString.length % 2 === 1) {\n hexString = '0' + hexString\n }\n return uint8ArrayFromString(hexString, 'base16')\n}\n\nfunction varintUint8ArrayEncode (input) {\n return Uint8Array.from(varint.encode(uint8ArrayToNumber(input)))\n}\n\nfunction varintEncode (num) {\n return Uint8Array.from(varint.encode(num))\n}\n","/**\n * Multihash implementation in JavaScript.\n */\n'use strict'\n\nconst multibase = require('multibase')\nconst varint = require('varint')\nconst { names } = require('./constants')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\nconst uint8ArrayConcat = require('uint8arrays/concat')\n\nconst codes = /** @type {import('./types').CodeNameMap} */({})\n\n// eslint-disable-next-line guard-for-in\nfor (const key in names) {\n const name = /** @type {HashName} */(key)\n codes[names[name]] = name\n}\nObject.freeze(codes)\n\n/**\n * Convert the given multihash to a hex encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toHexString (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(hash, 'base16')\n}\n\n/**\n * Convert the given hex encoded string to a multihash.\n *\n * @param {string} hash\n * @returns {Uint8Array}\n */\nfunction fromHexString (hash) {\n return uint8ArrayFromString(hash, 'base16')\n}\n\n/**\n * Convert the given multihash to a base58 encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toB58String (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1)\n}\n\n/**\n * Convert the given base58 encoded string to a multihash.\n *\n * @param {string|Uint8Array} hash\n * @returns {Uint8Array}\n */\nfunction fromB58String (hash) {\n const encoded = hash instanceof Uint8Array\n ? uint8ArrayToString(hash)\n : hash\n\n return multibase.decode('z' + encoded)\n}\n\n/**\n * Decode a hash from the given multihash.\n *\n * @param {Uint8Array} bytes\n * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result\n */\nfunction decode (bytes) {\n if (!(bytes instanceof Uint8Array)) {\n throw new Error('multihash must be a Uint8Array')\n }\n\n if (bytes.length < 2) {\n throw new Error('multihash too short. must be > 2 bytes.')\n }\n\n const code = /** @type {HashCode} */(varint.decode(bytes))\n if (!isValidCode(code)) {\n throw new Error(`multihash unknown function code: 0x${code.toString(16)}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n const len = varint.decode(bytes)\n if (len < 0) {\n throw new Error(`multihash invalid length: ${len}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n if (bytes.length !== len) {\n throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`)\n }\n\n return {\n code,\n name: codes[code],\n length: len,\n digest: bytes\n }\n}\n\n/**\n * Encode a hash digest along with the specified function code.\n *\n * > **Note:** the length is derived from the length of the digest itself.\n *\n * @param {Uint8Array} digest\n * @param {HashName | HashCode} code\n * @param {number} [length]\n * @returns {Uint8Array}\n */\nfunction encode (digest, code, length) {\n if (!digest || code === undefined) {\n throw new Error('multihash encode requires at least two args: digest, code')\n }\n\n // ensure it's a hashfunction code.\n const hashfn = coerceCode(code)\n\n if (!(digest instanceof Uint8Array)) {\n throw new Error('digest should be a Uint8Array')\n }\n\n if (length == null) {\n length = digest.length\n }\n\n if (length && digest.length !== length) {\n throw new Error('digest length should be equal to specified length.')\n }\n\n const hash = varint.encode(hashfn)\n const len = varint.encode(length)\n return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length)\n}\n\n/**\n * Converts a hash function name into the matching code.\n * If passed a number it will return the number if it's a valid code.\n *\n * @param {HashName | number} name\n * @returns {number}\n */\nfunction coerceCode (name) {\n let code = name\n\n if (typeof name === 'string') {\n if (names[name] === undefined) {\n throw new Error(`Unrecognized hash function named: ${name}`)\n }\n code = names[name]\n }\n\n if (typeof code !== 'number') {\n throw new Error(`Hash function code should be a number. Got: ${code}`)\n }\n\n // @ts-ignore\n if (codes[code] === undefined && !isAppCode(code)) {\n throw new Error(`Unrecognized function code: ${code}`)\n }\n\n return code\n}\n\n/**\n * Checks if a code is part of the app range\n *\n * @param {number} code\n * @returns {boolean}\n */\nfunction isAppCode (code) {\n return code > 0 && code < 0x10\n}\n\n/**\n * Checks whether a multihash code is valid.\n *\n * @param {HashCode} code\n * @returns {boolean}\n */\nfunction isValidCode (code) {\n if (isAppCode(code)) {\n return true\n }\n\n if (codes[code]) {\n return true\n }\n\n return false\n}\n\n/**\n * Check if the given buffer is a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {void}\n * @throws {Error}\n */\nfunction validate (multihash) {\n decode(multihash) // throws if bad.\n}\n\n/**\n * Returns a prefix from a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n * @throws {Error}\n */\nfunction prefix (multihash) {\n validate(multihash)\n\n return multihash.subarray(0, 2)\n}\n\nmodule.exports = {\n names,\n codes,\n toHexString,\n fromHexString,\n toB58String,\n fromB58String,\n decode,\n encode,\n coerceCode,\n isAppCode,\n validate,\n prefix,\n isValidCode\n}\n\n/**\n * @typedef { import(\"./constants\").HashCode } HashCode\n * @typedef { import(\"./constants\").HashName } HashName\n */\n","\"use strict\"\n\nexports.TextEncoder = TextEncoder\nexports.TextDecoder = TextDecoder\n","var ERROR_MSG_INPUT = 'Input must be an string, Buffer or Uint8Array'\n\n// For convenience, let people hash a string, not just a Uint8Array\nfunction normalizeInput (input) {\n var ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof (input) === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}\n\n// Converts a Uint8Array to a hexadecimal string\n// For example, toHex([255, 0, 255]) returns \"ff00ff\"\nfunction toHex (bytes) {\n return Array.prototype.map.call(bytes, function (n) {\n return (n < 16 ? '0' : '') + n.toString(16)\n }).join('')\n}\n\n// Converts any value in [0...2^32-1] to an 8-character hex string\nfunction uint32ToHex (val) {\n return (0x100000000 + val).toString(16).substring(1)\n}\n\n// For debugging: prints out hash state in the same format as the RFC\n// sample computation exactly, so that you can diff\nfunction debugPrint (label, arr, size) {\n var msg = '\\n' + label + ' = '\n for (var i = 0; i < arr.length; i += 2) {\n if (size === 32) {\n msg += uint32ToHex(arr[i]).toUpperCase()\n msg += ' '\n msg += uint32ToHex(arr[i + 1]).toUpperCase()\n } else if (size === 64) {\n msg += uint32ToHex(arr[i + 1]).toUpperCase()\n msg += uint32ToHex(arr[i]).toUpperCase()\n } else throw new Error('Invalid size ' + size)\n if (i % 6 === 4) {\n msg += '\\n' + new Array(label.length + 4).join(' ')\n } else if (i < arr.length - 2) {\n msg += ' '\n }\n }\n console.log(msg)\n}\n\n// For performance testing: generates N bytes of input, hashes M times\n// Measures and prints MB/second hash performance each time\nfunction testSpeed (hashFn, N, M) {\n var startMs = new Date().getTime()\n\n var input = new Uint8Array(N)\n for (var i = 0; i < N; i++) {\n input[i] = i % 256\n }\n var genMs = new Date().getTime()\n console.log('Generated random input in ' + (genMs - startMs) + 'ms')\n startMs = genMs\n\n for (i = 0; i < M; i++) {\n var hashHex = hashFn(input)\n var hashMs = new Date().getTime()\n var ms = hashMs - startMs\n startMs = hashMs\n console.log('Hashed in ' + ms + 'ms: ' + hashHex.substring(0, 20) + '...')\n console.log(Math.round(N / (1 << 20) / (ms / 1000) * 100) / 100 + ' MB PER SECOND')\n }\n}\n\nmodule.exports = {\n normalizeInput: normalizeInput,\n toHex: toHex,\n debugPrint: debugPrint,\n testSpeed: testSpeed\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict'\n\nexports = module.exports = require('./dagLink')\nexports.util = require('./util')\n","'use strict'\n\nconst protons = require('protons')\nconst proto = protons(require('./dag.proto'))\nconst DAGLink = require('./dag-link/dagLink')\nconst DAGNode = require('./dag-node/dagNode')\nconst { serializeDAGNodeLike } = require('./serialize')\nconst genCid = require('./genCid')\n\nexports = module.exports\n\nexports.codec = genCid.codec\nexports.defaultHashAlg = genCid.defaultHashAlg\n\n/**\n * Calculate the CID of the binary blob.\n *\n * @param {Object} binaryBlob - Encoded IPLD Node\n * @param {Object} [userOptions] - Options to create the CID\n * @param {number} [userOptions.cidVersion=1] - CID version number\n * @param {string} [UserOptions.hashAlg] - Defaults to the defaultHashAlg of the format\n * @returns {Promise.}\n */\nconst cid = (binaryBlob, userOptions) => {\n return genCid.cid(binaryBlob, userOptions)\n}\n\n/**\n * Serialize internal representation into a binary PB block.\n *\n * @param {Object} node - Internal representation of a CBOR block\n * @returns {Uint8Array} - The encoded binary representation\n */\nconst serialize = (node) => {\n if (DAGNode.isDAGNode(node)) {\n return node.serialize()\n } else {\n return serializeDAGNodeLike(node.Data, node.Links)\n }\n}\n\n/**\n * Deserialize PB block into the internal representation.\n *\n * @param {Uint8Array} buffer - Binary representation of a PB block\n * @returns {Object} - An object that conforms to the IPLD Data Model\n */\nconst deserialize = (buffer) => {\n const pbn = proto.PBNode.decode(buffer)\n\n const links = pbn.Links.map((link) => {\n return new DAGLink(link.Name, link.Tsize, link.Hash)\n })\n\n const data = pbn.Data == null ? new Uint8Array(0) : pbn.Data\n\n return new DAGNode(data, links, buffer.byteLength)\n}\n\nexports.serialize = serialize\nexports.deserialize = deserialize\nexports.cid = cid\n","'use strict'\n\nconst cbor = require('borc')\nconst multicodec = require('multicodec')\nconst multihashing = require('multihashing-async')\nconst CID = require('cids')\nconst isCircular = require('is-circular')\nconst uint8ArrayConcat = require('uint8arrays/concat')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\n\n// https://github.com/ipfs/go-ipfs/issues/3570#issuecomment-273931692\nconst CID_CBOR_TAG = 42\n\nfunction tagCID (cid) {\n if (typeof cid === 'string') {\n cid = new CID(cid).bytes\n } else if (CID.isCID(cid)) {\n cid = cid.bytes\n }\n\n return new cbor.Tagged(CID_CBOR_TAG, uint8ArrayConcat([\n uint8ArrayFromString('00', 'base16'), // thanks jdag\n cid\n ], 1 + cid.length))\n}\n\nfunction replaceCIDbyTAG (dagNode) {\n let circular\n try {\n circular = isCircular(dagNode)\n } catch (e) {\n circular = false\n }\n if (circular) {\n throw new Error('The object passed has circular references')\n }\n\n function transform (obj) {\n if (!obj || obj instanceof Uint8Array || typeof obj === 'string') {\n return obj\n }\n\n if (Array.isArray(obj)) {\n return obj.map(transform)\n }\n\n if (CID.isCID(obj)) {\n return tagCID(obj)\n }\n\n const keys = Object.keys(obj)\n\n if (keys.length > 0) {\n // Recursive transform\n const out = {}\n keys.forEach((key) => {\n if (typeof obj[key] === 'object') {\n out[key] = transform(obj[key])\n } else {\n out[key] = obj[key]\n }\n })\n return out\n } else {\n return obj\n }\n }\n\n return transform(dagNode)\n}\n\nconst codec = multicodec.DAG_CBOR\nconst defaultHashAlg = multicodec.SHA2_256\n\nconst defaultTags = {\n [CID_CBOR_TAG]: (val) => {\n // remove that 0\n val = val.slice(1)\n return new CID(val)\n }\n}\nconst defaultSize = 64 * 1024 // current decoder heap size, 64 Kb\nlet currentSize = defaultSize\nconst defaultMaxSize = 64 * 1024 * 1024 // max heap size when auto-growing, 64 Mb\nlet maxSize = defaultMaxSize\nlet decoder = null\n\n/**\n * Configure the underlying CBOR decoder.\n *\n * @param {Object} [options] - The options the decoder takes. The decoder will reset to the defaul values if no options are given.\n * @param {number} [options.size=65536] - The current heap size used in CBOR parsing, this may grow automatically as larger blocks are encountered up to `maxSize`\n * @param {number} [options.maxSize=67108864] - The maximum size the CBOR parsing heap is allowed to grow to before `dagCBOR.util.deserialize()` returns an error\n * @param {Object} [options.tags] - An object whose keys are CBOR tag numbers and values are transform functions that accept a `value` and return a decoded representation of that `value`\n */\nfunction configureDecoder (options) {\n let tags = defaultTags\n\n if (options) {\n if (typeof options.size === 'number') {\n currentSize = options.size\n }\n if (typeof options.maxSize === 'number') {\n maxSize = options.maxSize\n }\n if (options.tags) {\n tags = Object.assign({}, defaultTags, options && options.tags)\n }\n } else {\n // no options, reset to defaults\n currentSize = defaultSize\n maxSize = defaultMaxSize\n }\n\n const decoderOptions = {\n tags,\n size: currentSize\n }\n\n decoder = new cbor.Decoder(decoderOptions)\n // borc edits opts.size in-place so we can capture _actual_ size\n currentSize = decoderOptions.size\n}\n\nconfigureDecoder() // Setup default cbor.Decoder\n\n/**\n * Serialize internal representation into a binary CBOR block.\n *\n * @param {Object} node - Internal representation of a CBOR block\n * @returns {Uint8Array} - The encoded binary representation\n */\nfunction serialize (node) {\n const nodeTagged = replaceCIDbyTAG(node)\n const serialized = cbor.encode(nodeTagged)\n\n return serialized\n}\n\n/**\n * Deserialize CBOR block into the internal representation.\n *\n * @param {Uint8Array} data - Binary representation of a CBOR block\n * @returns {Object} - An object that conforms to the IPLD Data Model\n */\nfunction deserialize (data) {\n if (data.length > currentSize && data.length <= maxSize) {\n configureDecoder({ size: data.length })\n }\n\n if (data.length > currentSize) {\n throw new Error('Data is too large to deserialize with current decoder')\n }\n\n // borc will decode back-to-back objects into an implicit top-level array, we\n // strictly want to only see a single explicit top-level object\n const all = decoder.decodeAll(data)\n if (all.length !== 1) {\n throw new Error('Extraneous CBOR data found beyond initial top-level object')\n }\n\n return all[0]\n}\n\n/**\n * Calculate the CID of the binary blob.\n *\n * @param {Object} binaryBlob - Encoded IPLD Node\n * @param {Object} [userOptions] - Options to create the CID\n * @param {number} [userOptions.cidVersion=1] - CID version number\n * @param {string} [userOptions.hashAlg] - Defaults to the defaultHashAlg of the format\n * @returns {Promise.}\n */\nasync function cid (binaryBlob, userOptions) {\n const defaultOptions = { cidVersion: 1, hashAlg: defaultHashAlg }\n const options = Object.assign(defaultOptions, userOptions)\n\n const multihash = await multihashing(binaryBlob, options.hashAlg)\n const codecName = multicodec.getNameFromCode(codec)\n const cid = new CID(options.cidVersion, codecName, multihash)\n\n return cid\n}\n\nmodule.exports = {\n codec,\n defaultHashAlg,\n configureDecoder,\n serialize,\n deserialize,\n cid\n}\n","'use strict'\n\nconst { Buffer } = require('buffer')\nconst ieee754 = require('ieee754')\nconst Bignumber = require('bignumber.js').BigNumber\n\nconst parser = require('./decoder.asm')\nconst utils = require('./utils')\nconst c = require('./constants')\nconst Simple = require('./simple')\nconst Tagged = require('./tagged')\nconst { URL } = require('iso-url')\n\n/**\n * Transform binary cbor data into JavaScript objects.\n */\nclass Decoder {\n /**\n * @param {Object} [opts={}]\n * @param {number} [opts.size=65536] - Size of the allocated heap.\n */\n constructor (opts) {\n opts = opts || {}\n\n if (!opts.size || opts.size < 0x10000) {\n opts.size = 0x10000\n } else {\n // Ensure the size is a power of 2\n opts.size = utils.nextPowerOf2(opts.size)\n }\n\n // Heap use to share the input with the parser\n this._heap = new ArrayBuffer(opts.size)\n this._heap8 = new Uint8Array(this._heap)\n this._buffer = Buffer.from(this._heap)\n\n this._reset()\n\n // Known tags\n this._knownTags = Object.assign({\n 0: (val) => new Date(val),\n 1: (val) => new Date(val * 1000),\n 2: (val) => utils.arrayBufferToBignumber(val),\n 3: (val) => c.NEG_ONE.minus(utils.arrayBufferToBignumber(val)),\n 4: (v) => {\n // const v = new Uint8Array(val)\n return c.TEN.pow(v[0]).times(v[1])\n },\n 5: (v) => {\n // const v = new Uint8Array(val)\n return c.TWO.pow(v[0]).times(v[1])\n },\n 32: (val) => new URL(val),\n 35: (val) => new RegExp(val)\n }, opts.tags)\n\n // Initialize asm based parser\n this.parser = parser(global, {\n // eslint-disable-next-line no-console\n log: console.log.bind(console),\n pushInt: this.pushInt.bind(this),\n pushInt32: this.pushInt32.bind(this),\n pushInt32Neg: this.pushInt32Neg.bind(this),\n pushInt64: this.pushInt64.bind(this),\n pushInt64Neg: this.pushInt64Neg.bind(this),\n pushFloat: this.pushFloat.bind(this),\n pushFloatSingle: this.pushFloatSingle.bind(this),\n pushFloatDouble: this.pushFloatDouble.bind(this),\n pushTrue: this.pushTrue.bind(this),\n pushFalse: this.pushFalse.bind(this),\n pushUndefined: this.pushUndefined.bind(this),\n pushNull: this.pushNull.bind(this),\n pushInfinity: this.pushInfinity.bind(this),\n pushInfinityNeg: this.pushInfinityNeg.bind(this),\n pushNaN: this.pushNaN.bind(this),\n pushNaNNeg: this.pushNaNNeg.bind(this),\n pushArrayStart: this.pushArrayStart.bind(this),\n pushArrayStartFixed: this.pushArrayStartFixed.bind(this),\n pushArrayStartFixed32: this.pushArrayStartFixed32.bind(this),\n pushArrayStartFixed64: this.pushArrayStartFixed64.bind(this),\n pushObjectStart: this.pushObjectStart.bind(this),\n pushObjectStartFixed: this.pushObjectStartFixed.bind(this),\n pushObjectStartFixed32: this.pushObjectStartFixed32.bind(this),\n pushObjectStartFixed64: this.pushObjectStartFixed64.bind(this),\n pushByteString: this.pushByteString.bind(this),\n pushByteStringStart: this.pushByteStringStart.bind(this),\n pushUtf8String: this.pushUtf8String.bind(this),\n pushUtf8StringStart: this.pushUtf8StringStart.bind(this),\n pushSimpleUnassigned: this.pushSimpleUnassigned.bind(this),\n pushTagUnassigned: this.pushTagUnassigned.bind(this),\n pushTagStart: this.pushTagStart.bind(this),\n pushTagStart4: this.pushTagStart4.bind(this),\n pushTagStart8: this.pushTagStart8.bind(this),\n pushBreak: this.pushBreak.bind(this)\n }, this._heap)\n }\n\n get _depth () {\n return this._parents.length\n }\n\n get _currentParent () {\n return this._parents[this._depth - 1]\n }\n\n get _ref () {\n return this._currentParent.ref\n }\n\n // Finish the current parent\n _closeParent () {\n var p = this._parents.pop()\n\n if (p.length > 0) {\n throw new Error(`Missing ${p.length} elements`)\n }\n\n switch (p.type) {\n case c.PARENT.TAG:\n this._push(\n this.createTag(p.ref[0], p.ref[1])\n )\n break\n case c.PARENT.BYTE_STRING:\n this._push(this.createByteString(p.ref, p.length))\n break\n case c.PARENT.UTF8_STRING:\n this._push(this.createUtf8String(p.ref, p.length))\n break\n case c.PARENT.MAP:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createMap(p.ref, p.length))\n break\n case c.PARENT.OBJECT:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createObject(p.ref, p.length))\n break\n case c.PARENT.ARRAY:\n this._push(this.createArray(p.ref, p.length))\n break\n default:\n break\n }\n\n if (this._currentParent && this._currentParent.type === c.PARENT.TAG) {\n this._dec()\n }\n }\n\n // Reduce the expected length of the current parent by one\n _dec () {\n const p = this._currentParent\n // The current parent does not know the epxected child length\n\n if (p.length < 0) {\n return\n }\n\n p.length--\n\n // All children were seen, we can close the current parent\n if (p.length === 0) {\n this._closeParent()\n }\n }\n\n // Push any value to the current parent\n _push (val, hasChildren) {\n const p = this._currentParent\n p.values++\n\n switch (p.type) {\n case c.PARENT.ARRAY:\n case c.PARENT.BYTE_STRING:\n case c.PARENT.UTF8_STRING:\n if (p.length > -1) {\n this._ref[this._ref.length - p.length] = val\n } else {\n this._ref.push(val)\n }\n this._dec()\n break\n case c.PARENT.OBJECT:\n if (p.tmpKey != null) {\n this._ref[p.tmpKey] = val\n p.tmpKey = null\n this._dec()\n } else {\n p.tmpKey = val\n\n if (typeof p.tmpKey !== 'string') {\n // too bad, convert to a Map\n p.type = c.PARENT.MAP\n p.ref = utils.buildMap(p.ref)\n }\n }\n break\n case c.PARENT.MAP:\n if (p.tmpKey != null) {\n this._ref.set(p.tmpKey, val)\n p.tmpKey = null\n this._dec()\n } else {\n p.tmpKey = val\n }\n break\n case c.PARENT.TAG:\n this._ref.push(val)\n if (!hasChildren) {\n this._dec()\n }\n break\n default:\n throw new Error('Unknown parent type')\n }\n }\n\n // Create a new parent in the parents list\n _createParent (obj, type, len) {\n this._parents[this._depth] = {\n type: type,\n length: len,\n ref: obj,\n values: 0,\n tmpKey: null\n }\n }\n\n // Reset all state back to the beginning, also used for initiatlization\n _reset () {\n this._res = []\n this._parents = [{\n type: c.PARENT.ARRAY,\n length: -1,\n ref: this._res,\n values: 0,\n tmpKey: null\n }]\n }\n\n // -- Interface to customize deoding behaviour\n createTag (tagNumber, value) {\n const typ = this._knownTags[tagNumber]\n\n if (!typ) {\n return new Tagged(tagNumber, value)\n }\n\n return typ(value)\n }\n\n createMap (obj, len) {\n return obj\n }\n\n createObject (obj, len) {\n return obj\n }\n\n createArray (arr, len) {\n return arr\n }\n\n createByteString (raw, len) {\n return Buffer.concat(raw)\n }\n\n createByteStringFromHeap (start, end) {\n if (start === end) {\n return Buffer.alloc(0)\n }\n\n return Buffer.from(this._heap.slice(start, end))\n }\n\n createInt (val) {\n return val\n }\n\n createInt32 (f, g) {\n return utils.buildInt32(f, g)\n }\n\n createInt64 (f1, f2, g1, g2) {\n return utils.buildInt64(f1, f2, g1, g2)\n }\n\n createFloat (val) {\n return val\n }\n\n createFloatSingle (a, b, c, d) {\n return ieee754.read([a, b, c, d], 0, false, 23, 4)\n }\n\n createFloatDouble (a, b, c, d, e, f, g, h) {\n return ieee754.read([a, b, c, d, e, f, g, h], 0, false, 52, 8)\n }\n\n createInt32Neg (f, g) {\n return -1 - utils.buildInt32(f, g)\n }\n\n createInt64Neg (f1, f2, g1, g2) {\n const f = utils.buildInt32(f1, f2)\n const g = utils.buildInt32(g1, g2)\n\n if (f > c.MAX_SAFE_HIGH) {\n return c.NEG_ONE.minus(new Bignumber(f).times(c.SHIFT32).plus(g))\n }\n\n return -1 - ((f * c.SHIFT32) + g)\n }\n\n createTrue () {\n return true\n }\n\n createFalse () {\n return false\n }\n\n createNull () {\n return null\n }\n\n createUndefined () {\n return undefined\n }\n\n createInfinity () {\n return Infinity\n }\n\n createInfinityNeg () {\n return -Infinity\n }\n\n createNaN () {\n return NaN\n }\n\n createNaNNeg () {\n return -NaN\n }\n\n createUtf8String (raw, len) {\n return raw.join('')\n }\n\n createUtf8StringFromHeap (start, end) {\n if (start === end) {\n return ''\n }\n\n return this._buffer.toString('utf8', start, end)\n }\n\n createSimpleUnassigned (val) {\n return new Simple(val)\n }\n\n // -- Interface for decoder.asm.js\n\n pushInt (val) {\n this._push(this.createInt(val))\n }\n\n pushInt32 (f, g) {\n this._push(this.createInt32(f, g))\n }\n\n pushInt64 (f1, f2, g1, g2) {\n this._push(this.createInt64(f1, f2, g1, g2))\n }\n\n pushFloat (val) {\n this._push(this.createFloat(val))\n }\n\n pushFloatSingle (a, b, c, d) {\n this._push(this.createFloatSingle(a, b, c, d))\n }\n\n pushFloatDouble (a, b, c, d, e, f, g, h) {\n this._push(this.createFloatDouble(a, b, c, d, e, f, g, h))\n }\n\n pushInt32Neg (f, g) {\n this._push(this.createInt32Neg(f, g))\n }\n\n pushInt64Neg (f1, f2, g1, g2) {\n this._push(this.createInt64Neg(f1, f2, g1, g2))\n }\n\n pushTrue () {\n this._push(this.createTrue())\n }\n\n pushFalse () {\n this._push(this.createFalse())\n }\n\n pushNull () {\n this._push(this.createNull())\n }\n\n pushUndefined () {\n this._push(this.createUndefined())\n }\n\n pushInfinity () {\n this._push(this.createInfinity())\n }\n\n pushInfinityNeg () {\n this._push(this.createInfinityNeg())\n }\n\n pushNaN () {\n this._push(this.createNaN())\n }\n\n pushNaNNeg () {\n this._push(this.createNaNNeg())\n }\n\n pushArrayStart () {\n this._createParent([], c.PARENT.ARRAY, -1)\n }\n\n pushArrayStartFixed (len) {\n this._createArrayStartFixed(len)\n }\n\n pushArrayStartFixed32 (len1, len2) {\n const len = utils.buildInt32(len1, len2)\n this._createArrayStartFixed(len)\n }\n\n pushArrayStartFixed64 (len1, len2, len3, len4) {\n const len = utils.buildInt64(len1, len2, len3, len4)\n this._createArrayStartFixed(len)\n }\n\n pushObjectStart () {\n this._createObjectStartFixed(-1)\n }\n\n pushObjectStartFixed (len) {\n this._createObjectStartFixed(len)\n }\n\n pushObjectStartFixed32 (len1, len2) {\n const len = utils.buildInt32(len1, len2)\n this._createObjectStartFixed(len)\n }\n\n pushObjectStartFixed64 (len1, len2, len3, len4) {\n const len = utils.buildInt64(len1, len2, len3, len4)\n this._createObjectStartFixed(len)\n }\n\n pushByteStringStart () {\n this._parents[this._depth] = {\n type: c.PARENT.BYTE_STRING,\n length: -1,\n ref: [],\n values: 0,\n tmpKey: null\n }\n }\n\n pushByteString (start, end) {\n this._push(this.createByteStringFromHeap(start, end))\n }\n\n pushUtf8StringStart () {\n this._parents[this._depth] = {\n type: c.PARENT.UTF8_STRING,\n length: -1,\n ref: [],\n values: 0,\n tmpKey: null\n }\n }\n\n pushUtf8String (start, end) {\n this._push(this.createUtf8StringFromHeap(start, end))\n }\n\n pushSimpleUnassigned (val) {\n this._push(this.createSimpleUnassigned(val))\n }\n\n pushTagStart (tag) {\n this._parents[this._depth] = {\n type: c.PARENT.TAG,\n length: 1,\n ref: [tag]\n }\n }\n\n pushTagStart4 (f, g) {\n this.pushTagStart(utils.buildInt32(f, g))\n }\n\n pushTagStart8 (f1, f2, g1, g2) {\n this.pushTagStart(utils.buildInt64(f1, f2, g1, g2))\n }\n\n pushTagUnassigned (tagNumber) {\n this._push(this.createTag(tagNumber))\n }\n\n pushBreak () {\n if (this._currentParent.length > -1) {\n throw new Error('Unexpected break')\n }\n\n this._closeParent()\n }\n\n _createObjectStartFixed (len) {\n if (len === 0) {\n this._push(this.createObject({}))\n return\n }\n\n this._createParent({}, c.PARENT.OBJECT, len)\n }\n\n _createArrayStartFixed (len) {\n if (len === 0) {\n this._push(this.createArray([]))\n return\n }\n\n this._createParent(new Array(len), c.PARENT.ARRAY, len)\n }\n\n _decode (input) {\n if (input.byteLength === 0) {\n throw new Error('Input too short')\n }\n\n this._reset()\n this._heap8.set(input)\n const code = this.parser.parse(input.byteLength)\n\n if (this._depth > 1) {\n while (this._currentParent.length === 0) {\n this._closeParent()\n }\n if (this._depth > 1) {\n throw new Error('Undeterminated nesting')\n }\n }\n\n if (code > 0) {\n throw new Error('Failed to parse')\n }\n\n if (this._res.length === 0) {\n throw new Error('No valid result')\n }\n }\n\n // -- Public Interface\n\n decodeFirst (input) {\n this._decode(input)\n\n return this._res[0]\n }\n\n decodeAll (input) {\n this._decode(input)\n\n return this._res\n }\n\n /**\n * Decode the first cbor object.\n *\n * @param {Buffer|string} input\n * @param {string} [enc='hex'] - Encoding used if a string is passed.\n * @returns {*}\n */\n static decode (input, enc) {\n if (typeof input === 'string') {\n input = Buffer.from(input, enc || 'hex')\n }\n\n const dec = new Decoder({ size: input.length })\n return dec.decodeFirst(input)\n }\n\n /**\n * Decode all cbor objects.\n *\n * @param {Buffer|string} input\n * @param {string} [enc='hex'] - Encoding used if a string is passed.\n * @returns {Array<*>}\n */\n static decodeAll (input, enc) {\n if (typeof input === 'string') {\n input = Buffer.from(input, enc || 'hex')\n }\n\n const dec = new Decoder({ size: input.length })\n return dec.decodeAll(input)\n }\n}\n\nDecoder.decodeFirst = Decoder.decode\n\nmodule.exports = Decoder\n","'use strict'\n\nconst constants = require('./constants')\nconst MT = constants.MT\nconst SIMPLE = constants.SIMPLE\nconst SYMS = constants.SYMS\n\n/**\n * A CBOR Simple Value that does not map onto a known constant.\n */\nclass Simple {\n /**\n * Creates an instance of Simple.\n *\n * @param {integer} value - the simple value's integer value\n */\n constructor (value) {\n if (typeof value !== 'number') {\n throw new Error('Invalid Simple type: ' + (typeof value))\n }\n if ((value < 0) || (value > 255) || ((value | 0) !== value)) {\n throw new Error('value must be a small positive integer: ' + value)\n }\n this.value = value\n }\n\n /**\n * Debug string for simple value\n *\n * @returns {string} simple(value)\n */\n toString () {\n return 'simple(' + this.value + ')'\n }\n\n /**\n * Debug string for simple value\n *\n * @returns {string} simple(value)\n */\n inspect () {\n return 'simple(' + this.value + ')'\n }\n\n /**\n * Push the simple value onto the CBOR stream\n *\n * @param {cbor.Encoder} gen The generator to push onto\n * @returns {number}\n */\n encodeCBOR (gen) {\n return gen._pushInt(this.value, MT.SIMPLE_FLOAT)\n }\n\n /**\n * Is the given object a Simple?\n *\n * @param {any} obj - object to test\n * @returns {bool} - is it Simple?\n */\n static isSimple (obj) {\n return obj instanceof Simple\n }\n\n /**\n * Decode from the CBOR additional information into a JavaScript value.\n * If the CBOR item has no parent, return a \"safe\" symbol instead of\n * `null` or `undefined`, so that the value can be passed through a\n * stream in object mode.\n *\n * @param {Number} val - the CBOR additional info to convert\n * @param {bool} hasParent - Does the CBOR item have a parent?\n * @returns {(null|undefined|Boolean|Symbol)} - the decoded value\n */\n static decode (val, hasParent) {\n if (hasParent == null) {\n hasParent = true\n }\n switch (val) {\n case SIMPLE.FALSE:\n return false\n case SIMPLE.TRUE:\n return true\n case SIMPLE.NULL:\n if (hasParent) {\n return null\n } else {\n return SYMS.NULL\n }\n case SIMPLE.UNDEFINED:\n if (hasParent) {\n return undefined\n } else {\n return SYMS.UNDEFINED\n }\n case -1:\n if (!hasParent) {\n throw new Error('Invalid BREAK')\n }\n return SYMS.BREAK\n default:\n return new Simple(val)\n }\n }\n}\n\nmodule.exports = Simple\n","'use strict'\n\n/**\n * A CBOR tagged item, where the tag does not have semantics specified at the\n * moment, or those semantics threw an error during parsing. Typically this will\n * be an extension point you're not yet expecting.\n */\nclass Tagged {\n /**\n * Creates an instance of Tagged.\n *\n * @param {Number} tag - the number of the tag\n * @param {any} value - the value inside the tag\n * @param {Error} err - the error that was thrown parsing the tag, or null\n */\n constructor (tag, value, err) {\n this.tag = tag\n this.value = value\n this.err = err\n if (typeof this.tag !== 'number') {\n throw new Error('Invalid tag type (' + (typeof this.tag) + ')')\n }\n if ((this.tag < 0) || ((this.tag | 0) !== this.tag)) {\n throw new Error('Tag must be a positive integer: ' + this.tag)\n }\n }\n\n /**\n * Convert to a String\n *\n * @returns {String} string of the form '1(2)'\n */\n toString () {\n return `${this.tag}(${JSON.stringify(this.value)})`\n }\n\n /**\n * Push the simple value onto the CBOR stream\n *\n * @param {cbor.Encoder} gen The generator to push onto\n * @returns {number}\n */\n encodeCBOR (gen) {\n gen._pushTag(this.tag)\n return gen.pushAny(this.value)\n }\n\n /**\n * If we have a converter for this type, do the conversion. Some converters\n * are built-in. Additional ones can be passed in. If you want to remove\n * a built-in converter, pass a converter in whose value is 'null' instead\n * of a function.\n *\n * @param {Object} converters - keys in the object are a tag number, the value\n * is a function that takes the decoded CBOR and returns a JavaScript value\n * of the appropriate type. Throw an exception in the function on errors.\n * @returns {any} - the converted item\n */\n convert (converters) {\n var er, f\n f = converters != null ? converters[this.tag] : undefined\n if (typeof f !== 'function') {\n f = Tagged['_tag' + this.tag]\n if (typeof f !== 'function') {\n return this\n }\n }\n try {\n return f.call(Tagged, this.value)\n } catch (error) {\n er = error\n this.err = er\n return this\n }\n }\n}\n\nmodule.exports = Tagged\n","'use strict';\n\nconst {\n URLWithLegacySupport,\n format,\n URLSearchParams,\n defaultBase\n} = require('./src/url');\nconst relative = require('./src/relative');\n\nmodule.exports = {\n URL: URLWithLegacySupport,\n URLSearchParams,\n format,\n relative,\n defaultBase\n};\n","'use strict';\n\nconst defaultBase = self.location ?\n self.location.protocol + '//' + self.location.host :\n '';\nconst URL = self.URL;\n\nclass URLWithLegacySupport {\n constructor(url = '', base = defaultBase) {\n this.super = new URL(url, base);\n this.path = this.pathname + this.search;\n this.auth =\n this.username && this.password ?\n this.username + ':' + this.password :\n null;\n\n this.query =\n this.search && this.search.startsWith('?') ?\n this.search.slice(1) :\n null;\n }\n\n get hash() {\n return this.super.hash;\n }\n get host() {\n return this.super.host;\n }\n get hostname() {\n return this.super.hostname;\n }\n get href() {\n return this.super.href;\n }\n get origin() {\n return this.super.origin;\n }\n get password() {\n return this.super.password;\n }\n get pathname() {\n return this.super.pathname;\n }\n get port() {\n return this.super.port;\n }\n get protocol() {\n return this.super.protocol;\n }\n get search() {\n return this.super.search;\n }\n get searchParams() {\n return this.super.searchParams;\n }\n get username() {\n return this.super.username;\n }\n\n set hash(hash) {\n this.super.hash = hash;\n }\n set host(host) {\n this.super.host = host;\n }\n set hostname(hostname) {\n this.super.hostname = hostname;\n }\n set href(href) {\n this.super.href = href;\n }\n set origin(origin) {\n this.super.origin = origin;\n }\n set password(password) {\n this.super.password = password;\n }\n set pathname(pathname) {\n this.super.pathname = pathname;\n }\n set port(port) {\n this.super.port = port;\n }\n set protocol(protocol) {\n this.super.protocol = protocol;\n }\n set search(search) {\n this.super.search = search;\n }\n set searchParams(searchParams) {\n this.super.searchParams = searchParams;\n }\n set username(username) {\n this.super.username = username;\n }\n\n createObjectURL(o) {\n return this.super.createObjectURL(o);\n }\n revokeObjectURL(o) {\n this.super.revokeObjectURL(o);\n }\n toJSON() {\n return this.super.toJSON();\n }\n toString() {\n return this.super.toString();\n }\n format() {\n return this.toString();\n }\n}\n\nfunction format(obj) {\n if (typeof obj === 'string') {\n const url = new URL(obj);\n\n return url.toString();\n }\n\n if (!(obj instanceof URL)) {\n const userPass =\n obj.username && obj.password ?\n `${obj.username}:${obj.password}@` :\n '';\n const auth = obj.auth ? obj.auth + '@' : '';\n const port = obj.port ? ':' + obj.port : '';\n const protocol = obj.protocol ? obj.protocol + '//' : '';\n const host = obj.host || '';\n const hostname = obj.hostname || '';\n const search = obj.search || (obj.query ? '?' + obj.query : '');\n const hash = obj.hash || '';\n const pathname = obj.pathname || '';\n const path = obj.path || pathname + search;\n\n return `${protocol}${userPass || auth}${host ||\n hostname + port}${path}${hash}`;\n }\n}\n\nmodule.exports = {\n URLWithLegacySupport,\n URLSearchParams: self.URLSearchParams,\n defaultBase,\n format\n};\n","'use strict'\n\nconst varint = require('varint')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\n\nmodule.exports = {\n numberToUint8Array,\n uint8ArrayToNumber,\n varintUint8ArrayEncode,\n varintEncode\n}\n\n/**\n * @param {Uint8Array} buf\n */\nfunction uint8ArrayToNumber (buf) {\n return parseInt(uint8ArrayToString(buf, 'base16'), 16)\n}\n\n/**\n * @param {number} num\n */\nfunction numberToUint8Array (num) {\n let hexString = num.toString(16)\n if (hexString.length % 2 === 1) {\n hexString = '0' + hexString\n }\n return uint8ArrayFromString(hexString, 'base16')\n}\n\n/**\n * @param {Uint8Array} input\n */\nfunction varintUint8ArrayEncode (input) {\n return Uint8Array.from(varint.encode(uint8ArrayToNumber(input)))\n}\n\n/**\n * @param {number} num\n */\nfunction varintEncode (num) {\n return Uint8Array.from(varint.encode(num))\n}\n","'use strict'\n\nconst { encoding: getCodec } = require('multibase')\nconst { TextDecoder } = require('web-encoding')\nconst utf8Decoder = new TextDecoder('utf8')\n\n/**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n/**\n * Turns a Uint8Array of bytes into a string with each\n * character being the char code of the corresponding byte\n *\n * @param {Uint8Array} array - The array to turn into a string\n */\nfunction uint8ArrayToAsciiString (array) {\n let string = ''\n\n for (let i = 0; i < array.length; i++) {\n string += String.fromCharCode(array[i])\n }\n return string\n}\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {Uint8Array} array - The array to turn into a string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - The encoding to use\n * @returns {string}\n */\nfunction toString (array, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Decoder.decode(array)\n }\n\n if (encoding === 'ascii') {\n return uint8ArrayToAsciiString(array)\n }\n\n return getCodec(encoding).encode(array)\n}\n\nmodule.exports = toString\n","/**\n * Multihash implementation in JavaScript.\n */\n'use strict'\n\nconst multibase = require('multibase')\nconst varint = require('varint')\nconst { names } = require('./constants')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\nconst uint8ArrayConcat = require('uint8arrays/concat')\n\nconst codes = /** @type {import('./types').CodeNameMap} */({})\n\n// eslint-disable-next-line guard-for-in\nfor (const key in names) {\n const name = /** @type {HashName} */(key)\n codes[names[name]] = name\n}\nObject.freeze(codes)\n\n/**\n * Convert the given multihash to a hex encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toHexString (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(hash, 'base16')\n}\n\n/**\n * Convert the given hex encoded string to a multihash.\n *\n * @param {string} hash\n * @returns {Uint8Array}\n */\nfunction fromHexString (hash) {\n return uint8ArrayFromString(hash, 'base16')\n}\n\n/**\n * Convert the given multihash to a base58 encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toB58String (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1)\n}\n\n/**\n * Convert the given base58 encoded string to a multihash.\n *\n * @param {string|Uint8Array} hash\n * @returns {Uint8Array}\n */\nfunction fromB58String (hash) {\n const encoded = hash instanceof Uint8Array\n ? uint8ArrayToString(hash)\n : hash\n\n return multibase.decode('z' + encoded)\n}\n\n/**\n * Decode a hash from the given multihash.\n *\n * @param {Uint8Array} bytes\n * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result\n */\nfunction decode (bytes) {\n if (!(bytes instanceof Uint8Array)) {\n throw new Error('multihash must be a Uint8Array')\n }\n\n if (bytes.length < 2) {\n throw new Error('multihash too short. must be > 2 bytes.')\n }\n\n const code = /** @type {HashCode} */(varint.decode(bytes))\n if (!isValidCode(code)) {\n throw new Error(`multihash unknown function code: 0x${code.toString(16)}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n const len = varint.decode(bytes)\n if (len < 0) {\n throw new Error(`multihash invalid length: ${len}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n if (bytes.length !== len) {\n throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`)\n }\n\n return {\n code,\n name: codes[code],\n length: len,\n digest: bytes\n }\n}\n\n/**\n * Encode a hash digest along with the specified function code.\n *\n * > **Note:** the length is derived from the length of the digest itself.\n *\n * @param {Uint8Array} digest\n * @param {HashName | HashCode} code\n * @param {number} [length]\n * @returns {Uint8Array}\n */\nfunction encode (digest, code, length) {\n if (!digest || code === undefined) {\n throw new Error('multihash encode requires at least two args: digest, code')\n }\n\n // ensure it's a hashfunction code.\n const hashfn = coerceCode(code)\n\n if (!(digest instanceof Uint8Array)) {\n throw new Error('digest should be a Uint8Array')\n }\n\n if (length == null) {\n length = digest.length\n }\n\n if (length && digest.length !== length) {\n throw new Error('digest length should be equal to specified length.')\n }\n\n const hash = varint.encode(hashfn)\n const len = varint.encode(length)\n return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length)\n}\n\n/**\n * Converts a hash function name into the matching code.\n * If passed a number it will return the number if it's a valid code.\n *\n * @param {HashName | number} name\n * @returns {number}\n */\nfunction coerceCode (name) {\n let code = name\n\n if (typeof name === 'string') {\n if (names[name] === undefined) {\n throw new Error(`Unrecognized hash function named: ${name}`)\n }\n code = names[name]\n }\n\n if (typeof code !== 'number') {\n throw new Error(`Hash function code should be a number. Got: ${code}`)\n }\n\n // @ts-ignore\n if (codes[code] === undefined && !isAppCode(code)) {\n throw new Error(`Unrecognized function code: ${code}`)\n }\n\n return code\n}\n\n/**\n * Checks if a code is part of the app range\n *\n * @param {number} code\n * @returns {boolean}\n */\nfunction isAppCode (code) {\n return code > 0 && code < 0x10\n}\n\n/**\n * Checks whether a multihash code is valid.\n *\n * @param {HashCode} code\n * @returns {boolean}\n */\nfunction isValidCode (code) {\n if (isAppCode(code)) {\n return true\n }\n\n if (codes[code]) {\n return true\n }\n\n return false\n}\n\n/**\n * Check if the given buffer is a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {void}\n * @throws {Error}\n */\nfunction validate (multihash) {\n decode(multihash) // throws if bad.\n}\n\n/**\n * Returns a prefix from a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n * @throws {Error}\n */\nfunction prefix (multihash) {\n validate(multihash)\n\n return multihash.subarray(0, 2)\n}\n\nmodule.exports = {\n names,\n codes,\n toHexString,\n fromHexString,\n toB58String,\n fromB58String,\n decode,\n encode,\n coerceCode,\n isAppCode,\n validate,\n prefix,\n isValidCode\n}\n\n/**\n * @typedef { import(\"./constants\").HashCode } HashCode\n * @typedef { import(\"./constants\").HashName } HashName\n */\n","/**\n * Multihash implementation in JavaScript.\n */\n'use strict'\n\nconst multibase = require('multibase')\nconst varint = require('varint')\nconst { names } = require('./constants')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\nconst uint8ArrayConcat = require('uint8arrays/concat')\n\nconst codes = /** @type {import('./types').CodeNameMap} */({})\n\n// eslint-disable-next-line guard-for-in\nfor (const key in names) {\n const name = /** @type {HashName} */(key)\n codes[names[name]] = name\n}\nObject.freeze(codes)\n\n/**\n * Convert the given multihash to a hex encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toHexString (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(hash, 'base16')\n}\n\n/**\n * Convert the given hex encoded string to a multihash.\n *\n * @param {string} hash\n * @returns {Uint8Array}\n */\nfunction fromHexString (hash) {\n return uint8ArrayFromString(hash, 'base16')\n}\n\n/**\n * Convert the given multihash to a base58 encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toB58String (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1)\n}\n\n/**\n * Convert the given base58 encoded string to a multihash.\n *\n * @param {string|Uint8Array} hash\n * @returns {Uint8Array}\n */\nfunction fromB58String (hash) {\n const encoded = hash instanceof Uint8Array\n ? uint8ArrayToString(hash)\n : hash\n\n return multibase.decode('z' + encoded)\n}\n\n/**\n * Decode a hash from the given multihash.\n *\n * @param {Uint8Array} bytes\n * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result\n */\nfunction decode (bytes) {\n if (!(bytes instanceof Uint8Array)) {\n throw new Error('multihash must be a Uint8Array')\n }\n\n if (bytes.length < 2) {\n throw new Error('multihash too short. must be > 2 bytes.')\n }\n\n const code = /** @type {HashCode} */(varint.decode(bytes))\n if (!isValidCode(code)) {\n throw new Error(`multihash unknown function code: 0x${code.toString(16)}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n const len = varint.decode(bytes)\n if (len < 0) {\n throw new Error(`multihash invalid length: ${len}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n if (bytes.length !== len) {\n throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`)\n }\n\n return {\n code,\n name: codes[code],\n length: len,\n digest: bytes\n }\n}\n\n/**\n * Encode a hash digest along with the specified function code.\n *\n * > **Note:** the length is derived from the length of the digest itself.\n *\n * @param {Uint8Array} digest\n * @param {HashName | HashCode} code\n * @param {number} [length]\n * @returns {Uint8Array}\n */\nfunction encode (digest, code, length) {\n if (!digest || code === undefined) {\n throw new Error('multihash encode requires at least two args: digest, code')\n }\n\n // ensure it's a hashfunction code.\n const hashfn = coerceCode(code)\n\n if (!(digest instanceof Uint8Array)) {\n throw new Error('digest should be a Uint8Array')\n }\n\n if (length == null) {\n length = digest.length\n }\n\n if (length && digest.length !== length) {\n throw new Error('digest length should be equal to specified length.')\n }\n\n const hash = varint.encode(hashfn)\n const len = varint.encode(length)\n return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length)\n}\n\n/**\n * Converts a hash function name into the matching code.\n * If passed a number it will return the number if it's a valid code.\n *\n * @param {HashName | number} name\n * @returns {number}\n */\nfunction coerceCode (name) {\n let code = name\n\n if (typeof name === 'string') {\n if (names[name] === undefined) {\n throw new Error(`Unrecognized hash function named: ${name}`)\n }\n code = names[name]\n }\n\n if (typeof code !== 'number') {\n throw new Error(`Hash function code should be a number. Got: ${code}`)\n }\n\n // @ts-ignore\n if (codes[code] === undefined && !isAppCode(code)) {\n throw new Error(`Unrecognized function code: ${code}`)\n }\n\n return code\n}\n\n/**\n * Checks if a code is part of the app range\n *\n * @param {number} code\n * @returns {boolean}\n */\nfunction isAppCode (code) {\n return code > 0 && code < 0x10\n}\n\n/**\n * Checks whether a multihash code is valid.\n *\n * @param {HashCode} code\n * @returns {boolean}\n */\nfunction isValidCode (code) {\n if (isAppCode(code)) {\n return true\n }\n\n if (codes[code]) {\n return true\n }\n\n return false\n}\n\n/**\n * Check if the given buffer is a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {void}\n * @throws {Error}\n */\nfunction validate (multihash) {\n decode(multihash) // throws if bad.\n}\n\n/**\n * Returns a prefix from a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n * @throws {Error}\n */\nfunction prefix (multihash) {\n validate(multihash)\n\n return multihash.subarray(0, 2)\n}\n\nmodule.exports = {\n names,\n codes,\n toHexString,\n fromHexString,\n toB58String,\n fromB58String,\n decode,\n encode,\n coerceCode,\n isAppCode,\n validate,\n prefix,\n isValidCode\n}\n\n/**\n * @typedef { import(\"./constants\").HashCode } HashCode\n * @typedef { import(\"./constants\").HashName } HashName\n */\n","'use strict'\n\nconst { encoding: getCodec } = require('multibase')\nconst { TextEncoder } = require('web-encoding')\nconst utf8Encoder = new TextEncoder()\n\n/**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n/**\n * Interprets each character in a string as a byte and\n * returns a Uint8Array of those bytes.\n *\n * @param {string} string - The string to turn into an array\n */\nfunction asciiStringToUint8Array (string) {\n const array = new Uint8Array(string.length)\n\n for (let i = 0; i < string.length; i++) {\n array[i] = string.charCodeAt(i)\n }\n\n return array\n}\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {string} string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - utf8, base16, base64, base64urlpad, etc\n * @returns {Uint8Array}\n */\nfunction fromString (string, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Encoder.encode(string)\n }\n\n if (encoding === 'ascii') {\n return asciiStringToUint8Array(string)\n }\n\n return getCodec(encoding).decode(string)\n}\n\nmodule.exports = fromString\n","'use strict'\n\nconst CID = require('cids')\nconst configure = require('../lib/configure')\nconst toUrlSearchParams = require('../lib/to-url-search-params')\n\nmodule.exports = configure(api => {\n /**\n * @type {import('..').Implements}\n */\n const resolve = async (ipfsPath, options = {}) => {\n const res = await api.post('dag/resolve', {\n timeout: options.timeout,\n signal: options.signal,\n searchParams: toUrlSearchParams({\n arg: `${ipfsPath}${options.path ? `/${options.path}`.replace(/\\/[/]+/g, '/') : ''}`,\n ...options\n }),\n headers: options.headers\n })\n\n const data = await res.json()\n\n return { cid: new CID(data.Cid['/']), remainderPath: data.RemPath }\n }\n\n return resolve\n})\n","'use strict'\n\nconst toCamel = require('./object-to-camel')\n\nfunction toCamelWithMetadata (entry) {\n const file = toCamel(entry)\n\n if (Object.prototype.hasOwnProperty.call(file, 'mode')) {\n file.mode = parseInt(file.mode, 8)\n }\n\n if (Object.prototype.hasOwnProperty.call(file, 'mtime')) {\n file.mtime = {\n secs: file.mtime,\n nsecs: file.mtimeNsecs || 0\n }\n\n delete file.mtimeNsecs\n }\n\n return file\n}\n\nmodule.exports = toCamelWithMetadata\n","'use strict'\n\nconst CID = require('cids')\nconst toCamelWithMetadata = require('../lib/object-to-camel-with-metadata')\nconst configure = require('../lib/configure')\nconst toUrlSearchParams = require('../lib/to-url-search-params')\n\nmodule.exports = configure(api => {\n /**\n * @type {import('..').Implements}\n */\n async function stat (path, options = {}) {\n if (typeof path !== 'string') {\n options = path || {}\n path = '/'\n }\n\n const res = await api.post('files/stat', {\n timeout: options.timeout,\n signal: options.signal,\n searchParams: toUrlSearchParams({\n arg: path,\n ...options\n }),\n headers: options.headers\n })\n const data = await res.json()\n\n data.WithLocality = data.WithLocality || false\n return toCoreInterface(toCamelWithMetadata(data))\n }\n\n return stat\n})\n\nfunction toCoreInterface (entry) {\n entry.cid = new CID(entry.hash)\n delete entry.hash\n return entry\n}\n","'use strict'\n\nconst CID = require('cids')\nconst configure = require('../lib/configure')\nconst normaliseInput = require('ipfs-core-utils/src/pins/normalise-input')\nconst toUrlSearchParams = require('../lib/to-url-search-params')\n\nmodule.exports = configure(api => {\n return async function * addAll (source, options = {}) {\n for await (const { path, recursive, metadata } of normaliseInput(source)) {\n const res = await api.post('pin/add', {\n timeout: options.timeout,\n signal: options.signal,\n searchParams: toUrlSearchParams({\n ...options,\n arg: path,\n recursive,\n metadata: metadata ? JSON.stringify(metadata) : undefined,\n stream: true\n }),\n headers: options.headers\n })\n\n for await (const pin of res.ndjson()) {\n if (pin.Pins) { // non-streaming response\n for (const cid of pin.Pins) {\n yield new CID(cid)\n }\n continue\n }\n\n yield new CID(pin)\n }\n }\n }\n})\n","'use strict'\n\nconst errCode = require('err-code')\nconst CID = require('cids')\n\n/**\n * Transform one of:\n *\n * ```ts\n * CID\n * String\n * { cid: CID recursive, metadata }\n * { path: String recursive, metadata }\n * Iterable\n * Iterable\n * Iterable<{ cid: CID recursive, metadata }>\n * Iterable<{ path: String recursive, metadata }>\n * AsyncIterable\n * AsyncIterable\n * AsyncIterable<{ cid: CID recursive, metadata }>\n * AsyncIterable<{ path: String recursive, metadata }>\n * ```\n * Into:\n *\n * ```ts\n * AsyncIterable<{ path: CID|String, recursive:boolean, metadata }>\n * ```\n *\n * @param {Source} input\n * @returns {AsyncIterable}\n */\n// eslint-disable-next-line complexity\nmodule.exports = async function * normaliseInput (input) {\n // must give us something\n if (input === null || input === undefined) {\n throw errCode(new Error(`Unexpected input: ${input}`), 'ERR_UNEXPECTED_INPUT')\n }\n\n // CID|String\n if (CID.isCID(input)) {\n yield toPin({ cid: input })\n return\n }\n\n if (input instanceof String || typeof input === 'string') {\n yield toPin({ path: input })\n return\n }\n\n // { cid: CID recursive, metadata }\n // @ts-ignore - it still could be iterable or async iterable\n if (input.cid != null || input.path != null) {\n // @ts-ignore\n return yield toPin(input)\n }\n\n // Iterable\n if (input[Symbol.iterator]) {\n const iterator = input[Symbol.iterator]()\n const first = iterator.next()\n if (first.done) return iterator\n\n // Iterable\n if (CID.isCID(first.value) || first.value instanceof String || typeof first.value === 'string') {\n yield toPin({ cid: first.value })\n for (const cid of iterator) {\n yield toPin({ cid })\n }\n return\n }\n\n // Iterable<{ cid: CID recursive, metadata }>\n if (first.value.cid != null || first.value.path != null) {\n yield toPin(first.value)\n for (const obj of iterator) {\n yield toPin(obj)\n }\n return\n }\n\n throw errCode(new Error('Unexpected input: ' + typeof input), 'ERR_UNEXPECTED_INPUT')\n }\n\n // AsyncIterable\n if (input[Symbol.asyncIterator]) {\n const iterator = input[Symbol.asyncIterator]()\n const first = await iterator.next()\n if (first.done) return iterator\n\n // AsyncIterable\n if (CID.isCID(first.value) || first.value instanceof String || typeof first.value === 'string') {\n yield toPin({ cid: first.value })\n for await (const cid of iterator) {\n yield toPin({ cid })\n }\n return\n }\n\n // AsyncIterable<{ cid: CID|String recursive, metadata }>\n if (first.value.cid != null || first.value.path != null) {\n yield toPin(first.value)\n for await (const obj of iterator) {\n yield toPin(obj)\n }\n return\n }\n\n throw errCode(new Error('Unexpected input: ' + typeof input), 'ERR_UNEXPECTED_INPUT')\n }\n\n throw errCode(new Error('Unexpected input: ' + typeof input), 'ERR_UNEXPECTED_INPUT')\n}\n\n/**\n * @param {ToPinWithPath|ToPinWithCID} input\n * @returns {Pin}\n */\nfunction toPin (input) {\n const pin = {\n path: input.path == null ? input.cid : `${input.path}`,\n recursive: input.recursive !== false\n }\n\n if (input.metadata != null) {\n pin.metadata = input.metadata\n }\n\n return pin\n}\n\n/**\n * @typedef {Object} ToPinWithPath\n * @property {string | InstanceType | CID} path\n * @property {undefined} [cid]\n * @property {boolean} [recursive]\n * @property {any} [metadata]\n *\n * @typedef {Object} ToPinWithCID\n * @property {undefined} [path]\n * @property {CID} cid\n * @property {boolean} [recursive]\n * @property {any} [metadata]\n *\n * @typedef {CID|string|InstanceType|ToPinWithPath|ToPinWithPath} ToPin\n * @typedef {ToPin|Iterable|AsyncIterable} Source\n *\n * @typedef {Object} Pin\n * @property {string|CID} path\n * @property {boolean} recursive\n * @property {any} [metadata]\n */\n","'use strict'\n\nconst CID = require('cids')\nconst configure = require('../lib/configure')\nconst normaliseInput = require('ipfs-core-utils/src/pins/normalise-input')\nconst toUrlSearchParams = require('../lib/to-url-search-params')\n\nmodule.exports = configure(api => {\n return async function * rmAll (source, options = {}) {\n for await (const { path, recursive } of normaliseInput(source)) {\n const searchParams = new URLSearchParams(options.searchParams)\n searchParams.append('arg', `${path}`)\n\n if (recursive != null) searchParams.set('recursive', String(recursive))\n\n const res = await api.post('pin/rm', {\n timeout: options.timeout,\n signal: options.signal,\n headers: options.headers,\n searchParams: toUrlSearchParams({\n ...options,\n arg: `${path}`,\n recursive\n })\n })\n\n for await (const pin of res.ndjson()) {\n if (pin.Pins) { // non-streaming response\n yield * pin.Pins.map(cid => new CID(cid))\n continue\n }\n yield new CID(pin)\n }\n }\n }\n})\n","'use strict'\n\nconst { AbortController } = require('native-abort-controller')\n\nclass SubscriptionTracker {\n constructor () {\n this._subs = new Map()\n }\n\n static singleton () {\n if (SubscriptionTracker.instance) return SubscriptionTracker.instance\n SubscriptionTracker.instance = new SubscriptionTracker()\n return SubscriptionTracker.instance\n }\n\n subscribe (topic, handler, signal) {\n const topicSubs = this._subs.get(topic) || []\n\n if (topicSubs.find(s => s.handler === handler)) {\n throw new Error(`Already subscribed to ${topic} with this handler`)\n }\n\n // Create controller so a call to unsubscribe can cancel the request\n const controller = new AbortController()\n\n this._subs.set(topic, [{ handler, controller }].concat(topicSubs))\n\n // If there is an external signal, forward the abort event\n if (signal) {\n signal.addEventListener('abort', () => this.unsubscribe(topic, handler))\n }\n\n return controller.signal\n }\n\n unsubscribe (topic, handler) {\n const subs = this._subs.get(topic) || []\n let unsubs\n\n if (handler) {\n this._subs.set(topic, subs.filter(s => s.handler !== handler))\n unsubs = subs.filter(s => s.handler === handler)\n } else {\n this._subs.set(topic, [])\n unsubs = subs\n }\n\n unsubs.forEach(s => s.controller.abort())\n }\n}\n\nSubscriptionTracker.instance = null\n\nmodule.exports = SubscriptionTracker\n","'use strict'\n\nconst { BigNumber } = require('bignumber.js')\nconst configure = require('../lib/configure')\nconst toUrlSearchParams = require('../lib/to-url-search-params')\n\nmodule.exports = configure(api => {\n return async (options = {}) => {\n const res = await api.post('repo/stat', {\n timeout: options.timeout,\n signal: options.signal,\n searchParams: toUrlSearchParams(options),\n headers: options.headers\n })\n const data = await res.json()\n\n return {\n numObjects: new BigNumber(data.NumObjects),\n repoSize: new BigNumber(data.RepoSize),\n repoPath: data.RepoPath,\n version: data.Version,\n storageMax: new BigNumber(data.StorageMax)\n }\n }\n})\n","'use strict'\n\nconst configure = require('./lib/configure')\nconst toUrlSearchParams = require('./lib/to-url-search-params')\n\nmodule.exports = configure(api => {\n return async (options = {}) => {\n const res = await api.post('shutdown', {\n timeout: options.timeout,\n signal: options.signal,\n searchParams: toUrlSearchParams(options),\n headers: options.headers\n })\n\n await res.text()\n }\n})\n","'use strict'\n\nconst isReactNative =\n typeof navigator !== 'undefined' &&\n navigator.product === 'ReactNative'\n\nfunction getDefaultBase () {\n if (isReactNative) {\n return 'http://localhost'\n }\n\n return self.location.protocol + '//' + self.location.host\n}\n\nconst URL = self.URL\nconst defaultBase = getDefaultBase()\n\nclass URLWithLegacySupport {\n constructor (url = '', base = defaultBase) {\n this.super = new URL(url, base)\n this.path = this.pathname + this.search\n this.auth =\n this.username && this.password\n ? this.username + ':' + this.password\n : null\n\n this.query =\n this.search && this.search.startsWith('?')\n ? this.search.slice(1)\n : null\n }\n\n get hash () {\n return this.super.hash\n }\n\n get host () {\n return this.super.host\n }\n\n get hostname () {\n return this.super.hostname\n }\n\n get href () {\n return this.super.href\n }\n\n get origin () {\n return this.super.origin\n }\n\n get password () {\n return this.super.password\n }\n\n get pathname () {\n return this.super.pathname\n }\n\n get port () {\n return this.super.port\n }\n\n get protocol () {\n return this.super.protocol\n }\n\n get search () {\n return this.super.search\n }\n\n get searchParams () {\n return this.super.searchParams\n }\n\n get username () {\n return this.super.username\n }\n\n set hash (hash) {\n this.super.hash = hash\n }\n\n set host (host) {\n this.super.host = host\n }\n\n set hostname (hostname) {\n this.super.hostname = hostname\n }\n\n set href (href) {\n this.super.href = href\n }\n\n set password (password) {\n this.super.password = password\n }\n\n set pathname (pathname) {\n this.super.pathname = pathname\n }\n\n set port (port) {\n this.super.port = port\n }\n\n set protocol (protocol) {\n this.super.protocol = protocol\n }\n\n set search (search) {\n this.super.search = search\n }\n\n set username (username) {\n this.super.username = username\n }\n\n /**\n * @param {any} o\n */\n static createObjectURL (o) {\n return URL.createObjectURL(o)\n }\n\n /**\n * @param {string} o\n */\n static revokeObjectURL (o) {\n URL.revokeObjectURL(o)\n }\n\n toJSON () {\n return this.super.toJSON()\n }\n\n toString () {\n return this.super.toString()\n }\n\n format () {\n return this.toString()\n }\n}\n\n/**\n * @param {string | import('url').UrlObject} obj\n */\nfunction format (obj) {\n if (typeof obj === 'string') {\n const url = new URL(obj)\n\n return url.toString()\n }\n\n if (!(obj instanceof URL)) {\n const userPass =\n // @ts-ignore its not supported in node but we normalise\n obj.username && obj.password\n // @ts-ignore its not supported in node but we normalise\n ? `${obj.username}:${obj.password}@`\n : ''\n const auth = obj.auth ? obj.auth + '@' : ''\n const port = obj.port ? ':' + obj.port : ''\n const protocol = obj.protocol ? obj.protocol + '//' : ''\n const host = obj.host || ''\n const hostname = obj.hostname || ''\n const search = obj.search || (obj.query ? '?' + obj.query : '')\n const hash = obj.hash || ''\n const pathname = obj.pathname || ''\n // @ts-ignore - path is not supported in node but we normalise\n const path = obj.path || pathname + search\n\n return `${protocol}${userPass || auth}${\n host || hostname + port\n }${path}${hash}`\n }\n}\n\nmodule.exports = {\n URLWithLegacySupport,\n URLSearchParams: self.URLSearchParams,\n defaultBase,\n format\n}\n","exports.__esModule = true;\nvar ATTRIBUTE_NAMES = exports.ATTRIBUTE_NAMES = {\n BODY: \"bodyAttributes\",\n HTML: \"htmlAttributes\",\n TITLE: \"titleAttributes\"\n};\n\nvar TAG_NAMES = exports.TAG_NAMES = {\n BASE: \"base\",\n BODY: \"body\",\n HEAD: \"head\",\n HTML: \"html\",\n LINK: \"link\",\n META: \"meta\",\n NOSCRIPT: \"noscript\",\n SCRIPT: \"script\",\n STYLE: \"style\",\n TITLE: \"title\"\n};\n\nvar VALID_TAG_NAMES = exports.VALID_TAG_NAMES = Object.keys(TAG_NAMES).map(function (name) {\n return TAG_NAMES[name];\n});\n\nvar TAG_PROPERTIES = exports.TAG_PROPERTIES = {\n CHARSET: \"charset\",\n CSS_TEXT: \"cssText\",\n HREF: \"href\",\n HTTPEQUIV: \"http-equiv\",\n INNER_HTML: \"innerHTML\",\n ITEM_PROP: \"itemprop\",\n NAME: \"name\",\n PROPERTY: \"property\",\n REL: \"rel\",\n SRC: \"src\"\n};\n\nvar REACT_TAG_MAP = exports.REACT_TAG_MAP = {\n accesskey: \"accessKey\",\n charset: \"charSet\",\n class: \"className\",\n contenteditable: \"contentEditable\",\n contextmenu: \"contextMenu\",\n \"http-equiv\": \"httpEquiv\",\n itemprop: \"itemProp\",\n tabindex: \"tabIndex\"\n};\n\nvar HELMET_PROPS = exports.HELMET_PROPS = {\n DEFAULT_TITLE: \"defaultTitle\",\n DEFER: \"defer\",\n ENCODE_SPECIAL_CHARACTERS: \"encodeSpecialCharacters\",\n ON_CHANGE_CLIENT_STATE: \"onChangeClientState\",\n TITLE_TEMPLATE: \"titleTemplate\"\n};\n\nvar HTML_TAG_MAP = exports.HTML_TAG_MAP = Object.keys(REACT_TAG_MAP).reduce(function (obj, key) {\n obj[REACT_TAG_MAP[key]] = key;\n return obj;\n}, {});\n\nvar SELF_CLOSING_TAGS = exports.SELF_CLOSING_TAGS = [TAG_NAMES.NOSCRIPT, TAG_NAMES.SCRIPT, TAG_NAMES.STYLE];\n\nvar HELMET_ATTRIBUTE = exports.HELMET_ATTRIBUTE = \"data-react-helmet\";","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.chromeLight = exports.chromeDark = undefined;\n\nvar _chromeDark2 = require('./chromeDark');\n\nvar _chromeDark3 = _interopRequireDefault(_chromeDark2);\n\nvar _chromeLight2 = require('./chromeLight');\n\nvar _chromeLight3 = _interopRequireDefault(_chromeLight2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.chromeDark = _chromeDark3.default;\nexports.chromeLight = _chromeLight3.default;","module.exports = { \"default\": require(\"core-js/library/fn/object/define-property\"), __esModule: true };","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","module.exports = require('./_hide');\n","// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = require('./_object-keys-internal');\nvar hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n","var pIE = require('./_object-pie');\nvar createDesc = require('./_property-desc');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar has = require('./_has');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n","module.exports = require(\"regenerator-runtime\");\n","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends2 = require('babel-runtime/helpers/extends');\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');\n\nvar _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _defineProperty2 = require('babel-runtime/helpers/defineProperty');\n\nvar _defineProperty3 = _interopRequireDefault(_defineProperty2);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _TreeNode = require('./TreeNode');\n\nvar _TreeNode2 = _interopRequireDefault(_TreeNode);\n\nvar _pathUtils = require('./pathUtils');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar reducer = function reducer(state, action) {\n switch (action.type) {\n case 'TOGGLE_EXPAND':\n {\n var path = action.path;\n var expandedPaths = state.expandedPaths;\n var expanded = !!expandedPaths[path];\n\n return Object.assign({}, state, {\n expandedPaths: Object.assign({}, state.expandedPaths, (0, _defineProperty3.default)({}, path, !expanded))\n });\n }\n default:\n return state;\n }\n};\n\nvar ConnectedTreeNode = function (_Component) {\n (0, _inherits3.default)(ConnectedTreeNode, _Component);\n\n function ConnectedTreeNode(props, context) {\n (0, _classCallCheck3.default)(this, ConnectedTreeNode);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, (ConnectedTreeNode.__proto__ || Object.getPrototypeOf(ConnectedTreeNode)).call(this, props));\n\n _this.state = context.store.storeState;\n return _this;\n }\n\n (0, _createClass3.default)(ConnectedTreeNode, [{\n key: 'shouldComponentUpdate',\n value: function shouldComponentUpdate(nextProps, nextState) {\n return !!nextState.expandedPaths[nextProps.path] !== !!this.state.expandedPaths[this.props.path] || nextProps.data !== this.props.data || nextProps.name !== this.props.name;\n }\n }, {\n key: 'handleClick',\n value: function handleClick(path) {\n this.context.store.storeState = reducer(this.context.store.storeState, {\n type: 'TOGGLE_EXPAND',\n path: path\n });\n this.setState(this.context.store.storeState);\n }\n }, {\n key: 'renderChildNodes',\n value: function renderChildNodes(parentData, parentPath) {\n var dataIterator = this.props.dataIterator;\n var depth = this.props.depth;\n var nodeRenderer = this.props.nodeRenderer;\n\n\n var childNodes = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = dataIterator(parentData)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _ref2 = _step.value;\n var name = _ref2.name,\n data = _ref2.data,\n props = (0, _objectWithoutProperties3.default)(_ref2, ['name', 'data']);\n\n var key = name;\n var path = parentPath + '.' + key;\n childNodes.push(_react2.default.createElement(ConnectedTreeNode, (0, _extends3.default)({\n name: name,\n data: data,\n depth: depth + 1,\n path: path,\n key: key,\n dataIterator: dataIterator,\n nodeRenderer: nodeRenderer\n }, props)) // props for nodeRenderer\n );\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return childNodes;\n }\n }, {\n key: 'render',\n value: function render() {\n var _props = this.props,\n data = _props.data,\n dataIterator = _props.dataIterator,\n path = _props.path,\n depth = _props.depth;\n\n\n var nodeHasChildNodes = (0, _pathUtils.hasChildNodes)(data, dataIterator);\n var expandedPaths = this.state.expandedPaths;\n\n var expanded = !!expandedPaths[path];\n\n var nodeRenderer = this.props.nodeRenderer;\n\n\n return _react2.default.createElement(\n _TreeNode2.default,\n (0, _extends3.default)({\n expanded: expanded,\n onClick: nodeHasChildNodes ? this.handleClick.bind(this, path) : function () {}\n // show arrow anyway even if not expanded and not rendering children\n , shouldShowArrow: nodeHasChildNodes\n // show placeholder only for non root nodes\n , shouldShowPlaceholder: depth > 0\n // Render a node from name and data (or possibly other props like isNonenumerable)\n , nodeRenderer: nodeRenderer\n }, this.props),\n // only render if the node is expanded\n expanded ? this.renderChildNodes(data, path) : undefined\n );\n }\n }]);\n return ConnectedTreeNode;\n}(_react.Component);\n\nConnectedTreeNode.propTypes = {\n name: _propTypes2.default.string,\n data: _propTypes2.default.any,\n dataIterator: _propTypes2.default.func,\n\n depth: _propTypes2.default.number,\n expanded: _propTypes2.default.bool,\n\n nodeRenderer: _propTypes2.default.func\n};\n\nConnectedTreeNode.contextTypes = {\n store: _propTypes2.default.any\n};\n\nvar TreeView = function (_Component2) {\n (0, _inherits3.default)(TreeView, _Component2);\n\n function TreeView(props) {\n (0, _classCallCheck3.default)(this, TreeView);\n\n var _this2 = (0, _possibleConstructorReturn3.default)(this, (TreeView.__proto__ || Object.getPrototypeOf(TreeView)).call(this, props));\n\n _this2.store = {\n storeState: {\n expandedPaths: (0, _pathUtils.getExpandedPaths)(props.data, props.dataIterator, props.expandPaths, props.expandLevel)\n }\n };\n return _this2;\n }\n\n (0, _createClass3.default)(TreeView, [{\n key: 'componentWillReceiveProps',\n value: function componentWillReceiveProps(nextProps) {\n this.store = {\n storeState: {\n expandedPaths: (0, _pathUtils.getExpandedPaths)(nextProps.data, nextProps.dataIterator, nextProps.expandPaths, nextProps.expandLevel, this.store.storeState.expandedPaths)\n }\n };\n }\n }, {\n key: 'getChildContext',\n value: function getChildContext() {\n return {\n store: this.store\n };\n }\n }, {\n key: 'render',\n value: function render() {\n var _props2 = this.props,\n name = _props2.name,\n data = _props2.data,\n dataIterator = _props2.dataIterator;\n var nodeRenderer = this.props.nodeRenderer;\n\n\n var rootPath = _pathUtils.DEFAULT_ROOT_PATH;\n\n return _react2.default.createElement(ConnectedTreeNode, {\n name: name,\n data: data,\n dataIterator: dataIterator,\n depth: 0,\n path: rootPath,\n nodeRenderer: nodeRenderer\n });\n }\n }]);\n return TreeView;\n}(_react.Component);\n\nTreeView.defaultProps = {\n expandLevel: 0,\n expandPaths: []\n};\nTreeView.childContextTypes = {\n store: _propTypes2.default.any\n};\n\n\nTreeView.propTypes = {\n name: _propTypes2.default.string,\n data: _propTypes2.default.any,\n dataIterator: _propTypes2.default.func,\n\n nodeRenderer: _propTypes2.default.func\n};\n\nTreeView.defaultProps = {\n name: undefined\n};\n\nexports.default = TreeView;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _ObjectName = require('../object/ObjectName');\n\nvar _ObjectName2 = _interopRequireDefault(_ObjectName);\n\nvar _ObjectPreview = require('./ObjectPreview');\n\nvar _ObjectPreview2 = _interopRequireDefault(_ObjectPreview);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar ObjectRootLabel = function ObjectRootLabel(_ref) {\n var name = _ref.name,\n data = _ref.data;\n\n if (typeof name === 'string') {\n return _react2.default.createElement(\n 'span',\n null,\n _react2.default.createElement(_ObjectName2.default, { name: name }),\n _react2.default.createElement(\n 'span',\n null,\n ': '\n ),\n _react2.default.createElement(_ObjectPreview2.default, { data: data })\n );\n } else {\n return _react2.default.createElement(_ObjectPreview2.default, { data: data });\n }\n};\n\nexports.default = ObjectRootLabel;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _ObjectName = require('../object/ObjectName');\n\nvar _ObjectName2 = _interopRequireDefault(_ObjectName);\n\nvar _ObjectValue = require('../object/ObjectValue');\n\nvar _ObjectValue2 = _interopRequireDefault(_ObjectValue);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * if isNonenumerable is specified, render the name dimmed\n */\nvar ObjectLabel = function ObjectLabel(_ref) {\n var name = _ref.name,\n data = _ref.data,\n isNonenumerable = _ref.isNonenumerable,\n isMeta = _ref.isMeta;\n\n var object = data;\n\n return _react2.default.createElement(\n 'span',\n null,\n _react2.default.createElement(_ObjectName2.default, { name: name, dimmed: isNonenumerable || isMeta }),\n !isMeta && _react2.default.createElement(\n 'span',\n null,\n ': '\n ),\n !isMeta && _react2.default.createElement(_ObjectValue2.default, { object: object })\n );\n};\n\nObjectLabel.propTypes = {\n /** Non enumerable object property will be dimmed */\n isNonenumerable: _propTypes2.default.bool,\n /** meta info like array truncation lables */\n isMeta: _propTypes2.default.bool\n};\n\nObjectLabel.defaultProps = {\n isNonenumerable: false,\n isMeta: false\n};\n\nexports.default = ObjectLabel;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar TEXT_NODE_MAX_INLINE_CHARS = 80;\n\nvar shouldInline = function shouldInline(data) {\n return data.childNodes.length === 0 || data.childNodes.length === 1 && data.childNodes[0].nodeType === Node.TEXT_NODE && data.textContent.length < TEXT_NODE_MAX_INLINE_CHARS;\n};\n\nexports.default = shouldInline;","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","'use strict'\n\nconst { encoding: getCodec } = require('multibase')\nconst utf8Decoder = new TextDecoder('utf8')\n\n/**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n/**\n * Turns a Uint8Array of bytes into a string with each\n * character being the char code of the corresponding byte\n *\n * @param {Uint8Array} array - The array to turn into a string\n */\nfunction uint8ArrayToAsciiString (array) {\n let string = ''\n\n for (let i = 0; i < array.length; i++) {\n string += String.fromCharCode(array[i])\n }\n return string\n}\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {Uint8Array} array - The array to turn into a string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - The encoding to use\n * @returns {string}\n */\nfunction toString (array, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Decoder.decode(array)\n }\n\n if (encoding === 'ascii') {\n return uint8ArrayToAsciiString(array)\n }\n\n return getCodec(encoding).encode(array)\n}\n\nmodule.exports = toString\n","'use strict'\n\nconst varint = require('varint')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\n\nmodule.exports = {\n numberToUint8Array,\n uint8ArrayToNumber,\n varintUint8ArrayEncode,\n varintEncode\n}\n\n/**\n * @param {Uint8Array} buf\n */\nfunction uint8ArrayToNumber (buf) {\n return parseInt(uint8ArrayToString(buf, 'base16'), 16)\n}\n\n/**\n * @param {number} num\n */\nfunction numberToUint8Array (num) {\n let hexString = num.toString(16)\n if (hexString.length % 2 === 1) {\n hexString = '0' + hexString\n }\n return uint8ArrayFromString(hexString, 'base16')\n}\n\n/**\n * @param {Uint8Array} input\n */\nfunction varintUint8ArrayEncode (input) {\n return Uint8Array.from(varint.encode(uint8ArrayToNumber(input)))\n}\n\n/**\n * @param {number} num\n */\nfunction varintEncode (num) {\n return Uint8Array.from(varint.encode(num))\n}\n","\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(\"./util/minimal\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n","\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(\"./util/minimal\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n","'use strict'\n\nconst memoize = require('p-memoize')\nconst ip = require('ip')\nconst CID = require('cids')\nconst { TextDecoder } = require('web-encoding')\nconst utf8Decoder = new TextDecoder('utf8')\n\nconst formatData = require('./format')\n\nconst GEOIP_ROOT = new CID('Qmbt1YbZAhMoqo7r1t6Y5EJrYGVRgcaisNAZhLeJY6ehfg') // GeoLite2-City-CSV_20201013\n\n/**\n * @param {Object} ipfs\n * @param {CID} cid\n * @param {string} lookfor - ip\n * @returns {Promise}\n */\nasync function _lookup (ipfs, cid, lookfor) {\n // ensure input is a valid cid, but switch to string representation\n // to avoid serialization issues when mix of cids >1.0 and <1.0 are used\n cid = new CID(cid).toString()\n\n // TODO: use dag-cbor instead of stringified JSON\n let res\n let obj\n try {\n res = await ipfs.object.get(cid)\n obj = JSON.parse(utf8Decoder.decode(res.Data))\n } catch (e) {\n // log error, this makes things waaaay easier to fix in case API changes again\n console.error(`[ipfs-geoip] failed to get and parse Data via ipfs.object.get('${cid}')`, e) // eslint-disable-line no-console\n throw e\n }\n\n let child = 0\n\n if (obj.type === 'Node') {\n while (obj.mins[child] && obj.mins[child] <= lookfor) {\n child++\n }\n\n const next = res.Links[child - 1]\n\n if (!next) {\n throw new Error('Failed to lookup node')\n }\n\n const nextCid = getCid(next)\n\n if (!nextCid) {\n throw new Error('Failed to lookup node')\n }\n\n return memoizedLookup(ipfs, nextCid, lookfor)\n } else if (obj.type === 'Leaf') {\n while (obj.data[child] && obj.data[child].min <= lookfor) {\n child++\n }\n\n const next = obj.data[child - 1]\n\n if (!next) {\n throw new Error('Failed to lookup leaf node')\n }\n\n if (!next.data) {\n throw new Error('Unmapped range')\n }\n\n return formatData(next.data)\n }\n}\n\nconst memoizedLookup = memoize(_lookup, {\n cachePromiseRejection: false,\n cacheKey: args => {\n // cache based on cid+ip: we ignore first argument, which is ipfs api instance\n const [, cid, lookfor] = args\n return `${cid}.${lookfor}`\n }\n})\n\n/**\n * @param {Object} ipfs\n * @param {string} ipstring\n * @returns {Promise}\n */\nmodule.exports = function lookup (ipfs, ipstring) {\n return memoizedLookup(ipfs, GEOIP_ROOT, ip.toLong(ipstring))\n}\n\nfunction getCid (node) {\n if (!node) return null\n if (node.Hash) return node.Hash\n return null\n}\n","'use strict';\n\nconst copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable &&\n\t\ttoDescriptor.enumerable === fromDescriptor.enumerable &&\n\t\ttoDescriptor.configurable === fromDescriptor.configurable &&\n\t\t(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tObject.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});\n};\n\nconst mimicFn = (to, from, {ignoreNonConfigurable = false} = {}) => {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n};\n\nmodule.exports = mimicFn;\n","var upperCase = require('upper-case')\nvar noCase = require('no-case')\n\n/**\n * Camel case a string.\n *\n * @param {string} value\n * @param {string} [locale]\n * @return {string}\n */\nmodule.exports = function (value, locale, mergeNumbers) {\n var result = noCase(value, locale)\n\n // Replace periods between numeric entities with an underscore.\n if (!mergeNumbers) {\n result = result.replace(/ (?=\\d)/g, '_')\n }\n\n // Replace spaces between words with an upper cased character.\n return result.replace(/ (.)/g, function (m, $1) {\n return upperCase($1, locale)\n })\n}\n","var noCase = require('no-case')\n\n/**\n * Snake case a string.\n *\n * @param {string} value\n * @param {string} [locale]\n * @return {string}\n */\nmodule.exports = function (value, locale) {\n return noCase(value, locale, '_')\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorKind = void 0;\nvar ErrorKind;\n(function (ErrorKind) {\n /** Argument is unclosed (e.g. `{0`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_CLOSING_BRACE\"] = 1] = \"EXPECT_ARGUMENT_CLOSING_BRACE\";\n /** Argument is empty (e.g. `{}`). */\n ErrorKind[ErrorKind[\"EMPTY_ARGUMENT\"] = 2] = \"EMPTY_ARGUMENT\";\n /** Argument is malformed (e.g. `{foo!}``) */\n ErrorKind[ErrorKind[\"MALFORMED_ARGUMENT\"] = 3] = \"MALFORMED_ARGUMENT\";\n /** Expect an argument type (e.g. `{foo,}`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_TYPE\"] = 4] = \"EXPECT_ARGUMENT_TYPE\";\n /** Unsupported argument type (e.g. `{foo,foo}`) */\n ErrorKind[ErrorKind[\"INVALID_ARGUMENT_TYPE\"] = 5] = \"INVALID_ARGUMENT_TYPE\";\n /** Expect an argument style (e.g. `{foo, number, }`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_STYLE\"] = 6] = \"EXPECT_ARGUMENT_STYLE\";\n /** The number skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_NUMBER_SKELETON\"] = 7] = \"INVALID_NUMBER_SKELETON\";\n /** The date time skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_DATE_TIME_SKELETON\"] = 8] = \"INVALID_DATE_TIME_SKELETON\";\n /** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_NUMBER_SKELETON\"] = 9] = \"EXPECT_NUMBER_SKELETON\";\n /** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_DATE_TIME_SKELETON\"] = 10] = \"EXPECT_DATE_TIME_SKELETON\";\n /** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */\n ErrorKind[ErrorKind[\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"] = 11] = \"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\";\n /** Missing select argument options (e.g. `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_OPTIONS\"] = 12] = \"EXPECT_SELECT_ARGUMENT_OPTIONS\";\n /** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 13] = \"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 14] = \"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Expecting a selector in `select` argument (e.g `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR\"] = 15] = \"EXPECT_SELECT_ARGUMENT_SELECTOR\";\n /** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"] = 16] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR\";\n /** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"] = 17] = \"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\";\n /**\n * Expecting a message fragment after the `plural` or `selectordinal` selector\n * (e.g. `{foo, plural, one}`)\n */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"] = 18] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\";\n /** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_SELECTOR\"] = 19] = \"INVALID_PLURAL_ARGUMENT_SELECTOR\";\n /**\n * Duplicate selectors in `plural` or `selectordinal` argument.\n * (e.g. {foo, plural, one {#} one {#}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"] = 20] = \"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\";\n /** Duplicate selectors in `select` argument.\n * (e.g. {foo, select, apple {apple} apple {apple}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"] = 21] = \"DUPLICATE_SELECT_ARGUMENT_SELECTOR\";\n /** Plural or select argument option must have `other` clause. */\n ErrorKind[ErrorKind[\"MISSING_OTHER_CLAUSE\"] = 22] = \"MISSING_OTHER_CLAUSE\";\n /** The tag is malformed. (e.g. `foo) */\n ErrorKind[ErrorKind[\"INVALID_TAG\"] = 23] = \"INVALID_TAG\";\n /** The tag name is invalid. (e.g. `<123>foo`) */\n ErrorKind[ErrorKind[\"INVALID_TAG_NAME\"] = 25] = \"INVALID_TAG_NAME\";\n /** The closing tag does not match the opening tag. (e.g. `foo`) */\n ErrorKind[ErrorKind[\"UNMATCHED_CLOSING_TAG\"] = 26] = \"UNMATCHED_CLOSING_TAG\";\n /** The opening tag has unmatched closing tag. (e.g. `foo`) */\n ErrorKind[ErrorKind[\"UNCLOSED_TAG\"] = 27] = \"UNCLOSED_TAG\";\n})(ErrorKind = exports.ErrorKind || (exports.ErrorKind = {}));\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { cloneElement } from 'react';\nimport { invariant } from '@react-dnd/invariant';\n\nfunction setRef(ref, node) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n}\n\nexport function cloneWithRef(element, newRef) {\n var previousRef = element.ref;\n invariant(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + 'Please convert it to use a callback ref instead, or wrap it into a or
. ' + 'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute');\n\n if (!previousRef) {\n // When there is no ref on the element, use the new ref directly\n return cloneElement(element, {\n ref: newRef\n });\n } else {\n return cloneElement(element, {\n ref: function ref(node) {\n setRef(previousRef, node);\n setRef(newRef, node);\n }\n });\n }\n}","import { isValidElement } from 'react';\nimport { cloneWithRef } from '../utils/cloneWithRef';\n\nfunction throwIfCompositeComponentElement(element) {\n // Custom components can no longer be wrapped directly in React DnD 2.0\n // so that we don't need to depend on findDOMNode() from react-dom.\n if (typeof element.type === 'string') {\n return;\n }\n\n var displayName = element.type.displayName || element.type.name || 'the component';\n throw new Error('Only native element nodes can now be passed to React DnD connectors.' + \"You can either wrap \".concat(displayName, \" into a
, or turn it into a \") + 'drag source or a drop target itself.');\n}\n\nfunction wrapHookToRecognizeElement(hook) {\n return function () {\n var elementOrNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n // When passed a node, call the hook straight away.\n if (!isValidElement(elementOrNode)) {\n var node = elementOrNode;\n hook(node, options); // return the node so it can be chained (e.g. when within callback refs\n //
connectDragSource(connectDropTarget(node))}/>\n\n return node;\n } // If passed a ReactElement, clone it and attach this function as a ref.\n // This helps us achieve a neat API where user doesn't even know that refs\n // are being used under the hood.\n\n\n var element = elementOrNode;\n throwIfCompositeComponentElement(element); // When no options are passed, use the hook directly\n\n var ref = options ? function (node) {\n return hook(node, options);\n } : hook;\n return cloneWithRef(element, ref);\n };\n}\n\nexport function wrapConnectorHooks(hooks) {\n var wrappedHooks = {};\n Object.keys(hooks).forEach(function (key) {\n var hook = hooks[key]; // ref objects should be passed straight through without wrapping\n\n if (key.endsWith('Ref')) {\n wrappedHooks[key] = hooks[key];\n } else {\n var wrappedHook = wrapHookToRecognizeElement(hook);\n\n wrappedHooks[key] = function () {\n return wrappedHook;\n };\n }\n });\n return wrappedHooks;\n}","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nimport React from 'react';\n\nvar GlyphSmallCancel = function GlyphSmallCancel(props) {\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n viewBox: \"0 0 100 100\"\n }, props), /*#__PURE__*/React.createElement(\"path\", {\n d: \"M63.79 63.2l-3.88 3.88-9.71-9.7-9.7 9.7-3.88-3.88 9.7-9.71-9.7-9.7 3.88-3.88 9.7 9.7 9.71-9.7 3.88 3.88-9.7 9.7 9.7 9.71z\"\n }));\n};\n\nexport default GlyphSmallCancel;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport React from 'react';\nimport ErrorIcon from '../../icons/GlyphSmallCancel';\n\nvar ErrorBoundary = /*#__PURE__*/function (_React$Component) {\n _inherits(ErrorBoundary, _React$Component);\n\n var _super = _createSuper(ErrorBoundary);\n\n function ErrorBoundary() {\n var _this;\n\n _classCallCheck(this, ErrorBoundary);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n hasError: false\n });\n\n return _this;\n }\n\n _createClass(ErrorBoundary, [{\n key: \"componentDidCatch\",\n value: function componentDidCatch(error, info) {\n this.setState({\n hasError: true\n });\n console.log(error);\n }\n }, {\n key: \"render\",\n value: function render() {\n var hasError = this.state.hasError;\n var _this$props = this.props,\n children = _this$props.children,\n Fallback = _this$props.fallback;\n return hasError ? /*#__PURE__*/React.createElement(Fallback, null) : children;\n }\n }]);\n\n return ErrorBoundary;\n}(React.Component);\n\n_defineProperty(ErrorBoundary, \"defaultProps\", {\n fallback: ErrorIcon\n});\n\nexport default ErrorBoundary;","var findAnchorTag = function (el) {\n if (!el) { return null; }\n return el.tagName === 'A' ? el : findAnchorTag(el.parentElement);\n};\n\nvar getLocalPathname = function (a) { return a.href.indexOf(location.protocol + '//' + location.host) !== -1 ? a.href.split(location.host, 2)[1] : null; };\n\nvar getNavHelper = function (onInternalNav) { return function (e) {\n if (e.button === 0 && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey) {\n var aTag = findAnchorTag(e.target);\n\n if (aTag && aTag.target !== '_blank' && aTag.target !== '_external' && aTag.rel !== 'external' && !aTag.hasAttribute('download')) {\n var url = getLocalPathname(aTag);\n\n if (url) {\n e.preventDefault();\n onInternalNav(url);\n }\n }\n }\n}; };\n\nexport { findAnchorTag, getNavHelper };\n","var E_NOSCROLL = new Error('Element already at target scroll position')\nvar E_CANCELLED = new Error('Scroll cancelled')\nvar min = Math.min\nvar ms = Date.now\n\nmodule.exports = {\n left: make('scrollLeft'),\n top: make('scrollTop')\n}\n\nfunction make (prop) {\n return function scroll (el, to, opts, cb) {\n opts = opts || {}\n\n if (typeof opts == 'function') cb = opts, opts = {}\n if (typeof cb != 'function') cb = noop\n\n var start = ms()\n var from = el[prop]\n var ease = opts.ease || inOutSine\n var duration = !isNaN(opts.duration) ? +opts.duration : 350\n var cancelled = false\n\n return from === to ?\n cb(E_NOSCROLL, el[prop]) :\n requestAnimationFrame(animate), cancel\n\n function cancel () {\n cancelled = true\n }\n\n function animate (timestamp) {\n if (cancelled) return cb(E_CANCELLED, el[prop])\n\n var now = ms()\n var time = min(1, ((now - start) / duration))\n var eased = ease(time)\n\n el[prop] = (eased * (to - from)) + from\n\n time < 1 ?\n requestAnimationFrame(animate) :\n requestAnimationFrame(function () {\n cb(null, el[prop])\n })\n }\n }\n}\n\nfunction inOutSine (n) {\n return 0.5 * (1 - Math.cos(Math.PI * n))\n}\n\nfunction noop () {}\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport isRequiredIf from 'react-proptype-conditional-require';\nimport Popper from 'popper.js';\nimport deepmerge from 'deepmerge';\nimport is from 'is-lite';\nimport treeChanges from 'tree-changes';\nimport ReactDOM from 'react-dom';\nimport ExecutionEnvironment from 'exenv';\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nvar DEFAULTS = {flip:{padding:20},preventOverflow:{padding:10}};\n\nvar STATUS = {INIT:'init',IDLE:'idle',OPENING:'opening',OPEN:'open',CLOSING:'closing',ERROR:'error'};\n\nvar canUseDOM=ExecutionEnvironment.canUseDOM;var isReact16=ReactDOM.createPortal!==undefined;function isMobile(){return 'ontouchstart'in window&&/Mobi/.test(navigator.userAgent);}/**\n * Log method calls if debug is enabled\n *\n * @private\n * @param {Object} arg\n * @param {string} arg.title - The title the logger was called from\n * @param {Object|Array} [arg.data] - The data to be logged\n * @param {boolean} [arg.warn] - If true, the message will be a warning\n * @param {boolean} [arg.debug] - Nothing will be logged unless debug is true\n */function log(_ref){var title=_ref.title,data=_ref.data,_ref$warn=_ref.warn,warn=_ref$warn===void 0?false:_ref$warn,_ref$debug=_ref.debug,debug=_ref$debug===void 0?false:_ref$debug;/* eslint-disable no-console */var logFn=warn?console.warn||console.error:console.log;if(debug&&title&&data){console.groupCollapsed(\"%creact-floater: \".concat(title),'color: #9b00ff; font-weight: bold; font-size: 12px;');if(Array.isArray(data)){data.forEach(function(d){if(is.plainObject(d)&&d.key){logFn.apply(console,[d.key,d.value]);}else{logFn.apply(console,[d]);}});}else{logFn.apply(console,[data]);}console.groupEnd();}/* eslint-enable */}function on(element,event,cb){var capture=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;element.addEventListener(event,cb,capture);}function off(element,event,cb){var capture=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;element.removeEventListener(event,cb,capture);}function once(element,event,cb){var capture=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var _nextCB;// eslint-disable-next-line prefer-const\n_nextCB=function nextCB(e){cb(e);off(element,event,_nextCB);};on(element,event,_nextCB,capture);}function noop(){}\n\nvar ReactFloaterPortal=/*#__PURE__*/function(_React$Component){_inherits(ReactFloaterPortal,_React$Component);function ReactFloaterPortal(props){var _this;_classCallCheck(this,ReactFloaterPortal);_this=_possibleConstructorReturn(this,_getPrototypeOf(ReactFloaterPortal).call(this,props));if(!canUseDOM)return _possibleConstructorReturn(_this);_this.node=document.createElement('div');if(props.id){_this.node.id=props.id;}if(props.zIndex){_this.node.style.zIndex=props.zIndex;}document.body.appendChild(_this.node);return _this;}_createClass(ReactFloaterPortal,[{key:\"componentDidMount\",value:function componentDidMount(){if(!canUseDOM)return;if(!isReact16){this.renderPortal();}}},{key:\"componentDidUpdate\",value:function componentDidUpdate(){if(!canUseDOM)return;if(!isReact16){this.renderPortal();}}},{key:\"componentWillUnmount\",value:function componentWillUnmount(){if(!canUseDOM||!this.node)return;if(!isReact16){ReactDOM.unmountComponentAtNode(this.node);}document.body.removeChild(this.node);}},{key:\"renderPortal\",value:function renderPortal(){if(!canUseDOM)return null;var _this$props=this.props,children=_this$props.children,setRef=_this$props.setRef;/* istanbul ignore else */if(isReact16){return ReactDOM.createPortal(children,this.node);}var portal=ReactDOM.unstable_renderSubtreeIntoContainer(this,children.length>1?React.createElement(\"div\",null,children):children[0],this.node);setRef(portal);return null;}},{key:\"renderReact16\",value:function renderReact16(){var _this$props2=this.props,hasChildren=_this$props2.hasChildren,placement=_this$props2.placement,target=_this$props2.target;if(!hasChildren){if(target||placement==='center'){return this.renderPortal();}return null;}return this.renderPortal();}},{key:\"render\",value:function render(){if(!isReact16){return null;}return this.renderReact16();}}]);return ReactFloaterPortal;}(React.Component);_defineProperty(ReactFloaterPortal,\"propTypes\",{children:PropTypes.oneOfType([PropTypes.element,PropTypes.array]),hasChildren:PropTypes.bool,id:PropTypes.oneOfType([PropTypes.string,PropTypes.number]),placement:PropTypes.string,setRef:PropTypes.func.isRequired,target:PropTypes.oneOfType([PropTypes.object,PropTypes.string]),zIndex:PropTypes.number});\n\nvar FloaterArrow=/*#__PURE__*/function(_React$Component){_inherits(FloaterArrow,_React$Component);function FloaterArrow(){_classCallCheck(this,FloaterArrow);return _possibleConstructorReturn(this,_getPrototypeOf(FloaterArrow).apply(this,arguments));}_createClass(FloaterArrow,[{key:\"render\",value:function render(){var _this$props=this.props,placement=_this$props.placement,setArrowRef=_this$props.setArrowRef,styles=_this$props.styles;var _styles$arrow=styles.arrow,color=_styles$arrow.color,display=_styles$arrow.display,length=_styles$arrow.length,margin=_styles$arrow.margin,position=_styles$arrow.position,spread=_styles$arrow.spread;var arrowStyles={display:display,position:position};var points;var x=spread;var y=length;/* istanbul ignore else */if(placement.startsWith('top')){points=\"0,0 \".concat(x/2,\",\").concat(y,\" \").concat(x,\",0\");arrowStyles.bottom=0;arrowStyles.marginLeft=margin;arrowStyles.marginRight=margin;}else if(placement.startsWith('bottom')){points=\"\".concat(x,\",\").concat(y,\" \").concat(x/2,\",0 0,\").concat(y);arrowStyles.top=0;arrowStyles.marginLeft=margin;arrowStyles.marginRight=margin;}else if(placement.startsWith('left')){y=spread;x=length;points=\"0,0 \".concat(x,\",\").concat(y/2,\" 0,\").concat(y);arrowStyles.right=0;arrowStyles.marginTop=margin;arrowStyles.marginBottom=margin;}else if(placement.startsWith('right')){y=spread;x=length;points=\"\".concat(x,\",\").concat(y,\" \").concat(x,\",0 0,\").concat(y/2);arrowStyles.left=0;arrowStyles.marginTop=margin;arrowStyles.marginBottom=margin;}return React.createElement(\"div\",{className:\"__floater__arrow\",style:this.parentStyle},React.createElement(\"span\",{ref:setArrowRef,style:arrowStyles},React.createElement(\"svg\",{width:x,height:y,version:\"1.1\",xmlns:\"http://www.w3.org/2000/svg\"},React.createElement(\"polygon\",{points:points,fill:color}))));}},{key:\"parentStyle\",get:function get(){var _this$props2=this.props,placement=_this$props2.placement,styles=_this$props2.styles;var length=styles.arrow.length;var arrow={pointerEvents:'none',position:'absolute',width:'100%'};/* istanbul ignore else */if(placement.startsWith('top')){arrow.bottom=0;arrow.left=0;arrow.right=0;arrow.height=length;}else if(placement.startsWith('bottom')){arrow.left=0;arrow.right=0;arrow.top=0;arrow.height=length;}else if(placement.startsWith('left')){arrow.right=0;arrow.top=0;arrow.bottom=0;}else if(placement.startsWith('right')){arrow.left=0;arrow.top=0;}return arrow;}}]);return FloaterArrow;}(React.Component);_defineProperty(FloaterArrow,\"propTypes\",{placement:PropTypes.string.isRequired,setArrowRef:PropTypes.func.isRequired,styles:PropTypes.object.isRequired});\n\nvar FloaterCloseBtn=function FloaterCloseBtn(_ref){var handleClick=_ref.handleClick,styles=_ref.styles;var color=styles.color,height=styles.height,width=styles.width,style=_objectWithoutProperties(styles,[\"color\",\"height\",\"width\"]);return React.createElement(\"button\",{\"aria-label\":\"close\",onClick:handleClick,style:style,type:\"button\"},React.createElement(\"svg\",{width:\"\".concat(width,\"px\"),height:\"\".concat(height,\"px\"),viewBox:\"0 0 18 18\",version:\"1.1\",xmlns:\"http://www.w3.org/2000/svg\",preserveAspectRatio:\"xMidYMid\"},React.createElement(\"g\",null,React.createElement(\"path\",{d:\"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.57