{"version":3,"file":"client.es.mjs","names":["versions","aobject","randomBytes","B","shake256","randb","N","Q","PRF","opts","shake256","MlKEM1024","MlKEM768","Meta","Meta","versions","textEncoder","GCM_IV_LENGTH","textEncoder","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","createWSClient","getFingerprint","getFingerprintData","Response","textDecoder","KEY_PREFIX","KEY_PREFIX","GCM_IV_LENGTH","textEncoder","textDecoder"],"sources":["../src/libraries/Hex.js","../src/libraries/strings.js","../src/Meta.js","../src/libraries/array.js","../src/PolicyMeta.js","../src/AtomMeta.js","../src/exception/BaseException.js","../src/exception/AtomsMissingException.js","../src/versions/HashAtom.js","../src/versions/Version4.js","../src/versions/index.js","../src/Atom.js","../src/libraries/crypto.js","../src/TokenUnit.js","../src/exception/WalletCredentialException.js","../node_modules/@noble/hashes/_u64.js","../node_modules/@noble/hashes/utils.js","../node_modules/@noble/hashes/sha3.js","../node_modules/@noble/curves/utils.js","../node_modules/@noble/curves/abstract/fft.js","../node_modules/@noble/post-quantum/utils.js","../node_modules/@noble/post-quantum/_crystals.js","../node_modules/@noble/post-quantum/ml-kem.js","../src/Wallet.js","../src/exception/AtomIndexException.js","../src/exception/MolecularHashMismatchException.js","../src/exception/MolecularHashMissingException.js","../src/exception/PolicyInvalidException.js","../src/exception/SignatureMalformedException.js","../src/exception/SignatureMismatchException.js","../src/exception/TransferBalanceException.js","../src/exception/TransferMalformedException.js","../src/exception/TransferMismatchedException.js","../src/exception/TransferRemainderException.js","../src/exception/TransferToSelfException.js","../src/exception/TransferUnbalancedException.js","../src/exception/MetaMissingException.js","../src/exception/WrongTokenTypeException.js","../src/exception/BatchIdException.js","../src/instance/Rules/Meta.js","../src/instance/Rules/exception/RuleArgumentException.js","../src/exception/CodeException.js","../src/instance/Rules/Callback.js","../src/instance/Rules/Condition.js","../src/instance/Rules/Rule.js","../src/libraries/Dot.js","../src/libraries/CheckMolecule.js","../src/exception/BalanceInsufficientException.js","../src/exception/NegativeAmountException.js","../src/Molecule.js","../src/AuthToken.js","../src/exception/SecretStorageException.js","../src/libraries/secureMemory.js","../src/storage/secretEnvelope.js","../src/storage/MemorySecretStorageProvider.js","../src/libraries/Decimal.js","../src/exception/InvalidResponseException.js","../src/exception/UnauthenticatedException.js","../src/response/Response.js","../src/query/Query.js","../src/response/ResponseContinuId.js","../src/query/QueryContinuId.js","../src/response/ResponseWalletBundle.js","../src/query/QueryWalletBundle.js","../src/response/ResponseWalletList.js","../src/query/QueryWalletList.js","../src/response/ResponseBalance.js","../src/query/QueryBalance.js","../src/response/ResponseMetaType.js","../src/query/QueryMetaType.js","../src/query/QueryBatch.js","../src/query/QueryBatchHistory.js","../src/response/ResponseProposeMolecule.js","../src/mutation/Mutation.js","../src/mutation/MutationProposeMolecule.js","../src/response/ResponseRequestAuthorization.js","../src/mutation/MutationRequestAuthorization.js","../src/response/ResponseCreateToken.js","../src/mutation/MutationCreateToken.js","../src/response/ResponseRequestTokens.js","../src/mutation/MutationRequestTokens.js","../src/response/ResponseTransferTokens.js","../src/mutation/MutationTransferTokens.js","../src/response/ResponseCreateIdentifier.js","../src/mutation/MutationCreateIdentifier.js","../src/response/ResponseClaimShadowWallet.js","../src/mutation/MutationClaimShadowWallet.js","../src/response/ResponseCreateMeta.js","../src/mutation/MutationCreateMeta.js","../src/response/ResponsePeering.js","../src/mutation/MutationPeering.js","../src/response/ResponseAppendRequest.js","../src/mutation/MutationAppendRequest.js","../src/response/ResponseLinkIdentifier.js","../src/mutation/MutationLinkIdentifier.js","../src/response/ResponseCreateWallet.js","../src/mutation/MutationCreateWallet.js","../src/response/ResponseRequestAuthorizationGuest.js","../src/mutation/MutationRequestAuthorizationGuest.js","../src/exception/WalletShadowException.js","../src/exception/StackableUnitDecimalsException.js","../src/exception/StackableUnitAmountException.js","../src/subscribe/Subscribe.js","../src/subscribe/CreateMoleculeSubscribe.js","../src/subscribe/WalletStatusSubscribe.js","../src/subscribe/ActiveWalletSubscribe.js","../src/subscribe/ActiveSessionSubscribe.js","../src/response/ResponseActiveSession.js","../src/mutation/MutationActiveSession.js","../src/response/ResponseQueryActiveSession.js","../src/query/QueryActiveSession.js","../src/query/QueryToken.js","../src/exception/AuthorizationRejectedException.js","../src/response/ResponseAtom.js","../src/query/QueryAtom.js","../src/response/ResponsePolicy.js","../src/query/QueryPolicy.js","../src/response/ResponseMetaTypeViaAtom.js","../src/query/QueryMetaTypeViaAtom.js","../src/response/ResponseMetaTypeViaMolecule.js","../src/query/QueryMetaTypeViaMolecule.js","../src/response/ResponseEmbeddingStatus.js","../src/query/QueryEmbeddingStatus.js","../src/response/ResponseCreateRule.js","../src/mutation/MutationCreateRule.js","../src/mutation/MutationDepositBufferToken.js","../src/mutation/MutationWithdrawBufferToken.js","../node_modules/@thumbmarkjs/thumbmarkjs/dist/thumbmark.esm.js","../src/libraries/urql/UrqlClientWrapper.js","../src/KnishIOClient.js","../src/response/ResponseAuthorizationGuest.js","../src/storage/WebCryptoSecretStorageProvider.js","../src/storage/FileStorageBackend.js","../src/storage/WebStorageBackend.js","../src/storage/WebAuthnPrfSecretStorageProvider.js","../src/storage/NonExtractableKeySecretStorageProvider.js","../src/storage/index.js"],"sourcesContent":["/**\n * Create Uint8Array buffers from hexadecimal strings, and vice versa.\n */\n\nif (typeof self === 'undefined') {\n  global.self = global\n}\n\nexport default class Hex {\n  /**\n   * Converts the given buffer to a string containing its hexadecimal representation.\n   *\n   * arr a Uint8Array buffer to convert.\n   *\n   * options an optional object with the following members:\n   *     grouping this number of hex bytes are grouped together with spaces between groups. 0 means no grouping is applied. 0 if unspecified.\n   *     rowlength the number of groups which make up a row. When 0, no splitting into rows occurs. 0 if unspecified.\n   *     uppercase if true, the output will be in uppercase. true by default.\n   *\n   * return a hexadecimal string representing the buffer.\n   *\n   * @param {array|ArrayBuffer|Uint8Array} arr\n   * @param {object} options\n   * @return {string}\n   */\n  static toHex (arr, options) {\n    /**\n     * @param {number} val\n     * @param {boolean} uppercase\n     * @return {*}\n     */\n    const numberToHex = (val, uppercase) => {\n      const set = uppercase\n        ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']\n        : ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']\n\n      return set[Math.floor(val / 16)] + set[val % 16]\n    }\n    const opts = Object.assign(\n      {\n        grouping: 0,\n        rowlength: 0,\n        uppercase: false\n      },\n      options || {}\n    )\n\n    let str = ''\n    let group = 0\n    let column = 0\n\n    for (let i = 0; i < arr.length; ++i) {\n      str += numberToHex(arr[i], opts.uppercase)\n\n      if (i === arr.length - 1) {\n        break\n      }\n\n      if (opts.grouping > 0 && ++group === opts.grouping) {\n        group = 0\n\n        if (opts.rowlength > 0 && ++column === opts.rowlength) {\n          column = 0\n          str += '\\n'\n        } else {\n          str += ' '\n        }\n      }\n    }\n\n    return str\n  }\n\n  /**\n   * Takes a string containing hexadecimal and returns the equivalent as a Uint8Array buffer.\n   *\n   * str The string to convert. Whitespace is ignored. If an odd number of characters are specified,\n   * it will act as if preceeded with a leading 0; that is, \"FFF\" is equivalent to \"0FFF\".\n   *\n   * return a Uint8Array array.\n   *\n   * @param {string} str\n   * @return {Uint8Array}\n   */\n  static toUint8Array (str) {\n    let target = str.toLowerCase().replace(/\\s/g, '')\n\n    if (target.length % 2 === 1) {\n      target = `0${ target }`\n    }\n\n    const buffer = new Uint8Array(Math.floor(target.length / 2))\n    let curr = -1\n\n    for (let i = 0; i < target.length; ++i) {\n      const c = target[i]\n      const val = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'].indexOf(c)\n\n      if (val === -1) {\n        throw Error('unexpected character')\n      }\n\n      if (curr === -1) {\n        curr = 16 * val\n      } else {\n        buffer[Math.floor(i / 2)] = curr + val\n        curr = -1\n      }\n    }\n\n    return buffer\n  }\n}\n","import Hex from './Hex.js'\n\n/* eslint-disable no-extend-native -- intentional guarded String.prototype polyfill (trim) + SDK camel/snake-case helpers relied on across the codebase */\nif (!String.prototype.trim) {\n  String.prototype.trim = function () {\n    return this.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '')\n  }\n}\n\nif (!String.prototype.toCamelCase) {\n  String.prototype.toCamelCase = function () {\n    return this.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase())\n  }\n}\n\nif (!String.prototype.toSnakeCase) {\n  String.prototype.toSnakeCase = function () {\n    return this.replace(/[A-Z]/g, letter => `_${ letter.toLowerCase() }`)\n  }\n}\n\n/**\n * Chunks a string into array segments of equal size\n *\n * @param str\n * @param size\n * @return {any[]}\n */\nexport function chunkSubstr (str, size) {\n  const numChunks = Math.ceil(str.length / size)\n  const chunks = []\n\n  for (let chunkIndex = 0, o = 0; chunkIndex < numChunks; ++chunkIndex, o += size) {\n    chunks[chunkIndex] = str.substr(o, size)\n  }\n\n  return chunks\n}\n\n/**\n * Generates a cryptographically-secure pseudo-random string of the given length out of the given alphabet\n *\n * @param length\n * @param alphabet\n * @return {string}\n */\nexport function randomString (length = 256, alphabet = 'abcdef0123456789') {\n  const array = new Uint8Array(length)\n\n  crypto.getRandomValues(array)\n\n  // Build in a loop: String.fromCharCode.apply(null, array) spread every byte as a\n  // function argument and overflowed the call stack for a large caller-supplied length.\n  // `alphabet.charAt(x % len)` is the same mapping as the old fromCharCode(charCodeAt).\n  let result = ''\n  for (let i = 0; i < length; i++) {\n    result += alphabet.charAt(array[i] % alphabet.length)\n  }\n  return result\n}\n\n/**\n * Convert charset between bases and alphabets\n *\n * @param src\n * @param {int} fromBase\n * @param {int} toBase\n * @param { string} srcSymbolTable\n * @param {string} destSymbolTable\n * @return {boolean|string|number}\n */\nexport function charsetBaseConvert (src, fromBase, toBase, srcSymbolTable, destSymbolTable) {\n  const baseSymbols = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()-_=+[{]}\\\\|;:\\'\",<.>/?¿¡'\n  srcSymbolTable = srcSymbolTable || baseSymbols\n  destSymbolTable = destSymbolTable || srcSymbolTable\n\n  if (fromBase > srcSymbolTable.length || toBase > destSymbolTable.length) {\n    console.warn('Strings::charsetBaseConvert() - Can\\'t convert', src, 'to base', toBase, 'greater than symbol table length. src-table:', srcSymbolTable.length, 'dest-table:', destSymbolTable.length)\n    return false\n  }\n\n  // Convert from source base to BigInt in base 10\n  let val = BigInt(0)\n  for (let charIndex = 0; charIndex < src.length; charIndex++) {\n    val = val * BigInt(fromBase) + BigInt(srcSymbolTable.indexOf(src.charAt(charIndex)))\n  }\n\n  // Convert from BigInt in base 10 to destination base\n  let res = ''\n  while (val > 0) {\n    const r = val % BigInt(toBase)\n    res = destSymbolTable.charAt(Number(r)) + res\n    val /= BigInt(toBase)\n  }\n\n  // If the result is empty, it means the source was 0\n  return res || '0'\n}\n\n/**\n * Converts a buffer into a hexadecimal string\n *\n * @param byteArray\n * @return {string}\n */\nexport function bufferToHexString (byteArray) {\n  return Hex.toHex(byteArray, {})\n}\n\n/**\n * Converts a hexadecimal string into a buffer\n *\n * @param hexString\n * @return {Uint8Array}\n */\nexport function hexStringToBuffer (hexString) {\n  return Hex.toUint8Array(hexString)\n}\n\n/**\n * Compresses a given string for web sharing\n *\n * @param string\n * @return {string}\n */\nexport function hexToBase64 (string) {\n  const bytes = hexStringToBuffer(string)\n  // Buffer fast path (Node). Byte-identical to the btoa encoding below.\n  if (typeof Buffer !== 'undefined') {\n    return Buffer.from(bytes).toString('base64')\n  }\n  // Browser fallback: String.fromCharCode.apply(null, bytes) spreads every byte as a\n  // function argument and overflows the call stack past the engine's argument limit\n  // (~64K), so convert in chunks.\n  let binary = ''\n  const CHUNK_SIZE = 0x8000\n  for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {\n    binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE))\n  }\n  return btoa(binary)\n}\n\n/**\n * Decompresses a compressed string\n *\n * @param {string} string\n * @return {string}\n */\nexport function base64ToHex (string) {\n  // Buffer fast path (Node); index loop otherwise. The old `atob(string).split('')`\n  // allocated one single-char string per byte — prohibitive for multi-MB payloads.\n  if (typeof Buffer !== 'undefined') {\n    return bufferToHexString(new Uint8Array(Buffer.from(string, 'base64')))\n  }\n  const binary = atob(string)\n  const bytes = new Uint8Array(binary.length)\n  for (let i = 0; i < binary.length; i++) {\n    bytes[i] = binary.charCodeAt(i)\n  }\n  return bufferToHexString(bytes)\n}\n\n/**\n * @param {string} str\n * @return {boolean}\n */\nexport function isHex (str) {\n  return /^[A-F0-9]+$/i.test(str)\n}\n\n/**\n * @param {string} str\n * @return {boolean}\n */\nexport function isNumeric (str) {\n  return (typeof (str) === 'number' || (typeof (str) === 'string' && str.trim() !== '')) && !isNaN(str)\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n */\n\n/**\n * Meta class to represent metadata conveyed by Atoms\n */\nexport default class Meta {\n  /**\n   * Normalizes the meta array into the standard {key: ..., value: ...} format\n   *\n   * @param {array|object} meta\n   * @return {array}\n   */\n  static normalizeMeta (meta) {\n    // Ensuring that only object-based meta gets normalized\n    if (Array.isArray(meta)) {\n      return meta.map(entry => ({\n        key: entry.key,\n        value: entry.value == null ? null : String(entry.value)\n      }))\n    }\n\n    // Converting object-based meta into array-based notation\n    const target = []\n    for (const property in meta) {\n      if (Object.prototype.hasOwnProperty.call(meta, property)) {\n        const raw = meta[property]\n        target.push({ key: property, value: raw == null ? null : String(raw) })\n      }\n    }\n\n    return target\n  }\n\n  /**\n   * Condenses metadata array into object-based key: value notation\n   *\n   * @param {array|object} meta\n   * @return {object}\n   */\n  static aggregateMeta (meta) {\n    let aggregate = {}\n\n    // Ensuring that only array-based meta gets aggregated\n    if (Array.isArray(meta)) {\n      for (const metaEntry of meta) {\n        aggregate[metaEntry.key] = metaEntry.value\n      }\n    } else {\n      aggregate = meta\n    }\n\n    return aggregate\n  }\n}\n","/**\n * Split an array into chunks\n *\n * @param {array} arr\n * @param {number} size\n * @return {array}\n */\nexport function chunkArray (arr, size) {\n  // Iterative: the previous recursive form (`concat` + `slice(size)` per level) blew\n  // the call stack and allocated O(n^2) once arr grew past a few thousand elements.\n  const chunks = []\n  for (let i = 0; i < arr.length; i += size) {\n    chunks.push(arr.slice(i, i + size))\n  }\n  return chunks\n}\n\nexport function deepCloning (\n  o // The only argument passed by user: object to clone\n  , h // Cache (organized as array: [key,value,key,value,...])\n) {\n  let i\n  let r\n  let x // Property indexer, result, temporary variable\n\n  const t = [Array, Date, Number, String, Boolean] // Types to treat in a special way\n\n  const s = Object.prototype.toString // Shortcut to Object.prototype.toString\n  h = h || [] // If cache is not created yet, create it!\n  // Search cache for our object\n  for (i = 0; i < h.length; i += 2) {\n    if (o === h[i]) {\n      r = h[i + 1]\n    }\n  }\n  // Clone o if it is uncached object and not null\n  if (!r && o && typeof o === 'object') {\n    r = {} // Default result template: plain hash\n    // To handle multiframe environment, search for type by\n    for (i = 0; i < t.length; i++) {\n      //   comparing Object.prototype.toString's of our object\n      //   and new object x created with the constructor t[i]\n      // Notice that it will create new Date(o), new String(o)\n      //   which is good and new Array(o) which is bad\n      if (s.call(o) === s.call(x = new t[i](o))) {\n        r = i ? x : []\n      }\n    } // If i==0, t==Array. We need to recreate it. Else use x\n    h.push(o, r) // Add object to cache before (!) making recursive call\n    // Just copy properties recursively\n    for (i in o) {\n      // As o might have key 'hasOwnProperty', use something\n      if (h.hasOwnProperty.call(o, i)) {\n        r[i] = deepCloning(o[i], h)\n      }\n    } //   we defined right instead\n  }\n  return r || o // Return r if it was found in cache or built in if(){}\n}\n\n/**\n * @param arrays\n * @returns {*[]}\n */\nexport function diff (...arrays) {\n  return [].concat(...arrays.map((arr, i) => {\n    const others = arrays.slice(0)\n\n    others.splice(i, 1)\n\n    const unique = [...new Set([].concat(...others))]\n\n    return arr.filter(item => !unique.includes(item))\n  }))\n}\n\n/**\n *\n * @param arrays\n * @return {*[]}\n */\nexport function intersect (...arrays) {\n  return arrays.reduce((first, second) => first.filter(item => second.includes(item)))\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport { diff } from './libraries/array.js'\n\n/**\n *\n */\nexport default class PolicyMeta {\n  /**\n   *\n   * @param policy\n   * @param metaKeys\n   */\n  constructor (policy = {}, metaKeys = {}) {\n    this.policy = PolicyMeta.normalizePolicy(policy)\n    this.fillDefault(metaKeys)\n  }\n\n  /**\n   *\n   * @param policy\n   * @returns {{}}\n   */\n  static normalizePolicy (policy = {}) {\n    const policyMeta = {}\n    for (const [policyKey, value] of Object.entries(policy)) {\n      if (value !== null && ['read', 'write'].includes(policyKey)) {\n        policyMeta[policyKey] = {}\n        for (const [key, content] of Object.entries(value)) {\n          policyMeta[policyKey][key] = content\n        }\n      }\n    }\n    return policyMeta\n  }\n\n  /**\n   *\n   */\n  fillDefault (metaKeys = {}) {\n    const readPolicy = Array.from(this.policy).filter(item => item.action === 'read')\n    const writePolicy = Array.from(this.policy).filter(item => item.action === 'write')\n\n    for (const [type, value] of Object.entries({\n      read: readPolicy,\n      write: writePolicy\n    })) {\n      const policyKey = value.map(item => item.key)\n\n      if (!this.policy[type]) {\n        this.policy[type] = {}\n      }\n\n      for (const key of diff(metaKeys, policyKey)) {\n        if (!this.policy[type][key]) {\n          this.policy[type][key] = (type === 'write' && !['characters', 'pubkey'].includes(key)) ? ['self'] : ['all']\n        }\n      }\n    }\n  }\n\n  /**\n   *\n   * @returns {{}|*}\n   */\n  get () {\n    return this.policy\n  }\n\n  /**\n   *\n   * @returns {string}\n   */\n  toJson () {\n    return JSON.stringify(this.get())\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport PolicyMeta from './PolicyMeta.js'\nimport Meta from './Meta.js'\n\nconst USE_META_CONTEXT = false\nconst DEFAULT_META_CONTEXT = 'https://www.schema.org'\n\n/**\n *\n */\nexport default class AtomMeta {\n  /**\n   *\n   * @param {object|array} meta\n   */\n  constructor (meta = []) {\n    this.meta = Meta.normalizeMeta(meta)\n  }\n\n  /**\n   *\n   * @param {object|array} meta\n   * @returns {AtomMeta}\n   */\n  merge (meta) {\n    this.meta = Array.from(new Set([...this.meta, ...Meta.normalizeMeta(meta)]))\n    return this\n  }\n\n  /**\n   *\n   * @param context\n   * @returns {AtomMeta}\n   */\n  addContext (context = null) {\n    // Add context key if it is enabled\n    if (USE_META_CONTEXT) {\n      this.merge({ context: context || DEFAULT_META_CONTEXT })\n    }\n\n    return this\n  }\n\n  /**\n   *\n   * @param {Wallet} wallet\n   * @returns {AtomMeta}\n   */\n  setAtomWallet (wallet) {\n    const walletMeta = {}\n\n    // Add token units meta key\n    if (wallet.tokenUnits && wallet.tokenUnits.length) {\n      walletMeta.tokenUnits = JSON.stringify(wallet.getTokenUnitsData())\n    }\n    // Add trade rates meta key\n    if (wallet.tradeRates && wallet.tradeRates.length) {\n      walletMeta.tradeRates = JSON.stringify(wallet.tradeRates)\n    }\n\n    // Merge all wallet's metas (if any)\n    if (Object.keys(walletMeta).length > 0) {\n      this.merge(walletMeta)\n    }\n    return this\n  }\n\n  /**\n   * Set full NEW wallet metadata\n   * Used for shadow wallet claim & wallet creation & token creation\n   *\n   * @param {Wallet} wallet\n   * @returns {AtomMeta}\n   */\n  setMetaWallet (wallet) {\n    this.merge({\n      walletTokenSlug: wallet.token,\n      walletBundleHash: wallet.bundle,\n      walletAddress: wallet.address,\n      walletPosition: wallet.position,\n      walletBatchId: wallet.batchId,\n      walletPubkey: wallet.pubkey,\n      walletCharacters: wallet.characters\n    })\n    return this\n  }\n\n  /**\n   *\n   * @param shadowWalletClaim\n   * @returns {AtomMeta}\n   */\n  setShadowWalletClaim (shadowWalletClaim) {\n    this.merge({ shadowWalletClaim: shadowWalletClaim * 1 })\n    return this\n  }\n\n  /**\n   *\n   * @param {Wallet} signingWallet\n   * @returns {AtomMeta}\n   */\n  setSigningWallet (signingWallet) {\n    this.merge({\n      signingWallet: JSON.stringify({\n        tokenSlug: signingWallet.token,\n        bundleHash: signingWallet.bundle,\n        address: signingWallet.address,\n        position: signingWallet.position,\n        pubkey: signingWallet.pubkey,\n        characters: signingWallet.characters\n      })\n    })\n    return this\n  }\n\n  /**\n   *\n   * @param policy\n   * @todo move logic to the separated class\n   * @returns {AtomMeta}\n   */\n  addPolicy (policy) {\n    // Policy meta initialization\n    const policyMeta = new PolicyMeta(policy, Object.keys(this.meta))\n\n    this.merge({\n      policy: policyMeta.toJson()\n    })\n\n    return this\n  }\n\n  /**\n   *\n   * @returns {array}\n   */\n  get () {\n    return this.meta\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n/**\n * Base exception class\n */\nexport default class BaseException extends TypeError {\n  /**\n   * @param {string|null} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = null, fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n\n    if (message === null) {\n      throw new this(`Unknown ${ this.constructor.name }`)\n    }\n\n    this.name = 'BaseException'\n  }\n\n  /**\n   * @return {string}\n   */\n  toString () {\n    return `${ this.name }: ${ this.message }.\\nStack:\\n${ this.stack }`\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Empty molecules are not allowed\n */\nexport default class AtomsMissingException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'The molecule does not contain atoms', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'AtomsMissingException'\n  }\n}\n","export default class HashAtom {\n  /**\n   *\n   * @param {Atom} atom\n   */\n  static create (atom) {\n    const parameters = {}\n\n    for (const key of Object.keys(atom)) {\n      if (Object.prototype.hasOwnProperty.call(atom, key)) {\n        parameters[key] = atom[key]\n      }\n    }\n\n    return new this(parameters)\n  }\n\n  /**\n   *\n   * @param {Object|Array} object\n   * @returns {Object|Array[]}\n   */\n  static structure (object) {\n    switch (Object.prototype.toString.call(object)) {\n      case '[object Array]': {\n        const result = []\n        for (const key in object) {\n          result.push(HashAtom.isStructure(object[key]) ? HashAtom.structure(object[key]) : object[key])\n        }\n\n        return result\n      }\n\n      case '[object Object]': {\n        const result = []\n        const keys = Object.keys(object).sort((first, second) => {\n          if (first === second) {\n            return 0\n          }\n          return (first < second) ? -1 : 1\n        })\n\n        for (const key of keys) {\n          if (Object.prototype.hasOwnProperty.call(object, key)) {\n            const item = {}\n            item[key] = HashAtom.isStructure(object[key]) ? HashAtom.structure(object[key]) : object[key]\n            result.push(item)\n          }\n        }\n\n        if (result.length > 0) {\n          return result\n        }\n\n        break\n      }\n    }\n\n    return object\n  }\n\n  /**\n   *\n   * @param {*} structure\n   * @returns {boolean}\n   */\n  static isStructure (structure) {\n    return ['[object Object]', '[object Array]'].includes(Object.prototype.toString.call(structure))\n  }\n\n  /**\n   *\n   * @returns {Object[]}\n   */\n  view () {\n    return HashAtom.structure(this)\n  }\n}\n","import HashAtom from './HashAtom.js'\n\nexport default class Version4 extends HashAtom {\n  constructor ({\n    position = null,\n    walletAddress = null,\n    isotope = null,\n    token = null,\n    value = null,\n    batchId = null,\n    metaType = null,\n    metaId = null,\n    meta = null,\n    index = null,\n    createdAt = null,\n    version = null\n  }) {\n    super()\n    this.position = position\n    this.walletAddress = walletAddress\n    this.isotope = isotope\n    this.token = token\n    this.value = value\n    this.batchId = batchId\n\n    this.metaType = metaType\n    this.metaId = metaId\n    this.meta = meta\n\n    this.index = index\n    this.createdAt = createdAt\n    this.version = version\n  }\n}\n","import Version4 from './Version4.js'\n\nexport default {\n  4: Version4\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport JsSHA from 'jssha'\nimport { charsetBaseConvert } from './libraries/strings.js'\nimport Meta from './Meta.js'\nimport AtomMeta from './AtomMeta.js'\nimport AtomsMissingException from './exception/AtomsMissingException.js'\nimport versions from './versions/index.js'\n\n/**\n * Atom class used to form microtransactions within a Molecule\n */\nexport default class Atom {\n  /**\n   * Class constructor\n   *\n   * @param {string|null} position\n   * @param {string|null} walletAddress\n   * @param {string|null} isotope\n   * @param {string|null} token\n   * @param {string|number|null} value\n   * @param {string|null} batchId\n   * @param {string|null} metaType\n   * @param {string|null} metaId\n   * @param {array|object|null} meta\n   * @param {string|null} otsFragment\n   * @param {number|null} index\n   * @param {string|null} version\n   */\n  constructor ({\n    position = null,\n    walletAddress = null,\n    isotope = null,\n    token = null,\n    value = null,\n    batchId = null,\n    metaType = null,\n    metaId = null,\n    meta = null,\n    otsFragment = null,\n    index = null,\n    version = null\n  }) {\n    this.position = position\n    this.walletAddress = walletAddress\n    this.isotope = isotope\n    this.token = token\n    this.value = value !== null ? String(value) : null\n    this.batchId = batchId\n\n    this.metaType = metaType\n    this.metaId = metaId\n    this.meta = meta ? Meta.normalizeMeta(meta) : []\n\n    this.index = index\n    this.otsFragment = otsFragment\n    this.createdAt = String(+new Date())\n    if (version !== null && Object.prototype.hasOwnProperty.call(versions, version)) {\n      this.version = String(version)\n    }\n  }\n\n  /**\n   *\n   * @returns {string[]}\n   */\n  static getHashableProps () {\n    return [\n      'position',\n      'walletAddress',\n      'isotope',\n      'token',\n      'value',\n      'batchId',\n      'metaType',\n      'metaId',\n      'meta',\n      'createdAt'\n    ]\n  }\n\n  /**\n   *\n   * @returns {string[]}\n   */\n  static getUnclaimedProps () {\n    return [\n      'otsFragment'\n    ]\n  }\n\n  /**\n   *\n   * @param {string} isotope\n   * @param {Wallet|null} wallet\n   * @param {int|null} value\n   * @param {string|null} metaType\n   * @param {string|null} metaId\n   * @param {AtomMeta|array|object|null} meta\n   * @param {string|null} batchId\n   * @returns {Atom}\n   */\n  static create ({\n    isotope,\n    wallet = null,\n    value = null,\n    metaType = null,\n    metaId = null,\n    meta = null,\n    batchId = null\n  }) {\n    // If meta object is not passed - create it\n    if (!meta) {\n      meta = new AtomMeta()\n    }\n\n    // If meta object is not an instance of AtomMeta - create it from meta\n    if (!(meta instanceof AtomMeta)) {\n      meta = new AtomMeta(meta)\n    }\n\n    // If wallet has been passed => add related metas\n    if (wallet) {\n      // Add wallet's meta\n      meta.setAtomWallet(wallet)\n\n      // If batch ID does not passed: set it from the wallet\n      if (!batchId) {\n        batchId = wallet.batchId\n      }\n    }\n\n    // Create the final atom's object\n    // walletAddress is null for atoms without a pre-existing wallet (e.g., recipient V-atoms).\n    // toJSON() serializes null as '' for GraphQL compatibility; hash computation treats both identically.\n    return new Atom({\n      position: wallet ? wallet.position : null,\n      walletAddress: wallet ? wallet.address : null,\n      isotope,\n      token: wallet ? wallet.token : null,\n      value,\n      batchId,\n      metaType,\n      metaId,\n      meta: meta.get()\n    })\n  }\n\n  /**\n   * Converts a compliant JSON string into an Atom class instance\n   *\n   * @param {string} json\n   * @return {object}\n   */\n  static jsonToObject (json) {\n    const target = Object.assign(new Atom({}), JSON.parse(json))\n    const properties = Object.keys(new Atom({}))\n\n    for (const property in target) {\n      if (Object.prototype.hasOwnProperty.call(target, property) && !properties.includes(property)) {\n        delete target[property]\n      }\n    }\n\n    return target\n  }\n\n  /**\n   * Returns JSON-ready object for cross-SDK compatibility (2025 JS best practices)\n   *\n   * Provides clean serialization of atomic operations with optional OTS fragments.\n   * Follows 2025 JavaScript best practices with proper type safety and validation.\n   *\n   * @param {Object} options - Serialization options\n   * @param {boolean} options.includeOtsFragments - Include OTS signature fragments (default: true)\n   * @param {boolean} options.validateFields - Validate required fields (default: false)\n   * @return {Object} JSON-serializable object\n   * @throws {Error} If atom is in invalid state for serialization\n   */\n  toJSON (options = {}) {\n    const {\n      includeOtsFragments = true,\n      validateFields = false\n    } = options\n\n    try {\n      // Validate required fields if requested\n      if (validateFields) {\n        const requiredFields = ['position', 'walletAddress', 'isotope', 'token']\n        for (const field of requiredFields) {\n          if (!this[field]) {\n            throw new Error(`Required field '${field}' is missing or empty`)\n          }\n        }\n      }\n\n      // Core atom properties (always included)\n      // Coerce null position/walletAddress/token to empty string for GraphQL compatibility.\n      // The molecular hash computation (getHashableValues) already treats null as '' (line 448),\n      // so this coercion does NOT change the hash. Required because the Rust validator's\n      // GraphQL schema uses String! (non-null) with #[graphql(default)] for these fields,\n      // which accepts omitted values but rejects explicit null.\n      const serialized = {\n        position: this.position ?? '',\n        walletAddress: this.walletAddress ?? '',\n        isotope: this.isotope,\n        token: this.token ?? '',\n        value: this.value,\n        batchId: this.batchId,\n        metaType: this.metaType,\n        metaId: this.metaId,\n        meta: this.meta || [],\n        index: this.index,\n        createdAt: this.createdAt,\n        version: this.version\n      }\n\n      // Optional OTS fragments (can be large, so optional)\n      if (includeOtsFragments && this.otsFragment) {\n        serialized.otsFragment = this.otsFragment\n      }\n\n      return serialized\n    } catch (error) {\n      throw new Error(`Atom serialization failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Creates an Atom instance from JSON data (2025 JS best practices)\n   *\n   * Handles cross-SDK atom deserialization with robust error handling.\n   * Essential for reconstructing atoms from other SDK implementations.\n   *\n   * @param {string|Object} json - JSON string or object to deserialize\n   * @param {Object} options - Deserialization options\n   * @param {boolean} options.validateStructure - Validate required fields (default: true)\n   * @param {boolean} options.strictMode - Strict validation mode (default: false)\n   * @return {Atom} Reconstructed atom instance\n   * @throws {Error} If JSON is invalid or required fields are missing\n   */\n  static fromJSON (json, options = {}) {\n    const {\n      validateStructure = true,\n      strictMode = false\n    } = options\n\n    try {\n      // Parse JSON safely\n      const data = typeof json === 'string' ? JSON.parse(json) : json\n\n      // Validate required fields in strict mode\n      if (strictMode || validateStructure) {\n        const requiredFields = ['position', 'walletAddress', 'isotope', 'token']\n        for (const field of requiredFields) {\n          if (!data[field]) {\n            throw new Error(`Required field '${field}' is missing or empty`)\n          }\n        }\n      }\n\n      // Create atom instance with required fields\n      const atom = new Atom({\n        position: data.position,\n        walletAddress: data.walletAddress,\n        isotope: data.isotope,\n        token: data.token,\n        value: data.value,\n        batchId: data.batchId,\n        metaType: data.metaType,\n        metaId: data.metaId,\n        meta: data.meta,\n        index: data.index,\n        version: data.version\n      })\n\n      // Set additional properties that may not be in constructor\n      if (data.otsFragment) {\n        atom.otsFragment = data.otsFragment\n      }\n      if (data.createdAt) {\n        atom.createdAt = data.createdAt\n      }\n\n      return atom\n    } catch (error) {\n      throw new Error(`Atom deserialization failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Produces a hash of the atoms inside a molecule.\n   * Used to generate the molecularHash field for Molecules.\n   *\n   * @param {array} atoms\n   * @param {string} output\n   * @return {number[]|*}\n   */\n  static hashAtoms ({\n    atoms,\n    output = 'base17'\n  }) {\n    const molecularSponge = new JsSHA('SHAKE256', 'TEXT')\n    const atomList = Atom.sortAtoms(atoms)\n\n    if (atomList.length === 0) {\n      throw new AtomsMissingException()\n    }\n\n    atomList.map(atom => {\n      if (!(atom instanceof Atom)) {\n        throw new AtomsMissingException()\n      }\n      return atom\n    })\n\n    // Hashing each atom in the molecule to produce a molecular hash\n    if (atomList.every(atom => atom.version && Object.prototype.hasOwnProperty.call(versions, atom.version))) {\n      molecularSponge.update(JSON.stringify(atomList.map(atom => versions[atom.version].create(atom).view())))\n    } else {\n      const numberOfAtoms = String(atoms.length)\n      let hashableValues = []\n\n      for (const atom of atomList) {\n        // Add number of atoms (???)\n        hashableValues.push(numberOfAtoms)\n\n        // Add atom's properties\n        hashableValues = hashableValues.concat(atom.getHashableValues())\n      }\n\n      // Add hash values to the sponge\n      for (const hashableValue of hashableValues) {\n        molecularSponge.update(hashableValue)\n      }\n    }\n\n    // Return the hash in the requested format\n    switch (output) {\n      case 'hex': {\n        return molecularSponge.getHash('HEX', { outputLen: 256 })\n      }\n      case 'array': {\n        return molecularSponge.getHash('ARRAYBUFFER', { outputLen: 256 })\n      }\n      default: {\n        return charsetBaseConvert(molecularSponge.getHash('HEX', { outputLen: 256 }), 16, 17, '0123456789abcdef', '0123456789abcdefg').padStart(64, '0')\n      }\n    }\n  }\n\n  static jsonSerialization (key, value) {\n    if (!Atom.getUnclaimedProps().includes(key)) {\n      return value\n    }\n\n    return undefined\n  }\n\n  /**\n   * Sort the atoms in a Molecule\n   *\n   * @param {array} atoms\n   * @return {array}\n   */\n  static sortAtoms (atoms) {\n    const atomList = [...atoms]\n\n    // Sort based on atomic index\n    atomList.sort((first, second) => {\n      return first.index < second.index ? -1 : 1\n    })\n\n    return atomList\n  }\n\n  /**\n   * Get aggregated meta from stored normalized ones\n   */\n  aggregatedMeta () {\n    return Meta.aggregateMeta(this.meta)\n  }\n\n  /**\n   *\n   * @returns {*[]}\n   */\n  getHashableValues () {\n    const hashableValues = []\n    for (const property of Atom.getHashableProps()) {\n      const value = this[property]\n\n      // All nullable values are not hashed (only custom keys)\n      if (value === null && !['position', 'walletAddress'].includes(property)) {\n        continue\n      }\n\n      // Hashing individual meta keys and values\n      if (property === 'meta') {\n        for (const meta of value) {\n          if (typeof meta.value !== 'undefined' && meta.value !== null) {\n            hashableValues.push(String(meta.key))\n            hashableValues.push(String(meta.value))\n          }\n        }\n      } else {\n        // Default value\n        hashableValues.push(value === null ? '' : String(value))\n      }\n    }\n    return hashableValues\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n */\nimport { randomString } from './strings.js'\nimport JsSHA from 'jssha'\n\n/**\n * Generates a secret based on an optional seed\n *\n * @param seed\n * @param length\n * @return {string|*}\n */\nexport function generateSecret (seed = null, length = 2048) {\n  // console.info(`Crypto::generateSecret() - Computing new secret${ seed ? ' from existing seed' : '' }...`)\n  if (seed) {\n    const sponge = new JsSHA('SHAKE256', 'TEXT')\n    sponge.update(seed)\n    // outputLen is in BITS. For `length` hex chars = length/2 bytes = length*4 bits.\n    // (length=2048 → 8192 bits → 1024 bytes → 2048 hex chars, matching all SDKs.)\n    return sponge.getHash('HEX', { outputLen: length * 4 })\n  } else {\n    return randomString(length)\n  }\n}\n\n/**\n * Hashes the user secret to produce a bundle hash\n *\n * @param {string} secret\n * @param {string|null} source\n * @return {string}\n */\nexport function generateBundleHash (secret, source = null) {\n  const sponge = new JsSHA('SHAKE256', 'TEXT')\n  sponge.update(secret)\n  return sponge.getHash('HEX', { outputLen: 64 * 4 }) // 64 bytes = 512 bits\n}\n\n/**\n * SHAKE256 hash function\n *\n * @param {string} input - The input string to hash\n * @param {number} outputLength - The desired output length in bits\n * @return {string} The hex-encoded hash\n */\nexport function shake256 (input, outputLength) {\n  const sponge = new JsSHA('SHAKE256', 'TEXT')\n  sponge.update(input)\n  return sponge.getHash('HEX', { outputLen: outputLength })\n}\n\n/**\n * Returns a new batch ID for stackable tokens\n *\n * @param {string|null} molecularHash\n * @param {number|null} index\n *\n * @return {string}\n */\nexport function generateBatchId ({\n  molecularHash = null,\n  index = null\n}) {\n  if (molecularHash !== null && index !== null) {\n    return generateBundleHash(String(molecularHash) + String(index), 'generateBatchId')\n  }\n\n  return randomString(64)\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\n/**\n * AuthToken class\n */\nexport default class TokenUnit {\n  /**\n   *\n   * @param id\n   * @param name\n   * @param metas\n   */\n  constructor (id, name, metas) {\n    this.id = id\n    this.name = name\n    this.metas = metas || {}\n  }\n\n  /**\n   *\n   * @param data\n   * @returns {*}\n   */\n  static createFromGraphQL (data) {\n    let metas = data.metas || {}\n    if (metas.length) {\n      metas = JSON.parse(metas)\n      if (!metas) { // set an empty object instead of an array\n        metas = {}\n      }\n    }\n    return new TokenUnit(\n      data.id,\n      data.name,\n      metas\n    )\n  }\n\n  /**\n   *\n   * @param data\n   * @returns {TokenUnit}\n   */\n  static createFromDB (data) {\n    return new TokenUnit(\n      data[0],\n      data[1],\n      data.length > 2 ? data[2] : {}\n    )\n  }\n\n  /**\n   *\n   * @returns {*|null}\n   */\n  getFragmentZone () {\n    return this.metas.fragmentZone || null\n  }\n\n  /**\n   *\n   * @returns {*|null}\n   */\n  getFusedTokenUnits () {\n    return this.metas.fusedTokenUnits || null\n  }\n\n  /**\n   * @return array\n   */\n  toData () {\n    return [this.id, this.name, this.metas]\n  }\n\n  /**\n   *\n   * @returns {{metas: string, name: *, id: *}}\n   */\n  toGraphQLResponse () {\n    return {\n      id: this.id,\n      name: this.name,\n      metas: JSON.stringify(this.metas)\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when failing to retrieve shadow wallets\n */\nexport default class WalletCredentialException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Attempting to create a wallet with no credentials (secret or bundle hash)', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'WalletCredentialException'\n  }\n}\n","const U32_MASK64 = /* @__PURE__ */ (() => BigInt(2 ** 32 - 1))();\nconst _32n = /* @__PURE__ */ BigInt(32);\n// Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high\n// }` to match little-endian word order rather than the property names.\nfunction fromBig(n, le = false) {\n    if (le)\n        return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n    return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\n// Split bigint list into `[highWords, lowWords]` when `le=false`; with `le=true`, the first array\n// holds the low halves because `fromBig(...)` swaps the semantic meaning of `h` and `l`.\nfunction split(lst, le = false) {\n    const len = lst.length;\n    let Ah = new Uint32Array(len);\n    let Al = new Uint32Array(len);\n    for (let i = 0; i < len; i++) {\n        const { h, l } = fromBig(lst[i], le);\n        [Ah[i], Al[i]] = [h, l];\n    }\n    return [Ah, Al];\n}\n// Combine explicit `(high, low)` 32-bit halves into a bigint; `>>> 0` normalizes signed JS\n// bitwise results back to uint32 first, and little-endian callers must swap.\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// Split a JS number into u32 halves without a BigInt allocation. Exact only for integers\n// `0 <= n < 2**53`; callers use it on byte / bit counters, which JS length math caps far below\n// that (an ArrayBuffer cannot exceed 2**53 - 1 bytes).\nconst fromNumH = (n) => (n / 2 ** 32) | 0;\nconst fromNumL = (n) => n >>> 0;\n// Drop-in replacement for `view.setBigUint64(byteOffset, BigInt(n), isLE)` without the per-call\n// BigInt allocation. Same `n < 2**53` precondition as `fromNumH`/`fromNumL`.\nfunction setU64FromNum(view, byteOffset, n, isLE) {\n    const h = fromNumH(n);\n    const l = fromNumL(n);\n    view.setUint32(byteOffset, isLE ? l : h, isLE);\n    view.setUint32(byteOffset + 4, isLE ? h : l, isLE);\n}\n// High 32-bit half of a 64-bit logical right shift for `s` in `0..31`.\nconst shrSH = (h, _l, s) => h >>> s;\n// Low 32-bit half of a 64-bit logical right shift, valid for `s` in `1..31`.\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half.\nconst rotr32H = (_h, l) => l;\n// Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half.\nconst rotr32L = (h, _l) => h;\n// 64-bit left rotates (rotl*) are not defined here: sha3.ts, their only consumer, keeps\n// local copies so V8 inlines them into keccakP.\n// Add two split 64-bit words and return the split `{ h, l }` sum.\n// JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out\n// of the low sum and instead use division.\nfunction add(Ah, Al, Bh, Bl) {\n    const l = (Al >>> 0) + (Bl >>> 0);\n    return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\n// Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`.\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\n// High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`.\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 4-way addition; pass the raw result into `add4H(...)`.\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\n// High-word finalize step for 4-way addition; `low` must be the untruncated output of `add4L(...)`.\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 5-way addition; pass the raw result into `add5H(...)`.\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\n// High-word finalize step for 5-way addition; `low` must be the untruncated output of `add5L(...)`.\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, fromNumH, fromNumL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, setU64FromNum, shrSH, shrSL, split, toBig };\n","/**\n * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true.\n * @param a - value to test\n * @returns `true` when the value is a Uint8Array-compatible view.\n * @example\n * Check whether a value is a Uint8Array-compatible view.\n * ```ts\n * isBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function isBytes(a) {\n    // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases.\n    // The fallback still requires a real ArrayBuffer view, so plain\n    // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and\n    // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views.\n    return (a instanceof Uint8Array ||\n        (ArrayBuffer.isView(a) &&\n            a.constructor.name === 'Uint8Array' &&\n            'BYTES_PER_ELEMENT' in a &&\n            a.BYTES_PER_ELEMENT === 1));\n}\n// Shared error-message prefix builder. Only called on throw paths, so assert\n// success paths never pay for the string concatenation.\nconst atitle = (title) => (title ? `\"${title}\" ` : '');\n/**\n * Asserts something is a non-negative integer.\n * @param n - number to validate\n * @param title - label included in thrown errors\n * @returns The validated number.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a non-negative integer option.\n * ```ts\n * anumber(32, 'length');\n * ```\n */\nexport function anumber(n, title = '') {\n    if (typeof n !== 'number')\n        throw new TypeError(atitle(title) + 'expected number, got ' + typeof n);\n    if (!Number.isSafeInteger(n) || n < 0)\n        throw new RangeError(atitle(title) + 'expected integer >= 0, got ' + n);\n    return n;\n}\n/**\n * Asserts something is a boolean.\n * @param value - value to validate\n * @param title - label included in thrown errors\n * @returns The validated boolean.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a boolean option.\n * ```ts\n * abool(true, 'enableXOF');\n * ```\n */\nexport function abool(value, title = '') {\n    if (typeof value !== 'boolean')\n        throw new TypeError(atitle(title) + 'expected boolean, got type=' + typeof value);\n    return value;\n}\n/**\n * Asserts something is Uint8Array.\n * @param value - value to validate\n * @param length - optional exact length constraint\n * @param title - label included in thrown errors\n * @returns The validated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate that a value is a byte array.\n * ```ts\n * abytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function abytes(value, length, title = '') {\n    // Success path first: this runs at the start of every update() / digestInto(), and the\n    // common `abytes(data)` form must not pay for length handling it does not use.\n    if (isBytes(value) && (length === undefined || value.length === length))\n        return value;\n    // Error path: recompute freely to build the exact message.\n    if (length !== undefined)\n        anumber(length, 'length');\n    const bytes = isBytes(value);\n    const ofLen = length !== undefined ? ` of length ${length}` : '';\n    const got = bytes ? `length=${value.length}` : `type=${typeof value}`;\n    const message = atitle(title) + 'expected Uint8Array' + ofLen + ', got ' + got;\n    if (!bytes)\n        throw new TypeError(message);\n    throw new RangeError(message);\n}\n/**\n * Copies bytes into a fresh Uint8Array.\n * Buffer-style slices can alias the same backing store, so callers that need ownership should copy.\n * @param bytes - source bytes to clone\n * @returns Freshly allocated copy of `bytes`.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Clone a byte array before mutating it.\n * ```ts\n * const copy = copyBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function copyBytes(bytes) {\n    // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict\n    // because callers use it at byte-validation boundaries before mutating the detached copy.\n    return Uint8Array.from(abytes(bytes));\n}\n/**\n * Asserts something is a wrapped hash constructor.\n * @param h - hash constructor to validate\n * @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError}\n * @throws On invalid hash metadata ranges or values. {@link RangeError}\n * @throws If the hash metadata allows empty outputs or block sizes. {@link Error}\n * @example\n * Validate a callable hash wrapper.\n * ```ts\n * import { ahash } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * ahash(sha256);\n * ```\n */\nexport function ahash(h) {\n    if (typeof h !== 'function' || typeof h.create !== 'function')\n        throw new TypeError('expected hash wrapped by utils.createHasher');\n    anumber(h.outputLen);\n    anumber(h.blockLen);\n    // HMAC and KDF callers treat these as real byte lengths; allowing zero lets fake wrappers pass\n    // validation and can produce empty outputs instead of failing fast.\n    if (h.outputLen < 1 || h.blockLen < 1)\n        throw new Error('hash blockLen / outputLen must be >= 1');\n}\nconst aobject = (value, label) => {\n    if (value === null || typeof value !== 'object' || Array.isArray(value))\n        throw new TypeError((label === 'object' ? '' : `\"${label}\" `) + 'expected object, got type=' + typeof value);\n};\nconst aopts = (value, label) => {\n    aobject(value, label);\n    const proto = Object.getPrototypeOf(value);\n    if (proto !== Object.prototype && proto !== null)\n        throw new TypeError(`\"${label}\" expected plain object`);\n    // Object.assign() treats an own \"__proto__\" source key as a write to the target's legacy\n    // prototype setter. Reject it before merging so inherited option values cannot be injected.\n    if (Object.hasOwn(value, '__proto__'))\n        throw new TypeError(`\"${label}.__proto__\" is not allowed`);\n};\n/**\n * Asserts a hash instance has not been destroyed or finished.\n * @param instance - hash instance to validate\n * @param checkFinished - whether to reject finalized instances\n * @throws If the hash instance has already been destroyed or finalized. {@link Error}\n * @example\n * Validate that a hash instance is still usable.\n * ```ts\n * import { aexists } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aexists(hash);\n * ```\n */\nexport function aexists(instance, checkFinished = true) {\n    // Runs on every update()/digestInto(); the flags are library-owned booleans, so only their\n    // truthiness is checked - re-validating their type per call was pure hot-path overhead.\n    if (instance.destroyed)\n        throw new Error('hash was destroyed');\n    if (checkFinished && instance.finished)\n        throw new Error('digest() was already called');\n}\n/**\n * Asserts output is a sufficiently-sized byte array.\n * @param out - destination buffer\n * @param instance - hash instance providing output length\n * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a caller-provided digest buffer.\n * ```ts\n * import { aoutput } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aoutput(new Uint8Array(hash.outputLen), hash);\n * ```\n */\nexport function aoutput(out, instance) {\n    abytes(out, undefined, 'output');\n    // `outputLen` is a library-owned readonly number; the negated comparison keeps failing fast\n    // when it is missing/NaN (comparisons with undefined/NaN are false) without an anumber() call.\n    const min = instance.outputLen;\n    if (!(out.length >= min)) {\n        throw new RangeError('\"output\" expected length >= ' + min);\n    }\n}\n/**\n * Casts a typed array view to Uint8Array.\n * @param arr - source typed array\n * @returns Uint8Array view over the same buffer.\n * @example\n * Reinterpret a typed array as bytes.\n * ```ts\n * u8(new Uint32Array([1, 2]));\n * ```\n */\nexport function u8(arr) {\n    return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Casts a typed array view to Uint32Array.\n * `arr.byteOffset` must already be 4-byte aligned or the platform\n * Uint32Array constructor will throw.\n * @param arr - source typed array\n * @returns Uint32Array view over the same buffer.\n * @example\n * Reinterpret a byte array as 32-bit words.\n * ```ts\n * u32(new Uint8Array(8));\n * ```\n */\nexport function u32(arr) {\n    return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/**\n * Zeroizes typed arrays in place. Warning: JS provides no guarantees.\n * @param arrays - arrays to overwrite with zeros\n * @example\n * Zeroize sensitive buffers in place.\n * ```ts\n * clean(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function clean(...arrays) {\n    for (let i = 0; i < arrays.length; i++) {\n        arrays[i].fill(0);\n    }\n}\n/**\n * Creates a DataView for byte-level manipulation.\n * @param arr - source typed array\n * @returns DataView over the same buffer region.\n * @example\n * Create a DataView over an existing buffer.\n * ```ts\n * createView(new Uint8Array(4));\n * ```\n */\nexport function createView(arr) {\n    return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Rotate-right operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the right.\n * ```ts\n * rotr(0x12345678, 8);\n * ```\n */\nexport function rotr(word, shift) {\n    return (word << (32 - shift)) | (word >>> shift);\n}\n/**\n * Rotate-left operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the left.\n * ```ts\n * rotl(0x12345678, 8);\n * ```\n */\nexport function rotl(word, shift) {\n    return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n/** Whether the current platform is little-endian. */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n/**\n * Byte-swap operation for uint32 values.\n * @param word - source word\n * @returns Word with reversed byte order.\n * @example\n * Reverse the byte order of a 32-bit word.\n * ```ts\n * byteSwap(0x11223344);\n * ```\n */\nexport function byteSwap(word) {\n    return (((word << 24) & 0xff000000) |\n        ((word << 8) & 0xff0000) |\n        ((word >>> 8) & 0xff00) |\n        ((word >>> 24) & 0xff));\n}\n/**\n * Conditionally byte-swaps one 32-bit word on big-endian platforms.\n * @param n - source word\n * @returns Original or byte-swapped word depending on platform endianness.\n * @example\n * Normalize a 32-bit word for host endianness.\n * ```ts\n * swap8IfBE(0x11223344);\n * ```\n */\nexport const swap8IfBE = isLE\n    ? (n) => n\n    : (n) => byteSwap(n) >>> 0;\n/**\n * Byte-swaps every word of a Uint32Array in place.\n * @param arr - array to mutate\n * @returns The same array after mutation; callers pass live state arrays here.\n * @example\n * Reverse the byte order of every word in place.\n * ```ts\n * byteSwap32(new Uint32Array([0x11223344]));\n * ```\n */\nexport function byteSwap32(arr) {\n    for (let i = 0; i < arr.length; i++) {\n        arr[i] = byteSwap(arr[i]);\n    }\n    return arr;\n}\n/**\n * Conditionally byte-swaps a Uint32Array on big-endian platforms.\n * @param u - array to normalize for host endianness\n * @returns Original or byte-swapped array depending on platform endianness.\n *   On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`.\n * @example\n * Normalize a word array for host endianness.\n * ```ts\n * swap32IfBE(new Uint32Array([0x11223344]));\n * ```\n */\nexport const swap32IfBE = isLE\n    ? (u) => u\n    : byteSwap32;\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string.\n * Uses the built-in function when available and assumes it matches the tested\n * fallback semantics.\n * @param bytes - bytes to encode\n * @returns Lowercase hexadecimal string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Convert bytes to lowercase hexadecimal.\n * ```ts\n * bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123'\n * ```\n */\nexport function bytesToHex(bytes) {\n    abytes(bytes);\n    // @ts-ignore\n    if (hasHexBuiltin)\n        return bytes.toHex();\n    // pre-caching improves the speed 6x\n    let hex = '';\n    for (let i = 0; i < bytes.length; i++) {\n        hex += hexes[bytes[i]];\n    }\n    return hex;\n}\n// Strict ASCII nibble parser: non-ASCII hex lookalikes are rejected as undefined.\n// ASCII codes: '0'..'9' = 48..57, 'A'..'F' = 65..70, 'a'..'f' = 97..102.\n// prettier-ignore\nfunction asciiToBase16(ch) {\n    return ch >= 48 && ch <= 57 ? ch - 48 // '2' => 50-48\n        : ch >= 65 && ch <= 70 ? ch - (65 - 10) // 'B' => 66-(65-10)\n            : ch >= 97 && ch <= 102 ? ch - (97 - 10) // 'b' => 98-(97-10)\n                : undefined;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @param hex - hexadecimal string to decode\n * @returns Decoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Decode lowercase hexadecimal into bytes.\n * ```ts\n * hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n * ```\n */\nexport function hexToBytes(hex) {\n    if (typeof hex !== 'string')\n        throw new TypeError('hex string expected, got ' + typeof hex);\n    if (hasHexBuiltin) {\n        try {\n            return Uint8Array.fromHex(hex);\n        }\n        catch (error) {\n            if (error instanceof SyntaxError)\n                throw new RangeError(error.message);\n            throw error;\n        }\n    }\n    const hl = hex.length;\n    const al = hl / 2;\n    if (hl % 2)\n        throw new RangeError('hex string expected, got unpadded hex of length ' + hl);\n    const array = new Uint8Array(al);\n    for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n        const n1 = asciiToBase16(hex.charCodeAt(hi)); // parse first char, multiply it by 16\n        const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); // parse second char\n        if (n1 === undefined || n2 === undefined) {\n            const char = hex[hi] + hex[hi + 1];\n            throw new RangeError('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n        }\n        array[ai] = n1 * 16 + n2; // example: 'A9' => 10*16 + 9\n    }\n    return array;\n}\n/**\n * Yields to the host task scheduler so timers, I/O, and rendering can make progress.\n * Uses the Web Scheduling API when available or `setTimeout` as a cross-platform fallback.\n * Host-task yields are much slower than microtasks (roughly 1ms with the timer fallback), so\n * async loops should use `asyncTick >= 10` to amortize scheduling overhead to about 10% while\n * still allowing other event-loop work to proceed.\n * @param onReject - optional cleanup invoked only if the host yield fails\n * @example\n * Yield to the next scheduler tick.\n * ```ts\n * await nextTick();\n * ```\n */\nexport function nextTick(onReject) {\n    const host = globalThis;\n    if (typeof host.scheduler?.yield === 'function') {\n        const promise = host.scheduler.yield();\n        // Keep the original scheduler rejection; this handler exists only for cleanup.\n        if (onReject)\n            promise.catch(onReject);\n        return promise;\n    }\n    return new Promise((resolve) => host.setTimeout(resolve, 0));\n}\n/**\n * Returns control to the host event loop every `tick` milliseconds to avoid blocking long loops.\n * @param iters - number of loop iterations to run\n * @param tick - maximum time slice in milliseconds\n * @param cb - callback executed on each iteration\n * @param onReject - optional cleanup invoked only if a host yield fails\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Run a loop that periodically yields back to the event loop.\n * ```ts\n * await asyncLoop(2, 0, () => {});\n * ```\n */\nexport async function asyncLoop(iters, tick, cb, onReject) {\n    anumber(iters, 'iters');\n    anumber(tick, 'tick');\n    if (typeof cb !== 'function')\n        throw new TypeError('callback must be a function');\n    // Callback is synchronous by contract; asyncLoop only yields between sync work windows.\n    let ts = Date.now();\n    for (let i = 0; i < iters; i++) {\n        cb(i);\n        // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n        const diff = Date.now() - ts;\n        if (diff >= 0 && diff < tick)\n            continue;\n        await nextTick(onReject);\n        // Track only synchronous work time; scheduler delay after yielding is outside our budget.\n        ts = Date.now();\n    }\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * Built-in doesn't validate input to be string: we do the check.\n * Non-ASCII details are delegated to the platform `TextEncoder`.\n * @param str - string to encode\n * @returns UTF-8 encoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Encode a string as UTF-8 bytes.\n * ```ts\n * utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99])\n * ```\n */\nexport function utf8ToBytes(str) {\n    if (typeof str !== 'string')\n        throw new TypeError('string expected');\n    const encoded = new TextEncoder().encode(str);\n    try {\n        // Copy into the current realm for Firefox extension contexts. Callers that own the returned\n        // buffer can then wipe it independently of TextEncoder's temporary result.\n        return new Uint8Array(encoded); // https://bugzil.la/1681809\n    }\n    finally {\n        clean(encoded);\n    }\n}\n/**\n * Helper for KDFs: consumes Uint8Array or string.\n * String inputs are UTF-8 encoded; byte-array inputs stay aliased to the caller buffer.\n * @param data - user-provided KDF input\n * @param errorTitle - label included in thrown errors\n * @returns Byte representation of the input.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Normalize KDF input to bytes.\n * ```ts\n * kdfInputToBytes('password');\n * ```\n */\nexport function kdfInputToBytes(data, errorTitle = '') {\n    if (typeof data === 'string')\n        return utf8ToBytes(data);\n    return abytes(data, undefined, errorTitle);\n}\n/**\n * Copies several Uint8Arrays into one.\n * @param arrays - arrays to concatenate\n * @returns Concatenated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Concatenate multiple byte arrays.\n * ```ts\n * concatBytes(new Uint8Array([1]), new Uint8Array([2]));\n * ```\n */\nexport function concatBytes(...arrays) {\n    let sum = 0;\n    for (let i = 0; i < arrays.length; i++) {\n        const a = arrays[i];\n        abytes(a);\n        sum += a.length;\n    }\n    const res = new Uint8Array(sum);\n    for (let i = 0, pad = 0; i < arrays.length; i++) {\n        const a = arrays[i];\n        res.set(a, pad);\n        pad += a.length;\n    }\n    return res;\n}\n/**\n * Validates declared required and optional field types on a plain object.\n * This walks field schemas and formats detailed errors, so avoid it on hot paths; use direct\n * one-line guards such as `abytes()`, `abool()`, or `anumber()` instead.\n * @param object - object to validate\n * @param fields - map of required field names to expected types\n * @param optFields - map of optional field names to expected types\n * @param title - label included in thrown errors\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate required and optional option fields.\n * ```ts\n * validateObject({ N: 1024, dkLen: 32 }, { N: 'number' }, { dkLen: 'number' });\n * ```\n */\nexport const validateObject = (object, fields = {}, optFields = {}, title = 'object') => {\n    aobject(object, title);\n    aobject(fields, 'fields');\n    aobject(optFields, 'optFields');\n    function checkField(fieldName, expectedType, isOpt) {\n        const label = title === 'object' ? `param \"${String(fieldName)}\"` : `\"${title}.${String(fieldName)}\"`;\n        // Config fields must be explicit own properties. Optional inherited values are rejected too\n        // because callers keep reading the same options object after validation.\n        const val = object[fieldName];\n        // Runtime objects such as Field instances intentionally satisfy required method slots\n        // via their shared prototype.\n        if (!Object.hasOwn(object, fieldName) &&\n            (isOpt ? val !== undefined : expectedType !== 'function')) {\n            throw new TypeError(`${label} is invalid: expected own property`);\n        }\n        if (isOpt && val === undefined)\n            return;\n        const current = typeof val;\n        if (current !== expectedType || val === null)\n            throw new TypeError(`${label} is invalid: expected ${expectedType}, got ${current}`);\n    }\n    const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt));\n    iter(fields, false);\n    iter(optFields, true);\n};\n/**\n * Merges default options and passed options.\n * @param defaults - base option object\n * @param opts - user overrides\n * @param title - label included in thrown override errors\n * @returns Fresh merged option object with a null prototype.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Merge user overrides onto default options.\n * ```ts\n * checkOpts({ dkLen: 32 }, { asyncTick: 10 });\n * ```\n */\nexport function checkOpts(defaults, opts, title = 'opts') {\n    aopts(defaults, 'defaults');\n    if (opts !== undefined)\n        aopts(opts, title);\n    // Callers read optional fields directly, so omitted values must not fall through to ambient\n    // Object.prototype pollution (for example a forged `dkLen` changing SHAKE's default output).\n    const merged = Object.assign(Object.create(null), defaults, opts);\n    return merged;\n}\n/**\n * Creates a callable hash function from a stateful class constructor.\n * @param hashCons - hash constructor or factory\n * @param info - optional metadata such as DER OID\n * @returns Frozen callable hash wrapper with `.create()`.\n *   Wrapper construction eagerly calls `hashCons(undefined)` once to read\n *   `outputLen` / `blockLen`, so constructor side effects happen at module\n *   init time.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Wrap a stateful hash constructor into a callable helper.\n * ```ts\n * import { createHasher } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const wrapped = createHasher(sha256.create, { oid: sha256.oid });\n * wrapped(new Uint8Array([1]));\n * ```\n */\nexport function createHasher(hashCons, info = {}) {\n    if (typeof hashCons !== 'function')\n        throw new TypeError('\"hashCons\" expected function, got type=' + typeof hashCons);\n    info = checkOpts({}, info, 'info');\n    const hashC = (msg, opts) => hashCons(opts)\n        .update(msg)\n        .digest();\n    const tmp = hashCons(undefined);\n    hashC.outputLen = tmp.outputLen;\n    hashC.blockLen = tmp.blockLen;\n    hashC.canXOF = tmp.canXOF;\n    hashC.create = (opts) => hashCons(opts);\n    Object.assign(hashC, info);\n    return Object.freeze(hashC);\n}\n/**\n * Cryptographically secure PRNG backed by `crypto.getRandomValues`.\n * @param bytesLength - number of random bytes to generate\n * @returns Random bytes.\n * The platform `getRandomValues()` implementation still defines any\n * single-call length cap, and this helper rejects oversize requests\n * with a stable library `RangeError` instead of host-specific errors.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If the current runtime does not provide `crypto.getRandomValues`. {@link Error}\n * @example\n * Generate a fresh random key or nonce.\n * ```ts\n * const key = randomBytes(16);\n * ```\n */\nexport function randomBytes(bytesLength = 32) {\n    // Match the repo's other length-taking helpers instead of relying on Uint8Array coercion.\n    anumber(bytesLength, 'bytesLength');\n    const cr = typeof globalThis === 'object' ? globalThis.crypto : null;\n    if (typeof cr?.getRandomValues !== 'function')\n        throw new Error('crypto.getRandomValues must be defined');\n    // Web Cryptography API Level 2 §10.1.1:\n    // if `byteLength > 65536`, throw `QuotaExceededError`.\n    // Keep the guard explicit so callers can see the quota in code\n    // instead of discovering it by reading the spec or host errors.\n    // This wrapper surfaces the same quota as a stable library RangeError.\n    if (bytesLength > 65536)\n        throw new RangeError(`\"bytesLength\" expected <= 65536, got ${bytesLength}`);\n    return cr.getRandomValues(new Uint8Array(bytesLength));\n}\n/**\n * Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`.\n * @param suffix - final OID byte for the selected hash.\n *   The helper accepts any byte even though only the documented NIST hash\n *   suffixes are meaningful downstream.\n * @returns Object containing the DER-encoded OID.\n * @example\n * Build OID metadata for a NIST hash.\n * ```ts\n * oidNist(0x01);\n * ```\n */\nexport const oidNist = (suffix) => ({\n    // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet.\n    // Larger suffix values would need base-128 OID encoding and a different length byte.\n    oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),\n});\n","/**\n * SHA3 (keccak) hash function, based on a new \"Sponge function\" design.\n * Different from older hashes, the internal state is bigger than output size.\n *\n * Check out\n * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf | FIPS-202},\n * {@link https://keccak.team/keccak.html | Website}, and\n * {@link https://crypto.stackexchange.com/q/15727 | the differences between\n * SHA-3 and Keccak}.\n *\n * Check out `sha3-addons` module for cSHAKE, k12, and others.\n * @module\n */\nimport { split } from \"./_u64.js\";\n// prettier-ignore\nimport { abool, abytes, aexists, anumber, aoutput, checkOpts, clean, createHasher, oidNist, swap32IfBE, u32 } from \"./utils.js\";\n// No __PURE__ annotations in sha3 header:\n// EVERYTHING is in fact used on every export.\n// Various per round constants calculations\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst _7n = BigInt(7);\nconst _256n = BigInt(256);\n// FIPS 202 Algorithm 5 rc(): when the outgoing bit is 1, the 8-bit LFSR xors\n// taps 0, 4, 5, and 6, which compresses to the feedback mask `0x71`.\nconst _0x71n = BigInt(0x71);\nconst SHA3_PI = [];\nconst SHA3_ROTL = [];\nconst _SHA3_IOTA = []; // no pure annotation: var is always used\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n    // Pi\n    [x, y] = [y, (2 * x + 3 * y) % 5];\n    SHA3_PI.push(2 * (5 * y + x));\n    // Rotational\n    SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n    // Iota\n    let t = _0n;\n    for (let j = 0; j < 7; j++) {\n        R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n        if (R & _2n)\n            t ^= _1n << ((_1n << BigInt(j)) - _1n);\n    }\n    _SHA3_IOTA.push(t);\n}\nconst IOTAS = split(_SHA3_IOTA, true);\n// `split(..., true)` keeps the local little-endian lane-word layout used by\n// `state32`, so these `H` / `L` tables follow the file's first-word /\n// second-word lane slots rather than `_u64.ts`'s usual high/low naming.\nconst SHA3_IOTA_H = IOTAS[0];\nconst SHA3_IOTA_L = IOTAS[1];\n// 64-bit left rotates as u32 pairs. Inlined here (not imported from _u64) so V8 can\n// inline them into keccakP — the import path costs ~24% on sha3_256. SHA3 is the only\n// consumer of left-rotates; other hashes use right-rotates from _u64.\n// Valid for s in 1..31 (SH/SL) and 33..63 (BH/BL); keccak never rotates by 0/32/64.\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Reused Theta scratch buffer (column parities), same pattern as SHA256_W in sha2.\n// keccakP never calls user code, so the shared buffer cannot be observed mid-permutation.\nconst B = new Uint32Array(5 * 2);\n/**\n * `keccakf1600` internal permutation, additionally allows adjusting the round count.\n * @param s - 5x5 Keccak state encoded as 25 lanes split into 50 uint32 words\n *   in this file's local little-endian lane-word order\n * @param rounds - number of rounds to execute\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If `rounds` is outside the supported `1..24` range. {@link Error}\n * @example\n * Permute a Keccak state with the default 24 rounds.\n * ```ts\n * keccakP(new Uint32Array(50));\n * ```\n */\nexport function keccakP(s, rounds = 24) {\n    if (!(s instanceof Uint32Array))\n        throw new TypeError('\"s\" expected Uint32Array(50), got type=' + typeof s);\n    if (s.length !== 50)\n        throw new RangeError('\"s\" expected Uint32Array(50), got length=' + s.length);\n    anumber(rounds, 'rounds');\n    // This implementation precomputes only the standard Keccak-f[1600] 24-round Iota table.\n    if (rounds < 1 || rounds > 24)\n        throw new Error('\"rounds\" expected integer 1..24');\n    // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n    for (let round = 24 - rounds; round < 24; round++) {\n        // Theta θ\n        for (let x = 0; x < 10; x++)\n            B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n        for (let x = 0; x < 10; x += 2) {\n            const idx1 = (x + 8) % 10;\n            const idx0 = (x + 2) % 10;\n            const B0 = B[idx0];\n            const B1 = B[idx0 + 1];\n            const Th = rotlH(B0, B1, 1) ^ B[idx1];\n            const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n            for (let y = 0; y < 50; y += 10) {\n                s[x + y] ^= Th;\n                s[x + y + 1] ^= Tl;\n            }\n        }\n        // Rho (ρ) and Pi (π)\n        let curH = s[2];\n        let curL = s[3];\n        for (let t = 0; t < 24; t++) {\n            const shift = SHA3_ROTL[t];\n            const Th = rotlH(curH, curL, shift);\n            const Tl = rotlL(curH, curL, shift);\n            const PI = SHA3_PI[t];\n            curH = s[PI];\n            curL = s[PI + 1];\n            s[PI] = Th;\n            s[PI + 1] = Tl;\n        }\n        // Chi (χ)\n        // Same as:\n        // for (let x = 0; x < 10; x++) B[x] = s[y + x];\n        // for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n        for (let y = 0; y < 50; y += 10) {\n            const b0 = s[y], b1 = s[y + 1], b2 = s[y + 2], b3 = s[y + 3];\n            s[y] ^= ~s[y + 2] & s[y + 4];\n            s[y + 1] ^= ~s[y + 3] & s[y + 5];\n            s[y + 2] ^= ~s[y + 4] & s[y + 6];\n            s[y + 3] ^= ~s[y + 5] & s[y + 7];\n            s[y + 4] ^= ~s[y + 6] & s[y + 8];\n            s[y + 5] ^= ~s[y + 7] & s[y + 9];\n            s[y + 6] ^= ~s[y + 8] & b0;\n            s[y + 7] ^= ~s[y + 9] & b1;\n            s[y + 8] ^= ~b0 & b2;\n            s[y + 9] ^= ~b1 & b3;\n        }\n        // Iota (ι)\n        s[0] ^= SHA3_IOTA_H[round];\n        s[1] ^= SHA3_IOTA_L[round];\n    }\n    clean(B);\n}\n/**\n * Keccak sponge function.\n * @param blockLen - absorb/squeeze rate in bytes\n * @param suffix - domain separation suffix byte\n * @param outputLen - default digest length in bytes. This base sponge only\n *   requires a non-negative integer; wrappers that need positive output\n *   lengths must enforce that themselves.\n * @param enableXOF - whether XOF output is allowed\n * @param rounds - number of Keccak-f rounds\n * @example\n * Build a sponge state, absorb bytes, then finalize a digest.\n * ```ts\n * const hash = new Keccak(136, 0x06, 32);\n * hash.update(new Uint8Array([1, 2, 3]));\n * hash.digest();\n * ```\n */\nexport class Keccak {\n    state;\n    pos = 0;\n    posOut = 0;\n    finished = false;\n    state32;\n    destroyed = false;\n    blockLen;\n    suffix;\n    outputLen;\n    canXOF;\n    enableXOF = false;\n    rounds;\n    // NOTE: we accept arguments in bytes instead of bits here.\n    constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n        anumber(blockLen, 'blockLen');\n        anumber(suffix, 'suffix');\n        anumber(rounds, 'rounds');\n        abool(enableXOF, 'enableXOF');\n        this.blockLen = blockLen;\n        this.suffix = suffix;\n        this.outputLen = outputLen;\n        this.enableXOF = enableXOF;\n        this.canXOF = enableXOF;\n        this.rounds = rounds;\n        // Can be passed from user as dkLen\n        anumber(outputLen, 'outputLen');\n        // Only keccak-f1600 is supported: 1600 bits (5x5 matrix of 64bit) === 200 bytes of state.\n        if (!(0 < blockLen && blockLen < 200))\n            throw new Error('\"blockLen\" must be 1..199');\n        this.state = new Uint8Array(200);\n        this.state32 = u32(this.state);\n    }\n    clone() {\n        return this._cloneInto();\n    }\n    keccak() {\n        swap32IfBE(this.state32);\n        keccakP(this.state32, this.rounds);\n        swap32IfBE(this.state32);\n        this.posOut = 0;\n        this.pos = 0;\n    }\n    update(data) {\n        aexists(this);\n        abytes(data);\n        const { blockLen, state, state32 } = this;\n        const len = data.length;\n        // Absorb full blocks with u32 XORs when both sides are 4-byte aligned.\n        // XOR of same-position words equals XOR of same-position bytes, so this is endianness-safe.\n        const canUseU32 = blockLen % 4 === 0 && data.byteOffset % 4 === 0;\n        const blockLen32 = blockLen / 4;\n        const data32 = canUseU32 && len >= blockLen ? u32(data) : undefined;\n        for (let pos = 0; pos < len;) {\n            if (data32 !== undefined && this.pos === 0 && pos % 4 === 0 && len - pos >= blockLen) {\n                for (let i = 0, o = pos / 4; i < blockLen32; i++)\n                    state32[i] ^= data32[o + i];\n                pos += blockLen;\n                // Subclasses (_KeccakPRG) read `this.pos` inside their `keccak()` override,\n                // so it must reflect the fully-absorbed block before the permutation fires.\n                this.pos = blockLen;\n                this.keccak();\n                continue;\n            }\n            const take = Math.min(blockLen - this.pos, len - pos);\n            for (let i = 0; i < take; i++)\n                state[this.pos++] ^= data[pos++];\n            if (this.pos === blockLen)\n                this.keccak();\n        }\n        return this;\n    }\n    finish() {\n        if (this.finished)\n            return;\n        this.finished = true;\n        const { state, suffix, pos, blockLen } = this;\n        // FIPS 202 appends the SHA3/SHAKE domain-separation suffix before pad10*1.\n        // These byte values already include the first padding bit, while the\n        // final `0x80` below supplies the closing `1` bit in the last rate byte.\n        state[pos] ^= suffix;\n        // If that combined suffix lands in the last rate byte and already sets\n        // bit 7, absorb it first so the final pad10*1 bit can be xored into a\n        // fresh block.\n        if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n            this.keccak();\n        state[blockLen - 1] ^= 0x80;\n        this.keccak();\n    }\n    writeInto(out) {\n        aexists(this, false);\n        abytes(out);\n        this.finish();\n        const bufferOut = this.state;\n        const { blockLen } = this;\n        for (let pos = 0, len = out.length; pos < len;) {\n            if (this.posOut >= blockLen)\n                this.keccak();\n            const take = Math.min(blockLen - this.posOut, len - pos);\n            out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n            this.posOut += take;\n            pos += take;\n        }\n        return out;\n    }\n    xofInto(out) {\n        // Plain SHA3/Keccak usage with XOF is probably a mistake, but this base\n        // class is also reused by SHAKE/cSHAKE/KMAC/TupleHash/ParallelHash/\n        // TurboSHAKE/KangarooTwelve wrappers that intentionally enable XOF.\n        if (!this.enableXOF)\n            throw new Error('XOF is not enabled');\n        return this.writeInto(out);\n    }\n    xof(bytes) {\n        anumber(bytes);\n        return this.xofInto(new Uint8Array(bytes));\n    }\n    digestInto(out) {\n        aoutput(out, this);\n        if (this.finished)\n            throw new Error('digest() was already called');\n        // `aoutput(...)` allows oversized buffers; digestInto() must fill only the advertised digest.\n        this.writeInto(out.length === this.outputLen ? out : out.subarray(0, this.outputLen));\n        this.destroy();\n    }\n    digest() {\n        const out = new Uint8Array(this.outputLen);\n        this.digestInto(out);\n        return out;\n    }\n    destroy() {\n        this.destroyed = true;\n        clean(this.state);\n    }\n    _cloneInto(to) {\n        const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n        to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);\n        // Reused destinations can come from a different rate/capacity variant, so clone must rewrite\n        // the sponge geometry as well as the state words.\n        to.blockLen = blockLen;\n        to.state32.set(this.state32);\n        // Sponge padding and XOF output are positional, so both offsets are part of the clone state.\n        to.pos = this.pos;\n        to.posOut = this.posOut;\n        to.finished = this.finished;\n        to.rounds = rounds;\n        // Suffix can change in cSHAKE\n        to.suffix = suffix;\n        to.outputLen = outputLen;\n        to.enableXOF = enableXOF;\n        // Clones must preserve the public capability bit too; `_KMAC` reuses this path and deep clone\n        // tests compare instance fields directly, so leaving `canXOF` behind makes the clone lie.\n        to.canXOF = this.canXOF;\n        to.destroyed = this.destroyed;\n        return to;\n    }\n}\nconst genKeccak = (suffix, blockLen, outputLen, info = {}) => createHasher(() => new Keccak(blockLen, suffix, outputLen), info);\n/**\n * SHA3-224 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA3-224.\n * ```ts\n * sha3_224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha3_224 = /* @__PURE__ */ genKeccak(0x06, 144, 28, \n/* @__PURE__ */ oidNist(0x07));\n/**\n * SHA3-256 hash function. Different from keccak-256.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA3-256.\n * ```ts\n * sha3_256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32, \n/* @__PURE__ */ oidNist(0x08));\n/**\n * SHA3-384 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA3-384.\n * ```ts\n * sha3_384(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48, \n/* @__PURE__ */ oidNist(0x09));\n/**\n * SHA3-512 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA3-512.\n * ```ts\n * sha3_512(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64, \n/* @__PURE__ */ oidNist(0x0a));\n/**\n * Keccak-224 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with Keccak-224.\n * ```ts\n * keccak_224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const keccak_224 = /* @__PURE__ */ genKeccak(0x01, 144, 28);\n/**\n * Keccak-256 hash function. Different from SHA3-256.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with Keccak-256.\n * ```ts\n * keccak_256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const keccak_256 = /* @__PURE__ */ genKeccak(0x01, 136, 32);\n/**\n * Keccak-384 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with Keccak-384.\n * ```ts\n * keccak_384(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const keccak_384 = /* @__PURE__ */ genKeccak(0x01, 104, 48);\n/**\n * Keccak-512 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with Keccak-512.\n * ```ts\n * keccak_512(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const keccak_512 = /* @__PURE__ */ genKeccak(0x01, 72, 64);\nconst genShake = (suffix, blockLen, outputLen, info = {}) => createHasher((opts = {}) => {\n    opts = checkOpts({}, opts);\n    return new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true);\n}, info);\n/**\n * SHAKE128 XOF with 128-bit security and a 16-byte default output.\n * @param msg - message bytes to hash\n * @param opts - Optional output-length override. See {@link ShakeOpts}.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHAKE128.\n * ```ts\n * shake128(new Uint8Array([97, 98, 99]), { dkLen: 32 });\n * ```\n */\nexport const shake128 = \n/* @__PURE__ */\ngenShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b));\n/**\n * SHAKE256 XOF with 256-bit security and a 32-byte default output.\n * @param msg - message bytes to hash\n * @param opts - Optional output-length override. See {@link ShakeOpts}.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHAKE256.\n * ```ts\n * shake256(new Uint8Array([97, 98, 99]), { dkLen: 64 });\n * ```\n */\nexport const shake256 = \n/* @__PURE__ */\ngenShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c));\n/**\n * SHAKE128 XOF with 256-bit output (NIST version).\n * @param msg - message bytes to hash\n * @param opts - Optional output-length override. See {@link ShakeOpts}.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHAKE128 using a 32-byte default output.\n * ```ts\n * shake128_32(new Uint8Array([97, 98, 99]), { dkLen: 32 });\n * ```\n */\nexport const shake128_32 = \n/* @__PURE__ */\ngenShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b));\n/**\n * SHAKE256 XOF with 512-bit output (NIST version).\n * @param msg - message bytes to hash\n * @param opts - Optional output-length override. See {@link ShakeOpts}.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHAKE256 using a 64-byte default output.\n * ```ts\n * shake256_64(new Uint8Array([97, 98, 99]), { dkLen: 64 });\n * ```\n */\nexport const shake256_64 = \n/* @__PURE__ */\ngenShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c));\n","/**\n * Hex, bytes and number utilities.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { abytes as abytes_, anumber as anumber_, bytesToHex as bytesToHex_, concatBytes as concatBytes_, hexToBytes as hexToBytes_, isBytes as isBytes_, randomBytes as randomBytes_, } from '@noble/hashes/utils.js';\n/**\n * Validates that a value is an array, optionally validating each element.\n * @param item - Value to validate.\n * @param title - Label included in thrown errors.\n * @param inner - Optional per-element validator, called with the element and its label.\n * @returns The validated array.\n * @example\n * Validate an array of points before batch processing.\n *\n * ```ts\n * aarray([1n, 2n], 'scalars');\n * ```\n */\nexport function aarray(item, title, inner = () => { }) {\n    if (!Array.isArray(item))\n        throw new TypeError(`\"${title}\" expected array, got type=${typeof item}`);\n    for (let i = 0; i < item.length; i++)\n        inner(item[i], `${title}[${i}]`);\n    return item;\n}\n/**\n * Validates that a value is a byte array.\n * @param value - Value to validate.\n * @param length - Optional exact byte length.\n * @param title - Optional field name.\n * @returns Original byte array.\n * @example\n * Reject non-byte input before passing data into curve code.\n *\n * ```ts\n * abytes(new Uint8Array(1));\n * ```\n */\nexport const abytes = (value, length, title) => abytes_(value, length, title);\n/**\n * Validates that a value is a non-negative safe integer.\n * @param n - Value to validate.\n * @param title - Optional field name.\n * @returns The validated number.\n * @example\n * Validate a numeric length before allocating buffers.\n *\n * ```ts\n * anumber(1);\n * ```\n */\nexport const anumber = anumber_;\n/**\n * Asserts something is a string.\n * @param value - Value to validate.\n * @param title - Label included in thrown errors.\n * @returns The validated string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a label string.\n *\n * ```ts\n * astring('example', 'label');\n * ```\n */\nexport function astring(value, title = '') {\n    if (typeof value !== 'string') {\n        const prefix = title && `\"${title}\" `;\n        throw new TypeError(prefix + 'expected string, got type=' + typeof value);\n    }\n    return value;\n}\n/**\n * Asserts something is a plain object-ish value, not null or array.\n * @param value - Value to validate.\n * @param title - Label included in thrown errors.\n * @returns The validated object.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate an options object before checking fields.\n *\n * ```ts\n * aobject({ flag: true });\n * ```\n */\nexport function aobject(value, title = 'object') {\n    if (value === null || typeof value !== 'object' || Array.isArray(value))\n        throw new TypeError(title === 'object'\n            ? 'expected valid options object'\n            : `\"${title}\" expected object, got type=${typeof value}`);\n    return value;\n}\n/**\n * Asserts something is a function.\n * @param value - Value to validate.\n * @param title - Label included in thrown errors.\n * @returns The validated function.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a required method before calling it.\n *\n * ```ts\n * afunction(() => true, 'predicate');\n * ```\n */\nexport function afunction(value, title) {\n    if (typeof value !== 'function')\n        throw new TypeError(`\"${title}\" is invalid: expected function, got ${typeof value}`);\n    return value;\n}\n/**\n * Encodes bytes as lowercase hex.\n * @param bytes - Bytes to encode.\n * @returns Lowercase hex string.\n * @example\n * Serialize bytes as hex for logging or fixtures.\n *\n * ```ts\n * bytesToHex(Uint8Array.of(1, 2, 3));\n * ```\n */\nexport const bytesToHex = bytesToHex_;\n/**\n * Concatenates byte arrays.\n * @param arrays - Byte arrays to join.\n * @returns Concatenated bytes.\n * @example\n * Join domain-separated chunks into one buffer.\n *\n * ```ts\n * concatBytes(Uint8Array.of(1), Uint8Array.of(2));\n * ```\n */\nexport const concatBytes = (...arrays) => concatBytes_(...arrays);\n/**\n * Decodes lowercase or uppercase hex into bytes.\n * @param hex - Hex string to decode.\n * @returns Decoded bytes.\n * @example\n * Parse fixture hex into bytes before hashing.\n *\n * ```ts\n * hexToBytes('0102');\n * ```\n */\nexport const hexToBytes = (hex) => hexToBytes_(hex);\n/**\n * Checks whether a value is a Uint8Array.\n * @param a - Value to inspect.\n * @returns `true` when `a` is a Uint8Array.\n * @example\n * Branch on byte input before decoding it.\n *\n * ```ts\n * isBytes(new Uint8Array(1));\n * ```\n */\nexport const isBytes = isBytes_;\n/**\n * Reads random bytes from the platform CSPRNG.\n * @param bytesLength - Number of random bytes to read.\n * @returns Fresh random bytes.\n * @example\n * Generate a random seed for a keypair.\n *\n * ```ts\n * randomBytes(2);\n * ```\n */\nexport const randomBytes = (bytesLength) => randomBytes_(bytesLength);\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\n// Shared error-message prefix builder. Only called on throw paths, so assert\n// success paths never pay for the string concatenation.\nconst atitle = (title) => (title ? `\"${title}\" ` : '');\n/**\n * Validates that a flag is boolean.\n * @param value - Value to validate.\n * @param title - Optional field name.\n * @returns Original value.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Reject non-boolean option flags early.\n *\n * ```ts\n * abool(true);\n * ```\n */\nexport function abool(value, title = '') {\n    if (typeof value !== 'boolean')\n        throw new TypeError(atitle(title) + 'expected boolean, got type=' + typeof value);\n    return value;\n}\n/**\n * Validates that a value is a non-negative bigint or safe integer.\n * @param n - Value to validate.\n * @returns The same validated value.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate one integer-like value before serializing it.\n *\n * ```ts\n * abignumber(1n);\n * ```\n */\nexport function abignumber(n) {\n    if (typeof n === 'bigint') {\n        if (!isPosBig(n))\n            throw new RangeError('positive bigint expected, got ' + n);\n    }\n    else\n        anumber(n);\n    return n;\n}\n/**\n * Validates that a value is a safe integer.\n * @param value - Integer to validate.\n * @param title - Optional field name.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a window size before scalar arithmetic uses it.\n *\n * ```ts\n * asafenumber(1);\n * ```\n */\nexport function asafenumber(value, title = '') {\n    if (typeof value !== 'number') {\n        const prefix = title && `\"${title}\" `;\n        throw new TypeError(prefix + 'expected number, got type=' + typeof value);\n    }\n    if (!Number.isSafeInteger(value)) {\n        const prefix = title && `\"${title}\" `;\n        throw new RangeError(prefix + 'expected safe integer, got ' + value);\n    }\n}\n/**\n * Encodes a bigint into even-length big-endian hex.\n * The historical \"unpadded\" name only means \"no fixed-width field padding\"; odd-length hex still\n * gets one leading zero nibble so the result always represents whole bytes.\n * @param num - Number to encode.\n * @returns Big-endian hex string.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Encode a scalar into hex without a `0x` prefix.\n *\n * ```ts\n * numberToHexUnpadded(255n);\n * ```\n */\nexport function numberToHexUnpadded(num) {\n    const hex = abignumber(num).toString(16);\n    return hex.length & 1 ? '0' + hex : hex;\n}\n/**\n * Parses a big-endian hex string into bigint.\n * Accepts odd-length hex through the native `BigInt('0x' + hex)` parser and currently surfaces the\n * same native `SyntaxError` for malformed hex instead of wrapping it in a library-specific error.\n * @param hex - Hex string without `0x`.\n * @returns Parsed bigint value.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Parse a scalar from fixture hex.\n *\n * ```ts\n * hexToNumber('ff');\n * ```\n */\nexport function hexToNumber(hex) {\n    if (typeof hex !== 'string')\n        throw new TypeError('hex string expected, got ' + typeof hex);\n    return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian\n}\n// BE: Big Endian, LE: Little Endian\n/**\n * Parses big-endian bytes into bigint.\n * @param bytes - Bytes in big-endian order.\n * @returns Parsed bigint value.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Read a scalar encoded in network byte order.\n *\n * ```ts\n * bytesToNumberBE(Uint8Array.of(1, 0));\n * ```\n */\nexport function bytesToNumberBE(bytes) {\n    return hexToNumber(bytesToHex_(bytes));\n}\n/**\n * Parses little-endian bytes into bigint.\n * @param bytes - Bytes in little-endian order.\n * @returns Parsed bigint value.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Read a scalar encoded in little-endian form.\n *\n * ```ts\n * bytesToNumberLE(Uint8Array.of(1, 0));\n * ```\n */\nexport function bytesToNumberLE(bytes) {\n    return hexToNumber(bytesToHex_(copyBytes(abytes_(bytes)).reverse()));\n}\n/**\n * Encodes a bigint into fixed-length big-endian bytes.\n * @param n - Number to encode.\n * @param len - Output length in bytes. Must be greater than zero.\n * @returns Big-endian byte array.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If a documented runtime validation or state check fails. {@link Error}\n * @example\n * Serialize a scalar into a 32-byte field element.\n *\n * ```ts\n * numberToBytesBE(255n, 2);\n * ```\n */\nexport function numberToBytesBE(n, len) {\n    anumber_(len);\n    if (len === 0)\n        throw new Error('zero output length is invalid');\n    n = abignumber(n);\n    const expectedLen = len * 2;\n    const hex = n.toString(16);\n    // Detect overflow before hex parsing so oversized values don't leak the shared odd-hex error.\n    if (hex.length > expectedLen)\n        throw new RangeError('number is too large');\n    return hexToBytes_(hex.padStart(expectedLen, '0'));\n}\n/**\n * Encodes a bigint into fixed-length little-endian bytes.\n * @param n - Number to encode.\n * @param len - Output length in bytes.\n * @returns Little-endian byte array.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If a documented runtime validation or state check fails. {@link Error}\n * @example\n * Serialize a scalar for little-endian protocols.\n *\n * ```ts\n * numberToBytesLE(255n, 2);\n * ```\n */\nexport function numberToBytesLE(n, len) {\n    return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\n/**\n * Encodes a bigint into variable-length big-endian bytes.\n * @param n - Number to encode.\n * @returns Variable-length big-endian bytes.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Serialize a bigint without fixed-width padding.\n *\n * ```ts\n * numberToVarBytesBE(255n);\n * ```\n */\nexport function numberToVarBytesBE(n) {\n    return hexToBytes_(numberToHexUnpadded(abignumber(n)));\n}\n// Compares 2 u8a-s in kinda constant time\n/**\n * Compares two byte arrays in constant-ish time.\n * @param a - Left byte array.\n * @param b - Right byte array.\n * @returns `true` when bytes match.\n * @example\n * Compare two encoded points without early exit.\n *\n * ```ts\n * equalBytes(Uint8Array.of(1), Uint8Array.of(1));\n * ```\n */\nexport function equalBytes(a, b) {\n    a = abytes(a);\n    b = abytes(b);\n    if (a.length !== b.length)\n        return false;\n    let diff = 0;\n    for (let i = 0; i < a.length; i++)\n        diff |= a[i] ^ b[i];\n    return diff === 0;\n}\n/**\n * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer,\n * and Buffer#slice creates mutable copy. Never use Buffers!\n * @param bytes - Bytes to copy.\n * @returns Detached copy.\n * @example\n * Make an isolated copy before mutating serialized bytes.\n *\n * ```ts\n * copyBytes(Uint8Array.of(1, 2, 3));\n * ```\n */\nexport function copyBytes(bytes) {\n    // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict\n    // because callers use it at byte-validation boundaries before mutating the detached copy.\n    return Uint8Array.from(abytes(bytes));\n}\n/**\n * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols\n * Should be safe to use for things expected to be ASCII.\n * Returns exact same result as `TextEncoder` for ASCII or throws.\n * @param ascii - ASCII input text.\n * @returns Encoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Encode an ASCII domain-separation tag.\n *\n * ```ts\n * asciiToBytes('ABC');\n * ```\n */\nexport function asciiToBytes(ascii) {\n    if (typeof ascii !== 'string')\n        throw new TypeError('ascii string expected, got ' + typeof ascii);\n    return Uint8Array.from(ascii, (c, i) => {\n        const charCode = c.charCodeAt(0);\n        if (c.length !== 1 || charCode > 127) {\n            throw new RangeError(`string contains non-ASCII character \"${ascii[i]}\" with code ${charCode} at position ${i}`);\n        }\n        return charCode;\n    });\n}\n/**\n * Checks whether n is non-negative bigint. Historical name.\n * @param n - candidate value\n * @returns `true` when the value is bigint and 0 or larger\n * @example\n * Check a candidate scalar before range validation.\n *\n * ```ts\n * isPosBig(2n);\n * ```\n */\nexport function isPosBig(n) {\n    return typeof n === 'bigint' && _0n <= n;\n}\n/**\n * Checks whether a bigint lies inside a half-open range.\n * @param n - Candidate value.\n * @param min - Inclusive lower bound.\n * @param max - Exclusive upper bound.\n * @returns `true` when the value is inside the range.\n * @example\n * Check whether a candidate scalar fits the field order.\n *\n * ```ts\n * inRange(2n, 1n, 3n);\n * ```\n */\nexport function inRange(n, min, max) {\n    return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;\n}\n/**\n * Asserts `min <= n < max`. NOTE: upper bound is exclusive.\n * @param title - Value label for error messages.\n * @param n - Candidate value.\n * @param min - Inclusive lower bound.\n * @param max - Exclusive upper bound.\n * Wrong-type inputs are not separated from out-of-range values here: they still flow through the\n * shared `RangeError` path because this is only a throwing wrapper around `inRange(...)`.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Assert that a bigint stays within one half-open range.\n *\n * ```ts\n * aInRange('x', 2n, 1n, 256n);\n * ```\n */\nexport function aInRange(title, n, min, max) {\n    // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?\n    // consider P=256n, min=0n, max=P\n    // - a for min=0 would require -1:          `inRange('x', x, -1n, P)`\n    // - b would commonly require subtraction:  `inRange('x', x, 0n, P - 1n)`\n    // - our way is the cleanest:               `inRange('x', x, 0n, P)\n    if (!inRange(n, min, max))\n        throw new RangeError('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n);\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n * TODO: merge with nLength in modular\n * @param n - Value to inspect.\n * @returns Bit length.\n * @throws If the value is negative. {@link Error}\n * @example\n * Measure the bit length of a scalar before serialization.\n *\n * ```ts\n * bitLen(8n);\n * ```\n */\nexport function bitLen(n) {\n    // Size callers in this repo only use non-negative orders / scalars, so negative inputs are a\n    // contract bug and must not silently collapse to zero bits.\n    if (n < _0n)\n        throw new Error('expected non-negative bigint, got ' + n);\n    // Native radix conversion beats a shift loop at every size, and the loop is quadratic in bits.\n    return n === _0n ? 0 : n.toString(2).length;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n * @param n - Source value.\n * @param pos - Bit position. Negative positions are passed through to raw\n *   bigint shift semantics; because the mask is built as `1n << pos`,\n *   they currently collapse to `0n` and make the helper a no-op.\n * @returns Bit as bigint.\n * @example\n * Gets single bit at position.\n *\n * ```ts\n * bitGet(5n, 0);\n * ```\n */\nexport function bitGet(n, pos) {\n    if (typeof n !== 'bigint')\n        throw new TypeError('\"n\" expected bigint, got type=' + typeof n);\n    asafenumber(pos, 'pos');\n    return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n * @param n - Source value.\n * @param pos - Bit position. Negative positions are passed through to raw bigint shift semantics,\n *   so they currently behave like left shifts.\n * @param value - Whether the bit should be set.\n * @returns Updated bigint.\n * @example\n * Sets single bit at position.\n *\n * ```ts\n * bitSet(0n, 1, true);\n * ```\n */\nexport function bitSet(n, pos, value) {\n    if (typeof n !== 'bigint')\n        throw new TypeError('\"n\" expected bigint, got type=' + typeof n);\n    asafenumber(pos, 'pos');\n    abool(value, 'value');\n    const mask = _1n << BigInt(pos);\n    // Clearing needs AND-not here; OR with zero leaves an already-set bit untouched.\n    return value ? n | mask : n & ~mask;\n}\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n * @param n - Number of bits. Negative widths are currently passed through to raw bigint shift\n *   semantics and therefore produce `-1n`.\n * @returns Bitmask value.\n * @example\n * Calculate mask for N bits.\n *\n * ```ts\n * bitMask(4);\n * ```\n */\nexport const bitMask = (n) => {\n    asafenumber(n, 'n');\n    return (_1n << BigInt(n)) - _1n;\n};\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @param hashLen - Hash output size in bytes. Callers are expected to pass a positive length; `0`\n *   is not rejected here and would make the internal generate loop non-progressing.\n * @param qByteLen - Requested output size in bytes. Callers are expected to pass a positive length.\n * @param hmacFn - HMAC implementation.\n * @returns Function that will call DRBG until the predicate returns anything\n *   other than `undefined`.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Build a deterministic nonce generator for RFC6979-style signing.\n *\n * ```ts\n * import { createHmacDrbg } from '@noble/curves/utils.js';\n * import { hmac } from '@noble/hashes/hmac.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hmacFn = (key: Uint8Array, msg: Uint8Array) => hmac(sha256, key, msg);\n * const drbg = createHmacDrbg(32, 32, hmacFn);\n * const seed = new Uint8Array(32);\n * drbg(seed, (bytes) => bytes);\n * ```\n */\nexport function createHmacDrbg(hashLen, qByteLen, hmacFn) {\n    anumber_(hashLen, 'hashLen');\n    anumber_(qByteLen, 'qByteLen');\n    if (typeof hmacFn !== 'function')\n        throw new TypeError('hmacFn must be a function');\n    // creates Uint8Array\n    const u8n = (len) => new Uint8Array(len);\n    const NULL = Uint8Array.of();\n    const byte0 = Uint8Array.of(0x00);\n    const byte1 = Uint8Array.of(0x01);\n    const _maxDrbgIters = 1000;\n    // Step B, Step C: set hashLen to 8*ceil(hlen/8).\n    // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 signatures.\n    let v = u8n(hashLen);\n    // Steps B and C of RFC6979 3.2.\n    let k = u8n(hashLen);\n    let i = 0; // Iterations counter, will throw when over 1000\n    const reset = () => {\n        v.fill(1);\n        k.fill(0);\n        i = 0;\n    };\n    // hmac(k)(v, ...values)\n    const h = (...msgs) => hmacFn(k, concatBytes(v, ...msgs));\n    const reseed = (seed = NULL) => {\n        // HMAC-DRBG reseed() function. Steps D-G\n        k = h(byte0, seed); // k = hmac(k || v || 0x00 || seed)\n        v = h(); // v = hmac(k || v)\n        if (seed.length === 0)\n            return;\n        k = h(byte1, seed); // k = hmac(k || v || 0x01 || seed)\n        v = h(); // v = hmac(k || v)\n    };\n    const gen = () => {\n        // HMAC-DRBG generate() function\n        if (i++ >= _maxDrbgIters)\n            throw new Error('drbg: tried max amount of iterations');\n        let len = 0;\n        const out = [];\n        while (len < qByteLen) {\n            v = h();\n            const sl = v.slice();\n            out.push(sl);\n            len += v.length;\n        }\n        return concatBytes(...out);\n    };\n    const genUntil = (seed, pred) => {\n        reset();\n        reseed(seed); // Steps D-G\n        let res = undefined; // Step H: grind until the predicate accepts a candidate.\n        // Falsy values like 0 are valid outputs.\n        while ((res = pred(gen())) === undefined)\n            reseed();\n        reset();\n        return res;\n    };\n    return genUntil;\n}\n/**\n * Validates declared required and optional field types on a plain object.\n * Extra keys are intentionally ignored because many callers validate only the subset they use from\n * richer option bags or runtime objects.\n * This walks field schemas and formats detailed errors, so avoid it on hot paths; use direct\n * one-line guards such as `aobject()`, `afunction()`, `abool()`, or `asafenumber()` instead.\n * @param object - Object to validate.\n * @param fields - Required field types.\n * @param optFields - Optional field types.\n * @param title - Object label included in thrown errors.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Check user options before building a curve helper.\n *\n * ```ts\n * validateObject({ flag: true }, { flag: 'boolean' });\n * ```\n */\nexport function validateObject(object, fields = {}, optFields = {}, title = 'object') {\n    aobject(object, title);\n    aobject(fields, 'fields');\n    aobject(optFields, 'optFields');\n    function checkField(fieldName, expectedType, isOpt) {\n        const label = title === 'object' ? `param \"${String(fieldName)}\"` : `\"${title}.${String(fieldName)}\"`;\n        // Config fields must be explicit own properties. Optional inherited values are rejected too\n        // because callers keep reading the same options object after validation.\n        const val = object[fieldName];\n        // Runtime objects such as Field instances intentionally satisfy required method slots\n        // via their shared prototype.\n        if (!Object.hasOwn(object, fieldName) &&\n            (isOpt ? val !== undefined : expectedType !== 'function')) {\n            throw new TypeError(`${label} is invalid: expected own property`);\n        }\n        if (isOpt && val === undefined)\n            return;\n        const current = typeof val;\n        if (current !== expectedType || val === null)\n            throw new TypeError(`${label} is invalid: expected ${expectedType}, got ${current}`);\n    }\n    const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt));\n    iter(fields, false);\n    iter(optFields, true);\n}\n/**\n * Throws not implemented error.\n * @returns Never returns.\n * @throws If the unfinished code path is reached. {@link Error}\n * @example\n * Surface the placeholder error from an unfinished code path.\n *\n * ```ts\n * try {\n *   notImplemented();\n * } catch {}\n * ```\n */\nexport const notImplemented = () => {\n    throw new Error('not implemented');\n};\n","/**\n * Experimental implementation of NTT / FFT (Fast Fourier Transform) over finite fields.\n * API may change at any time. The code has not been audited. Feature requests are welcome.\n * @module\n */\nimport { aarray, validateObject } from \"../utils.js\";\nimport { validateField } from \"./modular.js\";\nfunction checkU32(n, title = 'n') {\n    // 0xff_ff_ff_ff\n    if (typeof n !== 'number')\n        throw new TypeError(`wrong u32 integer \"${title}\": expected number, got type=${typeof n}`);\n    if (!Number.isSafeInteger(n) || n < 0 || n > 0xffffffff)\n        throw new RangeError(`wrong u32 integer \"${title}\": expected 0..4294967295, got ${n}`);\n    return n;\n}\n/**\n * Checks if integer is in form of `1 << X`.\n * @param x - Integer to inspect.\n * @returns `true` when the value is a power of two.\n * @example\n * Validate that an FFT size is a power of two.\n *\n * ```ts\n * isPowerOfTwo(8);\n * ```\n */\nexport function isPowerOfTwo(x) {\n    checkU32(x, 'x');\n    return (x & (x - 1)) === 0 && x !== 0;\n}\n/**\n * @param n - Input value.\n * @returns Next power of two within the u32/array-length domain.\n * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error}\n * @example\n * Round an integer up to the FFT size it needs.\n *\n * ```ts\n * nextPowerOfTwo(9);\n * ```\n */\nexport function nextPowerOfTwo(n) {\n    checkU32(n);\n    if (n <= 1)\n        return 1;\n    // FFT sizes here are used as JS array lengths, so `2^32` is not a meaningful result:\n    // keep the fast u32 bit-twiddling path and fail explicitly instead of wrapping to 1.\n    if (n > 0x8000_0000)\n        throw new Error('nextPowerOfTwo overflow: result does not fit u32');\n    return (1 << (log2(n - 1) + 1)) >>> 0;\n}\n/**\n * @param n - Value to reverse.\n * @param bits - Number of bits to use.\n * @returns Bit-reversed integer.\n * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error}\n * @example\n * Reverse the low `bits` bits of one index.\n *\n * ```ts\n * reverseBits(3, 3);\n * ```\n */\nexport function reverseBits(n, bits) {\n    checkU32(n);\n    if (typeof bits !== 'number')\n        throw new TypeError('\"bits\" expected number, got type=' + typeof bits);\n    if (!Number.isSafeInteger(bits) || bits < 0 || bits > 32)\n        throw new Error(`expected integer 0 <= bits <= 32, got ${bits}`);\n    let reversed = 0;\n    for (let i = 0; i < bits; i++, n >>>= 1)\n        reversed = (reversed << 1) | (n & 1);\n    // JS bitwise ops are signed i32; cast back so 32-bit reversals stay in the unsigned u32 domain.\n    return reversed >>> 0;\n}\n/**\n * Similar to `bitLen(x)-1` but much faster for small integers, like indices.\n * @param n - Input value.\n * @returns Base-2 logarithm. For `n = 0`, the current implementation returns `-1`.\n * @example\n * Compute the radix-2 stage count for one transform size.\n *\n * ```ts\n * log2(8);\n * ```\n */\nexport function log2(n) {\n    checkU32(n);\n    return 31 - Math.clz32(n);\n}\n/**\n * Moves lowest bit to highest position, which at first step splits\n * array on even and odd indices, then it applied again to each part,\n * which is core of fft\n * @param values - Mutable coefficient array.\n * @returns Mutated input array.\n * @throws If the array length is not a positive power of two. {@link Error}\n * @example\n * Reorder coefficients into bit-reversed order in place.\n *\n * ```ts\n * const values = Uint8Array.from([0, 1, 2, 3]);\n * bitReversalInplace(values);\n * ```\n */\nexport function bitReversalInplace(values) {\n    if (!values ||\n        typeof values !== 'object' ||\n        typeof values.length !== 'number')\n        throw new TypeError('\"values\" expected array-like, got type=' + typeof values);\n    const n = values.length;\n    // Size-1 FFT is the identity, so bit-reversal must stay a no-op there instead of rejecting it.\n    if (!isPowerOfTwo(n))\n        throw new Error('expected positive power-of-two length, got ' + n);\n    const bits = log2(n);\n    for (let i = 0; i < n; i++) {\n        const j = reverseBits(i, bits);\n        if (i < j) {\n            const tmp = values[i];\n            values[i] = values[j];\n            values[j] = tmp;\n        }\n    }\n    return values;\n}\n/**\n * @param values - Input values.\n * @returns Reordered copy.\n * @throws If the array length is not a positive power of two. {@link Error}\n * @example\n * Return a reordered copy instead of mutating the input in place.\n *\n * ```ts\n * const reordered = bitReversalPermutation([0, 1, 2, 3]);\n * ```\n */\nexport function bitReversalPermutation(values) {\n    aarray(values, 'values');\n    return bitReversalInplace(values.slice());\n}\nconst _1n = /** @__PURE__ */ BigInt(1);\nfunction findGenerator(field) {\n    let G = BigInt(2);\n    for (; field.eql(field.pow(G, field.ORDER >> _1n), field.ONE); G++)\n        ;\n    return G;\n}\n/**\n * We limit roots up to 2**31, which is a lot: 2-billion polynomial should be rare.\n * @param field - Field implementation.\n * @param generator - Optional trusted non-quadratic-residue override for callers that already know the field.\n * @returns Roots-of-unity cache.\n * @example\n * Cache roots once, then ask for the omega table of one FFT size.\n *\n * ```ts\n * import { rootsOfUnity } from '@noble/curves/abstract/fft.js';\n * import { Field } from '@noble/curves/abstract/modular.js';\n * const roots = rootsOfUnity(Field(17n));\n * const omega = roots.omega(4);\n * ```\n */\nexport function rootsOfUnity(field, generator) {\n    validateField(field);\n    if (generator !== undefined && typeof generator !== 'bigint')\n        throw new TypeError('\"generator\" expected bigint, got type=' + typeof generator);\n    // Factor field.ORDER-1 as oddFactor * 2^powerOfTwo\n    let oddFactor = field.ORDER - _1n;\n    let powerOfTwo = 0;\n    for (; (oddFactor & _1n) !== _1n; powerOfTwo++, oddFactor >>= _1n)\n        ;\n    // Find non quadratic residue\n    let G = generator !== undefined ? BigInt(generator) : findGenerator(field);\n    // Powers of generator\n    const omegas = new Array(powerOfTwo + 1);\n    omegas[powerOfTwo] = field.pow(G, oddFactor);\n    for (let i = powerOfTwo; i > 0; i--)\n        omegas[i - 1] = field.sqr(omegas[i]);\n    // Compute all roots of unity for powers up to maxPower\n    const rootsCache = [];\n    const checkBits = (bits) => {\n        checkU32(bits, 'bits');\n        if (bits > 31 || bits > powerOfTwo)\n            throw new Error('rootsOfUnity: wrong bits ' + bits + ' powerOfTwo=' + powerOfTwo);\n        return bits;\n    };\n    const precomputeRoots = (maxPower) => {\n        checkBits(maxPower);\n        for (let power = maxPower; power >= 0; power--) {\n            if (rootsCache[power])\n                continue; // Skip if we've already computed roots for this power\n            const above = rootsCache[power + 1];\n            const rootsAtPower = [];\n            if (above) {\n                // ω_{2^p} = ω_{2^{p+1}}², so the smaller table is the even-index stride of the bigger\n                // one: only the largest requested power pays for the multiplication chain.\n                for (let j = 0; j < 2 ** power; j++)\n                    rootsAtPower.push(above[2 * j]);\n            }\n            else {\n                for (let j = 0, cur = field.ONE; j < 2 ** power; j++, cur = field.mul(cur, omegas[power]))\n                    rootsAtPower.push(cur);\n            }\n            rootsCache[power] = rootsAtPower;\n        }\n        return rootsCache[maxPower];\n    };\n    const brpCache = new Map();\n    const inverseCache = new Map();\n    // roots()/brp()/inverse() expose shared cached arrays by reference for speed; callers must treat them as read-only.\n    // NOTE: we use bits instead of power, because power = 2**bits,\n    // but power is not necessarily isPowerOfTwo(power)!\n    return {\n        info: { G, powerOfTwo, oddFactor },\n        roots: (bits) => {\n            const b = checkBits(bits);\n            return precomputeRoots(b);\n        },\n        brp(bits) {\n            const b = checkBits(bits);\n            if (brpCache.has(b))\n                return brpCache.get(b);\n            else {\n                const res = bitReversalPermutation(this.roots(b));\n                brpCache.set(b, res);\n                return res;\n            }\n        },\n        inverse(bits) {\n            const b = checkBits(bits);\n            if (inverseCache.has(b))\n                return inverseCache.get(b);\n            else {\n                // ωᴺ = 1, so inv(ωᵏ) = ωᴺ⁻ᵏ: the inverse table is the reversed roots table.\n                // Value-identical to field.invertBatch(roots), but skips its 3N muls + inversion.\n                const r = this.roots(b);\n                const res = [r[0]].concat(r.slice(1).reverse());\n                inverseCache.set(b, res);\n                return res;\n            }\n        },\n        omega: (bits) => omegas[checkBits(bits)],\n        clear: () => {\n            rootsCache.splice(0, rootsCache.length);\n            brpCache.clear();\n            inverseCache.clear();\n        },\n    };\n}\n/**\n * Constructs different flavors of FFT. radix2 implementation of low level mutating API. Flavors:\n *\n * - DIT (Decimation-in-Time): Bottom-Up (leaves to root), Cooley-Tukey\n * - DIF (Decimation-in-Frequency): Top-Down (root to leaves), Gentleman-Sande\n *\n * DIT takes brp input, returns natural output.\n * DIF takes natural input, returns brp output.\n *\n * The output is actually identical. Time / frequence distinction is not meaningful\n * for Polynomial multiplication in fields.\n * Which means if protocol supports/needs brp output/inputs, then we can skip this step.\n *\n * Cyclic NTT: Rq = Zq[x]/(x^n-1). butterfly_DIT+loop_DIT OR butterfly_DIF+loop_DIT, roots are omega\n * Negacyclic NTT: Rq = Zq[x]/(x^n+1). butterfly_DIT+loop_DIF, at least for mlkem / mldsa\n *\n * `invertButterflies` indexes roots by a per-butterfly-group counter (`grp`): forward\n * (`dit: false`) reads `roots[grp]` with grp = 1..; inverse (`dit: true`) reads `roots[N - grp]`\n * with grp restarting at 1. With `skipStages: 0` one table serves both directions (ωᴺ = 1 makes\n * the reversed walk self-inverse). With `skipStages > 0` the inverse walk starts at `N - 1`\n * instead of continuing where the skipped stages would have left off, so the caller must supply\n * a table shaped for that (ML-KEM: `ζ^BitRev7(i)` over all N=256 indices, whose aliased upper\n * half is exactly the FIPS 203 inverse walk).\n * @param F - Field operations.\n * @param coreOpts - FFT configuration. See {@link FFTCoreOpts}:\n *   - `N`: Transform size. Must be a power of two.\n *   - `roots`: Stage roots for the selected transform size.\n *   - `dit`: Whether to run the DIT variant instead of DIF.\n *   - `invertButterflies` (optional): Whether to invert butterfly placement.\n *   - `skipStages` (optional): Number of initial stages to skip.\n *   - `brp` (optional): Whether to apply bit-reversal permutation at the boundary.\n * @returns Low-level FFT loop.\n * @throws If the FFT options or cached roots are invalid for the requested size. {@link Error}\n * @example\n * Constructs different flavors of FFT.\n *\n * ```ts\n * import { FFTCore, rootsOfUnity } from '@noble/curves/abstract/fft.js';\n * import { Field } from '@noble/curves/abstract/modular.js';\n * const Fp = Field(17n);\n * const roots = rootsOfUnity(Fp).roots(2);\n * const loop = FFTCore(Fp, { N: 4, roots, dit: true });\n * const values = loop([1n, 2n, 3n, 4n]);\n * ```\n */\nexport const FFTCore = (F, coreOpts) => {\n    validateObject(coreOpts, { N: 'number', roots: 'object', dit: 'boolean' }, { invertButterflies: 'boolean', skipStages: 'number', brp: 'boolean' }, 'coreOpts');\n    const { N, roots, dit, invertButterflies = false, skipStages = 0, brp = true } = coreOpts;\n    checkU32(N, 'coreOpts.N');\n    const bits = log2(N);\n    if (!isPowerOfTwo(N))\n        throw new Error('FFT: Polynomial size should be power of two');\n    checkU32(skipStages, 'coreOpts.skipStages');\n    const maxSkipStages = bits === 0 ? 0 : bits - 1;\n    // Skipping every stage leaves only boundary layout changes, not a valid FFT loop shape.\n    if (skipStages > maxSkipStages)\n        throw new Error(`FFT: wrong skipStages: expected 0 <= skipStages <= ${maxSkipStages}`);\n    // Wrong-sized root tables can stay in-bounds for some loop shapes and silently compute nonsense.\n    if (roots.length !== N)\n        throw new Error(`FFT: wrong roots length: expected ${N}, got ${roots.length}`);\n    const isDit = dit !== invertButterflies;\n    return (values) => {\n        if (values.length !== N)\n            throw new Error('FFT: wrong Polynomial length');\n        if (dit && brp)\n            bitReversalInplace(values);\n        for (let i = 0, g = 1; i < bits - skipStages; i++) {\n            // For each stage s (sub-FFT length m = 2^s)\n            const s = dit ? i + 1 + skipStages : bits - i;\n            const m = 1 << s;\n            const m2 = m >> 1;\n            const stride = N >> s;\n            // Loop over each subarray of length m\n            for (let k = 0; k < N; k += m) {\n                // Loop over each butterfly within the subarray\n                for (let j = 0, grp = g++; j < m2; j++) {\n                    const rootPos = invertButterflies ? (dit ? N - grp : grp) : j * stride;\n                    const i0 = k + j;\n                    const i1 = k + j + m2;\n                    const omega = roots[rootPos];\n                    const b = values[i1];\n                    const a = values[i0];\n                    // Inlining gives us 10% perf in kyber vs functions\n                    if (isDit) {\n                        const t = F.mul(b, omega); // Standard DIT butterfly\n                        values[i0] = F.add(a, t);\n                        values[i1] = F.sub(a, t);\n                    }\n                    else if (invertButterflies) {\n                        values[i0] = F.add(b, a); // DIT loop + inverted butterflies (Kyber decode)\n                        values[i1] = F.mul(F.sub(b, a), omega);\n                    }\n                    else {\n                        values[i0] = F.add(a, b); // Standard DIF butterfly\n                        values[i1] = F.mul(F.sub(a, b), omega);\n                    }\n                }\n            }\n        }\n        if (!dit && brp)\n            bitReversalInplace(values);\n        return values;\n    };\n};\n/**\n * NTT aka FFT over finite field (NOT over complex numbers).\n * Naming mirrors other libraries.\n * @param roots - Roots-of-unity cache.\n * @param opts - Field operations. See {@link FFTOpts}.\n * @returns Forward and inverse FFT helpers.\n * @example\n * NTT aka FFT over finite field (NOT over complex numbers).\n *\n * ```ts\n * import { FFT, rootsOfUnity } from '@noble/curves/abstract/fft.js';\n * import { Field } from '@noble/curves/abstract/modular.js';\n * const Fp = Field(17n);\n * const fft = FFT(rootsOfUnity(Fp), Fp);\n * const values = fft.direct([1n, 2n, 3n, 4n]);\n * ```\n */\nexport function FFT(roots, opts) {\n    // Loops are cached per (size, direction, brp flags): FFTCore construction validates options\n    // and allocates closures, which costs more than a small transform itself. The cached loop\n    // closes over the root table active at first use; `roots.clear()` rebuilds value-identical\n    // tables, so a stale reference stays correct.\n    const loops = new Map();\n    const getLoop = (N, rootsTable, key) => {\n        const cached = loops.get(key);\n        if (cached)\n            return cached;\n        const brpInput = !!(key & 2);\n        const brpOutput = !!(key & 1);\n        let loop;\n        if (brpInput && brpOutput) {\n            // we cannot optimize this case, but lets support it anyway\n            const core = FFTCore(opts, { N, roots: rootsTable, dit: false, brp: false });\n            loop = (values) => core(bitReversalInplace(values));\n        }\n        else if (brpInput)\n            loop = FFTCore(opts, { N, roots: rootsTable, dit: true, brp: false });\n        else if (brpOutput)\n            loop = FFTCore(opts, { N, roots: rootsTable, dit: false, brp: false });\n        else\n            loop = FFTCore(opts, { N, roots: rootsTable, dit: true, brp: true }); // all natural\n        loops.set(key, loop);\n        return loop;\n    };\n    const loopKey = (bits, isInverse, brpInput, brpOutput) => (bits << 3) | (isInverse ? 4 : 0) | (brpInput ? 2 : 0) | (brpOutput ? 1 : 0);\n    return {\n        direct(values, brpInput = false, brpOutput = false) {\n            const N = values.length;\n            if (!isPowerOfTwo(N))\n                throw new Error('FFT: Polynomial size should be power of two');\n            const bits = log2(N);\n            const key = loopKey(bits, false, brpInput, brpOutput);\n            return getLoop(N, roots.roots(bits), key)(values.slice());\n        },\n        inverse(values, brpInput = false, brpOutput = false) {\n            const N = values.length;\n            if (!isPowerOfTwo(N))\n                throw new Error('FFT: Polynomial size should be power of two');\n            const bits = log2(N);\n            const key = loopKey(bits, true, brpInput, brpOutput);\n            const res = getLoop(N, roots.inverse(bits), key)(values.slice());\n            const ivm = opts.inv(BigInt(values.length)); // scale\n            // we can get brp output if we use dif instead of dit!\n            for (let i = 0; i < res.length; i++)\n                res[i] = opts.mul(res[i], ivm);\n            // Allows to re-use non-inverted roots, but is VERY fragile\n            // return [res[0]].concat(res.slice(1).reverse());\n            // inverse calculated as pow(-1), which transforms into ω^{-kn} (-> reverses indices)\n            return res;\n        },\n    };\n}\nexport function poly(field, roots, create, fft, length) {\n    validateField(field);\n    const F = field;\n    const _create = create ||\n        ((len, elm) => new Array(len).fill(elm ?? F.ZERO));\n    // `poly.mul(a, b)` distinguishes polynomial-vs-scalar at runtime, so keep accepted\n    // polynomial containers concrete instead of trying to support arbitrary wrappers.\n    const isPoly = (x) => {\n        if (Array.isArray(x))\n            return true;\n        if (!ArrayBuffer.isView(x))\n            return false;\n        const v = x;\n        return (typeof v.length === 'number' &&\n            typeof v.slice === 'function' &&\n            typeof v[Symbol.iterator] === 'function');\n    };\n    const checkPoly = (title, value) => {\n        if (!isPoly(value))\n            throw new TypeError(`\"${title}\" expected polynomial, got type=${typeof value}`);\n    };\n    const checkLength = (a, b) => {\n        checkPoly('a', a);\n        const L = a.length;\n        if (b !== undefined) {\n            checkPoly('b', b);\n            if (b.length !== L)\n                throw new Error(`poly: mismatched lengths ${L} vs ${b.length}`);\n        }\n        if (length !== undefined && L !== length)\n            throw new Error(`poly: expected fixed length ${length}, got ${L}`);\n        return L;\n    };\n    function findOmegaIndex(x, n, brp = false, weights) {\n        if (!isPowerOfTwo(n))\n            throw new Error('poly.lagrange: expected power of two length, got ' + n);\n        // Explicit weights define the interpolation domain, including the Kronecker-δ shortcut.\n        const omega = weights || (brp ? roots.brp(log2(n)) : roots.roots(log2(n)));\n        for (let i = 0; i < n; i++)\n            if (F.eql(x, omega[i]))\n                return i;\n        return -1;\n    }\n    // TODO: mutating versions for mlkem/mldsa\n    return {\n        roots,\n        create: _create,\n        length,\n        extend: (a, len) => {\n            checkLength(a);\n            const out = _create(len, F.ZERO);\n            // Plain arrays grow when writing past `out.length`, so cap the copy explicitly to keep\n            // `extend()` consistent with typed arrays and with its documented truncate behavior.\n            for (let i = 0; i < Math.min(a.length, len); i++)\n                out[i] = a[i];\n            return out;\n        },\n        degree: (a) => {\n            checkLength(a);\n            for (let i = a.length - 1; i >= 0; i--)\n                if (!F.is0(a[i]))\n                    return i;\n            return -1;\n        },\n        add: (a, b) => {\n            const len = checkLength(a, b);\n            const out = _create(len);\n            for (let i = 0; i < len; i++)\n                out[i] = F.add(a[i], b[i]);\n            return out;\n        },\n        sub: (a, b) => {\n            const len = checkLength(a, b);\n            const out = _create(len);\n            for (let i = 0; i < len; i++)\n                out[i] = F.sub(a[i], b[i]);\n            return out;\n        },\n        dot: (a, b) => {\n            const len = checkLength(a, b);\n            const out = _create(len);\n            for (let i = 0; i < len; i++)\n                out[i] = F.mul(a[i], b[i]);\n            return out;\n        },\n        mul: (a, b) => {\n            if (isPoly(b)) {\n                const len = checkLength(a, b);\n                if (fft) {\n                    const A = fft.direct(a, false, true);\n                    const B = fft.direct(b, false, true);\n                    for (let i = 0; i < A.length; i++)\n                        A[i] = F.mul(A[i], B[i]);\n                    return fft.inverse(A, true, false);\n                }\n                else {\n                    // NOTE: this is quadratic and mostly for compat tests with FFT\n                    const res = _create(len);\n                    for (let i = 0; i < len; i++) {\n                        for (let j = 0; j < len; j++) {\n                            const k = (i + j) % len; // wrap mod length\n                            res[k] = F.add(res[k], F.mul(a[i], b[j]));\n                        }\n                    }\n                    return res;\n                }\n            }\n            else {\n                const out = _create(checkLength(a));\n                for (let i = 0; i < out.length; i++)\n                    out[i] = F.mul(a[i], b);\n                return out;\n            }\n        },\n        convolve(a, b) {\n            checkPoly('a', a);\n            checkPoly('b', b);\n            const len = nextPowerOfTwo(a.length + b.length - 1);\n            return this.mul(this.extend(a, len), this.extend(b, len));\n        },\n        shift(p, factor) {\n            checkPoly('p', p);\n            const out = _create(p.length);\n            if (length !== undefined && p.length !== length)\n                throw new Error(`poly: expected fixed length ${length}, got ${p.length}`);\n            if (!p.length)\n                return out;\n            out[0] = p[0];\n            for (let i = 1, power = F.ONE; i < p.length; i++) {\n                power = F.mul(power, factor);\n                out[i] = F.mul(p[i], power);\n            }\n            return out;\n        },\n        clone: (a) => {\n            checkLength(a);\n            const out = _create(a.length);\n            for (let i = 0; i < a.length; i++)\n                out[i] = a[i];\n            return out;\n        },\n        eval: (a, basis) => {\n            checkLength(a, basis);\n            let acc = F.ZERO;\n            for (let i = 0; i < a.length; i++)\n                acc = F.add(acc, F.mul(a[i], basis[i]));\n            return acc;\n        },\n        monomial: {\n            basis: (x, n) => {\n                const out = _create(n);\n                let pow = F.ONE;\n                for (let i = 0; i < n; i++) {\n                    out[i] = pow;\n                    pow = F.mul(pow, x);\n                }\n                return out;\n            },\n            eval: (a, x) => {\n                checkLength(a);\n                // Same as eval(a, monomialBasis(x, a.length)), but it is faster this way\n                let acc = F.ZERO;\n                for (let i = a.length - 1; i >= 0; i--)\n                    acc = F.add(F.mul(acc, x), a[i]);\n                return acc;\n            },\n        },\n        lagrange: {\n            basis: (x, n, brp = false, weights) => {\n                if (!isPowerOfTwo(n))\n                    throw new Error('poly.lagrange: expected power of two length, got ' + n);\n                const bits = log2(n);\n                const cache = weights || (brp ? roots.brp(bits) : roots.roots(bits)); // [ω⁰, ω¹, ..., ωⁿ⁻¹]\n                const out = _create(n);\n                // Fast Kronecker-δ shortcut\n                const idx = findOmegaIndex(x, n, brp, weights);\n                if (idx !== -1) {\n                    out[idx] = F.ONE;\n                    return out;\n                }\n                const tm = F.pow(x, BigInt(n));\n                const c = F.mul(F.sub(tm, F.ONE), F.inv(BigInt(n))); // c = (xⁿ - 1)/n\n                const denom = _create(n);\n                for (let i = 0; i < n; i++)\n                    denom[i] = F.sub(x, cache[i]);\n                const inv = F.invertBatch(denom);\n                for (let i = 0; i < n; i++)\n                    out[i] = F.mul(c, F.mul(cache[i], inv[i]));\n                return out;\n            },\n            eval(a, x, brp = false) {\n                checkLength(a);\n                const idx = findOmegaIndex(x, a.length, brp);\n                if (idx !== -1)\n                    return a[idx]; // fast path\n                const L = this.basis(x, a.length, brp); // Lᵢ(x)\n                let acc = F.ZERO;\n                for (let i = 0; i < a.length; i++)\n                    if (!F.is0(a[i]))\n                        acc = F.add(acc, F.mul(a[i], L[i]));\n                return acc;\n            },\n        },\n        vanishing(roots) {\n            checkPoly('roots', roots);\n            if (length !== undefined && roots.length !== length)\n                throw new Error(`poly: expected fixed length ${length}, got ${roots.length}`);\n            const out = _create(roots.length + 1, F.ZERO);\n            out[0] = F.ONE;\n            for (const r of roots) {\n                const neg = F.neg(r);\n                for (let j = out.length - 1; j > 0; j--)\n                    out[j] = F.add(F.mul(out[j], neg), out[j - 1]);\n                out[0] = F.mul(out[0], neg);\n            }\n            return out;\n        },\n    };\n}\n","/**\n * Utilities for hex, bytearray and number handling.\n * @module\n */\n/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */\nimport { abytes, abytes as abytes_, ahash as ahash_, anumber, bytesToHex, concatBytes, isBytes, isLE, randomBytes as randb, } from '@noble/hashes/utils.js';\n/**\n * Asserts that a value is a byte array and optionally checks its length.\n * Returns the original reference unchanged on success, and currently also accepts Node `Buffer`\n * values through the upstream validator.\n * This helper throws on malformed input, so APIs that must return `false` need to guard lengths\n * before decoding or before calling it.\n * @example\n * Validate that a value is a byte array with the expected length.\n * ```ts\n * abytes(new Uint8Array([1]), 1);\n * ```\n */\nconst abytesDoc = abytes;\nexport { abytesDoc as abytes };\n/**\n * Concatenates byte arrays into a new `Uint8Array`.\n * Zero arguments return an empty `Uint8Array`.\n * Invalid segments throw before allocation because each argument is validated first.\n * @example\n * Concatenate two byte arrays into one result.\n * ```ts\n * concatBytes(new Uint8Array([1]), new Uint8Array([2]));\n * ```\n */\nconst concatBytesDoc = concatBytes;\nexport { concatBytesDoc as concatBytes };\n/**\n * Returns cryptographically secure random bytes.\n * Requires `globalThis.crypto.getRandomValues` and throws if that API is unavailable.\n * `bytesLength` is validated by the upstream helper as a non-negative integer before allocation,\n * so negative and fractional values both throw instead of truncating through JS `ToIndex`.\n * @param bytesLength - Number of random bytes to generate.\n * @returns Fresh random bytes.\n * @example\n * Generate a fresh random seed.\n * ```ts\n * const seed = randomBytes(4);\n * ```\n */\nexport const randomBytes = randb;\nexport function aarray(item, title, inner = () => { }) {\n    if (!Array.isArray(item))\n        throw new TypeError(`\"${title}\" expected array, got type=${typeof item}`);\n    for (let i = 0; i < item.length; i++)\n        inner(item[i], `${title}[${i}]`);\n    return item;\n}\nexport function aobject(value, title = 'object') {\n    if (value === null || typeof value !== 'object' || Array.isArray(value))\n        throw new TypeError(title === 'object'\n            ? 'expected valid options object'\n            : `\"${title}\" expected object, got type=${typeof value}`);\n    return value;\n}\n/**\n * Compares two byte arrays in a length-constant way for equal lengths.\n * Inputs are validated as byte arrays; unequal lengths return `false` immediately.\n * @param a - First byte array.\n * @param b - Second byte array.\n * @returns Whether both arrays contain the same bytes.\n * @example\n * Compare two byte arrays for equality.\n * ```ts\n * equalBytes(new Uint8Array([1]), new Uint8Array([1]));\n * ```\n */\nexport function equalBytes(a, b) {\n    a = abytes(a);\n    b = abytes(b);\n    if (a.length !== b.length)\n        return false;\n    let diff = 0;\n    for (let i = 0; i < a.length; i++)\n        diff |= a[i] ^ b[i];\n    return diff === 0;\n}\n/**\n * Copies bytes into a fresh `Uint8Array`.\n * Returns a detached plain `Uint8Array` after validating that the input is real bytes.\n * @param bytes - Source bytes.\n * @returns Copy of the input bytes.\n * @example\n * Copy bytes into a fresh array.\n * ```ts\n * copyBytes(new Uint8Array([1, 2]));\n * ```\n */\nexport function copyBytes(bytes) {\n    // The typed-array constructor copies a typed-array source through its internal byte storage.\n    // Unlike `Uint8Array.from`, it does not invoke a subclass-overridden iterator. Keep the explicit\n    // validation because the constructor itself would also accept arrays and other typed arrays.\n    return new Uint8Array(abytes(bytes));\n}\n/**\n * Byte-swaps each 64-bit lane in place.\n * Falcon's exact binary64 tables are stored as little-endian byte payloads, so BE runtimes need\n * this boundary helper before aliasing them as host `Float64Array` lanes.\n * @param arr - Byte buffer whose length is a multiple of 8.\n * @returns The same buffer after in-place 64-bit lane byte swaps.\n * @example\n * Byte-swap one 64-bit lane in place.\n * ```ts\n * byteSwap64(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]));\n * ```\n */\nexport function byteSwap64(arr) {\n    const bytes = new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n    for (let i = 0; i < bytes.length; i += 8) {\n        const a0 = bytes[i + 0];\n        const a1 = bytes[i + 1];\n        const a2 = bytes[i + 2];\n        const a3 = bytes[i + 3];\n        bytes[i + 0] = bytes[i + 7];\n        bytes[i + 1] = bytes[i + 6];\n        bytes[i + 2] = bytes[i + 5];\n        bytes[i + 3] = bytes[i + 4];\n        bytes[i + 4] = a3;\n        bytes[i + 5] = a2;\n        bytes[i + 6] = a1;\n        bytes[i + 7] = a0;\n    }\n    return arr;\n}\n/**\n * Byte-swaps 64-bit lanes on big-endian runtimes and returns the input unchanged on little-endian.\n * This keeps Falcon's binary64 tables in canonical little-endian order before aliasing them as\n * `Float64Array` lanes on the current host.\n * @param arr - Buffer to pass through or swap in place.\n * @returns The same buffer, normalized for Falcon's little-endian table layout.\n * @example\n * Normalize one host-endian buffer for Falcon's float tables.\n * ```ts\n * baswap64If(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]));\n * ```\n */\nexport const baswap64If = isLE\n    ? (arr) => arr\n    : byteSwap64;\n/**\n * Validates that an options bag is a plain object.\n * @param opts - Options object to validate.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate that an options bag is a plain object.\n * ```ts\n * validateOpts({});\n * ```\n */\nexport function validateOpts(opts) {\n    // Arrays silently passed here before, but these call sites expect named option-bag fields.\n    if (isBytes(opts))\n        throw new TypeError('\"opts\" expected object, got Uint8Array');\n    aobject(opts, 'opts');\n    const proto = Object.getPrototypeOf(opts);\n    // Options are security parameters, not general class instances. Restricting the bag to own\n    // properties prevents values injected through Object.prototype (or a custom shared prototype)\n    // from silently changing signing behavior. Null-prototype records remain supported.\n    if (proto !== null && proto !== Object.prototype)\n        throw new TypeError('\"opts\" expected a plain object');\n}\n// Frozen because they are exported: an unfrozen array export lets anything in the\n// process push a key onto the accepted set and silently re-open exactly the hole this\n// validation closes.\n/** Keys accepted by `verify`. */\nexport const VER_OPT_KEYS = /* @__PURE__ */ Object.freeze([\n    'context',\n]);\n/** Keys accepted by `sign`. */\nexport const SIG_OPT_KEYS = /* @__PURE__ */ Object.freeze([\n    'context',\n    'extraEntropy',\n]);\n/**\n * Rejects option keys the caller did not mean to set.\n *\n * Validating the types of known keys while ignoring unknown ones makes a typo\n * indistinguishable from an omission, and for these options an omission is a\n * security downgrade rather than a no-op: `{ ctx }` instead of `{ context }` signs\n * with no domain separation, succeeds, and verifies for anyone who also supplies\n * none. Nothing at any layer reports it. TypeScript catches this through excess\n * property checks, so the exposure is JavaScript callers specifically.\n *\n * @param opts - Options object to check.\n * @param allowed - The keys this call site accepts.\n * Returns a frozen null-prototype snapshot so later reads cannot fall through to a polluted\n * prototype. Like `checkOpts()` in noble-hashes, only enumerable own properties are copied.\n * @throws If any other copied key is present or the bag has a custom prototype. {@link TypeError}\n * @returns Sanitized snapshot of the enumerable own options.\n * @example\n * Accept a known option key. A key the list does not name, such as `ctx`, throws instead.\n * ```ts\n * import { checkOptKeys } from '@noble/post-quantum/utils.js';\n * checkOptKeys({ context: new Uint8Array() }, ['context']);\n * ```\n */\nexport function checkOptKeys(opts, allowed) {\n    validateOpts(opts);\n    // Snapshot once before validation: Object.assign follows the same own-enumerable option-bag\n    // semantics as noble-hashes, while the null prototype keeps omitted fields immune to pollution.\n    const normalized = Object.assign(Object.create(null), opts);\n    for (const [k, v] of Object.entries(normalized)) {\n        // `undefined` means unset everywhere else in these validators, and building an options bag by\n        // spread is a normal way to reach these calls, so present-but-undefined stays equivalent to\n        // omission.\n        if (v === undefined)\n            continue;\n        if (!allowed.includes(k))\n            throw new TypeError('unexpected option \"' + String(k) + '\"; expected one of: ' + allowed.join(', '));\n    }\n    return Object.freeze(normalized);\n}\n/**\n * Validates common verification options.\n * `context` itself is validated with `abytes(...)`, and individual algorithms may narrow support\n * further after this shared plain-object gate.\n * @param opts - Verification options. See {@link VerOpts}.\n * @param allowed - Keys this call site accepts. Defaults to {@link VER_OPT_KEYS}; surfaces that\n * take extra keys, or take fewer, pass their own list.\n * @throws On wrong argument types. {@link TypeError}\n * @returns Frozen null-prototype snapshot of the validated options.\n * @example\n * Validate common verification options.\n * ```ts\n * validateVerOpts({ context: new Uint8Array([1]) });\n * ```\n */\nexport function validateVerOpts(opts, allowed = VER_OPT_KEYS) {\n    const normalized = checkOptKeys(opts, allowed);\n    if (normalized.context !== undefined)\n        abytes(normalized.context, undefined, 'opts.context');\n    return normalized;\n}\n/**\n * Validates common signing options.\n * `extraEntropy` is validated with `abytes(...)`; exact lengths and extra algorithm-specific\n * restrictions are enforced later by callers.\n * @param opts - Signing options. See {@link SigOpts}.\n * @param allowed - Keys this call site accepts. Defaults to {@link SIG_OPT_KEYS}; surfaces that\n * take extra keys, or take fewer, pass their own list.\n * @throws On wrong argument types. {@link TypeError}\n * @returns Frozen null-prototype snapshot of the validated options.\n * @example\n * Validate common signing options.\n * ```ts\n * validateSigOpts({ extraEntropy: new Uint8Array([1]) });\n * ```\n */\nexport function validateSigOpts(opts, allowed = SIG_OPT_KEYS) {\n    const normalized = checkOptKeys(opts, allowed);\n    if (normalized.context !== undefined)\n        abytes(normalized.context, undefined, 'opts.context');\n    if (normalized.extraEntropy !== false && normalized.extraEntropy !== undefined)\n        abytes(normalized.extraEntropy, undefined, 'opts.extraEntropy');\n    return normalized;\n}\n/**\n * Builds a fixed-layout coder from byte lengths and nested coders.\n * Raw-length fields decode as zero-copy `subarray(...)` views, and nested coders may preserve that\n * aliasing too. Nested coder `encode(...)` results are treated as owned scratch: `splitCoder`\n * copies them into the output and then zeroizes them with `fill(0)`. If a nested encoder forwards\n * caller-owned bytes, it must do so only after detaching them into a disposable copy.\n * @param label - Label used in validation errors.\n * @param lengths - Field lengths or nested coders.\n * @returns Composite fixed-length coder.\n * @example\n * Build a fixed-layout coder from byte lengths and nested coders.\n * ```ts\n * splitCoder('demo', 1, 2).encode([new Uint8Array([1]), new Uint8Array([2, 3])]);\n * ```\n */\nexport function splitCoder(label, ...lengths) {\n    const getLength = (c) => typeof c === 'number' ? c : c.bytesLen;\n    const bytesLen = lengths.reduce((sum, a) => sum + getLength(a), 0);\n    return {\n        bytesLen,\n        encode: (bufs) => {\n            const res = new Uint8Array(bytesLen);\n            for (let i = 0, pos = 0; i < lengths.length; i++) {\n                const c = lengths[i];\n                const l = getLength(c);\n                const b = typeof c === 'number' ? bufs[i] : c.encode(bufs[i]);\n                abytes_(b, l, label);\n                res.set(b, pos);\n                if (typeof c !== 'number')\n                    b.fill(0); // clean\n                pos += l;\n            }\n            return res;\n        },\n        decode: (buf) => {\n            abytes_(buf, bytesLen, label);\n            const res = [];\n            for (const c of lengths) {\n                const l = getLength(c);\n                const b = buf.subarray(0, l);\n                res.push(typeof c === 'number' ? b : c.decode(b));\n                buf = buf.subarray(l);\n            }\n            return res;\n        },\n    };\n}\n// nano-packed.array (fixed size)\n/**\n * Builds a fixed-length vector coder from another fixed-length coder.\n * Element decoding receives `subarray(...)` views, so aliasing depends on the element coder.\n * Element coder `encode(...)` results are treated as owned scratch: `vecCoder` copies them into\n * the output and then zeroizes them with `fill(0)`. If an element encoder forwards caller-owned\n * bytes, it must do so only after detaching them into a disposable copy. `vecCoder` also trusts\n * the `BytesCoderLen` contract: each encoded element must already be exactly `c.bytesLen` bytes.\n * @param c - Element coder.\n * @param vecLen - Number of elements in the vector.\n * @returns Fixed-length vector coder.\n * @example\n * Build a fixed-length vector coder from another fixed-length coder.\n * ```ts\n * vecCoder(\n *   { bytesLen: 1, encode: (n: number) => Uint8Array.of(n), decode: (b: Uint8Array) => b[0] || 0 },\n *   2\n * ).encode([1, 2]);\n * ```\n */\nexport function vecCoder(c, vecLen) {\n    const coder = c;\n    const bytesLen = vecLen * coder.bytesLen;\n    return {\n        bytesLen,\n        encode: (u) => {\n            const uArr = aarray(u, 'u');\n            if (uArr.length !== vecLen)\n                throw new RangeError(`vecCoder.encode: wrong length=${uArr.length}. Expected: ${vecLen}`);\n            const res = new Uint8Array(bytesLen);\n            for (let i = 0, pos = 0; i < uArr.length; i++) {\n                const b = coder.encode(uArr[i]);\n                res.set(b, pos);\n                b.fill(0); // clean\n                pos += b.length;\n            }\n            return res;\n        },\n        decode: (a) => {\n            abytes_(a, bytesLen);\n            const r = [];\n            for (let i = 0; i < a.length; i += coder.bytesLen)\n                r.push(coder.decode(a.subarray(i, i + coder.bytesLen)));\n            return r;\n        },\n    };\n}\n/**\n * Overwrites supported typed-array inputs with zeroes in place.\n * Accepts direct typed arrays and one-level arrays of them.\n * @param list - Typed arrays or one-level lists of typed arrays to clear.\n * @example\n * Overwrite typed arrays with zeroes.\n * ```ts\n * const buf = Uint8Array.of(1, 2, 3);\n * cleanBytes(buf);\n * ```\n */\nexport function cleanBytes(...list) {\n    for (const t of list) {\n        if (Array.isArray(t))\n            for (const b of t)\n                b.fill(0);\n        else\n            t.fill(0);\n    }\n}\n/**\n * Creates a 32-bit mask with the lowest `bits` bits set.\n * @param bits - Number of low bits to keep.\n * @returns Bit mask with `bits` ones.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Create a low-bit mask for packed-field operations.\n * ```ts\n * const mask = getMask(4);\n * ```\n */\nexport function getMask(bits) {\n    anumber(bits, 'bits');\n    if (bits > 32)\n        throw new RangeError('\"bits\" expected <= 32, got ' + bits);\n    // JS shifts are modulo 32, so bit 32 needs an explicit full-width mask.\n    return bits === 32 ? 0xffffffff : ~(-1 << bits) >>> 0;\n}\n/** Shared empty byte array used as the default context. */\nexport const EMPTY = /* @__PURE__ */ Uint8Array.of();\n/**\n * Builds the domain-separated message payload for the pure sign/verify paths.\n * Context length `255` is valid; only `ctx.length > 255` is rejected.\n * @param msg - Message bytes.\n * @param ctx - Optional context bytes.\n * @returns Domain-separated message payload.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Build the domain-separated payload before direct signing.\n * ```ts\n * const payload = getMessage(new Uint8Array([1, 2]));\n * ```\n */\nexport function getMessage(msg, ctx = EMPTY) {\n    abytes_(msg, undefined, 'msg');\n    abytes_(ctx, undefined, 'ctx');\n    if (ctx.length > 255)\n        throw new RangeError('context should be 255 bytes or less');\n    return concatBytes(new Uint8Array([0, ctx.length]), ctx, msg);\n}\n// DER tag+length plus the shared NIST hash OID arc 2.16.840.1.101.3.4.2.* used by the\n// FIPS 204 / FIPS 205 pre-hash wrappers; the final byte selects SHA-256, SHA-512, SHAKE128,\n// SHAKE256, or another approved hash/XOF under that subtree.\n// 06 09 60 86 48 01 65 03 04 02\nconst oidNistP = /* @__PURE__ */ Uint8Array.from([6, 9, 0x60, 0x86, 0x48, 1, 0x65, 3, 4, 2]);\n/**\n * Output length, in bytes, that each XOF OID under this arc denotes.\n *\n * Unlike a fixed hash, an XOF's OID is a promise about the digest length: RFC 8702\n * defines id-shake128 as SHAKE128 with 256-bit output and id-shake256 as SHAKE256 with\n * 512-bit output, and FIPS 204 / FIPS 205 use exactly those pairings for pre-hash. Both\n * bare noble-hashes defaults are half these values, so neither can be signed under its\n * own OID.\n */\nconst XOF_OID_OUTPUT_LEN = /* @__PURE__ */ (() => ({\n    '060960864801650304020b': 32, // id-shake128, SHAKE128(M, 256)\n    '060960864801650304020c': 64, // id-shake256, SHAKE256(M, 512)\n}))();\n/**\n * Validates that a hash exposes a NIST hash OID and enough collision resistance.\n * Current accepted surface is broader than the FIPS algorithm tables: any hash/XOF under the NIST\n * `2.16.840.1.101.3.4.2.*` subtree is accepted if its effective `outputLen` is strong enough.\n * XOF callers must pass a callable whose `outputLen` matches the digest length they actually intend\n * to sign; bare `shake128` / `shake256` defaults are too short for the stronger prehash modes.\n * @param hash - Hash function to validate.\n * @param requiredStrength - Minimum required collision-resistance strength in bits.\n * @throws If the hash metadata or collision resistance is insufficient. {@link Error}\n * @example\n * Validate that a hash exposes a NIST hash OID and enough collision resistance.\n * ```ts\n * import { sha256 } from '@noble/hashes/sha2.js';\n * import { checkHash } from '@noble/post-quantum/utils.js';\n * checkHash(sha256, 128);\n * ```\n */\nexport function checkHash(hash, requiredStrength = 0) {\n    if (typeof hash !== 'function' || typeof hash.create !== 'function')\n        throw new TypeError('\"hash\" expected hash function, got type=' + typeof hash);\n    ahash_(hash);\n    anumber(requiredStrength, 'requiredStrength');\n    const oid = hash.oid;\n    abytes_(oid, undefined, 'hash.oid');\n    if (!equalBytes(oid.subarray(0, 10), oidNistP))\n        throw new Error('\"hash.oid\" is invalid: expected NIST hash');\n    // FIPS 204 / FIPS 205 require both collision and second-preimage strength; for approved NIST\n    // hashes/XOFs under this OID subtree, the collision bound from the configured digest length is\n    // the tighter runtime check, so enforce that lower bound here.\n    // XOFs under this arc are identified by an OID that fixes their output length:\n    // FIPS 204 §5.4.1 (SHAKE128) and FIPS 205 §10.2.2 (both SHAKEs), matching RFC 8702, pair\n    // id-shake128 with SHAKE128(M, 256) and id-shake256 with SHAKE256(M, 512). getMessagePrehash embeds\n    // hash.oid beside hash(msg), so a shorter digest signs an M' that claims a length\n    // it does not have: noble-hashes' bare shake256 defaults to 32 bytes and cleared\n    // the collision bound at the 128-bit level, producing signatures a conformant\n    // verifier rejects because it recomputes 512 bits. Check the length the OID\n    // denotes rather than the generic bound.\n    const xofLen = XOF_OID_OUTPUT_LEN[bytesToHex(oid)];\n    if (xofLen !== undefined && hash.outputLen !== xofLen) {\n        throw new Error('Pre-hash XOF output length must be ' + xofLen + ' bytes for this OID, got: ' + hash.outputLen);\n    }\n    const collisionResistance = (hash.outputLen * 8) / 2;\n    if (requiredStrength > collisionResistance) {\n        throw new Error('Pre-hash security strength too low: ' +\n            collisionResistance +\n            ', required: ' +\n            requiredStrength);\n    }\n}\n/**\n * Builds the domain-separated prehash payload for the prehash sign/verify paths.\n * Callers are expected to vet `hash.oid` first, e.g. via `checkHash(...)`; calling this helper\n * directly with a hash object that lacks `oid` currently throws later inside `concatBytes(...)`.\n * Context length `255` is valid; only `ctx.length > 255` is rejected.\n * @param hash - Prehash function.\n * @param msg - Message bytes.\n * @param ctx - Optional context bytes.\n * @returns Domain-separated prehash payload.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Build the domain-separated prehash payload for external hashing.\n * ```ts\n * import { sha256 } from '@noble/hashes/sha2.js';\n * import { getMessagePrehash } from '@noble/post-quantum/utils.js';\n * getMessagePrehash(sha256, new Uint8Array([1, 2]));\n * ```\n */\nexport function getMessagePrehash(hash, msg, ctx = EMPTY) {\n    checkHash(hash);\n    abytes_(msg, undefined, 'msg');\n    abytes_(ctx, undefined, 'ctx');\n    if (ctx.length > 255)\n        throw new RangeError('context should be 255 bytes or less');\n    const hashed = hash(msg);\n    return concatBytes(new Uint8Array([1, ctx.length]), ctx, hash.oid, hashed);\n}\n/**\n * Asserts something is a string.\n * @param value - Value to validate.\n * @param title - Label included in thrown errors.\n * @returns The validated string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a label string.\n *\n * ```ts\n * astring('example', 'label');\n * ```\n */\nexport function astring(value, title = '') {\n    if (typeof value !== 'string') {\n        const prefix = title && `\"${title}\" `;\n        throw new TypeError(prefix + 'expected string, got type=' + typeof value);\n    }\n    return value;\n}\n","/**\n * Internal methods for lattice-based ML-KEM and ML-DSA.\n * @module\n */\n/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */\nimport { FFTCore, reverseBits } from '@noble/curves/abstract/fft.js';\nimport { shake128, shake256 } from '@noble/hashes/sha3.js';\nimport { cleanBytes, getMask, } from \"./utils.js\";\n/**\n * Creates shared modular arithmetic, NTT, and packing helpers for CRYSTALS schemes.\n * @param opts - Polynomial and transform parameters. See {@link CrystalOpts}.\n * @returns CRYSTALS arithmetic and encoding helpers.\n * @example\n * Create shared modular arithmetic and NTT helpers for a CRYSTALS parameter set.\n * ```ts\n * const crystals = genCrystals({\n *   newPoly: (n) => new Uint16Array(n),\n *   N: 256,\n *   Q: 3329,\n *   F: 3303,\n *   ROOT_OF_UNITY: 17,\n *   brvBits: 7,\n *   isKyber: true,\n * });\n * const reduced = crystals.mod(-1);\n * ```\n */\nexport const genCrystals = (opts) => {\n    // isKyber: true means Kyber, false means Dilithium\n    const { newPoly, N, Q, F, ROOT_OF_UNITY, brvBits, isKyber } = opts;\n    // Normalize JS `%` into the canonical Z_m representative `[0, modulo-1]` expected by\n    // FIPS 203 §2.3 / FIPS 204 §2.3 before downstream mod-q arithmetic.\n    const mod = (a, modulo = Q) => {\n        const result = (a % modulo) | 0;\n        return (result >= 0 ? result | 0 : (modulo + result) | 0) | 0;\n    };\n    // FIPS 204 §7.4 uses the centered `mod ±` representative for low bits, keeping the\n    // positive midpoint when `modulo` is even.\n    // Center to `[-floor((modulo-1)/2), floor(modulo/2)]`.\n    const smod = (a, modulo = Q) => {\n        const r = mod(a, modulo) | 0;\n        return (r > modulo >> 1 ? (r - modulo) | 0 : r) | 0;\n    };\n    // Kyber uses the FIPS 203 Appendix A `BitRev_7` table here via the first 128 entries, while\n    // Dilithium uses the FIPS 204 §7.5 / Appendix B `BitRev_8` zetas table over all 256 entries.\n    function getZettas() {\n        const out = newPoly(N);\n        for (let i = 0; i < N; i++) {\n            const b = reverseBits(i, brvBits);\n            const p = BigInt(ROOT_OF_UNITY) ** BigInt(b) % BigInt(Q);\n            out[i] = Number(p) | 0;\n        }\n        return out;\n    }\n    const nttZetas = getZettas();\n    // Number-Theoretic Transform\n    // Explained: https://electricdusk.com/ntt.html\n    // Kyber has slightly different params, since there is no 512th primitive root of unity mod q,\n    // only 256th primitive root of unity mod. Which also complicates MultiplyNTT.\n    const inv = (_a) => {\n        throw new Error('not implemented');\n    };\n    // ML-KEM (Kyber) polynomials always enter the transform reduced to [0, Q), so add/sub only\n    // need one conditional correction instead of `%`; measured ~20% faster NTT there.\n    // ML-DSA keeps the generic mod() path on purpose: its first forward stage sees centered\n    // (negative) coefficients, and `sub(a, t)` can drop below -Q (t is a mul output in [0, Q)),\n    // so a single correction is not enough. A guarded fast path with mod() fallback was measured\n    // slower than plain `%` for the 23-bit Q (V8 int32 modulo is one div; the branches lose).\n    const field = isKyber\n        ? {\n            add: (a, b) => {\n                const r = (a + b) | 0;\n                return r >= Q ? (r - Q) | 0 : r;\n            },\n            sub: (a, b) => {\n                const r = (a - b) | 0;\n                return r < 0 ? (r + Q) | 0 : r;\n            },\n            mul: (a, b) => mod((a | 0) * (b | 0)) | 0,\n            inv,\n        }\n        : {\n            add: (a, b) => mod((a | 0) + (b | 0)) | 0,\n            sub: (a, b) => mod((a | 0) - (b | 0)) | 0,\n            mul: (a, b) => mod((a | 0) * (b | 0)) | 0,\n            inv,\n        };\n    const nttOpts = {\n        N,\n        roots: nttZetas,\n        invertButterflies: true,\n        skipStages: isKyber ? 1 : 0,\n        brp: false,\n    };\n    const dif = FFTCore(field, { dit: false, ...nttOpts });\n    const dit = FFTCore(field, { dit: true, ...nttOpts });\n    const NTT = {\n        encode: (r) => {\n            return dif(r);\n        },\n        decode: (r) => {\n            dit(r);\n            // The inverse-NTT normalization factor is family-specific: FIPS 203 Algorithm 10 line 14\n            // uses `128^-1 mod q` for Kyber, while FIPS 204 Algorithm 42 lines 21-23 use `256^-1 mod q`.\n            // kyber uses 128 here, because brv && stuff\n            for (let i = 0; i < r.length; i++)\n                r[i] = mod(F * r[i]);\n            return r;\n        },\n    };\n    // Pack one little-endian `d`-bit word per coefficient, matching FIPS 203 ByteEncode /\n    // ByteDecode and the FIPS 204 BitsToBytes-based polynomial packing helpers.\n    const bitsCoder = (d, c) => {\n        // Validate the carry shape once: JS bitwise operations silently truncate wider accumulators.\n        for (let i = 0, bufLen = 0; i < N; i++) {\n            bufLen += d;\n            if (bufLen > 32)\n                getMask(bufLen);\n            bufLen %= 8;\n        }\n        const mask = getMask(d);\n        const bytesLen = d * (N / 8);\n        return {\n            bytesLen,\n            encode: (poly_) => {\n                const poly = poly_;\n                const r = new Uint8Array(bytesLen);\n                for (let i = 0, buf = 0, bufLen = 0, pos = 0; i < poly.length; i++) {\n                    buf |= (c.encode(poly[i]) & mask) << bufLen;\n                    bufLen += d;\n                    // Take the low byte directly: `& 0xff` matches the previous getMask(bufLen) result\n                    // after Uint8Array truncation, without a validated function call per output byte.\n                    for (; bufLen >= 8; bufLen -= 8, buf >>= 8)\n                        r[pos++] = buf & 0xff;\n                }\n                return r;\n            },\n            decode: (bytes) => {\n                const r = newPoly(N);\n                for (let i = 0, buf = 0, bufLen = 0, pos = 0; i < bytes.length; i++) {\n                    buf |= bytes[i] << bufLen;\n                    bufLen += 8;\n                    for (; bufLen >= d; bufLen -= d, buf >>= d)\n                        r[pos++] = c.decode(buf & mask);\n                }\n                return r;\n            },\n        };\n    };\n    return {\n        mod,\n        smod,\n        nttZetas: nttZetas,\n        NTT: {\n            encode: (r) => NTT.encode(r),\n            decode: (r) => NTT.decode(r),\n        },\n        bitsCoder: bitsCoder,\n    };\n};\nconst createXofShake = (shake) => (seed, blockLen) => {\n    if (!blockLen)\n        blockLen = shake.blockLen;\n    // Optimizations that won't mater:\n    // - cached seed update (two .update(), on start and on the end)\n    // - another cache which cloned into working copy\n    // Faster than multiple updates, since seed less than blockLen\n    const _seed = new Uint8Array(seed.length + 2);\n    _seed.set(seed);\n    const seedLen = seed.length;\n    const buf = new Uint8Array(blockLen); // == shake128.blockLen\n    let h = shake.create({});\n    let calls = 0;\n    let xofs = 0;\n    return {\n        stats: () => ({ calls, xofs }),\n        get: (x, y) => {\n            // Rebind to `seed || x || y` so callers can implement the spec's per-coordinate\n            // SHAKE inputs like `rho || j || i` and `rho || IntegerToBytes(counter, 2)`.\n            _seed[seedLen + 0] = x;\n            _seed[seedLen + 1] = y;\n            h.destroy();\n            h = shake.create({}).update(_seed);\n            calls++;\n            return () => {\n                xofs++;\n                return h.xofInto(buf);\n            };\n        },\n        clean: () => {\n            h.destroy();\n            cleanBytes(buf, _seed);\n        },\n    };\n};\n/**\n * SHAKE128-based extendable-output reader factory used by ML-KEM.\n * `get(x, y)` selects one coordinate pair at a time; calling it again invalidates previously\n * returned readers, and each squeeze reuses one mutable internal output buffer.\n * @param seed - Seed bytes for the reader.\n * @param blockLen - Optional output block length.\n * @returns Stateful XOF reader.\n * @example\n * Build the ML-KEM SHAKE128 matrix expander and read one block.\n * ```ts\n * import { randomBytes } from '@noble/post-quantum/utils.js';\n * import { XOF128 } from '@noble/post-quantum/_crystals.js';\n * const reader = XOF128(randomBytes(32));\n * const block = reader.get(0, 0)();\n * ```\n */\nexport const XOF128 = /* @__PURE__ */ createXofShake(shake128);\n/**\n * SHAKE256-based extendable-output reader factory used by ML-DSA.\n * `get(x, y)` appends raw one-byte coordinates to the seed, invalidates previously returned\n * readers, and reuses one mutable internal output buffer for each squeeze.\n * @param seed - Seed bytes for the reader.\n * @param blockLen - Optional output block length.\n * @returns Stateful XOF reader.\n * @example\n * Build the ML-DSA SHAKE256 coefficient expander and read one block.\n * ```ts\n * import { randomBytes } from '@noble/post-quantum/utils.js';\n * import { XOF256 } from '@noble/post-quantum/_crystals.js';\n * const reader = XOF256(randomBytes(32));\n * const block = reader.get(0, 0)();\n * ```\n */\nexport const XOF256 = /* @__PURE__ */ createXofShake(shake256);\n","/**\n * ML-KEM: Module Lattice-based Key Encapsulation Mechanism from\n * [FIPS-203](https://csrc.nist.gov/pubs/fips/203/ipd). A.k.a. CRYSTALS-Kyber.\n *\n * Key encapsulation is similar to DH / ECDH (think X25519), with important differences:\n * * Unlike in ECDH, we can't verify if it was \"Bob\" who've sent the shared secret\n * * Unlike ECDH, it is probabalistic and relies on quality of randomness (CSPRNG).\n * * Decapsulation never throws an error, even when shared secret was\n *   encrypted by a different public key. It will just return a different shared secret.\n *\n * There are some concerns with regards to security: see\n * [djb blog](https://blog.cr.yp.to/20231003-countcorrectly.html) and\n * [mailing list](https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/W2VOzy0wz_E).\n *\n * Has similar internals to ML-DSA, but their keys and params are different.\n *\n * Check out [official site](https://www.pq-crystals.org/kyber/resources.shtml),\n * [repo](https://github.com/pq-crystals/kyber),\n * [spec](https://datatracker.ietf.org/doc/draft-cfrg-schwabe-kyber/).\n * @module\n */\n/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */\nimport { sha3_256, sha3_512, shake256 } from '@noble/hashes/sha3.js';\nimport { swap32IfBE, u32 } from '@noble/hashes/utils.js';\nimport { genCrystals, XOF128 } from \"./_crystals.js\";\nimport { abytes, cleanBytes, copyBytes, equalBytes, getMask, randomBytes, splitCoder, vecCoder, } from \"./utils.js\";\n/** Key encapsulation mechanism interface */\nconst N = 256; // Kyber (not FIPS-203) supports different lengths, but all std modes were using 256\nconst Q = 3329; // 13*(2**8)+1, modulo prime\nconst F = 3303; // 3303 ≡ 128**(−1) mod q (FIPS-203)\nconst ROOT_OF_UNITY = 17; // ζ = 17 ∈ Zq is a primitive 256-th root of unity modulo Q. ζ**128 ≡−1\n// treeshake: keep genCrystals behind the object so PARAMS-only bundles can drop it entirely.\n// Shared CRYSTALS helper in the ML-KEM branch: Kyber mode, 7-bit bit-reversal,\n// and Uint16Array polys because current coefficients stay reduced modulo q.\nconst crystals = /* @__PURE__ */ genCrystals({\n    N,\n    Q,\n    F,\n    ROOT_OF_UNITY,\n    newPoly: (n) => new Uint16Array(n),\n    brvBits: 7,\n    isKyber: true,\n});\n/** Internal params of ML-KEM versions */\n// prettier-ignore\n/** Built-in ML-KEM parameter presets keyed by the public export names\n * `ml_kem512` / `ml_kem768` / `ml_kem1024`.\n * `RBGstrength` is Table 2's required randomness-source strength in bits,\n * not a generic security label.\n */\nexport const PARAMS = /* @__PURE__ */ (() => Object.freeze({\n    512: Object.freeze({ N, Q, K: 2, ETA1: 3, ETA2: 2, du: 10, dv: 4, RBGstrength: 128 }),\n    768: Object.freeze({ N, Q, K: 3, ETA1: 2, ETA2: 2, du: 10, dv: 4, RBGstrength: 192 }),\n    1024: Object.freeze({ N, Q, K: 4, ETA1: 2, ETA2: 2, du: 11, dv: 5, RBGstrength: 256 }),\n}))();\n// FIPS-203: compress/decompress\nconst compress = (d) => {\n    // d=12 is the ByteEncode12/ByteDecode12 path, not lossy compression.\n    // ByteDecode12 interprets each 12-bit word modulo q; without that reduction the public-key\n    // modulus check in encapsulate() becomes a no-op for malformed coefficients like 4095.\n    if (d >= 12)\n        return { encode: (i) => i, decode: (i) => (i >= Q ? i - Q : i) };\n    // Comments map to python implementation in RFC (draft-cfrg-schwabe-kyber)\n    // const round = (i: number) => Math.floor(i + 0.5) | 0;\n    const a = 2 ** (d - 1);\n    return {\n        // This only matches standalone Compress_d after bitsCoder masks the result into Z_(2^d).\n        encode: (i) => ((i << d) + Q / 2) / Q,\n        // const decompress = (i: number) => round((Q / 2 ** d) * i);\n        decode: (i) => (i * Q + a) >>> d,\n    };\n};\n// Raw ByteEncode_d / ByteDecode_d from FIPS 203 operate on d-bit words directly.\n// That differs from `polyCoder(d)` for d<12, where noble folds packing together with the lossy\n// ciphertext compression step used by u/v. Tests that exercise the spec's raw packing surface need\n// this exact non-lossy variant instead.\nconst byteCoder = (d) => crystals.bitsCoder(d, d === 12\n    ? { encode: (i) => i, decode: (i) => (i >= Q ? i - Q : i) }\n    : { encode: (i) => i, decode: (i) => i });\n// NOTE: we merge encoding and compress because it is faster, also both require same d param\n// d=12 is the ByteEncode12/ByteDecode12 path rather than compression, and caller-side\n// public-key modulus checks route through this helper's decode/encode roundtrip.\n// Converts between bytes and d-bits compressed representation.\n// Kinda like convertRadix2 from @scure/base.\n// decode(encode(t)) == t, but there is loss of information on encode(decode(t))\nconst polyCoder = (d) => (d === 12 ? byteCoder(12) : crystals.bitsCoder(d, compress(d)));\n// Coefficients always stay reduced in [0, Q) here (samplers, NTT and coders all reduce),\n// so one conditional correction replaces the generic mod().\nfunction polyAdd(a_, b_) {\n    const a = a_;\n    const b = b_;\n    // Mutates `a` in place; callers must pass two N=256 polynomials.\n    for (let i = 0; i < N; i++) {\n        const r = a[i] + b[i]; // a += b\n        a[i] = r >= Q ? r - Q : r;\n    }\n}\nfunction polySub(a_, b_) {\n    const a = a_;\n    const b = b_;\n    // Mutates `a` in place; callers must pass two N=256 polynomials.\n    for (let i = 0; i < N; i++) {\n        const r = a[i] - b[i]; // a -= b\n        a[i] = r < 0 ? r + Q : r;\n    }\n}\n// FIPS-203: Computes the product of two degree-one polynomials with respect to a quadratic modulus\nfunction BaseCaseMultiply(a0, a1, b0, b1, zeta) {\n    // `zeta` here is Algorithm 11's γ = ζ^(2BitRev_7(i)+1).\n    // Reduce a1*b1 before multiplying by zeta: a1*b1*zeta would reach ~2^35, forcing JS engines\n    // into slow float fmod; with the extra reduction every intermediate fits int32.\n    const c0 = crystals.mod(crystals.mod(a1 * b1) * zeta + a0 * b0);\n    const c1 = crystals.mod(a0 * b1 + a1 * b0);\n    return { c0, c1 };\n}\n// FIPS-203: Computes the product (in the ring Tq) of two NTT representations.\n// Works in place on `f`; `g` is read-only and both inputs must already be in NTT form.\nfunction MultiplyNTTs(f_, g_) {\n    const f = f_;\n    const g = g_;\n    for (let i = 0; i < N / 2; i++) {\n        let z = crystals.nttZetas[64 + (i >> 1)];\n        if (i & 1)\n            z = -z;\n        const { c0, c1 } = BaseCaseMultiply(f[2 * i + 0], f[2 * i + 1], g[2 * i + 0], g[2 * i + 1], z);\n        f[2 * i + 0] = c0;\n        f[2 * i + 1] = c1;\n    }\n    return f;\n}\n// Return poly in NTT representation\nfunction SampleNTT(xof_) {\n    const xof = xof_;\n    // The reader must already bind the Algorithm 7 seed||j||i bytes\n    // and return block lengths divisible by 3.\n    const r = new Uint16Array(N);\n    for (let j = 0; j < N;) {\n        const b = xof();\n        if (b.length % 3)\n            throw new Error('SampleNTT: unaligned block');\n        for (let i = 0; j < N && i + 3 <= b.length; i += 3) {\n            const d1 = ((b[i + 0] >> 0) | (b[i + 1] << 8)) & 0xfff;\n            const d2 = ((b[i + 1] >> 4) | (b[i + 2] << 4)) & 0xfff;\n            if (d1 < Q)\n                r[j++] = d1;\n            if (j < N && d2 < Q)\n                r[j++] = d2;\n        }\n    }\n    return r;\n}\n// Sampling from the centered binomial distribution\n// Returns poly with small coefficients (noise/errors) stored modulo q in ordinary coefficient form.\n// Current callers only use Table 2 eta values {2,3} and PRF outputs of exactly 64*eta bytes.\nconst sampleCBDBytes = (buf, eta) => {\n    const r = new Uint16Array(N);\n    // CBD consumes the PRF bitstream in little-endian byte order; normalize the word view on BE,\n    // then swap it back so callers still observe `buf` as read-only.\n    const b32 = u32(buf);\n    swap32IfBE(b32);\n    let len = 0;\n    for (let i = 0, p = 0, bb = 0, t0 = 0; i < b32.length; i++) {\n        let b = b32[i];\n        for (let j = 0; j < 32; j++) {\n            bb += b & 1;\n            b >>= 1;\n            len += 1;\n            if (len === eta) {\n                t0 = bb;\n                bb = 0;\n            }\n            else if (len === 2 * eta) {\n                r[p++] = crystals.mod(t0 - bb);\n                bb = 0;\n                len = 0;\n            }\n        }\n    }\n    swap32IfBE(b32);\n    if (len)\n        throw new Error(`sampleCBD: leftover bits: ${len}`);\n    return r;\n};\nfunction sampleCBD(PRF_, seed, nonce, eta) {\n    const PRF = PRF_;\n    return sampleCBDBytes(PRF((eta * N) / 4, seed, nonce), eta);\n}\n// K-PKE\n// Internal ML-KEM subroutine only: exact 32-byte `seed` / `msg` inputs\n// come from Algorithms 13-15, and the helper mutates decoded temporary\n// polynomials in place while leaving caller byte arrays unchanged.\nconst genKPKE = (opts_) => {\n    const opts = opts_;\n    const { K, PRF, XOF, HASH512, ETA1, ETA2, du, dv } = opts;\n    const poly1 = polyCoder(1);\n    const polyV = polyCoder(dv);\n    const polyU = polyCoder(du);\n    const publicCoder = splitCoder('publicKey', vecCoder(polyCoder(12), K), 32);\n    const secretCoder = vecCoder(polyCoder(12), K);\n    const cipherCoder = splitCoder('ciphertext', vecCoder(polyU, K), polyV);\n    const seedCoder = splitCoder('seed', 32, 32);\n    // Algorithm 14 (K-PKE.Encrypt) core, after ek parsing. `tHat` and every poly returned by\n    // `getA(i, j)` are treated as disposable scratch: they are mutated in place and wiped/dropped,\n    // so callers holding cached copies must pass fresh copies.\n    const encryptCore = (tHat, getA, msg, seed) => {\n        const rHat = [];\n        for (let i = 0; i < K; i++)\n            rHat.push(crystals.NTT.encode(sampleCBD(PRF, seed, i, ETA1)));\n        const tmp2 = new Uint16Array(N);\n        const u = [];\n        for (let i = 0; i < K; i++) {\n            const e1 = sampleCBD(PRF, seed, K + i, ETA2);\n            const tmp = new Uint16Array(N);\n            for (let j = 0; j < K; j++) {\n                const aij = getA(i, j); // A[j][i], inplace transpose access\n                polyAdd(tmp, MultiplyNTTs(aij, rHat[j])); // t += aij * rHat[j]\n            }\n            polyAdd(e1, crystals.NTT.decode(tmp)); // e1 += tmp\n            u.push(e1);\n            polyAdd(tmp2, MultiplyNTTs(tHat[i], rHat[i])); // t2 += tHat[i] * rHat[i]\n            cleanBytes(tmp);\n        }\n        const e2 = sampleCBD(PRF, seed, 2 * K, ETA2);\n        polyAdd(e2, crystals.NTT.decode(tmp2)); // e2 += tmp2\n        const v = poly1.decode(msg); // encode plaintext m into polynomial v\n        polyAdd(v, e2); // v += e2\n        cleanBytes(tHat, rHat, tmp2, e2);\n        return cipherCoder.encode([u, v]);\n    };\n    return {\n        secretCoder,\n        lengths: {\n            secretKey: secretCoder.bytesLen,\n            publicKey: publicCoder.bytesLen,\n            cipherText: cipherCoder.bytesLen,\n        },\n        keygen: (seed) => {\n            abytes(seed, 32, 'seed');\n            const seedDst = new Uint8Array(33);\n            seedDst.set(seed);\n            // FIPS 203 Algorithm 13 appends the parameter-set byte `k`\n            // before `G(d || k)`, so expanding the same 32-byte seed\n            // under a different ML-KEM parameter set yields unrelated keys.\n            seedDst[32] = K;\n            const seedHash = HASH512(seedDst);\n            const [rho, sigma] = seedCoder.decode(seedHash);\n            const sHat = [];\n            const tHat = [];\n            for (let i = 0; i < K; i++)\n                sHat.push(crystals.NTT.encode(sampleCBD(PRF, sigma, i, ETA1)));\n            const x = XOF(rho);\n            for (let i = 0; i < K; i++) {\n                const e = crystals.NTT.encode(sampleCBD(PRF, sigma, K + i, ETA1));\n                for (let j = 0; j < K; j++) {\n                    const aji = SampleNTT(x.get(j, i)); // A[i][j], inplace\n                    polyAdd(e, MultiplyNTTs(aji, sHat[j]));\n                }\n                tHat.push(e); // t ← A ◦ s + e\n            }\n            x.clean();\n            const res = {\n                publicKey: publicCoder.encode([tHat, rho]),\n                secretKey: secretCoder.encode(sHat),\n            };\n            cleanBytes(rho, sigma, sHat, tHat, seedDst, seedHash);\n            return res;\n        },\n        encrypt: (publicKey, msg, seed) => {\n            const [tHat, rho] = publicCoder.decode(publicKey);\n            const x = XOF(rho);\n            const res = encryptCore(tHat, (i, j) => SampleNTT(x.get(i, j)), msg, seed);\n            x.clean();\n            return res;\n        },\n        // Expands the full Â matrix (public data derived from rho) once, so repeated encryptions\n        // against the same ek skip the K² SampleNTT XOF expansions. Cached polys are copied per\n        // call because encryptCore mutates its inputs in place.\n        prepare: (publicKey) => {\n            const [tHat, rho] = publicCoder.decode(publicKey);\n            const x = XOF(rho);\n            const A = [];\n            for (let i = 0; i < K; i++)\n                for (let j = 0; j < K; j++)\n                    A.push(SampleNTT(x.get(i, j)));\n            x.clean();\n            return {\n                encrypt: (msg, seed) => encryptCore(tHat.map((p) => p.slice()), (i, j) => A[i * K + j].slice(), msg, seed),\n                clean: () => cleanBytes(tHat, A),\n            };\n        },\n        decrypt: (cipherText, privateKey) => {\n            const [u, v] = cipherCoder.decode(cipherText);\n            const sk = secretCoder.decode(privateKey); // s  ← ByteDecode_12(dkPKE)\n            const tmp = new Uint16Array(N);\n            // tmp += sk[i] * u[i]\n            for (let i = 0; i < K; i++)\n                polyAdd(tmp, MultiplyNTTs(sk[i], crystals.NTT.encode(u[i])));\n            polySub(v, crystals.NTT.decode(tmp)); // w = v' - tmp\n            // `v` now holds w, from which the plaintext is just a 1-bit threshold away, so wipe it too.\n            // encode() allocates its own buffer, so the returned bytes do not alias `v`.\n            const res = poly1.encode(v);\n            cleanBytes(tmp, sk, u, v);\n            return res;\n        },\n    };\n};\n/**\n * Public ML-KEM wrapper over the internal K-PKE subroutine.\n * `keygen(seed)` and `encapsulate(publicKey, msg)` are deterministic/test-oriented hooks that map\n * more directly to Algorithms 16-17 than to the pure no-input / random-internal Algorithms 19-20.\n * `encapsulate`'s optional `msg` is the 32-byte message randomness `m` of Algorithm 17, the\n * pre-image the shared secret is derived from, NOT a plaintext to encrypt: ML-KEM is a key\n * encapsulation mechanism, not a cipher. Omit it to draw fresh randomness; pass it only to\n * reproduce a known-answer vector, and only as 32 uniformly random bytes, since a low-entropy or\n * reused value makes the shared secret predictable. The same holds for `keygen`'s optional `seed`.\n * decapsulate() tries to follow the Algorithms 18/21 implicit-reject structure as closely as\n * practical here by re-encrypting, comparing ciphertexts, returning `Khat` on match or `Kbar` on\n * mismatch, and zeroizing the non-returned shared-secret candidate; JS/JIT still provides no\n * constant-time guarantees for that path.\n */\nfunction createKyber(opts) {\n    const rawOpts = opts;\n    const KPKE = genKPKE(rawOpts);\n    const { HASH256, HASH512, KDF } = rawOpts;\n    const { secretCoder: KPKESecretCoder, lengths } = KPKE;\n    const secretCoder = splitCoder('secretKey', lengths.secretKey, lengths.publicKey, 32, 32);\n    const msgLen = 32;\n    const seedLen = 64;\n    // FIPS-203 includes additional verification check for modulus\n    const validateModulus = (publicKey, fn) => {\n        const eke = publicKey.subarray(0, 384 * rawOpts.K);\n        // Copy because of inplace encoding\n        const ek = KPKESecretCoder.encode(KPKESecretCoder.decode(copyBytes(eke)));\n        // (Modulus check.) Perform the computation ek ← ByteEncode12(ByteDecode12(eke)).\n        // If ek = ̸ eke, the input is invalid. (See Section 4.2.1.)\n        const ok = equalBytes(ek, eke);\n        cleanBytes(ek);\n        if (!ok)\n            throw new Error(`ML-KEM.${fn}: wrong publicKey modulus`);\n    };\n    const kemLengths = Object.freeze({\n        ...lengths,\n        seed: 64,\n        msg: msgLen,\n        msgRand: msgLen,\n        secretKey: secretCoder.bytesLen,\n    });\n    return Object.freeze({\n        info: Object.freeze({ type: 'ml-kem' }),\n        lengths: kemLengths,\n        keygen: (seed) => {\n            // A generated seed carries z (the implicit-rejection secret) and must be wiped once the\n            // secret key holds a copy, matching ml-dsa / slh-dsa / falcon keygen. A caller-supplied\n            // seed is the caller's to manage (and the immutability test requires it stay untouched).\n            const ownSeed = seed === undefined;\n            const s = ownSeed ? randomBytes(seedLen) : seed;\n            let sk;\n            let publicKeyHash;\n            try {\n                abytes(s, seedLen, 'seed');\n                const keys = KPKE.keygen(s.subarray(0, 32));\n                const publicKey = keys.publicKey;\n                sk = keys.secretKey;\n                publicKeyHash = HASH256(publicKey);\n                // (dkPKE||ek||H(ek)||z)\n                const secretKey = secretCoder.encode([sk, publicKey, publicKeyHash, s.subarray(32)]);\n                return {\n                    publicKey: publicKey,\n                    secretKey: secretKey,\n                };\n            }\n            finally {\n                if (sk !== undefined)\n                    cleanBytes(sk);\n                if (publicKeyHash !== undefined)\n                    cleanBytes(publicKeyHash);\n                if (ownSeed)\n                    cleanBytes(s);\n            }\n        },\n        getPublicKey: (secretKey) => {\n            const [_sk, publicKey, _publicKeyHash, _z] = secretCoder.decode(secretKey);\n            return Uint8Array.from(publicKey);\n        },\n        encapsulate: (publicKey, msg) => {\n            // A generated message is the preimage of the shared secret (K = G(m || H(ek))[0:32]) and\n            // must be wiped. A caller-supplied message is the deterministic-randomness hook and the\n            // caller's to manage (the immutability test requires it stay untouched).\n            const ownMsg = msg === undefined;\n            const m = ownMsg ? randomBytes(msgLen) : msg;\n            let kr;\n            try {\n                abytes(publicKey, lengths.publicKey, 'publicKey');\n                abytes(m, msgLen, 'message');\n                validateModulus(publicKey, 'encapsulate');\n                // derive randomness\n                kr = HASH512.create().update(m).update(HASH256(publicKey)).digest();\n                const cipherText = KPKE.encrypt(publicKey, m, kr.subarray(32, 64));\n                return {\n                    cipherText: cipherText,\n                    sharedSecret: kr.subarray(0, 32),\n                };\n            }\n            finally {\n                if (kr !== undefined)\n                    cleanBytes(kr.subarray(32));\n                if (ownMsg)\n                    cleanBytes(m);\n            }\n        },\n        decapsulate: (cipherText, secretKey) => {\n            abytes(secretKey, secretCoder.bytesLen, 'secretKey'); // 768*k + 96\n            abytes(cipherText, lengths.cipherText, 'cipherText'); // 32(du*k + dv)\n            // test ← H(dk[384𝑘 ∶ 768𝑘 + 32])) .\n            const k768 = secretCoder.bytesLen - 96;\n            const start = k768 + 32;\n            const test = HASH256(secretKey.subarray(k768 / 2, start));\n            // If test ≠ dk[768𝑘 + 32 ∶ 768𝑘 + 64], then input checking has failed.\n            if (!equalBytes(test, secretKey.subarray(start, start + 32)))\n                throw new Error('invalid secretKey: hash check failed');\n            const [sk, publicKey, publicKeyHash, z] = secretCoder.decode(secretKey);\n            const msg = KPKE.decrypt(cipherText, sk);\n            // derive randomness, Khat, rHat = G(mHat || h)\n            const kr = HASH512.create().update(msg).update(publicKeyHash).digest();\n            const Khat = kr.subarray(0, 32);\n            // re-encrypt using the derived randomness\n            const cipherText2 = KPKE.encrypt(publicKey, msg, kr.subarray(32, 64));\n            // if ciphertexts do not match, “implicitly reject”\n            const isValid = equalBytes(cipherText, cipherText2);\n            const Kbar = KDF.create({ dkLen: 32 }).update(z).update(cipherText).digest();\n            // kr[32:64] is the derived K-PKE encryption randomness: wipe it like encapsulate() does.\n            cleanBytes(msg, cipherText2, kr.subarray(32), !isValid ? Khat : Kbar);\n            return (isValid ? Khat : Kbar);\n        },\n        /**\n         * Experimental prototype: pre-expand a public key so repeated encapsulate/decapsulate\n         * against the same key skip re-validation, H(ek), t̂ decoding and the K² SampleNTT\n         * XOF expansions of Â. Only public data is cached; see {@link KEMPrepared}.\n         */\n        prepare: (publicKey) => {\n            abytes(publicKey, lengths.publicKey, 'publicKey');\n            validateModulus(publicKey, 'prepare');\n            const ek = copyBytes(publicKey); // detach from the caller before caching\n            const publicKeyHash = HASH256(ek);\n            const cached = KPKE.prepare(ek);\n            return Object.freeze({\n                publicKey: ek,\n                encapsulate: (msg) => {\n                    // As in the non-prepared encapsulate: a generated message is the shared-secret\n                    // preimage and is wiped; a caller-supplied one is left untouched.\n                    const ownMsg = msg === undefined;\n                    const m = ownMsg ? randomBytes(msgLen) : msg;\n                    let kr;\n                    try {\n                        abytes(m, msgLen, 'message');\n                        kr = HASH512.create().update(m).update(publicKeyHash).digest();\n                        const cipherText = cached.encrypt(m, kr.subarray(32, 64));\n                        return {\n                            cipherText: cipherText,\n                            sharedSecret: kr.subarray(0, 32),\n                        };\n                    }\n                    finally {\n                        if (kr !== undefined)\n                            cleanBytes(kr.subarray(32));\n                        if (ownMsg)\n                            cleanBytes(m);\n                    }\n                },\n                decapsulate: (cipherText, secretKey) => {\n                    abytes(secretKey, secretCoder.bytesLen, 'secretKey');\n                    abytes(cipherText, lengths.cipherText, 'cipherText');\n                    const [sk, ekEmbedded, storedHash, z] = secretCoder.decode(secretKey);\n                    // Under KEMPrepared's read-only publicKey contract, bind dk to the prepared key.\n                    // Together with publicKeyHash = H(ek) computed in prepare(), this is equivalent to (and\n                    // stronger than) FIPS 203 §7.3's `H(dk[384k : 768k+32]) == dk[768k+32 : 768k+64]`.\n                    if (!equalBytes(ekEmbedded, ek) || !equalBytes(storedHash, publicKeyHash))\n                        throw new Error('ML-KEM.decapsulate: secretKey does not match prepared publicKey');\n                    const msg = KPKE.decrypt(cipherText, sk);\n                    // derive randomness, Khat, rHat = G(mHat || h)\n                    const kr = HASH512.create().update(msg).update(publicKeyHash).digest();\n                    const Khat = kr.subarray(0, 32);\n                    // re-encrypt using the derived randomness and cached Â/t̂\n                    const cipherText2 = cached.encrypt(msg, kr.subarray(32, 64));\n                    // if ciphertexts do not match, “implicitly reject”\n                    const isValid = equalBytes(cipherText, cipherText2);\n                    const Kbar = KDF.create({ dkLen: 32 }).update(z).update(cipherText).digest();\n                    cleanBytes(msg, cipherText2, kr.subarray(32), !isValid ? Khat : Kbar);\n                    return (isValid ? Khat : Kbar);\n                },\n                clean: cached.clean,\n            });\n        },\n    });\n}\n// FIPS 203's PRF_eta binding: current callers use only 32-byte keys, one-byte nonces,\n// and dkLen values {128, 192}; out-of-range nonce numbers still wrap modulo 256 here.\nfunction shakePRF(dkLen, key, nonce) {\n    return shake256\n        .create({ dkLen })\n        .update(key)\n        .update(new Uint8Array([nonce]))\n        .digest();\n}\n// Fixed ML-KEM hash/XOF bindings. `KDF` here is the spec's fixed 32-byte `J` call,\n// and swapping any field changes the scheme rather than tuning an internal dependency.\nconst opts = /* @__PURE__ */ (() => ({\n    HASH256: sha3_256,\n    HASH512: sha3_512,\n    KDF: shake256,\n    XOF: XOF128,\n    PRF: shakePRF,\n}))();\n// Parameter-set instantiation step for the spec's \"ML-KEM-x\" names; current correctness relies\n// on the internal PARAMS rows rather than local validation of arbitrary KEMParam objects.\nconst mk = (params) => createKyber({\n    ...opts,\n    ...params,\n});\n/**\n * ML-KEM-512: Table 2 row `k=2, η1=3, η2=2, du=10, dv=4`; Table 3 sizes `800/1632/768/32`.\n * The ASD lifecycle note here is external policy guidance, not a FIPS 203 requirement.\n * @example\n * Generate deterministic ML-KEM-512 keys, encapsulate a shared secret, and decapsulate it.\n * ```ts\n * import { ml_kem512 } from '@noble/post-quantum/ml-kem.js';\n * const seed = new Uint8Array(ml_kem512.lengths.seed!);\n * const { secretKey, publicKey } = ml_kem512.keygen(seed);\n * const msg = new Uint8Array(ml_kem512.lengths.msgRand!);\n * const { cipherText, sharedSecret } = ml_kem512.encapsulate(publicKey, msg);\n * const recovered = ml_kem512.decapsulate(cipherText, secretKey);\n * const publicKey2 = ml_kem512.getPublicKey(secretKey);\n * ```\n */\nexport const ml_kem512 = /* @__PURE__ */ (() => mk(PARAMS[512]))();\n/**\n * ML-KEM-768: Table 2 row `k=3, η1=2, η2=2, du=10, dv=4`; Table 3 sizes `1184/2400/1088/32`.\n * The ASD lifecycle note here is external policy guidance, not a FIPS 203 requirement.\n */\nexport const ml_kem768 = /* @__PURE__ */ (() => mk(PARAMS[768]))();\n/**\n * ML-KEM-1024: Table 2 row `k=4, η1=2, η2=2, du=11, dv=5`; Table 3 sizes `1568/3168/1568/32`.\n * The ASD lifecycle note here is external policy guidance, not a FIPS 203 requirement.\n */\nexport const ml_kem1024 = /* @__PURE__ */ (() => mk(PARAMS[1024]))();\n// NOTE: for tests only, don't use. This keeps the exact internal ML-KEM math surfaces available\n// without re-implementing them in separate test code.\nexport const __tests = /* @__PURE__ */ (() => Object.freeze({\n    Compress_d: (x, d) => {\n        if (d < 1 || d > 11)\n            throw new Error(`Compress_d: expected d in [1..11], got ${d}`);\n        return compress(d).encode(x) & getMask(d);\n    },\n    Decompress_d: (y, d) => {\n        if (d < 1 || d > 11)\n            throw new Error(`Decompress_d: expected d in [1..11], got ${d}`);\n        return compress(d).decode(y);\n    },\n    ByteEncode_d: (F, d) => {\n        if (d < 1 || d > 12)\n            throw new Error(`ByteEncode_d: expected d in [1..12], got ${d}`);\n        return byteCoder(d).encode(F);\n    },\n    ByteDecode_d: (B, d) => {\n        if (d < 1 || d > 12)\n            throw new Error(`ByteDecode_d: expected d in [1..12], got ${d}`);\n        return byteCoder(d).decode(B);\n    },\n    NTT: (f) => crystals.NTT.encode(Uint16Array.from(f)),\n    NTT_inv: (fHat) => crystals.NTT.decode(Uint16Array.from(fHat)),\n    MultiplyNTTs: (fHat, gHat) => MultiplyNTTs(Uint16Array.from(fHat), Uint16Array.from(gHat)),\n    SamplePolyCBD: (B, eta) => {\n        abytes(B, 64 * eta, 'B');\n        return sampleCBDBytes(B, eta);\n    },\n    SampleNTT: (B) => {\n        abytes(B, 34, 'B');\n        const xof = XOF128(B.subarray(0, 32));\n        try {\n            return SampleNTT(xof.get(B[32], B[33]));\n        }\n        finally {\n            xof.clean();\n        }\n    },\n}))();\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport JsSHA from 'jssha'\nimport {\n  chunkSubstr,\n  isHex,\n  randomString\n} from './libraries/strings.js'\nimport {\n  generateBatchId,\n  generateBundleHash,\n  generateSecret,\n  shake256\n} from './libraries/crypto.js'\nimport TokenUnit from './TokenUnit.js'\nimport WalletCredentialException from './exception/WalletCredentialException.js'\nimport { ml_kem768 as MlKEM768, ml_kem1024 as MlKEM1024 } from '@noble/post-quantum/ml-kem.js'\n\nconst ML_KEM_PARAMS = {\n  1024: { kem: MlKEM1024, pkBytes: 1568, skBytes: 3168, ctBytes: 1568 },\n  768: { kem: MlKEM768, pkBytes: 1184, skBytes: 2400, ctBytes: 1088 }\n}\nconst DEFAULT_ML_KEM_PARAMETER_SET = 1024\n\n/**\n * Wallet class represents the set of public and private\n * keys to sign Molecules\n */\nexport default class Wallet {\n  /**\n   * Class constructor\n   *\n   * @param {string|null} secret - typically a 2048-character biometric hash\n   * @param {string|null} bundle - 64-character hexadecimal user identifier\n   * @param {string} token - slug for the token this wallet is intended for\n   * @param {string|null} address - hexadecimal public key for the signature of this wallet\n   * @param {string|null} position - hexadecimal string used to salt the secret and produce one-time signatures\n   * @param {string|null} batchId\n   * @param {string|null} characters\n   */\n  constructor ({\n    secret = null,\n    bundle = null,\n    token = 'USER',\n    address = null,\n    position = null,\n    batchId = null,\n    characters = null,\n    mlKemParameterSet = DEFAULT_ML_KEM_PARAMETER_SET\n  }) {\n    const paramSetNum = Number(mlKemParameterSet)\n    if (!ML_KEM_PARAMS[paramSetNum]) {\n      throw new Error(`KnishIO: unsupported ML-KEM parameter set ${mlKemParameterSet}; expected 1024 or 768.`)\n    }\n    this.mlKemParameterSet = paramSetNum\n    this.token = token\n    this.balance = '0'\n    this.molecules = {}\n\n    // Empty values\n    this.key = null\n    this.privkey = null\n    this.pubkey = null\n    this.tokenUnits = []\n    this.tradeRates = {}\n\n    this.address = address\n    this.position = position\n    this.bundle = bundle\n    this.batchId = batchId\n    this.characters = characters\n\n    if (secret) {\n      // Set bundle from the secret\n      this.bundle = this.bundle || generateBundleHash(secret, 'Wallet::constructor')\n\n      // Generate a position for non-shadow wallet if not initialized\n      this.position = this.position || Wallet.generatePosition()\n\n      // Key & address initialization\n      this.key = Wallet.generateKey({\n        secret,\n        token: this.token,\n        position: this.position\n      })\n      this.address = this.address || Wallet.generateAddress(this.key)\n\n      // Set characters\n      this.characters = this.characters || 'BASE64'\n\n      // Initialize ML-KEM keys\n      this.initializeMLKEM()\n    }\n  }\n\n  /**\n   * Creates a new Wallet instance\n   *\n   * @param {string|null} secret\n   * @param {string|null} bundle\n   * @param {string} token\n   * @param {string|null} batchId\n   * @param {string|null} characters\n   * @return {Wallet}\n   */\n  static create ({\n    secret = null,\n    bundle = null,\n    token,\n    batchId = null,\n    characters = null,\n    mlKemParameterSet = DEFAULT_ML_KEM_PARAMETER_SET\n  }) {\n    let position = null\n\n    // No credentials parameters provided?\n    if (!secret && !bundle) {\n      throw new WalletCredentialException()\n    }\n\n    // Secret, but no bundle?\n    if (secret && !bundle) {\n      position = Wallet.generatePosition()\n      bundle = generateBundleHash(secret, 'Wallet::create')\n    }\n\n    // Wallet initialization\n    return new Wallet({\n      secret,\n      bundle,\n      token,\n      position,\n      batchId,\n      characters,\n      mlKemParameterSet\n    })\n  }\n\n  /**\n   * Determines if the provided string is a bundle hash\n   *\n   * @param {string} maybeBundleHash\n   * @return {boolean}\n   */\n  static isBundleHash (maybeBundleHash) {\n    if (typeof maybeBundleHash !== 'string') {\n      return false\n    }\n\n    return maybeBundleHash.length === 64 && isHex(maybeBundleHash)\n  }\n\n  /**\n   * Get formatted token units from the raw data\n   *\n   * @param unitsData\n   * @return {[]}\n   */\n  static getTokenUnits (unitsData) {\n    const result = []\n    unitsData.forEach(unitData => {\n      result.push(TokenUnit.createFromDB(unitData))\n    })\n    return result\n  }\n\n  /**\n   * Generates a private key for the given parameters\n   *\n   * @param {string} secret\n   * @param {string} token\n   * @param {string} position\n   * @return {string}\n   */\n  static generateKey ({\n    secret,\n    token,\n    position\n  }) {\n    if (!secret) {\n      throw new WalletCredentialException('Wallet::generateKey() - Secret is required!')\n    }\n    if (!position) {\n      throw new WalletCredentialException('Wallet::generateKey() - Position is required!')\n    }\n\n    // Normalize non-hex secret via SHAKE256 (matching Rust/Kotlin behavior)\n    const secretHex = isHex(secret) ? secret : shake256(secret, 1024)\n    // Normalize non-hex position via SHAKE256\n    const positionHex = isHex(position) ? position : shake256(position, 256)\n\n    // Converting secret to bigInt\n    const bigIntSecret = BigInt(`0x${ secretHex }`)\n\n    // Adding new position to the user secret to produce the indexed key\n    const indexedKey = bigIntSecret + BigInt(`0x${ positionHex }`)\n\n    // Hashing the indexed key to produce the intermediate key\n    const intermediateKeySponge = new JsSHA('SHAKE256', 'TEXT')\n\n    intermediateKeySponge.update(indexedKey.toString(16))\n\n    if (token) {\n      intermediateKeySponge.update(token)\n    }\n\n    // Hashing the intermediate key to produce the private key\n    const privateKeySponge = new JsSHA('SHAKE256', 'TEXT')\n    privateKeySponge.update(intermediateKeySponge.getHash('HEX', { outputLen: 8192 }))\n    return privateKeySponge.getHash('HEX', { outputLen: 8192 })\n  }\n\n  /**\n   * Generates a wallet address\n   *\n   * @param {string} key\n   * @return {string}\n   */\n  static generateAddress (key) {\n    // Subdivide private key into 16 fragments of 128 characters each\n    const keyFragments = chunkSubstr(key, 128)\n    // Generating wallet digest\n    const digestSponge = new JsSHA('SHAKE256', 'TEXT')\n\n    for (const index in keyFragments) {\n      let workingFragment = keyFragments[index]\n      for (let fragmentCount = 1; fragmentCount <= 16; fragmentCount++) {\n        const workingSponge = new JsSHA('SHAKE256', 'TEXT')\n        workingSponge.update(workingFragment)\n        workingFragment = workingSponge.getHash('HEX', { outputLen: 512 })\n      }\n\n      digestSponge.update(workingFragment)\n    }\n\n    // Producing wallet address\n    const outputSponge = new JsSHA('SHAKE256', 'TEXT')\n    outputSponge.update(digestSponge.getHash('HEX', { outputLen: 8192 }))\n    return outputSponge.getHash('HEX', { outputLen: 256 })\n  }\n\n  /**\n   *\n   * @param saltLength\n   * @returns {string}\n   */\n  static generatePosition (saltLength = 64) {\n    return randomString(saltLength, 'abcdef0123456789')\n  }\n\n  /**\n   * Derive an ML-KEM keypair for an arbitrary parameter set from the wallet's key seed.\n   *\n   * Returns `null` when the wallet holds no key — a secret-less wallet, which is what\n   * {@link Molecule.fromJSON} builds for validation context. `generateSecret(null, …)` does NOT\n   * throw, so without this the wallet would derive a plausible-looking identity from a bogus seed\n   * and fail three layers down at AES-GCM instead of at the missing key. The guard lives here\n   * rather than at each call site so a new caller cannot miss it.\n   *\n   * @param {number} parameterSet - 1024 or 768\n   * @return {{pubkey: string, privkey: Uint8Array, params: object}|null}\n   */\n  _deriveMlKemKeypair (parameterSet) {\n    const params = ML_KEM_PARAMS[parameterSet]\n    if (!params) {\n      throw new Error(`KnishIO: unsupported ML-KEM parameter set ${parameterSet}; expected 1024 or 768.`)\n    }\n    if (!this.key) {\n      return null\n    }\n    const seedHex = generateSecret(this.key, 128) // 128 hex chars = 64 bytes\n    const seed = new Uint8Array(64)\n    for (let i = 0; i < 64; i++) {\n      seed[i] = parseInt(seedHex.substr(i * 2, 2), 16)\n    }\n    const { publicKey, secretKey } = params.kem.keygen(seed)\n    return {\n      pubkey: this.serializeKey(publicKey),\n      privkey: secretKey,\n      params\n    }\n  }\n\n  /**\n   * Initializes the ML-KEM key pair. Only ever reached from the constructor's `secret` branch,\n   * so the derivation cannot come back empty here.\n   */\n  initializeMLKEM () {\n    const derived = this._deriveMlKemKeypair(this.mlKemParameterSet)\n    if (!derived) {\n      return\n    }\n    this.pubkey = derived.pubkey\n    this.privkey = derived.privkey\n  }\n\n  serializeKey (key) {\n    if (typeof Buffer !== 'undefined') {\n      return Buffer.from(key).toString('base64')\n    }\n    // String.fromCharCode.apply(null, key) overflows the call stack once the\n    // payload exceeds the engine's argument limit (~64K), so convert in chunks.\n    let binary = ''\n    const CHUNK_SIZE = 0x8000\n    for (let i = 0; i < key.length; i += CHUNK_SIZE) {\n      binary += String.fromCharCode(...key.subarray(i, i + CHUNK_SIZE))\n    }\n    return btoa(binary)\n  }\n\n  deserializeKey (serializedKey) {\n    if (typeof Buffer !== 'undefined') {\n      return new Uint8Array(Buffer.from(serializedKey, 'base64'))\n    }\n    const binaryString = atob(serializedKey)\n    return new Uint8Array(binaryString.length).map((_, i) => binaryString.charCodeAt(i))\n  }\n\n  /**\n   * ML-KEM parameter set implied by a serialized public key's raw byte length. FIPS 203's\n   * key lengths are disjoint (1568 bytes → ML-KEM-1024, 1184 bytes → ML-KEM-768), so a stored\n   * peer key recovers the parameter set of the session it belongs to without a wire-format\n   * change. Used by {@link AuthToken.restore} to resolve a snapshot that predates the field.\n   *\n   * @param {string|null} pubkey - Base64-serialized ML-KEM public key\n   * @return {number|null} 1024, 768, or null when the length matches neither\n   */\n  static mlKemParameterSetFromPubkey (pubkey) {\n    if (!pubkey) {\n      return null\n    }\n    let byteLength\n    try {\n      byteLength = typeof Buffer !== 'undefined'\n        ? Buffer.from(pubkey, 'base64').length\n        : atob(pubkey).length\n    } catch (e) {\n      return null\n    }\n    for (const [set, params] of Object.entries(ML_KEM_PARAMS)) {\n      if (params.pkBytes === byteLength) {\n        return Number(set)\n      }\n    }\n    return null\n  }\n\n  /**\n   * Returns balance as a Number for arithmetic operations.\n   * WARNING: Precision loss for values > 2^53.\n   *\n   * @return {number}\n   */\n  balanceAsNumber () {\n    return Number(this.balance)\n  }\n\n  /**\n   * Returns balance as a BigInt for precision-safe integer arithmetic.\n   * Truncates any fractional component.\n   *\n   * @return {bigint}\n   */\n  balanceAsBigInt () {\n    const str = String(this.balance)\n    const intPart = str.includes('.') ? str.split('.')[0] : str\n    return BigInt(intPart || '0')\n  }\n\n  /**\n   * Sets balance from a BigInt value\n   *\n   * @param {bigint} value\n   */\n  setBalanceBigInt (value) {\n    this.balance = value.toString()\n  }\n\n  /**\n   * Sets balance from a Number value, storing as String\n   *\n   * @param {number} value\n   */\n  setBalanceNumber (value) {\n    this.balance = String(value)\n  }\n\n  /**\n   *\n   * @returns {*[]}\n   */\n  getTokenUnitsData () {\n    const result = []\n    this.tokenUnits.forEach(tokenUnit => {\n      result.push(tokenUnit.toData())\n    })\n    return result\n  }\n\n  /**\n   * Split token units\n   *\n   * @param {array} units\n   * @param remainderWallet\n   * @param recipientWallet\n   */\n  splitUnits (\n    units, // Array: token unit IDs\n    remainderWallet,\n    recipientWallet = null\n  ) {\n    // No units supplied, nothing to split\n    if (units.length === 0) {\n      return\n    }\n\n    // Init recipient & remainder token units\n    const recipientTokenUnits = []\n    const remainderTokenUnits = []\n    this.tokenUnits.forEach(tokenUnit => {\n      if (units.includes(tokenUnit.id)) {\n        recipientTokenUnits.push(tokenUnit)\n      } else {\n        remainderTokenUnits.push(tokenUnit)\n      }\n    })\n\n    // Reset token units to the sending value\n    this.tokenUnits = recipientTokenUnits\n\n    // Set token units to recipient & remainder\n    if (recipientWallet !== null) {\n      recipientWallet.tokenUnits = recipientTokenUnits\n    }\n    remainderWallet.tokenUnits = remainderTokenUnits\n  }\n\n  /**\n   * Split token units across MULTIPLE recipients (WP line 544).\n   *\n   * The source retains the SENT union (all units leaving), each recipient gets its own subset,\n   * and the remainder gets the KEPT units (those not assigned to any recipient). Mirrors\n   * splitUnits() but N-way: the source's tokenUnits become the union (not a single recipient's\n   * subset) so the source atom carries the full SENT set the validator reads as the authority.\n   *\n   * @param {array[]} recipientUnitLists - array of unit-id arrays, parallel to recipientWallets\n   * @param {Wallet[]} recipientWallets\n   * @param {Wallet} remainderWallet\n   */\n  splitUnitsMulti (\n    recipientUnitLists,\n    recipientWallets,\n    remainderWallet\n  ) {\n    // The union of all unit ids leaving the source\n    const sentIds = new Set()\n    recipientUnitLists.forEach(unitList => {\n      unitList.forEach(id => sentIds.add(id))\n    })\n\n    // Nothing to split (fungible transfer) — leave token units untouched\n    if (sentIds.size === 0) {\n      return\n    }\n\n    // Each recipient gets its own subset of the source's token units\n    recipientWallets.forEach((recipientWallet, index) => {\n      const ids = recipientUnitLists[index]\n      recipientWallet.tokenUnits = this.tokenUnits.filter(tokenUnit => ids.includes(tokenUnit.id))\n    })\n\n    // The remainder keeps everything not sent to any recipient\n    remainderWallet.tokenUnits = this.tokenUnits.filter(tokenUnit => !sentIds.has(tokenUnit.id))\n\n    // The source carries the SENT union (the ownership authority the validator reads)\n    this.tokenUnits = this.tokenUnits.filter(tokenUnit => sentIds.has(tokenUnit.id))\n  }\n\n  /**\n   * Create a remainder wallet from the source one\n   *\n   * @param secret\n   */\n  createRemainder (secret) {\n    const remainderWallet = Wallet.create({\n      secret,\n      token: this.token,\n      characters: this.characters\n    })\n    remainderWallet.initBatchId({\n      sourceWallet: this,\n      isRemainder: true\n    })\n    return remainderWallet\n  }\n\n  /**\n   * @return boolean\n   */\n  isShadow () {\n    return (\n      (typeof this.position === 'undefined' || this.position === null) &&\n      (typeof this.address === 'undefined' || this.address === null)\n    )\n  }\n\n  /**\n   * Sets up a batch ID - either using the sender's, or a new one\n   *\n   * @param {Wallet} sourceWallet\n   * @param {boolean} isRemainder\n   */\n  initBatchId ({\n    sourceWallet,\n    isRemainder = false\n  }) {\n    if (sourceWallet.batchId) {\n      this.batchId = isRemainder ? sourceWallet.batchId : generateBatchId({})\n    }\n  }\n\n  async encryptMessage (message, recipientPubkey) {\n    const messageString = JSON.stringify(message)\n    const messageUint8 = new TextEncoder().encode(messageString)\n    const deserializedPubkey = this.deserializeKey(recipientPubkey)\n    // ML-KEM public keys are exactly 1568 bytes (ML-KEM-1024) or 1184 bytes (ML-KEM-768). A wrong-length key here\n    // almost always means the node did not advertise an ML-KEM public key in its auth `key` field (e.g. a validator\n    // predating the PQ-transport build). Fail with an actionable message rather than the crypto lib's cryptic\n    // `\"publicKey\" expected Uint8Array of length N, got length=M` assertion.\n    const params = ML_KEM_PARAMS[this.mlKemParameterSet]\n    if (deserializedPubkey.length !== params.pkBytes) {\n      throw new Error(\n        `KnishIO: cannot ML-KEM-encrypt — recipient public key is ${deserializedPubkey.length} bytes, ` +\n        `expected ${params.pkBytes} (ML-KEM-${this.mlKemParameterSet}). The peer is not running ML-KEM-${this.mlKemParameterSet}; ` +\n        'upgrade the peer, or step this client back to the other parameter set.'\n      )\n    }\n    const { cipherText, sharedSecret } = params.kem.encapsulate(deserializedPubkey)\n    const encryptedMessage = await this.encryptWithSharedSecret(messageUint8, sharedSecret)\n    return {\n      cipherText: this.serializeKey(cipherText),\n      encryptedMessage: this.serializeKey(encryptedMessage)\n    }\n  }\n\n  async decryptMessage (encryptedData) {\n    const decryptedString = await this._mlkemDecryptToString(encryptedData)\n    return decryptedString === null ? null : JSON.parse(decryptedString)\n  }\n\n  /**\n   * ML-KEM decapsulate + AES-256-GCM decrypt → the RAW decrypted UTF-8 string\n   * (no JSON.parse). Shared by {@link decryptMessage} (which JSON.parses the result)\n   * and the PQ CipherHash transport ({@link decryptMyMessageML}, which needs the raw\n   * response JSON text). PQ-transport Phase E (cycle 163).\n   */\n  async _mlkemDecryptToString (encryptedData) {\n    const { cipherText, encryptedMessage } = encryptedData\n\n    const deserializedCipherText = this.deserializeKey(cipherText)\n    const configuredParams = ML_KEM_PARAMS[this.mlKemParameterSet]\n    const otherSet = this.mlKemParameterSet === 1024 ? 768 : 1024\n\n    // Inbound is PERMISSIVE: a ciphertext at either parameter set decrypts, provided it is addressed\n    // to one of THIS wallet's own ML-KEM identities. The 64-byte seed is parameter-set-independent,\n    // so the other identity is derived on demand and its private key is released with this call's\n    // scope — never cached on the wallet. Outbound encapsulation stays STRICT (see encryptMessage);\n    // reading a 768 record we own downgrades nothing, but encapsulating at 768 would.\n    let decapsParams = configuredParams\n    let decapsPrivkey = this.privkey\n    if (deserializedCipherText.length !== configuredParams.ctBytes) {\n      if (deserializedCipherText.length !== ML_KEM_PARAMS[otherSet].ctBytes) {\n        console.error(\n          `Wallet::decryptMessage() - Ciphertext length mismatch: got ${deserializedCipherText.length}, expected ${configuredParams.ctBytes}`\n        )\n        return null\n      }\n      // `null` here means the wallet holds no key to derive from (a secret-less validation\n      // wallet); preserve the existing failure observable rather than decapsulating with nothing.\n      const derived = this._deriveMlKemKeypair(otherSet)\n      if (!derived) {\n        console.error(`Wallet::decryptMessage() - cannot derive the ML-KEM-${otherSet} identity: wallet has no key`)\n        return null\n      }\n      decapsParams = derived.params\n      decapsPrivkey = derived.privkey\n    }\n\n    let sharedSecret\n    try {\n      sharedSecret = decapsParams.kem.decapsulate(deserializedCipherText, decapsPrivkey)\n    } catch (e) {\n      console.error('Wallet::decryptMessage() - Decapsulation failed', e)\n      console.info('Wallet::decryptMessage() - my public key', this.pubkey)\n      return null\n    }\n\n    let deserializedEncryptedMessage\n    try {\n      deserializedEncryptedMessage = this.deserializeKey(encryptedMessage)\n    } catch (e) {\n      console.warn('Wallet::decryptMessage() - Deserialization failed', e)\n      console.info('Wallet::decryptMessage() - my public key', this.pubkey)\n      console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)\n      return null\n    }\n\n    let decryptedUint8\n    try {\n      decryptedUint8 = await this.decryptWithSharedSecret(deserializedEncryptedMessage, sharedSecret)\n    } catch (e) {\n      console.warn('Wallet::decryptMessage() - Decryption failed', e)\n      console.info('Wallet::decryptMessage() - my public key', this.pubkey)\n      console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)\n      console.info('Wallet::decryptMessage() - deserialized encrypted message', deserializedEncryptedMessage)\n      return null\n    }\n\n    try {\n      return new TextDecoder().decode(decryptedUint8)\n    } catch (e) {\n      console.warn('Wallet::decryptMessage() - Decoding failed', e)\n      console.info('Wallet::decryptMessage() - my public key', this.pubkey)\n      console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)\n      console.info('Wallet::decryptMessage() - deserialized encrypted message', deserializedEncryptedMessage)\n      console.info('Wallet::decryptMessage() - decrypted Uint8Array', decryptedUint8)\n      return null\n    }\n  }\n\n  /**\n   * Multi-recipient map key for a public key: `Base64_standard(SHAKE256(pubkey_utf8, 8 bytes))`\n   * — matches the validator's `hash_share` and the other SDKs' `hashShare`/`shortHash`.\n   * `shake256(pubkey, 64)` = 64 bits = 8 bytes, hex; hex-decode → standard base64. PQ Phase E.\n   */\n  hashShare (pubkey) {\n    const hex = shake256(pubkey, 64)\n    const bytes = Uint8Array.from(hex.match(/.{2}/g).map(b => parseInt(b, 16)))\n    return this.serializeKey(bytes)\n  }\n\n  /**\n   * Post-quantum (ML-KEM) `CipherHash` request envelope: a stringified single-recipient\n   * map `{ \"<hashShare(recipientPubkey)>\": {cipherText, encryptedMessage} }` (object-valued,\n   * via {@link encryptMessage}). Matches the Rust validator's CipherHash handler. PQ Phase E.\n   */\n  async encryptStringML (message, recipientPubkey) {\n    const envelope = await this.encryptMessage(message, recipientPubkey)\n    return JSON.stringify({ [this.hashShare(recipientPubkey)]: envelope })\n  }\n\n  /**\n   * Decrypt a `CipherHash` response map addressed to THIS wallet's ML-KEM pubkey\n   * (`hashShare(this.pubkey)`) → the RAW decrypted GraphQL response JSON text (NOT JSON.parsed;\n   * it replaces the HTTP response body for the normal parser). `null` if no entry / decrypt fails.\n   */\n  async decryptMyMessageML (map) {\n    let envelope = map[this.hashShare(this.pubkey)]\n    if (!envelope) {\n      // Inbound permissive: try the hash share of the on-demand derived other-set pubkey.\n      // A secret-less wallet derives nothing, so the lookup is simply skipped.\n      const otherSet = this.mlKemParameterSet === 1024 ? 768 : 1024\n      const other = this._deriveMlKemKeypair(otherSet)\n      if (other) {\n        envelope = map[this.hashShare(other.pubkey)]\n      }\n    }\n    if (!envelope) {\n      return null\n    }\n    return this._mlkemDecryptToString(envelope)\n  }\n\n  async encryptWithSharedSecret (message, sharedSecret) {\n    const iv = crypto.getRandomValues(new Uint8Array(12))\n    const algorithm = { name: 'AES-GCM', iv }\n\n    // Convert the shared secret to a CryptoKey\n    const key = await crypto.subtle.importKey(\n      'raw',\n      sharedSecret,\n      { name: 'AES-GCM' },\n      false,\n      ['encrypt']\n    )\n\n    // Encrypt the message\n    const encryptedContent = await crypto.subtle.encrypt(\n      algorithm,\n      key,\n      message\n    )\n\n    // Combine IV and encrypted content\n    const result = new Uint8Array(iv.length + encryptedContent.byteLength)\n    result.set(iv)\n    result.set(new Uint8Array(encryptedContent), iv.length)\n\n    return result\n  }\n\n  /**\n   * Decrypts the given message using the shared secret\n   * @param encryptedMessage\n   * @param sharedSecret\n   * @returns {Promise<Uint8Array>}\n   */\n  async decryptWithSharedSecret (encryptedMessage, sharedSecret) {\n    // Extract IV from the encrypted message\n    const iv = encryptedMessage.slice(0, 12)\n    const algorithm = { name: 'AES-GCM', iv }\n\n    // Convert the shared secret to a CryptoKey\n    const key = await crypto.subtle.importKey(\n      'raw',\n      sharedSecret,\n      { name: 'AES-GCM' },\n      false,\n      ['decrypt']\n    )\n\n    // Decrypt the message\n    const decryptedContent = await crypto.subtle.decrypt(\n      algorithm,\n      key,\n      encryptedMessage.slice(12)\n    )\n\n    return new Uint8Array(decryptedContent)\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Atoms must have an index so that they can be sorted in a Molecule\n */\nexport default class AtomIndexException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'There is an atom without an index', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'AtomIndexException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Molecular hash does not match - contents may have been tampered with\n */\nexport default class MolecularHashMismatchException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'The molecular hash does not match', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'MolecularHashMismatchException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * A molecular hash is always required.\n */\nexport default class MolecularHashMissingException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'The molecular hash is missing', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'MolecularHashMissingException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Exception for bad GraphQL responses\n */\nexport default class PolicyInvalidException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = '', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'PolicyInvalidException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when a molecular signature is malformed\n */\nexport default class SignatureMalformedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'OTS malformed', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'SignatureMalformedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when signature does not match the public key\n */\nexport default class SignatureMismatchException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'One-time signature (OTS) does not match!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'SignatureMismatchException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when you try to transfer more tokens than you have available\n */\nexport default class TransferBalanceException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Insufficient balance to make transfer', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferBalanceException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when V isotope atoms are arranged incorrectly\n */\nexport default class TransferMalformedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Token transfer atoms are malformed', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferMalformedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when the token slugs of wallets involved in a transfer do not match\n */\nexport default class TransferMismatchedException extends BaseException {\n  /**\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Token slugs for wallets in transfer do not match!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferMismatchedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when the remainder atom in a V isotope transfer is incorrect\n */\nexport default class TransferRemainderException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Invalid remainder provided', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferRemainderException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when attempting to transfer tokens to yourself\n */\nexport default class TransferToSelfException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Sender and recipient(s) cannot be the same', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferToSelfException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when V isotope atom amounts do not add up to zero\n */\nexport default class TransferUnbalancedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Token transfer atoms are unbalanced', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferUnbalancedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * M isotope atoms must always contain metadata\n */\nexport default class MetaMissingException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Empty meta data.', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'MetaMissingException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when trying to use an inappropriate token slug for a particular isotope\n */\nexport default class WrongTokenTypeException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Wrong type of token for this isotope', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'WrongTokenTypeException'\n  }\n}\n","import BaseException from './BaseException.js'\n\n/**\n * Generic code exception\n */\nexport default class BatchIdException extends BaseException {\n  /**\n   * @param {string|null} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Incorrect BatchId', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'BatchIdException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nexport default class Meta {\n  constructor (args = {}) {\n    for (const key in args) {\n      this[`__${ key }`] = args[key]\n    }\n  }\n\n  static toObject (object) {\n    return new this(object)\n  }\n\n  /**\n   *\n   * @returns {{}}\n   */\n  toJSON () {\n    const object = {}\n\n    for (const item of Object.keys(this)) {\n      if (item.substring(0, 2) === '__') {\n        object[item.substring(2, item.length)] = this[item]\n      }\n    }\n\n    return object\n  }\n}\n","import BaseException from '../../../exception/BaseException.js'\n\nexport default class RuleArgumentException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'An incorrect argument!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'RuleArgumentException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Generic code exception\n */\nexport default class CodeException extends BaseException {\n  /**\n   * @param {string|null} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Code exception', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'CodeException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Meta from './Meta.js'\nimport RuleArgumentException from './exception/RuleArgumentException.js'\nimport { isNumeric } from '../../libraries/strings.js'\nimport { intersect } from '../../libraries/array.js'\nimport CodeException from '../../exception/CodeException.js'\n\n/* eslint-disable accessor-pairs -- intentional setter-only fluent rule builder; values are read directly via __field, no getter needed */\nexport default class Callback {\n  /**\n   *\n   * @param {string} action\n   * @param {string|null} metaType\n   * @param {string|null} metaId\n   * @param {Meta|null} meta\n   * @param {string|null} address\n   * @param {string|null} token\n   * @param {string|null} amount\n   * @param {string|null} comparison\n   */\n  constructor ({\n    action,\n    metaType = null,\n    metaId = null,\n    meta = null,\n    address = null,\n    token = null,\n    amount = null,\n    comparison = null\n  }) {\n    if (meta) {\n      this.meta = meta\n    }\n\n    if (!action) {\n      throw new RuleArgumentException('Callback structure violated, missing mandatory \"action\" parameter.')\n    }\n\n    this.__metaId = metaId\n    this.__metaType = metaType\n    this.__action = action\n    this.__address = address\n    this.__token = token\n    this.__amount = amount\n    this.__comparison = comparison\n  }\n\n  /**\n   *\n   * @param {string} comparison\n   */\n  set comparison (comparison) {\n    this.__comparison = comparison\n  }\n\n  /**\n   *\n   * @param {string} amount\n   */\n  set amount (amount) {\n    if (!isNumeric(amount)) {\n      throw new CodeException('Parameter amount should be a string containing numbers')\n    }\n    this.__amount = amount\n  }\n\n  /**\n   *\n   * @param {string} token\n   */\n  set token (token) {\n    this.__token = token\n  }\n\n  /**\n   *\n   * @param {string} address\n   */\n  set address (address) {\n    this.__address = address\n  }\n\n  /**\n   *\n   * @param {Meta|object} meta\n   */\n  set meta (meta) {\n    this.__meta = meta instanceof Meta ? meta : Meta.toObject(meta)\n  }\n\n  /**\n   *\n   * @param {string} metaType\n   */\n  set metaType (metaType) {\n    this.__metaType = metaType\n  }\n\n  /**\n   *\n   * @param {string} metaId\n   */\n  set metaId (metaId) {\n    this.__metaId = metaId\n  }\n\n  /**\n   *\n   * @param {object} object\n   *\n   * @return Callback\n   */\n  static toObject (object) {\n    const callback = new Callback({\n      action: object.action\n    })\n\n    if (object.metaType) {\n      callback.metaType = object.metaType\n    }\n\n    if (object.metaId) {\n      callback.metaId = object.metaId\n    }\n\n    if (object.meta) {\n      callback.meta = object.meta\n    }\n\n    if (object.address) {\n      callback.address = object.address\n    }\n\n    if (object.token) {\n      callback.token = object.token\n    }\n\n    if (object.amount) {\n      callback.amount = object.amount\n    }\n\n    if (object.comparison) {\n      callback.comparison = object.comparison\n    }\n\n    return callback\n  }\n\n  /**\n   *\n   * @return {{action: string}}\n   */\n  toJSON () {\n    const meta = {\n      action: this.__action\n    }\n\n    if (this.__metaType) {\n      meta.metaType = this.__metaType\n    }\n    if (this.__metaId) {\n      meta.metaId = this.__metaId\n    }\n    if (this.__meta) {\n      meta.meta = this.__meta\n    }\n\n    if (this.__address) {\n      meta.address = this.__address\n    }\n\n    if (this.__token) {\n      meta.token = this.__token\n    }\n\n    if (this.__amount) {\n      meta.amount = this.__amount\n    }\n\n    if (this.__comparison) {\n      meta.comparison = this.__comparison\n    }\n\n    return meta\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isReject () {\n    return this._is('reject')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isMeta () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'metaId', 'metaType', 'meta'])\n\n    return prop.length === 4 && this._is('meta')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isCollect () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'address', 'token', 'amount', 'comparison'])\n\n    return prop.length === 5 && this._is('collect')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isBuffer () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'address', 'token', 'amount', 'comparison'])\n\n    return prop.length === 5 && this._is('buffer')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isRemit () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'token', 'amount'])\n\n    return prop.length === 3 && this._is('remit')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isBurn () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'token', 'amount', 'comparison'])\n\n    return prop.length === 4 && this._is('burn')\n  }\n\n  /**\n   * @param {string} type\n   *\n   * @return {boolean}\n   * @private\n   */\n  _is (type) {\n    return this.__action.toLowerCase() === type.toLowerCase()\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport RuleArgumentException from './exception/RuleArgumentException.js'\n\nexport default class Condition {\n  /**\n   *\n   * @param key\n   * @param value\n   * @param comparison\n   */\n  constructor ({\n    key,\n    value,\n    comparison\n  }) {\n    if ([key, value, comparison].some(item => !item)) {\n      throw new RuleArgumentException('Condition::constructor( { key, value, comparison } ) - not all class parameters are initialised!')\n    }\n\n    this.__key = key\n    this.__value = value\n    this.__comparison = comparison\n  }\n\n  /**\n   * @param object\n   * @return {Condition}\n   */\n  static toObject (object) {\n    return new this({\n      key: object.key,\n      value: object.value,\n      comparison: object.comparison\n    })\n  }\n\n  /**\n   * @return {{comparison, value, key}}\n   */\n  toJSON () {\n    return {\n      key: this.__key,\n      value: this.__value,\n      comparison: this.__comparison\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Callback from './Callback.js'\nimport Condition from './Condition.js'\nimport RuleArgumentException from './exception/RuleArgumentException.js'\nimport MetaMissingException from '../../exception/MetaMissingException.js'\n\n/* eslint-disable accessor-pairs -- intentional setter-only fluent rule builder; values are read directly via __field, no getter needed */\nexport default class Rule {\n  /**\n   *\n   * @param {Condition[]} condition\n   * @param  {Callback[]} callback\n   */\n  constructor ({\n    condition = [],\n    callback = []\n  }) {\n    for (const element of condition) {\n      if (!(element instanceof Condition)) {\n        throw new RuleArgumentException()\n      }\n    }\n\n    for (const element of callback) {\n      if (!(element instanceof Callback)) {\n        throw new RuleArgumentException()\n      }\n    }\n\n    this.__condition = condition\n    this.__callback = callback\n  }\n\n  /**\n   *\n   * @param {Condition[]|{}} condition\n   */\n  set comparison (condition) {\n    this.__condition.push(condition instanceof Condition ? condition : Condition.toObject(condition))\n  }\n\n  /**\n   * @param {Callback[]|{}} callback\n   */\n  set callback (callback) {\n    this.__callback.push(callback instanceof Callback ? callback : Callback.toObject(callback))\n  }\n\n  /**\n   *\n   * @param {object} object\n   *\n   * @return {Rule}\n   */\n  static toObject (object) {\n    if (!object.condition) {\n      throw new MetaMissingException('Rule::toObject() - Incorrect rule format! There is no condition field.')\n    }\n    if (!object.callback) {\n      throw new MetaMissingException('Rule::toObject() - Incorrect rule format! There is no callback field.')\n    }\n\n    const rule = new Rule({})\n\n    for (const condition of object.condition) {\n      rule.comparison = condition\n    }\n\n    for (const callback of object.callback) {\n      rule.callback = callback\n    }\n\n    return rule\n  }\n\n  /**\n   * @returns {{condition: *, callback: Callback[]}}\n   */\n  toJSON () {\n    return {\n      condition: this.__condition,\n      callback: this.__callback\n    }\n  }\n}\n","/**\n * Utility class for accessing nested object properties using dot notation\n */\nexport default class Dot {\n  /**\n   * Initialize the Dot utility with the given object and key path\n   * @param {object|array} obj - The object or array to traverse\n   * @param {string} keys - The dot-notated string of keys\n   * @private\n   */\n  static __init (obj, keys) {\n    this.arr = String(keys).split('.')\n    this.key = this.arr.shift()\n\n    // Convert to number if the key is a valid integer\n    const numberKey = Number(this.key)\n    if (Number.isInteger(numberKey)) {\n      this.key = numberKey\n    }\n\n    this.__nextKey = this.arr.length\n    this.__next = this.__tic(obj)\n  }\n\n  /**\n   * Check if the current key exists in the object\n   * @param {object|array} obj - The object or array to check\n   * @return {boolean} - Whether the key exists\n   * @private\n   */\n  static __tic (obj) {\n    if (!Array.isArray(obj) && !(obj instanceof Object)) {\n      return false\n    }\n\n    return typeof obj[this.key] !== 'undefined'\n  }\n\n  /**\n   * Check if a nested property exists in an object using dot notation\n   * @param {object|array} obj - The object or array to search\n   * @param {string} keys - The path to the property, using dot notation\n   * @return {boolean} - True if the property exists, false otherwise\n   */\n  static has (obj, keys) {\n    this.__init(obj, keys)\n\n    if (!this.__next) {\n      return false\n    }\n    if (this.__nextKey === 0) {\n      return true\n    }\n\n    return this.has(obj[this.key], this.arr.join('.'))\n  }\n\n  /**\n   * Get a nested property from an object using dot notation\n   * @param {object|array} obj - The object or array to search\n   * @param {string} keys - The path to the property, using dot notation\n   * @param {*} [def=null] - The default value to return if the property is not found\n   * @return {*} - The value of the property, or the default value if not found\n   */\n  static get (obj, keys, def = null) {\n    this.__init(obj, keys)\n\n    if (!this.__next) {\n      return def\n    }\n    if (this.__nextKey === 0) {\n      return obj[this.key]\n    }\n\n    return this.get(obj[this.key], this.arr.join('.'), def)\n  }\n\n  /**\n   * Set a nested property in an object using dot notation\n   * @param {object|array} obj - The object or array to modify\n   * @param {string} keys - The path to the property, using dot notation\n   * @param {*} value - The value to set\n   * @return {object|array} - The modified object or array\n   */\n  static set (obj, keys, value) {\n    const parts = keys.split('.')\n    let current = obj\n    const lastIndex = parts.length - 1\n\n    for (let i = 0; i < lastIndex; i++) {\n      const key = parts[i]\n      const numberKey = Number(key)\n      const useNumberKey = Number.isInteger(numberKey)\n\n      if (!(useNumberKey ? numberKey : key in current)) {\n        current[useNumberKey ? numberKey : key] = parts[i + 1].match(/^\\d+$/) ? [] : {}\n      }\n      current = current[useNumberKey ? numberKey : key]\n    }\n\n    const lastKey = parts[lastIndex]\n    const lastNumberKey = Number(lastKey)\n    current[Number.isInteger(lastNumberKey) ? lastNumberKey : lastKey] = value\n\n    return obj\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n */\nimport AtomIndexException from './../exception/AtomIndexException.js'\nimport AtomsMissingException from './../exception/AtomsMissingException.js'\nimport MolecularHashMismatchException from './../exception/MolecularHashMismatchException.js'\nimport MolecularHashMissingException from './../exception/MolecularHashMissingException.js'\nimport PolicyInvalidException from './../exception/PolicyInvalidException.js'\nimport SignatureMalformedException from './../exception/SignatureMalformedException.js'\nimport SignatureMismatchException from './../exception/SignatureMismatchException.js'\nimport TransferBalanceException from './../exception/TransferBalanceException.js'\nimport TransferMalformedException from './../exception/TransferMalformedException.js'\nimport TransferMismatchedException from './../exception/TransferMismatchedException.js'\nimport TransferRemainderException from './../exception/TransferRemainderException.js'\nimport TransferToSelfException from './../exception/TransferToSelfException.js'\nimport TransferUnbalancedException from './../exception/TransferUnbalancedException.js'\nimport MetaMissingException from './../exception/MetaMissingException.js'\nimport WrongTokenTypeException from './../exception/WrongTokenTypeException.js'\nimport BatchIdException from './../exception/BatchIdException.js'\nimport Atom from './../Atom.js'\nimport Meta from './../Meta.js'\nimport Molecule from './../Molecule.js'\nimport Wallet from './../Wallet.js'\nimport Rule from '../instance/Rules/Rule.js'\nimport {\n  base64ToHex,\n  chunkSubstr\n} from './strings.js'\nimport JsSHA from 'jssha'\nimport Dot from './../libraries/Dot.js'\n\n/**\n *\n */\nexport default class CheckMolecule {\n  /**\n   *\n   * @param molecule\n   */\n  constructor (molecule) {\n    // No molecular hash?\n    if (molecule.molecularHash === null) {\n      throw new MolecularHashMissingException()\n    }\n\n    // No atoms?\n    if (!molecule.atoms.length) {\n      throw new AtomsMissingException()\n    }\n\n    // Check atom indexes\n    for (const atom of molecule.atoms) {\n      if (atom.index === null) {\n        throw new AtomIndexException()\n      }\n    }\n\n    this.molecule = molecule\n  }\n\n  /**\n   *\n   * @param senderWallet\n   * @returns {false|*|boolean}\n   */\n  verify (senderWallet) {\n    return this.molecularHash() &&\n      this.ots() &&\n      this.batchId() &&\n      this.continuId() &&\n      this.isotopeM() &&\n      this.isotopeT() &&\n      this.isotopeC() &&\n      this.isotopeU() &&\n      this.isotopeI() &&\n      this.isotopeR() &&\n      this.isotopeP() &&\n      this.isotopeA() &&\n      this.isotopeB() &&\n      this.isotopeF() &&\n      this.isotopeV(senderWallet)\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  continuId () {\n    const firstAtom = this.molecule.atoms[0]\n\n    if (firstAtom.token === 'USER' && this.molecule.getIsotopes('I').length < 1) {\n      throw new AtomsMissingException('Check::continuId() - Molecule is missing required ContinuID Atom!')\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  batchId () {\n    if (this.molecule.atoms.length > 0) {\n      const signingAtom = this.molecule.atoms[0]\n\n      if (signingAtom.isotope === 'V' && signingAtom.batchId !== null) {\n        const atoms = this.molecule.getIsotopes('V')\n        const remainderAtom = atoms[atoms.length - 1]\n\n        if (signingAtom.batchId !== remainderAtom.batchId) {\n          throw new BatchIdException()\n        }\n\n        for (const atom of atoms) {\n          if (atom.batchId === null) {\n            throw new BatchIdException()\n          }\n        }\n      }\n\n      return true\n    }\n\n    throw new BatchIdException()\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeI () {\n    for (const atom of this.molecule.getIsotopes('I')) {\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeI() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (atom.index === 0) {\n        throw new AtomIndexException(`Check::isotopeI() - Isotope \"${ atom.isotope }\" Atoms must have a non-zero index!`)\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeU () {\n    for (const atom of this.molecule.getIsotopes('U')) {\n      if (atom.token !== 'AUTH') {\n        throw new WrongTokenTypeException(`Check::isotopeU() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (atom.index !== 0) {\n        throw new AtomIndexException(`Check::isotopeU() - Isotope \"${ atom.isotope }\" Atoms must have an index equal to 0!`)\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeM () {\n    const policyArray = ['readPolicy', 'writePolicy']\n\n    for (/** @type {Atom} */ const atom of this.molecule.getIsotopes('M')) {\n      if (atom.meta.length < 1) {\n        throw new MetaMissingException()\n      }\n\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeM() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      const metas = Meta.aggregateMeta(atom.meta)\n\n      for (const key of policyArray) {\n        let policy = metas[key]\n\n        if (policy) {\n          policy = JSON.parse(policy)\n\n          for (const [policyName, policyValue] of Object.entries(policy)) {\n            if (!policyArray.includes(policyName)) {\n              if (!Object.keys(metas).includes(policyName)) {\n                throw new PolicyInvalidException(`${ policyName } is missing from the meta.`)\n              }\n\n              for (const value of policyValue) {\n                if (!Wallet.isBundleHash(value) && !['all', 'self'].includes(value)) {\n                  throw new PolicyInvalidException(`${ value } does not correspond to the format of the policy.`)\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeC () {\n    for (const atom of this.molecule.getIsotopes('C')) {\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeC() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (atom.index !== 0) {\n        throw new AtomIndexException(`Check::isotopeC() - Isotope \"${ atom.isotope }\" Atoms must have an index equal to 0!`)\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeT () {\n    for (const atom of this.molecule.getIsotopes('T')) {\n      const meta = atom.aggregatedMeta()\n      const metaType = String(atom.metaType).toLowerCase()\n\n      if (metaType === 'wallet') {\n        for (const key of ['position', 'bundle']) {\n          if (!Object.prototype.hasOwnProperty.call(meta, key) || !meta[key]) {\n            throw new MetaMissingException(`Check::isotopeT() - Required meta field \"${ key }\" is missing!`)\n          }\n        }\n      }\n\n      for (const key of ['token']) {\n        if (!Object.prototype.hasOwnProperty.call(meta, key) || !meta[key]) {\n          throw new MetaMissingException(`Check::isotopeT() - Required meta field \"${ key }\" is missing!`)\n        }\n      }\n\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeT() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (atom.index !== 0) {\n        throw new AtomIndexException(`Check::isotopeT() - Isotope \"${ atom.isotope }\" Atoms must have an index equal to 0!`)\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeR () {\n    for (const atom of this.molecule.getIsotopes('R')) {\n      const metas = atom.aggregatedMeta()\n\n      if (metas.policy) {\n        const policy = JSON.parse(metas.policy)\n\n        if (!Object.keys(policy).every(i => ['read', 'write'].includes(i))) {\n          throw new MetaMissingException('Check::isotopeR() - Mixing rules with politics!')\n        }\n      }\n\n      if (metas.rule) {\n        const rules = JSON.parse(metas.rule)\n\n        if (!Array.isArray(rules)) {\n          throw new MetaMissingException('Check::isotopeR() - Incorrect rule format!')\n        }\n\n        for (const item of rules) {\n          Rule.toObject(item)\n        }\n\n        if (rules.length < 1) {\n          throw new MetaMissingException('Check::isotopeR() - No rules!')\n        }\n      }\n    }\n\n    return true\n  }\n\n  /**\n   * Validates P-isotope (Peering) atoms\n   *\n   * @returns {boolean}\n   */\n  isotopeP () {\n    for (const atom of this.molecule.getIsotopes('P')) {\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeP() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      const metas = atom.aggregatedMeta()\n\n      if (!Object.prototype.hasOwnProperty.call(metas, 'peerHost') || !metas.peerHost) {\n        throw new MetaMissingException('Check::isotopeP() - Required meta field \"peerHost\" is missing!')\n      }\n    }\n\n    return true\n  }\n\n  /**\n   * Validates A-isotope (Append Request) atoms\n   *\n   * @returns {boolean}\n   */\n  isotopeA () {\n    for (const atom of this.molecule.getIsotopes('A')) {\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeA() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (!atom.metaType) {\n        throw new MetaMissingException('Check::isotopeA() - Required field \"metaType\" is missing!')\n      }\n\n      if (!atom.metaId) {\n        throw new MetaMissingException('Check::isotopeA() - Required field \"metaId\" is missing!')\n      }\n\n      const metas = atom.aggregatedMeta()\n\n      if (!Object.prototype.hasOwnProperty.call(metas, 'action') || !metas.action) {\n        throw new MetaMissingException('Check::isotopeA() - Required meta field \"action\" is missing!')\n      }\n    }\n\n    return true\n  }\n\n  /**\n   * Validates B-isotope (Buffer/Exchange) atoms\n   *\n   * @returns {boolean}\n   */\n  isotopeB () {\n    const isotopeB = this.molecule.getIsotopes('B')\n\n    if (isotopeB.length === 0) {\n      return true\n    }\n\n    for (const atom of isotopeB) {\n      // B atoms must reference a wallet bundle\n      if (!atom.metaType || atom.metaType !== 'walletBundle') {\n        throw new MetaMissingException('Check::isotopeB() - B-isotope atoms must have metaType \"walletBundle\"!')\n      }\n\n      if (!atom.metaId) {\n        throw new MetaMissingException('Check::isotopeB() - B-isotope atoms must have a metaId!')\n      }\n\n      // Value must be parseable as a number\n      const value = Number(atom.value)\n      if (Number.isNaN(value)) {\n        throw new TransferMalformedException('Check::isotopeB() - B-isotope atom value is not a valid number!')\n      }\n    }\n\n    // V+B balance conservation: sum of all V and B atom values must equal zero\n    const vAtoms = this.molecule.getIsotopes('V')\n    if (vAtoms.length > 0) {\n      let sum = 0\n      for (const atom of [...vAtoms, ...isotopeB]) {\n        const value = Number(atom.value)\n        if (!Number.isNaN(value)) {\n          sum += value\n        }\n      }\n      if (sum !== 0) {\n        throw new TransferUnbalancedException('Check::isotopeB() - V+B atom values do not balance to zero!')\n      }\n    }\n\n    return true\n  }\n\n  /**\n   * Validates F-isotope (Fusion/NFT) atoms\n   *\n   * @returns {boolean}\n   */\n  isotopeF () {\n    const isotopeF = this.molecule.getIsotopes('F')\n\n    if (isotopeF.length === 0) {\n      return true\n    }\n\n    for (const atom of isotopeF) {\n      // F atoms must reference a wallet bundle\n      if (!atom.metaType || atom.metaType !== 'walletBundle') {\n        throw new MetaMissingException('Check::isotopeF() - F-isotope atoms must have metaType \"walletBundle\"!')\n      }\n\n      if (!atom.metaId) {\n        throw new MetaMissingException('Check::isotopeF() - F-isotope atoms must have a metaId!')\n      }\n\n      // Value must be parseable\n      const value = Number(atom.value)\n      if (Number.isNaN(value)) {\n        throw new TransferMalformedException('Check::isotopeF() - F-isotope atom value is not a valid number!')\n      }\n\n      if (value < 0) {\n        throw new TransferMalformedException('Check::isotopeF() - F-isotope atom value must not be negative!')\n      }\n    }\n\n    // V+F balance conservation: sum of all V and F atom values must equal zero\n    const vAtoms = this.molecule.getIsotopes('V')\n    if (vAtoms.length > 0) {\n      let sum = 0\n      for (const atom of [...vAtoms, ...isotopeF]) {\n        const value = Number(atom.value)\n        if (!Number.isNaN(value)) {\n          sum += value\n        }\n      }\n      if (sum !== 0) {\n        throw new TransferUnbalancedException('Check::isotopeF() - V+F atom values do not balance to zero!')\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @param senderWallet\n   * @returns {boolean}\n   */\n  isotopeV (senderWallet = null) {\n    const isotopeV = this.molecule.getIsotopes('V')\n\n    if (isotopeV.length === 0) {\n      return true\n    }\n\n    // When B or F atoms are present, cross-isotope conservation is validated\n    // by isotopeB()/isotopeF() — skip V-only conservation check\n    const hasCrossIsotope = this.molecule.getIsotopes('B').length > 0 ||\n      this.molecule.getIsotopes('F').length > 0\n\n    const firstAtom = this.molecule.atoms[0]\n\n    if (!hasCrossIsotope && firstAtom.isotope === 'V' && isotopeV.length === 2) {\n      const endAtom = isotopeV[isotopeV.length - 1]\n\n      if (firstAtom.token !== endAtom.token) {\n        throw new TransferMismatchedException()\n      }\n\n      if (endAtom.value < 0) {\n        throw new TransferMalformedException()\n      }\n\n      // Conservation check for 2-atom transfers\n      if ((Number(firstAtom.value) + Number(endAtom.value)) !== 0) {\n        throw new TransferUnbalancedException()\n      }\n\n      return true\n    }\n\n    let sum = 0\n    let value = 0\n\n    for (const index in this.molecule.atoms) {\n      if (Object.prototype.hasOwnProperty.call(this.molecule.atoms, index)) {\n        const vAtom = this.molecule.atoms[index]\n\n        // Not V? Next...\n        if (vAtom.isotope !== 'V') {\n          continue\n        }\n\n        // Making sure we're in integer land\n        value = vAtom.value * 1\n\n        if (Number.isNaN(value)) {\n          throw new TypeError('Invalid isotope \"V\" values')\n        }\n\n        // Making sure all V atoms of the same token\n        if (vAtom.token !== firstAtom.token) {\n          throw new TransferMismatchedException()\n        }\n\n        // Checking non-primary atoms\n        if (index > 0) {\n          // Negative V atom in a non-primary position?\n          if (value < 0) {\n            throw new TransferMalformedException()\n          }\n\n          // Cannot be sending and receiving from the same address\n          if (vAtom.walletAddress === firstAtom.walletAddress) {\n            throw new TransferToSelfException()\n          }\n        }\n\n        // Adding this Atom's value to the total sum\n        sum += value\n      }\n    }\n\n    // V-only conservation: all V atoms must sum to zero (skip for B/F cross-isotope)\n    if (!hasCrossIsotope && sum !== 0) {\n      throw new TransferUnbalancedException()\n    }\n\n    // If we're provided with a senderWallet argument, we can perform additional checks\n    if (senderWallet) {\n      value = firstAtom.value * 1\n\n      if (Number.isNaN(value)) {\n        throw new TypeError('Invalid isotope \"V\" values')\n      }\n\n      const remainder = Number(senderWallet.balance) + value\n\n      // Is there enough balance to send?\n      if (remainder < 0) {\n        throw new TransferBalanceException()\n      }\n\n      // Does the remainder match what should be there in the source wallet, if provided?\n      // Skip for cross-isotope (B/F) — conservation is validated by isotopeB()/isotopeF()\n      if (!hasCrossIsotope && remainder !== sum) {\n        throw new TransferRemainderException()\n      }\n    } else if (value !== 0) {\n      // No senderWallet, but have a remainder?\n      throw new TransferRemainderException()\n    }\n\n    // Looks like we passed all the tests!\n    return true\n  }\n\n  /**\n   * Verifies if the hash of all the atoms matches the molecular hash to ensure content has not been messed with\n   *\n   * @returns {boolean}\n   */\n  molecularHash () {\n    if (this.molecule.molecularHash !== Atom.hashAtoms({\n      atoms: this.molecule.atoms\n    })) {\n      throw new MolecularHashMismatchException()\n    }\n\n    // Looks like we passed all the tests!\n    return true\n  }\n\n  /**\n   * Checks if the provided molecule was signed properly by transforming a collection of signature\n   * fragments from its atoms and its molecular hash into a single-use wallet address to be matched\n   * against the sender’s address. If it matches, the molecule was correctly signed.\n   *\n   * @returns {boolean}\n   */\n  ots () {\n    // Convert Hm to numeric notation via EnumerateMolecule(Hm)\n    const normalizedHash = this.molecule.normalizedHash()\n\n    // Rebuilding OTS out of all the atoms\n    let ots = this.molecule.atoms.map(\n      atom => atom.otsFragment\n    ).reduce(\n      (accumulator, otsFragment) => accumulator + otsFragment\n    )\n\n    // Wrong size? Maybe it's compressed\n    if (ots.length !== 2048) {\n      // Attempting decompression\n      ots = base64ToHex(ots)\n\n      // Still wrong? That's a failure\n      if (ots.length !== 2048) {\n        throw new SignatureMalformedException()\n      }\n    }\n\n    // Subdivide Kk into 16 segments of 256 bytes (128 characters) each\n    const otsChunks = chunkSubstr(ots, 128)\n\n    let keyFragments = ''\n\n    for (const index in otsChunks) {\n      let workingChunk = otsChunks[index]\n\n      for (let iterationCount = 0, condition = 8 + normalizedHash[index]; iterationCount < condition; iterationCount++) {\n        workingChunk = (new JsSHA('SHAKE256', 'TEXT')).update(workingChunk).getHash('HEX', { outputLen: 512 })\n      }\n\n      keyFragments += workingChunk\n    }\n\n    // Absorb the hashed Kk into the sponge to receive the digest Dk\n    const digestSponge = new JsSHA('SHAKE256', 'TEXT')\n    digestSponge.update(keyFragments)\n    const digest = digestSponge.getHash('HEX', { outputLen: 8192 })\n\n    // Squeeze the sponge to retrieve a 128 byte (64 character) string that should match the sender’s wallet address\n    const addressSponge = new JsSHA('SHAKE256', 'TEXT')\n    addressSponge.update(digest)\n    const address = addressSponge.getHash('HEX', { outputLen: 256 })\n\n    // Signing atom\n    const signingAtom = this.molecule.atoms[0]\n\n    // Get a signing address\n    let signingAddress = signingAtom.walletAddress\n\n    // Get signing wallet from first atom's metas\n    const signingWallet = Dot.get(signingAtom.aggregatedMeta(), 'signingWallet')\n\n    // Try to get custom signing address from the metas (local molecule with server secret)\n    if (signingWallet) {\n      signingAddress = Dot.get(JSON.parse(signingWallet), 'address')\n    }\n\n    if (address !== signingAddress) {\n      throw new SignatureMismatchException()\n    }\n\n    // Looks like we passed all the tests!\n    return true\n  }\n\n  /**\n   * Converts server-side molecule data (from GraphQL meta query responses)\n   * into a Molecule instance suitable for verification via CheckMolecule.\n   *\n   * Handles field mapping differences between server and client:\n   * - tokenSlug → token\n   * - metasJson (JSON string) → meta (array of {key, value})\n   * - bundleHash → bundle\n   *\n   * @param {object} serverData - Molecule data from GraphQL response\n   * @param {string} serverData.molecularHash\n   * @param {string} serverData.bundleHash\n   * @param {string|null} serverData.cellSlug\n   * @param {string|null} serverData.status\n   * @param {string|null} serverData.createdAt\n   * @param {array} serverData.atoms - Array of server-format atom objects\n   * @return {Molecule}\n   */\n  static fromServerData ({\n    molecularHash,\n    bundleHash,\n    cellSlug = null,\n    status = null,\n    createdAt = null,\n    atoms = []\n  }) {\n    const mappedAtoms = atoms.map(serverAtom => {\n      let meta = []\n      if (serverAtom.metasJson) {\n        try {\n          const parsed = JSON.parse(serverAtom.metasJson)\n          if (Array.isArray(parsed)) {\n            // Already in [{key, value}] format\n            meta = parsed\n          } else if (parsed && typeof parsed === 'object') {\n            // Object format {key1: val1, key2: val2} — convert to [{key, value}] pairs\n            meta = Object.entries(parsed).map(([key, value]) => ({ key, value }))\n          }\n        } catch (e) {\n          meta = []\n        }\n      }\n\n      return {\n        position: serverAtom.position || null,\n        walletAddress: serverAtom.walletAddress || null,\n        isotope: serverAtom.isotope || null,\n        token: serverAtom.tokenSlug || serverAtom.token || null,\n        value: serverAtom.value != null ? String(serverAtom.value) : null,\n        batchId: serverAtom.batchId || null,\n        metaType: serverAtom.metaType || null,\n        metaId: serverAtom.metaId || null,\n        meta,\n        index: serverAtom.index != null ? serverAtom.index : null,\n        otsFragment: serverAtom.otsFragment || null,\n        createdAt: serverAtom.createdAt || null\n      }\n    })\n\n    return Molecule.fromJSON({\n      molecularHash,\n      bundle: bundleHash,\n      cellSlug,\n      status,\n      createdAt,\n      atoms: mappedAtoms\n    })\n  }\n\n  /**\n   * Verifies a molecule reconstructed from server-side GraphQL data.\n   * Returns an object with verification result and any error details.\n   *\n   * @param {object} moleculeData - Server molecule data (same format as fromServerData)\n   * @return {{ molecularHash: string, verified: boolean, error: string|null }}\n   */\n  static verifyFromServerData (moleculeData) {\n    try {\n      const molecule = CheckMolecule.fromServerData(moleculeData)\n      new CheckMolecule(molecule).verify()\n      return {\n        molecularHash: moleculeData.molecularHash,\n        verified: true,\n        error: null\n      }\n    } catch (error) {\n      return {\n        molecularHash: moleculeData.molecularHash || null,\n        verified: false,\n        error: error.message || String(error)\n      }\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when the node does not have enough tokens to fulfill a T request\n */\nexport default class BalanceInsufficientException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Insufficient balance for requested transfer', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'BalanceInsufficientException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when a negative amount is provided\n */\nexport default class NegativeAmountException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Amount cannot be negative!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'NegativeAmountException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Atom from './Atom.js'\nimport AtomMeta from './AtomMeta.js'\nimport Wallet from './Wallet.js'\nimport JsSHA from 'jssha'\nimport {\n  chunkSubstr,\n  hexToBase64\n} from './libraries/strings.js'\nimport CheckMolecule from './libraries/CheckMolecule.js'\nimport {\n  generateBatchId,\n  generateBundleHash\n} from './libraries/crypto.js'\nimport Dot from './libraries/Dot.js'\nimport Rule from './instance/Rules/Rule.js'\nimport AtomsMissingException from './exception/AtomsMissingException.js'\nimport BalanceInsufficientException from './exception/BalanceInsufficientException.js'\nimport NegativeAmountException from './exception/NegativeAmountException.js'\nimport SignatureMalformedException from './exception/SignatureMalformedException.js'\nimport versions from './versions/index.js'\n\n/**\n * Molecule class used for committing changes to the ledger\n */\nexport default class Molecule {\n  /**\n   * Class constructor\n   *\n   * @param {string|null} secret\n   * @param {string|null} bundle\n   * @param {Wallet|null} sourceWallet\n   * @param {Wallet|null} remainderWallet\n   * @param {string|null} cellSlug\n   * @param {string|number|null} version\n   */\n  constructor ({\n    secret = null,\n    bundle = null,\n    sourceWallet = null,\n    remainderWallet = null,\n    cellSlug = null,\n    version = null,\n    continuIdPosition = null,\n    mlKemParameterSet = null\n  }) {\n    this.mlKemParameterSet = mlKemParameterSet || (sourceWallet && sourceWallet.mlKemParameterSet) || 1024\n    this.status = null\n    this.molecularHash = null\n    this.createdAt = String(+new Date())\n    this.cellSlugOrigin = this.cellSlug = cellSlug\n    this.secret = secret\n    this.bundle = bundle\n    this.sourceWallet = sourceWallet\n    this.continuIdPosition = continuIdPosition\n    this.atoms = []\n    this.parentHashes = []\n    if (version !== null && Object.prototype.hasOwnProperty.call(versions, version)) {\n      this.version = String(version)\n    }\n\n    // Set the remainder wallet for this transaction\n    if (remainderWallet || sourceWallet) {\n      this.remainderWallet = remainderWallet || Wallet.create({\n        secret,\n        bundle,\n        token: sourceWallet.token,\n        batchId: sourceWallet.batchId,\n        characters: sourceWallet.characters,\n        mlKemParameterSet: this.mlKemParameterSet\n      })\n    }\n  }\n\n  /**\n   * Sets parent molecular hashes for DAG linkage\n   *\n   * @param {string[]} hashes - Array of parent molecular hash strings\n   * @return {Molecule} this instance for chaining\n   */\n  withParentHashes (hashes) {\n    this.parentHashes = Array.isArray(hashes) ? [...hashes] : []\n    return this\n  }\n\n  /**\n   * Returns the cell slug delimiter\n   *\n   * @return {string}\n   */\n  get cellSlugDelimiter () {\n    return '.'\n  }\n\n  /**\n   * Filters the atoms array by the supplied isotope list\n   *\n   * @param {string|array} isotopes\n   * @param {array} atoms\n   * @returns {*[]}\n   */\n  static isotopeFilter (isotopes, atoms) {\n    if (!Array.isArray(isotopes)) {\n      isotopes = [isotopes]\n    }\n    return atoms.filter(atom => isotopes.includes(atom.isotope))\n  }\n\n  /**\n   * Generates the next atomic index\n   *\n   * @param {array} atoms\n   * @return {number}\n   */\n  static generateNextAtomIndex (atoms) {\n    return atoms.length\n  }\n\n  /**\n   * Converts a JSON object into a Molecule Structure instance\n   *\n   * @param {string} json\n   * @return {object}\n   * @throws {AtomsMissingException}\n   */\n  static jsonToObject (json) {\n    const target = Object.assign(new Molecule({}), JSON.parse(json))\n    const properties = Object.keys(new Molecule({}))\n\n    if (!Array.isArray(target.atoms)) {\n      throw new AtomsMissingException()\n    }\n\n    for (const index in Object.keys(target.atoms)) {\n      target.atoms[index] = Atom.jsonToObject(JSON.stringify(target.atoms[index]))\n\n      for (const property of ['position', 'walletAddress', 'isotope']) {\n        if (target.atoms[index].isotope.toLowerCase() !== 'r' && (typeof target.atoms[index][property] === 'undefined' || target.atoms[index][property] === null)) {\n          throw new AtomsMissingException('MolecularStructure::jsonToObject() - Required Atom properties are missing!')\n        }\n      }\n    }\n\n    for (const property in target) {\n      if (Object.prototype.hasOwnProperty.call(target, property) && !properties.includes(property)) {\n        delete target[property]\n      }\n    }\n\n    target.atoms = Atom.sortAtoms(target.atoms)\n\n    return target\n  }\n\n  /**\n   * Accept a string of letters and numbers, and outputs a collection of decimals representing each\n   * character according to a pre-defined dictionary. Input string would typically be 64-character\n   * hexadecimal string featuring numbers from 0 to 9 and characters from a to f - a total of 15\n   * unique symbols. To ensure that string has an even number of symbols, convert it to Base 17\n   * (adding G as a possible symbol). Map each symbol to integer values as follows:\n   *  0   1   2   3   4   5   6   7  8  9  a   b   c   d   e   f   g\n   * -8  -7  -6  -5  -4  -3  -2  -1  0  1  2   3   4   5   6   7   8\n   *\n   * @param {string} hash\n   * @return {array}\n   */\n  static enumerate (hash) {\n    const mapped = {\n      0: -8,\n      1: -7,\n      2: -6,\n      3: -5,\n      4: -4,\n      5: -3,\n      6: -2,\n      7: -1,\n      8: 0,\n      9: 1,\n      a: 2,\n      b: 3,\n      c: 4,\n      d: 5,\n      e: 6,\n      f: 7,\n      g: 8\n    }\n    const target = []\n    const hashList = hash.toLowerCase().split('')\n\n    for (let index = 0, len = hashList.length; index < len; ++index) {\n      const symbol = hashList[index]\n\n      if (typeof mapped[symbol] !== 'undefined') {\n        target[index] = mapped[symbol]\n      }\n    }\n\n    return target\n  }\n\n  /**\n   * Normalize enumerated string to ensure that the total sum of all symbols is exactly zero. This\n   * ensures that exactly 50% of the WOTS+ key is leaked with each usage, ensuring predictable key\n   * safety:\n   * The sum of each symbol within Hm shall be presented by m\n   *  While m0 iterate across that set’s integers as Im:\n   *    If m0 and Im>-8 , let Im=Im-1\n   *    If m<0 and Im<8 , let Im=Im+1\n   *    If m=0, stop the iteration\n   *\n   * @param {array} mappedHashArray\n   * @return {array}\n   */\n  static normalize (mappedHashArray) {\n    let total = mappedHashArray.reduce((total, num) => total + num)\n\n    const totalCondition = total < 0\n\n    while (total < 0 || total > 0) {\n      for (const index of Object.keys(mappedHashArray)) {\n        const condition = totalCondition ? mappedHashArray[index] < 8 : mappedHashArray[index] > -8\n\n        if (condition) {\n          if (totalCondition) {\n            ++mappedHashArray[index]\n            ++total\n          } else {\n            --mappedHashArray[index]\n            --total\n          }\n\n          if (total === 0) {\n            break\n          }\n        }\n      }\n    }\n\n    return mappedHashArray\n  }\n\n  /**\n   *\n   * @param isotopes\n   * @returns {*[]}\n   */\n  getIsotopes (isotopes) {\n    return Molecule.isotopeFilter(isotopes, this.atoms)\n  }\n\n  /**\n   * Generates the next atomic index\n   *\n   * @return {number}\n   */\n  generateIndex () {\n    return Molecule.generateNextAtomIndex(this.atoms)\n  }\n\n  /**\n   * Fills a Molecule's properties with the provided object\n   *\n   * @param {Molecule} molecule\n   */\n  fill (molecule) {\n    for (const key in Object.keys(molecule)) {\n      this[key] = molecule[key]\n    }\n  }\n\n  /**\n   *\n   * @param {Atom} atom\n   * @returns {Molecule}\n   */\n  addAtom (atom) {\n    // Reset the molecular hash\n    this.molecularHash = null\n\n    // Set atom's index\n    atom.index = this.generateIndex()\n    atom.version = this.version\n\n    // Add atom\n    this.atoms.push(atom)\n\n    // Sort atoms\n    this.atoms = Atom.sortAtoms(this.atoms)\n\n    return this\n  }\n\n  /**\n   * Add user remainder atom for ContinuID\n   *\n   * @return {Molecule}\n   */\n  addContinuIdAtom () {\n    // If remainder wallet is not USER token, create a new USER remainder wallet\n    if (!this.remainderWallet || this.remainderWallet.token !== 'USER') {\n      this.remainderWallet = Wallet.create({\n        secret: this.secret,\n        bundle: this.bundle,\n        mlKemParameterSet: this.mlKemParameterSet\n      })\n    }\n\n    // ContinuID metadata for chain integrity validation (matching Rust SDK GAP-07-002).\n    // These are atom meta fields (not core fields), so they don't affect molecular hash.\n    const continuIdMeta = {}\n\n    // previousPosition: the current USER ContinuID position being consumed.\n    // For non-USER source wallets (V/B isotopes), use the explicitly passed\n    // continuIdPosition from createMolecule() instead of the TOKEN wallet position.\n    if (this.continuIdPosition) {\n      continuIdMeta.previousPosition = this.continuIdPosition\n    } else if (this.sourceWallet && this.sourceWallet.position) {\n      continuIdMeta.previousPosition = this.sourceWallet.position\n    }\n\n    // pubkey: ML-KEM public key for encrypted communication\n    if (this.remainderWallet.pubkey) {\n      continuIdMeta.pubkey = this.remainderWallet.pubkey\n    }\n\n    // characters: encoding format for the wallet\n    if (this.remainderWallet.characters) {\n      continuIdMeta.characters = this.remainderWallet.characters\n    }\n\n    this.addAtom(Atom.create({\n      isotope: 'I',\n      wallet: this.remainderWallet,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle,\n      meta: new AtomMeta(continuIdMeta)\n    }))\n    return this\n  }\n\n  /**\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object} meta\n   * @param {object} policy\n   *\n   * @return {Molecule}\n   */\n  addPolicyAtom ({\n    metaType,\n    metaId,\n    meta = {},\n    policy = {}\n  }) {\n    // AtomMeta object initialization\n    const atomMeta = new AtomMeta(meta)\n    atomMeta.addPolicy(policy)\n\n    // F-3 (E2E gauntlet 2026-06-02): sign the policy (R-isotope) atom from the\n    // established ContinuID source wallet, NOT a freshly-derived Wallet.create() at a\n    // random position. As the signing (first) atom in createPolicy(), a fresh-wallet\n    // position is unknown to the validator → \"ContinuID chain validation failed:\n    // signing position … not found as wallet\" (a different position each retry). This\n    // mirrors createRule(), which adds its R-atom at this.sourceWallet.\n    this.addAtom(Atom.create({\n      wallet: this.sourceWallet,\n      isotope: 'R',\n      metaType,\n      metaId,\n      meta: atomMeta\n    }))\n    return this\n  }\n\n  /**\n   *\n   * @param tokenUnits\n   * @param recipientWallet\n   * @returns {Molecule}\n   */\n  fuseToken (tokenUnits, recipientWallet) {\n    // Calculate amount\n    const amount = tokenUnits.length\n\n    if ((this.sourceWallet.balance - amount) < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Initializing a new Atom to remove tokens from source\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -amount\n    }))\n\n    // Add F isotope for fused tokens creation\n    this.addAtom(Atom.create({\n      isotope: 'F',\n      wallet: recipientWallet,\n      value: 1,\n      metaType: 'walletBundle',\n      metaId: recipientWallet.bundle\n    }))\n\n    // Initializing a new Atom to remove tokens from source\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   * Burns some amount of tokens from a wallet\n   *\n   * @param {number} amount\n   * @param {string|null} walletBundle\n   * @return {Molecule}\n   */\n  burnToken ({\n    amount,\n    walletBundle = null\n  }) {\n    if (amount < 0.0) {\n      throw new NegativeAmountException('Molecule::burnToken() - Amount to burn must be positive!')\n    }\n\n    if ((this.sourceWallet.balance - amount) < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Create burn address wallet (null bundle = token destruction)\n    const burnWallet = new Wallet({\n      bundle: '0000000000000000000000000000000000000000000000000000000000000000',\n      token: this.sourceWallet.token,\n      mlKemParameterSet: this.mlKemParameterSet\n    })\n\n    // V-atom 1: Debit full balance from source\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance\n    }))\n\n    // V-atom 2: Credit burn amount to burn address\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: burnWallet,\n      value: amount,\n      metaType: 'walletBundle',\n      metaId: burnWallet.bundle\n    }))\n\n    // V-atom 3: Remainder back to source identity\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /*\n   * Replenishes non-finite token supplies\n   *\n   * @param {number} amount\n   * @param {string} token\n   * @param {array|object} metas\n   * @return {Molecule}\n   */\n  replenishToken ({\n    amount,\n    units = []\n  }) {\n    if (amount < 0) {\n      throw new NegativeAmountException('Molecule::replenishToken() - Amount to replenish must be positive!')\n    }\n\n    // Special code for the token unit logic\n    if (units.length) {\n      // Prepare token units to formatted style\n      units = Wallet.getTokenUnits(units)\n\n      // Merge token units with source wallet & new items\n      this.remainderWallet.tokenUnits = this.sourceWallet.tokenUnits\n      for (const unit of units) {\n        this.remainderWallet.tokenUnits.push(unit)\n      }\n      this.remainderWallet.balance = String(this.remainderWallet.tokenUnits.length)\n\n      // Override first atom's token units to replenish values\n      this.sourceWallet.tokenUnits = units\n      this.sourceWallet.balance = String(this.sourceWallet.tokenUnits.length)\n    } else {\n      // Update wallet's balances\n      this.remainderWallet.balance = String(Number(this.sourceWallet.balance) + amount)\n      this.sourceWallet.balance = String(amount)\n    }\n\n    // Initializing a new Atom to remove tokens from source\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: Number(this.sourceWallet.balance)\n    }))\n\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: Number(this.remainderWallet.balance),\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   * Initialize a V-type molecule to transfer value from one wallet to another, with a third,\n   * regenerated wallet receiving the remainder\n   *\n   * @param {Wallet} recipientWallet\n   * @param {number} amount\n   * @return {Molecule}\n   */\n  initValue ({\n    recipientWallet,\n    amount\n  }) {\n    // Canonical token transfer (incl. stackable): a UTXO-style FULL-balance debit + remainder.\n    // The source wallet is fully drained (-balance) and the change returns via the remainder atom,\n    // so the 3 V-atoms conserve (sum == 0) and the validator's stackable full-drain guard accepts.\n    // Per-unit (stackable) movement is layered by calling Wallet.splitUnits(units, remainder,\n    // recipient) BEFORE this — there is no separate partial-debit transfer mode.\n    if (this.sourceWallet.balance - amount < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Initializing a new Atom to remove tokens from source (debit full balance)\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance\n    }))\n    // Initializing a new Atom to add tokens to recipient\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: recipientWallet,\n      value: amount,\n      metaType: 'walletBundle',\n      metaId: recipientWallet.bundle\n    }))\n    // Initializing a remainder atom\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   * Multi-recipient value transfer (WP line 544: one molecule funds N recipients).\n   *\n   * Builds 1 source atom (full-balance debit, carrying the SENT union of all units) + one atom\n   * per recipient (its amount + its own units, walletBundle-bonded) + 1 remainder atom (the KEPT\n   * change). Conservation: -balance + Σ amounts + (balance - Σ amounts) == 0.\n   *\n   * Per-unit (stackable) routing is layered by calling Wallet.splitUnitsMulti(...) BEFORE this —\n   * it sets the source's tokenUnits to the union, each recipient's to its subset, and the\n   * remainder's to the kept units. The single-recipient initValue() is the N=1 special case.\n   *\n   * @param {Wallet[]} recipientWallets\n   * @param {number[]} amounts - parallel to recipientWallets\n   * @return {Molecule}\n   */\n  initValues ({\n    recipientWallets,\n    amounts\n  }) {\n    const total = amounts.reduce((sum, value) => sum + Number(value), 0)\n\n    if (this.sourceWallet.balance - total < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Source atom: debit the full balance (UTXO); carries the SENT union of all units\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance\n    }))\n\n    // One atom per recipient: its amount + its own units, bonded to the recipient bundle\n    recipientWallets.forEach((recipientWallet, index) => {\n      this.addAtom(Atom.create({\n        isotope: 'V',\n        wallet: recipientWallet,\n        value: amounts[index],\n        metaType: 'walletBundle',\n        metaId: recipientWallet.bundle\n      }))\n    })\n\n    // Remainder atom: the change back to the sender; carries the KEPT units\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - total,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   *\n   * @param amount\n   * @param tradeRates\n   */\n  initDepositBuffer ({\n    amount,\n    tradeRates\n  }) {\n    if (this.sourceWallet.balance - amount < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Create a buffer wallet\n    const bufferWallet = Wallet.create({\n      secret: this.secret,\n      bundle: this.bundle,\n      token: this.sourceWallet.token,\n      batchId: this.sourceWallet.batchId,\n      mlKemParameterSet: this.mlKemParameterSet\n    })\n    bufferWallet.tradeRates = tradeRates\n\n    // Initializing a new Atom to remove tokens from source (debit full balance)\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance\n    }))\n\n    // Initializing a new Atom to add tokens to recipient\n    this.addAtom(Atom.create({\n      isotope: 'B',\n      wallet: bufferWallet,\n      value: amount,\n      metaType: 'walletBundle',\n      metaId: this.sourceWallet.bundle\n    }))\n\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.sourceWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   *\n   * @param {{}} recipients\n   * @param {Wallet|{}} signingWallet\n   * @returns {Molecule}\n   */\n  initWithdrawBuffer ({\n    recipients,\n    signingWallet = null\n  }) {\n    // Calculate final amount from all recipients\n    let amount = 0\n    for (const recipientAmount of Object.values(recipients || {})) {\n      amount += recipientAmount\n    }\n    if (this.sourceWallet.balance - amount < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Set a metas signing position for molecule correct reconciliation\n    const firstAtomMeta = new AtomMeta()\n    if (signingWallet) {\n      firstAtomMeta.setSigningWallet(signingWallet)\n    }\n\n    // Initializing a new Atom to remove tokens from source (debit full balance)\n    this.addAtom(Atom.create({\n      isotope: 'B',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance,\n      meta: firstAtomMeta,\n      metaType: 'walletBundle',\n      metaId: this.sourceWallet.bundle\n    }))\n\n    // Initializing a new Atom to add tokens to recipient\n    for (const [recipientBundle, recipientAmount] of Object.entries(recipients || {})) {\n      this.addAtom(new Atom({\n        isotope: 'V',\n        token: this.sourceWallet.token,\n        value: recipientAmount,\n        batchId: this.sourceWallet.batchId ? generateBatchId({}) : null,\n        metaType: 'walletBundle',\n        metaId: recipientBundle\n      }))\n    }\n\n    this.addAtom(Atom.create({\n      isotope: 'B',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   * Initialize a C-type molecule to issue a new type of token\n   *\n   * @param {Wallet} recipientWallet - wallet receiving the tokens. Needs to be initialized for the new token beforehand.\n   * @param {number} amount - how many of the token we are initially issuing (for fungible tokens only)\n   * @param {array|object} meta - additional fields to configure the token\n   * @return {Molecule}\n   */\n  initTokenCreation ({\n    recipientWallet,\n    amount,\n    meta\n  }) {\n    const atomMeta = new AtomMeta(meta)\n    atomMeta.setMetaWallet(recipientWallet)\n\n    // The primary atom tells the ledger that a certain amount of the new token is being issued.\n    this.addAtom(Atom.create({\n      isotope: 'C',\n      wallet: this.sourceWallet,\n      value: amount,\n      metaType: 'token',\n      metaId: recipientWallet.token,\n      meta: atomMeta,\n      batchId: recipientWallet.batchId\n    }))\n\n    // User remainder atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object[]} rule,\n   * @param {object} policy\n   * @return {Molecule}\n   */\n  createRule ({\n    metaType,\n    metaId,\n    rule,\n    policy = {}\n  }) {\n    const $rules = []\n\n    for (const $rule of rule) {\n      $rules.push($rule instanceof Rule ? $rule : Rule.toObject($rule))\n    }\n\n    // Create atom meta with rules\n    const atomMeta = new AtomMeta({\n      rule: JSON.stringify($rules)\n    })\n\n    // Add policies to meta object\n    atomMeta.addPolicy(policy)\n\n    this.addAtom(Atom.create({\n      isotope: 'R',\n      wallet: this.sourceWallet,\n      metaType,\n      metaId,\n      meta: atomMeta\n    }))\n\n    // User continuID atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Builds Atoms to define a new wallet on the ledger\n   *\n   * @param {Wallet} wallet\n   * @param {AtomMeta|null} atomMeta\n   * @return {Molecule}\n   */\n  initWalletCreation (wallet, atomMeta = null) {\n    if (!atomMeta) {\n      atomMeta = new AtomMeta()\n    }\n    atomMeta.setMetaWallet(wallet)\n    const creationAtom = Atom.create({\n      isotope: 'C',\n      wallet: this.sourceWallet,\n      metaType: 'wallet',\n      metaId: wallet.address,\n      meta: atomMeta,\n      batchId: wallet.batchId\n    })\n    this.addAtom(creationAtom)\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Init shadow wallet claim\n   *\n   * @param wallet\n   */\n  initShadowWalletClaim (wallet) {\n    const atomMeta = (new AtomMeta()).setShadowWalletClaim(true)\n    return this.initWalletCreation(wallet, atomMeta)\n  }\n\n  /**\n   * Builds Atoms to define a new identifier on the ledger\n   *\n   * @param {string} type - phone or email\n   * @param {string} contact - phone number or email string\n   * @param {string} code -\n   *\n   * @return {Molecule}\n   */\n  initIdentifierCreation ({\n    type,\n    contact,\n    code\n  }) {\n    const meta = {\n      code,\n      hash: generateBundleHash(contact.trim(), 'Molecule::initIdentifierCreation')\n    }\n\n    this.addAtom(Atom.create({\n      isotope: 'C',\n      wallet: this.sourceWallet,\n      metaType: 'identifier',\n      metaId: type,\n      meta: new AtomMeta(meta)\n    }))\n\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Initialize an M-type molecule with the given data\n   *\n   * @param {array|object} meta\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object} policy\n   * @return {Molecule}\n   */\n  initMeta ({\n    meta,\n    metaType,\n    metaId,\n    policy\n  }) {\n    // Initializing a new Atom to hold our metadata\n    this.addAtom(Atom.create({\n      isotope: 'M',\n      wallet: this.sourceWallet,\n      metaType,\n      metaId,\n      meta: new AtomMeta(meta)\n    }))\n\n    // Only add policy atom if policy is provided and not empty\n    if (policy && Object.keys(policy).length > 0) {\n      this.addPolicyAtom({\n        metaType,\n        metaId,\n        meta,\n        policy\n      })\n    }\n\n    // User remainder atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Initialize a P-type molecule for peer registration\n   *\n   * @param {string} host - The peer host URL to register\n   * @return {Molecule}\n   */\n  initPeering ({\n    host\n  }) {\n    this.addAtom(Atom.create({\n      isotope: 'P',\n      wallet: this.sourceWallet,\n      metaType: 'walletBundle',\n      metaId: this.bundle,\n      meta: new AtomMeta({ peerHost: host })\n    }))\n\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Initialize an A-type molecule for an append request\n   *\n   * @param {string} metaType - The target MetaType to append to\n   * @param {string} metaId - The target MetaId to append to\n   * @param {string} action - The action to perform\n   * @param {object} meta - Additional metadata\n   * @return {Molecule}\n   */\n  initAppendRequest ({\n    metaType,\n    metaId,\n    action,\n    meta = {}\n  }) {\n    this.addAtom(Atom.create({\n      isotope: 'A',\n      wallet: this.sourceWallet,\n      metaType,\n      metaId,\n      meta: new AtomMeta({ action, ...meta })\n    }))\n\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Arranges atoms to request tokens from the node itself\n   *\n   * @param {string} token\n   * @param {Number} amount\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {array|object} meta\n   * @param {string|null} batchId\n   *\n   * @return {Molecule}\n   */\n  initTokenRequest ({\n    token,\n    amount,\n    metaType,\n    metaId,\n    meta = {},\n    batchId = null\n  }) {\n    meta.token = token\n    meta.amount = String(amount)\n\n    this.addAtom(Atom.create({\n      isotope: 'T',\n      wallet: this.sourceWallet,\n      value: amount,\n      metaType,\n      metaId,\n      meta: new AtomMeta(meta),\n      batchId\n    }))\n\n    // User remainder atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Arranges atoms to request an authorization token from the node\n   *\n   * @param {object} meta\n   *\n   * @return {Molecule}\n   */\n  initAuthorization ({ meta }) {\n    this.addAtom(Atom.create({\n      isotope: 'U',\n      wallet: this.sourceWallet,\n      meta: new AtomMeta(meta)\n    }))\n\n    // User remainder atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Creates a one-time signature for a molecule and breaks it up across multiple atoms within that\n   * molecule. Resulting 4096 byte (2048 character) string is the one-time signature, which is then compressed.\n   *\n   * @param {string|null} bundle\n   * @param {boolean} anonymous\n   * @param {boolean} compressed\n   * @return {string|null}\n   * @throws {AtomsMissingException}\n   */\n  sign ({\n    bundle = null,\n    anonymous = false,\n    compressed = true\n  } = {}) {\n    // Do we have atoms?\n    if (this.atoms.length === 0 || this.atoms.filter(atom => !(atom instanceof Atom)).length !== 0) {\n      throw new AtomsMissingException()\n    }\n\n    // Derive the user's bundle\n    if (!anonymous && !this.bundle) {\n      this.bundle = bundle || generateBundleHash(this.secret, 'Molecule::sign')\n    }\n\n    // Hash atoms to get molecular hash\n    this.molecularHash = Atom.hashAtoms({\n      atoms: this.atoms\n    })\n\n    // Signing atom\n    const signingAtom = this.atoms[0]\n\n    // Set signing position from the first atom\n    let signingPosition = signingAtom.position\n\n    // Get signing wallet from first atom's metas\n    const signingWallet = Dot.get(signingAtom.aggregatedMeta(), 'signingWallet')\n\n    // Try to get custom signing position from the metas (local molecule with server secret)\n    if (signingWallet) {\n      signingPosition = Dot.get(JSON.parse(signingWallet), 'position')\n    }\n\n    // Signing position is required\n    if (!signingPosition) {\n      throw new SignatureMalformedException('Signing wallet must have a position!')\n    }\n\n    // Generate the private signing key for this molecule\n    const key = Wallet.generateKey({\n      secret: this.secret,\n      token: signingAtom.token,\n      position: signingAtom.position\n    })\n    // Subdivide Kk into 16 segments of 256 bytes (128 characters) each\n    const keyChunks = chunkSubstr(key, 128)\n    // Convert Hm to numeric notation, and then normalize\n    const normalizedHash = this.normalizedHash()\n\n    // Building a one-time-signature\n    let signatureFragments = ''\n\n    for (const index in keyChunks) {\n      let workingChunk = keyChunks[index]\n\n      for (let iterationCount = 0, condition = 8 - normalizedHash[index]; iterationCount < condition; iterationCount++) {\n        workingChunk = (new JsSHA('SHAKE256', 'TEXT')).update(workingChunk).getHash('HEX', { outputLen: 512 })\n      }\n      signatureFragments += workingChunk\n    }\n\n    // Compressing the OTS\n    if (compressed) {\n      signatureFragments = hexToBase64(signatureFragments)\n    }\n\n    // Chunking the signature across multiple atoms\n    const chunkedSignature = chunkSubstr(signatureFragments, Math.ceil(signatureFragments.length / this.atoms.length))\n\n    let lastPosition = null\n\n    for (let chunkCount = 0, condition = chunkedSignature.length; chunkCount < condition; chunkCount++) {\n      this.atoms[chunkCount].otsFragment = chunkedSignature[chunkCount]\n      lastPosition = this.atoms[chunkCount].position\n    }\n\n    return lastPosition\n  }\n\n  /**\n   * Synchronous signing — identical to sign() since all operations are CPU-bound.\n   * Provided for API parity with Rust SDK's sign_sync().\n   *\n   * @param {object} options\n   * @param {string|null} options.bundle\n   * @param {boolean} options.anonymous\n   * @param {boolean} options.compressed\n   * @return {string|null}\n   */\n  signSync (options = {}) {\n    return this.sign(options)\n  }\n\n  /**\n   * Returns the base cell slug portion\n   *\n   * @return {string}\n   */\n  cellSlugBase () {\n    return (this.cellSlug || '').split(this.cellSlugDelimiter)[0]\n  }\n\n  /**\n   * Returns JSON-ready object for cross-SDK compatibility (2025 JS best practices)\n   *\n   * Includes all necessary fields for cross-SDK validation while excluding sensitive data.\n   * Follows 2025 JavaScript best practices with proper error handling and type safety.\n   *\n   * @param {Object} options - Serialization options\n   * @param {boolean} options.includeValidationContext - Include sourceWallet/remainderWallet for validation (default: false)\n   * @param {boolean} options.includeOtsFragments - Include OTS signature fragments (default: true)\n   * @param {boolean} options.secureMode - Extra security checks (default: false)\n   * @return {Object} JSON-serializable object\n   * @throws {Error} If molecule is in invalid state for serialization\n   */\n  toJSON (options = {}) {\n    const {\n      includeValidationContext = false,\n      includeOtsFragments = true\n    } = options\n\n    try {\n      // Core molecule properties (server-compatible fields only)\n      const serialized = {\n        status: this.status,\n        molecularHash: this.molecularHash,\n        createdAt: this.createdAt,\n        cellSlug: this.cellSlug,\n        bundle: this.bundle,\n\n        // Serialized atoms array with optional OTS fragments\n        atoms: this.atoms.map(atom => atom.toJSON({\n          includeOtsFragments\n        }))\n      }\n\n      // Parent molecular hashes for DAG linkage (only include when non-empty\n      // to maintain backward compatibility with servers that don't support it)\n      if (this.parentHashes && this.parentHashes.length > 0) {\n        serialized.parentHashes = this.parentHashes\n      }\n\n      // Extended context for Rust validator and local validation\n      if (includeValidationContext) {\n        serialized.cellSlugOrigin = this.cellSlugOrigin\n        serialized.version = this.version\n\n        if (this.sourceWallet) {\n          serialized.sourceWallet = {\n            address: this.sourceWallet.address,\n            position: this.sourceWallet.position,\n            token: this.sourceWallet.token,\n            balance: this.sourceWallet.balance || '0',\n            bundle: this.sourceWallet.bundle,\n            batchId: this.sourceWallet.batchId || null,\n            characters: this.sourceWallet.characters || 'BASE64',\n            pubkey: this.sourceWallet.pubkey || null,\n            tokenUnits: this.sourceWallet.tokenUnits || [],\n            tradeRates: this.sourceWallet.tradeRates || {},\n            molecules: this.sourceWallet.molecules || {}\n          }\n        }\n\n        if (this.remainderWallet) {\n          serialized.remainderWallet = {\n            address: this.remainderWallet.address,\n            position: this.remainderWallet.position,\n            token: this.remainderWallet.token,\n            balance: this.remainderWallet.balance || '0',\n            bundle: this.remainderWallet.bundle,\n            batchId: this.remainderWallet.batchId || null,\n            characters: this.remainderWallet.characters || 'BASE64',\n            pubkey: this.remainderWallet.pubkey || null,\n            tokenUnits: this.remainderWallet.tokenUnits || [],\n            tradeRates: this.remainderWallet.tradeRates || {},\n            molecules: this.remainderWallet.molecules || {}\n          }\n        }\n      }\n\n      return serialized\n    } catch (error) {\n      throw new Error(`Molecule serialization failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Creates a Molecule instance from JSON data (2025 JS best practices)\n   *\n   * Handles cross-SDK deserialization with robust error handling and validation.\n   * Essential for cross-platform molecule validation and compatibility testing.\n   *\n   * @param {string|Object} json - JSON string or object to deserialize\n   * @param {Object} options - Deserialization options\n   * @param {boolean} options.includeValidationContext - Reconstruct sourceWallet/remainderWallet (default: false)\n   * @param {boolean} options.validateStructure - Validate required fields (default: true)\n   * @return {Molecule} Reconstructed molecule instance\n   * @throws {Error} If JSON is invalid or required fields are missing\n   */\n  static fromJSON (json, options = {}) {\n    const {\n      includeValidationContext = false,\n      validateStructure = true\n    } = options\n\n    try {\n      // Parse JSON safely\n      const data = typeof json === 'string' ? JSON.parse(json) : json\n\n      // Validate required fields in strict mode\n      if (validateStructure) {\n        if (!data.molecularHash || !Array.isArray(data.atoms)) {\n          throw new Error('Invalid molecule data: missing molecularHash or atoms array')\n        }\n      }\n\n      // Create minimal molecule instance (never include secret from JSON)\n      const molecule = new Molecule({\n        secret: null,\n        bundle: data.bundle || null,\n        cellSlug: data.cellSlug || null,\n        version: data.version || null\n      })\n\n      // Populate core properties\n      molecule.status = data.status\n      molecule.molecularHash = data.molecularHash\n      molecule.createdAt = data.createdAt || String(+new Date())\n      molecule.cellSlugOrigin = data.cellSlugOrigin\n      molecule.parentHashes = Array.isArray(data.parentHashes) ? [...data.parentHashes] : []\n\n      // Reconstruct atoms array with proper Atom instances\n      if (Array.isArray(data.atoms)) {\n        molecule.atoms = data.atoms.map((atomData, index) => {\n          try {\n            return Atom.fromJSON(atomData)\n          } catch (error) {\n            throw new Error(`Failed to reconstruct atom ${index}: ${error.message}`)\n          }\n        })\n      }\n\n      // Reconstruct validation context if available and requested\n      if (includeValidationContext) {\n        if (data.sourceWallet) {\n          // Create source wallet for validation (without secret for security)\n          molecule.sourceWallet = new Wallet({\n            secret: null,\n            token: data.sourceWallet.token,\n            position: data.sourceWallet.position,\n            bundle: data.sourceWallet.bundle,\n            batchId: data.sourceWallet.batchId,\n            characters: data.sourceWallet.characters,\n            mlKemParameterSet: molecule.mlKemParameterSet\n          })\n\n          // Set additional properties for validation context\n          molecule.sourceWallet.balance = String(data.sourceWallet.balance != null ? data.sourceWallet.balance : 0)\n          molecule.sourceWallet.address = data.sourceWallet.address\n          if (data.sourceWallet.pubkey) {\n            molecule.sourceWallet.pubkey = data.sourceWallet.pubkey\n          }\n          molecule.sourceWallet.tokenUnits = data.sourceWallet.tokenUnits || []\n          molecule.sourceWallet.tradeRates = data.sourceWallet.tradeRates || {}\n          molecule.sourceWallet.molecules = data.sourceWallet.molecules || {}\n        }\n\n        if (data.remainderWallet) {\n          // Create remainder wallet for validation (without secret for security)\n          molecule.remainderWallet = new Wallet({\n            secret: null,\n            token: data.remainderWallet.token,\n            position: data.remainderWallet.position,\n            bundle: data.remainderWallet.bundle,\n            batchId: data.remainderWallet.batchId,\n            characters: data.remainderWallet.characters,\n            mlKemParameterSet: molecule.mlKemParameterSet\n          })\n\n          // Set additional properties for validation context\n          molecule.remainderWallet.balance = String(data.remainderWallet.balance != null ? data.remainderWallet.balance : 0)\n          molecule.remainderWallet.address = data.remainderWallet.address\n          if (data.remainderWallet.pubkey) {\n            molecule.remainderWallet.pubkey = data.remainderWallet.pubkey\n          }\n          molecule.remainderWallet.tokenUnits = data.remainderWallet.tokenUnits || []\n          molecule.remainderWallet.tradeRates = data.remainderWallet.tradeRates || {}\n          molecule.remainderWallet.molecules = data.remainderWallet.molecules || {}\n        }\n      }\n\n      return molecule\n    } catch (error) {\n      throw new Error(`Molecule deserialization failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Validates the current molecular structure\n   *\n   * @param senderWallet\n   */\n  check (senderWallet = null) {\n    return (new CheckMolecule(this)).verify(senderWallet)\n  }\n\n  /**\n   * Convert Hm to numeric notation via EnumerateMolecule(Hm)\n   *\n   * @returns {Array}\n   */\n  normalizedHash () {\n    return Molecule.normalize(Molecule.enumerate(this.molecularHash))\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Wallet from './Wallet.js'\n\n/**\n *\n */\nexport default class AuthToken {\n  /**\n   *\n   * @param {string} token\n   * @param {number} expiresAt\n   * @param {boolean} encrypt\n   * @param {string} pubkey\n   */\n  constructor ({\n    token,\n    expiresAt,\n    encrypt,\n    pubkey\n  }) {\n    this.$__token = token\n    this.$__expiresAt = expiresAt\n    this.$__pubkey = pubkey\n    this.$__encrypt = encrypt\n  }\n\n  /**\n   *\n   * @param data\n   * @param wallet\n   * @returns {AuthToken}\n   */\n  static create (data, wallet) {\n    const authToken = new AuthToken(data)\n    authToken.setWallet(wallet)\n    return authToken\n  }\n\n  /**\n   * ML-KEM parameter set a restored session must use, resolved in three tiers:\n   * an explicit snapshot field, then the stored validator key's length, then ML-KEM-768.\n   *\n   * The final tier is deliberately NOT the constructor default. A snapshot with neither an\n   * explicit field nor a recognisable key can only have come from a pre-bump build, and every\n   * pre-bump build was 768-only — defaulting to 1024 would make the restored wallet advertise\n   * a public key the validator never recorded for that token.\n   *\n   * @param {object} snapshot\n   * @return {number}\n   */\n  static resolveMlKemParameterSet (snapshot) {\n    const explicit = snapshot.wallet && snapshot.wallet.mlKemParameterSet\n    if (explicit) {\n      return Number(explicit)\n    }\n    return Wallet.mlKemParameterSetFromPubkey(snapshot.pubkey) || 768\n  }\n\n  /**\n   *\n   * @param {object} snapshot\n   * @param {string} secret\n   * @return {AuthToken}\n   */\n  static restore (snapshot, secret) {\n    const wallet = new Wallet({\n      secret,\n      token: 'AUTH',\n      position: snapshot.wallet.position,\n      characters: snapshot.wallet.characters,\n      mlKemParameterSet: AuthToken.resolveMlKemParameterSet(snapshot)\n    })\n    return AuthToken.create({\n      token: snapshot.token,\n      expiresAt: snapshot.expiresAt,\n      pubkey: snapshot.pubkey,\n      encrypt: snapshot.encrypt\n    }, wallet)\n  }\n\n  /**\n   *\n   * @param {Wallet} wallet\n   */\n  setWallet (wallet) {\n    this.$__wallet = wallet\n  }\n\n  /**\n   * Get a wallet\n   * @return {Wallet}\n   */\n  getWallet () {\n    return this.$__wallet\n  }\n\n  /**\n   *\n   * @return {{wallet: {characters, position, mlKemParameterSet}, encrypt, expiresAt, token, pubkey}}\n   */\n  getSnapshot () {\n    return {\n      token: this.$__token,\n      expiresAt: this.$__expiresAt,\n      pubkey: this.$__pubkey,\n      encrypt: this.$__encrypt,\n      wallet: {\n        position: this.$__wallet.position,\n        characters: this.$__wallet.characters,\n        mlKemParameterSet: this.$__wallet.mlKemParameterSet\n      }\n    }\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  getToken () {\n    return this.$__token\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  getPubkey () {\n    return this.$__pubkey\n  }\n\n  /**\n   *\n   * @return {number}\n   */\n  getExpireInterval () {\n    return (this.$__expiresAt * 1000) - Date.now()\n  }\n\n  /**\n   *\n   * @return {boolean}\n   */\n  isExpired () {\n    return !this.$__expiresAt || this.getExpireInterval() < 0\n  }\n\n  /**\n   * Get auth data for the final GraphQL client\n   * @return {{wallet: Wallet, token: string, pubkey: string}}\n   */\n  getAuthData () {\n    return {\n      token: this.getToken(),\n      pubkey: this.getPubkey(),\n      wallet: this.getWallet()\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport BaseException from './BaseException.js'\n\n/**\n * Exception thrown when secret storage or hardware envelope encryption fails\n */\nexport default class SecretStorageException extends BaseException {\n  /**\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Secret storage operation failed', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'SecretStorageException'\n  }\n\n  /**\n   * Factory method: secret not found for bundle\n   *\n   * @param {string} bundleHash\n   * @returns {SecretStorageException}\n   */\n  static notFound (bundleHash) {\n    return new SecretStorageException(`Secret not found for bundle: ${bundleHash}`)\n  }\n\n  /**\n   * Factory method: decryption failed\n   *\n   * @param {string} [reason]\n   * @returns {SecretStorageException}\n   */\n  static decryptionFailed (reason = 'Invalid passphrase or corrupted ciphertext') {\n    return new SecretStorageException(`Failed to decrypt master secret: ${reason}`)\n  }\n\n  /**\n   * Factory method: provider unavailable\n   *\n   * @param {string} provider\n   * @param {string} [reason]\n   * @returns {SecretStorageException}\n   */\n  static unavailable (provider, reason = 'Hardware or API not accessible') {\n    return new SecretStorageException(`Secret storage provider '${provider}' is unavailable: ${reason}`)\n  }\n\n  /**\n   * Factory method: validation error\n   *\n   * @param {string} message\n   * @returns {SecretStorageException}\n   */\n  static validationError (message) {\n    return new SecretStorageException(message)\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\n/**\n * Memory hygiene and zeroization utilities for sensitive cryptographic material\n */\n\nconst textEncoder = new TextEncoder()\n\n/**\n * Overwrite byte array contents with zeros\n *\n * @param {Uint8Array|number[]} buffer\n */\nexport function zeroizeBytes (buffer) {\n  if (buffer instanceof Uint8Array) {\n    buffer.fill(0)\n  } else if (Array.isArray(buffer)) {\n    for (let i = 0; i < buffer.length; i++) {\n      buffer[i] = 0\n    }\n  }\n}\n\n/**\n * Execute a callback with a byte buffer and guarantee zeroization upon completion\n *\n * @template T\n * @param {Uint8Array} bytes\n * @param {(bytes: Uint8Array) => Promise<T>|T} fn\n * @returns {Promise<T>}\n */\nexport async function withSecureBytes (bytes, fn) {\n  try {\n    return await fn(bytes)\n  } finally {\n    zeroizeBytes(bytes)\n  }\n}\n\n/**\n * Execute a callback with a secret string, ensuring temporary byte buffers are cleared\n *\n * @template T\n * @param {string} secret\n * @param {(cleanSecret: string) => Promise<T>|T} fn\n * @returns {Promise<T>}\n */\nexport async function withSecureString (secret, fn) {\n  const bytes = textEncoder.encode(secret)\n  try {\n    return await fn(secret)\n  } finally {\n    zeroizeBytes(bytes)\n  }\n}\n\n/**\n * Constant-time comparison of two byte arrays or strings to prevent timing attacks\n *\n * @param {Uint8Array|string} a\n * @param {Uint8Array|string} b\n * @returns {boolean}\n */\nexport function constantTimeCompare (a, b) {\n  const bytesA = typeof a === 'string' ? textEncoder.encode(a) : a\n  const bytesB = typeof b === 'string' ? textEncoder.encode(b) : b\n\n  let result = bytesA.length === bytesB.length ? 0 : 1\n  const len = Math.min(bytesA.length, bytesB.length)\n\n  for (let i = 0; i < len; i++) {\n    result |= (bytesA[i] ?? 0) ^ (bytesB[i] ?? 0)\n  }\n\n  if (typeof a === 'string') zeroizeBytes(bytesA)\n  if (typeof b === 'string') zeroizeBytes(bytesB)\n\n  return result === 0\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                            (//////////(                      (////)\n                            (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { zeroizeBytes } from '../libraries/secureMemory.js'\n\nexport const ENVELOPE_ALGORITHM = 'AES-GCM'\nexport const DEFAULT_ITERATIONS = 100000\nexport const SECRET_KEY_PREFIX = 'knishio:secret:'\nexport const RECOVERY_KEY_PREFIX = 'knishio:recovery:'\nconst GCM_IV_LENGTH = 12\nconst SALT_LENGTH = 16\n\nconst textEncoder = new TextEncoder()\n\n/**\n * Helper to convert Uint8Array to base64\n *\n * @param {Uint8Array} bytes\n * @returns {string}\n */\nexport function uint8ArrayToBase64 (bytes) {\n  let binary = ''\n  const len = bytes.byteLength\n  for (let i = 0; i < len; i++) {\n    const byte = bytes[i]\n    if (byte !== undefined) {\n      binary += String.fromCharCode(byte)\n    }\n  }\n  return btoa(binary)\n}\n\n/**\n * Helper to convert base64 to Uint8Array\n *\n * @param {string} base64\n * @returns {Uint8Array}\n */\nexport function base64ToUint8Array (base64) {\n  const binary = atob(base64)\n  const len = binary.length\n  const bytes = new Uint8Array(len)\n  for (let i = 0; i < len; i++) {\n    bytes[i] = binary.charCodeAt(i)\n  }\n  return bytes\n}\n\n/**\n * Derive an AES-GCM CryptoKey from a passphrase and salt using PBKDF2\n *\n * @param {string} passphrase\n * @param {Uint8Array} salt\n * @param {number} [iterations]\n * @returns {Promise<CryptoKey>}\n */\nexport async function deriveEnvelopeKey (passphrase, salt, iterations = DEFAULT_ITERATIONS) {\n  if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle === 'undefined') {\n    throw new SecretStorageException('WebCrypto API is not available')\n  }\n\n  const passphraseBytes = textEncoder.encode(passphrase)\n  try {\n    const baseKey = await globalThis.crypto.subtle.importKey(\n      'raw',\n      passphraseBytes,\n      'PBKDF2',\n      false,\n      ['deriveKey']\n    )\n\n    return await globalThis.crypto.subtle.deriveKey(\n      {\n        name: 'PBKDF2',\n        salt,\n        iterations,\n        hash: 'SHA-256'\n      },\n      baseKey,\n      { name: 'AES-GCM', length: 256 },\n      false,\n      ['encrypt', 'decrypt']\n    )\n  } finally {\n    zeroizeBytes(passphraseBytes)\n  }\n}\n\n/**\n * Seal a secret string into an EncryptedSecretPayload envelope\n *\n * @param {string} secret\n * @param {string} passphrase\n * @param {object} metadata\n * @returns {Promise<object>}\n */\nexport async function sealEnvelope (secret, passphrase, metadata) {\n  if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle === 'undefined') {\n    throw new SecretStorageException('WebCrypto API is not available')\n  }\n\n  const salt = new Uint8Array(SALT_LENGTH)\n  const iv = new Uint8Array(GCM_IV_LENGTH)\n  globalThis.crypto.getRandomValues(salt)\n  globalThis.crypto.getRandomValues(iv)\n\n  const key = await deriveEnvelopeKey(passphrase, salt, DEFAULT_ITERATIONS)\n  const secretBytes = textEncoder.encode(secret)\n\n  try {\n    const encryptedBuffer = await globalThis.crypto.subtle.encrypt(\n      {\n        name: ENVELOPE_ALGORITHM,\n        iv\n      },\n      key,\n      secretBytes\n    )\n\n    const ciphertext = uint8ArrayToBase64(new Uint8Array(encryptedBuffer))\n    return {\n      version: 1,\n      ciphertext,\n      iv: uint8ArrayToBase64(iv),\n      salt: uint8ArrayToBase64(salt),\n      algorithm: ENVELOPE_ALGORITHM,\n      iterations: DEFAULT_ITERATIONS,\n      metadata\n    }\n  } finally {\n    zeroizeBytes(secretBytes)\n  }\n}\n\n/**\n * Open an EncryptedSecretPayload envelope with a passphrase, returning the decrypted secret bytes\n *\n * @param {object} payload\n * @param {string} passphrase\n * @returns {Promise<Uint8Array>}\n */\nexport async function openEnvelope (payload, passphrase) {\n  if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle === 'undefined') {\n    throw new SecretStorageException('WebCrypto API is not available')\n  }\n\n  const salt = base64ToUint8Array(payload.salt)\n  const iv = base64ToUint8Array(payload.iv)\n  const ciphertext = base64ToUint8Array(payload.ciphertext)\n\n  const key = await deriveEnvelopeKey(passphrase, salt, payload.iterations ?? DEFAULT_ITERATIONS)\n  const decryptedBuffer = await globalThis.crypto.subtle.decrypt(\n    {\n      name: ENVELOPE_ALGORITHM,\n      iv\n    },\n    key,\n    ciphertext\n  )\n\n  return new Uint8Array(decryptedBuffer)\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { withSecureString, zeroizeBytes } from '../libraries/secureMemory.js'\nimport { sealEnvelope, openEnvelope } from './secretEnvelope.js'\n\n/**\n * In-memory secret storage provider\n * Used for testing, headless runners, and backward-compatible fallback\n */\nexport default class MemorySecretStorageProvider {\n  constructor () {\n    this.providerType = 'memory'\n    this.secrets = new Map()\n    this.recoverySecrets = new Map()\n  }\n\n  /**\n   * Memory storage is not hardware backed\n   *\n   * @returns {boolean}\n   */\n  isHardwareBacked () {\n    return false\n  }\n\n  /**\n   * Memory storage is always available\n   *\n   * @returns {Promise<boolean>}\n   */\n  async isAvailable () {\n    return true\n  }\n\n  /**\n   * Store a secret in memory\n   *\n   * @param {string} bundleHash\n   * @param {string} secret\n   * @param {{ label?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async storeSecret (bundleHash, secret, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!secret) {\n      throw new SecretStorageException('Secret cannot be empty')\n    }\n\n    const metadata = {\n      bundleHash,\n      label: options.label,\n      createdAt: Date.now(),\n      hardwareBacked: false,\n      providerType: this.providerType\n    }\n\n    this.secrets.set(bundleHash, { secret, metadata })\n\n    if (options.recoveryPassphrase) {\n      const recoveryMetadata = {\n        bundleHash,\n        label: options.label,\n        createdAt: Date.now(),\n        hardwareBacked: false,\n        providerType: 'webcrypto-aes-gcm'\n      }\n      const recoveryPayload = await sealEnvelope(secret, options.recoveryPassphrase, recoveryMetadata)\n      this.recoverySecrets.set(bundleHash, JSON.stringify(recoveryPayload))\n    }\n  }\n\n  /**\n   * Retrieve a secret from memory\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<string|null>}\n   */\n  async retrieveSecret (bundleHash) {\n    const entry = this.secrets.get(bundleHash)\n    return entry ? entry.secret : null\n  }\n\n  /**\n   * Delete a stored secret\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<boolean>}\n   */\n  async deleteSecret (bundleHash) {\n    this.recoverySecrets.delete(bundleHash)\n    return this.secrets.delete(bundleHash)\n  }\n\n  /**\n   * Check if a secret exists\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<boolean>}\n   */\n  async hasSecret (bundleHash) {\n    return this.secrets.has(bundleHash)\n  }\n\n  /**\n   * List all stored secret metadata\n   *\n   * @returns {Promise<Array<{ bundleHash: string, label?: string, createdAt: number, hardwareBacked: boolean, providerType: string }>>}\n   */\n  async listSecrets () {\n    return Array.from(this.secrets.values()).map(entry => ({ ...entry.metadata }))\n  }\n\n  /**\n   * Execute callback with unwrapped secret and ensure cleanup\n   *\n   * @template T\n   * @param {string} bundleHash\n   * @param {(secret: string) => Promise<T>|T} fn\n   * @returns {Promise<T>}\n   */\n  async withSecret (bundleHash, fn) {\n    const entry = this.secrets.get(bundleHash)\n    if (!entry) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    return withSecureString(entry.secret, fn)\n  }\n\n  /**\n   * Clear all secrets from memory\n   */\n  clear () {\n    this.secrets.clear()\n    this.recoverySecrets.clear()\n  }\n\n  /**\n   * Recover a secret using its recovery envelope and restore it\n   *\n   * @param {string} bundleHash\n   * @param {string} recoveryPassphrase\n   * @param {{ label?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async recoverSecret (bundleHash, recoveryPassphrase, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!recoveryPassphrase) {\n      throw new SecretStorageException('Recovery passphrase cannot be empty')\n    }\n\n    const raw = this.recoverySecrets.get(bundleHash)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted recovery payload format')\n    }\n\n    let decryptedBytes\n    try {\n      decryptedBytes = await openEnvelope(payload, recoveryPassphrase)\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n\n    let secretStr\n    try {\n      secretStr = new TextDecoder().decode(decryptedBytes)\n    } finally {\n      zeroizeBytes(decryptedBytes)\n    }\n\n    await this.storeSecret(bundleHash, secretStr, {\n      ...options,\n      recoveryPassphrase\n    })\n  }\n}\n","// Value determines by min sql decimal precision\nconst multiplier = 10 ** 18\n\nexport default class Decimal {\n  /**\n   * @param {number} value\n   * @return {number}\n   */\n  static val (value) {\n    if (Math.abs(value * multiplier) < 1) {\n      return 0.0\n    }\n\n    return value\n  }\n\n  /**\n   * @param {number} value1\n   * @param {number} value2\n   * @param {boolean} debug\n   * @return {number}\n   */\n  static cmp (value1, value2, debug = false) {\n    const val1 = Decimal.val(value1) * multiplier\n    const val2 = Decimal.val(value2) * multiplier\n\n    // Equal\n    if (Math.abs(val1 - val2) < 1) {\n      return 0\n    }\n\n    // Greater or smaller\n    return (val1 > val2) ? 1 : -1\n  }\n\n  /**\n   * @param {number} value1\n   * @param {number} value2\n   * @return {boolean}\n   */\n  static equal (value1, value2) {\n    return (Decimal.cmp(value1, value2) === 0)\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Exception for bad GraphQL responses\n */\nexport default class InvalidResponseException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'GraphQL did not provide a valid response.', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'InvalidResponseException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when attempting to transact without an auth token\n */\nexport default class UnauthenticatedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Authorization token missing or invalid.', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'UnauthenticatedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport InvalidResponseException from '../exception/InvalidResponseException.js'\nimport UnauthenticatedException from '../exception/UnauthenticatedException.js'\nimport Dot from '../libraries/Dot.js'\n\n/**\n * Base Response class for processing node responses\n */\nexport default class Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   * @param {string|null} dataKey\n   */\n  constructor ({\n    query,\n    json,\n    dataKey = null\n  }) {\n    this.dataKey = dataKey\n    this.errorKey = 'exception'\n    this.$__payload = null\n    this.$__query = query\n    this.$__originResponse = json\n    this.$__response = json\n\n    if (typeof this.$__response === 'undefined' || this.$__response === null) {\n      throw new InvalidResponseException()\n    }\n\n    if (Dot.has(this.$__response, this.errorKey)) {\n      const error = Dot.get(this.$__response, this.errorKey)\n\n      if (String(error).includes('Unauthenticated')) {\n        throw new UnauthenticatedException()\n      }\n\n      throw new InvalidResponseException()\n    }\n\n    // Check for GraphQL errors array\n    if (this.$__response.errors && Array.isArray(this.$__response.errors) && this.$__response.errors.length > 0) {\n      const errorMessage = this.$__response.errors[0].message || 'Unknown GraphQL error'\n\n      if (errorMessage.includes('Unauthenticated')) {\n        throw new UnauthenticatedException()\n      }\n\n      throw new InvalidResponseException(`GraphQL Error: ${errorMessage}`)\n    }\n\n    this.init()\n  }\n\n  /**\n   *\n   */\n  init () {\n  }\n\n  /**\n   * @return {*}\n   */\n  data () {\n    if (!this.dataKey) {\n      return this.response()\n    }\n\n    // Check if response has data field\n    if (!this.response().data) {\n      throw new InvalidResponseException('Response has no data field')\n    }\n\n    // Check key & return custom data from the response\n    if (!Dot.has(this.response(), this.dataKey)) {\n      throw new InvalidResponseException(`Missing expected field: ${this.dataKey}`)\n    }\n\n    return Dot.get(this.response(), this.dataKey)\n  }\n\n  /**\n   * @return {object}\n   */\n  response () {\n    return this.$__response\n  }\n\n  /**\n   * @return {*}\n   */\n  payload () {\n    return null\n  }\n\n  /**\n   * @return {Query}\n   */\n  query () {\n    return this.$__query\n  }\n\n  /**\n   * @return {*}\n   */\n  status () {\n    return null\n  }\n\n  /**\n   * Check if response was successful\n   * @return {boolean}\n   */\n  success () {\n    // Default implementation - can be overridden by subclasses\n    return !this.$__response?.errors?.length\n  }\n\n  /**\n   * Get error message if any\n   *\n   * @return {string|null}\n   */\n  error () {\n    return this.$__response?.errors?.length ? this.$__response.errors[0].message || 'Unknown error' : null\n  }\n\n  /**\n   * Enhanced interface methods for standardized response handling\n   */\n\n  /**\n   * Get error reason (alias for error() to match standardized interface)\n   * @return {string|null}\n   */\n  reason () {\n    return this.error()\n  }\n\n  /**\n   * Convert to ValidationResult for enhanced error handling\n   * @return {object}\n   */\n  toValidationResult () {\n    if (this.success() && this.payload() !== null) {\n      return {\n        success: true,\n        data: this.payload(),\n        warnings: []\n      }\n    } else {\n      return {\n        success: false,\n        error: {\n          message: this.reason() || 'Unknown error',\n          context: this.constructor.name,\n          details: this.$__response?.errors || []\n        }\n      }\n    }\n  }\n\n  /**\n   * Enhanced error handling with callbacks\n   * @param {function} callback\n   * @return {Response}\n   */\n  onSuccess (callback) {\n    if (this.success() && this.payload() !== null) {\n      try {\n        callback(this.payload())\n      } catch (error) {\n        console.warn('Response.onSuccess callback failed:', error)\n      }\n    }\n    return this\n  }\n\n  /**\n   * Enhanced failure handling with callbacks\n   * @param {function} callback\n   * @return {Response}\n   */\n  onFailure (callback) {\n    if (!this.success()) {\n      try {\n        callback(this.reason() || 'Unknown error')\n      } catch (error) {\n        console.warn('Response.onFailure callback failed:', error)\n      }\n    }\n    return this\n  }\n\n  /**\n   * Debug logging with enhanced context\n   * @param {string|null} label\n   * @return {Response}\n   */\n  debug (label = null) {\n    const debugPrefix = label ? `[${label}]` : `[${this.constructor.name}]`\n\n    if (this.success()) {\n      console.debug(`${debugPrefix} Success:`, {\n        payload: this.payload(),\n        query: this.$__query?.constructor?.name,\n        dataKey: this.dataKey\n      })\n    } else {\n      console.debug(`${debugPrefix} Failure:`, {\n        error: this.reason(),\n        errors: this.$__response?.errors,\n        rawData: this.$__response\n      })\n    }\n\n    return this\n  }\n\n  /**\n   * Promise conversion for enhanced async patterns\n   * @return {Promise}\n   */\n  toPromise () {\n    if (this.success() && this.payload() !== null) {\n      return Promise.resolve(this.payload())\n    } else {\n      return Promise.reject(new Error(this.reason() || 'Unknown error'))\n    }\n  }\n\n  /**\n   * Functional programming map operation\n   * @param {function} mapper\n   * @return {Response}\n   */\n  map (mapper) {\n    if (this.success() && this.payload() !== null) {\n      try {\n        const mappedPayload = mapper(this.payload())\n        // Create new response with mapped payload\n        const newResponse = Object.create(Object.getPrototypeOf(this))\n        Object.assign(newResponse, this)\n        newResponse.$__payload = mappedPayload\n        return newResponse\n      } catch (error) {\n        // Create error response\n        const errorResponse = Object.create(Object.getPrototypeOf(this))\n        Object.assign(errorResponse, this)\n        errorResponse.$__response = { errors: [{ message: `Mapping failed: ${error.message}` }] }\n        return errorResponse\n      }\n    } else {\n      return this\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport CodeException from '../exception/CodeException.js'\nimport Response from '../response/Response.js'\n\nexport default class Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    this.client = graphQLClient\n    this.knishIOClient = knishIOClient\n    this.$__variables = null\n    this.$__query = null\n    this.$__response = null\n    this.$__request = null\n  }\n\n  /**\n   * Return a response object\n   * Used at KnishIOClient::createMolecule => sets the source wallet from the remainder one stored in response object\n   * @return {Response}\n   */\n  response () {\n    return this.$__response\n  }\n\n  /**\n   * Builds a Response based on JSON input\n   *\n   * @param response\n   * @return {Promise<Response>}\n   */\n  async createResponseRaw (response) {\n    return this.createResponse(response)\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {Response}\n   */\n  createResponse (json) {\n    return new Response({\n      query: this,\n      json\n    })\n  }\n\n  /**\n   * Creates a new Request for the given parameters\n   *\n   * @param {{}} variables\n   * @returns {{variables: (Object|null), query: null}}\n   */\n  createQuery ({ variables = null }) {\n    this.$__variables = this.compiledVariables(variables)\n\n    // Uri is a required parameter\n    const uri = this.uri()\n\n    if (!uri) {\n      throw new CodeException('Query::createQuery() - Node URI was not initialized for this client instance!')\n    }\n\n    if (this.$__query === null) {\n      throw new CodeException('Query::createQuery() - GraphQL subscription was not initialized!')\n    }\n\n    return {\n      query: this.$__query,\n      variables: this.variables()\n    }\n  }\n\n  /**\n   * Sends the Query to a Knish.IO node and returns the Response\n   *\n   * @param {object} variables\n   * @param {object} context\n   * @return {Promise<Response>}\n   */\n  async execute ({ variables = null, context = {} }) {\n    this.$__request = this.createQuery({ variables })\n\n    const mergedContext = {\n      ...context,\n      ...this.createQueryContext()\n    }\n\n    try {\n      const response = await this.client.query({\n        ...this.$__request,\n        context: mergedContext\n      })\n\n      this.$__response = await this.createResponseRaw(response)\n\n      return this.$__response\n    } catch (error) {\n      if (error.name === 'AbortError') {\n        this.knishIOClient.log('warn', 'Query was cancelled')\n        // You might want to create a custom response for cancelled queries\n        return new Response({\n          query: this,\n          json: { data: null, errors: [{ message: 'Query was cancelled' }] }\n        })\n      } else {\n        throw error\n      }\n    }\n  }\n\n  /**\n   * Returns a variables object for the Query\n   *\n   * @param {object} variables\n   * @return {object}\n   */\n  compiledVariables (variables = null) {\n    return variables || {}\n  }\n\n  /**\n   * Returns the Knish.IO endpoint URI\n   *\n   * @return {string}\n   */\n  uri () {\n    return this.client.getUri()\n  }\n\n  /**\n   * Returns the query variables object\n   *\n   * @return {object|null}\n   */\n  variables () {\n    return this.$__variables\n  }\n\n  createQueryContext () {\n    // Override this method in subclasses if needed\n    return {}\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Wallet from '../Wallet.js'\n\n/**\n * Response for ContinuID query\n */\nexport default class ResponseContinuId extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.ContinuId'\n    })\n  }\n\n  /**\n   * Returns the ContinuID wallet\n   *\n   * @return {Wallet|null}\n   */\n  payload () {\n    let wallet = null\n\n    const continuId = this.data()\n\n    if (continuId) {\n      wallet = new Wallet({\n        secret: null,\n        token: continuId.tokenSlug\n      })\n      wallet.address = continuId.address\n      wallet.position = continuId.position\n      wallet.bundle = continuId.bundleHash\n      wallet.batchId = continuId.batchId\n      wallet.characters = continuId.characters\n      wallet.pubkey = continuId.pubkey\n      wallet.balance = String(continuId.amount != null ? continuId.amount : 0)\n    }\n\n    return wallet\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseContinuId from '../response/ResponseContinuId.js'\nimport { gql } from '@urql/core'\n\n/**\n * Queries the node for the next wallet to sign with for ContinuID\n */\nexport default class QueryContinuId extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query ($bundle: String!) {\n      ContinuId(bundle: $bundle) {\n        address,\n        bundleHash,\n        tokenSlug,\n        position,\n        batchId,\n        characters,\n        pubkey,\n        amount,\n        createdAt\n      }\n    }`\n  }\n\n  /**\n   * Force network-only for ContinuID queries to prevent URQL cache from\n   * returning stale wallet positions after mutations advance the ContinuID chain\n   */\n  createQueryContext () {\n    return { requestPolicy: 'network-only' }\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseContinuId}\n   */\n  createResponse (json) {\n    return new ResponseContinuId({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Meta from '../Meta.js'\n\n/**\n * Response for Wallet Bundle query\n */\nexport default class ResponseWalletBundle extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.WalletBundle'\n    })\n  }\n\n  /**\n   * Returns a wallet bundle with normalized metadata\n   *\n   * @return {{}|null}\n   */\n  payload () {\n    const bundleData = this.data()\n\n    if (!bundleData || bundleData.length === 0) {\n      return null\n    }\n\n    const aggregate = {}\n\n    bundleData.forEach(bundle => {\n      bundle.metas = Meta.aggregateMeta(bundle.metas)\n      aggregate[bundle.bundleHash] = bundle\n    })\n\n    return aggregate\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseWalletBundle from '../response/ResponseWalletBundle.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving information about Wallet Bundles\n */\nexport default class QueryWalletBundle extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $bundleHashes: [ String! ] ) {\n      WalletBundle( bundleHashes: $bundleHashes ) {\n        bundleHash,\n        metas {\n          molecularHash,\n          position,\n          key,\n          value,\n          createdAt\n        },\n        createdAt\n      }\n    }`\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseWalletBundle}\n   */\n  createResponse (json) {\n    return new ResponseWalletBundle({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Wallet from '../Wallet.js'\nimport TokenUnit from '../TokenUnit.js'\n\n/**\n * Response for Wallet List query\n */\nexport default class ResponseWalletList extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.Wallet'\n    })\n  }\n\n  /**\n   * Returns a Knish.IO client Wallet class instance out of object data\n   *\n   * @param {object} data\n   * @param {string|null} secret\n   * @return {Wallet}\n   */\n  static toClientWallet ({\n    data,\n    secret = null\n  }) {\n    let wallet\n\n    if (data.position === null || typeof data.position === 'undefined') {\n      wallet = Wallet.create({\n        bundle: data.bundleHash,\n        token: data.tokenSlug,\n        batchId: data.batchId,\n        characters: data.characters\n      })\n    } else {\n      wallet = new Wallet({\n        secret,\n        token: data.tokenSlug,\n        position: data.position,\n        batchId: data.batchId,\n        characters: data.characters\n      })\n      wallet.address = data.address\n      wallet.bundle = data.bundleHash\n    }\n\n    if (data.token) {\n      wallet.tokenName = data.token.name\n      wallet.tokenAmount = data.token.amount\n      wallet.tokenSupply = data.token.supply\n      wallet.tokenFungibility = data.token.fungibility\n    }\n\n    if (data.tokenUnits.length) {\n      for (const tokenUnitData of data.tokenUnits) {\n        wallet.tokenUnits.push(TokenUnit.createFromGraphQL(tokenUnitData))\n      }\n    }\n\n    if (data.tradeRates.length) {\n      for (const tradeRate of data.tradeRates) {\n        wallet.tradeRates[tradeRate.tokenSlug] = tradeRate.amount\n      }\n    }\n\n    wallet.balance = String(data.amount != null ? data.amount : 0)\n    wallet.pubkey = data.pubkey\n    wallet.createdAt = data.createdAt\n\n    return wallet\n  }\n\n  /**\n   * Returns a list of Wallet class instances\n   *\n   * @param secret\n   * @return {null|[Wallet]}\n   */\n  getWallets (secret = null) {\n    const list = this.data()\n\n    if (!list) {\n      return null\n    }\n\n    const wallets = []\n\n    for (const data of list) {\n      wallets.push(ResponseWalletList.toClientWallet({\n        data,\n        secret\n      }))\n    }\n\n    return wallets\n  }\n\n  /**\n   * Returns response payload\n   *\n   * @return {null|[Wallet]}\n   */\n  payload () {\n    return this.getWallets()\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseWalletList from '../response/ResponseWalletList.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for getting a list of Wallets\n */\nexport default class QueryWalletList extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $bundleHash: String, $token: String ) {\n      Wallet( bundleHash: $bundleHash, token: $token ) {\n        address,\n        bundleHash,\n        token {\n          name,\n          amount,\n          fungibility,\n          supply\n        },\n        tokenSlug,\n        batchId,\n        position,\n        amount,\n        characters,\n        pubkey,\n        createdAt,\n        tokenUnits {\n          id,\n          name,\n          metas\n        },\n        tradeRates {\n          tokenSlug,\n          amount\n        }\n      }\n    }`\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseWalletList}\n   */\n  createResponse (json) {\n    return new ResponseWalletList({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport ResponseWalletList from './ResponseWalletList.js'\n\n/**\n * Response for balance query\n */\nexport default class ResponseBalance extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.Balance'\n    })\n  }\n\n  /**\n   * Returns a wallet with balance\n   *\n   * @return {null|Wallet}\n   */\n  payload () {\n    let walletData = this.data()\n\n    // Handle array response (e.g. from Rust validator which returns Vec<Wallet>)\n    if (Array.isArray(walletData)) {\n      walletData = walletData.length > 0 ? walletData[0] : null\n    }\n\n    if (!walletData || !walletData.bundleHash || !walletData.tokenSlug) {\n      return null\n    }\n\n    return ResponseWalletList.toClientWallet({\n      data: walletData\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseBalance from '../response/ResponseBalance.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for getting the balance of a given wallet or token slug\n */\nexport default class QueryBalance extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $address: String, $bundleHash: String, $type: String, $token: String, $position: String ) {\n      Balance( address: $address, bundleHash: $bundleHash, type: $type, token: $token, position: $position ) {\n        address,\n        bundleHash,\n        type,\n        tokenSlug,\n        batchId,\n        position,\n        amount,\n        characters,\n        pubkey,\n        createdAt,\n        tokenUnits {\n          id,\n          name,\n          metas\n        },\n        tradeRates {\n          tokenSlug,\n          amount\n        }\n      }\n    }`\n  }\n\n  /**\n   * @param {object} json\n   * @return {ResponseBalance}\n   */\n  createResponse (json) {\n    return new ResponseBalance({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\n/**\n * Response for MetaType Query\n */\nexport default class ResponseMetaType extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.MetaType'\n    })\n  }\n\n  /**\n   * Returns meta type instance results\n   *\n   * @return {null|*}\n   */\n  payload () {\n    const metaTypeData = this.data()\n\n    if (!metaTypeData || metaTypeData.length === 0) {\n      return null\n    }\n\n    const response = {\n      instances: {},\n      instanceCount: {},\n      paginatorInfo: {}\n    }\n\n    const metaData = metaTypeData.pop()\n\n    if (metaData.instances) {\n      response.instances = metaData.instances\n    }\n\n    if (metaData.instanceCount) {\n      response.instanceCount = metaData.instanceCount\n    }\n\n    if (metaData.paginatorInfo) {\n      response.paginatorInfo = metaData.paginatorInfo\n    }\n\n    return response\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseMetaType from '../response/ResponseMetaType.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving Meta Asset information\n */\nexport default class QueryMetaType extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $metaType: String, $metaTypes: [ String! ], $metaId: String, $metaIds: [ String! ], $key: String, $keys: [ String! ], $value: String, $values: [ String! ], $count: String, $latest: Boolean, $filter: [ MetaFilter! ], $queryArgs: QueryArgs, $countBy: String, $cellSlug: String ) {\n      MetaType( metaType: $metaType, metaTypes: $metaTypes, metaId: $metaId, metaIds: $metaIds, key: $key, keys: $keys, value: $value, values: $values, count: $count, filter: $filter, queryArgs: $queryArgs, countBy: $countBy, cellSlug: $cellSlug ) {\n        metaType,\n        instanceCount {\n          key,\n          value\n        },\n        instances {\n          metaType,\n          metaId,\n          createdAt,\n          metas(latest:$latest) {\n            molecularHash,\n            position,\n            key,\n            value,\n            createdAt\n          }\n        },\n        paginatorInfo {\n          currentPage,\n          total\n        }\n      }\n    }`\n  }\n\n  /**\n   * Builds a GraphQL-friendly variables object based on input fields\n   *\n   * @param {string|array|null} metaType\n   * @param {string|array|null} metaId\n   * @param {string|array|null} key\n   * @param {string|array|null} value\n   * @param {boolean|null} latest\n   * @param {object|null} filter\n   * @param {object|null} queryArgs\n   * @param {string|null} count\n   * @param {string|null} countBy\n   * @param {string|null} cellSlug\n   * @return {{}}\n   */\n  static createVariables ({\n    metaType = null,\n    metaId = null,\n    key = null,\n    value = null,\n    latest = null,\n    filter = null,\n    queryArgs = null,\n    count = null,\n    countBy = null,\n    cellSlug = null\n  }) {\n    const variables = {}\n\n    if (metaType) {\n      variables[typeof metaType === 'string' ? 'metaType' : 'metaTypes'] = metaType\n    }\n\n    if (metaId) {\n      variables[typeof metaId === 'string' ? 'metaId' : 'metaIds'] = metaId\n    }\n\n    if (key) {\n      variables[typeof key === 'string' ? 'key' : 'keys'] = key\n    }\n\n    if (value) {\n      variables[typeof value === 'string' ? 'value' : 'values'] = value\n    }\n\n    variables.latest = latest === true\n\n    if (filter) {\n      variables.filter = filter\n    }\n\n    if (queryArgs) {\n      if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {\n        queryArgs.limit = '*'\n      }\n\n      variables.queryArgs = queryArgs\n    }\n\n    if (count) {\n      variables.count = count\n    }\n\n    if (countBy) {\n      variables.countBy = countBy\n    }\n\n    if (cellSlug) {\n      variables.cellSlug = cellSlug\n    }\n\n    return variables\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseMetaType}\n   */\n  createResponse (json) {\n    return new ResponseMetaType({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport Response from '../response/Response.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving Meta Asset information\n */\nexport default class QueryBatch extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $batchId: String ) {\n      Batch( batchId: $batchId ) {\n        ${ QueryBatch.getFields() },\n        children {\n          ${ QueryBatch.getFields() }\n        }\n      }\n    }`\n  }\n\n  static getFields () {\n    return `batchId,\n              molecularHash,\n              type,\n              status,\n              createdAt,\n              wallet {\n                  address,\n                  bundleHash,\n                  amount,\n                  tokenSlug,\n                  token {\n                      name,\n                      amount\n                  },\n                  tokenUnits {\n                      id,\n                      name,\n                      metas\n                  }\n              },\n              fromWallet {\n                  address,\n                  bundleHash,\n                  amount,\n                  batchId\n              },\n              toWallet {\n                  address,\n                  bundleHash,\n                  amount,\n                  batchId\n              },\n              sourceTokenUnits {\n                  id,\n                  name,\n                  metas\n              },\n              transferTokenUnits {\n                  id,\n                  name,\n                  metas\n              },\n              metas {\n                  key,\n                  value,\n              },\n              throughMetas {\n                  key,\n                  value\n              }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {Response}\n   */\n  createResponse (json) {\n    const responseObject = new Response({\n      query: this,\n      json\n    })\n    responseObject.dataKey = 'data.Batch'\n    return responseObject\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport QueryBatch from './QueryBatch.js'\nimport Response from '../response/Response.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving Meta Asset information\n */\nexport default class QueryBatchHistory extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $batchId: String ) {\n      BatchHistory( batchId: $batchId ) {\n        ${ QueryBatch.getFields() }\n      }\n    }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {Response}\n   */\n  createResponse (json) {\n    const responseObject = new Response({\n      query: this,\n      json\n    })\n    responseObject.dataKey = 'data.BatchHistory'\n    return responseObject\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Dot from '../libraries/Dot.js'\nimport Molecule from '../Molecule.js'\n\n/**\n * Response for proposing new Molecules\n */\nexport default class ResponseProposeMolecule extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {MutationProposeMolecule} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.ProposeMolecule'\n    })\n    this.$__clientMolecule = query.molecule()\n  }\n\n  /**\n   * Initialize response object with payload data\n   */\n  init () {\n    const payloadJson = Dot.get(this.data(), 'payload')\n    try {\n      this.$__payload = Object.prototype.toString.call(payloadJson) === '[object String]'\n        ? JSON.parse(payloadJson)\n        : payloadJson\n    } catch (err) {\n      this.$__payload = null\n    }\n  }\n\n  /**\n   * Returns the client molecule\n   */\n  clientMolecule () {\n    return this.$__clientMolecule\n  }\n\n  /**\n   * Returns the resulting molecule\n   *\n   * @return {Molecule|null}\n   */\n  molecule () {\n    const data = this.data()\n\n    if (!data) {\n      return null\n    }\n\n    const molecule = new Molecule({})\n\n    molecule.molecularHash = Dot.get(data, 'molecularHash')\n    molecule.status = Dot.get(data, 'status')\n    molecule.createdAt = Dot.get(data, 'createdAt')\n\n    return molecule\n  }\n\n  /**\n   * Returns whether molecule was accepted or not\n   *\n   * @return {boolean}\n   */\n  success () {\n    return this.status() === 'accepted'\n  }\n\n  /**\n   * Returns the status of the proposal\n   *\n   * @return {string}\n   */\n  status () {\n    return Dot.get(this.data(), 'status', 'rejected')\n  }\n\n  /**\n   * Returns the reason for rejection\n   *\n   * @return {string}\n   */\n  reason () {\n    return Dot.get(this.data(), 'reason', 'Invalid response from server')\n  }\n\n  /**\n   * Returns payload object\n   *\n   * @return {null}\n   */\n  payload () {\n    return this.$__payload\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from '../query/Query.js'\nimport Response from '../response/Response.js'\n\n/**\n * Base class used to construct various GraphQL mutations\n */\nexport default class Mutation extends Query {\n  /**\n   * Creates a new Request for the given parameters\n   *\n   * @param {{}} variables\n   * @returns {{variables: (Object|null), query: null}}\n   */\n  createQuery ({ variables = null }) {\n    const request = super.createQuery({ variables })\n    request.mutation = request.query\n    delete request.query\n    return request\n  }\n\n  /**\n   * Sends the Mutation to a Knish.IO node and returns the Response\n   * @param {Object||null} variables\n   * @param {Object||null} context\n   * @returns {Promise<Response|null>}\n   */\n  async execute ({ variables = {}, context = {} }) {\n    this.$__request = this.createQuery({\n      variables\n    })\n\n    const mergedContext = {\n      ...context,\n      ...this.createQueryContext()\n    }\n\n    try {\n      const mutationParams = {\n        ...this.$__request,\n        context: mergedContext\n      }\n      const response = await this.client.mutate(mutationParams)\n\n      this.$__response = await this.createResponseRaw(response)\n\n      return this.$__response\n    } catch (error) {\n      if (error.name === 'AbortError') {\n        this.knishIOClient.log('warn', 'Mutation was cancelled')\n        // You might want to create a custom response for cancelled mutations\n        return new Response({\n          query: this,\n          json: { data: null, errors: [{ message: 'Mutation was cancelled' }] }\n        })\n      } else {\n        throw error\n      }\n    }\n  }\n\n  createQueryContext () {\n    // Override this method in subclasses if needed\n    return {}\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from '../response/ResponseProposeMolecule.js'\nimport Mutation from './Mutation.js'\nimport { gql } from '@urql/core'\n\nexport default class MutationProposeMolecule extends Mutation {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   * @param molecule\n   */\n  constructor (graphQLClient, knishIOClient, molecule) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__molecule = molecule\n    this.$__remainderWallet = null\n    this.$__query = gql`mutation( $molecule: MoleculeInput! ) {\n      ProposeMolecule( molecule: $molecule ) {\n        molecularHash,\n        height,\n        depth,\n        status,\n        reason,\n        payload,\n        createdAt,\n        receivedAt,\n        processedAt,\n        broadcastedAt,\n      }\n    }`\n  }\n\n  /**\n   * Returns an object of query variables\n   *\n   * @param {object} variables\n   * @return {object}\n   */\n  compiledVariables (variables) {\n    const _variables = super.compiledVariables(variables)\n\n    return { ..._variables, ...{ molecule: this.molecule() } }\n  }\n\n  /**\n   * Creates a new response from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseProposeMolecule}\n   */\n  createResponse (json) {\n    return new ResponseProposeMolecule({\n      query: this,\n      json\n    })\n  }\n\n  /**\n   * Executes the query\n   *\n   * @param {object} variables\n   * @return {Promise}\n   */\n  async execute ({ variables = null }) {\n    variables = variables || {}\n    variables.molecule = this.molecule()\n\n    return super.execute({\n      variables\n    })\n  }\n\n  /**\n   * Returns the remainder wallet\n   *\n   * @return {null}\n   */\n  remainderWallet () {\n    return this.$__remainderWallet\n  }\n\n  /**\n   * Returns the molecule we are proposing\n   *\n   * @return {Molecule}\n   */\n  molecule () {\n    return this.$__molecule\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Dot from '../libraries/Dot.js'\nimport InvalidResponseException from '../exception/InvalidResponseException.js'\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for auth token mutation\n */\nexport default class ResponseRequestAuthorization extends ResponseProposeMolecule {\n  /**\n   * return the authorization key\n   *\n   * @param key\n   * @return {*}\n   */\n  payloadKey (key) {\n    if (!Dot.has(this.payload(), key)) {\n      throw new InvalidResponseException(`ResponseRequestAuthorization::payloadKey() - '${ key }' key was not found in the payload!`)\n    }\n    return Dot.get(this.payload(), key)\n  }\n\n  /**\n   * Returns the auth token\n   *\n   * @return {string}\n   */\n  token () {\n    return this.payloadKey('token')\n  }\n\n  /**\n   * Returns raw time value from payload\n   *\n   * @return {string}\n   */\n  time () {\n    return this.payloadKey('time')\n  }\n\n  /**\n   * Returns the expiration timestamp as Unix seconds.\n   * Handles both server formats:\n   * - PHP server: time = lifetime in ms, expiresAt = Unix timestamp in payload\n   * - Rust server: time = Unix timestamp in seconds\n   *\n   * @return {number}\n   */\n  expiresAt () {\n    // Try the explicit expiresAt payload key first (PHP server provides this)\n    try {\n      const ea = this.payloadKey('expiresAt')\n      if (ea) {\n        return Number(ea)\n      }\n    } catch (_e) {\n      // Not available in payload, fall back\n    }\n\n    // Use time field with heuristic detection\n    const timeValue = Number(this.time())\n\n    // If timeValue looks like a valid Unix timestamp (>= year 2020), use directly\n    // Rust server sets time = Unix timestamp in seconds\n    if (timeValue >= 1577836800) {\n      return timeValue\n    }\n\n    // Otherwise, time is a lifetime in milliseconds (PHP server format)\n    // Convert to Unix timestamp: now_seconds + lifetime_seconds\n    return Math.floor(Date.now() / 1000) + Math.floor(timeValue / 1000)\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  encrypt () {\n    return this.payloadKey('encrypt')\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  pubKey () {\n    return this.payloadKey('key')\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseRequestAuthorization from '../response/ResponseRequestAuthorization.js'\n\n/**\n * Query for requesting an authorization token from the node\n */\nexport default class MutationRequestAuthorization extends MutationProposeMolecule {\n  /**\n   *\n   * @param {object} meta\n   */\n  fillMolecule ({ meta }) {\n    this.$__molecule.initAuthorization({ meta })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseRequestAuthorization}\n   */\n  createResponse (json) {\n    return new ResponseRequestAuthorization({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for token creation\n */\nexport default class ResponseCreateToken extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateToken from '../response/ResponseCreateToken.js'\n\n/**\n * Query for creating new Tokens\n */\nexport default class MutationCreateToken extends MutationProposeMolecule {\n  /**\n   * @param {Wallet|null} recipientWallet\n   * @param {number|null} amount\n   * @param {object|null} meta\n   */\n  fillMolecule ({\n    recipientWallet,\n    amount,\n    meta = null\n  }) {\n    this.$__molecule.initTokenCreation({\n      recipientWallet,\n      amount,\n      meta: meta || {}\n    })\n    this.$__molecule.sign({\n      bundle: recipientWallet.bundle\n    })\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseCreateToken}\n   */\n  createResponse (json) {\n    return new ResponseCreateToken({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for identifier creation\n */\nexport default class ResponseRequestTokens extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseRequestTokens from '../response/ResponseRequestTokens.js'\n\nexport default class MutationRequestTokens extends MutationProposeMolecule {\n  /**\n   * Fills a Molecule with the appropriate atoms and prepares for broadcast\n   *\n   * @param {string} token\n   * @param {Number} amount\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object} meta\n   * @param {string|null} batchId\n   */\n  fillMolecule ({\n    token,\n    amount,\n    metaType,\n    metaId,\n    meta = null,\n    batchId = null\n  }) {\n    this.$__molecule.initTokenRequest({\n      token,\n      amount,\n      metaType,\n      metaId,\n      meta: meta || {},\n      batchId\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseRequestTokens}\n   */\n  createResponse (json) {\n    return new ResponseRequestTokens({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for token transfer queries\n */\nexport default class ResponseTransferTokens extends ResponseProposeMolecule {\n  /**\n   * Returns result of the transfer\n   *\n   * @return {{reason: null, status: null}}\n   */\n  payload () {\n    const result = {\n      reason: null,\n      status: null\n    }\n    const data = this.data()\n\n    result.reason = typeof data.reason === 'undefined' ? 'Invalid response from server' : data.reason\n    result.status = typeof data.status === 'undefined' ? 'rejected' : data.status\n\n    return result\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseTransferTokens from '../response/ResponseTransferTokens.js'\n\n/**\n * Query for moving tokens between wallets\n */\nexport default class MutationTransferTokens extends MutationProposeMolecule {\n  /**\n   * Fills the Molecule with provided wallet and amount data\n   *\n   * @param recipientWallet\n   * @param amount\n   */\n  fillMolecule ({\n    recipientWallet,\n    amount\n  }) {\n    this.$__molecule.initValue({\n      recipientWallet,\n      amount\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check(this.$__molecule.sourceWallet)\n  }\n\n  /**\n   * Fills the Molecule for a MULTI-recipient transfer (WP line 544)\n   *\n   * @param {Wallet[]} recipientWallets\n   * @param {number[]} amounts - parallel to recipientWallets\n   */\n  fillMoleculeMulti ({\n    recipientWallets,\n    amounts\n  }) {\n    this.$__molecule.initValues({\n      recipientWallets,\n      amounts\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check(this.$__molecule.sourceWallet)\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseTransferTokens}\n   */\n  createResponse (json) {\n    return new ResponseTransferTokens({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for identifier creation\n */\nexport default class ResponseCreateIdentifier extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateIdentifier from '../response/ResponseCreateIdentifier.js'\n\n/**\n * Query for creating a new Identifier\n */\nexport default class MutationCreateIdentifier extends MutationProposeMolecule {\n  fillMolecule ({\n    type,\n    contact,\n    code\n  }) {\n    this.$__molecule.initIdentifierCreation({\n      type,\n      contact,\n      code\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseCreateIdentifier}\n   */\n  createResponse (json) {\n    return new ResponseCreateIdentifier({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for identifier creation\n */\nexport default class ResponseClaimShadowWallet extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport Wallet from '../Wallet.js'\nimport ResponseClaimShadowWallet from '../response/ResponseClaimShadowWallet.js'\n\n/**\n * Mutation for claiming a Shadow Wallet\n */\nexport default class MutationClaimShadowWallet extends MutationProposeMolecule {\n  /**\n   * Class constructor\n   *\n   * @param {string} token\n   * @param {string|null} batchId\n   */\n  fillMolecule ({\n    token,\n    batchId = null\n  }) {\n    const wallet = Wallet.create({\n      secret: this.$__molecule.secret,\n      bundle: this.$__molecule.bundle,\n      token,\n      batchId\n    })\n\n    this.$__molecule.initShadowWalletClaim(wallet)\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseClaimShadowWallet}\n   */\n  createResponse (json) {\n    return new ResponseClaimShadowWallet({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for token creation\n */\nexport default class ResponseCreateMeta extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateMeta from '../response/ResponseCreateMeta.js'\n\n/**\n * Query for creating new Meta attached to some MetaType\n */\nexport default class MutationCreateMeta extends MutationProposeMolecule {\n  /**\n   * Fills a molecule with an appropriate metadata atom\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {array|object} meta\n   * @param {object} policy\n   */\n  fillMolecule ({\n    metaType,\n    metaId,\n    meta,\n    policy\n  }) {\n    this.$__molecule.initMeta({\n      meta,\n      metaType,\n      metaId,\n      policy\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseCreateMeta}\n   */\n  createResponse (json) {\n    return new ResponseCreateMeta({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for peer registration via P-isotope\n */\nexport default class ResponsePeering extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponsePeering from '../response/ResponsePeering.js'\n\n/**\n * Mutation for registering a peer node via the P-isotope\n */\nexport default class MutationPeering extends MutationProposeMolecule {\n  /**\n   * Fills a molecule with a P-isotope peering atom\n   *\n   * @param {string} host\n   */\n  fillMolecule ({\n    host\n  }) {\n    this.$__molecule.initPeering({\n      host\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponsePeering}\n   */\n  createResponse (json) {\n    return new ResponsePeering({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for append requests via A-isotope\n */\nexport default class ResponseAppendRequest extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseAppendRequest from '../response/ResponseAppendRequest.js'\n\n/**\n * Mutation for submitting an append request via the A-isotope\n */\nexport default class MutationAppendRequest extends MutationProposeMolecule {\n  /**\n   * Fills a molecule with an A-isotope append request atom\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {string} action\n   * @param {object} meta\n   */\n  fillMolecule ({\n    metaType,\n    metaId,\n    action,\n    meta = {}\n  }) {\n    this.$__molecule.initAppendRequest({\n      metaType,\n      metaId,\n      action,\n      meta\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseAppendRequest}\n   */\n  createResponse (json) {\n    return new ResponseAppendRequest({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Dot from '../libraries/Dot.js'\n\n/**\n * Response for mutation to create / link an Identifier to a Wallet Bundle\n */\nexport default class ResponseLinkIdentifier extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.LinkIdentifier'\n    })\n  }\n\n  /**\n   * Returns success status\n   *\n   * @return {*}\n   */\n  success () {\n    return Dot.get(this.data(), 'set')\n  }\n\n  /**\n   * Returns message\n   *\n   * @return {*}\n   */\n  message () {\n    return Dot.get(this.data(), 'message')\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Mutation from '../mutation/Mutation.js'\nimport ResponseLinkIdentifier from '../response/ResponseLinkIdentifier.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for linking an Identifier to a Wallet Bundle\n */\nexport default class MutationLinkIdentifier extends Mutation {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`mutation( $bundle: String!, $type: String!, $content: String! ) {\n      LinkIdentifier( bundle: $bundle, type: $type, content: $content ) {\n        type,\n        bundle,\n        content,\n        set,\n        message\n      }\n    }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseLinkIdentifier}\n   */\n  createResponse (json) {\n    return new ResponseLinkIdentifier({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for Wallet creation\n */\nexport default class ResponseCreateWallet extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateWallet from '../response/ResponseCreateWallet.js'\n\n/**\n * Query for creating new Wallets\n */\nexport default class MutationCreateWallet extends MutationProposeMolecule {\n  fillMolecule (wallet) {\n    this.$__molecule.initWalletCreation(wallet)\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseCreateWallet}\n   */\n  createResponse (json) {\n    return new ResponseCreateWallet({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Dot from '../libraries/Dot.js'\nimport InvalidResponseException from '../exception/InvalidResponseException.js'\n\n/**\n * Response for guest auth mutation\n */\nexport default class ResponseRequestAuthorizationGuest extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {MutationRequestAuthorizationGuest} query\n   * @param json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.AccessToken'\n    })\n  }\n\n  /**\n   * Returns the reason for rejection\n   *\n   * @return {string}\n   */\n  reason () {\n    return 'Invalid response from server'\n  }\n\n  /**\n   * Returns whether molecule was accepted or not\n   *\n   * @return {boolean}\n   */\n  success () {\n    return this.payload() !== null\n  }\n\n  /**\n   * Returns a wallet with balance\n   *\n   * @return {null|Wallet}\n   */\n  payload () {\n    return this.data()\n  }\n\n  /**\n   * Returns the authorization key\n   *\n   * @param key\n   * @return {*}\n   */\n  payloadKey (key) {\n    if (!Dot.has(this.payload(), key)) {\n      throw new InvalidResponseException(`ResponseAuthorizationGuest::payloadKey() - '${ key }' key is not found in the payload!`)\n    }\n    return Dot.get(this.payload(), key)\n  }\n\n  /**\n   * Returns the auth token\n   *\n   * @return {*}\n   */\n  token () {\n    return this.payloadKey('token')\n  }\n\n  /**\n   * Returns raw time value from payload\n   *\n   * @return {*}\n   */\n  time () {\n    return this.payloadKey('time')\n  }\n\n  /**\n   * Returns the expiration timestamp as Unix seconds.\n   * Handles both server formats:\n   * - PHP server: time = lifetime in ms, expiresAt = Unix timestamp in payload\n   * - Rust server: time = Unix timestamp in seconds\n   *\n   * @return {number}\n   */\n  expiresAt () {\n    // Try the explicit expiresAt payload key first (PHP server provides this)\n    try {\n      const ea = this.payloadKey('expiresAt')\n      if (ea) {\n        return Number(ea)\n      }\n    } catch (_e) {\n      // Not available in payload, fall back\n    }\n\n    // Use time field with heuristic detection\n    const timeValue = Number(this.time())\n\n    // If timeValue looks like a valid Unix timestamp (>= year 2020), use directly\n    if (timeValue >= 1577836800) {\n      return timeValue\n    }\n\n    // Otherwise, time is a lifetime in milliseconds (PHP server format)\n    return Math.floor(Date.now() / 1000) + Math.floor(timeValue / 1000)\n  }\n\n  /**\n   * Returns timestamp\n   *\n   * @return {string}\n   */\n  pubKey () {\n    return this.payloadKey('key')\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  encrypt () {\n    return this.payloadKey('encrypt')\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Mutation from '../mutation/Mutation.js'\nimport ResponseRequestAuthorizationGuest from '../response/ResponseRequestAuthorizationGuest.js'\nimport { gql } from '@urql/core'\n\nexport default class MutationRequestAuthorizationGuest extends Mutation {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`mutation( $cellSlug: String, $pubkey: String, $encrypt: Boolean ) {\n      AccessToken( cellSlug: $cellSlug, pubkey: $pubkey, encrypt: $encrypt ) {\n        token,\n        pubkey,\n        expiresAt\n      }\n    }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseRequestAuthorizationGuest}\n   */\n  createResponse (json) {\n    return new ResponseRequestAuthorizationGuest({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when failing to retrieve shadow wallets\n */\nexport default class WalletShadowException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'The shadow wallet does not exist', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'WalletShadowException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when a stackable token is being created with units and non-zero decimals\n */\nexport default class StackableUnitDecimalsException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Stackable tokens with unit IDs cannot have decimal places!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'StackableUnitDecimalsException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when a stackable token is being transferred with both unit IDs AND an amount specified (ambiguous)\n */\nexport default class StackableUnitAmountException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Stackable tokens with unit IDs cannot have an amount!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'StackableUnitAmountException'\n  }\n}\n","import CodeException from '../exception/CodeException.js'\n\nexport default class Subscribe {\n  /**\n   *\n   * @param {UrqlClientWrapper} graphQLClient\n   */\n  constructor (graphQLClient) {\n    this.client = graphQLClient\n    this.$__variables = null\n    this.$__subscribe = null\n  }\n\n  /**\n   * Creates a new Request for the given parameters\n   *\n   * @param {{}} variables\n   * @returns {{variables: (Object|null), fetchPolicy: string, query: null}}\n   */\n  createSubscribe ({\n    variables = null\n  }) {\n    this.$__variables = this.compiledVariables(variables)\n\n    // Uri is a required parameter\n    const uri = this.uri()\n\n    if (!uri) {\n      throw new CodeException('Subscribe::createSubscribe() - Node URI was not initialized for this client instance!')\n    }\n\n    if (this.$__subscribe === null) {\n      throw new CodeException('Subscribe::createSubscribe() - GraphQL subscription was not initialized!')\n    }\n\n    return {\n      query: this.$__subscribe,\n      variables: this.variables(),\n      fetchPolicy: 'no-cache'\n    }\n  }\n\n  /**\n   * Sends the Query to a Knish.IO node and returns the Response\n   *\n   * @param {{}} variables\n   * @param {function} closure\n   * @return {string}\n   */\n  async execute ({\n    variables = null,\n    closure\n  }) {\n    if (!closure) {\n      throw new CodeException(`${ this.constructor.name }::execute() - closure parameter is required!`)\n    }\n\n    this.$__request = this.createSubscribe({\n      variables\n    })\n\n    return this.client.subscribe(this.$__request, closure)\n  }\n\n  /**\n   * Returns a variables object for the Query\n   *\n   * @param variables\n   * @return {object}\n   */\n  compiledVariables (variables = null) {\n    return variables || {}\n  }\n\n  /**\n   * Returns the Knish.IO endpoint URI\n   *\n   * @return {string}\n   */\n  uri () {\n    return this.client.getUri()\n  }\n\n  /**\n   * Returns the query variables object\n   *\n   * @return {object|null}\n   */\n  variables () {\n    return this.$__variables\n  }\n}\n","import Subscribe from './Subscribe.js'\nimport { gql } from '@urql/core'\n\nexport default class CreateMoleculeSubscribe extends Subscribe {\n  constructor (graphQLClient) {\n    super(graphQLClient)\n    this.$__subscribe = gql`\n      subscription onCreateMolecule ( $bundle: String! ) {\n        CreateMolecule( bundle: $bundle ) {\n          molecularHash,\n          cellSlug,\n          counterparty,\n          bundleHash,\n          status,\n          local,\n          height,\n          depth,\n          createdAt,\n          receivedAt,\n          processedAt,\n          broadcastedAt,\n          reason,\n          reasonPayload,\n          payload,\n          status,\n          atoms {\n            molecularHash,\n            position,\n            isotope,\n            walletAddress,\n            tokenSlug,\n            batchId,\n            value,\n            index,\n            metaType,\n            metaId,\n            metasJson,\n            otsFragment,\n            createdAt,\n            metas {\n              molecularHash,\n              position,\n              metaType,\n              metaId,\n              key,\n              value,\n              createdAt,\n            }\n          }\n        }\n      }\n    `\n  }\n}\n","import Subscribe from './Subscribe.js'\nimport { gql } from '@urql/core'\n\nexport default class WalletStatusSubscribe extends Subscribe {\n  constructor (graphQLClient) {\n    super(graphQLClient)\n    this.$__subscribe = gql`\n      subscription onWalletStatus ( $bundle: String!, $token: String! ) {\n        WalletStatus( bundle: $bundle, token: $token ) {\n          bundle,\n          token,\n          admission,\n          balance,\n        }\n      }\n    `\n  }\n}\n","import Subscribe from './Subscribe.js'\nimport { gql } from '@urql/core'\n\nexport default class ActiveWalletSubscribe extends Subscribe {\n  constructor (graphQLClient) {\n    super(graphQLClient)\n    this.$__subscribe = gql`\n      subscription onActiveWallet ( $bundle: String! ) {\n        ActiveWallet( bundle: $bundle ) {\n          address,\n          bundleHash,\n          walletBundle {\n            bundleHash,\n            slug,\n            createdAt,\n          },\n          tokenSlug,\n          token {\n            slug,\n            name,\n            fungibility,\n            supply,\n            decimals,\n            amount,\n            icon,\n            createdAt\n          },\n          batchId,\n          position,\n          characters,\n          pubkey,\n          amount,\n          createdAt,\n          metas {\n            molecularHash,\n            position,\n            metaType,\n            metaId,\n            key,\n            value,\n            createdAt,\n          }\n        }\n      }\n    `\n  }\n}\n","import Subscribe from './Subscribe.js'\nimport { gql } from '@urql/core'\n\nexport default class ActiveSessionSubscribe extends Subscribe {\n  constructor (graphQLClient) {\n    super(graphQLClient)\n    this.$__subscribe = gql`\n      subscription onActiveUser ( $metaType: String!, $metaId: String! ) {\n        ActiveUser( metaType: $metaType, metaId: $metaId ) {\n          bundleHash,\n          metaType,\n          metaId,\n          jsonData,\n          createdAt,\n          updatedAt\n        }\n      }`\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\nexport default class ResponseActiveSession extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.ActiveSession'\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Mutation from '../mutation/Mutation.js'\nimport ResponseActiveSession from '../response/ResponseActiveSession.js'\nimport { gql } from '@urql/core'\n\n/**\n * Mutation for declaring an active User Session with a given MetaAsset\n */\nexport default class MutationActiveSession extends Mutation {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`mutation(\n      $bundleHash: String!,\n      $metaType: String!,\n      $metaId: String!,\n      $ipAddress: String,\n      $browser: String,\n      $osCpu: String,\n      $resolution: String,\n      $timeZone: String,\n      $json: String ) {\n      ActiveSession(\n        bundleHash: $bundleHash,\n        metaType: $metaType,\n        metaId: $metaId,\n        ipAddress: $ipAddress,\n        browser: $browser,\n        osCpu: $osCpu,\n        resolution: $resolution,\n        timeZone: $timeZone,\n        json: $json\n      ) {\n        bundleHash,\n        metaType,\n        metaId,\n        jsonData,\n        createdAt,\n        updatedAt\n      }\n    }`\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseActiveSession}\n   */\n  createResponse (json) {\n    return new ResponseActiveSession({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\n/**\n * Response for QueryActiveSession\n */\nexport default class ResponseQueryActiveSession extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.ActiveUser'\n    })\n  }\n\n  payload () {\n    const list = this.data()\n\n    if (!list) {\n      return null\n    }\n\n    const activeUsers = []\n\n    for (const item of list) {\n      const activeSession = { ...item }\n\n      if (activeSession.jsonData) {\n        activeSession.jsonData = JSON.parse(activeSession.jsonData)\n      }\n\n      if (activeSession.createdAt) {\n        activeSession.createdAt = new Date(activeSession.createdAt)\n      }\n\n      if (activeSession.updatedAt) {\n        activeSession.updatedAt = new Date(activeSession.updatedAt)\n      }\n\n      activeUsers.push(activeSession)\n    }\n\n    return activeUsers\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseQueryActiveSession from '../response/ResponseQueryActiveSession.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving a list of active User Sessions\n */\nexport default class QueryActiveSession extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query ActiveUserQuery ($bundleHash:String, $metaType: String, $metaId: String) {\n      ActiveUser (bundleHash: $bundleHash, metaType: $metaType, metaId: $metaId) {\n        bundleHash,\n        metaType,\n        metaId,\n        jsonData,\n        createdAt,\n        updatedAt\n      }\n    }`\n  }\n\n  /**\n   * @param {object} json\n   * @return {ResponseQueryActiveSession}\n   */\n  createResponse (json) {\n    return new ResponseQueryActiveSession({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport Response from '../response/Response.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for getting the token info\n */\nexport default class QueryToken extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $slug: String, $slugs: [ String! ], $limit: Int, $order: String ) {\n      Token( slug: $slug, slugs: $slugs, limit: $limit, order: $order ) {\n        slug,\n        name,\n        fungibility,\n        supply,\n        decimals,\n        amount,\n        icon,\n      }\n    }`\n  }\n\n  /**\n   *\n   * @param json\n   * @returns {Response}\n   */\n  createResponse (json) {\n    return new Response({\n      query: this,\n      json,\n      dataKey: 'data.Token'\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when attempt to authorize is rejected by the node\n */\nexport default class AuthorizationRejectedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Authorization attempt rejected by ledger.', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'AuthorizationRejectedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\n/**\n * Response for MetaType Query\n */\nexport default class ResponseAtom extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.Atom'\n    })\n  }\n\n  /**\n   * Returns meta type instance results\n   *\n   * @return {null|*}\n   */\n  payload () {\n    const metaTypeData = this.data()\n\n    if (!metaTypeData) {\n      return null\n    }\n\n    const response = {\n      instances: [],\n      instanceCount: {},\n      paginatorInfo: {}\n    }\n\n    if (metaTypeData.instances) {\n      response.instances = metaTypeData.instances\n\n      for (const instanceKey in response.instances) {\n        const instance = response.instances[instanceKey]\n        if (instance.metasJson) {\n          response.instances[instanceKey].metas = JSON.parse(instance.metasJson)\n        }\n      }\n    }\n\n    if (metaTypeData.instanceCount) {\n      response.instanceCount = metaTypeData.instanceCount\n    }\n\n    if (metaTypeData.paginatorInfo) {\n      response.paginatorInfo = metaTypeData.paginatorInfo\n    }\n\n    return response\n  }\n\n  metas () {\n    const response = this.payload()\n    const metas = []\n\n    if (response && response.instances) {\n      for (const instance of response.instances) {\n        if (instance.metasJson) {\n          metas.push(JSON.parse(instance.metasJson))\n        }\n      }\n    }\n\n    return metas\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseAtom from '../response/ResponseAtom.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for getting the balance of a given wallet or token slug\n */\nexport default class QueryAtom extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query(\n      $molecularHashes: [String!],\n      $bundleHashes: [String!],\n      $positions:[String!],\n      $walletAddresses: [String!],\n      $isotopes: [String!],\n      $tokenSlugs: [String!],\n      $cellSlugs: [String!],\n      $batchIds: [String!],\n      $values: [String!],\n      $metaTypes: [String!],\n      $metaIds: [String!],\n      $indexes: [String!],\n      $filter: [ MetaFilter! ],\n      $latest: Boolean,\n      $queryArgs: QueryArgs,\n    ) {\n      Atom(\n        molecularHashes: $molecularHashes,\n        bundleHashes: $bundleHashes,\n        positions: $positions,\n        walletAddresses: $walletAddresses,\n        isotopes: $isotopes,\n        tokenSlugs: $tokenSlugs,\n        cellSlugs: $cellSlugs,\n        batchIds: $batchIds,\n        values: $values,\n        metaTypes: $metaTypes,\n        metaIds: $metaIds,\n        indexes: $indexes,\n        filter: $filter,\n        latest: $latest,\n        queryArgs: $queryArgs,\n      ) {\n        instances {\n          position,\n          walletAddress,\n          tokenSlug,\n          isotope,\n          index,\n          molecularHash,\n          metaId,\n          metaType,\n          metasJson,\n          batchId,\n          value,\n          bundleHashes,\n          cellSlugs,\n          createdAt,\n          otsFragment\n        },\n        paginatorInfo {\n          currentPage,\n          total\n        }\n      }\n    }`\n  }\n\n  /**\n   * Queries Knish.IO Atoms\n   *\n   * @param {string[]} molecularHashes\n   * @param {string} molecularHash\n   * @param {string[]} bundleHashes\n   * @param {string} bundleHash\n   * @param {string[]} positions\n   * @param {string} position\n   * @param {string[]} walletAddresses\n   * @param {string} walletAddress\n   * @param {string[]} isotopes\n   * @param {string} isotope\n   * @param {string[]} tokenSlugs\n   * @param {string} tokenSlug\n   * @param {string[]} cellSlugs\n   * @param {string} cellSlug\n   * @param {string[]} batchIds\n   * @param {string} batchId\n   * @param {string[]} values\n   * @param {string|number} value\n   * @param {string[]} metaTypes\n   * @param {string} metaType\n   * @param {string[]} metaIds\n   * @param {string} metaId\n   * @param {number[]} indexes\n   * @param {number} index\n   * @param {object[]} filter,\n   * @param {boolean} latest\n   * @param {object} queryArgs\n   * @return {object}\n   */\n  static createVariables ({\n    molecularHashes,\n    molecularHash,\n    bundleHashes,\n    bundleHash,\n    positions,\n    position,\n    walletAddresses,\n    walletAddress,\n    isotopes,\n    isotope,\n    tokenSlugs,\n    tokenSlug,\n    cellSlugs,\n    cellSlug,\n    batchIds,\n    batchId,\n    values,\n    value,\n    metaTypes,\n    metaType,\n    metaIds,\n    metaId,\n    indexes,\n    index,\n    filter,\n    latest,\n    queryArgs\n  }) {\n    if (molecularHash) {\n      molecularHashes = molecularHashes || []\n      molecularHashes.push(molecularHash)\n    }\n\n    if (bundleHash) {\n      bundleHashes = bundleHashes || []\n      bundleHashes.push(bundleHash)\n    }\n\n    if (position) {\n      positions = positions || []\n      positions.push(position)\n    }\n\n    if (walletAddress) {\n      walletAddresses = walletAddresses || []\n      walletAddresses.push(walletAddress)\n    }\n\n    if (isotope) {\n      isotopes = isotopes || []\n      isotopes.push(isotope)\n    }\n\n    if (tokenSlug) {\n      tokenSlugs = tokenSlugs || []\n      tokenSlugs.push(tokenSlug)\n    }\n\n    if (cellSlug) {\n      cellSlugs = cellSlugs || []\n      cellSlugs.push(cellSlug)\n    }\n\n    if (batchId) {\n      batchIds = batchIds || []\n      batchIds.push(batchId)\n    }\n\n    if (value) {\n      values = values || []\n      values.push(value)\n    }\n\n    if (metaType) {\n      metaTypes = metaTypes || []\n      metaTypes.push(metaType)\n    }\n\n    if (metaId) {\n      metaIds = metaIds || []\n      metaIds.push(metaId)\n    }\n\n    if (index) {\n      indexes = indexes || []\n      indexes.push(index)\n    }\n\n    return {\n      molecularHashes,\n      bundleHashes,\n      positions,\n      walletAddresses,\n      isotopes,\n      tokenSlugs,\n      cellSlugs,\n      batchIds,\n      values,\n      metaTypes,\n      metaIds,\n      indexes,\n      filter,\n      latest,\n      queryArgs\n    }\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseAtom}\n   */\n  createResponse (json) {\n    return new ResponseAtom({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\nexport default class ResponsePolicy extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json\n    })\n    this.dataKey = 'data.Policy'\n    this.init()\n  }\n\n  /**\n   *\n   * @returns {null|object}\n   */\n  payload () {\n    const policy = this.data()\n\n    if (!policy) {\n      return null\n    }\n\n    if (policy.callback) {\n      return JSON.parse(policy.callback)\n    }\n\n    return null\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Query from './Query.js'\nimport ResponsePolicy from '../response/ResponsePolicy.js'\nimport { gql } from '@urql/core'\n\nexport default class QueryPolicy extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $metaType: String, $metaId: String, ) {\n      Policy( metaType: $metaType, metaId: $metaId ) {\n        molecularHash,\n        position,\n        metaType,\n        metaId,\n        conditions,\n        callback,\n        rule,\n        createdAt\n      }\n    }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponsePolicy}\n   */\n  createResponse (json) {\n    return new ResponsePolicy({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\nexport default class ResponseMetaTypeViaAtom extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.MetaTypeViaAtom'\n    })\n  }\n\n  payload () {\n    const metaTypeData = this.data()\n\n    if (!metaTypeData || metaTypeData.length === 0) {\n      return null\n    }\n\n    const response = {\n      instances: {},\n      instanceCount: {},\n      paginatorInfo: {}\n    }\n\n    const metaData = metaTypeData.pop()\n\n    if (metaData.instances) {\n      response.instances = metaData.instances\n    }\n\n    if (metaData.instanceCount) {\n      response.instanceCount = metaData.instanceCount\n    }\n\n    if (metaData.paginatorInfo) {\n      response.paginatorInfo = metaData.paginatorInfo\n    }\n\n    return response\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseMetaTypeViaAtom from '../response/ResponseMetaTypeViaAtom.js'\nimport { gql } from '@urql/core'\n\nexport default class QueryMetaTypeViaAtom extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!], $cellSlugs: [String!] ) {\n      MetaTypeViaAtom(\n        metaTypes: $metaTypes\n        metaIds: $metaIds\n        atomValues: $atomValues\n        cellSlugs: $cellSlugs\n        filter: $filter,\n        latest: $latest,\n        queryArgs: $queryArgs\n        countBy: $countBy\n      ) {\n        metaType,\n        instanceCount {\n          key,\n          value\n        },\n        instances {\n          metaType,\n          metaId,\n          createdAt,\n          metas( values: $values, keys: $keys ) {\n            molecularHash,\n            position,\n            key,\n            value,\n            createdAt\n          }\n        },\n        paginatorInfo {\n          currentPage,\n          total\n        }\n      }\n    }`\n  }\n\n  /**\n   * Builds a GraphQL-friendly variables object based on input fields\n   *\n   * @param {string|array|null} metaType\n   * @param {string|array|null} metaId\n   * @param {string|null} key\n   * @param {string|null} value\n   * @param {array|null} values\n   * @param {array|null} keys\n   * @param {array|null} atomValues\n   * @param {boolean|null} latest\n   * @param {array|null} filter\n   * @param {object|null} queryArgs\n   * @param {string|null} countBy\n   * @param {string|null} cellSlug\n   * @return {{}}\n   */\n  static createVariables ({\n    metaType = null,\n    metaId = null,\n    key = null,\n    value = null,\n    keys = null,\n    values = null,\n    atomValues = null,\n    latest = null,\n    filter = null,\n    queryArgs = null,\n    countBy = null,\n    cellSlug = null\n  }) {\n    const variables = {}\n\n    if (atomValues) {\n      variables.atomValues = atomValues\n    }\n\n    if (keys) {\n      variables.keys = keys\n    }\n\n    if (values) {\n      variables.values = values\n    }\n\n    if (metaType) {\n      variables.metaTypes = typeof metaType === 'string' ? [metaType] : metaType\n    }\n\n    if (metaId) {\n      variables.metaIds = typeof metaId === 'string' ? [metaId] : metaId\n    }\n\n    if (cellSlug) {\n      variables.cellSlugs = typeof cellSlug === 'string' ? [cellSlug] : cellSlug\n    }\n\n    if (countBy) {\n      variables.countBy = countBy\n    }\n\n    if (filter) {\n      variables.filter = filter\n    }\n\n    if (key && value) {\n      variables.filter = variables.filter || []\n      variables.filter.push({\n        key,\n        value,\n        comparison: '='\n      })\n    }\n\n    variables.latest = latest === true\n\n    if (queryArgs) {\n      if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {\n        queryArgs.limit = '*'\n      }\n\n      variables.queryArgs = queryArgs\n    }\n\n    return variables\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseMetaTypeViaAtom}\n   */\n  createResponse (json) {\n    return new ResponseMetaTypeViaAtom({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (//////////////)\n                       (////////////////(               (///////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\nimport CheckMolecule from '../libraries/CheckMolecule.js'\n\n/**\n * Response for MetaType queries via Molecule data.\n *\n * Instead of using the redundant instance-level `metas` field,\n * this response extracts metadata from molecule atoms' `metasJson`,\n * producing a payload format compatible with ResponseMetaType and\n * ResponseMetaTypeViaAtom for drop-in replacement usage.\n */\nexport default class ResponseMetaTypeViaMolecule extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.MetaTypeViaAtom'\n    })\n  }\n\n  /**\n   * Extracts metas from a molecule's atoms' metasJson for a specific instance.\n   * Filters atoms by matching metaType and metaId, then parses metasJson.\n   *\n   * @param {object} molecule - Molecule data with atoms array\n   * @param {string} metaType - Instance meta type to filter by\n   * @param {string} metaId - Instance meta ID to filter by\n   * @return {Array<{molecularHash: string, position: string, key: string, value: string, createdAt: string}>}\n   */\n  static extractMetasFromMolecule (molecule, metaType, metaId) {\n    if (!molecule || !molecule.atoms) {\n      return []\n    }\n\n    const metas = []\n\n    for (const atom of molecule.atoms) {\n      // Filter atoms to those matching this instance's metaType and metaId\n      if (atom.metaType !== metaType || atom.metaId !== metaId) {\n        continue\n      }\n\n      if (!atom.metasJson) {\n        continue\n      }\n\n      let parsed\n      try {\n        parsed = JSON.parse(atom.metasJson)\n        if (!Array.isArray(parsed)) {\n          continue\n        }\n      } catch (e) {\n        continue\n      }\n\n      for (const entry of parsed) {\n        metas.push({\n          molecularHash: molecule.molecularHash,\n          position: atom.position,\n          key: entry.key,\n          value: entry.value,\n          createdAt: atom.createdAt\n        })\n      }\n    }\n\n    return metas\n  }\n\n  /**\n   * Returns meta type instance results with metas synthesized from molecule data.\n   * Produces the same payload format as ResponseMetaType and ResponseMetaTypeViaAtom:\n   * { instances, instanceCount, paginatorInfo }\n   *\n   * @return {null|{instances: Array, instanceCount: Array, paginatorInfo: object}}\n   */\n  payload () {\n    const metaTypeData = this.data()\n\n    if (!metaTypeData || metaTypeData.length === 0) {\n      return null\n    }\n\n    const response = {\n      instances: {},\n      instanceCount: {},\n      paginatorInfo: {}\n    }\n\n    const metaData = metaTypeData.pop()\n\n    if (metaData.instances) {\n      response.instances = metaData.instances.map(instance => {\n        // Prefer server-filtered metas (from metas sub-field) when available\n        let metas = instance.metas\n        if (!metas || metas.length === 0) {\n          // Fallback: synthesize from molecule atoms' metasJson\n          metas = ResponseMetaTypeViaMolecule.extractMetasFromMolecule(\n            instance.molecule,\n            instance.metaType,\n            instance.metaId\n          )\n        }\n\n        return {\n          ...instance,\n          metas\n        }\n      })\n    }\n\n    if (metaData.instanceCount) {\n      response.instanceCount = metaData.instanceCount\n    }\n\n    if (metaData.paginatorInfo) {\n      response.paginatorInfo = metaData.paginatorInfo\n    }\n\n    return response\n  }\n\n  /**\n   * Verifies the cryptographic integrity of all molecules associated\n   * with meta instances in this response. For each instance, reconstructs\n   * the molecule from server data and runs CheckMolecule.verify() to validate\n   * the molecular hash and OTS signature.\n   *\n   * @return {{ verified: boolean, molecules: Array<{ molecularHash: string, verified: boolean, error: string|null }> }}\n   */\n  verifyIntegrity () {\n    const results = []\n    const metaTypeData = this.data()\n\n    if (!metaTypeData || metaTypeData.length === 0) {\n      return { verified: true, molecules: results }\n    }\n\n    const instances = metaTypeData[metaTypeData.length - 1]?.instances || []\n\n    for (const instance of instances) {\n      if (!instance.molecule) continue\n      results.push(CheckMolecule.verifyFromServerData(instance.molecule))\n    }\n\n    return {\n      verified: results.length === 0 || results.every(r => r.verified),\n      molecules: results\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (//////////////)\n                       (////////////////(               (///////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseMetaTypeViaMolecule from '../response/ResponseMetaTypeViaMolecule.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving Meta Asset information via Molecule data.\n *\n * Unlike QueryMetaTypeViaAtom, this query does NOT request the redundant\n * instance-level `metas` field. Instead, metadata is extracted client-side\n * from molecule atoms' `metasJson`, eliminating duplicate data transfer.\n */\nexport default class QueryMetaTypeViaMolecule extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!], $cellSlugs: [String!] ) {\n      MetaTypeViaAtom(\n        metaTypes: $metaTypes\n        metaIds: $metaIds\n        atomValues: $atomValues\n        cellSlugs: $cellSlugs\n        filter: $filter,\n        latest: $latest,\n        queryArgs: $queryArgs\n        countBy: $countBy\n      ) {\n        metaType,\n        instanceCount {\n          key,\n          value\n        },\n        instances {\n          metaType,\n          metaId,\n          createdAt,\n          metas( values: $values, keys: $keys ) {\n            molecularHash,\n            position,\n            key,\n            value,\n            createdAt\n          },\n          molecule {\n            molecularHash,\n            bundleHash,\n            cellSlug,\n            status,\n            createdAt,\n            atoms {\n              position,\n              walletAddress,\n              isotope,\n              tokenSlug,\n              value,\n              batchId,\n              metaType,\n              metaId,\n              index,\n              createdAt,\n              otsFragment,\n              metasJson\n            }\n          }\n        },\n        paginatorInfo {\n          currentPage,\n          total\n        }\n      }\n    }`\n  }\n\n  /**\n   * Builds a GraphQL-friendly variables object based on input fields\n   *\n   * @param {string|array|null} metaType\n   * @param {string|array|null} metaId\n   * @param {string|null} key\n   * @param {string|null} value\n   * @param {array|null} values\n   * @param {array|null} keys\n   * @param {array|null} atomValues\n   * @param {boolean|null} latest\n   * @param {array|null} filter\n   * @param {object|null} queryArgs\n   * @param {string|null} countBy\n   * @param {string|null} cellSlug\n   * @return {{}}\n   */\n  static createVariables ({\n    metaType = null,\n    metaId = null,\n    key = null,\n    value = null,\n    keys = null,\n    values = null,\n    atomValues = null,\n    latest = null,\n    filter = null,\n    queryArgs = null,\n    countBy = null,\n    cellSlug = null\n  }) {\n    const variables = {}\n\n    if (atomValues) {\n      variables.atomValues = atomValues\n    }\n\n    if (keys) {\n      variables.keys = keys\n    }\n\n    if (values) {\n      variables.values = values\n    }\n\n    if (metaType) {\n      variables.metaTypes = typeof metaType === 'string' ? [metaType] : metaType\n    }\n\n    if (metaId) {\n      variables.metaIds = typeof metaId === 'string' ? [metaId] : metaId\n    }\n\n    if (cellSlug) {\n      variables.cellSlugs = typeof cellSlug === 'string' ? [cellSlug] : cellSlug\n    }\n\n    if (countBy) {\n      variables.countBy = countBy\n    }\n\n    if (filter) {\n      variables.filter = filter\n    }\n\n    if (key && value) {\n      variables.filter = variables.filter || []\n      variables.filter.push({\n        key,\n        value,\n        comparison: '='\n      })\n    }\n\n    variables.latest = latest === true\n\n    if (queryArgs) {\n      if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {\n        queryArgs.limit = '*'\n      }\n\n      variables.queryArgs = queryArgs\n    }\n\n    return variables\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseMetaTypeViaMolecule}\n   */\n  createResponse (json) {\n    return new ResponseMetaTypeViaMolecule({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\n/**\n * Response for EmbeddingStatus Query\n *\n * Payload is an array of EmbeddingStatusItem objects:\n *   { metaType, metaId, state, totalMetas, embeddedCount, embeddedAt, model }\n *\n * state is one of: 'PENDING' | 'STALE' | 'COMPLETE'\n */\nexport default class ResponseEmbeddingStatus extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.embeddingStatus'\n    })\n  }\n\n  /**\n   * Returns the array of embedding status items, or null if empty.\n   *\n   * Each item contains:\n   * - metaType {string} - Metadata type (echoed from input)\n   * - metaId {string} - Instance identifier (echoed from input)\n   * - state {string} - PENDING | STALE | COMPLETE\n   * - totalMetas {number} - Total meta rows for this instance\n   * - embeddedCount {number} - Rows with current-model embeddings\n   * - embeddedAt {number|null} - Unix epoch of most recent embedding\n   * - model {string|null} - Model name used for embeddings\n   *\n   * @return {Array<object>|null}\n   */\n  payload () {\n    const items = this.data()\n\n    if (!items || !Array.isArray(items) || items.length === 0) {\n      return null\n    }\n\n    return items\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseEmbeddingStatus from '../response/ResponseEmbeddingStatus.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving DataBraid embedding status for meta instances.\n *\n * Supports both single-instance and bulk modes:\n * - Single: { metaType: 'product', metaId: 'SKU-001' }\n * - Bulk:   { instances: [{ metaType: 'product', metaId: 'SKU-001' }, ...] }\n *\n * Returns embedding state (PENDING, STALE, COMPLETE) for each instance,\n * allowing apps to render spinner badges and completion indicators.\n *\n * NOTE: Only available on servers with EMBEDDING_ENABLED=true.\n * Use KnishIOClient.queryEmbeddingStatus() which handles capability\n * detection and returns null for unsupported servers.\n */\nexport default class QueryEmbeddingStatus extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $metaType: String, $metaId: String, $instances: [EmbeddingStatusInput!] ) {\n      embeddingStatus( metaType: $metaType, metaId: $metaId, instances: $instances ) {\n        metaType,\n        metaId,\n        state,\n        totalMetas,\n        embeddedCount,\n        embeddedAt,\n        model\n      }\n    }`\n  }\n\n  /**\n   * Builds a GraphQL-friendly variables object for embedding status queries.\n   *\n   * Single mode: createVariables({ metaType: 'product', metaId: 'SKU-001' })\n   * Bulk mode:   createVariables({ instances: [{ metaType: 'product', metaId: 'SKU-001' }, ...] })\n   *\n   * @param {string|null} metaType\n   * @param {string|null} metaId\n   * @param {Array<{metaType: string, metaId: string}>|null} instances\n   * @return {{}}\n   */\n  static createVariables ({\n    metaType = null,\n    metaId = null,\n    instances = null\n  }) {\n    const variables = {}\n\n    if (instances && instances.length > 0) {\n      variables.instances = instances\n    }\n\n    if (metaType) {\n      variables.metaType = metaType\n    }\n\n    if (metaId) {\n      variables.metaId = metaId\n    }\n\n    return variables\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseEmbeddingStatus}\n   */\n  createResponse (json) {\n    return new ResponseEmbeddingStatus({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for rule creation\n */\nexport default class ResponseCreateRule extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateRule from '../response/ResponseCreateRule.js'\n\n/**\n * Query for creating new Meta attached to some MetaType\n */\nexport default class MutationCreateRule extends MutationProposeMolecule {\n  /**\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object[]} rule\n   * @param {object} policy\n   */\n  fillMolecule ({\n    metaType,\n    metaId,\n    rule,\n    policy\n  }) {\n    this.$__molecule.createRule({\n      metaType,\n      metaId,\n      rule,\n      policy\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseCreateRule}\n   */\n  createResponse (json) {\n    return new ResponseCreateRule({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\n\n/**\n *\n */\nexport default class MutationDepositBufferToken extends MutationProposeMolecule {\n  /**\n   * Fills the Molecule with provided wallet and amount data\n   *\n   * @param amount\n   * @param tradeRates\n   */\n  fillMolecule ({\n    amount,\n    tradeRates\n  }) {\n    this.$__molecule.initDepositBuffer({\n      amount,\n      tradeRates\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check(this.$__molecule.sourceWallet)\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\n\n/**\n *\n */\nexport default class MutationWithdrawBufferToken extends MutationProposeMolecule {\n  /**\n   *\n   * @param recipients\n   * @param signingWallet\n   */\n  fillMolecule ({\n    recipients,\n    signingWallet\n  }) {\n    this.$__molecule.initWithdrawBuffer({\n      recipients,\n      signingWallet\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check(this.$__molecule.sourceWallet)\n  }\n}\n","const e=2592e5,n=\"thumbmark\",t=\"https://api.thumbmarkjs.com\",r={exclude:[],include:[],stabilize:[\"private\",\"iframe\"],logging:!0,timeout:5e3,cache_api_call:!0,cache_lifetime_in_ms:0,performance:!1,experimental:!1,simple_request:!1,property_name_factory:e=>`${n}_${e}`};let o={...r};function i(e,n){o[e]=n}const a={private:[{exclude:[\"canvas\"],browsers:[\"firefox\",\"safari>=17\",\"brave\"]},{exclude:[\"audio\"],browsers:[\"samsungbrowser\",\"safari\"]},{exclude:[\"fonts\"],browsers:[\"firefox\"]},{exclude:[\"audio.sampleHash\",\"hardware.deviceMemory\",\"header.acceptLanguage.q\",\"system.hardwareConcurrency\",\"plugins\"],browsers:[\"brave\"]},{exclude:[\"tls.extensions\"],browsers:[\"firefox\",\"chrome\",\"safari\"]},{exclude:[\"header.acceptLanguage\"],browsers:[\"edge\",\"chrome\"]}],iframe:[{exclude:[\"system.applePayVersion\",\"system.cookieEnabled\"],browsers:[\"safari\"]},{exclude:[\"permissions\"]}],vpn:[{exclude:[\"ip\"]}],always:[{exclude:[\"speech\"],browsers:[\"brave\",\"firefox\"]}]},s=\"undefined\"!=typeof window?window.OfflineAudioContext||window.webkitOfflineAudioContext:null;function c(e){let n=0;for(let t=0;t<e.length;++t)n+=Math.abs(e[t]);return n}function l(e,n,t){if(1===e.length)return e[0];if(3===e.length){const r=e[0].data,o=e[1].data,i=e[2].data,a=new Uint8ClampedArray(r.length);for(let e=0;e<r.length;e++){const n=r[e],t=o[e],s=i[e];a[e]=n===t||n===s?n:t===s?t:n}return new ImageData(a,n,t)}let r=[];for(let n=0;n<e[0].data.length;n++){let t=[];for(let r=0;r<e.length;r++)t.push(e[r].data[n]);r.push(u(t))}const o=new Uint8ClampedArray(r);return new ImageData(o,n,t)}function u(e){if(0===e.length)return 0;const n={};for(const t of e)n[t]=(n[t]||0)+1;let t=e[0];for(const e in n)n[e]>n[t]&&(t=parseInt(e,10));return t}function d(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),(e^=e>>>16)>>>0}const m=new Uint32Array([597399067,2869860233,951274213,2716044179]);function p(e,n){return e<<n|e>>>32-n}function f(e,n=0){if(n=n?0|n:0,\"string\"==typeof e&&(e=function(e){if(\"undefined\"!=typeof TextEncoder)return(new TextEncoder).encode(e).buffer;const n=[];for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);r<128?n.push(r):r<2048?n.push(192|r>>6,128|63&r):r<55296||r>=57344?n.push(224|r>>12,128|r>>6&63,128|63&r):(t++,r=65536+((1023&r)<<10|1023&e.charCodeAt(t)),n.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return new Uint8Array(n).buffer}(e)),!(e instanceof ArrayBuffer))throw new TypeError(\"Expected key to be ArrayBuffer or string\");const t=new Uint32Array([n,n,n,n]);!function(e,n){const t=e.byteLength/16|0,r=new Uint32Array(e,0,4*t);for(let e=0;e<t;e++){const t=r.subarray(4*e,4*(e+1));t[0]=Math.imul(t[0],m[0]),t[0]=p(t[0],15),t[0]=Math.imul(t[0],m[1]),n[0]=n[0]^t[0],n[0]=p(n[0],19),n[0]=n[0]+n[1],n[0]=Math.imul(n[0],5)+1444728091,t[1]=Math.imul(t[1],m[1]),t[1]=p(t[1],16),t[1]=Math.imul(t[1],m[2]),n[1]=n[1]^t[1],n[1]=p(n[1],17),n[1]=n[1]+n[2],n[1]=Math.imul(n[1],5)+197830471,t[2]=Math.imul(t[2],m[2]),t[2]=p(t[2],17),t[2]=Math.imul(t[2],m[3]),n[2]=n[2]^t[2],n[2]=p(n[2],15),n[2]=n[2]+n[3],n[2]=Math.imul(n[2],5)+2530024501,t[3]=Math.imul(t[3],m[3]),t[3]=p(t[3],18),t[3]=Math.imul(t[3],m[0]),n[3]=n[3]^t[3],n[3]=p(n[3],13),n[3]=n[3]+n[0],n[3]=Math.imul(n[3],5)+850148119}}(e,t),function(e,n){const t=e.byteLength/16|0,r=e.byteLength%16,o=new Uint32Array(4),i=new Uint8Array(e,16*t,r);switch(r){case 15:o[3]=o[3]^i[14]<<16;case 14:o[3]=o[3]^i[13]<<8;case 13:o[3]=o[3]^i[12],o[3]=Math.imul(o[3],m[3]),o[3]=p(o[3],18),o[3]=Math.imul(o[3],m[0]),n[3]=n[3]^o[3];case 12:o[2]=o[2]^i[11]<<24;case 11:o[2]=o[2]^i[10]<<16;case 10:o[2]=o[2]^i[9]<<8;case 9:o[2]=o[2]^i[8],o[2]=Math.imul(o[2],m[2]),o[2]=p(o[2],17),o[2]=Math.imul(o[2],m[3]),n[2]=n[2]^o[2];case 8:o[1]=o[1]^i[7]<<24;case 7:o[1]=o[1]^i[6]<<16;case 6:o[1]=o[1]^i[5]<<8;case 5:o[1]=o[1]^i[4],o[1]=Math.imul(o[1],m[1]),o[1]=p(o[1],16),o[1]=Math.imul(o[1],m[2]),n[1]=n[1]^o[1];case 4:o[0]=o[0]^i[3]<<24;case 3:o[0]=o[0]^i[2]<<16;case 2:o[0]=o[0]^i[1]<<8;case 1:o[0]=o[0]^i[0],o[0]=Math.imul(o[0],m[0]),o[0]=p(o[0],15),o[0]=Math.imul(o[0],m[1]),n[0]=n[0]^o[0]}}(e,t),function(e,n){n[0]=n[0]^e.byteLength,n[1]=n[1]^e.byteLength,n[2]=n[2]^e.byteLength,n[3]=n[3]^e.byteLength,n[0]=n[0]+n[1]|0,n[0]=n[0]+n[2]|0,n[0]=n[0]+n[3]|0,n[1]=n[1]+n[0]|0,n[2]=n[2]+n[0]|0,n[3]=n[3]+n[0]|0,n[0]=d(n[0]),n[1]=d(n[1]),n[2]=d(n[2]),n[3]=d(n[3]),n[0]=n[0]+n[1]|0,n[0]=n[0]+n[2]|0,n[0]=n[0]+n[3]|0,n[1]=n[1]+n[0]|0,n[2]=n[2]+n[0]|0,n[3]=n[3]+n[0]|0}(e,t);const r=new Uint8Array(t.buffer);return Array.from(r).map((e=>e.toString(16).padStart(2,\"0\"))).join(\"\")}const h=280;function g(e,n){return new Promise((t=>setTimeout(t,e,n)))}const v=[\"Arial\",\"Arial Black\",\"Arial Narrow\",\"Arial Rounded MT\",\"Arimo\",\"Archivo\",\"Barlow\",\"Bebas Neue\",\"Bitter\",\"Bookman\",\"Calibri\",\"Cabin\",\"Candara\",\"Century\",\"Century Gothic\",\"Comic Sans MS\",\"Constantia\",\"Courier\",\"Courier New\",\"Crimson Text\",\"DM Mono\",\"DM Sans\",\"DM Serif Display\",\"DM Serif Text\",\"Dosis\",\"Droid Sans\",\"Exo\",\"Fira Code\",\"Fira Sans\",\"Franklin Gothic Medium\",\"Garamond\",\"Geneva\",\"Georgia\",\"Gill Sans\",\"Helvetica\",\"Impact\",\"Inconsolata\",\"Indie Flower\",\"Inter\",\"Josefin Sans\",\"Karla\",\"Lato\",\"Lexend\",\"Lucida Bright\",\"Lucida Console\",\"Lucida Sans Unicode\",\"Manrope\",\"Merriweather\",\"Merriweather Sans\",\"Montserrat\",\"Myriad\",\"Noto Sans\",\"Nunito\",\"Nunito Sans\",\"Open Sans\",\"Optima\",\"Orbitron\",\"Oswald\",\"Pacifico\",\"Palatino\",\"Perpetua\",\"PT Sans\",\"PT Serif\",\"Poppins\",\"Prompt\",\"Public Sans\",\"Quicksand\",\"Rajdhani\",\"Recursive\",\"Roboto\",\"Roboto Condensed\",\"Rockwell\",\"Rubik\",\"Segoe Print\",\"Segoe Script\",\"Segoe UI\",\"Sora\",\"Source Sans Pro\",\"Space Mono\",\"Tahoma\",\"Taviraj\",\"Times\",\"Times New Roman\",\"Titillium Web\",\"Trebuchet MS\",\"Ubuntu\",\"Varela Round\",\"Verdana\",\"Work Sans\"],w=[\"monospace\",\"sans-serif\",\"serif\"];function y(e,n){return e.font=`72px ${n}`,e.measureText(\"WwMmLli0Oo\").width}function S(){var e;const n=document.createElement(\"canvas\"),t=null!==(e=n.getContext(\"webgl\"))&&void 0!==e?e:n.getContext(\"experimental-webgl\");if(t&&\"getParameter\"in t)try{const e=(t.getParameter(t.VENDOR)||\"\").toString(),n=(t.getParameter(t.RENDERER)||\"\").toString();let r={vendor:e,renderer:n,version:(t.getParameter(t.VERSION)||\"\").toString(),shadingLanguageVersion:(t.getParameter(t.SHADING_LANGUAGE_VERSION)||\"\").toString()};if(!n.length||!e.length){const e=t.getExtension(\"WEBGL_debug_renderer_info\");if(e){const n=(t.getParameter(e.UNMASKED_VENDOR_WEBGL)||\"\").toString(),o=(t.getParameter(e.UNMASKED_RENDERER_WEBGL)||\"\").toString();n&&(r.vendorUnmasked=n),o&&(r.rendererUnmasked=o)}}return r}catch(e){}return\"undefined\"}function b(){const e=new Float32Array(1),n=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],n[3]}const _=(e,n,t,r)=>{const o=(t-n)/r;let i=0;for(let t=0;t<r;t++){i+=e(n+(t+.5)*o)}return i*o};function P(e,n){const t={};return n.forEach((n=>{const r=function(e){if(0===e.length)return null;const n={};e.forEach((e=>{const t=String(e);n[t]=(n[t]||0)+1}));let t=e[0],r=1;return Object.keys(n).forEach((e=>{n[e]>r&&(t=e,r=n[e])})),t}(e.map((e=>n in e?e[n]:void 0)).filter((e=>void 0!==e)));r&&(t[n]=r)})),t}const A=[\"accelerometer\",\"accessibility\",\"accessibility-events\",\"ambient-light-sensor\",\"background-fetch\",\"background-sync\",\"bluetooth\",\"camera\",\"clipboard-read\",\"clipboard-write\",\"device-info\",\"display-capture\",\"gyroscope\",\"geolocation\",\"local-fonts\",\"magnetometer\",\"microphone\",\"midi\",\"nfc\",\"notifications\",\"payment-handler\",\"persistent-storage\",\"push\",\"speaker\",\"storage-access\",\"top-level-storage-access\",\"window-management\",\"query\"];const M=new Map;function x(){if(\"undefined\"==typeof navigator)return{name:\"unknown\",version:\"unknown\"};const e=!!navigator.brave,n=(e?\"B|\":\"N|\")+navigator.userAgent,t=M.get(n);if(t)return t;const r=[{name:\"Brave\",detect:()=>e}];let o;for(const e of r)if(e.detect()){const t=C(navigator.userAgent);return o={name:e.name,version:t.version},M.set(n,o),o}return o=C(navigator.userAgent),M.set(n,o),o}function C(e){var n,t,r,o,i,a;const s=[/(?<name>SamsungBrowser)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>EdgA|EdgiOS|Edg)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>OPR|OPX)\\/(?<version>\\d+(?:\\.\\d+)+)/,/Opera[\\s\\/](?<version>\\d+(?:\\.\\d+)+)/,/Opera Mini\\/(?<version>\\d+(?:\\.\\d+)+)/,/Opera Mobi\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>Vivaldi)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>CriOS)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>FxiOS)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>Chrome|Chromium)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>Firefox|Waterfox|Iceweasel|IceCat)\\/(?<version>\\d+(?:\\.\\d+)+)/,/Version\\/(?<version1>[\\d.]+).*Safari\\/[\\d.]+|(?<name>Safari)\\/(?<version2>[\\d.]+)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>[A-Za-z]+)\\/(?<version>\\d+(?:\\.\\d+)+)/],c={edg:\"Edge\",edga:\"Edge\",edgios:\"Edge\",opr:\"Opera\",opx:\"Opera\",crios:\"Chrome\",fxios:\"Firefox\",samsung:\"SamsungBrowser\",vivaldi:\"Vivaldi\"};for(const l of s){const s=e.match(l);if(s){let e=null===(n=s.groups)||void 0===n?void 0:n.name,u=(null===(t=s.groups)||void 0===t?void 0:t.version)||(null===(r=s.groups)||void 0===r?void 0:r.version1)||(null===(o=s.groups)||void 0===o?void 0:o.version2);if(e||!(null===(i=s.groups)||void 0===i?void 0:i.version1)&&!(null===(a=s.groups)||void 0===a?void 0:a.version2)||(e=\"Safari\"),!e&&l.source.includes(\"Opera Mini\")&&(e=\"Opera Mini\"),!e&&l.source.includes(\"Opera Mobi\")&&(e=\"Opera Mobi\"),!e&&l.source.includes(\"Opera\")&&(e=\"Opera\"),!e&&s[1]&&(e=s[1]),!u&&s[2]&&(u=s[2]),e){return{name:c[e.toLowerCase()]||e,version:u||\"unknown\"}}}}return{name:\"unknown\",version:\"unknown\"}}function E(){if(\"undefined\"==typeof navigator||!navigator.userAgent)return!1;const e=navigator.userAgent;return/Mobi|Android|iPhone|iPod|IEMobile|Opera Mini|Opera Mobi|webOS|BlackBerry|Windows Phone/i.test(e)&&!/iPad/i.test(e)}function T(){let e=[];const n={\"prefers-contrast\":[\"high\",\"more\",\"low\",\"less\",\"forced\",\"no-preference\"],\"any-hover\":[\"hover\",\"none\"],\"any-pointer\":[\"none\",\"coarse\",\"fine\"],pointer:[\"none\",\"coarse\",\"fine\"],hover:[\"hover\",\"none\"],update:[\"fast\",\"slow\"],\"inverted-colors\":[\"inverted\",\"none\"],\"prefers-reduced-motion\":[\"reduce\",\"no-preference\"],\"prefers-reduced-transparency\":[\"reduce\",\"no-preference\"],scripting:[\"none\",\"initial-only\",\"enabled\"],\"forced-colors\":[\"active\",\"none\"]};return Object.keys(n).forEach((t=>{n[t].forEach((n=>{matchMedia(`(${t}: ${n})`).matches&&e.push(`${t}: ${n}`)}))})),e}function k(){if(\"https:\"===window.location.protocol&&\"function\"==typeof window.ApplePaySession)try{const e=window.ApplePaySession.supportsVersion;for(let n=15;n>0;n--)if(e(n))return n}catch(e){return 0}return 0}const R=\"SamsungBrowser\"!==x().name?1:3,O=\"Brave\"!==x().name,I=137,B=(()=>{const e=new Float32Array(548),n=2*Math.PI/I;for(let t=0;t<I;t++){const r=t*n;e[4*t]=0,e[4*t+1]=0,e[4*t+2]=100*Math.cos(r),e[4*t+3]=50*Math.sin(r)}return e})();let L=null;function D(){try{if(\"undefined\"==typeof document)return null;const e=document.createElement(\"canvas\");e.width=200,e.height=100;const n=e.getContext(\"webgl\");if(!n)return null;e.addEventListener(\"webglcontextlost\",(e=>{e.preventDefault(),L=null}),{once:!0});const t=n.createShader(n.VERTEX_SHADER),r=n.createShader(n.FRAGMENT_SHADER);if(!t||!r)return null;if(n.shaderSource(t,\"\\n    attribute vec2 position;\\n    void main() {\\n        gl_Position = vec4(position, 0.0, 1.0);\\n    }\\n\"),n.compileShader(t),!n.getShaderParameter(t,n.COMPILE_STATUS))return null;if(n.shaderSource(r,\"\\n    precision mediump float;\\n    void main() {\\n        gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color\\n    }\\n\"),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))return null;const o=n.createProgram();if(!o)return null;if(n.attachShader(o,t),n.attachShader(o,r),n.linkProgram(o),!n.getProgramParameter(o,n.LINK_STATUS))return null;const i=n.createBuffer();return i?(n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,B,n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),{canvas:e,gl:n,program:o,buffer:i}):null}catch(e){return null}}function N(e){const n=new Set;return function e(t){if(t&&t.toJSON&&\"function\"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if(\"number\"==typeof t)return isFinite(t)?\"\"+t:\"null\";if(\"object\"!=typeof t)return JSON.stringify(t);let r,o;if(Array.isArray(t)){for(o=\"[\",r=0;r<t.length;r++)r&&(o+=\",\"),o+=e(t[r])||\"null\";return o+\"]\"}if(null===t)return\"null\";if(n.has(t))throw new TypeError(\"Converting circular structure to JSON\");n.add(t);const i=Object.keys(t).sort();for(o=\"\",r=0;r<i.length;r++){const n=i[r],a=e(t[n]);a&&(o&&(o+=\",\"),o+=JSON.stringify(n)+\":\"+a)}return n.delete(t),\"{\"+o+\"}\"}(e)||\"\"}const U={audio:async function(){return s?async function(){return new Promise(((e,n)=>{try{const n=new s(1,5e3,44100),t=n.createBufferSource(),r=n.createOscillator();r.frequency.value=1e3;const o=n.createDynamicsCompressor();let i;o.threshold.value=-50,o.knee.value=40,o.ratio.value=12,o.attack.value=0,o.release.value=.2,r.connect(o),o.connect(n.destination),r.start(),n.oncomplete=r=>{i=r.renderedBuffer.getChannelData(0),e({sampleHash:c(i),maxChannels:n.destination.maxChannelCount,channelCountMode:t.channelCountMode})},n.startRendering()}catch(e){n(e)}}))}():null},canvas:async function(){return new Promise((e=>{const n=Array.from({length:3},(()=>function(){const e=document.createElement(\"canvas\"),n=e.getContext(\"2d\");if(!n)return null;e.width=h,e.height=20;const t=n.createLinearGradient(0,0,e.width,e.height);t.addColorStop(0,\"red\"),t.addColorStop(1/6,\"orange\"),t.addColorStop(2/6,\"yellow\"),t.addColorStop(.5,\"green\"),t.addColorStop(4/6,\"blue\"),t.addColorStop(5/6,\"indigo\"),t.addColorStop(1,\"violet\"),n.fillStyle=t,n.fillRect(0,0,e.width,e.height);const r=\"Random Text WMwmil10Oo\";return n.font=\"23.123px Arial\",n.fillStyle=\"black\",n.fillText(r,-5,15),n.fillStyle=\"rgba(0, 0, 255, 0.5)\",n.fillText(r,-3.3,17.7),n.beginPath(),n.moveTo(0,0),n.lineTo(2*e.width/7,e.height),n.strokeStyle=\"white\",n.lineWidth=2,n.stroke(),n.getImageData(0,0,e.width,e.height)}())).filter((e=>null!==e));0!==n.length?e({commonPixelsHash:f(l(n,h,20).data.toString()).toString()}):e(null)}))},fonts:async function(e){return new Promise((e=>{try{!async function(e){for(var n;!document.body;)await g(50);const t=document.createElement(\"iframe\");t.setAttribute(\"frameBorder\",\"0\");const r=t.style;r.setProperty(\"position\",\"fixed\"),r.setProperty(\"display\",\"block\",\"important\"),r.setProperty(\"visibility\",\"visible\"),r.setProperty(\"border\",\"0\"),r.setProperty(\"opacity\",\"0\"),t.src=\"about:blank\",document.body.appendChild(t);const o=t.contentDocument||(null===(n=t.contentWindow)||void 0===n?void 0:n.document);if(!o)throw new Error(\"Iframe document is not accessible\");e({iframe:o}),setTimeout((()=>{document.body.removeChild(t)}),0)}((async({iframe:n})=>{const t=n.createElement(\"canvas\").getContext(\"2d\");if(!t)return void e(null);const r=w.map((e=>y(t,e)));let o={};v.forEach((e=>{const n=y(t,e);r.includes(n)||(o[e]=n)})),e(o)}))}catch(n){e(null)}}))},hardware:function(){return new Promise(((e,n)=>{const t=void 0!==navigator.deviceMemory?navigator.deviceMemory:0,r=window.performance&&window.performance.memory?window.performance.memory:0;e({videocard:S(),architecture:b(),deviceMemory:t.toString()||\"undefined\",jsHeapSizeLimit:r.jsHeapSizeLimit||0})}))},locales:function(){return new Promise((e=>{e({languages:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}))},math:function(){return new Promise((e=>{e({acos:Math.acos(.5),asin:_(Math.asin,-1,1,97),cos:_(Math.cos,0,Math.PI,97),largeCos:Math.cos(1e20),largeSin:Math.sin(1e20),largeTan:Math.tan(1e20),sin:_(Math.sin,-Math.PI,Math.PI,97),tan:_(Math.tan,0,2*Math.PI,97)})}))},permissions:async function(e){const n=(null==e?void 0:e.permissions_to_check)||A;return P(await Promise.all(Array.from({length:3},(()=>async function(e){const n={};for(const t of e)try{const e=await navigator.permissions.query({name:t});n[t]=e.state.toString()}catch(e){}return n}(n)))),n)},plugins:async function(){const e=[];if(navigator.plugins)for(let n=0;n<navigator.plugins.length;n++){const t=navigator.plugins[n];e.push([t.name,t.filename,t.description].join(\"|\"))}return new Promise((n=>{n({plugins:e})}))},screen:function(){return new Promise((e=>{if(\"undefined\"==typeof matchMedia||\"undefined\"==typeof screen)return void e(null);const n={is_touchscreen:navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints,colorDepth:screen.colorDepth,mediaMatches:T()};E()&&navigator.maxTouchPoints>0&&(n.resolution=function(){const e=window.screen.width,n=window.screen.height,t=Math.max(e,n).toString(),r=Math.min(e,n).toString();return`${t}x${r}`}()),e(n)}))},system:function(){return new Promise((e=>{const n=x();e({platform:window.navigator.platform,productSub:navigator.productSub,product:navigator.product,useragent:navigator.userAgent,hardwareConcurrency:navigator.hardwareConcurrency,browser:{name:n.name,version:n.version},mobile:E(),applePayVersion:k(),cookieEnabled:window.navigator.cookieEnabled})}))},webgl:async function(){const e=O?(L||(L=D()),L):D();if(!e)return{webgl:\"unsupported\"};try{const n=Array.from({length:R},(()=>function(e){const{canvas:n,gl:t,program:r,buffer:o}=e;try{t.useProgram(r),t.bindBuffer(t.ARRAY_BUFFER,o);const e=t.getAttribLocation(r,\"position\");t.enableVertexAttribArray(e),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),t.viewport(0,0,n.width,n.height),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.LINES,0,274);const i=new Uint8ClampedArray(n.width*n.height*4);return t.readPixels(0,0,n.width,n.height,t.RGBA,t.UNSIGNED_BYTE,i),new ImageData(i,n.width,n.height)}catch(e){return L=null,new ImageData(1,1)}finally{t.bindBuffer(t.ARRAY_BUFFER,null),t.useProgram(null),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(0,0,0,0)}}(e)));return{commonPixelsHash:f(l(n,e.canvas.width,e.canvas.height).data.toString()).toString()}}catch(e){return{webgl:\"unsupported\"}}},webrtc:async function(e){return new Promise((e=>{let n;try{const t=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection;if(!t)return void e({supported:!1,error:\"WebRTC not supported\"});n=new t({iceCandidatePoolSize:1,iceServers:[]});const r=n;r.createDataChannel(\"\");(async()=>{try{const n={offerToReceiveAudio:!0,offerToReceiveVideo:!0},t=await r.createOffer(n);await r.setLocalDescription(t);const o=t.sdp||\"\",i=[...new Set((o.match(/extmap:\\d+ [^\\n\\r]+/g)||[]).map((e=>e.replace(/extmap:\\d+ /,\"\"))))].sort(),a=e=>{const n=o.match(new RegExp(`m=${e} [^\\\\s]+ [^\\\\s]+ ([^\\\\n\\\\r]+)`));return n?n[1].split(\" \"):[]},s=(e,n)=>n.map((n=>{const t=new RegExp(`(rtpmap|fmtp|rtcp-fb):${n} (.+)`,\"g\"),r=[...o.matchAll(t)];if(!r.length)return null;const i={};return r.forEach((n=>{const[t,r,o]=n,a=o.split(\"/\");\"rtpmap\"===r?(i.mimeType=`${e}/${a[0]}`,i.clockRate=+a[1],\"audio\"===e&&(i.channels=+a[2]||1)):\"rtcp-fb\"===r?(i.feedbackSupport=i.feedbackSupport||[],i.feedbackSupport.push(o)):\"fmtp\"===r&&(i.sdpFmtpLine=o)})),i})).filter(Boolean),c=s(\"audio\",a(\"audio\")),l=s(\"video\",a(\"video\")),u={audio:{count:c.length,hash:f(N(c))},video:{count:l.length,hash:f(N(l))},extensionsHash:f(N(i))};r.close();const d={supported:!0,...u,candidateType:\"host\"};e({details:d,hash:f(N(d))})}catch(n){r.close(),e({supported:!0,error:`WebRTC offer failed: ${n.message}`})}})()}catch(t){null==n||n.close(),e({supported:!1,error:`WebRTC error: ${t.message}`})}}))},speech:async function(){return new Promise((e=>{try{if(\"undefined\"==typeof window||!window.speechSynthesis||\"function\"!=typeof window.speechSynthesis.getVoices)return void e({supported:!1,error:\"Speech Synthesis API not supported\"});let n=!1,t=null;const r=r=>{if(!n){n=!0,t&&clearTimeout(t);try{const n=r.map((e=>{const n=e=>e.replace(/\\\\/g,\"\\\\\\\\\").replace(/,/g,\"\\\\,\");return[n(e.voiceURI||\"\"),n(e.name||\"\"),n(e.lang||\"\"),e.localService?\"1\":\"0\",e.default?\"1\":\"0\"].join(\",\")}));n.sort();const t={voiceCount:r.length,voicesHash:f(N(n))};e({details:t,hash:f(N(t))})}catch(n){e({supported:!0,error:`Voice processing failed: ${n.message}`})}}},o=window.speechSynthesis.getVoices();if(o.length>0)return void r(o);t=setTimeout((()=>{const e=window.speechSynthesis.getVoices();r(e)}),800);const i=()=>{window.speechSynthesis.removeEventListener(\"voiceschanged\",i);const e=window.speechSynthesis.getVoices();r(e)};window.speechSynthesis.addEventListener(\"voiceschanged\",i)}catch(n){e({supported:!1,error:`Speech Synthesis error: ${n.message}`})}}))}},$={},F={timeout:\"true\"},j=(e,n,t)=>{$[e]=n};function V(){return\"1.11.0\"}function W(e,n){var t,r;let o=x();if(\"unknown\"===o.name&&n){const e=null===(t=n.system)||void 0===t?void 0:t.browser;(null==e?void 0:e.name)&&(o={name:String(e.name),version:String(e.version||\"unknown\")})}const i=o.name.toLowerCase(),s=parseInt(o.version.split(\".\")[0]||\"0\",10),c=Array.isArray(null==e?void 0:e.exclude)?[...e.exclude]:[],l=[...new Set([...(null==e?void 0:e.stabilize)||[],\"always\"])];for(const e of l){const n=a[e];if(n)for(const e of n)\"browsers\"in e&&!(null===(r=e.browsers)||void 0===r?void 0:r.some((e=>{const n=e.match(/(.+?)(>=)(\\d+)/);return n?i===n[1]&&s>=+n[3]:i===e})))||c.push(...e.exclude)}return c}function G(e,n){const t=W(n,e),r=Array.isArray(null==n?void 0:n.include)?n.include:[];return function e(n,o=\"\"){const i={};for(const[a,s]of Object.entries(n)){const n=o?`${o}.${a}`:a;if(\"object\"!=typeof s||Array.isArray(s)||null===s){const e=t.some((e=>n.startsWith(e))),o=r.some((e=>n.startsWith(e)));e&&!o||(i[a]=s)}else{const t=e(s,n);Object.keys(t).length>0&&(i[a]=t)}}return i}(e)}const H=\"https://experimental.thumbmarkjs.com/experimental.min.js\",q=131072;function J(e,n){const t={target:\"request\",type:e};return n&&(t.message=n.slice(0,200)),{schema:0,payload_id:\"none\",signals:{},errors:[t]}}function z(e){if(\"object\"!=typeof e||null===e||Array.isArray(e))return!1;const n=Object.getPrototypeOf(e);return n===Object.prototype||null===n}function Y(e){return e instanceof Error?e.message:void 0}async function K(){var e;try{return null!==(e=await function(e,n){let t;const r=new Promise((e=>{t=setTimeout((()=>e(null)),n)}));return Promise.race([e,r]).finally((()=>clearTimeout(t)))}(async function(){let e,n;try{const n=await fetch(H,{method:\"GET\"});if(!n.ok)return J(\"http\",`HTTP ${n.status}`);e=await n.text()}catch(e){return J(\"fetch\",Y(e))}if(!e)return J(\"empty\");if(e.length>q)return J(\"oversized\",`${e.length} chars`);try{const t=eval;n=await Promise.resolve(t(e))}catch(e){return J(function(e){return e instanceof SyntaxError?\"syntax\":e instanceof EvalError?\"eval_blocked\":\"threw\"}(e),Y(e))}return function(e){return!!z(e)&&!(\"number\"!=typeof e.schema||e.schema<1)&&\"string\"==typeof e.payload_id&&z(e.signals)}(n)?{...n,errors:Array.isArray(n.errors)?n.errors:[]}:J(\"malformed\")}(),2e3))&&void 0!==e?e:J(\"timeout\",\"exceeded 2000ms\")}catch(e){return J(\"threw\",Y(e))}}const X=\"visitor_id\";function Z(e){return e.storage_property_name?e.storage_property_name:e.property_name_factory(X)}const Q=`${n}_${X}`;function ee(e,n){try{localStorage.setItem(Z(n),e)}catch(e){}}const ne=\"cache\";function te(e){try{const n=localStorage.getItem(e.property_name_factory(ne)),t=JSON.parse(n);return t||{}}catch(e){}return{}}function re(n){return n.cache_lifetime_in_ms>e?Date.now()+e:Date.now()+n.cache_lifetime_in_ms}class oe extends Error{constructor(e){super(`HTTP error! status: ${e}`),this.status=e}}let ie=null,ae=null;async function se(e,n,t,r){const o=t.simple_request?{\"Content-Type\":\"text/plain\"}:{\"x-api-key\":t.api_key,Authorization:\"custom-authorized\",\"Content-Type\":\"application/json\"},i=await fetch(e,{method:\"POST\",headers:o,body:JSON.stringify(n)});if(!i.ok)throw new oe(i.status);const a=await i.json();return a.visitorId&&a.visitorId!==r&&ee(a.visitorId,t),ae=a,function(e,n){if(!e.cache_api_call||!e.cache_lifetime_in_ms)return;!function(e,n){const t={...te(e),...n};try{localStorage.setItem(e.property_name_factory(ne),JSON.stringify(t))}catch(e){}}(e,{apiResponseExpiry:re(e),apiResponse:n})}(t,a),a}const ce=(e,n)=>{if(e.cache_api_call){if(ae)return Promise.resolve(ae);const n=function(e){const n=te(e);if(n&&n.apiResponse&&n.apiResponseExpiry&&Date.now()<=n.apiResponseExpiry)return n.apiResponse;return}(e);if(n)return Promise.resolve(n);if(ie)return ie}const r=e.api_endpoint||t;let o;try{const e=new URL(r);o=\"/\"!==e.pathname||r.endsWith(\"/\")?r:`${e.origin}/thumbmark`}catch(e){o=`${r}/thumbmark`}const i=function(e){try{const n=Z(e);let t=localStorage.getItem(n);return t||n===Q||(t=localStorage.getItem(Q),t&&ee(t,e)),t}catch(e){return null}}(e),{api_key:a,...s}=e,c={components:n,options:s,clientHash:f(N(n)),version:\"1.11.0\"};if(i&&(c.visitorId=i),e.metadata){const n=\"function\"==typeof e.metadata?e.metadata():e.metadata;if(n){(\"string\"==typeof n?n.length:JSON.stringify(n).length)>1e3?console.error(\"ThumbmarkJS: Metadata exceeds 1000 characters. Skipping metadata.\"):c.metadata=n}}const l=e.timeout||5e3,u=async function(e,n,t,r){for(let o=0;o<3;o++){o>0&&await new Promise((e=>setTimeout(e,200*o)));try{return await se(e,n,t,r)}catch(e){if(e instanceof oe||2===o)throw e}}throw new Error(\"Unreachable\")}(o,c,e,i).finally((()=>{ie=null})),d=new Promise((n=>{setTimeout((()=>{const t=te(e);n((null==t?void 0:t.apiResponse)||{info:{timed_out:!0},...i&&{visitorId:i}})}),l)}));return ie=Promise.race([u,d]),ie};async function le(e,n={}){var o;if(\"undefined\"==typeof document||\"undefined\"==typeof window)return{thumbmark:\"\",components:{},info:{},version:\"1.11.0\",error:[{type:\"fatal\",message:\"Browser environment required\"}]};try{const i={...r,...e},a=[],s=i.logging&&!sessionStorage.getItem(\"_tmjs_l\")&&Math.random()<1e-4,c={...U,...$,...n},{elapsed:l,resolvedComponents:u,errors:d,pipelineTimings:m}=await ue(c,i);a.push(...d);const p=i.api_key||i.simple_request?ce(i,u):null;let h=null;if(p)try{h=await p}catch(e){if(e instanceof oe&&403===e.status)return{error:[{type:\"api_unauthorized\",message:\"Invalid API key or quota exceeded\"}],components:{},info:{},version:\"1.11.0\",thumbmark:\"\"};a.push({type:e instanceof oe?\"api_error\":\"network_error\",message:e instanceof Error?e.message:String(e)})}(null===(o=null==h?void 0:h.info)||void 0===o?void 0:o.timed_out)&&a.push({type:\"api_timeout\",message:\"API request timed out\"});const g=performance.now(),v=G((null==h?void 0:h.components)||{},i),w=performance.now()-g,y={...u,...v},S=(null==h?void 0:h.info)||{uniqueness:{score:\"api only\"}};let b,_=0,P=0;if(null==h?void 0:h.thumbmark)b=h.thumbmark;else{const e=performance.now(),n=N(y);_=performance.now()-e;const t=performance.now();b=f(n),P=performance.now()-t}const A=\"1.11.0\";s&&async function(e,n,r,o=[]){var i;const a=`${t}/log`;sessionStorage.setItem(\"_tmjs_l\",\"1\");const s={thumbmark:e,components:n,experimental:await K(),version:\"1.11.0\",options:r,path:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.pathname,...o.length>0&&{errors:o}};try{await fetch(a,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(s)})}catch(e){}}(b,y,i,a).catch((()=>{}));const M={\"_pipeline.dispatch\":m[\"_pipeline.dispatch\"],\"_pipeline.resolve\":m[\"_pipeline.resolve\"],\"_pipeline.filter\":m[\"_pipeline.filter\"]+w,\"_pipeline.stringify\":_,\"_pipeline.hash\":P,\"_pipeline.assembly\":0},x={...l,...m,...M},C=i.performance?{elapsed:x}:{},E=performance.now(),T={...(null==h?void 0:h.visitorId)&&{visitorId:h.visitorId},thumbmark:b,components:y,info:S,version:A,...C,...a.length>0&&{error:a},...(null==h?void 0:h.requestId)&&{requestId:h.requestId},...(null==h?void 0:h.metadata)&&{metadata:h.metadata}};return x[\"_pipeline.assembly\"]=performance.now()-E,T}catch(e){return{thumbmark:\"\",components:{},info:{},version:\"1.11.0\",error:[{type:\"fatal\",message:e instanceof Error?e.message:String(e)}]}}}async function ue(e,n){const t={...r,...n},o=W(t).filter((e=>!e.includes(\".\"))),i=Object.entries(e).filter((([e])=>{var n;return!(null===(n=null==t?void 0:t.exclude)||void 0===n?void 0:n.includes(e))})).filter((([e])=>!o.includes(e))).filter((([e])=>{var n,r,o,i;return(null===(n=null==t?void 0:t.include)||void 0===n?void 0:n.some((e=>e.includes(\".\"))))?null===(r=null==t?void 0:t.include)||void 0===r?void 0:r.some((n=>n.startsWith(e))):0===(null===(o=null==t?void 0:t.include)||void 0===o?void 0:o.length)||(null===(i=null==t?void 0:t.include)||void 0===i?void 0:i.includes(e))})),a=i.map((([e])=>e)),s={},c=performance.now(),l=i.map((([e,t])=>{const r=performance.now(),o=t(n);return s[`_dispatch.${e}`]=performance.now()-r,o})),u=performance.now()-c,d=performance.now(),m=await function(e,n,t){return Promise.all(e.map((e=>{const r=performance.now();let o;const i=e.then((e=>(void 0!==o&&clearTimeout(o),{value:e,elapsed:performance.now()-r}))).catch((e=>(void 0!==o&&clearTimeout(o),{value:t,elapsed:performance.now()-r,error:e instanceof Error?e.message:String(e)}))),a=new Promise((e=>{o=setTimeout((()=>{e({value:t,elapsed:performance.now()-r,error:\"timeout\"})}),n)}));return Promise.race([i,a])})))}(l,(null==t?void 0:t.timeout)||5e3,F),p=performance.now()-d,f={},h={},g=[];m.forEach(((e,n)=>{var t;const r=a[n];f[r]=null!==(t=e.elapsed)&&void 0!==t?t:0,\"timeout\"===e.error?g.push({type:\"component_timeout\",message:`Component '${r}' timed out`,component:r}):e.error&&g.push({type:\"component_error\",message:e.error,component:r}),null!=e.value&&(h[r]=e.value)}));const v=performance.now(),w=G(h,t),y={\"_pipeline.dispatch\":u,\"_pipeline.resolve\":p,\"_pipeline.filter\":performance.now()-v,...s};return{elapsed:f,resolvedComponents:w,errors:g,pipelineTimings:y}}async function de(){return(await le(o)).components}async function me(e){try{const n=await le(o);return e?{hash:n.thumbmark.toString(),data:n.components}:n.thumbmark.toString()}catch(e){throw e}}async function pe(){try{const{elapsed:e,resolvedComponents:n}=await ue(U,o);return{...n,elapsed:e}}catch(e){throw e}}class fe{constructor(e){this.options={...r,...e},this.customComponents={}}async get(e){return le({...this.options,...e},this.customComponents)}getVersion(){return\"1.11.0\"}includeComponent(e,n){this.customComponents[e]=n}}export{fe as Thumbmark,G as filterThumbmarkData,me as getFingerprint,de as getFingerprintData,pe as getFingerprintPerformance,le as getThumbmark,V as getVersion,j as includeComponent,i as setOption,a as stabilizationExclusionRules,N as stableStringify};\n//# sourceMappingURL=thumbmark.esm.js.map\n","import {\n  createClient,\n  subscriptionExchange,\n  cacheExchange,\n  fetchExchange\n} from '@urql/core'\nimport { createClient as createWSClient } from 'graphql-ws'\nimport { pipe, map, subscribe } from 'wonka'\n\n// PQ-transport Phase E (cycle 163): the post-quantum CipherHash wrapper query. The validator\n// intercepts the `CipherHash` op, decrypts `$Hash`, executes the inner request, and returns the\n// encrypted response in `{ data: { CipherHash: { hash } } }`.\nconst CIPHER_HASH_QUERY = 'query ( $Hash: String! ) { CipherHash ( Hash: $Hash ) { hash } }'\n\n/**\n * Light parse of a GraphQL request body's operation type + root field name, for the CipherHash\n * bypass decision (no full GraphQL parse needed). Operation type = the first query/mutation/\n * subscription keyword (default 'query' for an anonymous `{ ... }`); root field = the first\n * identifier inside the top-level selection set.\n */\nfunction parseOperation (query) {\n  const typeMatch = (query || '').match(/\\b(query|mutation|subscription)\\b/i)\n  const type = typeMatch ? typeMatch[1].toLowerCase() : 'query'\n  const braceIdx = (query || '').indexOf('{')\n  const nameMatch = braceIdx >= 0 ? query.slice(braceIdx + 1).match(/[A-Za-z_][A-Za-z0-9_]*/) : null\n  return { type, name: nameMatch ? nameMatch[0] : '' }\n}\n\nclass UrqlClientWrapper {\n  constructor ({ serverUri, socket = null, encrypt = false }) {\n    this.$__client = this.createUrqlClient({ serverUri, socket, encrypt })\n    this.$__authToken = ''\n    this.$__pubkey = null\n    this.$__wallet = null\n    this.serverUri = serverUri\n    this.soketi = socket\n    this.cipherLink = !!encrypt\n    this.$__subscriptionManager = new Map()\n  }\n\n  createUrqlClient ({ serverUri, socket, encrypt }) {\n    const exchanges = [cacheExchange, fetchExchange]\n\n    // Add subscription support if socket is configured\n    if (socket && socket.socketUri) {\n      const wsClient = createWSClient({\n        url: socket.socketUri,\n        connectionParams: () => ({\n          authToken: this.$__authToken\n        })\n      })\n\n      exchanges.push(subscriptionExchange({\n        forwardSubscription: operation => ({\n          subscribe: sink => {\n            const disposable = wsClient.subscribe(operation, sink)\n            return { unsubscribe: disposable }\n          }\n        })\n      }))\n    }\n\n    return createClient({\n      url: serverUri,\n      exchanges,\n      // urql 5 had no default and always POSTed; urql 6 defaults to 'within-url-limit', which\n      // URL-encodes short queries and sends NO body. That would silently disable the CipherHash\n      // envelope below — cipherFetch's `typeof init.body === 'string'` guard fails on a GET, so\n      // the query would leave as plaintext URL parameters with no error. Pin POST explicitly.\n      preferGetMethod: false,\n      // PQ-transport Phase E: when encryption is on, route fetch through the CipherHash\n      // wrapper (encrypt the request body to the validator's ML-KEM pubkey, decrypt the\n      // response). Undefined → urql uses the global fetch (plaintext).\n      ...(encrypt ? { fetch: (input, init) => this.cipherFetch(input, init) } : {}),\n      fetchOptions: () => ({\n        headers: {\n          'X-Auth-Token': this.$__authToken\n        },\n        // Add 60 second timeout for debugging\n        signal: AbortSignal.timeout(60000)\n      })\n    })\n  }\n\n  /**\n   * Whether an outgoing GraphQL request body should be wrapped in CipherHash. Bypass (plaintext):\n   * introspection `__schema`, `ContinuId`, the `AccessToken` mutation, and the U-isotope\n   * `ProposeMolecule` (auth bootstrap — the key exchange itself can't be encrypted). Mirrors the\n   * Kotlin/validator bypass set.\n   */\n  shouldEncrypt (body) {\n    let parsed\n    try {\n      parsed = JSON.parse(body)\n    } catch (e) {\n      return false\n    }\n    const { type, name } = parseOperation(parsed.query)\n    if (type === 'query' && (name === '__schema' || name === 'ContinuId')) return false\n    if (type === 'mutation' && name === 'AccessToken') return false\n    if (type === 'mutation' && name === 'ProposeMolecule') {\n      const isotope = parsed.variables && parsed.variables.molecule &&\n        parsed.variables.molecule.atoms && parsed.variables.molecule.atoms[0] &&\n        parsed.variables.molecule.atoms[0].isotope\n      if (isotope === 'U') return false\n    }\n    return true\n  }\n\n  /**\n   * Custom `fetch` that wraps a GraphQL request in the ML-KEM CipherHash envelope and decrypts the\n   * response (PQ-transport Phase E). Operates on the raw POST body (mirrors Kotlin's\n   * encryptBody/decryptBody). Reads the CURRENT client wallet + validator pubkey from auth.\n   */\n  async cipherFetch (input, init) {\n    const wallet = this.getWallet()\n    const serverPubkey = this.getPubKey()\n    let encryptedRequest = false\n    let requestInit = init\n\n    if (wallet && serverPubkey && init && typeof init.body === 'string' && this.shouldEncrypt(init.body)) {\n      const hashVar = await wallet.encryptStringML(init.body, serverPubkey)\n      requestInit = { ...init, body: JSON.stringify({ query: CIPHER_HASH_QUERY, variables: { Hash: hashVar } }) }\n      encryptedRequest = true\n    }\n\n    const response = await fetch(input, requestInit)\n    if (!encryptedRequest) {\n      return response\n    }\n\n    // Decrypt the CipherHash response back to the inner GraphQL response JSON.\n    const text = await response.text()\n    const init2 = { status: response.status, statusText: response.statusText, headers: response.headers }\n    let parsed\n    try {\n      parsed = JSON.parse(text)\n    } catch (e) {\n      return new Response(text, init2)\n    }\n    const hash = parsed && parsed.data && parsed.data.CipherHash && parsed.data.CipherHash.hash\n    if (typeof hash !== 'string') {\n      // Plaintext (e.g. a validator-side error response) — pass through unchanged.\n      return new Response(text, init2)\n    }\n    const decrypted = await wallet.decryptMyMessageML(JSON.parse(hash))\n    return new Response(decrypted != null ? decrypted : text, init2)\n  }\n\n  setAuthData ({ token, pubkey, wallet }) {\n    this.$__authToken = token\n    this.$__pubkey = pubkey\n    this.$__wallet = wallet\n\n    // Recreate client with new auth data\n    this.$__client = this.createUrqlClient({\n      serverUri: this.serverUri,\n      socket: this.soketi,\n      encrypt: !!this.cipherLink\n    })\n  }\n\n  /**\n   * Builds the urql operation options forwarded with a query/mutation.\n   *\n   * Forwards the requestPolicy (so a long-lived client does not serve stale\n   * cache-first reads) and, when the caller supplied a per-query abort signal,\n   * the signal too — while re-supplying the X-Auth-Token header. urql REPLACES\n   * (not merges) the client-level fetchOptions with any operation-context\n   * fetchOptions (createRequestOperation builds the op context as\n   * {...baseOpts, ...opts}), so forwarding fetchOptions WITHOUT the header would\n   * drop X-Auth-Token and break auth. The header here is byte-identical to the\n   * client-level one set in createUrqlClient.\n   *\n   * @param {object} context\n   * @returns {object|undefined}\n   */\n  buildRequestOptions (context) {\n    if (!context) {\n      return undefined\n    }\n    const opts = {}\n    if (context.requestPolicy) {\n      opts.requestPolicy = context.requestPolicy\n    }\n    const callerSignal = context.fetchOptions && context.fetchOptions.signal\n    if (callerSignal) {\n      // Combine the per-query abort signal with the 60s timeout so either can\n      // cancel the request; fall back to the caller signal where AbortSignal.any\n      // is unavailable.\n      const signal = (typeof AbortSignal !== 'undefined' && typeof AbortSignal.any === 'function')\n        ? AbortSignal.any([callerSignal, AbortSignal.timeout(60000)])\n        : callerSignal\n      opts.fetchOptions = {\n        headers: { 'X-Auth-Token': this.$__authToken },\n        signal\n      }\n    }\n    return Object.keys(opts).length ? opts : undefined\n  }\n\n  async query (request) {\n    const { query, variables, context } = request\n    const opts = this.buildRequestOptions(context)\n    const result = await this.$__client.query(query, variables || {}, opts).toPromise()\n    return this.formatResponse(result)\n  }\n\n  async mutate (request) {\n    const { mutation, variables, context } = request\n    const opts = this.buildRequestOptions(context)\n    const result = await this.$__client.mutation(mutation, variables || {}, opts).toPromise()\n    return this.formatResponse(result)\n  }\n\n  subscribe (request, closure) {\n    const { query, variables, operationName } = request\n\n    // F-22 fix: wonka v3 — `subscribe` is a function applied via pipe, not a\n    // method on the result. The pipe-with-subscribe expression returns the\n    // subscription object directly (already shaped as `{ unsubscribe }`).\n    const subscription = pipe(\n      this.$__client.subscription(query, variables),\n      map(result => {\n        closure(this.formatResponse(result))\n      }),\n      subscribe(() => {})\n    )\n\n    // Store subscription for later cleanup\n    this.$__subscriptionManager.set(operationName, subscription)\n\n    return {\n      unsubscribe: () => this.unsubscribe(operationName)\n    }\n  }\n\n  formatResponse (result) {\n    // Match old Apollo response format\n    return {\n      data: result.data,\n      errors: result.error ? [result.error] : undefined\n    }\n  }\n\n  socketDisconnect () {\n    if (this.soketi) {\n      // Unsubscribe from all active subscriptions\n      this.unsubscribeAll()\n    }\n  }\n\n  unsubscribe (operationName) {\n    const subscription = this.$__subscriptionManager.get(operationName)\n    if (subscription) {\n      subscription.unsubscribe()\n      this.$__subscriptionManager.delete(operationName)\n    }\n  }\n\n  unsubscribeAll () {\n    this.$__subscriptionManager.forEach((subscription, operationName) => {\n      this.unsubscribe(operationName)\n    })\n  }\n\n  unsubscribeFromChannel (operationName) {\n    this.unsubscribe(operationName)\n  }\n\n  setEncryption (encrypt = false) {\n    this.cipherLink = encrypt\n    this.$__client = this.createUrqlClient({\n      serverUri: this.serverUri,\n      socket: this.soketi,\n      encrypt\n    })\n  }\n\n  getAuthToken () { return this.$__authToken }\n  getPubKey () { return this.$__pubkey }\n  getWallet () { return this.$__wallet }\n  getServerUri () { return this.serverUri }\n  getSocketUri () { return this.soketi ? this.soketi.socketUri : null }\n  getUri () { return this.serverUri }\n\n  setUri (uri) {\n    this.serverUri = uri\n    this.$__client = this.createUrqlClient({\n      serverUri: uri,\n      socket: this.soketi,\n      encrypt: !!this.cipherLink\n    })\n  }\n\n  setSocketUri ({ socketUri, appKey }) {\n    this.soketi = { socketUri, appKey }\n    this.$__client = this.createUrqlClient({\n      serverUri: this.serverUri,\n      socket: this.soketi,\n      encrypt: !!this.cipherLink\n    })\n  }\n}\n\nexport default UrqlClientWrapper\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n */\nimport Dot from './libraries/Dot.js'\nimport MemorySecretStorageProvider from './storage/MemorySecretStorageProvider.js'\nimport Decimal from './libraries/Decimal.js'\nimport {\n  generateBatchId,\n  generateBundleHash,\n  generateSecret\n} from './libraries/crypto.js'\nimport Molecule from './Molecule.js'\nimport Wallet from './Wallet.js'\nimport TokenUnit from './TokenUnit.js'\nimport AuthToken from './AuthToken.js'\nimport QueryContinuId from './query/QueryContinuId.js'\nimport QueryWalletBundle from './query/QueryWalletBundle.js'\nimport QueryWalletList from './query/QueryWalletList.js'\nimport QueryBalance from './query/QueryBalance.js'\nimport QueryMetaType from './query/QueryMetaType.js'\nimport QueryBatch from './query/QueryBatch.js'\nimport QueryBatchHistory from './query/QueryBatchHistory.js'\nimport MutationRequestAuthorization from './mutation/MutationRequestAuthorization.js'\nimport MutationCreateToken from './mutation/MutationCreateToken.js'\nimport MutationRequestTokens from './mutation/MutationRequestTokens.js'\nimport MutationTransferTokens from './mutation/MutationTransferTokens.js'\nimport MutationProposeMolecule from './mutation/MutationProposeMolecule.js'\nimport MutationCreateIdentifier from './mutation/MutationCreateIdentifier.js'\nimport MutationClaimShadowWallet from './mutation/MutationClaimShadowWallet.js'\nimport MutationCreateMeta from './mutation/MutationCreateMeta.js'\nimport MutationPeering from './mutation/MutationPeering.js'\nimport MutationAppendRequest from './mutation/MutationAppendRequest.js'\nimport MutationLinkIdentifier from './mutation/MutationLinkIdentifier.js'\nimport MutationCreateWallet from './mutation/MutationCreateWallet.js'\nimport MutationRequestAuthorizationGuest from './mutation/MutationRequestAuthorizationGuest.js'\nimport TransferBalanceException from './exception/TransferBalanceException.js'\nimport CodeException from './exception/CodeException.js'\nimport UnauthenticatedException from './exception/UnauthenticatedException.js'\nimport WalletShadowException from './exception/WalletShadowException.js'\nimport StackableUnitDecimalsException from './exception/StackableUnitDecimalsException.js'\nimport StackableUnitAmountException from './exception/StackableUnitAmountException.js'\nimport CreateMoleculeSubscribe from './subscribe/CreateMoleculeSubscribe.js'\nimport WalletStatusSubscribe from './subscribe/WalletStatusSubscribe.js'\nimport ActiveWalletSubscribe from './subscribe/ActiveWalletSubscribe.js'\nimport ActiveSessionSubscribe from './subscribe/ActiveSessionSubscribe.js'\nimport MutationActiveSession from './mutation/MutationActiveSession.js'\nimport QueryActiveSession from './query/QueryActiveSession.js'\nimport QueryToken from './query/QueryToken.js'\nimport BatchIdException from './exception/BatchIdException.js'\nimport AuthorizationRejectedException from './exception/AuthorizationRejectedException.js'\nimport QueryAtom from './query/QueryAtom.js'\nimport QueryPolicy from './query/QueryPolicy.js'\nimport QueryMetaTypeViaAtom from './query/QueryMetaTypeViaAtom.js'\nimport QueryMetaTypeViaMolecule from './query/QueryMetaTypeViaMolecule.js'\nimport QueryEmbeddingStatus from './query/QueryEmbeddingStatus.js'\nimport MutationCreateRule from './mutation/MutationCreateRule.js'\nimport MutationDepositBufferToken from './mutation/MutationDepositBufferToken.js'\nimport MutationWithdrawBufferToken from './mutation/MutationWithdrawBufferToken.js'\nimport {\n  getFingerprint,\n  getFingerprintData\n} from '@thumbmarkjs/thumbmarkjs'\nimport UrqlClientWrapper from './libraries/urql/UrqlClientWrapper.js'\n\n/**\n * Base client class providing a powerful but user-friendly wrapper\n * around complex Knish.IO ledger transactions.\n */\nexport default class KnishIOClient {\n  /**\n   * Class constructor\n   *\n   * @param {string} uri\n   * @param {string|null} cellSlug\n   * @param {object|null} socket\n   * @param {UrqlClientWrapper|null} client\n   * @param {number} serverSdkVersion\n   * @param {boolean} logging\n   */\n  constructor ({\n    uri,\n    cellSlug = null,\n    client = null,\n    socket = null,\n    serverSdkVersion = 3,\n    logging = false,\n    defaultRequestPolicy = null,\n    secretStorage = null,\n    mlKemParameterSet = 1024\n  }) {\n    this.initialize({\n      uri,\n      cellSlug,\n      socket,\n      client,\n      serverSdkVersion,\n      logging,\n      defaultRequestPolicy,\n      secretStorage,\n      mlKemParameterSet\n    })\n  }\n\n  /**\n   * Initializes a new Knish.IO client session\n   *\n   * @param {string|[]} uri\n   * @param {string|null} cellSlug\n   * @param {object|null} socket\n   * @param {UrqlClientWrapper|null} client\n   * @param {number} serverSdkVersion\n   * @param {boolean} logging\n   */\n  initialize ({\n    uri,\n    cellSlug = null,\n    socket = null,\n    client = null,\n    serverSdkVersion = 3,\n    logging = false,\n    defaultRequestPolicy = null,\n    secretStorage = null,\n    mlKemParameterSet = 1024\n  }) {\n    this.reset()\n\n    this.$__secretStorage = secretStorage\n    this.$__logging = logging\n    // Client-level urql request policy applied to reads that omit a per-call\n    // policy. A long-lived server/sync client set to 'network-only' never serves\n    // a stale cache-first read; browser/SPA consumers leave this null (cache-first).\n    this.$__defaultRequestPolicy = defaultRequestPolicy\n    this.setMlKemParameterSet(mlKemParameterSet)\n    this.$__authTokenObjects = {}\n    this.$__authInProcess = false\n    this.abortControllers = new Map()\n\n    this.setUri(uri)\n\n    if (cellSlug) {\n      this.setCellSlug(cellSlug)\n    }\n\n    for (const uriKey in this.$__uris) {\n      const url = this.$__uris[uriKey]\n      this.$__authTokenObjects[url] = null\n    }\n\n    this.log('info', `KnishIOClient::initialize() - Initializing new Knish.IO client session for SDK version ${ serverSdkVersion }...`)\n\n    this.$__client = client || new UrqlClientWrapper({\n      socket: {\n        ...{\n          socketUri: null,\n          appKey: 'knishio'\n        },\n        ...socket || {}\n      },\n      serverUri: this.getRandomUri()\n    })\n\n    this.$__serverSdkVersion = serverSdkVersion\n  }\n\n  /**\n   * Get active ML-KEM parameter set (1024 default or 768 step-back)\n   *\n   * @return {number}\n   */\n  getMlKemParameterSet () {\n    return this.$__mlKemParameterSet || 1024\n  }\n\n  /**\n   * Set active ML-KEM parameter set (1024 default or 768 step-back)\n   *\n   * @param {number|string} parameterSet\n   * @return {KnishIOClient}\n   */\n  setMlKemParameterSet (parameterSet) {\n    const paramNum = Number(parameterSet)\n    if (![1024, 768].includes(paramNum)) {\n      throw new Error(`KnishIO: unsupported ML-KEM parameter set ${parameterSet}; expected 1024 or 768.`)\n    }\n    this.$__mlKemParameterSet = paramNum\n    return this\n  }\n\n  /**\n   * Get random uri from specified this.$__uris\n   *\n   * @return {string}\n   */\n  getRandomUri () {\n    const rand = Math.floor(Math.random() * (this.$__uris.length))\n    return this.$__uris[rand]\n  }\n\n  /**\n   *\n   * @param encrypt\n   * @return {boolean}\n   */\n  switchEncryption (encrypt) {\n    if (this.$__encrypt === encrypt) {\n      return false\n    }\n    this.log('info', `KnishIOClient::switchEncryption() - Forcing encryption ${ encrypt ? 'on' : 'off' } to match node...`)\n\n    // Set encryption\n    this.$__encrypt = encrypt\n    this.$__client.setEncryption(encrypt)\n    return true\n  }\n\n  /**\n   * De-initializes the Knish.IO client session so that a new session can replace it\n   */\n  deinitialize () {\n    this.log('info', 'KnishIOClient::deinitialize() - Clearing the Knish.IO client session...')\n    this.reset()\n  }\n\n  /**\n   * Subscribes the client to the node's broadcast socket\n   *\n   * @return {UrqlClientWrapper}\n   */\n  subscribe () {\n    if (!this.client().getSocketUri()) {\n      throw new CodeException('KnishIOClient::subscribe() - Socket client not initialized!')\n    }\n    return this.client()\n  }\n\n  /**\n   * Gets the client's SDK version\n   *\n   * @return {number}\n   */\n  getServerSdkVersion () {\n    return this.$__serverSdkVersion\n  }\n\n  /**\n   * Returns the client-level default urql request policy (or null)\n   *\n   * @return {string|null}\n   */\n  getDefaultRequestPolicy () {\n    return this.$__defaultRequestPolicy || null\n  }\n\n  /**\n   * Sets the client-level default urql request policy applied to reads that\n   * omit a per-call policy (e.g. 'network-only' for a long-lived server client)\n   *\n   * @param {string|null} policy - 'cache-first'|'cache-only'|'network-only'|'cache-and-network'|null\n   */\n  setDefaultRequestPolicy (policy) {\n    this.$__defaultRequestPolicy = policy\n  }\n\n  /**\n   * Reset common properties\n   */\n  reset () {\n    this.$__secret = ''\n    this.$__bundle = ''\n    this.$__secretStorage = null\n    this.remainderWallet = null\n    this.$__capabilityCache = {}\n    this.$__defaultRequestPolicy = null\n  }\n\n  /**\n   * Returns the currently defined Cell identifier for this session\n   *\n   * @return {string|null}\n   */\n  getCellSlug () {\n    return this.$__cellSlug || null\n  }\n\n  /**\n   * Sets the Cell identifier for this session\n   *\n   * @param {string} cellSlug\n   */\n  setCellSlug (cellSlug) {\n    this.$__cellSlug = cellSlug\n  }\n\n  /**\n   * Sets the endpoint URI for this session\n   *\n   * @param {string|object} uri\n   */\n  setUri (uri) {\n    this.$__uris = typeof uri === 'object' ? uri : [uri]\n\n    // If client exists, update its URI with a random one from the new array\n    if (this.$__client) {\n      const randomUri = this.getRandomUri()\n      this.$__client.setUri(randomUri)\n    }\n  }\n\n  /**\n   * Sets the WebSocket (subscription) endpoint for this session.\n   *\n   * `setUri()` only updates the HTTP endpoint; the subscription socket is built once\n   * at construction from the `socket.socketUri` passed in. This lets a caller re-point\n   * the socket when the endpoint changes (F-8a, E2E gauntlet 2026-06-02).\n   *\n   * @param {string} socketUri\n   */\n  setSocketUri (socketUri) {\n    if (this.$__client && typeof this.$__client.setSocketUri === 'function') {\n      this.$__client.setSocketUri({ socketUri, appKey: 'knishio' })\n    }\n  }\n\n  /**\n   * Retrieves the endpoint URI for this session\n   *\n   * @return {string}\n   */\n  getUri () {\n    return this.$__client.getUri()\n  }\n\n  /**\n   * Returns the GraphQL client class session\n   *\n   * @return {UrqlClientWrapper}\n   */\n  client () {\n    if (!this.$__authInProcess) {\n      const randomUri = this.getRandomUri()\n      this.$__client.setUri(randomUri)\n\n      // Try to get stored auth token object\n      const authTokenObject = this.$__authTokenObjects[randomUri]\n\n      // Not authorized - try to do it\n      if (!authTokenObject) {\n        this.requestAuthToken({\n          secret: this.$__secret,\n          cellSlug: this.$__cellSlug,\n          encrypt: this.$__encrypt\n        }).catch(err => {\n          this.log('warn', `KnishIOClient::client() - Background authorization failed: ${ err.message }`)\n        })\n      } else {\n        // Use stored authorization data\n        this.$__client.setAuthData(authTokenObject.getAuthData())\n      }\n    }\n    return this.$__client\n  }\n\n  /**\n   * Returns whether a secret is being stored for this session\n   *\n   * @return {boolean}\n   */\n  hasSecret () {\n    return (!!this.$__secret && this.$__secret.length > 0) || (!!this.$__secretStorage && !!this.$__bundle && this.$__bundle.length > 0)\n  }\n\n  /**\n   * Set the client's secret\n   *\n   * @param secret\n   */\n  setSecret (secret) {\n    this.$__secret = secret\n    this.$__bundle = this.hashSecret(secret, 'setSecret')\n    if (!this.$__secretStorage) {\n      const memStorage = new MemorySecretStorageProvider()\n      memStorage.storeSecret(this.$__bundle, secret)\n      this.$__secretStorage = memStorage\n    } else {\n      this.$__secretStorage.storeSecret(this.$__bundle, secret)\n    }\n  }\n\n  /**\n   * Hashes the user secret to produce a bundle hash\n   * @param {string} secret\n   * @param {string|null} source\n   * @returns {string}\n   */\n  hashSecret (secret, source = null) {\n    this.log('info', `KnishIOClient::hashSecret(${ source ? `source: ${ source }` : '' }) - Computing wallet bundle from secret...`)\n    return generateBundleHash(secret)\n  }\n\n  /**\n   * Retrieves the stored secret for this session\n   *\n   * @return {string}\n   */\n  getSecret () {\n    if (!this.hasSecret()) {\n      throw new UnauthenticatedException('KnishIOClient::getSecret() - Unable to find a stored secret! Have you set a secret?')\n    }\n    return this.$__secret\n  }\n\n  /**\n   * Sets the secret storage provider and optionally sets the bundle hash\n   *\n   * @param {object} storage\n   * @param {string|null} [bundleHash]\n   */\n  setSecretStorage (storage, bundleHash = null) {\n    this.$__secretStorage = storage\n    if (bundleHash) {\n      this.$__bundle = bundleHash\n    }\n  }\n\n  /**\n   * Returns current secret storage provider\n   *\n   * @returns {object|null}\n   */\n  getSecretStorage () {\n    return this.$__secretStorage\n  }\n\n  /**\n   * Asynchronously retrieves the secret from storage or returns in-memory secret\n   *\n   * @param {object} [options]\n   * @returns {Promise<string|null>}\n   */\n  async retrieveSecret (options = {}) {\n    if (this.$__secret && this.$__secret.length > 0) {\n      return this.$__secret\n    }\n    if (this.$__secretStorage && this.$__bundle && this.$__bundle.length > 0) {\n      return await this.$__secretStorage.retrieveSecret(this.$__bundle, options)\n    }\n    return null\n  }\n\n  /**\n   * Returns whether a bundle hash is being stored for this session\n   *\n   * @return {boolean}\n   */\n  hasBundle () {\n    return !!this.$__bundle\n  }\n\n  /**\n   * Returns the bundle hash for this session\n   *\n   * @return {string}\n   */\n  getBundle () {\n    if (!this.hasBundle()) {\n      throw new UnauthenticatedException('KnishIOClient::getBundle() - Unable to find a stored bundle! Have you set a secret?')\n    }\n    return this.$__bundle\n  }\n\n  /**\n   * Retrieves the device fingerprint.\n   *\n   * @returns {Promise<string>} A promise that resolves to the device fingerprint as a string.\n   */\n  getFingerprint () {\n    return getFingerprint()\n  }\n\n  getFingerprintData () {\n    return getFingerprintData()\n  }\n\n  /**\n   * Retrieves this session's wallet used for signing the next Molecule\n   *\n   * @return {Promise<*|Wallet|null>}\n   */\n  async getSourceWallet () {\n    let sourceWallet = (await this.queryContinuId({\n      bundle: this.getBundle()\n    })).payload()\n\n    if (!sourceWallet) {\n      sourceWallet = new Wallet({\n        secret: this.getSecret(),\n        mlKemParameterSet: this.getMlKemParameterSet()\n      })\n    } else {\n      sourceWallet.key = Wallet.generateKey({\n        secret: this.getSecret(),\n        token: sourceWallet.token,\n        position: sourceWallet.position\n      })\n    }\n\n    return sourceWallet\n  }\n\n  /**\n   * Retrieves this session's remainder wallet\n   *\n   * @return {null}\n   */\n  getRemainderWallet () {\n    return this.remainderWallet\n  }\n\n  /**\n   * Instantiates a new Molecule and prepares this client session to operate on it\n   *\n   * @param secret\n   * @param bundle\n   * @param sourceWallet\n   * @param remainderWallet\n   * @return {Promise<Molecule>}\n   */\n  async createMolecule ({\n    secret = null,\n    bundle = null,\n    sourceWallet = null,\n    remainderWallet = null\n  }) {\n    this.log('info', 'KnishIOClient::createMolecule() - Creating a new molecule...')\n    if (!secret) {\n      if (this.$__secret && this.$__secret.length > 0) {\n        secret = this.getSecret()\n      } else if (this.$__secretStorage && this.$__bundle && this.$__bundle.length > 0) {\n        secret = await this.$__secretStorage.retrieveSecret(this.$__bundle)\n      }\n    }\n\n    secret = secret || this.getSecret()\n    bundle = bundle || this.getBundle()\n    // For non-USER source wallets (V/B isotopes), capture the current USER\n    // ContinuID position BEFORE overwriting the client's remainder wallet.\n    // This position is needed by addContinuIdAtom() for previousPosition metadata.\n    let continuIdPosition = null\n    if (sourceWallet && sourceWallet.token !== 'USER') {\n      if (this.lastMoleculeQuery &&\n        this.getRemainderWallet() &&\n        this.getRemainderWallet().token === 'USER' &&\n        this.lastMoleculeQuery.response() &&\n        this.lastMoleculeQuery.response().success()\n      ) {\n        // Carry-forward: use last successful USER remainder wallet position\n        continuIdPosition = this.getRemainderWallet().position\n      } else {\n        // Query server for current ContinuID position\n        const userWallet = await this.getSourceWallet()\n        continuIdPosition = userWallet ? userWallet.position : null\n      }\n    }\n\n    // Sets the source wallet as the last remainder wallet (to maintain ContinuID)\n    if (!sourceWallet &&\n      this.lastMoleculeQuery &&\n      this.getRemainderWallet().token === 'USER' &&\n      this.lastMoleculeQuery.response() &&\n      this.lastMoleculeQuery.response().success()\n    ) {\n      sourceWallet = this.getRemainderWallet()\n    }\n\n    // Unable to use last remainder wallet; Figure out what wallet to use:\n    if (sourceWallet === null) {\n      sourceWallet = await this.getSourceWallet()\n    }\n\n    // Set the remainder wallet for the next transaction\n    this.remainderWallet = remainderWallet || Wallet.create({\n      secret,\n      bundle,\n      token: 'USER',\n      batchId: sourceWallet.batchId,\n      characters: sourceWallet.characters,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    return new Molecule({\n      secret,\n      bundle,\n      sourceWallet,\n      remainderWallet: this.getRemainderWallet(),\n      cellSlug: this.getCellSlug(),\n      version: this.getServerSdkVersion(),\n      continuIdPosition,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n  }\n\n  /**\n   * Builds a new instance of the provided Query class\n   *\n   * @param QueryClass\n   * @return {*}\n   */\n  createQuery (QueryClass) {\n    return new QueryClass(this.client(), this)\n  }\n\n  /**\n   * Builds a new instance of the provided Subscription class\n   *\n   * @param SubscribeClass\n   * @return {*}\n   */\n  createSubscribe (SubscribeClass) {\n    return new SubscribeClass(this.subscribe())\n  }\n\n  /**\n   * Uses the supplied Mutation class to build a new tailored Molecule\n   *\n   * @param mutationClass\n   * @param molecule\n   */\n  async createMoleculeMutation ({\n    mutationClass: MutationClass,\n    molecule = null\n  }) {\n    this.log('info', `KnishIOClient::createMoleculeQuery() - Creating a new ${ MutationClass.name } query...`)\n\n    // If you don't supply the molecule, we'll generate one for you\n    const _molecule = molecule || await this.createMolecule({})\n\n    const mutation = new MutationClass(this.client(), this, _molecule)\n\n    if (!(mutation instanceof MutationProposeMolecule)) {\n      throw new CodeException(`${ this.constructor.name }::createMoleculeMutation() - This method only accepts MutationProposeMolecule!`)\n    }\n\n    this.lastMoleculeQuery = mutation\n\n    return mutation\n  }\n\n  /**\n   *\n   * @param query\n   * @param variables\n   * @returns {Promise<*>}\n   */\n  async executeQuery (query, variables = null, context = {}) {\n    // Check and refresh authorization token if needed\n    // Guard with $__authInProcess to prevent concurrent auth requests\n    if (this.$__authToken && this.$__authToken.isExpired() && !this.$__authInProcess) {\n      this.log('info', 'KnishIOClient::executeQuery() - Access token is expired. Getting new one...')\n      const authSecret = this.$__secret || (await this.retrieveSecret()) || ''\n      await this.requestAuthToken({\n        secret: authSecret,\n        cellSlug: this.$__cellSlug,\n        encrypt: this.$__encrypt\n      })\n    }\n\n    // Create a new AbortController for this query\n    const abortController = new AbortController()\n    const queryKey = JSON.stringify({\n      query: query.$__query,\n      variables\n    })\n    this.abortControllers.set(queryKey, abortController)\n\n    try {\n      // Apply the client-level default request policy when neither the caller\n      // nor the query's own createQueryContext specifies one, so a long-lived\n      // server/sync client (defaultRequestPolicy:'network-only') never serves a\n      // stale cache-first read. Precedence: a query's own createQueryContext\n      // (e.g. ContinuId's network-only, applied in Query.execute's merge) >\n      // per-call context.requestPolicy > this client default > urql default.\n      const requestContext = { ...context }\n      if (this.$__defaultRequestPolicy && !requestContext.requestPolicy) {\n        requestContext.requestPolicy = this.$__defaultRequestPolicy\n      }\n\n      // Use the existing query execution method, but add the abort signal\n      const result = await query.execute({\n        variables,\n        context: {\n          fetchOptions: {\n            signal: abortController.signal\n          },\n          ...requestContext\n        }\n      })\n\n      // Remove the AbortController after the query is complete\n      this.abortControllers.delete(queryKey)\n\n      return result\n    } catch (error) {\n      if (error.name === 'AbortError') {\n        this.log('warn', 'Query was cancelled')\n      } else {\n        throw error\n      }\n    }\n  }\n\n  cancelQuery (query, variables = null) {\n    const queryKey = JSON.stringify({\n      query: query.$__query,\n      variables\n    })\n    const controller = this.abortControllers.get(queryKey)\n    if (controller) {\n      controller.abort()\n      this.abortControllers.delete(queryKey)\n    }\n  }\n\n  cancelAllQueries () {\n    for (const controller of this.abortControllers.values()) {\n      controller.abort()\n    }\n    this.abortControllers.clear()\n  }\n\n  /**\n   * Retrieves the balance wallet for a specified Knish.IO identity and token slug\n   *\n   * @param {string} token\n   * @param {string|null} bundle\n   * @param {string} type\n   * @returns {Promise<*>}\n   */\n  async queryBalance ({\n    token,\n    bundle = null,\n    type = 'regular'\n  }) {\n    /**\n     * @type {QueryBalance}\n     */\n    const query = this.createQuery(QueryBalance)\n\n    // Execute query with either the provided bundle hash or the active client's bundle\n    return this.executeQuery(query, {\n      bundleHash: bundle || this.getBundle(),\n      token,\n      type\n    })\n  }\n\n  /**\n   *\n   * @param {string} token\n   * @param {number} amount\n   * @param {string} type\n   * @returns {Promise<{address}|{position}|*>}\n   */\n  async querySourceWallet ({\n    token,\n    amount,\n    type = 'regular'\n  }) {\n    const sourceWallet = (await this.queryBalance({\n      token,\n      type\n    })).payload()\n\n    // Do you have enough tokens?\n    if (sourceWallet === null || Decimal.cmp(sourceWallet.balance, amount) < 0) {\n      throw new TransferBalanceException()\n    }\n\n    // Check shadow wallet\n    if (!sourceWallet.position || !sourceWallet.address) {\n      throw new TransferBalanceException('Source wallet can not be a shadow wallet.')\n    }\n\n    return sourceWallet\n  }\n\n  /**\n   * @param {string|null} bundle\n   * @param {function} closure\n   * @return {Promise<string>}\n   */\n  async subscribeCreateMolecule ({\n    bundle,\n    closure\n  }) {\n    const subscribe = this.createSubscribe(CreateMoleculeSubscribe)\n\n    return await subscribe.execute({\n      variables: {\n        bundle: bundle || this.getBundle()\n      },\n      closure\n    })\n  }\n\n  /**\n   * Creates a subscription for updating Wallet status\n   *\n   * @param {string|null} bundle\n   * @param {string} token\n   * @param {function} closure\n   * @return {string}\n   */\n  subscribeWalletStatus ({\n    bundle,\n    token,\n    closure\n  }) {\n    if (!token) {\n      throw new CodeException(`${ this.constructor.name }::subscribeWalletStatus() - Token parameter is required!`)\n    }\n\n    const subscribe = this.createSubscribe(WalletStatusSubscribe)\n\n    return subscribe.execute({\n      variables: {\n        bundle: bundle || this.getBundle(),\n        token\n      },\n      closure\n    })\n  }\n\n  /**\n   *  Creates a subscription for updating active Wallet\n   *\n   * @param {string|null} bundle\n   * @param {function} closure\n   * @return {string}\n   */\n  subscribeActiveWallet ({\n    bundle,\n    closure\n  }) {\n    const subscribe = this.createSubscribe(ActiveWalletSubscribe)\n\n    return subscribe.execute({\n      variables: {\n        bundle: bundle || this.getBundle()\n      },\n      closure\n    })\n  }\n\n  /**\n   * Creates a subscription for updating list of active sessions for a given MetaType\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {function} closure\n   * @return {*}\n   */\n  subscribeActiveSession ({\n    metaType,\n    metaId,\n    closure\n  }) {\n    const subscribe = this.createSubscribe(ActiveSessionSubscribe)\n\n    return subscribe.execute({\n      variables: {\n        metaType,\n        metaId\n      },\n      closure\n    })\n  }\n\n  /**\n   * Unsubscribes from a given subscription name\n   *\n   * @param {string} operationName\n   */\n  unsubscribe (operationName) {\n    this.subscribe().unsubscribe(operationName)\n  }\n\n  unsubscribeAll () {\n    this.subscribe().unsubscribeAll()\n  }\n\n  /**\n   * Retrieves metadata for the given metaType and provided parameters\n   *\n   * @param {string|array|null} metaType\n   * @param {string|array|null} metaId\n   * @param {string|array|null} key\n   * @param {string|array|null} value\n   * @param {boolean|null} latest\n   * @param {object|null} fields\n   * @param {object|null} filter\n   * @param {object|null} queryArgs\n   * @param {string|null} count\n   * @param {string|null} countBy\n   * @param {boolean} throughAtom\n   * @param {boolean} throughMolecule\n   * @param {array|null} values\n   * @param {array|null} keys\n   * @param {array|null} atomValues\n   * @return {Promise<ResponseMetaType|ResponseMetaTypeViaAtom|ResponseMetaTypeViaMolecule>}\n   */\n  queryMeta ({\n    metaType,\n    metaId = null,\n    key = null,\n    value = null,\n    latest = true,\n    fields = null,\n    filter = null,\n    queryArgs = null,\n    count = null,\n    countBy = null,\n    throughAtom = true,\n    throughMolecule = false,\n    values = null,\n    keys = null,\n    atomValues = null,\n    requestPolicy = null\n  }) {\n    this.log('info', `KnishIOClient::queryMeta() - Querying metaType: ${ metaType }, metaId: ${ metaId }...`)\n\n    let query\n    let variables\n\n    if (throughMolecule) {\n      /**\n       * @type {QueryMetaTypeViaMolecule}\n       */\n      query = this.createQuery(QueryMetaTypeViaMolecule)\n      variables = QueryMetaTypeViaMolecule.createVariables({\n        metaType,\n        metaId,\n        key,\n        value,\n        latest,\n        filter,\n        queryArgs,\n        countBy,\n        values,\n        keys,\n        atomValues,\n        cellSlug: this.getCellSlug()\n      })\n    } else if (throughAtom) {\n      /**\n       * @type {QueryMetaTypeViaAtom}\n       */\n      query = this.createQuery(QueryMetaTypeViaAtom)\n      variables = QueryMetaTypeViaAtom.createVariables({\n        metaType,\n        metaId,\n        key,\n        value,\n        latest,\n        filter,\n        queryArgs,\n        countBy,\n        values,\n        keys,\n        atomValues,\n        cellSlug: this.getCellSlug()\n      })\n    } else {\n      /**\n       * @type {QueryMetaType}\n       */\n      query = this.createQuery(QueryMetaType)\n      variables = QueryMetaType.createVariables({\n        metaType,\n        metaId,\n        key,\n        value,\n        latest,\n        filter,\n        queryArgs,\n        count,\n        countBy,\n        cellSlug: this.getCellSlug()\n      })\n    }\n\n    return this.executeQuery(query, variables, requestPolicy ? { requestPolicy } : {})\n  }\n\n  /**\n   * Queries meta assets and verifies cryptographic integrity of associated molecules.\n   * Returns the same response as queryMeta(), with an additional `integrity` field on the payload\n   * containing verification results for each molecule.\n   *\n   * @param {object} params - Same parameters as queryMeta()\n   * @return {Promise<ResponseMetaType|ResponseMetaTypeViaAtom|ResponseMetaTypeViaMolecule>}\n   */\n  async queryMetaVerified (params) {\n    const response = await this.queryMeta(params)\n    const payload = response.payload()\n    if (payload) {\n      payload.integrity = response.verifyIntegrity()\n    }\n    return response\n  }\n\n  /**\n   * Probes the connected server to check whether it supports a named root query field.\n   * Result is cached per URI so the network round-trip happens at most once per URI.\n   *\n   * Uses GraphQL introspection which is universally supported by spec-compliant servers.\n   *\n   * @param {string} fieldName - The root Query field name to check (e.g. 'embeddingStatus')\n   * @return {Promise<boolean>}\n   */\n  async hasQueryField (fieldName) {\n    const uri = this.getUri()\n    const cacheKey = `${ uri }::${ fieldName }`\n\n    if (typeof this.$__capabilityCache[cacheKey] === 'boolean') {\n      return this.$__capabilityCache[cacheKey]\n    }\n\n    try {\n      const result = await this.$__client.query({\n        query: '{ __schema { queryType { fields { name } } } }',\n        variables: {}\n      })\n\n      const fields = result?.data?.__schema?.queryType?.fields || []\n      const supported = fields.some(f => f.name === fieldName)\n      this.$__capabilityCache[cacheKey] = supported\n      return supported\n    } catch (err) {\n      this.log('warn', `KnishIOClient::hasQueryField() - Capability probe for '${ fieldName }' failed: ${ err.message }`)\n      this.$__capabilityCache[cacheKey] = false\n      return false\n    }\n  }\n\n  /**\n   * Queries embedding status for one or more meta instances (DataBraid observability).\n   *\n   * If the connected server does not support the embeddingStatus query,\n   * returns null without throwing an error (graceful degradation).\n   *\n   * Single mode: queryEmbeddingStatus({ metaType: 'product', metaId: 'SKU-001' })\n   * Bulk mode:   queryEmbeddingStatus({ instances: [{ metaType: 'product', metaId: 'SKU-001' }, ...] })\n   *\n   * @param {string|null} metaType - Metadata type (single-instance mode)\n   * @param {string|null} metaId - Instance identifier (single-instance mode)\n   * @param {Array<{metaType: string, metaId: string}>|null} instances - Bulk mode input\n   * @return {Promise<ResponseEmbeddingStatus|null>} Response with payload(), or null if unsupported\n   */\n  async queryEmbeddingStatus ({\n    metaType = null,\n    metaId = null,\n    instances = null\n  }) {\n    this.log('info', `KnishIOClient::queryEmbeddingStatus() - Checking embedding status for metaType: ${ metaType || '(bulk)' }...`)\n\n    const supported = await this.hasQueryField('embeddingStatus')\n\n    if (!supported) {\n      this.log('warn', 'KnishIOClient::queryEmbeddingStatus() - Server does not support embeddingStatus query. Returning null.')\n      return null\n    }\n\n    const query = this.createQuery(QueryEmbeddingStatus)\n    const variables = QueryEmbeddingStatus.createVariables({ metaType, metaId, instances })\n\n    return this.executeQuery(query, variables)\n  }\n\n  /**\n   * Query batch to get cascading meta instances by batchID\n   *\n   * @param batchId\n   * @return {Promise<*>}\n   */\n  async queryBatch ({\n    batchId\n  }) {\n    this.log('info', `KnishIOClient::queryBatch() - Querying cascading meta instances for batchId: ${ batchId }...`)\n    const query = this.createQuery(QueryBatch)\n    return await this.executeQuery(query, {\n      batchId\n    })\n  }\n\n  /**\n   * Query batch history to get cascading meta instances by batchID\n   *\n   * @param batchId\n   * @return {Promise<*>}\n   */\n  async queryBatchHistory ({\n    batchId\n  }) {\n    this.log('info', `KnishIOClient::queryBatchHistory() - Querying cascading meta instances for batchId: ${ batchId }...`)\n\n    const query = this.createQuery(QueryBatchHistory)\n\n    return await this.executeQuery(query, {\n      batchId\n    })\n  }\n\n  /**\n   * Queries atom instances based on the provided parameters.\n   *\n   * @param {string[]} molecularHashes - Array of multiple molecular hashes.\n   * @param {string} molecularHash - Single molecular hash.\n   * @param {string[]} bundleHashes - Array of multiple bundle hashes.\n   * @param {string} bundleHash - Single bundle hash.\n   * @param {number[]} positions - Array of multiple positions.\n   * @param {number} position - Single position.\n   * @param {string[]} walletAddresses - Array of multiple wallet addresses.\n   * @param {string} walletAddress - Single wallet address.\n   * @param {string[]} isotopes - Array of multiple isotopes.\n   * @param {string} isotope - Single isotope.\n   * @param {string[]} tokenSlugs - Array of multiple token slugs.\n   * @param {string} tokenSlug - Single token slug.\n   * @param {string[]} cellSlugs - Array of multiple cell slugs.\n   * @param {string} cellSlug - Single cell slug.\n   * @param {string[]} batchIds - Array of multiple batch IDs.\n   * @param {string} batchId - Single batch ID.\n   * @param {any[]} values - Array of multiple values.\n   * @param {any} value - Single value.\n   * @param {string[]} metaTypes - Array of multiple meta types.\n   * @param {string} metaType - Single meta type.\n   * @param {string[]} metaIds - Array of multiple meta IDs.\n   * @param {string} metaId - Single meta ID.\n   * @param {string[]} indexes - Array of multiple atom indices.\n   * @param {string} index - Single atom index.\n   * @param {object} filter - The filter object.\n   * @param {boolean} latest - The latest flag.\n   * @param {object} [queryArgs] - The query arguments (limit, offset).\n   * @param {number} [queryArgs.limit=15] - The limit.\n   * @param {number} [queryArgs.offset=1] - The offset.\n   *\n   * @returns {Promise<ResponseAtom>} - A promise that resolves with the queried atom instances.\n   */\n  async queryAtom ({\n    molecularHashes,\n    molecularHash,\n    bundleHashes,\n    bundleHash,\n    positions,\n    position,\n    walletAddresses,\n    walletAddress,\n    isotopes,\n    isotope,\n    tokenSlugs,\n    tokenSlug,\n    cellSlugs,\n    cellSlug,\n    batchIds,\n    batchId,\n    values,\n    value,\n    metaTypes,\n    metaType,\n    metaIds,\n    metaId,\n    indexes,\n    index,\n    filter,\n    latest,\n    queryArgs = {\n      limit: 15,\n      offset: 1\n    }\n  }) {\n    this.log('info', 'KnishIOClient::queryAtom() - Querying atom instances')\n\n    /** @type QueryAtom */\n    const query = this.createQuery(QueryAtom)\n\n    return await this.executeQuery(query, QueryAtom.createVariables({\n      molecularHashes,\n      molecularHash,\n      bundleHashes,\n      bundleHash,\n      positions,\n      position,\n      walletAddresses,\n      walletAddress,\n      isotopes,\n      isotope,\n      tokenSlugs,\n      tokenSlug,\n      cellSlugs,\n      cellSlug,\n      batchIds,\n      batchId,\n      values,\n      value,\n      metaTypes,\n      metaType,\n      metaIds,\n      metaId,\n      indexes,\n      index,\n      filter,\n      latest,\n      queryArgs\n    }))\n  }\n\n  /**\n   * Builds and executes a molecule to issue a new Wallet on the ledger\n   *\n   * @param {string} token - The token slug for the new wallet\n   * @returns {Promise<ResponseCreateWallet>} - A Promise that resolves with the result of the execution.\n   */\n  async createWallet ({\n    token\n  }) {\n    const newWallet = new Wallet({\n      secret: this.getSecret(),\n      token,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    /**\n     * @type {MutationCreateWallet}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationCreateWallet\n    })\n\n    query.fillMolecule(newWallet)\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Queries the ledger to retrieve a list of active sessions for the given MetaType\n   *\n   * @param {string} bundleHash - The hash of the session bundle.\n   * @param {string} metaType - The type of metadata associated with the session.\n   * @param {string} metaId - The ID of the metadata associated with the session.\n   * @returns {Promise<ResponseQueryActiveSession>} - Returns a promise containing the result of the query.\n   */\n  async queryActiveSession ({\n    bundleHash,\n    metaType,\n    metaId\n  }) {\n    const query = this.createQuery(QueryActiveSession)\n\n    return await this.executeQuery(query, {\n      bundleHash,\n      metaType,\n      metaId\n    })\n  }\n\n  /**\n   * Builds and executes a molecule to declare an active session for the given MetaType\n   *\n   * @param {Object} options - The options for activating a session.\n   * @param {string} options.bundle - The bundle hash.\n   * @param {string} options.metaType - The meta type.\n   * @param {string} options.metaId - The meta ID.\n   * @param {string} options.ipAddress - The client's IP address.\n   * @param {string} options.browser - The client's browser.\n   * @param {string} options.osCpu - The client's operating system and CPU.\n   * @param {string} options.resolution - The client's screen resolution.\n   * @param {string} options.timeZone - The client's time zone.\n   * @param {Object} [options.json={}] - Additional JSON data.\n   * @returns {Promise<ResponseActiveSession>} A promise that resolves with the result of the activation.\n   */\n  async activeSession ({\n    bundle,\n    metaType,\n    metaId,\n    ipAddress,\n    browser,\n    osCpu,\n    resolution,\n    timeZone,\n    json = {}\n  }) {\n    const query = this.createQuery(MutationActiveSession)\n\n    return await this.executeQuery(query, {\n      bundleHash: bundle,\n      metaType,\n      metaId,\n      ipAddress,\n      browser,\n      osCpu,\n      resolution,\n      timeZone,\n      json: JSON.stringify(json)\n    })\n  }\n\n  /**\n   * Creates a new token with the given parameters.\n   *\n   * @param {object} options - The options for creating the token.\n   * @param {string} options.token - The token identifier.\n   * @param {number} [options.amount] - The amount of tokens to create.\n   * @param {object} [options.meta] - Additional metadata for the token.\n   * @param {string} [options.batchId] - The batch identifier for stackable tokens.\n   * @param {array} [options.units] - The unit IDs for the token.\n   *\n   * @throws {StackableUnitDecimalsException} If a stackable token has decimals.\n   * @throws {StackableUnitAmountException} If stackable units are provided with an amount.\n   *\n   * @returns {Promise<ResponseCreateToken>} A Promise that resolves to the result of creating the token.\n   */\n  async createToken ({\n    token,\n    amount = null,\n    meta = null,\n    batchId = null,\n    units = []\n  }) {\n    // What is the fungibility mode for this token?\n    const fungibility = Dot.get(meta || {}, 'fungibility')\n\n    // For stackable token - create a batch ID\n    if (fungibility === 'stackable') {\n      meta.batchId = batchId || generateBatchId({})\n    }\n\n    // Special logic for token unit initialization (nonfungible || stackable)\n    if (['nonfungible', 'stackable'].includes(fungibility) && units.length > 0) {\n      // Stackable tokens with Unit IDs must not use decimals\n      if (Dot.get(meta || {}, 'decimals') > 0) {\n        throw new StackableUnitDecimalsException()\n      }\n\n      // Can't create stackable units AND provide amount\n      if (amount > 0) {\n        throw new StackableUnitAmountException()\n      }\n\n      // Calculating amount based on Unit IDs\n      amount = units.length\n      meta.splittable = 1\n      meta.decimals = 0\n      meta.tokenUnits = JSON.stringify(units)\n    }\n\n    // Creating the wallet that will receive the new tokens\n    const recipientWallet = new Wallet({\n      secret: this.getSecret(),\n      bundle: this.getBundle(),\n      token,\n      batchId,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    /**\n     * @type {MutationCreateToken}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationCreateToken\n    })\n\n    query.fillMolecule({\n      recipientWallet,\n      amount,\n      meta: meta || {}\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Creates a new rule with the specified parameters.\n   *\n   * @param {string} metaType - The type of the metadata associated with the rule.\n   * @param {string} metaId - The ID of the metadata associated with the rule.\n   * @param {object} rule - The rule object.\n   * @param {object} [policy={}] - The policy object. (optional)\n   * @returns {Promise<ResponseCreateRule>} - A promise that resolves to the created rule.\n   */\n  async createRule ({\n    metaType,\n    metaId,\n    rule,\n    policy = {}\n  }) {\n    /**\n     * @type {MutationCreateRule}\n     */\n    const query = await this.createMoleculeMutation({\n        mutationClass: MutationCreateRule,\n        molecule: await this.createMolecule({\n          secret: this.getSecret()\n        })\n      }\n    )\n\n    query.fillMolecule({\n      metaType,\n      metaId,\n      rule,\n      policy\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to convey new metadata to the ledger\n   *\n   * @param {string} metaType - The type of the metadata entry.\n   * @param {string} metaId - The ID of the metadata entry.\n   * @param {object|array} meta - The metadata object.\n   * @param {object} [policy={}] - The policy object.\n   * @returns {Promise<ResponseCreateMeta>} - A Promise that resolves with the created metadata entry.\n   */\n  async createMeta ({\n    metaType,\n    metaId,\n    meta = null,\n    policy = {}\n  }) {\n    /**\n     * @type {MutationCreateMeta}\n     */\n    const query = await this.createMoleculeMutation({\n        mutationClass: MutationCreateMeta,\n        molecule: await this.createMolecule({\n          secret: this.getSecret()\n        })\n      }\n    )\n\n    const metas = meta || {}\n\n    query.fillMolecule({\n      metaType,\n      metaId,\n      meta: metas,\n      policy\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to register a peer node via P-isotope\n   *\n   * @param {string} host - The peer host URL to register\n   * @returns {Promise<ResponsePeering>} - A Promise that resolves with the peering response.\n   */\n  async registerPeer ({\n    host\n  }) {\n    /**\n     * @type {MutationPeering}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationPeering,\n      molecule: await this.createMolecule({\n        secret: this.getSecret()\n      })\n    })\n\n    query.fillMolecule({\n      host\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to submit an append request via A-isotope\n   *\n   * @param {string} metaType - The target MetaType to append to\n   * @param {string} metaId - The target MetaId to append to\n   * @param {string} action - The action to perform\n   * @param {object} [meta={}] - Additional metadata\n   * @returns {Promise<ResponseAppendRequest>} - A Promise that resolves with the append request response.\n   */\n  async appendRequest ({\n    metaType,\n    metaId,\n    action,\n    meta = {}\n  }) {\n    /**\n     * @type {MutationAppendRequest}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationAppendRequest,\n      molecule: await this.createMolecule({\n        secret: this.getSecret()\n      })\n    })\n\n    query.fillMolecule({\n      metaType,\n      metaId,\n      action,\n      meta\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to create a new identifier on the ledger\n   *\n   * @param {string} type - The type of the identifier.\n   * @param {string} contact - The contact associated with the identifier.\n   * @param {string} code - The code for the identifier.\n   * @returns {Promise<ResponseCreateIdentifier>} - A promise that resolves to the created identifier.\n   */\n  async createIdentifier ({\n    type,\n    contact,\n    code\n  }) {\n    /**\n     * @type {MutationCreateIdentifier}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationCreateIdentifier\n    })\n\n    query.fillMolecule({\n      type,\n      contact,\n      code\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Links an identifier to the current wallet bundle\n   *\n   * @param {string} type - The type of the identifier.\n   * @param {string} contact - The contact associated with the identifier.\n   * @returns {Promise<ResponseLinkIdentifier>} - A promise that resolves to the link result.\n   */\n  async linkIdentifier ({\n    type,\n    contact\n  }) {\n    const query = this.createQuery(MutationLinkIdentifier)\n    return await this.executeQuery(query, {\n      bundle: this.getBundle(),\n      type,\n      content: contact\n    })\n  }\n\n  /**\n   * Creates a policy for a given metaType and metaId.\n   *\n   * @param {Object} options - The options for creating the policy.\n   * @param {string} options.metaType - The type of the meta.\n   * @param {string} options.metaId - The ID of the meta.\n   * @param {Object} [options.policy={}] - The policy object.\n   * @returns {Promise<*>} - A promise that resolves with the result of the execution.\n   */\n  async createPolicy ({\n    metaType,\n    metaId,\n    policy = {}\n  }) {\n    // Create a molecule. F-3 (E2E gauntlet 2026-06-02): the ContinuID-rejection bug\n    // here was NOT this construction — it was molecule.addPolicyAtom() signing the\n    // R-isotope atom from a fresh random wallet (now fixed in Molecule.addPolicyAtom\n    // to use this.sourceWallet). A policy is a policy-only R-atom (no rules), so this\n    // path is kept as-is: routing through createRule with an empty rule list would\n    // fail the SDK's own `Check::isotopeR() - No rules!` validation.\n    const molecule = await this.createMolecule({})\n    molecule.addPolicyAtom({\n      metaType,\n      metaId,\n      meta: {},\n      policy\n    })\n    molecule.addContinuIdAtom()\n    molecule.sign({\n      bundle: this.getBundle()\n    })\n    molecule.check()\n\n    // Create & execute a mutation\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationProposeMolecule,\n      molecule\n    })\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Queries the policy based on the provided metaType and metaId.\n   *\n   * @param {string} metaType - The type of the meta.\n   * @param {string} metaId - The ID of the meta.\n   * @returns {Promise<ResponsePolicy>} - A Promise that resolves to the query result.\n   */\n  async queryPolicy ({\n    metaType,\n    metaId\n  }) {\n    const query = this.createQuery(QueryPolicy)\n    return await this.executeQuery(query, {\n      metaType,\n      metaId\n    })\n  }\n\n  /**\n   * Queries wallets based on the provided parameters.\n   *\n   * @param {object} options - The options for querying wallets.\n   * @param {string|null} options.bundle - The bundle to query wallets for.\n   * @param {string|null} options.token - The token to query wallets for.\n   * @param {boolean} [options.unspent=true] - Whether to include unspent wallets or not.\n   *\n   * @returns {Promise<ResponseWalletList>} - A promise that resolves to the response payload of the query.\n   */\n  queryWallets ({\n    bundle = null,\n    token = null,\n    unspent = true\n  }) {\n    this.log('info', `KnishIOClient::queryWallets() - Querying wallets${ bundle ? ` for ${ bundle }` : '' }...`)\n\n    /**\n     * @type {QueryWalletList}\n     */\n    const walletQuery = this.createQuery(QueryWalletList)\n\n    return this.executeQuery(walletQuery, {\n      bundleHash: bundle || this.getBundle(),\n      token,\n      unspent\n    })\n      .then((response) => {\n        return response.payload()\n      })\n  }\n\n  /**\n   * Queries wallet bundle metadata.\n   *\n   * @param {Object} options - The options for the query.\n   * @param {string|null} options.bundle - The bundle to query. Default is null.\n   * @param {string|null} options.fields - The fields to retrieve. Default is null.\n   * @param {boolean} options.raw - Whether to return the raw response or the payload. Default is false.\n   * @returns {Promise<ResponseWalletBundle|{}|null>} - A promise that resolves to the response or payload.\n   */\n  queryBundle ({\n    bundle = null,\n    fields = null,\n    raw = false\n  }) {\n    this.log('info', `KnishIOClient::queryBundle() - Querying wallet bundle metadata${ bundle ? ` for ${ bundle }` : '' }...`)\n\n    // Bundle default init & to array convertion\n    if (!bundle) {\n      bundle = this.getBundle()\n    }\n    if (typeof bundle === 'string') {\n      bundle = [bundle]\n    }\n\n    /**\n     * @type {QueryWalletBundle}\n     */\n    const query = this.createQuery(QueryWalletBundle)\n    return this.executeQuery(query, { bundleHashes: bundle })\n      .then((/** ResponseWalletBundle */ response) => {\n        return raw ? response : response.payload()\n      })\n  }\n\n  /**\n   * Queries the ledger for the next ContinuId wallet\n   *\n   * @param {String} bundle - The bundle hash used in the query.\n   * @returns {Promise<ResponseContinuId>} - A promise that resolves to the result of the query.\n   */\n  async queryContinuId ({\n    bundle\n  }) {\n    /**\n     * @type {QueryContinuId}\n     */\n    const query = this.createQuery(QueryContinuId)\n\n    return this.executeQuery(query, {\n      bundle\n    })\n  }\n\n  /**\n   * Requests tokens for a specific recipient or for the current wallet bundle.\n   *\n   * @param {Object} options - The options for the token request.\n   * @param {string} options.token - The token slug.\n   * @param {string|Wallet} [options.to] - The recipient of the tokens. If not provided, tokens will be requested for the current wallet bundle.\n   * @param {number|null} [options.amount=null] - The amount of tokens to request. If not provided and `options.units` are provided, the amount will be calculated based on the number of\n   * units.\n   * @param {Array} [options.units=[]] - The array of unit IDs. If provided, the amount will be calculated based on the length of `options.units`.\n   * @param {Object|null} [options.meta=null] - Additional metadata for the token request.\n   * @param {string|null} [options.batchId=null] - The batch ID for the token request. If not provided and the token is stackable, a new batch ID will be generated.\n   *\n   * @returns {Promise<ResponseRequestTokens>} - A promise that resolves with the response from the token request.\n   *\n   * @throws {BatchIdException} - When a non-stackable token is used and `options.batchId` is not null.\n   * @throws {StackableUnitAmountException} - When both `options.units` and `options.amount` are provided for stackable tokens.\n   */\n  async requestTokens ({\n    token,\n    to,\n    amount = null,\n    units = [],\n    meta = null,\n    batchId = null\n  }) {\n    let metaType,\n      metaId\n\n    meta = meta || {}\n\n    // Get a token & init is Stackable flag for batch ID initialization\n    const queryToken = this.createQuery(QueryToken)\n    const tokenResponse = await this.executeQuery(queryToken, {\n      slug: token\n    })\n    const isStackable = Dot.get(tokenResponse.data(), '0.fungibility') === 'stackable'\n\n    // NON-stackable tokens & batch ID is NOT NULL - error\n    if (!isStackable && batchId !== null) {\n      throw new BatchIdException('Expected Batch ID = null for non-stackable tokens.')\n    }\n    // Stackable tokens & batch ID is NULL - generate new one\n    if (isStackable && batchId === null) {\n      batchId = generateBatchId({})\n    }\n\n    // Calculate amount & set meta key\n    if (units.length > 0) {\n      // Can't move stackable units AND provide amount\n      if (amount > 0) {\n        throw new StackableUnitAmountException()\n      }\n\n      // Calculating amount based on Unit IDs\n      amount = units.length\n      meta.tokenUnits = JSON.stringify(units)\n    }\n\n    // Are we specifying a specific recipient?\n    if (to) {\n      // If the recipient is provided as an object, try to figure out the actual recipient\n      if (Object.prototype.toString.call(to) === '[object String]') {\n        if (Wallet.isBundleHash(to)) {\n          metaType = 'walletBundle'\n          metaId = to\n        } else {\n          to = Wallet.create({\n            secret: to,\n            token,\n            mlKemParameterSet: this.getMlKemParameterSet()\n          })\n        }\n      }\n\n      // If recipient is a Wallet, we need to help the node triangulate\n      // the transfer by providing position and bundle hash\n      if (to instanceof Wallet) {\n        metaType = 'wallet'\n        meta.position = to.position\n        meta.bundle = to.bundle\n        metaId = to.address\n      }\n    } else {\n      // No recipient, so request tokens for ourselves\n      metaType = 'walletBundle'\n      metaId = this.getBundle()\n    }\n\n    /**\n     * @type {MutationRequestTokens}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationRequestTokens\n    })\n\n    query.fillMolecule({\n      token,\n      amount,\n      metaType,\n      metaId,\n      meta,\n      batchId\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Claims a shadow wallet for a given token.\n   *\n   * @param {string} token - The token for which to claim the shadow wallet.\n   * @param {string|null} batchId - The batch ID of the shadow wallet (optional).\n   * @param {string|null} molecule - The molecule associated with the shadow wallet (optional).\n   *\n   * @returns {Promise<ResponseClaimShadowWallet>} - A promise that resolves to the result of the claim operation.\n   */\n  async claimShadowWallet ({\n    token,\n    batchId = null,\n    molecule = null\n  }) {\n    /**\n     * @type {MutationClaimShadowWallet}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationClaimShadowWallet,\n      molecule\n    })\n\n    query.fillMolecule({\n      token,\n      batchId\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Claims all shadow wallets for a given token.\n   *\n   * @param {Object} options - The options for claiming shadow wallets.\n   * @param {string} options.token - The token to claim shadow wallets for.\n   * @returns {Promise<*>} - A promise that resolves to an array of responses from claiming shadow wallets.\n   * @throws {WalletShadowException} - If the shadow wallet list is invalid or if a non-shadow wallet is found.\n   */\n  async claimShadowWallets ({\n    token\n  }) {\n    // --- Get & check a shadow wallet list\n    const shadowWallets = await this.queryWallets({ token })\n    if (!shadowWallets || !Array.isArray(shadowWallets)) {\n      throw new WalletShadowException()\n    }\n\n    shadowWallets.forEach(shadowWallet => {\n      if (!shadowWallet.isShadow()) {\n        throw new WalletShadowException()\n      }\n    })\n    // ----\n\n    const responses = []\n    for (const shadowWallet of shadowWallets) {\n      responses.push(await this.claimShadowWallet({\n        token,\n        batchId: shadowWallet.batchId\n      }))\n    }\n    return responses\n  }\n\n  /**\n   * Transfers tokens from one wallet to another.\n   *\n   * @param {Object} options - The transfer options.\n   * @param {string} options.bundleHash - The bundle hash of the source wallet.\n   * @param {string} options.token - The token to transfer.\n   * @param {number} [options.amount=null] - The amount of tokens to transfer. Not required if units are provided.\n   * @param {Array} [options.units=[]] - An array of units to transfer. Overrides the amount if provided.\n   * @param {string} [options.batchId=null] - The batch ID for the recipient wallet.\n   * @param {Object} [options.sourceWallet=null] - The source wallet object. If not provided, it will be queried.\n   *\n   * @returns {Promise} - A Promise that resolves to the transaction result.\n   *\n   * @throws {StackableUnitAmountException} - If both amount and units are provided.\n   * @throws {TransferBalanceException} - If the source wallet does not have enough balance.\n   */\n  async transferToken ({\n    bundleHash,\n    token,\n    amount = null,\n    units = [],\n    batchId = null,\n    sourceWallet = null\n  }) {\n    // Calculate amount & set meta key\n    if (units.length > 0) {\n      // Can't move stackable units AND provide amount\n      if (amount > 0) {\n        throw new StackableUnitAmountException()\n      }\n\n      amount = units.length\n    }\n\n    // Get a source wallet\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token,\n        amount\n      })\n    }\n\n    // Do you have enough tokens?\n    if (sourceWallet === null || Decimal.cmp(sourceWallet.balance, amount) < 0) {\n      throw new TransferBalanceException()\n    }\n\n    // Attempt to get the recipient's wallet, if not provided\n    const recipientWallet = Wallet.create({\n      bundle: bundleHash,\n      token,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    // Compute the batch ID for the recipient\n    // (typically used by stackable tokens)\n    if (batchId !== null) {\n      recipientWallet.batchId = batchId\n    } else {\n      recipientWallet.initBatchId({\n        sourceWallet\n      })\n    }\n\n    // Create a remainder from the source wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // --- Token units splitting\n    sourceWallet.splitUnits(\n      units,\n      remainderWallet,\n      recipientWallet\n    )\n    // ---\n\n    // Build the molecule itself\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    /**\n     * @type {MutationTransferTokens}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationTransferTokens,\n      molecule\n    })\n\n    query.fillMolecule({\n      recipientWallet,\n      amount\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Transfers tokens from one source wallet to MULTIPLE recipients in a single molecule.\n   *\n   * One molecule funds N recipients (WP line 544: \"utilizing the sender's Wallet to fund multiple\n   * recipients with one transaction\"). Each recipient receives its own amount and, for stackable\n   * tokens, its own subset of token units. The source is fully drained and the unsent change\n   * returns via the remainder atom (UTXO), so the V-atoms conserve. Single-recipient transfers\n   * should keep using transferToken(); this is its N-recipient generalization.\n   *\n   * @param {Object} options - The transfer options.\n   * @param {string} options.token - The token to transfer.\n   * @param {Array} options.recipients - [{ bundleHash, amount?, units?, batchId? }] per recipient.\n   * @param {Object} [options.sourceWallet=null] - The source wallet; queried if not provided.\n   *\n   * @returns {Promise} - A Promise that resolves to the transaction result.\n   *\n   * @throws {StackableUnitAmountException} - If a recipient provides both amount and units.\n   * @throws {TransferBalanceException} - If the source wallet does not have enough balance.\n   */\n  async transferTokens ({\n    token,\n    recipients,\n    sourceWallet = null\n  }) {\n    // Per-recipient amount: units.length for stackable, else the explicit amount\n    const amounts = recipients.map(recipient => {\n      const units = recipient.units || []\n      if (units.length > 0) {\n        // Can't move stackable units AND provide amount\n        if (recipient.amount > 0) {\n          throw new StackableUnitAmountException()\n        }\n        return units.length\n      }\n      return recipient.amount || 0\n    })\n    const total = amounts.reduce((sum, value) => sum + value, 0)\n\n    // Get a source wallet (loads its token units)\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token,\n        amount: total\n      })\n    }\n\n    // Do you have enough tokens?\n    if (sourceWallet === null || Decimal.cmp(sourceWallet.balance, total) < 0) {\n      throw new TransferBalanceException()\n    }\n\n    // Build a shadow recipient wallet per recipient, each with its own batch ID\n    const recipientWallets = recipients.map(recipient => {\n      const recipientWallet = Wallet.create({\n        bundle: recipient.bundleHash,\n        token,\n        mlKemParameterSet: this.getMlKemParameterSet()\n      })\n\n      // Compute the batch ID for the recipient (typically used by stackable tokens)\n      if (recipient.batchId !== undefined && recipient.batchId !== null) {\n        recipientWallet.batchId = recipient.batchId\n      } else {\n        recipientWallet.initBatchId({\n          sourceWallet\n        })\n      }\n\n      return recipientWallet\n    })\n\n    // Create a remainder from the source wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // --- Token units splitting (N-way): source keeps the union, each recipient its subset,\n    //     remainder the kept units\n    sourceWallet.splitUnitsMulti(\n      recipients.map(recipient => recipient.units || []),\n      recipientWallets,\n      remainderWallet\n    )\n    // ---\n\n    // Build the molecule itself\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    /**\n     * @type {MutationTransferTokens}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationTransferTokens,\n      molecule\n    })\n\n    query.fillMoleculeMulti({\n      recipientWallets,\n      amounts\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Deposits buffer token into the source wallet.\n   *\n   * @param {Object} options - The options for depositing buffer token.\n   * @param {string} options.tokenSlug - The slug of the token to deposit.\n   * @param {number} options.amount - The amount of token to deposit.\n   * @param {Object} options.tradeRates - The trade rates for the deposit.\n   * @param {Wallet|null} options.sourceWallet - The source wallet for the deposit. If not provided, a source wallet will be queried.\n   *\n   * @returns {Promise<*>} - A promise that resolves with the result of the deposit.\n   */\n  async depositBufferToken ({\n    tokenSlug,\n    amount,\n    tradeRates,\n    sourceWallet = null\n  }) {\n    // Get a source wallet\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token: tokenSlug,\n        amount\n      })\n    }\n\n    // Remainder wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // Build the molecule itself\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    /**\n     * @type {MutationDepositBufferToken}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationDepositBufferToken,\n      molecule\n    })\n    query.fillMolecule({\n      amount,\n      tradeRates\n    })\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Withdraws buffer tokens.\n   *\n   * @param {Object} options - The options for withdrawing buffer tokens.\n   * @param {string} options.tokenSlug - The token slug.\n   * @param {number} options.amount - The amount of tokens to withdraw.\n   * @param {Object} [options.sourceWallet=null] - The source wallet to withdraw tokens from. If not provided, a source wallet will be queried.\n   * @param {Object} [options.signingWallet=null] - The signing wallet to use for the transaction.\n   * @returns {Promise<Object>} A promise that resolves to the result of the withdrawal transaction.\n   */\n  async withdrawBufferToken ({\n    tokenSlug,\n    amount,\n    sourceWallet = null,\n    signingWallet = null\n  }) {\n    // Get a source wallet\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token: tokenSlug,\n        amount,\n        type: 'buffer'\n      })\n    }\n\n    // Remainder wallet\n    const remainderWallet = sourceWallet\n\n    // Build the molecule itself\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    /**\n     * @type {MutationWithdrawBufferToken}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationWithdrawBufferToken,\n      molecule\n    })\n    const recipients = {}\n    recipients[this.getBundle()] = amount\n    query.fillMolecule({\n      recipients,\n      signingWallet\n    })\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to destroy the specified Token units\n   *\n   * @param {string} token\n   * @param {number|null} amount\n   * @param {array|null} units\n   * @param {Wallet|null} sourceWallet\n   * @return {Promise<unknown>}\n   */\n  async burnTokens ({\n    token,\n    amount = null,\n    units = [],\n    sourceWallet = null\n  }) {\n    // Get a source wallet\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token,\n        amount\n      })\n    }\n\n    // Remainder wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // Calculate amount & set meta key\n    if (units.length > 0) {\n      // Can't burn stackable units AND provide amount\n      if (amount > 0) {\n        throw new StackableUnitAmountException()\n      }\n\n      // Calculating amount based on Unit IDs\n      amount = units.length\n\n      // --- Token units splitting\n      sourceWallet.splitUnits(\n        units,\n        remainderWallet\n      )\n      // ---\n    }\n\n    // Create a molecule\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    molecule.burnToken({ amount })\n    molecule.sign({\n      bundle: this.getBundle()\n    })\n    molecule.check(sourceWallet)\n\n    // Create & execute a mutation\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationProposeMolecule,\n      molecule\n    })\n    return this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to destroy the specified Token units\n   *\n   * @param {string} token\n   * @param {number|null} amount\n   * @param {array|null} units\n   * @param {Wallet|null} sourceWallet\n   * @return {Promise<unknown>}\n   */\n  async replenishToken ({\n    token,\n    amount = null,\n    units = [],\n    sourceWallet = null\n  }) {\n    if (sourceWallet === null) {\n      sourceWallet = (await this.queryBalance({ token })).payload()\n    }\n    if (!sourceWallet) {\n      throw new TransferBalanceException('Source wallet is missing or invalid.')\n    }\n\n    // Remainder wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // Create a molecule\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    molecule.replenishToken({\n      amount,\n      units\n    })\n    molecule.sign({\n      bundle: this.getBundle()\n    })\n    molecule.check()\n\n    // Create & execute a mutation\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationProposeMolecule,\n      molecule\n    })\n    return this.executeQuery(query)\n  }\n\n  /**\n   *\n   * @param bundleHash\n   * @param tokenSlug\n   * @param newTokenUnit\n   * @param fusedTokenUnitIds\n   * @param sourceWallet\n   * @returns {Promise<*>}\n   */\n  async fuseToken ({\n    bundleHash,\n    tokenSlug,\n    newTokenUnit,\n    fusedTokenUnitIds,\n    sourceWallet = null\n  }) {\n    if (sourceWallet === null) {\n      sourceWallet = (await this.queryBalance({ token: tokenSlug })).payload()\n    }\n\n    // Check source wallet\n    if (sourceWallet === null) {\n      throw new TransferBalanceException('Source wallet is missing or invalid.')\n    }\n    if (!sourceWallet.tokenUnits || !sourceWallet.tokenUnits.length) {\n      throw new TransferBalanceException('Source wallet does not have token units.')\n    }\n    if (!fusedTokenUnitIds.length) {\n      throw new TransferBalanceException('Fused token unit list is empty.')\n    }\n\n    // Check fused token units\n    const sourceTokenUnitIds = []\n    sourceWallet.tokenUnits.forEach((tokenUnit) => {\n      sourceTokenUnitIds.push(tokenUnit.id)\n    })\n    fusedTokenUnitIds.forEach((tokenUnitId) => {\n      if (!sourceTokenUnitIds.includes(tokenUnitId)) {\n        throw new TransferBalanceException(`Fused token unit ID = ${ tokenUnitId } does not found in the source wallet.`)\n      }\n    })\n\n    // Generate new recipient wallet if only recipient secret has been passed\n    const recipientWallet = Wallet.create({\n      bundle: bundleHash,\n      token: tokenSlug,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    // Set batch ID\n    recipientWallet.initBatchId({ sourceWallet })\n\n    // Remainder wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // Split token units (fused)\n    sourceWallet.splitUnits(fusedTokenUnitIds, remainderWallet)\n\n    // Coerce string newTokenUnit to TokenUnit object\n    if (typeof newTokenUnit === 'string') {\n      newTokenUnit = new TokenUnit(newTokenUnit, newTokenUnit, {})\n    }\n\n    // Set recipient new fused token unit\n    newTokenUnit.metas.fusedTokenUnits = sourceWallet.getTokenUnitsData()\n    recipientWallet.tokenUnits = [newTokenUnit]\n\n    // Create a molecule\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    molecule.fuseToken(sourceWallet.tokenUnits, recipientWallet)\n    molecule.sign({\n      bundle: this.getBundle()\n    })\n    molecule.check()\n\n    // Create & execute a mutation\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationProposeMolecule,\n      molecule\n    })\n    return this.executeQuery(query)\n  }\n\n  /**\n   * Requests a guest authentication token using the fingerprint of the user.\n   * @param {Object} options - The options for the guest authentication token request.\n   * @param {string} options.cellSlug - The slug of the cell to request the token for.\n   * @param {boolean} options.encrypt - Indicates whether the session should be encrypted.\n   * @returns {Promise<ResponseRequestAuthorizationGuest>} - A promise that resolves to the response of the guest authentication token request.\n   */\n  async requestGuestAuthToken ({\n    cellSlug,\n    encrypt\n  }) {\n    this.setCellSlug(cellSlug)\n\n    // Create a wallet for encryption\n    const wallet = new Wallet({\n      secret: generateSecret(await this.getFingerprint()),\n      token: 'AUTH',\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    /**\n     * @type {MutationRequestAuthorizationGuest}\n     */\n    const query = await this.createQuery(MutationRequestAuthorizationGuest)\n\n    const variables = {\n      cellSlug,\n      pubkey: wallet.pubkey,\n      encrypt\n    }\n\n    /**\n     * @type {ResponseRequestAuthorizationGuest}\n     */\n    const response = await query.execute({ variables })\n\n    // Did the authorization molecule get accepted?\n    if (response.success()) {\n      // Create & set an auth token from the response data\n      // Map server payload field names (time/key) to AuthToken constructor names (expiresAt/pubkey)\n      const authToken = AuthToken.create({\n        token: response.token(),\n        expiresAt: response.expiresAt(),\n        pubkey: response.pubKey(),\n        encrypt: response.encrypt()\n      }, wallet)\n      this.setAuthToken(authToken)\n    } else {\n      throw new AuthorizationRejectedException(`KnishIOClient::requestGuestAuthToken() - Authorization attempt rejected by ledger. Reason: ${ response.reason() }`)\n    }\n\n    return response\n  }\n\n  /**\n   * Request a profile auth token\n   *\n   * @param secret\n   * @param encrypt\n   * @returns {Promise<ResponseRequestAuthorization>}\n   */\n  async requestProfileAuthToken ({\n    secret,\n    encrypt\n  }) {\n    this.setSecret(secret)\n\n    // Generate a signing wallet\n    const wallet = new Wallet({\n      secret,\n      token: 'AUTH',\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    // Create a wallet with a signing wallet\n    const molecule = await this.createMolecule({\n      secret,\n      sourceWallet: wallet\n    })\n\n    /**\n     * @type {MutationRequestAuthorization}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationRequestAuthorization,\n      molecule\n    })\n\n    // PQ-transport Phase E (cycle 163): convey the AUTH source wallet's ML-KEM public key as a\n    // SIGNED `walletPubkey` meta on the U-atom (fillMolecule → initAuthorization → sign), so the\n    // validator can encrypt CipherHash responses back to THIS wallet (the one that decrypts them).\n    // Signed → tamper-proof. Only when present (PQ-capable wallet).\n    const authMeta = { encrypt: (encrypt ? 'true' : 'false') }\n    if (wallet.pubkey) {\n      authMeta.walletPubkey = wallet.pubkey\n    }\n    query.fillMolecule({ meta: authMeta })\n    /**\n     * @type {ResponseRequestAuthorization}\n     */\n    const response = await query.execute({})\n\n    // Did the authorization molecule get accepted?\n    if (response.success()) {\n      // Create & set an auth token from the response data\n      // Map server payload field names (time/key) to AuthToken constructor names (expiresAt/pubkey)\n      const authToken = AuthToken.create({\n        token: response.token(),\n        expiresAt: response.expiresAt(),\n        pubkey: response.pubKey(),\n        encrypt: response.encrypt()\n      }, wallet)\n      this.setAuthToken(authToken)\n    } else {\n      throw new AuthorizationRejectedException(`KnishIOClient::requestProfileAuthToken() - Authorization attempt rejected by ledger. Reason: ${ response.reason() }`)\n    }\n\n    return response\n  }\n\n  /**\n   * Request an auth token (guest or profile)\n   *\n   * @param secret\n   * @param seed\n   * @param cellSlug\n   * @param encrypt\n   * @returns {Promise<ResponseRequestAuthorizationGuest|ResponseRequestAuthorization|null>}\n   */\n  async requestAuthToken ({\n    secret = null,\n    seed = null,\n    cellSlug = null,\n    encrypt = false\n  }) {\n    // SDK versions 2 and below do not utilize an authorization token\n    if (this.$__serverSdkVersion < 3) {\n      this.log('warn', 'KnishIOClient::authorize() - Server SDK version does not require an authorization...')\n      return null\n    }\n\n    // Generate a secret from the seed if it has been passed\n    if (secret === null && seed) {\n      secret = generateSecret(seed)\n    }\n\n    // Set cell slug if it has been passed\n    if (cellSlug) {\n      this.setCellSlug(cellSlug)\n    }\n\n    // Retrieve secret from storage provider if available\n    if (secret === null && this.$__secretStorage && this.$__bundle) {\n      secret = await this.$__secretStorage.retrieveSecret(this.$__bundle)\n    }\n\n    // Auth in process...\n    this.$__authInProcess = true\n\n    // Auth token response\n    let response\n\n    // Authorized user\n    if (secret) {\n      response = await this.requestProfileAuthToken({\n        secret,\n        encrypt\n      })\n    } else {\n      // Guest\n      response = await this.requestGuestAuthToken({\n        cellSlug,\n        encrypt\n      })\n    }\n\n    // Set auth token\n    this.log('info', `KnishIOClient::authorize() - Successfully retrieved auth token ${ this.$__authToken.getToken() }...`)\n\n    // Switch encryption mode if it has been changed\n    this.switchEncryption(encrypt)\n\n    // Auth process is stopped\n    this.$__authInProcess = false\n\n    // Return full response\n    return response\n  }\n\n  /**\n   * Sets the auth token\n   *\n   * @param {AuthToken} authToken\n   */\n  setAuthToken (authToken) {\n    // An empty auth token\n    if (!authToken) {\n      this.log('info', 'KnishIOClient::setAuthToken() - authToken object is empty.')\n      return\n    }\n\n    // Save auth token object to global list\n    this.$__authTokenObjects[this.getUri()] = authToken\n\n    // Set auth data to GraphQL client\n    this.client().setAuthData(authToken.getAuthData())\n\n    // Save a full auth token object with expireAt key\n    this.$__authToken = authToken\n  }\n\n  /**\n   * Returns the current authorization token\n   *\n   * @return {AuthToken}\n   */\n  getAuthToken () {\n    return this.$__authToken\n  }\n\n  /**\n   * Writes the specified message to the console.\n   * @param {string} level\n   * @param {string} message\n   */\n  log (level, message) {\n    if (this.$__logging) {\n      switch (level) {\n        case 'info':\n          console.info(message)\n          break\n        case 'warn':\n          console.warn(message)\n          break\n        case 'error':\n          console.error(message)\n          break\n        default:\n          console.log(message)\n      }\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\nimport Dot from '../libraries/Dot.js'\nimport InvalidResponseException from '../exception/InvalidResponseException.js'\n\n/**\n * Response for Guest Authorization Request\n */\nexport default class ResponseAuthorizationGuest extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.AccessToken'\n    })\n  }\n\n  /**\n   * Returns the reason for rejection\n   *\n   * @return {string}\n   */\n  reason () {\n    return 'Invalid response from server'\n  }\n\n  /**\n   * Returns whether molecule was accepted or not\n   *\n   * @return {boolean}\n   */\n  success () {\n    return this.payload() !== null\n  }\n\n  /**\n   * Returns a wallet with balance\n   *\n   * @return {null|Wallet}\n   */\n  payload () {\n    return this.data()\n  }\n\n  /**\n   * Returns the authorization key\n   *\n   * @param key\n   * @return {*}\n   */\n  payloadKey (key) {\n    if (!Dot.has(this.payload(), key)) {\n      throw new InvalidResponseException(`ResponseAuthorizationGuest::payloadKey() - '${ key }' key is not found in the payload!`)\n    }\n    return Dot.get(this.payload(), key)\n  }\n\n  /**\n   * Returns the auth token\n   *\n   * @return {*}\n   */\n  token () {\n    return this.payloadKey('token')\n  }\n\n  /**\n   * Returns timestamp\n   *\n   * @return {*}\n   */\n  time () {\n    return this.payloadKey('time')\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { zeroizeBytes, withSecureBytes } from '../libraries/secureMemory.js'\nimport {\n  sealEnvelope,\n  openEnvelope,\n  deriveEnvelopeKey,\n  DEFAULT_ITERATIONS,\n  SECRET_KEY_PREFIX,\n  RECOVERY_KEY_PREFIX\n} from './secretEnvelope.js'\n\n/**\n * Default in-memory backend for WebCrypto encrypted payloads\n */\nexport class MemoryStorageBackend {\n  constructor () {\n    this.store = new Map()\n  }\n\n  getItem (key) {\n    return this.store.get(key) ?? null\n  }\n\n  setItem (key, value) {\n    this.store.set(key, value)\n  }\n\n  removeItem (key) {\n    return this.store.delete(key)\n  }\n\n  keys () {\n    return Array.from(this.store.keys())\n  }\n}\n\nconst textDecoder = new TextDecoder()\nconst KEY_PREFIX = SECRET_KEY_PREFIX\n\n/**\n * Software envelope-encryption secret storage provider: WebCrypto AES-256-GCM with PBKDF2-HMAC-SHA256.\n * Writes the cross-SDK envelope format; never hardware-backed.\n */\nexport default class WebCryptoSecretStorageProvider {\n  /**\n   * @param {{ backend?: object, defaultPassphrase?: string }} [options]\n   */\n  constructor (options = {}) {\n    this.providerType = 'webcrypto-aes-gcm'\n    this.backend = options.backend || new MemoryStorageBackend()\n    this.defaultPassphrase = options.defaultPassphrase\n  }\n\n  /**\n   * True only when this provider holds a non-exportable key inside platform-secure\n   * hardware (Android TEE/StrongBox, Secure Enclave, TPM) and learned that from the\n   * platform itself — never from a caller argument. Software envelope providers\n   * return false. The value is persisted as `metadata.hardwareBacked` in every\n   * envelope this provider writes.\n   *\n   * @returns {boolean}\n   */\n  isHardwareBacked () {\n    return false\n  }\n\n  /**\n   * Check if WebCrypto subtle API is available\n   *\n   * @returns {Promise<boolean>}\n   */\n  async isAvailable () {\n    return (\n      typeof globalThis.crypto !== 'undefined' &&\n      typeof globalThis.crypto.subtle !== 'undefined'\n    )\n  }\n\n  /**\n   * Derive an AES-GCM CryptoKey from a passphrase and salt using PBKDF2\n   *\n   * @param {string} passphrase\n   * @param {Uint8Array} salt\n   * @param {number} [iterations]\n   * @returns {Promise<CryptoKey>}\n   */\n  async deriveKey (passphrase, salt, iterations = DEFAULT_ITERATIONS) {\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebCrypto API is not available')\n    }\n    return await deriveEnvelopeKey(passphrase, salt, iterations)\n  }\n\n  /**\n   * Store and encrypt a master secret\n   *\n   * @param {string} bundleHash\n   * @param {string} secret\n   * @param {{ label?: string, passphrase?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async storeSecret (bundleHash, secret, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!secret) {\n      throw new SecretStorageException('Secret cannot be empty')\n    }\n\n    const passphrase = options.passphrase || this.defaultPassphrase\n    if (!passphrase) {\n      throw new SecretStorageException('Passphrase required for envelope encryption')\n    }\n\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebCrypto API is not available')\n    }\n\n    try {\n      const metadata = {\n        bundleHash,\n        label: options.label,\n        createdAt: Date.now(),\n        hardwareBacked: false,\n        providerType: this.providerType\n      }\n\n      const payload = await sealEnvelope(secret, passphrase, metadata)\n      await this.backend.setItem(`${KEY_PREFIX}${bundleHash}`, JSON.stringify(payload))\n\n      if (options.recoveryPassphrase) {\n        const recoveryMetadata = {\n          bundleHash,\n          label: options.label,\n          createdAt: Date.now(),\n          hardwareBacked: false,\n          providerType: 'webcrypto-aes-gcm'\n        }\n        const recoveryPayload = await sealEnvelope(secret, options.recoveryPassphrase, recoveryMetadata)\n        await this.backend.setItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`, JSON.stringify(recoveryPayload))\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw new SecretStorageException(`Encryption failed: ${msg}`)\n    }\n  }\n\n  /**\n   * Retrieve and decrypt the master secret\n   *\n   * @param {string} bundleHash\n   * @param {{ passphrase?: string }} [options]\n   * @returns {Promise<string|null>}\n   */\n  async retrieveSecret (bundleHash, options = {}) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      return null\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = options.passphrase || this.defaultPassphrase\n    if (!passphrase) {\n      throw new SecretStorageException('Passphrase required for secret decryption')\n    }\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebCrypto API is not available')\n    }\n\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      try {\n        return textDecoder.decode(decryptedBytes)\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  /**\n   * Delete a stored secret\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<boolean>}\n   */\n  async deleteSecret (bundleHash) {\n    const key = `${KEY_PREFIX}${bundleHash}`\n    const recoveryKey = `${RECOVERY_KEY_PREFIX}${bundleHash}`\n    const result = await this.backend.removeItem(key)\n    await this.backend.removeItem(recoveryKey)\n    return result !== false\n  }\n\n  /**\n   * Check if a secret exists\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<boolean>}\n   */\n  async hasSecret (bundleHash) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    return raw !== null\n  }\n\n  /**\n   * List all stored secret metadata\n   *\n   * @returns {Promise<Array<{ bundleHash: string, label?: string, createdAt: number, hardwareBacked: boolean, providerType: string }>>}\n   */\n  async listSecrets () {\n    const keys = await this.backend.keys()\n    const matchingKeys = keys.filter(k => k.startsWith(KEY_PREFIX) && !k.startsWith(RECOVERY_KEY_PREFIX))\n    const results = []\n\n    for (const key of matchingKeys) {\n      const raw = await this.backend.getItem(key)\n      if (raw) {\n        try {\n          const payload = JSON.parse(raw)\n          if (payload.metadata) {\n            results.push(payload.metadata)\n          }\n        } catch {\n          // Ignore corrupted entries\n        }\n      }\n    }\n\n    return results\n  }\n\n  /**\n   * Execute callback with unwrapped secret, zeroizing the decrypted buffer upon completion\n   *\n   * @template T\n   * @param {string} bundleHash\n   * @param {(secret: string) => Promise<T>|T} fn\n   * @param {{ passphrase?: string }} [options]\n   * @returns {Promise<T>}\n   */\n  async withSecret (bundleHash, fn, options = {}) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = options.passphrase || this.defaultPassphrase\n    if (!passphrase) {\n      throw new SecretStorageException('Passphrase required for secret decryption')\n    }\n\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebCrypto API is not available')\n    }\n\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      return await withSecureBytes(decryptedBytes, async (bytes) => {\n        const secretString = textDecoder.decode(bytes)\n        return await fn(secretString)\n      })\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  /**\n   * Recover a secret using its recovery envelope and re-enroll it\n   *\n   * @param {string} bundleHash\n   * @param {string} recoveryPassphrase\n   * @param {{ label?: string, passphrase?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async recoverSecret (bundleHash, recoveryPassphrase, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!recoveryPassphrase) {\n      throw new SecretStorageException('Recovery passphrase cannot be empty')\n    }\n\n    const raw = await this.backend.getItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted recovery payload format')\n    }\n\n    let decryptedBytes\n    try {\n      decryptedBytes = await openEnvelope(payload, recoveryPassphrase)\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n\n    let secretStr\n    try {\n      secretStr = textDecoder.decode(decryptedBytes)\n    } finally {\n      zeroizeBytes(decryptedBytes)\n    }\n\n    const storePassphrase = options.passphrase || this.defaultPassphrase || recoveryPassphrase\n    await this.storeSecret(bundleHash, secretStr, {\n      ...options,\n      passphrase: storePassphrase,\n      recoveryPassphrase\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\n\n/**\n * Node-only persistent file storage backend.\n * Stores key-value entries in a JSON file with restrictive permissions (0o600).\n * Uses temporary file writing followed by atomic rename to prevent corruption.\n */\nexport default class FileStorageBackend {\n  /**\n   * @param {string} filePath\n   */\n  constructor (filePath) {\n    if (!filePath) {\n      throw new SecretStorageException('Storage file path cannot be empty')\n    }\n    this.filePath = filePath\n    this.store = new Map()\n    this.loaded = false\n  }\n\n  /**\n   * @private\n   */\n  async getFs () {\n    try {\n      // Platform-specific: node:fs and node:path do not exist in browser runtimes\n      // and cannot be statically imported without breaking browser bundles.\n      const fs = await import('node:fs/promises')\n      const path = await import('node:path')\n      return { fs, path }\n    } catch {\n      throw SecretStorageException.unavailable(\n        'file-storage',\n        'FileStorageBackend is only supported in Node.js environments with node:fs access'\n      )\n    }\n  }\n\n  /**\n   * @private\n   */\n  async ensureLoaded () {\n    if (this.loaded) {\n      return this.store\n    }\n\n    const { fs } = await this.getFs()\n\n    try {\n      const content = await fs.readFile(this.filePath, 'utf8')\n      let parsed\n      try {\n        parsed = JSON.parse(content)\n      } catch {\n        throw SecretStorageException.decryptionFailed('Corrupted storage file format')\n      }\n\n      if (parsed && typeof parsed === 'object') {\n        this.store = new Map(Object.entries(parsed).map(([k, v]) => [k, String(v)]))\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      if (err?.code !== 'ENOENT') {\n        const msg = err instanceof Error ? err.message : String(err)\n        throw new SecretStorageException(`Failed to read storage file: ${msg}`)\n      }\n      this.store = new Map()\n    }\n\n    this.loaded = true\n    return this.store\n  }\n\n  /**\n   * @private\n   */\n  async persist () {\n    const { fs, path } = await this.getFs()\n\n    const dir = path.dirname(this.filePath)\n    if (dir && dir !== '.') {\n      await fs.mkdir(dir, { recursive: true })\n    }\n\n    const tmpPath = `${this.filePath}.tmp.${Date.now()}_${Math.random().toString(36).slice(2)}`\n    const data = JSON.stringify(Object.fromEntries(this.store), null, 2)\n\n    try {\n      await fs.writeFile(tmpPath, data, { mode: 0o600, encoding: 'utf8' })\n      if (typeof process !== 'undefined' && process.platform !== 'win32') {\n        try {\n          await fs.chmod(tmpPath, 0o600)\n        } catch {\n          // Ignore chmod error if file system does not support it\n        }\n      }\n      await fs.rename(tmpPath, this.filePath)\n    } catch (err) {\n      try {\n        await fs.unlink(tmpPath)\n      } catch {\n        // Ignore cleanup error\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw new SecretStorageException(`Failed to persist storage file: ${msg}`)\n    }\n  }\n\n  /**\n   * @param {string} key\n   * @returns {Promise<string|null>}\n   */\n  async getItem (key) {\n    await this.ensureLoaded()\n    return this.store.get(key) ?? null\n  }\n\n  /**\n   * @param {string} key\n   * @param {string} value\n   * @returns {Promise<void>}\n   */\n  async setItem (key, value) {\n    await this.ensureLoaded()\n    this.store.set(key, value)\n    await this.persist()\n  }\n\n  /**\n   * @param {string} key\n   * @returns {Promise<boolean>}\n   */\n  async removeItem (key) {\n    await this.ensureLoaded()\n    const existed = this.store.delete(key)\n    if (existed) {\n      await this.persist()\n    }\n    return existed\n  }\n\n  /**\n   * @returns {Promise<string[]>}\n   */\n  async keys () {\n    await this.ensureLoaded()\n    return Array.from(this.store.keys())\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\n\n/**\n * Browser persistent storage backend wrapping Web Storage (localStorage or sessionStorage).\n * Adapts the Web Storage API (length + key(i)) to IStorageBackend.keys(), filtering\n * by a prefix (defaults to 'knishio:') so unrelated items are ignored.\n */\nexport default class WebStorageBackend {\n  /**\n   * @param {Storage} [storage]\n   * @param {string} [prefix]\n   */\n  constructor (storage, prefix = 'knishio:') {\n    if (storage) {\n      this.storage = storage\n    } else if (typeof globalThis !== 'undefined' && globalThis.localStorage) {\n      this.storage = globalThis.localStorage\n    } else {\n      throw SecretStorageException.unavailable(\n        'web-storage',\n        'WebStorageBackend requires a Storage object or global localStorage'\n      )\n    }\n    this.prefix = prefix\n  }\n\n  /**\n   * @param {string} key\n   * @returns {string|null}\n   */\n  getItem (key) {\n    return this.storage.getItem(key)\n  }\n\n  /**\n   * @param {string} key\n   * @param {string} value\n   */\n  setItem (key, value) {\n    this.storage.setItem(key, value)\n  }\n\n  /**\n   * @param {string} key\n   * @returns {boolean}\n   */\n  removeItem (key) {\n    const existed = this.storage.getItem(key) !== null\n    this.storage.removeItem(key)\n    return existed\n  }\n\n  /**\n   * @returns {string[]}\n   */\n  keys () {\n    const result = []\n    const len = this.storage.length\n    for (let i = 0; i < len; i++) {\n      const k = this.storage.key(i)\n      if (k !== null) {\n        if (!this.prefix || k.startsWith(this.prefix)) {\n          result.push(k)\n        }\n      }\n    }\n    return result\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                            (//////////(                      (////)\n                            (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { zeroizeBytes, withSecureBytes } from '../libraries/secureMemory.js'\nimport {\n  sealEnvelope,\n  openEnvelope,\n  uint8ArrayToBase64,\n  base64ToUint8Array,\n  SECRET_KEY_PREFIX,\n  RECOVERY_KEY_PREFIX\n} from './secretEnvelope.js'\n\nexport const PRF_SALT_LABEL = 'knishio:secret-storage:webauthn-prf:v1'\nexport const KEK_INFO = 'knishio:secret-storage:kek:v1'\nconst KEY_PREFIX = SECRET_KEY_PREFIX\nconst GCM_IV_LENGTH = 12\n\nconst textEncoder = new TextEncoder()\nconst textDecoder = new TextDecoder()\n\nfunction base64UrlEncode (bytes) {\n  return uint8ArrayToBase64(bytes)\n    .replace(/\\+/g, '-')\n    .replace(/\\//g, '_')\n    .replace(/=+$/, '')\n}\n\nfunction base64UrlDecode (str) {\n  let base64 = str.replace(/-/g, '+').replace(/_/g, '/')\n  while (base64.length % 4 !== 0) {\n    base64 += '='\n  }\n  return base64ToUint8Array(base64)\n}\n\nfunction toUint8Array (buf) {\n  if (buf instanceof Uint8Array) {\n    return buf\n  }\n  if (ArrayBuffer.isView(buf)) {\n    return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength)\n  }\n  return new Uint8Array(buf)\n}\n\nasync function computePrfSalt () {\n  const hash = await globalThis.crypto.subtle.digest('SHA-256', textEncoder.encode(PRF_SALT_LABEL))\n  return new Uint8Array(hash)\n}\n\nasync function deriveKekFromPrf (prfOutput, prfSalt) {\n  const hkdfKey = await globalThis.crypto.subtle.importKey(\n    'raw',\n    prfOutput,\n    'HKDF',\n    false,\n    ['deriveKey']\n  )\n\n  return await globalThis.crypto.subtle.deriveKey(\n    {\n      name: 'HKDF',\n      hash: 'SHA-256',\n      salt: prfSalt,\n      info: textEncoder.encode(KEK_INFO)\n    },\n    hkdfKey,\n    { name: 'AES-GCM', length: 256 },\n    false,\n    ['encrypt', 'decrypt']\n  )\n}\n\n/**\n * Hardware-attested passkey PRF secret storage provider.\n * Wraps a random device passphrase under a KEK derived from the WebAuthn PRF extension.\n */\nexport default class WebAuthnPrfSecretStorageProvider {\n  /**\n   * @param {object} options\n   * @param {object} options.backend\n   * @param {{ id?: string, name: string }} options.rp\n   * @param {{ id: Uint8Array, name: string, displayName: string }} options.user\n   * @param {object} [options.credentials]\n   * @param {string} [options.alias]\n   */\n  constructor (options) {\n    this.providerType = 'webauthn-prf'\n    this.backend = options.backend\n    this.rp = options.rp\n    this.user = options.user\n    this.credentialsContainer = options.credentials\n    this.alias = options.alias || 'default'\n    this.cachedPassphrase = undefined\n  }\n\n  get credentials () {\n    if (this.credentialsContainer) {\n      return this.credentialsContainer\n    }\n    if (typeof globalThis.navigator !== 'undefined' && globalThis.navigator.credentials) {\n      return globalThis.navigator.credentials\n    }\n    throw SecretStorageException.unavailable(\n      this.providerType,\n      'WebAuthn credentials container is not available'\n    )\n  }\n\n  get recordKey () {\n    return `knishio:webauthn-prf:${this.alias}`\n  }\n\n  isHardwareBacked () {\n    // The PRF secret is bound to the authenticator hardware, but the derived KEK\n    // material is handled by page JS and passkey attestation is not verified here.\n    return false\n  }\n\n  async isAvailable () {\n    const hasWebCrypto =\n      typeof globalThis.crypto !== 'undefined' &&\n      typeof globalThis.crypto.subtle !== 'undefined'\n    const hasCredentials = Boolean(\n      this.credentialsContainer ||\n      (typeof globalThis.navigator !== 'undefined' &&\n        globalThis.navigator.credentials &&\n        typeof globalThis.PublicKeyCredential !== 'undefined')\n    )\n    return hasWebCrypto && hasCredentials\n  }\n\n  /**\n   * Enroll a new passkey credential with PRF support and wrap a random device passphrase\n   */\n  async enroll () {\n    const existing = await this.backend.getItem(this.recordKey)\n    if (existing) {\n      return\n    }\n\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebAuthn PRF is not available')\n    }\n\n    const challenge = new Uint8Array(32)\n    globalThis.crypto.getRandomValues(challenge)\n\n    const credential = await this.credentials.create({\n      publicKey: {\n        rp: this.rp,\n        user: {\n          id: this.user.id,\n          name: this.user.name,\n          displayName: this.user.displayName\n        },\n        challenge,\n        pubKeyCredParams: [\n          { type: 'public-key', alg: -7 },\n          { type: 'public-key', alg: -257 }\n        ],\n        authenticatorSelection: {\n          residentKey: 'required',\n          userVerification: 'required'\n        },\n        extensions: {\n          prf: {}\n        }\n      }\n    })\n\n    if (!credential) {\n      throw SecretStorageException.unavailable(this.providerType, 'Authenticator creation returned null')\n    }\n\n    const extResults = credential.getClientExtensionResults?.()\n    if (extResults?.prf?.enabled !== true) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator does not support the PRF extension'\n      )\n    }\n\n    const credentialIdBytes = new Uint8Array(credential.rawId)\n    const prfSalt = await computePrfSalt()\n\n    const getChallenge = new Uint8Array(32)\n    globalThis.crypto.getRandomValues(getChallenge)\n\n    let assertion\n    try {\n      assertion = await this.credentials.get({\n        publicKey: {\n          challenge: getChallenge,\n          rpId: this.rp.id,\n          allowCredentials: [\n            {\n              type: 'public-key',\n              id: credentialIdBytes\n            }\n          ],\n          userVerification: 'required',\n          extensions: {\n            prf: {\n              eval: {\n                first: prfSalt\n              }\n            }\n          }\n        }\n      })\n    } catch (err) {\n      if (err?.name === 'NotAllowedError') {\n        throw SecretStorageException.unavailable(\n          this.providerType,\n          'authenticator refused or credential missing'\n        )\n      }\n      throw err\n    }\n\n    if (!assertion) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator refused or credential missing'\n      )\n    }\n\n    const getExtResults = assertion?.getClientExtensionResults?.()\n    const firstOutput = getExtResults?.prf?.results?.first\n    if (!firstOutput) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator returned no PRF result'\n      )\n    }\n\n    const prfBytes = toUint8Array(firstOutput)\n    const kek = await deriveKekFromPrf(prfBytes, prfSalt)\n\n    const devicePassphraseBytes = new Uint8Array(32)\n    globalThis.crypto.getRandomValues(devicePassphraseBytes)\n    const devicePassphrase = uint8ArrayToBase64(devicePassphraseBytes)\n\n    const iv = new Uint8Array(GCM_IV_LENGTH)\n    globalThis.crypto.getRandomValues(iv)\n\n    const passphraseBytes = textEncoder.encode(devicePassphrase)\n    try {\n      const encryptedBuffer = await globalThis.crypto.subtle.encrypt(\n        {\n          name: 'AES-GCM',\n          iv\n        },\n        kek,\n        passphraseBytes\n      )\n\n      const record = {\n        version: 1,\n        credentialId: base64UrlEncode(credentialIdBytes),\n        iv: uint8ArrayToBase64(iv),\n        ciphertext: uint8ArrayToBase64(new Uint8Array(encryptedBuffer))\n      }\n\n      await this.backend.setItem(this.recordKey, JSON.stringify(record))\n      this.cachedPassphrase = devicePassphrase\n    } finally {\n      zeroizeBytes(passphraseBytes)\n      zeroizeBytes(devicePassphraseBytes)\n    }\n  }\n\n  /**\n   * Unlock the device passphrase using the enrolled WebAuthn PRF credential\n   */\n  async unlock () {\n    if (this.cachedPassphrase) {\n      return this.cachedPassphrase\n    }\n\n    const rawRecord = await this.backend.getItem(this.recordKey)\n    if (!rawRecord) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'no enrolled credential; call enroll() first'\n      )\n    }\n\n    let record\n    try {\n      record = JSON.parse(rawRecord)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted PRF record format')\n    }\n\n    const credentialIdBytes = base64UrlDecode(record.credentialId)\n    const prfSalt = await computePrfSalt()\n\n    const challenge = new Uint8Array(32)\n    globalThis.crypto.getRandomValues(challenge)\n\n    let assertion\n    try {\n      assertion = await this.credentials.get({\n        publicKey: {\n          challenge,\n          rpId: this.rp.id,\n          allowCredentials: [\n            {\n              type: 'public-key',\n              id: credentialIdBytes\n            }\n          ],\n          userVerification: 'required',\n          extensions: {\n            prf: {\n              eval: {\n                first: prfSalt\n              }\n            }\n          }\n        }\n      })\n    } catch (err) {\n      if (err?.name === 'NotAllowedError') {\n        throw SecretStorageException.unavailable(\n          this.providerType,\n          'authenticator refused or credential missing'\n        )\n      }\n      throw err\n    }\n\n    if (!assertion) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator refused or credential missing'\n      )\n    }\n\n    const extResults = assertion?.getClientExtensionResults?.()\n    const firstOutput = extResults?.prf?.results?.first\n    if (!firstOutput) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator returned no PRF result'\n      )\n    }\n\n    const prfBytes = toUint8Array(firstOutput)\n    const kek = await deriveKekFromPrf(prfBytes, prfSalt)\n\n    const iv = base64ToUint8Array(record.iv)\n    const ciphertext = base64ToUint8Array(record.ciphertext)\n\n    try {\n      const decryptedBuffer = await globalThis.crypto.subtle.decrypt(\n        {\n          name: 'AES-GCM',\n          iv\n        },\n        kek,\n        ciphertext\n      )\n\n      const decryptedBytes = new Uint8Array(decryptedBuffer)\n      try {\n        this.cachedPassphrase = textDecoder.decode(decryptedBytes)\n        return this.cachedPassphrase\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch {\n      throw SecretStorageException.decryptionFailed(\n        'wrapped device passphrase failed authentication under the enrolled credential'\n      )\n    }\n  }\n\n  /**\n   * Lock the provider by clearing cached passphrase material\n   */\n  lock () {\n    this.cachedPassphrase = undefined\n  }\n\n  /**\n   * Unenroll the current credential, removing the stored PRF record and clearing cached passphrase\n   *\n   * @returns {Promise<void>}\n   */\n  async unenroll () {\n    this.lock()\n    await this.backend.removeItem(this.recordKey)\n  }\n\n  async storeSecret (bundleHash, secret, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!secret) {\n      throw new SecretStorageException('Secret cannot be empty')\n    }\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'WebAuthnPrfSecretStorageProvider derives its passphrase from the authenticator; options.passphrase is not accepted'\n      )\n    }\n\n    if (!options.recoveryPassphrase && !options.allowUnrecoverable) {\n      throw SecretStorageException.validationError(\n        'Recovery passphrase required for non-exportable hardware key unless allowUnrecoverable is true'\n      )\n    }\n\n    const passphrase = await this.unlock()\n    const metadata = {\n      bundleHash,\n      label: options.label,\n      createdAt: Date.now(),\n      hardwareBacked: false,\n      providerType: this.providerType\n    }\n\n    const payload = await sealEnvelope(secret, passphrase, metadata)\n    await this.backend.setItem(`${KEY_PREFIX}${bundleHash}`, JSON.stringify(payload))\n\n    if (options.recoveryPassphrase) {\n      const recoveryMetadata = {\n        bundleHash,\n        label: options.label,\n        createdAt: Date.now(),\n        hardwareBacked: false,\n        providerType: 'webcrypto-aes-gcm'\n      }\n      const recoveryPayload = await sealEnvelope(secret, options.recoveryPassphrase, recoveryMetadata)\n      await this.backend.setItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`, JSON.stringify(recoveryPayload))\n    }\n  }\n\n  async retrieveSecret (bundleHash, options = {}) {\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'WebAuthnPrfSecretStorageProvider derives its passphrase from the authenticator; options.passphrase is not accepted'\n      )\n    }\n\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      return null\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = await this.unlock()\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      try {\n        return textDecoder.decode(decryptedBytes)\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  async withSecret (bundleHash, fn, options = {}) {\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'WebAuthnPrfSecretStorageProvider derives its passphrase from the authenticator; options.passphrase is not accepted'\n      )\n    }\n\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = await this.unlock()\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      return await withSecureBytes(decryptedBytes, async (bytes) => {\n        const secretString = textDecoder.decode(bytes)\n        return await fn(secretString)\n      })\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  async deleteSecret (bundleHash) {\n    const key = `${KEY_PREFIX}${bundleHash}`\n    const recoveryKey = `${RECOVERY_KEY_PREFIX}${bundleHash}`\n    const result = await this.backend.removeItem(key)\n    await this.backend.removeItem(recoveryKey)\n    return result !== false\n  }\n\n  async hasSecret (bundleHash) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    return raw !== null\n  }\n\n  async listSecrets () {\n    const keys = await this.backend.keys()\n    const matchingKeys = keys.filter(k => k.startsWith(KEY_PREFIX) && !k.startsWith(RECOVERY_KEY_PREFIX))\n    const results = []\n\n    for (const key of matchingKeys) {\n      const raw = await this.backend.getItem(key)\n      if (raw) {\n        try {\n          const payload = JSON.parse(raw)\n          if (payload.metadata) {\n            results.push(payload.metadata)\n          }\n        } catch {\n          // Ignore unparseable entries\n        }\n      }\n    }\n\n    return results\n  }\n\n  /**\n   * Recover a secret using its recovery envelope and re-enroll it under a fresh WebAuthn PRF credential\n   *\n   * @param {string} bundleHash\n   * @param {string} recoveryPassphrase\n   * @param {{ label?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async recoverSecret (bundleHash, recoveryPassphrase, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!recoveryPassphrase) {\n      throw new SecretStorageException('Recovery passphrase cannot be empty')\n    }\n\n    const raw = await this.backend.getItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted recovery payload format')\n    }\n\n    let decryptedBytes\n    try {\n      decryptedBytes = await openEnvelope(payload, recoveryPassphrase)\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n\n    let secretStr\n    try {\n      secretStr = textDecoder.decode(decryptedBytes)\n    } finally {\n      zeroizeBytes(decryptedBytes)\n    }\n\n    await this.storeSecret(bundleHash, secretStr, {\n      ...options,\n      recoveryPassphrase\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                            (//////////(                      (////)\n                            (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { zeroizeBytes, withSecureBytes } from '../libraries/secureMemory.js'\nimport {\n  sealEnvelope,\n  openEnvelope,\n  uint8ArrayToBase64,\n  base64ToUint8Array,\n  SECRET_KEY_PREFIX,\n  RECOVERY_KEY_PREFIX\n} from './secretEnvelope.js'\n\nconst KEY_PREFIX = SECRET_KEY_PREFIX\nconst GCM_IV_LENGTH = 12\n\nconst textEncoder = new TextEncoder()\nconst textDecoder = new TextDecoder()\n\n/**\n * In-memory key store for tests and non-browser environments\n */\nexport class MemoryKeyStore {\n  constructor () {\n    this.keys = new Map()\n  }\n\n  async get (name) {\n    return this.keys.get(name)\n  }\n\n  async put (name, key) {\n    this.keys.set(name, key)\n  }\n\n  async delete (name) {\n    return this.keys.delete(name)\n  }\n}\n\n/**\n * IndexedDB key store for browser environments\n */\nexport class IndexedDbKeyStore {\n  constructor (dbName = 'knishio-secret-storage') {\n    this.dbName = dbName\n    this.storeName = 'keys'\n  }\n\n  async getDb () {\n    if (typeof globalThis.indexedDB === 'undefined') {\n      throw SecretStorageException.unavailable(\n        'webcrypto-nonextractable',\n        'IndexedDB is not available'\n      )\n    }\n\n    return new Promise((resolve, reject) => {\n      const request = globalThis.indexedDB.open(this.dbName, 1)\n      request.onupgradeneeded = () => {\n        const db = request.result\n        if (!db.objectStoreNames.contains(this.storeName)) {\n          db.createObjectStore(this.storeName)\n        }\n      }\n      request.onsuccess = () => resolve(request.result)\n      request.onerror = () => reject(request.error)\n    })\n  }\n\n  async get (name) {\n    const db = await this.getDb()\n    return new Promise((resolve, reject) => {\n      const tx = db.transaction(this.storeName, 'readonly')\n      const store = tx.objectStore(this.storeName)\n      const request = store.get(name)\n      request.onsuccess = () => resolve(request.result)\n      request.onerror = () => reject(request.error)\n    })\n  }\n\n  async put (name, key) {\n    const db = await this.getDb()\n    return new Promise((resolve, reject) => {\n      const tx = db.transaction(this.storeName, 'readwrite')\n      const store = tx.objectStore(this.storeName)\n      const request = store.put(key, name)\n      request.onsuccess = () => resolve()\n      request.onerror = () => reject(request.error)\n    })\n  }\n\n  async delete (name) {\n    const db = await this.getDb()\n    return new Promise((resolve, reject) => {\n      const tx = db.transaction(this.storeName, 'readwrite')\n      const store = tx.objectStore(this.storeName)\n      const request = store.delete(name)\n      request.onsuccess = () => resolve(true)\n      request.onerror = () => reject(request.error)\n    })\n  }\n}\n\n/**\n * Secret storage provider backed by a non-extractable CryptoKey stored in IndexedDB.\n * The KEK cannot be exported from the browser's WebCrypto context.\n */\nexport default class NonExtractableKeySecretStorageProvider {\n  /**\n   * @param {object} options\n   * @param {object} options.backend\n   * @param {object} [options.keyStore]\n   * @param {string} [options.alias]\n   */\n  constructor (options) {\n    this.providerType = 'webcrypto-nonextractable'\n    this.backend = options.backend\n    this.keyStore = options.keyStore || new IndexedDbKeyStore()\n    this.alias = options.alias || 'default'\n    this.cachedPassphrase = undefined\n  }\n\n  get recordKey () {\n    return `knishio:kek:webcrypto-nonextractable:${this.alias}`\n  }\n\n  get kekStoreKey () {\n    return `knishio:kek:${this.alias}`\n  }\n\n  isHardwareBacked () {\n    // Non-extractable WebCrypto keys prevent JS extraction, but are not verified\n    // hardware-enclave keys.\n    return false\n  }\n\n  async isAvailable () {\n    return (\n      typeof globalThis.crypto !== 'undefined' &&\n      typeof globalThis.crypto.subtle !== 'undefined'\n    )\n  }\n\n  /**\n   * Unlock or initialize the device passphrase using the non-extractable KEK\n   */\n  async unlock () {\n    if (this.cachedPassphrase) {\n      return this.cachedPassphrase\n    }\n\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'WebCrypto API is not available'\n      )\n    }\n\n    const rawRecord = await this.backend.getItem(this.recordKey)\n    if (!rawRecord) {\n      // First use: create non-extractable KEK and wrap new device passphrase\n      let kek = await this.keyStore.get(this.kekStoreKey)\n      if (!kek) {\n        kek = await globalThis.crypto.subtle.generateKey(\n          { name: 'AES-GCM', length: 256 },\n          false,\n          ['encrypt', 'decrypt']\n        )\n        await this.keyStore.put(this.kekStoreKey, kek)\n      }\n\n      const devicePassphraseBytes = new Uint8Array(32)\n      globalThis.crypto.getRandomValues(devicePassphraseBytes)\n      const devicePassphrase = uint8ArrayToBase64(devicePassphraseBytes)\n\n      const iv = new Uint8Array(GCM_IV_LENGTH)\n      globalThis.crypto.getRandomValues(iv)\n\n      const passphraseBytes = textEncoder.encode(devicePassphrase)\n      try {\n        const encryptedBuffer = await globalThis.crypto.subtle.encrypt(\n          {\n            name: 'AES-GCM',\n            iv\n          },\n          kek,\n          passphraseBytes\n        )\n\n        const record = {\n          version: 1,\n          iv: uint8ArrayToBase64(iv),\n          ciphertext: uint8ArrayToBase64(new Uint8Array(encryptedBuffer))\n        }\n\n        await this.backend.setItem(this.recordKey, JSON.stringify(record))\n        this.cachedPassphrase = devicePassphrase\n        return devicePassphrase\n      } finally {\n        zeroizeBytes(passphraseBytes)\n        zeroizeBytes(devicePassphraseBytes)\n      }\n    }\n\n    // Subsequent use: unwrap device passphrase with stored KEK\n    let record\n    try {\n      record = JSON.parse(rawRecord)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted key record format')\n    }\n\n    const kek = await this.keyStore.get(this.kekStoreKey)\n    if (!kek) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        `no non-extractable key found for alias '${this.alias}'`\n      )\n    }\n\n    const iv = base64ToUint8Array(record.iv)\n    const ciphertext = base64ToUint8Array(record.ciphertext)\n\n    try {\n      const decryptedBuffer = await globalThis.crypto.subtle.decrypt(\n        {\n          name: 'AES-GCM',\n          iv\n        },\n        kek,\n        ciphertext\n      )\n\n      const decryptedBytes = new Uint8Array(decryptedBuffer)\n      try {\n        this.cachedPassphrase = textDecoder.decode(decryptedBytes)\n        return this.cachedPassphrase\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch {\n      throw SecretStorageException.decryptionFailed(\n        'wrapped device passphrase failed authentication under non-extractable key'\n      )\n    }\n  }\n\n  /**\n   * Lock the provider by clearing cached passphrase material\n   */\n  lock () {\n    this.cachedPassphrase = undefined\n  }\n\n  /**\n   * Unenroll the non-extractable key, removing the stored wrapped record and KEK\n   *\n   * @returns {Promise<void>}\n   */\n  async unenroll () {\n    this.lock()\n    await this.backend.removeItem(this.recordKey)\n    await this.keyStore.delete(this.kekStoreKey)\n  }\n\n  async storeSecret (bundleHash, secret, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!secret) {\n      throw new SecretStorageException('Secret cannot be empty')\n    }\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'NonExtractableKeySecretStorageProvider derives its passphrase from the non-extractable device key; options.passphrase is not accepted'\n      )\n    }\n\n    if (!options.recoveryPassphrase && !options.allowUnrecoverable) {\n      throw SecretStorageException.validationError(\n        'Recovery passphrase required for non-exportable hardware key unless allowUnrecoverable is true'\n      )\n    }\n\n    const passphrase = await this.unlock()\n    const metadata = {\n      bundleHash,\n      label: options.label,\n      createdAt: Date.now(),\n      hardwareBacked: false,\n      providerType: this.providerType\n    }\n\n    const payload = await sealEnvelope(secret, passphrase, metadata)\n    await this.backend.setItem(`${KEY_PREFIX}${bundleHash}`, JSON.stringify(payload))\n\n    if (options.recoveryPassphrase) {\n      const recoveryMetadata = {\n        bundleHash,\n        label: options.label,\n        createdAt: Date.now(),\n        hardwareBacked: false,\n        providerType: 'webcrypto-aes-gcm'\n      }\n      const recoveryPayload = await sealEnvelope(secret, options.recoveryPassphrase, recoveryMetadata)\n      await this.backend.setItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`, JSON.stringify(recoveryPayload))\n    }\n  }\n\n  async retrieveSecret (bundleHash, options = {}) {\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'NonExtractableKeySecretStorageProvider derives its passphrase from the non-extractable device key; options.passphrase is not accepted'\n      )\n    }\n\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      return null\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = await this.unlock()\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      try {\n        return textDecoder.decode(decryptedBytes)\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  async withSecret (bundleHash, fn, options = {}) {\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'NonExtractableKeySecretStorageProvider derives its passphrase from the non-extractable device key; options.passphrase is not accepted'\n      )\n    }\n\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = await this.unlock()\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      return await withSecureBytes(decryptedBytes, async (bytes) => {\n        const secretString = textDecoder.decode(bytes)\n        return await fn(secretString)\n      })\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  async deleteSecret (bundleHash) {\n    const key = `${KEY_PREFIX}${bundleHash}`\n    const recoveryKey = `${RECOVERY_KEY_PREFIX}${bundleHash}`\n    const result = await this.backend.removeItem(key)\n    await this.backend.removeItem(recoveryKey)\n    return result !== false\n  }\n\n  async hasSecret (bundleHash) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    return raw !== null\n  }\n\n  async listSecrets () {\n    const keys = await this.backend.keys()\n    const matchingKeys = keys.filter(k => k.startsWith(KEY_PREFIX) && !k.startsWith(RECOVERY_KEY_PREFIX))\n    const results = []\n\n    for (const key of matchingKeys) {\n      const raw = await this.backend.getItem(key)\n      if (raw) {\n        try {\n          const payload = JSON.parse(raw)\n          if (payload.metadata) {\n            results.push(payload.metadata)\n          }\n        } catch {\n          // Ignore unparseable entries\n        }\n      }\n    }\n\n    return results\n  }\n\n  /**\n   * Recover a secret using its recovery envelope and re-enroll it under a fresh non-extractable KEK\n   *\n   * @param {string} bundleHash\n   * @param {string} recoveryPassphrase\n   * @param {{ label?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async recoverSecret (bundleHash, recoveryPassphrase, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!recoveryPassphrase) {\n      throw new SecretStorageException('Recovery passphrase cannot be empty')\n    }\n\n    const raw = await this.backend.getItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted recovery payload format')\n    }\n\n    let decryptedBytes\n    try {\n      decryptedBytes = await openEnvelope(payload, recoveryPassphrase)\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n\n    let secretStr\n    try {\n      secretStr = textDecoder.decode(decryptedBytes)\n    } finally {\n      zeroizeBytes(decryptedBytes)\n    }\n\n    await this.storeSecret(bundleHash, secretStr, {\n      ...options,\n      recoveryPassphrase\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nexport { default as MemorySecretStorageProvider } from './MemorySecretStorageProvider.js'\nexport {\n  default as WebCryptoSecretStorageProvider,\n  MemoryStorageBackend\n} from './WebCryptoSecretStorageProvider.js'\nexport { default as FileStorageBackend } from './FileStorageBackend.js'\nexport { default as WebStorageBackend } from './WebStorageBackend.js'\nexport {\n  default as WebAuthnPrfSecretStorageProvider,\n  PRF_SALT_LABEL,\n  KEK_INFO\n} from './WebAuthnPrfSecretStorageProvider.js'\nexport {\n  default as NonExtractableKeySecretStorageProvider,\n  IndexedDbKeyStore,\n  MemoryKeyStore\n} from './NonExtractableKeySecretStorageProvider.js'\nexport {\n  sealEnvelope,\n  openEnvelope,\n  uint8ArrayToBase64,\n  base64ToUint8Array,\n  deriveEnvelopeKey,\n  ENVELOPE_ALGORITHM,\n  DEFAULT_ITERATIONS,\n  SECRET_KEY_PREFIX,\n  RECOVERY_KEY_PREFIX\n} from './secretEnvelope.js'\n\nimport MemorySecretStorageProvider from './MemorySecretStorageProvider.js'\nimport WebCryptoSecretStorageProvider from './WebCryptoSecretStorageProvider.js'\n\n/**\n * Factory function to create a secret storage provider\n *\n * @param {{ type?: 'webcrypto'|'memory', defaultPassphrase?: string, backend?: object }} [options]\n * @returns {object}\n */\nexport function createDefaultSecretStorage (options = {}) {\n  if (options.type === 'memory') {\n    return new MemorySecretStorageProvider()\n  }\n\n  // Default to WebCrypto if available\n  if (typeof globalThis.crypto !== 'undefined' && typeof globalThis.crypto.subtle !== 'undefined') {\n    return new WebCryptoSecretStorageProvider({\n      backend: options.backend,\n      defaultPassphrase: options.defaultPassphrase\n    })\n  }\n\n  return new MemorySecretStorageProvider()\n}\n"],"x_google_ignoreList":[15,16,17,18,19,20,21,22,127],"mappings":";;;;;AAII,OAAO,OAAS,QAClB,OAAO,OAAO;AAGhB,IAAqB,IAArB,MAAyB;CAiBvB,OAAO,MAAO,GAAK,GAAS;EAM1B,IAAM,KAAe,GAAK,MAAc;GACtC,IAAM,IAAM,IACR;IAAC;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;GAAG,IAC/E;IAAC;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;GAAG;GAEnF,OAAO,EAAI,KAAK,MAAM,IAAM,EAAE,KAAK,EAAI,IAAM;EAC/C,GACM,IAAO,OAAO,OAClB;GACE,UAAU;GACV,WAAW;GACX,WAAW;EACb,GACA,KAAW,CAAC,CACd,GAEI,IAAM,IACN,IAAQ,GACR,IAAS;EAEb,KAAK,IAAI,IAAI,GAAG,IAAI,EAAI,WACtB,KAAO,EAAY,EAAI,IAAI,EAAK,SAAS,GAErC,MAAM,EAAI,SAAS,IAHO,EAAE,GAOhC,AAAI,EAAK,WAAW,KAAK,EAAE,MAAU,EAAK,aACxC,IAAQ,GAEJ,EAAK,YAAY,KAAK,EAAE,MAAW,EAAK,aAC1C,IAAS,GACT,KAAO,QAEP,KAAO;EAKb,OAAO;CACT;CAaA,OAAO,aAAc,GAAK;EACxB,IAAI,IAAS,EAAI,YAAY,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