{"version":3,"sources":["jsdelivr-header.js","/npm/@algora/sdk@0.3.1/src/index.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+server@10.35.0/node_modules/@trpc/server/dist/observable-ade1bad8.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+server@10.35.0/node_modules/@trpc/server/dist/observable/index.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+client@10.35.0_@trpc+server@10.35.0/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+client@10.35.0_@trpc+server@10.35.0/node_modules/@trpc/client/dist/TRPCClientError-fef6cf44.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+server@10.35.0/node_modules/@trpc/server/dist/codes-c924c3db.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+server@10.35.0/node_modules/@trpc/server/dist/index-f91d720c.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+client@10.35.0_@trpc+server@10.35.0/node_modules/@trpc/client/dist/httpUtils-ad76b802.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+client@10.35.0_@trpc+server@10.35.0/node_modules/@trpc/client/dist/transformResult-7ab522e6.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+client@10.35.0_@trpc+server@10.35.0/node_modules/@trpc/client/dist/httpBatchLink-520db465.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+client@10.35.0_@trpc+server@10.35.0/node_modules/@trpc/client/dist/links/httpLink.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/@trpc+client@10.35.0_@trpc+server@10.35.0/node_modules/@trpc/client/dist/index.mjs","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/double-indexed-kv.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/registry.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/class-registry.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/util.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/custom-transformer-registry.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/is.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/pathstringifier.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/transformer.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/accessDeep.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/plainer.ts","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/is-what@4.1.15/node_modules/is-what/dist/index.js","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js","/npm/@algora/sdk@0.3.1/node_modules/.pnpm/superjson@1.13.1/node_modules/superjson/src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,+ZCNA,GAAA,GCAA,SAAS,GAAS,GACd,OAAO,CACX,CAEiB,SAAS,GAAc,GACpC,OAAmB,IAAf,EAAI,OACG,GAEQ,IAAf,EAAI,OAEG,EAAI,GAER,SAAe,GAClB,OAAO,EAAI,QAAO,CAAC,EAAM,IAAK,EAAG,IAAO,EAC5C,CACJ,CAKA,SAAS,EAAW,GAChB,IAAM,EAAO,CACT,SAAA,CAAW,GACP,IAAI,EAAc,KACd,GAAS,EACT,GAAe,EACf,GAAsB,EAC1B,SAAS,IACe,OAAhB,EAIA,IAGJ,GAAe,EACY,mBAAhB,EACP,IACO,GACP,EAAY,eAVZ,GAAsB,CAY9B,CAC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B,IACE,IAAM,EAAY,SAAS,cAAc,GACzC,IAAK,EACH,OAGF,IAAM,EAAS,GAAY,GAC3B,IAAK,EAEH,YADA,QAAQ,MAAM,qCAIhB,EAAU,UAAY,GAEtB,QAAS,EAAI,EAAG,EAAI,EAAO,MAAO,IAChC,EAAU,WAAa,uPAWzB,IAAQ,MAAO,SAAmB,GAAO,OAAO,KAAK,MAAM,GAE3D,EAAU,UAAY,GAEtB,EAAS,SAAS,IAChB,EAAU,WAAa,iCAEX,EAAO,KAAK,uLAMW,EAAO,iEACR,EAAO,KAAK,aAAa,EAAO,KAAK,uDACrC,EAAO,KAAK,qDAAA,GAKlD,OAAS,GACP,QAAQ,MAAM,uCAAwC,EACxD,CACF,QAGW,OAAW,MACnB,OAAe,OAAS,CAAE,UAAQ,SAGP,YAAxB,SAAS,WACX,SAAS,iBAAiB,oBAAoB,IAAM,OAEpD","file":"/npm/@algora/sdk@0.3.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/@algora/sdk@0.3.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { createTRPCProxyClient, httpBatchLink } from \"@trpc/client\";\nimport { type inferRouterInputs, type inferRouterOutputs } from \"@trpc/server\";\nimport superjson from \"superjson\";\nimport { type API } from \"types/api\";\n\nexport type AlgoraInput = inferRouterInputs<API>;\nexport type AlgoraOutput = inferRouterOutputs<API>;\n\nexport const algora = createTRPCProxyClient<API>({\n  transformer: superjson,\n  links: [\n    httpBatchLink({\n      url: \"https://console.algora.io/api/trpc\",\n    }),\n  ],\n});\n\nconst parseStatus = (\n  status: string | null,\n): \"active\" | \"inactive\" | undefined => {\n  switch (status) {\n    case \"active\":\n      return \"active\";\n    case \"inactive\":\n      return \"inactive\";\n    default:\n      return undefined;\n  }\n};\n\nconst parseParams = (el: Element) => {\n  const org = el.getAttribute(\"data-bounty-org\");\n  const limit = parseInt(el.getAttribute(\"data-bounty-limit\") || \"100\", 10);\n  const status = parseStatus(el.getAttribute(\"data-bounty-status\"));\n\n  if (!org) {\n    return;\n  }\n\n  return { org, limit, status };\n};\n\nasync function init(selector = \"[data-bounty-org]\") {\n  try {\n    const container = document.querySelector(selector);\n    if (!container) {\n      return;\n    }\n\n    const params = parseParams(container);\n    if (!params) {\n      console.error(\"Algora SDK: Invalid configuration\");\n      return;\n    }\n\n    container.innerHTML = \"\";\n\n    for (let i = 0; i < params.limit; i++) {\n      container.innerHTML += `\n      <div class=\"bounty-skeleton\">\n        <div class=\"bounty-content\">\n          <div class=\"bounty-reward\"></div>\n          <div class=\"bounty-issue\"></div>\n          <div class=\"bounty-title\"></div>\n        </div>\n      </div>\n    `;\n    }\n\n    const { items: bounties } = await algora.bounty.list.query(params);\n\n    container.innerHTML = \"\";\n\n    bounties.forEach((bounty) => {\n      container.innerHTML += `\n        <a\n          href=\"${bounty.task.url}\"\n          target=\"_blank\"\n          rel=\"noopener\"\n          class=\"bounty-card\"\n        >\n          <div class=\"bounty-content\">\n            <div class=\"bounty-reward\">${bounty.reward_formatted}</div>\n            <div class=\"bounty-issue\">${bounty.task.repo_name}#${bounty.task.number}</div>\n            <div class=\"bounty-title\">${bounty.task.title}</div>\n          </div>\n        </a>\n      `;\n    });\n  } catch (error) {\n    console.error(\"Algora SDK: Failed to fetch bounties\", error);\n  }\n}\n\n// Export for IIFE bundle\nif (typeof window !== \"undefined\") {\n  (window as any).Algora = { algora, init };\n\n  // Auto-initialize when script loads\n  if (document.readyState === \"loading\") {\n    document.addEventListener(\"DOMContentLoaded\", () => init());\n  } else {\n    init();\n  }\n}\n","function identity(x) {\n    return x;\n}\n\n/** @internal */ function pipeFromArray(fns) {\n    if (fns.length === 0) {\n        return identity;\n    }\n    if (fns.length === 1) {\n        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n        return fns[0];\n    }\n    return function piped(input) {\n        return fns.reduce((prev, fn)=>fn(prev), input);\n    };\n}\n\nfunction isObservable(x) {\n    return typeof x === 'object' && x !== null && 'subscribe' in x;\n}\nfunction observable(subscribe) {\n    const self = {\n        subscribe (observer) {\n            let teardownRef = null;\n            let isDone = false;\n            let unsubscribed = false;\n            let teardownImmediately = false;\n            function unsubscribe() {\n                if (teardownRef === null) {\n                    teardownImmediately = true;\n                    return;\n                }\n                if (unsubscribed) {\n                    return;\n                }\n                unsubscribed = true;\n                if (typeof teardownRef === 'function') {\n                    teardownRef();\n                } else if (teardownRef) {\n                    teardownRef.unsubscribe();\n                }\n            }\n            teardownRef = subscribe({\n                next (value) {\n                    if (isDone) {\n                        return;\n                    }\n                    observer.next?.(value);\n                },\n                error (err) {\n                    if (isDone) {\n                        return;\n                    }\n                    isDone = true;\n                    observer.error?.(err);\n                    unsubscribe();\n                },\n                complete () {\n                    if (isDone) {\n                        return;\n                    }\n                    isDone = true;\n                    observer.complete?.();\n                    unsubscribe();\n                }\n            });\n            if (teardownImmediately) {\n                unsubscribe();\n            }\n            return {\n                unsubscribe\n            };\n        },\n        pipe (...operations) {\n            return pipeFromArray(operations)(self);\n        }\n    };\n    return self;\n}\n\nexport { isObservable as i, observable as o };\n","export { i as isObservable, o as observable } from '../observable-ade1bad8.mjs';\n\nfunction share(_opts) {\n    return (originalObserver)=>{\n        let refCount = 0;\n        let subscription = null;\n        const observers = [];\n        function startIfNeeded() {\n            if (subscription) {\n                return;\n            }\n            subscription = originalObserver.subscribe({\n                next (value) {\n                    for (const observer of observers){\n                        observer.next?.(value);\n                    }\n                },\n                error (error) {\n                    for (const observer of observers){\n                        observer.error?.(error);\n                    }\n                },\n                complete () {\n                    for (const observer of observers){\n                        observer.complete?.();\n                    }\n                }\n            });\n        }\n        function resetIfNeeded() {\n            // \"resetOnRefCountZero\"\n            if (refCount === 0 && subscription) {\n                const _sub = subscription;\n                subscription = null;\n                _sub.unsubscribe();\n            }\n        }\n        return {\n            subscribe (observer) {\n                refCount++;\n                observers.push(observer);\n                startIfNeeded();\n                return {\n                    unsubscribe () {\n                        refCount--;\n                        resetIfNeeded();\n                        const index = observers.findIndex((v)=>v === observer);\n                        if (index > -1) {\n                            observers.splice(index, 1);\n                        }\n                    }\n                };\n            }\n        };\n    };\n}\n\nfunction map(project) {\n    return (originalObserver)=>{\n        return {\n            subscribe (observer) {\n                let index = 0;\n                const subscription = originalObserver.subscribe({\n                    next (value) {\n                        observer.next?.(project(value, index++));\n                    },\n                    error (error) {\n                        observer.error?.(error);\n                    },\n                    complete () {\n                        observer.complete?.();\n                    }\n                });\n                return subscription;\n            }\n        };\n    };\n}\n\nfunction tap(observer) {\n    return (originalObserver)=>{\n        return {\n            subscribe (observer2) {\n                return originalObserver.subscribe({\n                    next (v) {\n                        observer.next?.(v);\n                        observer2.next?.(v);\n                    },\n                    error (v) {\n                        observer.error?.(v);\n                        observer2.error?.(v);\n                    },\n                    complete () {\n                        observer.complete?.();\n                        observer2.complete?.();\n                    }\n                });\n            }\n        };\n    };\n}\n\nclass ObservableAbortError extends Error {\n    constructor(message){\n        super(message);\n        this.name = 'ObservableAbortError';\n        Object.setPrototypeOf(this, ObservableAbortError.prototype);\n    }\n}\n/** @internal */ function observableToPromise(observable) {\n    let abort;\n    const promise = new Promise((resolve, reject)=>{\n        let isDone = false;\n        function onDone() {\n            if (isDone) {\n                return;\n            }\n            isDone = true;\n            reject(new ObservableAbortError('This operation was aborted.'));\n            obs$.unsubscribe();\n        }\n        const obs$ = observable.subscribe({\n            next (data) {\n                isDone = true;\n                resolve(data);\n                onDone();\n            },\n            error (data) {\n                isDone = true;\n                reject(data);\n                onDone();\n            },\n            complete () {\n                isDone = true;\n                onDone();\n            }\n        });\n        abort = onDone;\n    });\n    return {\n        promise,\n        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n        abort: abort\n    };\n}\n\nexport { map, observableToPromise, share, tap };\n","import { observable } from '@trpc/server/observable';\n\n/** @internal */ function createChain(opts) {\n    return observable((observer)=>{\n        function execute(index = 0, op = opts.op) {\n            const next = opts.links[index];\n            if (!next) {\n                throw new Error('No more links to execute - did you forget to add an ending link?');\n            }\n            const subscription = next({\n                op,\n                next (nextOp) {\n                    const nextObserver = execute(index + 1, nextOp);\n                    return nextObserver;\n                }\n            });\n            return subscription;\n        }\n        const obs$ = execute();\n        return obs$.subscribe(observer);\n    });\n}\n\nfunction asArray(value) {\n    return Array.isArray(value) ? value : [\n        value\n    ];\n}\nfunction splitLink(opts) {\n    return (runtime)=>{\n        const yes = asArray(opts.true).map((link)=>link(runtime));\n        const no = asArray(opts.false).map((link)=>link(runtime));\n        return (props)=>{\n            return observable((observer)=>{\n                const links = opts.condition(props.op) ? yes : no;\n                return createChain({\n                    op: props.op,\n                    links\n                }).subscribe(observer);\n            });\n        };\n    };\n}\n\nexport { createChain as c, splitLink as s };\n","function isTRPCClientError(cause) {\n    return cause instanceof TRPCClientError || /**\n     * @deprecated\n     * Delete in next major\n     */ cause.name === 'TRPCClientError';\n}\nclass TRPCClientError extends Error {\n    static from(cause, opts = {}) {\n        if (!(cause instanceof Error)) {\n            return new TRPCClientError(cause.error.message ?? '', {\n                ...opts,\n                cause: undefined,\n                result: cause\n            });\n        }\n        if (isTRPCClientError(cause)) {\n            if (opts.meta) {\n                // Decorate with meta error data\n                cause.meta = {\n                    ...cause.meta,\n                    ...opts.meta\n                };\n            }\n            return cause;\n        }\n        return new TRPCClientError(cause.message, {\n            ...opts,\n            cause,\n            result: null\n        });\n    }\n    constructor(message, opts){\n        const cause = opts?.cause;\n        // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n        // @ts-ignore https://github.com/tc39/proposal-error-cause\n        super(message, {\n            cause\n        });\n        this.meta = opts?.meta;\n        this.cause = cause;\n        this.shape = opts?.result?.error;\n        this.data = opts?.result?.error.data;\n        this.name = 'TRPCClientError';\n        Object.setPrototypeOf(this, TRPCClientError.prototype);\n    }\n}\n\nexport { TRPCClientError as T };\n","/**\n * @internal\n */ function invert(obj) {\n    const newObj = Object.create(null);\n    for(const key in obj){\n        const v = obj[key];\n        newObj[v] = key;\n    }\n    return newObj;\n}\n\n// reference: https://www.jsonrpc.org/specification\n/**\n * JSON-RPC 2.0 Error codes\n *\n * `-32000` to `-32099` are reserved for implementation-defined server-errors.\n * For tRPC we're copying the last digits of HTTP 4XX errors.\n */ const TRPC_ERROR_CODES_BY_KEY = {\n    /**\n   * Invalid JSON was received by the server.\n   * An error occurred on the server while parsing the JSON text.\n   */ PARSE_ERROR: -32700,\n    /**\n   * The JSON sent is not a valid Request object.\n   */ BAD_REQUEST: -32600,\n    // Internal JSON-RPC error\n    INTERNAL_SERVER_ERROR: -32603,\n    NOT_IMPLEMENTED: -32603,\n    // Implementation specific errors\n    UNAUTHORIZED: -32001,\n    FORBIDDEN: -32003,\n    NOT_FOUND: -32004,\n    METHOD_NOT_SUPPORTED: -32005,\n    TIMEOUT: -32008,\n    CONFLICT: -32009,\n    PRECONDITION_FAILED: -32012,\n    PAYLOAD_TOO_LARGE: -32013,\n    UNPROCESSABLE_CONTENT: -32022,\n    TOO_MANY_REQUESTS: -32029,\n    CLIENT_CLOSED_REQUEST: -32099\n};\nconst TRPC_ERROR_CODES_BY_NUMBER = invert(TRPC_ERROR_CODES_BY_KEY);\n\nexport { TRPC_ERROR_CODES_BY_KEY as T, TRPC_ERROR_CODES_BY_NUMBER as a, invert as i };\n","import { i as invert, T as TRPC_ERROR_CODES_BY_KEY } from './codes-c924c3db.mjs';\n\nconst TRPC_ERROR_CODES_BY_NUMBER = invert(TRPC_ERROR_CODES_BY_KEY);\nconst JSONRPC2_TO_HTTP_CODE = {\n    PARSE_ERROR: 400,\n    BAD_REQUEST: 400,\n    UNAUTHORIZED: 401,\n    NOT_FOUND: 404,\n    FORBIDDEN: 403,\n    METHOD_NOT_SUPPORTED: 405,\n    TIMEOUT: 408,\n    CONFLICT: 409,\n    PRECONDITION_FAILED: 412,\n    PAYLOAD_TOO_LARGE: 413,\n    UNPROCESSABLE_CONTENT: 422,\n    TOO_MANY_REQUESTS: 429,\n    CLIENT_CLOSED_REQUEST: 499,\n    INTERNAL_SERVER_ERROR: 500,\n    NOT_IMPLEMENTED: 501\n};\nfunction getStatusCodeFromKey(code) {\n    return JSONRPC2_TO_HTTP_CODE[code] ?? 500;\n}\nfunction getHTTPStatusCode(json) {\n    const arr = Array.isArray(json) ? json : [\n        json\n    ];\n    const httpStatuses = new Set(arr.map((res)=>{\n        if ('error' in res) {\n            const data = res.error.data;\n            if (typeof data.httpStatus === 'number') {\n                return data.httpStatus;\n            }\n            const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];\n            return getStatusCodeFromKey(code);\n        }\n        return 200;\n    }));\n    if (httpStatuses.size !== 1) {\n        return 207;\n    }\n    const httpStatus = httpStatuses.values().next().value;\n    return httpStatus;\n}\nfunction getHTTPStatusCodeFromError(error) {\n    return getStatusCodeFromKey(error.code);\n}\n\nconst noop = ()=>{\n// noop\n};\nfunction createInnerProxy(callback, path) {\n    const proxy = new Proxy(noop, {\n        get (_obj, key) {\n            if (typeof key !== 'string' || key === 'then') {\n                // special case for if the proxy is accidentally treated\n                // like a PromiseLike (like in `Promise.resolve(proxy)`)\n                return undefined;\n            }\n            return createInnerProxy(callback, [\n                ...path,\n                key\n            ]);\n        },\n        apply (_1, _2, args) {\n            const isApply = path[path.length - 1] === 'apply';\n            return callback({\n                args: isApply ? args.length >= 2 ? args[1] : [] : args,\n                path: isApply ? path.slice(0, -1) : path\n            });\n        }\n    });\n    return proxy;\n}\n/**\n * Creates a proxy that calls the callback with the path and arguments\n *\n * @internal\n */ const createRecursiveProxy = (callback)=>createInnerProxy(callback, []);\n/**\n * Used in place of `new Proxy` where each handler will map 1 level deep to another value.\n *\n * @internal\n */ const createFlatProxy = (callback)=>{\n    return new Proxy(noop, {\n        get (_obj, name) {\n            if (typeof name !== 'string' || name === 'then') {\n                // special case for if the proxy is accidentally treated\n                // like a PromiseLike (like in `Promise.resolve(proxy)`)\n                return undefined;\n            }\n            return callback(name);\n        }\n    });\n};\n\nexport { TRPC_ERROR_CODES_BY_NUMBER as T, createRecursiveProxy as a, getHTTPStatusCode as b, createFlatProxy as c, getHTTPStatusCodeFromError as g };\n","import { T as TRPCClientError } from './TRPCClientError-fef6cf44.mjs';\n\nconst isFunction = (fn)=>typeof fn === 'function';\nfunction getFetch(customFetchImpl) {\n    if (customFetchImpl) {\n        return customFetchImpl;\n    }\n    if (typeof window !== 'undefined' && isFunction(window.fetch)) {\n        return window.fetch;\n    }\n    if (typeof globalThis !== 'undefined' && isFunction(globalThis.fetch)) {\n        return globalThis.fetch;\n    }\n    throw new Error('No fetch implementation found');\n}\n\nfunction getAbortController(customAbortControllerImpl) {\n    if (customAbortControllerImpl) {\n        return customAbortControllerImpl;\n    }\n    // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n    if (typeof window !== 'undefined' && window.AbortController) {\n        return window.AbortController;\n    }\n    // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n    if (typeof globalThis !== 'undefined' && globalThis.AbortController) {\n        return globalThis.AbortController;\n    }\n    return null;\n}\n\nfunction resolveHTTPLinkOptions(opts) {\n    return {\n        url: opts.url,\n        fetch: opts.fetch,\n        AbortController: getAbortController(opts.AbortController)\n    };\n}\n// https://github.com/trpc/trpc/pull/669\nfunction arrayToDict(array) {\n    const dict = {};\n    for(let index = 0; index < array.length; index++){\n        const element = array[index];\n        dict[index] = element;\n    }\n    return dict;\n}\nconst METHOD = {\n    query: 'GET',\n    mutation: 'POST'\n};\nfunction getInput(opts) {\n    return 'input' in opts ? opts.runtime.transformer.serialize(opts.input) : arrayToDict(opts.inputs.map((_input)=>opts.runtime.transformer.serialize(_input)));\n}\nconst getUrl = (opts)=>{\n    let url = opts.url + '/' + opts.path;\n    const queryParts = [];\n    if ('inputs' in opts) {\n        queryParts.push('batch=1');\n    }\n    if (opts.type === 'query') {\n        const input = getInput(opts);\n        if (input !== undefined) {\n            queryParts.push(`input=${encodeURIComponent(JSON.stringify(input))}`);\n        }\n    }\n    if (queryParts.length) {\n        url += '?' + queryParts.join('&');\n    }\n    return url;\n};\nconst getBody = (opts)=>{\n    if (opts.type === 'query') {\n        return undefined;\n    }\n    const input = getInput(opts);\n    return input !== undefined ? JSON.stringify(input) : undefined;\n};\nconst jsonHttpRequester = (opts)=>{\n    return httpRequest({\n        ...opts,\n        contentTypeHeader: 'application/json',\n        getUrl,\n        getBody\n    });\n};\nasync function fetchHTTPResponse(opts, ac) {\n    const url = opts.getUrl(opts);\n    const body = opts.getBody(opts);\n    const { type  } = opts;\n    const resolvedHeaders = await opts.headers();\n    /* istanbul ignore if -- @preserve */ if (type === 'subscription') {\n        throw new Error('Subscriptions should use wsLink');\n    }\n    const headers = {\n        ...opts.contentTypeHeader ? {\n            'content-type': opts.contentTypeHeader\n        } : {},\n        ...opts.batchModeHeader ? {\n            'trpc-batch-mode': opts.batchModeHeader\n        } : {},\n        ...resolvedHeaders\n    };\n    return getFetch(opts.fetch)(url, {\n        method: METHOD[type],\n        signal: ac?.signal,\n        body: body,\n        headers\n    });\n}\nfunction httpRequest(opts) {\n    const ac = opts.AbortController ? new opts.AbortController() : null;\n    const meta = {};\n    const promise = new Promise((resolve, reject)=>{\n        fetchHTTPResponse(opts, ac).then((_res)=>{\n            meta.response = _res;\n            return _res.json();\n        }).then((json)=>{\n            meta.responseJSON = json;\n            resolve({\n                json: json,\n                meta\n            });\n        }).catch((err)=>{\n            reject(TRPCClientError.from(err, {\n                meta\n            }));\n        });\n    });\n    const cancel = ()=>{\n        ac?.abort();\n    };\n    return {\n        promise,\n        cancel\n    };\n}\n\nexport { getBody as a, getFetch as b, fetchHTTPResponse as f, getUrl as g, httpRequest as h, jsonHttpRequester as j, resolveHTTPLinkOptions as r };\n","function isObject(value) {\n    // check that value is object\n    return !!value && !Array.isArray(value) && typeof value === 'object';\n}\n\n// FIXME:\n// - the generics here are probably unnecessary\n// - the RPC-spec could probably be simplified to combine HTTP + WS\n/** @internal */ function transformResultInner(response, runtime) {\n    if ('error' in response) {\n        const error = runtime.transformer.deserialize(response.error);\n        return {\n            ok: false,\n            error: {\n                ...response,\n                error\n            }\n        };\n    }\n    const result = {\n        ...response.result,\n        ...(!response.result.type || response.result.type === 'data') && {\n            type: 'data',\n            data: runtime.transformer.deserialize(response.result.data)\n        }\n    };\n    return {\n        ok: true,\n        result\n    };\n}\nclass TransformResultError extends Error {\n    constructor(){\n        super('Unable to transform response from server');\n    }\n}\n/**\n * Transforms and validates that the result is a valid TRPCResponse\n * @internal\n */ function transformResult(response, runtime) {\n    let result;\n    try {\n        // Use the data transformers on the JSON-response\n        result = transformResultInner(response, runtime);\n    } catch (err) {\n        throw new TransformResultError();\n    }\n    // check that output of the transformers is a valid TRPCResponse\n    if (!result.ok && (!isObject(result.error.error) || typeof result.error.error.code !== 'number')) {\n        throw new TransformResultError();\n    }\n    if (result.ok && !isObject(result.result)) {\n        throw new TransformResultError();\n    }\n    return result;\n}\n\nexport { transformResult as t };\n","import { observable } from '@trpc/server/observable';\nimport { t as transformResult } from './transformResult-7ab522e6.mjs';\nimport { T as TRPCClientError } from './TRPCClientError-fef6cf44.mjs';\nimport { r as resolveHTTPLinkOptions, g as getUrl, j as jsonHttpRequester } from './httpUtils-ad76b802.mjs';\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */ /**\n * A function that should never be called unless we messed something up.\n */ const throwFatalError = ()=>{\n    throw new Error('Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new');\n};\n/**\n * Dataloader that's very inspired by https://github.com/graphql/dataloader\n * Less configuration, no caching, and allows you to cancel requests\n * When cancelling a single fetch the whole batch will be cancelled only when _all_ items are cancelled\n */ function dataLoader(batchLoader) {\n    let pendingItems = null;\n    let dispatchTimer = null;\n    const destroyTimerAndPendingItems = ()=>{\n        clearTimeout(dispatchTimer);\n        dispatchTimer = null;\n        pendingItems = null;\n    };\n    /**\n   * Iterate through the items and split them into groups based on the `batchLoader`'s validate function\n   */ function groupItems(items) {\n        const groupedItems = [\n            []\n        ];\n        let index = 0;\n        while(true){\n            const item = items[index];\n            if (!item) {\n                break;\n            }\n            const lastGroup = groupedItems[groupedItems.length - 1];\n            if (item.aborted) {\n                // Item was aborted before it was dispatched\n                item.reject?.(new Error('Aborted'));\n                index++;\n                continue;\n            }\n            const isValid = batchLoader.validate(lastGroup.concat(item).map((it)=>it.key));\n            if (isValid) {\n                lastGroup.push(item);\n                index++;\n                continue;\n            }\n            if (lastGroup.length === 0) {\n                item.reject?.(new Error('Input is too big for a single dispatch'));\n                index++;\n                continue;\n            }\n            // Create new group, next iteration will try to add the item to that\n            groupedItems.push([]);\n        }\n        return groupedItems;\n    }\n    function dispatch() {\n        const groupedItems = groupItems(pendingItems);\n        destroyTimerAndPendingItems();\n        // Create batches for each group of items\n        for (const items of groupedItems){\n            if (!items.length) {\n                continue;\n            }\n            const batch = {\n                items,\n                cancel: throwFatalError\n            };\n            for (const item of items){\n                item.batch = batch;\n            }\n            const unitResolver = (index, value)=>{\n                const item = batch.items[index];\n                item.resolve?.(value);\n                item.batch = null;\n                item.reject = null;\n                item.resolve = null;\n            };\n            const { promise , cancel  } = batchLoader.fetch(batch.items.map((_item)=>_item.key), unitResolver);\n            batch.cancel = cancel;\n            promise.then((result)=>{\n                for(let i = 0; i < result.length; i++){\n                    const value = result[i];\n                    unitResolver(i, value);\n                }\n                for (const item of batch.items){\n                    item.reject?.(new Error('Missing result'));\n                    item.batch = null;\n                }\n            }).catch((cause)=>{\n                for (const item of batch.items){\n                    item.reject?.(cause);\n                    item.batch = null;\n                }\n            });\n        }\n    }\n    function load(key) {\n        const item = {\n            aborted: false,\n            key,\n            batch: null,\n            resolve: throwFatalError,\n            reject: throwFatalError\n        };\n        const promise = new Promise((resolve, reject)=>{\n            item.reject = reject;\n            item.resolve = resolve;\n            if (!pendingItems) {\n                pendingItems = [];\n            }\n            pendingItems.push(item);\n        });\n        if (!dispatchTimer) {\n            dispatchTimer = setTimeout(dispatch);\n        }\n        const cancel = ()=>{\n            item.aborted = true;\n            if (item.batch?.items.every((item)=>item.aborted)) {\n                // All items in the batch have been cancelled\n                item.batch.cancel();\n                item.batch = null;\n            }\n        };\n        return {\n            promise,\n            cancel\n        };\n    }\n    return {\n        load\n    };\n}\n\n/**\n * @internal\n */ function createHTTPBatchLink(requester) {\n    return function httpBatchLink(opts) {\n        const resolvedOpts = resolveHTTPLinkOptions(opts);\n        const maxURLLength = opts.maxURLLength ?? Infinity;\n        // initialized config\n        return (runtime)=>{\n            const batchLoader = (type)=>{\n                const validate = (batchOps)=>{\n                    if (maxURLLength === Infinity) {\n                        // escape hatch for quick calcs\n                        return true;\n                    }\n                    const path = batchOps.map((op)=>op.path).join(',');\n                    const inputs = batchOps.map((op)=>op.input);\n                    const url = getUrl({\n                        ...resolvedOpts,\n                        runtime,\n                        type,\n                        path,\n                        inputs\n                    });\n                    return url.length <= maxURLLength;\n                };\n                const fetch = requester({\n                    ...resolvedOpts,\n                    runtime,\n                    type,\n                    opts\n                });\n                return {\n                    validate,\n                    fetch\n                };\n            };\n            const query = dataLoader(batchLoader('query'));\n            const mutation = dataLoader(batchLoader('mutation'));\n            const subscription = dataLoader(batchLoader('subscription'));\n            const loaders = {\n                query,\n                subscription,\n                mutation\n            };\n            return ({ op  })=>{\n                return observable((observer)=>{\n                    const loader = loaders[op.type];\n                    const { promise , cancel  } = loader.load(op);\n                    let _res = undefined;\n                    promise.then((res)=>{\n                        _res = res;\n                        const transformed = transformResult(res.json, runtime);\n                        if (!transformed.ok) {\n                            observer.error(TRPCClientError.from(transformed.error, {\n                                meta: res.meta\n                            }));\n                            return;\n                        }\n                        observer.next({\n                            context: res.meta,\n                            result: transformed.result\n                        });\n                        observer.complete();\n                    }).catch((err)=>{\n                        observer.error(TRPCClientError.from(err, {\n                            meta: _res?.meta\n                        }));\n                    });\n                    return ()=>{\n                        cancel();\n                    };\n                });\n            };\n        };\n    };\n}\n\nconst batchRequester = (requesterOpts)=>{\n    return (batchOps)=>{\n        const path = batchOps.map((op)=>op.path).join(',');\n        const inputs = batchOps.map((op)=>op.input);\n        const { promise , cancel  } = jsonHttpRequester({\n            ...requesterOpts,\n            path,\n            inputs,\n            headers () {\n                if (!requesterOpts.opts.headers) {\n                    return {};\n                }\n                if (typeof requesterOpts.opts.headers === 'function') {\n                    return requesterOpts.opts.headers({\n                        opList: batchOps\n                    });\n                }\n                return requesterOpts.opts.headers;\n            }\n        });\n        return {\n            promise: promise.then((res)=>{\n                const resJSON = Array.isArray(res.json) ? res.json : batchOps.map(()=>res.json);\n                const result = resJSON.map((item)=>({\n                        meta: res.meta,\n                        json: item\n                    }));\n                return result;\n            }),\n            cancel\n        };\n    };\n};\nconst httpBatchLink = createHTTPBatchLink(batchRequester);\n\nexport { createHTTPBatchLink as c, httpBatchLink as h };\n","import { observable } from '@trpc/server/observable';\nimport { t as transformResult } from '../transformResult-7ab522e6.mjs';\nimport { T as TRPCClientError } from '../TRPCClientError-fef6cf44.mjs';\nimport { r as resolveHTTPLinkOptions, j as jsonHttpRequester } from '../httpUtils-ad76b802.mjs';\n\nfunction httpLinkFactory(factoryOpts) {\n    return (opts)=>{\n        const resolvedOpts = resolveHTTPLinkOptions(opts);\n        return (runtime)=>({ op  })=>observable((observer)=>{\n                    const { path , input , type  } = op;\n                    const { promise , cancel  } = factoryOpts.requester({\n                        ...resolvedOpts,\n                        runtime,\n                        type,\n                        path,\n                        input,\n                        headers () {\n                            if (!opts.headers) {\n                                return {};\n                            }\n                            if (typeof opts.headers === 'function') {\n                                return opts.headers({\n                                    op\n                                });\n                            }\n                            return opts.headers;\n                        }\n                    });\n                    let meta = undefined;\n                    promise.then((res)=>{\n                        meta = res.meta;\n                        const transformed = transformResult(res.json, runtime);\n                        if (!transformed.ok) {\n                            observer.error(TRPCClientError.from(transformed.error, {\n                                meta\n                            }));\n                            return;\n                        }\n                        observer.next({\n                            context: res.meta,\n                            result: transformed.result\n                        });\n                        observer.complete();\n                    }).catch((cause)=>{\n                        observer.error(TRPCClientError.from(cause, {\n                            meta\n                        }));\n                    });\n                    return ()=>{\n                        cancel();\n                    };\n                });\n    };\n}\nconst httpLink = httpLinkFactory({\n    requester: jsonHttpRequester\n});\n\nexport { httpLink, httpLinkFactory };\n","import { share, observableToPromise } from '@trpc/server/observable';\nimport { c as createChain } from './splitLink-4c75f7be.mjs';\nexport { s as splitLink } from './splitLink-4c75f7be.mjs';\nimport { T as TRPCClientError } from './TRPCClientError-fef6cf44.mjs';\nexport { T as TRPCClientError } from './TRPCClientError-fef6cf44.mjs';\nimport { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared';\nimport { f as fetchHTTPResponse, g as getUrl, a as getBody$1, h as httpRequest } from './httpUtils-ad76b802.mjs';\nexport { b as getFetch } from './httpUtils-ad76b802.mjs';\nimport { c as createHTTPBatchLink } from './httpBatchLink-520db465.mjs';\nexport { h as httpBatchLink } from './httpBatchLink-520db465.mjs';\nimport { httpLinkFactory } from './links/httpLink.mjs';\nexport { httpLink, httpLinkFactory } from './links/httpLink.mjs';\nexport { loggerLink } from './links/loggerLink.mjs';\nexport { createWSClient, wsLink } from './links/wsLink.mjs';\nimport './transformResult-7ab522e6.mjs';\n\nclass TRPCUntypedClient {\n    $request({ type , input , path , context ={}  }) {\n        const chain$ = createChain({\n            links: this.links,\n            op: {\n                id: ++this.requestId,\n                type,\n                path,\n                input,\n                context\n            }\n        });\n        return chain$.pipe(share());\n    }\n    requestAsPromise(opts) {\n        const req$ = this.$request(opts);\n        const { promise , abort  } = observableToPromise(req$);\n        const abortablePromise = new Promise((resolve, reject)=>{\n            opts.signal?.addEventListener('abort', abort);\n            promise.then((envelope)=>{\n                resolve(envelope.result.data);\n            }).catch((err)=>{\n                reject(TRPCClientError.from(err));\n            });\n        });\n        return abortablePromise;\n    }\n    query(path, input, opts) {\n        return this.requestAsPromise({\n            type: 'query',\n            path,\n            input,\n            context: opts?.context,\n            signal: opts?.signal\n        });\n    }\n    mutation(path, input, opts) {\n        return this.requestAsPromise({\n            type: 'mutation',\n            path,\n            input,\n            context: opts?.context,\n            signal: opts?.signal\n        });\n    }\n    subscription(path, input, opts) {\n        const observable$ = this.$request({\n            type: 'subscription',\n            path,\n            input,\n            context: opts?.context\n        });\n        return observable$.subscribe({\n            next (envelope) {\n                if (envelope.result.type === 'started') {\n                    opts.onStarted?.();\n                } else if (envelope.result.type === 'stopped') {\n                    opts.onStopped?.();\n                } else {\n                    opts.onData?.(envelope.result.data);\n                }\n            },\n            error (err) {\n                opts.onError?.(err);\n            },\n            complete () {\n                opts.onComplete?.();\n            }\n        });\n    }\n    constructor(opts){\n        this.requestId = 0;\n        const combinedTransformer = (()=>{\n            const transformer = opts.transformer;\n            if (!transformer) {\n                return {\n                    input: {\n                        serialize: (data)=>data,\n                        deserialize: (data)=>data\n                    },\n                    output: {\n                        serialize: (data)=>data,\n                        deserialize: (data)=>data\n                    }\n                };\n            }\n            if ('input' in transformer) {\n                return opts.transformer;\n            }\n            return {\n                input: transformer,\n                output: transformer\n            };\n        })();\n        this.runtime = {\n            transformer: {\n                serialize: (data)=>combinedTransformer.input.serialize(data),\n                deserialize: (data)=>combinedTransformer.output.deserialize(data)\n            },\n            combinedTransformer\n        };\n        // Initialize the links\n        this.links = opts.links.map((link)=>link(this.runtime));\n    }\n}\n\nfunction createTRPCUntypedClient(opts) {\n    return new TRPCUntypedClient(opts);\n}\n\n/**\n * @deprecated use `createTRPCProxyClient` instead\n */ function createTRPCClient(opts) {\n    const client = new TRPCUntypedClient(opts);\n    return client;\n}\n\nconst clientCallTypeMap = {\n    query: 'query',\n    mutate: 'mutation',\n    subscribe: 'subscription'\n};\n/** @internal */ const clientCallTypeToProcedureType = (clientCallType)=>{\n    return clientCallTypeMap[clientCallType];\n};\n/**\n * @deprecated use `createTRPCProxyClient` instead\n * @internal\n */ function createTRPCClientProxy(client) {\n    return createFlatProxy((key)=>{\n        if (client.hasOwnProperty(key)) {\n            return client[key];\n        }\n        if (key === '__untypedClient') {\n            return client;\n        }\n        return createRecursiveProxy(({ path , args  })=>{\n            const pathCopy = [\n                key,\n                ...path\n            ];\n            const procedureType = clientCallTypeToProcedureType(pathCopy.pop());\n            const fullPath = pathCopy.join('.');\n            return client[procedureType](fullPath, ...args);\n        });\n    });\n}\nfunction createTRPCProxyClient(opts) {\n    const client = new TRPCUntypedClient(opts);\n    const proxy = createTRPCClientProxy(client);\n    return proxy;\n}\n/**\n * Get an untyped client from a proxy client\n * @internal\n */ function getUntypedClient(client) {\n    return client.__untypedClient;\n}\n\nfunction getTextDecoder(customTextDecoder) {\n    if (customTextDecoder) {\n        return customTextDecoder;\n    }\n    // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n    if (typeof window !== 'undefined' && window.TextDecoder) {\n        return new window.TextDecoder();\n    }\n    // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n    if (typeof globalThis !== 'undefined' && globalThis.TextDecoder) {\n        return new globalThis.TextDecoder();\n    }\n    throw new Error('No TextDecoder implementation found');\n}\n\n// Stream parsing adapted from https://www.loginradius.com/blog/engineering/guest-post/http-streaming-with-nodejs-and-fetch-api/\n/**\n * @internal\n * @description Take a stream of bytes and call `onLine` with\n * a JSON object for each line in the stream. Expected stream\n * format is:\n * ```json\n * {\"1\": {...}\n * ,\"0\": {...}\n * }\n * ```\n */ async function parseJSONStream(opts) {\n    const parse = opts.parse ?? JSON.parse;\n    const onLine = (line)=>{\n        if (opts.signal?.aborted) return;\n        if (!line || line === '}') {\n            return;\n        }\n        /**\n     * At this point, `line` can be one of two things:\n     * - The first line of the stream `{\"2\":{...}`\n     * - A line in the middle of the stream `,\"2\":{...}`\n     */ const indexOfColon = line.indexOf(':');\n        const indexAsStr = line.substring(2, indexOfColon - 1);\n        const text = line.substring(indexOfColon + 1);\n        opts.onSingle(Number(indexAsStr), parse(text));\n    };\n    await readLines(opts.readableStream, onLine, opts.textDecoder);\n}\n/**\n * Handle transforming a stream of bytes into lines of text.\n * To avoid using AsyncIterators / AsyncGenerators,\n * we use a callback for each line.\n *\n * @param readableStream can be a NodeJS stream or a WebAPI stream\n * @param onLine will be called for every line ('\\n' delimited) in the stream\n */ async function readLines(readableStream, onLine, textDecoder) {\n    let partOfLine = '';\n    const onChunk = (chunk)=>{\n        const chunkText = textDecoder.decode(chunk);\n        const chunkLines = chunkText.split('\\n');\n        if (chunkLines.length === 1) {\n            partOfLine += chunkLines[0];\n        } else if (chunkLines.length > 1) {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- length checked on line above\n            onLine(partOfLine + chunkLines[0]);\n            for(let i = 1; i < chunkLines.length - 1; i++){\n                // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- length checked on line above\n                onLine(chunkLines[i]);\n            }\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- length doesn't change, so is necessarily > 1\n            partOfLine = chunkLines[chunkLines.length - 1];\n        }\n    };\n    // we handle 2 different types of streams, this if where we figure out which one we have\n    if ('getReader' in readableStream) {\n        await readStandardChunks(readableStream, onChunk);\n    } else {\n        await readNodeChunks(readableStream, onChunk);\n    }\n    onLine(partOfLine);\n}\n/**\n * Handle NodeJS stream\n */ function readNodeChunks(stream, onChunk) {\n    return new Promise((resolve)=>{\n        stream.on('data', onChunk);\n        stream.on('end', resolve);\n    });\n}\n/**\n * Handle WebAPI stream\n */ async function readStandardChunks(stream, onChunk) {\n    const reader = stream.getReader();\n    let readResult = await reader.read();\n    while(!readResult.done){\n        onChunk(readResult.value);\n        readResult = await reader.read();\n    }\n}\nconst streamingJsonHttpRequester = (opts, onSingle)=>{\n    const ac = opts.AbortController ? new opts.AbortController() : null;\n    const responsePromise = fetchHTTPResponse({\n        ...opts,\n        contentTypeHeader: 'application/json',\n        batchModeHeader: 'stream',\n        getUrl,\n        getBody: getBody$1\n    }, ac);\n    const cancel = ()=>ac?.abort();\n    const promise = responsePromise.then(async (res)=>{\n        if (!res.body) throw new Error('Received response without body');\n        const meta = {\n            response: res\n        };\n        return parseJSONStream({\n            readableStream: res.body,\n            onSingle,\n            parse: (string)=>({\n                    json: JSON.parse(string),\n                    meta\n                }),\n            signal: ac?.signal,\n            textDecoder: opts.textDecoder\n        });\n    });\n    return {\n        cancel,\n        promise\n    };\n};\n\nconst streamRequester = (requesterOpts)=>{\n    const textDecoder = getTextDecoder(requesterOpts.opts.textDecoder);\n    return (batchOps, unitResolver)=>{\n        const path = batchOps.map((op)=>op.path).join(',');\n        const inputs = batchOps.map((op)=>op.input);\n        const { cancel , promise  } = streamingJsonHttpRequester({\n            ...requesterOpts,\n            textDecoder,\n            path,\n            inputs,\n            headers () {\n                if (!requesterOpts.opts.headers) {\n                    return {};\n                }\n                if (typeof requesterOpts.opts.headers === 'function') {\n                    return requesterOpts.opts.headers({\n                        opList: batchOps\n                    });\n                }\n                return requesterOpts.opts.headers;\n            }\n        }, (index, res)=>{\n            unitResolver(index, res);\n        });\n        return {\n            /**\n       * return an empty array because the batchLoader expects an array of results\n       * but we've already called the `unitResolver` for each of them, there's\n       * nothing left to do here.\n       */ promise: promise.then(()=>[]),\n            cancel\n        };\n    };\n};\nconst unstable_httpBatchStreamLink = createHTTPBatchLink(streamRequester);\n\nconst getBody = (opts)=>{\n    if (!('input' in opts)) {\n        return undefined;\n    }\n    if (!(opts.input instanceof FormData)) {\n        throw new Error('Input is not FormData');\n    }\n    return opts.input;\n};\nconst formDataRequester = (opts)=>{\n    if (opts.type !== 'mutation') {\n        // TODO(?) handle formdata queries\n        throw new Error('We only handle mutations with formdata');\n    }\n    return httpRequest({\n        ...opts,\n        getUrl () {\n            return `${opts.url}/${opts.path}`;\n        },\n        getBody\n    });\n};\nconst experimental_formDataLink = httpLinkFactory({\n    requester: formDataRequester\n});\n\nexport { clientCallTypeToProcedureType, createTRPCClient, createTRPCClientProxy, createTRPCProxyClient, createTRPCUntypedClient, experimental_formDataLink, getUntypedClient, unstable_httpBatchStreamLink };\n","export class DoubleIndexedKV<K, V> {\n  keyToValue = new Map<K, V>();\n  valueToKey = new Map<V, K>();\n\n  set(key: K, value: V) {\n    this.keyToValue.set(key, value);\n    this.valueToKey.set(value, key);\n  }\n\n  getByKey(key: K): V | undefined {\n    return this.keyToValue.get(key);\n  }\n\n  getByValue(value: V): K | undefined {\n    return this.valueToKey.get(value);\n  }\n\n  clear() {\n    this.keyToValue.clear();\n    this.valueToKey.clear();\n  }\n}\n","import { DoubleIndexedKV } from './double-indexed-kv';\n\nexport class Registry<T> {\n  private kv = new DoubleIndexedKV<string, T>();\n\n  constructor(private readonly generateIdentifier: (v: T) => string) {}\n\n  register(value: T, identifier?: string): void {\n    if (this.kv.getByValue(value)) {\n      return;\n    }\n\n    if (!identifier) {\n      identifier = this.generateIdentifier(value);\n    }\n\n    this.kv.set(identifier, value);\n  }\n\n  clear(): void {\n    this.kv.clear();\n  }\n\n  getIdentifier(value: T) {\n    return this.kv.getByValue(value);\n  }\n\n  getValue(identifier: string) {\n    return this.kv.getByKey(identifier);\n  }\n}\n","import { Registry } from './registry';\nimport { Class } from './types';\n\nexport interface RegisterOptions {\n  identifier?: string;\n  allowProps?: string[];\n}\n\nexport class ClassRegistry extends Registry<Class> {\n  constructor() {\n    super(c => c.name);\n  }\n\n  private classToAllowedProps = new Map<Class, string[]>();\n\n  register(value: Class, options?: string | RegisterOptions): void {\n    if (typeof options === 'object') {\n      if (options.allowProps) {\n        this.classToAllowedProps.set(value, options.allowProps);\n      }\n\n      super.register(value, options.identifier);\n    } else {\n      super.register(value, options);\n    }\n  }\n\n  getAllowedProps(value: Class): string[] | undefined {\n    return this.classToAllowedProps.get(value);\n  }\n}\n","function valuesOfObj<T>(record: Record<string, T>): T[] {\n  if ('values' in Object) {\n    // eslint-disable-next-line es5/no-es6-methods\n    return Object.values(record);\n  }\n\n  const values: T[] = [];\n\n  // eslint-disable-next-line no-restricted-syntax\n  for (const key in record) {\n    if (record.hasOwnProperty(key)) {\n      values.push(record[key]);\n    }\n  }\n\n  return values;\n}\n\nexport function find<T>(\n  record: Record<string, T>,\n  predicate: (v: T) => boolean\n): T | undefined {\n  const values = valuesOfObj(record);\n  if ('find' in values) {\n    // eslint-disable-next-line es5/no-es6-methods\n    return values.find(predicate);\n  }\n\n  const valuesNotNever = values as T[];\n\n  for (let i = 0; i < valuesNotNever.length; i++) {\n    const value = valuesNotNever[i];\n    if (predicate(value)) {\n      return value;\n    }\n  }\n\n  return undefined;\n}\n\nexport function forEach<T>(\n  record: Record<string, T>,\n  run: (v: T, key: string) => void\n) {\n  Object.entries(record).forEach(([key, value]) => run(value, key));\n}\n\nexport function includes<T>(arr: T[], value: T) {\n  return arr.indexOf(value) !== -1;\n}\n\nexport function findArr<T>(\n  record: T[],\n  predicate: (v: T) => boolean\n): T | undefined {\n  for (let i = 0; i < record.length; i++) {\n    const value = record[i];\n    if (predicate(value)) {\n      return value;\n    }\n  }\n\n  return undefined;\n}\n","import { JSONValue } from './types';\nimport { find } from './util';\n\nexport interface CustomTransfomer<I, O extends JSONValue> {\n  name: string;\n  isApplicable: (v: any) => v is I;\n  serialize: (v: I) => O;\n  deserialize: (v: O) => I;\n}\n\nexport class CustomTransformerRegistry {\n  private transfomers: Record<string, CustomTransfomer<any, any>> = {};\n\n  register<I, O extends JSONValue>(transformer: CustomTransfomer<I, O>) {\n    this.transfomers[transformer.name] = transformer;\n  }\n\n  findApplicable<T>(v: T) {\n    return find(this.transfomers, transformer =>\n      transformer.isApplicable(v)\n    ) as CustomTransfomer<T, JSONValue> | undefined;\n  }\n\n  findByName(name: string) {\n    return this.transfomers[name];\n  }\n}\n","const getType = (payload: any): string =>\n  Object.prototype.toString.call(payload).slice(8, -1);\n\nexport const isUndefined = (payload: any): payload is undefined =>\n  typeof payload === 'undefined';\n\nexport const isNull = (payload: any): payload is null => payload === null;\n\nexport const isPlainObject = (\n  payload: any\n): payload is { [key: string]: any } => {\n  if (typeof payload !== 'object' || payload === null) return false;\n  if (payload === Object.prototype) return false;\n  if (Object.getPrototypeOf(payload) === null) return true;\n\n  return Object.getPrototypeOf(payload) === Object.prototype;\n};\n\nexport const isEmptyObject = (payload: any): payload is {} =>\n  isPlainObject(payload) && Object.keys(payload).length === 0;\n\nexport const isArray = (payload: any): payload is any[] =>\n  Array.isArray(payload);\n\nexport const isString = (payload: any): payload is string =>\n  typeof payload === 'string';\n\nexport const isNumber = (payload: any): payload is number =>\n  typeof payload === 'number' && !isNaN(payload);\n\nexport const isBoolean = (payload: any): payload is boolean =>\n  typeof payload === 'boolean';\n\nexport const isRegExp = (payload: any): payload is RegExp =>\n  payload instanceof RegExp;\n\nexport const isMap = (payload: any): payload is Map<any, any> =>\n  payload instanceof Map;\n\nexport const isSet = (payload: any): payload is Set<any> =>\n  payload instanceof Set;\n\nexport const isSymbol = (payload: any): payload is symbol =>\n  getType(payload) === 'Symbol';\n\nexport const isDate = (payload: any): payload is Date =>\n  payload instanceof Date && !isNaN(payload.valueOf());\n\nexport const isError = (payload: any): payload is Error =>\n  payload instanceof Error;\n\nexport const isNaNValue = (payload: any): payload is typeof NaN =>\n  typeof payload === 'number' && isNaN(payload);\n\nexport const isPrimitive = (\n  payload: any\n): payload is boolean | null | undefined | number | string | symbol =>\n  isBoolean(payload) ||\n  isNull(payload) ||\n  isUndefined(payload) ||\n  isNumber(payload) ||\n  isString(payload) ||\n  isSymbol(payload);\n\nexport const isBigint = (payload: any): payload is bigint =>\n  typeof payload === 'bigint';\n\nexport const isInfinite = (payload: any): payload is number =>\n  payload === Infinity || payload === -Infinity;\n\nexport type TypedArrayConstructor =\n  | Int8ArrayConstructor\n  | Uint8ArrayConstructor\n  | Uint8ClampedArrayConstructor\n  | Int16ArrayConstructor\n  | Uint16ArrayConstructor\n  | Int32ArrayConstructor\n  | Uint32ArrayConstructor\n  | Float32ArrayConstructor\n  | Float64ArrayConstructor;\n\nexport type TypedArray = InstanceType<TypedArrayConstructor>;\n\nexport const isTypedArray = (payload: any): payload is TypedArray =>\n  ArrayBuffer.isView(payload) && !(payload instanceof DataView);\n\nexport const isURL = (payload: any): payload is URL => payload instanceof URL;\n","export type StringifiedPath = string;\ntype Path = string[];\n\nexport const escapeKey = (key: string) => key.replace(/\\./g, '\\\\.');\n\nexport const stringifyPath = (path: Path): StringifiedPath =>\n  path\n    .map(String)\n    .map(escapeKey)\n    .join('.');\n\nexport const parsePath = (string: StringifiedPath) => {\n  const result: string[] = [];\n\n  let segment = '';\n  for (let i = 0; i < string.length; i++) {\n    let char = string.charAt(i);\n\n    const isEscapedDot = char === '\\\\' && string.charAt(i + 1) === '.';\n    if (isEscapedDot) {\n      segment += '.';\n      i++;\n      continue;\n    }\n\n    const isEndOfSegment = char === '.';\n    if (isEndOfSegment) {\n      result.push(segment);\n      segment = '';\n      continue;\n    }\n\n    segment += char;\n  }\n\n  const lastSegment = segment;\n  result.push(lastSegment);\n\n  return result;\n};\n","import {\n  isBigint,\n  isDate,\n  isInfinite,\n  isMap,\n  isNaNValue,\n  isRegExp,\n  isSet,\n  isUndefined,\n  isSymbol,\n  isArray,\n  isError,\n  isTypedArray,\n  TypedArrayConstructor,\n  isURL,\n} from './is';\nimport { findArr } from './util';\nimport SuperJSON from '.';\n\nexport type PrimitiveTypeAnnotation = 'number' | 'undefined' | 'bigint';\n\ntype LeafTypeAnnotation =\n  | PrimitiveTypeAnnotation\n  | 'regexp'\n  | 'Date'\n  | 'Error'\n  | 'URL';\n\ntype TypedArrayAnnotation = ['typed-array', string];\ntype ClassTypeAnnotation = ['class', string];\ntype SymbolTypeAnnotation = ['symbol', string];\ntype CustomTypeAnnotation = ['custom', string];\n\ntype SimpleTypeAnnotation = LeafTypeAnnotation | 'map' | 'set';\n\ntype CompositeTypeAnnotation =\n  | TypedArrayAnnotation\n  | ClassTypeAnnotation\n  | SymbolTypeAnnotation\n  | CustomTypeAnnotation;\n\nexport type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;\n\nfunction simpleTransformation<I, O, A extends SimpleTypeAnnotation>(\n  isApplicable: (v: any, superJson: SuperJSON) => v is I,\n  annotation: A,\n  transform: (v: I, superJson: SuperJSON) => O,\n  untransform: (v: O, superJson: SuperJSON) => I\n) {\n  return {\n    isApplicable,\n    annotation,\n    transform,\n    untransform,\n  };\n}\n\nconst simpleRules = [\n  simpleTransformation(\n    isUndefined,\n    'undefined',\n    () => null,\n    () => undefined\n  ),\n  simpleTransformation(\n    isBigint,\n    'bigint',\n    v => v.toString(),\n    v => {\n      if (typeof BigInt !== 'undefined') {\n        return BigInt(v);\n      }\n\n      console.error('Please add a BigInt polyfill.');\n\n      return v as any;\n    }\n  ),\n  simpleTransformation(\n    isDate,\n    'Date',\n    v => v.toISOString(),\n    v => new Date(v)\n  ),\n\n  simpleTransformation(\n    isError,\n    'Error',\n    (v, superJson) => {\n      const baseError: any = {\n        name: v.name,\n        message: v.message,\n      };\n\n      superJson.allowedErrorProps.forEach(prop => {\n        baseError[prop] = (v as any)[prop];\n      });\n\n      return baseError;\n    },\n    (v, superJson) => {\n      const e = new Error(v.message);\n      e.name = v.name;\n      e.stack = v.stack;\n\n      superJson.allowedErrorProps.forEach(prop => {\n        (e as any)[prop] = v[prop];\n      });\n\n      return e;\n    }\n  ),\n\n  simpleTransformation(\n    isRegExp,\n    'regexp',\n    v => '' + v,\n    regex => {\n      const body = regex.slice(1, regex.lastIndexOf('/'));\n      const flags = regex.slice(regex.lastIndexOf('/') + 1);\n      return new RegExp(body, flags);\n    }\n  ),\n\n  simpleTransformation(\n    isSet,\n    'set',\n    // (sets only exist in es6+)\n    // eslint-disable-next-line es5/no-es6-methods\n    v => [...v.values()],\n    v => new Set(v)\n  ),\n  simpleTransformation(\n    isMap,\n    'map',\n    v => [...v.entries()],\n    v => new Map(v)\n  ),\n\n  simpleTransformation<number, 'NaN' | 'Infinity' | '-Infinity', 'number'>(\n    (v): v is number => isNaNValue(v) || isInfinite(v),\n    'number',\n    v => {\n      if (isNaNValue(v)) {\n        return 'NaN';\n      }\n\n      if (v > 0) {\n        return 'Infinity';\n      } else {\n        return '-Infinity';\n      }\n    },\n    Number\n  ),\n\n  simpleTransformation<number, '-0', 'number'>(\n    (v): v is number => v === 0 && 1 / v === -Infinity,\n    'number',\n    () => {\n      return '-0';\n    },\n    Number\n  ),\n\n  simpleTransformation(\n    isURL,\n    'URL',\n    v => v.toString(),\n    v => new URL(v)\n  ),\n];\n\nfunction compositeTransformation<I, O, A extends CompositeTypeAnnotation>(\n  isApplicable: (v: any, superJson: SuperJSON) => v is I,\n  annotation: (v: I, superJson: SuperJSON) => A,\n  transform: (v: I, superJson: SuperJSON) => O,\n  untransform: (v: O, a: A, superJson: SuperJSON) => I\n) {\n  return {\n    isApplicable,\n    annotation,\n    transform,\n    untransform,\n  };\n}\n\nconst symbolRule = compositeTransformation(\n  (s, superJson): s is Symbol => {\n    if (isSymbol(s)) {\n      const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);\n      return isRegistered;\n    }\n    return false;\n  },\n  (s, superJson) => {\n    const identifier = superJson.symbolRegistry.getIdentifier(s);\n    return ['symbol', identifier!];\n  },\n  v => v.description,\n  (_, a, superJson) => {\n    const value = superJson.symbolRegistry.getValue(a[1]);\n    if (!value) {\n      throw new Error('Trying to deserialize unknown symbol');\n    }\n    return value;\n  }\n);\n\nconst constructorToName = [\n  Int8Array,\n  Uint8Array,\n  Int16Array,\n  Uint16Array,\n  Int32Array,\n  Uint32Array,\n  Float32Array,\n  Float64Array,\n  Uint8ClampedArray,\n].reduce<Record<string, TypedArrayConstructor>>((obj, ctor) => {\n  obj[ctor.name] = ctor;\n  return obj;\n}, {});\n\nconst typedArrayRule = compositeTransformation(\n  isTypedArray,\n  v => ['typed-array', v.constructor.name],\n  v => [...v],\n  (v, a) => {\n    const ctor = constructorToName[a[1]];\n\n    if (!ctor) {\n      throw new Error('Trying to deserialize unknown typed array');\n    }\n\n    return new ctor(v);\n  }\n);\n\nexport function isInstanceOfRegisteredClass(\n  potentialClass: any,\n  superJson: SuperJSON\n): potentialClass is any {\n  if (potentialClass?.constructor) {\n    const isRegistered = !!superJson.classRegistry.getIdentifier(\n      potentialClass.constructor\n    );\n    return isRegistered;\n  }\n  return false;\n}\n\nconst classRule = compositeTransformation(\n  isInstanceOfRegisteredClass,\n  (clazz, superJson) => {\n    const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);\n    return ['class', identifier!];\n  },\n  (clazz, superJson) => {\n    const allowedProps = superJson.classRegistry.getAllowedProps(\n      clazz.constructor\n    );\n    if (!allowedProps) {\n      return { ...clazz };\n    }\n\n    const result: any = {};\n    allowedProps.forEach(prop => {\n      result[prop] = clazz[prop];\n    });\n    return result;\n  },\n  (v, a, superJson) => {\n    const clazz = superJson.classRegistry.getValue(a[1]);\n\n    if (!clazz) {\n      throw new Error(\n        'Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564'\n      );\n    }\n\n    return Object.assign(Object.create(clazz.prototype), v);\n  }\n);\n\nconst customRule = compositeTransformation(\n  (value, superJson): value is any => {\n    return !!superJson.customTransformerRegistry.findApplicable(value);\n  },\n  (value, superJson) => {\n    const transformer = superJson.customTransformerRegistry.findApplicable(\n      value\n    )!;\n    return ['custom', transformer.name];\n  },\n  (value, superJson) => {\n    const transformer = superJson.customTransformerRegistry.findApplicable(\n      value\n    )!;\n    return transformer.serialize(value);\n  },\n  (v, a, superJson) => {\n    const transformer = superJson.customTransformerRegistry.findByName(a[1]);\n    if (!transformer) {\n      throw new Error('Trying to deserialize unknown custom value');\n    }\n    return transformer.deserialize(v);\n  }\n);\n\nconst compositeRules = [classRule, symbolRule, customRule, typedArrayRule];\n\nexport const transformValue = (\n  value: any,\n  superJson: SuperJSON\n): { value: any; type: TypeAnnotation } | undefined => {\n  const applicableCompositeRule = findArr(compositeRules, rule =>\n    rule.isApplicable(value, superJson)\n  );\n  if (applicableCompositeRule) {\n    return {\n      value: applicableCompositeRule.transform(value as never, superJson),\n      type: applicableCompositeRule.annotation(value, superJson),\n    };\n  }\n\n  const applicableSimpleRule = findArr(simpleRules, rule =>\n    rule.isApplicable(value, superJson)\n  );\n\n  if (applicableSimpleRule) {\n    return {\n      value: applicableSimpleRule.transform(value as never, superJson),\n      type: applicableSimpleRule.annotation,\n    };\n  }\n\n  return undefined;\n};\n\nconst simpleRulesByAnnotation: Record<string, typeof simpleRules[0]> = {};\nsimpleRules.forEach(rule => {\n  simpleRulesByAnnotation[rule.annotation] = rule;\n});\n\nexport const untransformValue = (\n  json: any,\n  type: TypeAnnotation,\n  superJson: SuperJSON\n) => {\n  if (isArray(type)) {\n    switch (type[0]) {\n      case 'symbol':\n        return symbolRule.untransform(json, type, superJson);\n      case 'class':\n        return classRule.untransform(json, type, superJson);\n      case 'custom':\n        return customRule.untransform(json, type, superJson);\n      case 'typed-array':\n        return typedArrayRule.untransform(json, type, superJson);\n      default:\n        throw new Error('Unknown transformation: ' + type);\n    }\n  } else {\n    const transformation = simpleRulesByAnnotation[type];\n    if (!transformation) {\n      throw new Error('Unknown transformation: ' + type);\n    }\n\n    return transformation.untransform(json as never, superJson);\n  }\n};\n","import { isMap, isArray, isPlainObject, isSet } from './is';\nimport { includes } from './util';\n\nconst getNthKey = (value: Map<any, any> | Set<any>, n: number): any => {\n  const keys = value.keys();\n  while (n > 0) {\n    keys.next();\n    n--;\n  }\n\n  return keys.next().value;\n};\n\nfunction validatePath(path: (string | number)[]) {\n  if (includes(path, '__proto__')) {\n    throw new Error('__proto__ is not allowed as a property');\n  }\n  if (includes(path, 'prototype')) {\n    throw new Error('prototype is not allowed as a property');\n  }\n  if (includes(path, 'constructor')) {\n    throw new Error('constructor is not allowed as a property');\n  }\n}\n\nexport const getDeep = (object: object, path: (string | number)[]): object => {\n  validatePath(path);\n\n  for (let i = 0; i < path.length; i++) {\n    const key = path[i];\n    if (isSet(object)) {\n      object = getNthKey(object, +key);\n    } else if (isMap(object)) {\n      const row = +key;\n      const type = +path[++i] === 0 ? 'key' : 'value';\n\n      const keyOfRow = getNthKey(object, row);\n      switch (type) {\n        case 'key':\n          object = keyOfRow;\n          break;\n        case 'value':\n          object = object.get(keyOfRow);\n          break;\n      }\n    } else {\n      object = (object as any)[key];\n    }\n  }\n\n  return object;\n};\n\nexport const setDeep = (\n  object: any,\n  path: (string | number)[],\n  mapper: (v: any) => any\n): any => {\n  validatePath(path);\n\n  if (path.length === 0) {\n    return mapper(object);\n  }\n\n  let parent = object;\n\n  for (let i = 0; i < path.length - 1; i++) {\n    const key = path[i];\n\n    if (isArray(parent)) {\n      const index = +key;\n      parent = parent[index];\n    } else if (isPlainObject(parent)) {\n      parent = parent[key];\n    } else if (isSet(parent)) {\n      const row = +key;\n      parent = getNthKey(parent, row);\n    } else if (isMap(parent)) {\n      const isEnd = i === path.length - 2;\n      if (isEnd) {\n        break;\n      }\n\n      const row = +key;\n      const type = +path[++i] === 0 ? 'key' : 'value';\n\n      const keyOfRow = getNthKey(parent, row);\n      switch (type) {\n        case 'key':\n          parent = keyOfRow;\n          break;\n        case 'value':\n          parent = parent.get(keyOfRow);\n          break;\n      }\n    }\n  }\n\n  const lastKey = path[path.length - 1];\n\n  if (isArray(parent)) {\n    parent[+lastKey] = mapper(parent[+lastKey]);\n  } else if (isPlainObject(parent)) {\n    parent[lastKey] = mapper(parent[lastKey]);\n  }\n\n  if (isSet(parent)) {\n    const oldValue = getNthKey(parent, +lastKey);\n    const newValue = mapper(oldValue);\n    if (oldValue !== newValue) {\n      parent.delete(oldValue);\n      parent.add(newValue);\n    }\n  }\n\n  if (isMap(parent)) {\n    const row = +path[path.length - 2];\n    const keyToRow = getNthKey(parent, row);\n\n    const type = +lastKey === 0 ? 'key' : 'value';\n    switch (type) {\n      case 'key': {\n        const newKey = mapper(keyToRow);\n        parent.set(newKey, parent.get(keyToRow));\n\n        if (newKey !== keyToRow) {\n          parent.delete(keyToRow);\n        }\n        break;\n      }\n\n      case 'value': {\n        parent.set(keyToRow, mapper(parent.get(keyToRow)));\n        break;\n      }\n    }\n  }\n\n  return object;\n};\n","import {\n  isArray,\n  isEmptyObject,\n  isMap,\n  isPlainObject,\n  isPrimitive,\n  isSet,\n} from './is';\nimport { escapeKey, stringifyPath } from './pathstringifier';\nimport {\n  isInstanceOfRegisteredClass,\n  transformValue,\n  TypeAnnotation,\n  untransformValue,\n} from './transformer';\nimport { includes, forEach } from './util';\nimport { parsePath } from './pathstringifier';\nimport { getDeep, setDeep } from './accessDeep';\nimport SuperJSON from '.';\n\ntype Tree<T> = InnerNode<T> | Leaf<T>;\ntype Leaf<T> = [T];\ntype InnerNode<T> = [T, Record<string, Tree<T>>];\n\nexport type MinimisedTree<T> = Tree<T> | Record<string, Tree<T>> | undefined;\n\nfunction traverse<T>(\n  tree: MinimisedTree<T>,\n  walker: (v: T, path: string[]) => void,\n  origin: string[] = []\n): void {\n  if (!tree) {\n    return;\n  }\n\n  if (!isArray(tree)) {\n    forEach(tree, (subtree, key) =>\n      traverse(subtree, walker, [...origin, ...parsePath(key)])\n    );\n    return;\n  }\n\n  const [nodeValue, children] = tree;\n  if (children) {\n    forEach(children, (child, key) => {\n      traverse(child, walker, [...origin, ...parsePath(key)]);\n    });\n  }\n\n  walker(nodeValue, origin);\n}\n\nexport function applyValueAnnotations(\n  plain: any,\n  annotations: MinimisedTree<TypeAnnotation>,\n  superJson: SuperJSON\n) {\n  traverse(annotations, (type, path) => {\n    plain = setDeep(plain, path, v => untransformValue(v, type, superJson));\n  });\n\n  return plain;\n}\n\nexport function applyReferentialEqualityAnnotations(\n  plain: any,\n  annotations: ReferentialEqualityAnnotations\n) {\n  function apply(identicalPaths: string[], path: string) {\n    const object = getDeep(plain, parsePath(path));\n\n    identicalPaths.map(parsePath).forEach(identicalObjectPath => {\n      plain = setDeep(plain, identicalObjectPath, () => object);\n    });\n  }\n\n  if (isArray(annotations)) {\n    const [root, other] = annotations;\n    root.forEach(identicalPath => {\n      plain = setDeep(plain, parsePath(identicalPath), () => plain);\n    });\n\n    if (other) {\n      forEach(other, apply);\n    }\n  } else {\n    forEach(annotations, apply);\n  }\n\n  return plain;\n}\n\nconst isDeep = (object: any, superJson: SuperJSON): boolean =>\n  isPlainObject(object) ||\n  isArray(object) ||\n  isMap(object) ||\n  isSet(object) ||\n  isInstanceOfRegisteredClass(object, superJson);\n\nfunction addIdentity(object: any, path: any[], identities: Map<any, any[][]>) {\n  const existingSet = identities.get(object);\n\n  if (existingSet) {\n    existingSet.push(path);\n  } else {\n    identities.set(object, [path]);\n  }\n}\n\ninterface Result {\n  transformedValue: any;\n  annotations?: MinimisedTree<TypeAnnotation>;\n}\n\nexport type ReferentialEqualityAnnotations =\n  | Record<string, string[]>\n  | [string[]]\n  | [string[], Record<string, string[]>];\n\nexport function generateReferentialEqualityAnnotations(\n  identitites: Map<any, any[][]>\n): ReferentialEqualityAnnotations | undefined {\n  const result: Record<string, string[]> = {};\n  let rootEqualityPaths: string[] | undefined = undefined;\n\n  identitites.forEach(paths => {\n    if (paths.length <= 1) {\n      return;\n    }\n\n    const [shortestPath, ...identicalPaths] = paths\n      .map(path => path.map(String))\n      .sort((a, b) => a.length - b.length);\n\n    if (shortestPath.length === 0) {\n      rootEqualityPaths = identicalPaths.map(stringifyPath);\n    } else {\n      result[stringifyPath(shortestPath)] = identicalPaths.map(stringifyPath);\n    }\n  });\n\n  if (rootEqualityPaths) {\n    if (isEmptyObject(result)) {\n      return [rootEqualityPaths];\n    } else {\n      return [rootEqualityPaths, result];\n    }\n  } else {\n    return isEmptyObject(result) ? undefined : result;\n  }\n}\n\nexport const walker = (\n  object: any,\n  identities: Map<any, any[][]>,\n  superJson: SuperJSON,\n  dedupe: boolean,\n  path: any[] = [],\n  objectsInThisPath: any[] = [],\n  seenObjects = new Map<unknown, Result>()\n): Result => {\n  const primitive = isPrimitive(object);\n\n  if (!primitive) {\n    addIdentity(object, path, identities);\n\n    const seen = seenObjects.get(object);\n    if (seen) {\n      // short-circuit result if we've seen this object before\n      return dedupe\n        ? {\n            transformedValue: null,\n          }\n        : seen;\n    }\n  }\n\n  if (!isDeep(object, superJson)) {\n    const transformed = transformValue(object, superJson);\n\n    const result: Result = transformed\n      ? {\n          transformedValue: transformed.value,\n          annotations: [transformed.type],\n        }\n      : {\n          transformedValue: object,\n        };\n    if (!primitive) {\n      seenObjects.set(object, result);\n    }\n    return result;\n  }\n\n  if (includes(objectsInThisPath, object)) {\n    // prevent circular references\n    return {\n      transformedValue: null,\n    };\n  }\n\n  const transformationResult = transformValue(object, superJson);\n  const transformed = transformationResult?.value ?? object;\n\n  const transformedValue: any = isArray(transformed) ? [] : {};\n  const innerAnnotations: Record<string, Tree<TypeAnnotation>> = {};\n\n  forEach(transformed, (value, index) => {\n    const recursiveResult = walker(\n      value,\n      identities,\n      superJson,\n      dedupe,\n      [...path, index],\n      [...objectsInThisPath, object],\n      seenObjects\n    );\n\n    transformedValue[index] = recursiveResult.transformedValue;\n\n    if (isArray(recursiveResult.annotations)) {\n      innerAnnotations[index] = recursiveResult.annotations;\n    } else if (isPlainObject(recursiveResult.annotations)) {\n      forEach(recursiveResult.annotations, (tree, key) => {\n        innerAnnotations[escapeKey(index) + '.' + key] = tree;\n      });\n    }\n  });\n\n  const result: Result = isEmptyObject(innerAnnotations)\n    ? {\n        transformedValue,\n        annotations: !!transformationResult\n          ? [transformationResult.type]\n          : undefined,\n      }\n    : {\n        transformedValue,\n        annotations: !!transformationResult\n          ? [transformationResult.type, innerAnnotations]\n          : innerAnnotations,\n      };\n  if (!primitive) {\n    seenObjects.set(object, result);\n  }\n\n  return result;\n};\n","function getType(payload) {\n  return Object.prototype.toString.call(payload).slice(8, -1);\n}\nfunction isUndefined(payload) {\n  return getType(payload) === \"Undefined\";\n}\nfunction isNull(payload) {\n  return getType(payload) === \"Null\";\n}\nfunction isPlainObject(payload) {\n  if (getType(payload) !== \"Object\")\n    return false;\n  const prototype = Object.getPrototypeOf(payload);\n  return !!prototype && prototype.constructor === Object && prototype === Object.prototype;\n}\nfunction isObject(payload) {\n  return isPlainObject(payload);\n}\nfunction isEmptyObject(payload) {\n  return isPlainObject(payload) && Object.keys(payload).length === 0;\n}\nfunction isFullObject(payload) {\n  return isPlainObject(payload) && Object.keys(payload).length > 0;\n}\nfunction isAnyObject(payload) {\n  return getType(payload) === \"Object\";\n}\nfunction isObjectLike(payload) {\n  return isAnyObject(payload);\n}\nfunction isFunction(payload) {\n  return typeof payload === \"function\";\n}\nfunction isArray(payload) {\n  return getType(payload) === \"Array\";\n}\nfunction isFullArray(payload) {\n  return isArray(payload) && payload.length > 0;\n}\nfunction isEmptyArray(payload) {\n  return isArray(payload) && payload.length === 0;\n}\nfunction isString(payload) {\n  return getType(payload) === \"String\";\n}\nfunction isFullString(payload) {\n  return isString(payload) && payload !== \"\";\n}\nfunction isEmptyString(payload) {\n  return payload === \"\";\n}\nfunction isNumber(payload) {\n  return getType(payload) === \"Number\" && !isNaN(payload);\n}\nfunction isPositiveNumber(payload) {\n  return isNumber(payload) && payload > 0;\n}\nfunction isNegativeNumber(payload) {\n  return isNumber(payload) && payload < 0;\n}\nfunction isBoolean(payload) {\n  return getType(payload) === \"Boolean\";\n}\nfunction isRegExp(payload) {\n  return getType(payload) === \"RegExp\";\n}\nfunction isMap(payload) {\n  return getType(payload) === \"Map\";\n}\nfunction isWeakMap(payload) {\n  return getType(payload) === \"WeakMap\";\n}\nfunction isSet(payload) {\n  return getType(payload) === \"Set\";\n}\nfunction isWeakSet(payload) {\n  return getType(payload) === \"WeakSet\";\n}\nfunction isSymbol(payload) {\n  return getType(payload) === \"Symbol\";\n}\nfunction isDate(payload) {\n  return getType(payload) === \"Date\" && !isNaN(payload);\n}\nfunction isBlob(payload) {\n  return getType(payload) === \"Blob\";\n}\nfunction isFile(payload) {\n  return getType(payload) === \"File\";\n}\nfunction isPromise(payload) {\n  return getType(payload) === \"Promise\";\n}\nfunction isError(payload) {\n  return getType(payload) === \"Error\";\n}\nfunction isNaNValue(payload) {\n  return getType(payload) === \"Number\" && isNaN(payload);\n}\nfunction isPrimitive(payload) {\n  return isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);\n}\nconst isNullOrUndefined = isOneOf(isNull, isUndefined);\nfunction isOneOf(a, b, c, d, e) {\n  return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);\n}\nfunction isType(payload, type) {\n  if (!(type instanceof Function)) {\n    throw new TypeError(\"Type must be a function\");\n  }\n  if (!Object.prototype.hasOwnProperty.call(type, \"prototype\")) {\n    throw new TypeError(\"Type is not a class\");\n  }\n  const name = type.name;\n  return getType(payload) === name || Boolean(payload && payload.constructor === type);\n}\nfunction isInstanceOf(value, classOrClassName) {\n  if (typeof classOrClassName === \"function\") {\n    for (let p = value; p; p = Object.getPrototypeOf(p)) {\n      if (isType(p, classOrClassName)) {\n        return true;\n      }\n    }\n    return false;\n  } else {\n    for (let p = value; p; p = Object.getPrototypeOf(p)) {\n      if (getType(p) === classOrClassName) {\n        return true;\n      }\n    }\n    return false;\n  }\n}\n\nexport { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyArray, isEmptyObject, isEmptyString, isError, isFile, isFullArray, isFullObject, isFullString, isFunction, isInstanceOf, isMap, isNaNValue, isNegativeNumber, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isOneOf, isPlainObject, isPositiveNumber, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet };\n","import { isArray, isPlainObject } from 'is-what';\n\nfunction assignProp(carry, key, newVal, originalObject, includeNonenumerable) {\n  const propType = {}.propertyIsEnumerable.call(originalObject, key) ? \"enumerable\" : \"nonenumerable\";\n  if (propType === \"enumerable\")\n    carry[key] = newVal;\n  if (includeNonenumerable && propType === \"nonenumerable\") {\n    Object.defineProperty(carry, key, {\n      value: newVal,\n      enumerable: false,\n      writable: true,\n      configurable: true\n    });\n  }\n}\nfunction copy(target, options = {}) {\n  if (isArray(target)) {\n    return target.map((item) => copy(item, options));\n  }\n  if (!isPlainObject(target)) {\n    return target;\n  }\n  const props = Object.getOwnPropertyNames(target);\n  const symbols = Object.getOwnPropertySymbols(target);\n  return [...props, ...symbols].reduce((carry, key) => {\n    if (isArray(options.props) && !options.props.includes(key)) {\n      return carry;\n    }\n    const val = target[key];\n    const newVal = copy(val, options);\n    assignProp(carry, key, newVal, target, options.nonenumerable);\n    return carry;\n  }, {});\n}\n\nexport { copy };\n","import { Class, JSONValue, SuperJSONResult, SuperJSONValue } from './types';\nimport { ClassRegistry, RegisterOptions } from './class-registry';\nimport { Registry } from './registry';\nimport {\n  CustomTransfomer,\n  CustomTransformerRegistry,\n} from './custom-transformer-registry';\nimport {\n  applyReferentialEqualityAnnotations,\n  applyValueAnnotations,\n  generateReferentialEqualityAnnotations,\n  walker,\n} from './plainer';\nimport { copy } from 'copy-anything';\n\nexport default class SuperJSON {\n  /**\n   * If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.\n   */\n  private readonly dedupe: boolean;\n\n  /**\n   * @param dedupeReferentialEqualities  If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.\n   */\n  constructor({\n    dedupe = false,\n  }: {\n    dedupe?: boolean;\n  } = {}) {\n    this.dedupe = dedupe;\n  }\n\n  serialize(object: SuperJSONValue): SuperJSONResult {\n    const identities = new Map<any, any[][]>();\n    const output = walker(object, identities, this, this.dedupe);\n    const res: SuperJSONResult = {\n      json: output.transformedValue,\n    };\n\n    if (output.annotations) {\n      res.meta = {\n        ...res.meta,\n        values: output.annotations,\n      };\n    }\n\n    const equalityAnnotations = generateReferentialEqualityAnnotations(\n      identities\n    );\n    if (equalityAnnotations) {\n      res.meta = {\n        ...res.meta,\n        referentialEqualities: equalityAnnotations,\n      };\n    }\n\n    return res;\n  }\n\n  deserialize<T = unknown>(payload: SuperJSONResult): T {\n    const { json, meta } = payload;\n\n    let result: T = copy(json) as any;\n\n    if (meta?.values) {\n      result = applyValueAnnotations(result, meta.values, this);\n    }\n\n    if (meta?.referentialEqualities) {\n      result = applyReferentialEqualityAnnotations(\n        result,\n        meta.referentialEqualities\n      );\n    }\n\n    return result;\n  }\n\n  stringify(object: SuperJSONValue): string {\n    return JSON.stringify(this.serialize(object));\n  }\n\n  parse<T = unknown>(string: string): T {\n    return this.deserialize(JSON.parse(string));\n  }\n\n  readonly classRegistry = new ClassRegistry();\n  registerClass(v: Class, options?: RegisterOptions | string) {\n    this.classRegistry.register(v, options);\n  }\n\n  readonly symbolRegistry = new Registry<Symbol>(s => s.description ?? '');\n  registerSymbol(v: Symbol, identifier?: string) {\n    this.symbolRegistry.register(v, identifier);\n  }\n\n  readonly customTransformerRegistry = new CustomTransformerRegistry();\n  registerCustom<I, O extends JSONValue>(\n    transformer: Omit<CustomTransfomer<I, O>, 'name'>,\n    name: string\n  ) {\n    this.customTransformerRegistry.register({\n      name,\n      ...transformer,\n    });\n  }\n\n  readonly allowedErrorProps: string[] = [];\n  allowErrorProps(...props: string[]) {\n    this.allowedErrorProps.push(...props);\n  }\n\n  private static defaultInstance = new SuperJSON();\n  static serialize = SuperJSON.defaultInstance.serialize.bind(\n    SuperJSON.defaultInstance\n  );\n  static deserialize = SuperJSON.defaultInstance.deserialize.bind(\n    SuperJSON.defaultInstance\n  );\n  static stringify = SuperJSON.defaultInstance.stringify.bind(\n    SuperJSON.defaultInstance\n  );\n  static parse = SuperJSON.defaultInstance.parse.bind(\n    SuperJSON.defaultInstance\n  );\n  static registerClass = SuperJSON.defaultInstance.registerClass.bind(\n    SuperJSON.defaultInstance\n  );\n  static registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(\n    SuperJSON.defaultInstance\n  );\n  static registerCustom = SuperJSON.defaultInstance.registerCustom.bind(\n    SuperJSON.defaultInstance\n  );\n  static allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(\n    SuperJSON.defaultInstance\n  );\n}\n\nexport { SuperJSON };\n\nexport const serialize = SuperJSON.serialize;\nexport const deserialize = SuperJSON.deserialize;\n\nexport const stringify = SuperJSON.stringify;\nexport const parse = SuperJSON.parse;\n\nexport const registerClass = SuperJSON.registerClass;\nexport const registerCustom = SuperJSON.registerCustom;\nexport const registerSymbol = SuperJSON.registerSymbol;\nexport const allowErrorProps = SuperJSON.allowErrorProps;\n"]}