@mittwald/flow-remote-core 1.5.0-next.9 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs.map +1 -1
  2. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/Thread.mjs.map +1 -1
  3. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/constants.mjs.map +1 -1
  4. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/errors.mjs.map +1 -1
  5. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs.map +1 -1
  6. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/nanoid.mjs.map +1 -1
  7. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs.map +1 -1
  8. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/serialization/shared.mjs.map +1 -1
  9. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs.map +1 -1
  10. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs.map +1 -1
  11. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/ThreadNestedWindow.mjs.map +1 -1
  12. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs.map +1 -1
  13. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs.map +1 -1
  14. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/transfer.mjs.map +1 -1
  15. package/dist/js/packages/remote-core/src/serialization/FlowThreadSerialization.mjs.map +1 -1
  16. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"NestedAbortController.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs"],"sourcesContent":["/**\n * An `AbortController` that will automatically abort when any of\n * its \"parent\" `AbortController`s abort. This is useful for when\n * you have nested asynchronous operations that may abort independently.\n * The `AbortController` can also be independently aborted.\n *\n * To associate the parent `AbortController`s, pass their signals\n * as arguments to the constructor.\n *\n * @example\n * import {NestedAbortController} from '@shopify/events';\n *\n * const parent = new AbortController();\n * const nested = new NestedAbortController(parent.signal);\n *\n * parent.abort();\n * nested.signal.aborted; // true\n */\nclass NestedAbortController extends AbortController {\n constructor(...parents) {\n super();\n const abortedSignal = parents.find(signal => signal.aborted);\n if (abortedSignal) {\n this.abort(abortedSignal.reason);\n } else {\n const abort = event => this.abort(event.target.reason);\n const options = {\n signal: this.signal\n };\n for (const signal of parents) {\n signal.addEventListener('abort', abort, options);\n }\n }\n }\n}\n\nexport { NestedAbortController };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,IAAM,wBAAN,cAAoC,gBAAgB;CAClD,YAAY,GAAG,SAAS;EACtB,MAAM;EACN,MAAM,gBAAgB,QAAQ,MAAK,WAAU,OAAO,OAAO;EAC3D,IAAI,eACF,KAAK,MAAM,cAAc,MAAM;OAC1B;GACL,MAAM,SAAQ,UAAS,KAAK,MAAM,MAAM,OAAO,MAAM;GACrD,MAAM,UAAU,EACd,QAAQ,KAAK,OACf;GACA,KAAK,MAAM,UAAU,SACnB,OAAO,iBAAiB,SAAS,OAAO,OAAO;EAEnD;CACF;AACF"}
1
+ {"version":3,"file":"NestedAbortController.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs"],"sourcesContent":["/**\n * An `AbortController` that will automatically abort when any of\n * its \"parent\" `AbortController`s abort. This is useful for when\n * you have nested asynchronous operations that may abort independently.\n * The `AbortController` can also be independently aborted.\n *\n * To associate the parent `AbortController`s, pass their signals\n * as arguments to the constructor.\n *\n * @example\n * import {NestedAbortController} from '@shopify/events';\n *\n * const parent = new AbortController();\n * const nested = new NestedAbortController(parent.signal);\n *\n * parent.abort();\n * nested.signal.aborted; // true\n */\nclass NestedAbortController extends AbortController {\n constructor(...parents) {\n super();\n const abortedSignal = parents.find(signal => signal.aborted);\n if (abortedSignal) {\n this.abort(abortedSignal.reason);\n } else {\n const abort = event => this.abort(event.target.reason);\n const options = {\n signal: this.signal\n };\n for (const signal of parents) {\n signal.addEventListener('abort', abort, options);\n }\n }\n }\n}\n\nexport { NestedAbortController };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,IAAM,wBAAN,cAAoC,gBAAgB;CAClD,YAAY,GAAG,SAAS;EACtB,MAAM;EACN,MAAM,gBAAgB,QAAQ,MAAK,WAAU,OAAO,OAAO;EAC3D,IAAI,eACF,KAAK,MAAM,cAAc,MAAM;OAC1B;GACL,MAAM,SAAQ,UAAS,KAAK,MAAM,MAAM,OAAO,MAAM;GACrD,MAAM,UAAU,EACd,QAAQ,KAAK,OACf;GACA,KAAK,MAAM,UAAU,SACnB,OAAO,iBAAiB,SAAS,OAAO,OAAO;EAEnD;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Thread.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/Thread.mjs"],"sourcesContent":["import { NestedAbortController } from '@quilted/events';\nimport { ThreadClosedError } from './errors.mjs';\nimport { nanoid } from './nanoid.mjs';\nimport { MESSAGE_FUNCTION_RELEASE, MESSAGE_FUNCTION_RESULT, MESSAGE_CALL_RESULT, MESSAGE_FUNCTION_CALL, MESSAGE_CALL } from './constants.mjs';\nimport { ThreadFunctionsAutomatic } from './functions/ThreadFunctionsAutomatic.mjs';\nimport { ThreadSerializationStructuredClone } from './serialization/ThreadSerializationStructuredClone.mjs';\n\n/**\n * A thread represents a target JavaScript environment that exposes a set\n * of callable, asynchronous methods. The thread takes care of automatically\n * encoding and decoding its arguments and return values, so you can interact\n * with it as if its methods were implemented in the same environment as your\n * own code.\n */\nclass Thread {\n get signal() {\n return this.#abort.signal;\n }\n\n get closed() {\n return this.#abort.signal.aborted;\n }\n\n #abort;\n #idsToResolver = (() => new Map())();\n\n /*\n * Serialization is async in this build, and the number of microtask turns a\n * payload takes is proportional to its size. Upstream is synchronous, so a\n * message was posted in the same stack frame as the call that produced it and\n * order came for free. Here two calls made in one task race, and the one whose\n * payload serializes in fewer turns wins — a larger batch followed by a smaller\n * one arrives second. For a stream of remote-DOM mutations that silently\n * applies the tree in the wrong order.\n *\n * So both directions get a queue. #sendQueue keeps `serialize` then post\n * atomic per call, #receiveQueue keeps `deserialize` then invoke atomic per\n * message. Each is a promise chain that never rejects, so one failed call\n * cannot wedge the thread.\n */\n #sendQueue = (() => Promise.resolve())();\n #receiveQueue = (() => Promise.resolve())();\n\n constructor(messages, {\n imports,\n exports,\n functions = new ThreadFunctionsAutomatic(),\n serialization = new ThreadSerializationStructuredClone(),\n signal\n } = {}) {\n this.messages = messages;\n this.#abort = signal ? new NestedAbortController(signal) : new AbortController();\n this.exports = exports ?? {};\n this.imports = createThreadImports(this.#handlerForCall.bind(this), imports);\n this.functions = functions;\n this.serialization = serialization;\n\n this.functions.start?.(this);\n this.serialization.start?.(this);\n\n this.signal.addEventListener('abort', () => {\n for (const id of this.#idsToResolver.keys()) {\n this.#resolveCall(id, undefined, new ThreadClosedError());\n }\n this.#idsToResolver.clear();\n }, { once: true });\n\n messages.listen(async (rawData) => {\n const isThreadMessageData = Array.isArray(rawData) && typeof rawData[0] === 'number';\n if (!isThreadMessageData) return;\n\n const data = rawData;\n\n switch (data[0]) {\n case MESSAGE_CALL: {\n const [, id, property, args] = data;\n const func = this.exports[property] ?? (() => {\n throw new Error(`No '${property}' method is exported from this thread`);\n });\n\n await this.#callLocal(func, args, (value, error, transferable) => {\n this.messages.send([MESSAGE_CALL_RESULT, id, value, error], transferable);\n });\n\n break;\n }\n\n case MESSAGE_FUNCTION_CALL: {\n const [, callID, funcID, args] = data;\n const func = this.functions.get(funcID, this) ?? missingThreadFunction;\n\n await this.#callLocal(func, args, (value, error, transferable) => {\n this.messages.send([MESSAGE_FUNCTION_RESULT, callID, value, error], transferable);\n });\n\n break;\n }\n\n case MESSAGE_CALL_RESULT:\n case MESSAGE_FUNCTION_RESULT: {\n this.#resolveCall(...data.slice(1));\n break;\n }\n\n case MESSAGE_FUNCTION_RELEASE: {\n const id = data[1];\n this.functions.release(id, this);\n break;\n }\n }\n }, { signal: this.signal });\n }\n\n close() {\n this.#abort.abort();\n }\n\n call(func, args) {\n if (this.closed) {\n return Promise.reject(new ThreadClosedError());\n }\n\n // Claim the id and its resolver before yielding, so the ids reflect call\n // order and a result cannot arrive before there is something to receive it.\n const id = nanoid();\n const done = this.#waitForResult(id);\n\n this.#sendQueue = this.#sendQueue.then(async () => {\n try {\n const transferable = [];\n const serialized = await this.serialization.serialize(args, this, transferable);\n\n func(id, serialized, transferable);\n } catch (error) {\n // Serializing the arguments failed, so nothing was sent and no result\n // will ever come back. Reject this call and leave the queue usable.\n this.#resolveCall(id, undefined, error);\n }\n });\n\n return done;\n }\n\n async #callLocal(func, args, withResult) {\n /*\n * The queue is handed on as soon as the function has been *invoked*, not\n * when it settles. Ordering only needs the calls to start in message order;\n * waiting for completion would let one slow export stall every later\n * message, and deadlock outright if that export awaits a call back to the\n * paired thread.\n */\n let releaseQueue;\n const invoked = new Promise((resolve) => {\n releaseQueue = resolve;\n });\n\n const predecessor = this.#receiveQueue;\n this.#receiveQueue = invoked;\n\n try {\n await predecessor;\n\n const pendingResult = this.functions.call\n ? this.functions.call(func, args, this) // keep original contract\n : func(...(await this.serialization.deserialize(args, this)));\n\n releaseQueue();\n\n const result = await pendingResult;\n\n const transferable = [];\n const serialized = await this.serialization.serialize(result, this, transferable);\n\n withResult(serialized, undefined, transferable);\n } catch (error) {\n releaseQueue();\n withResult(undefined, await this.serialization.serialize(error, this));\n }\n }\n\n #handlerForCall(property) {\n return (...args) => {\n try {\n if (typeof property !== 'string' && typeof property !== 'number') {\n throw new Error(`Can’t call a symbol method on a thread: ${property.toString()}`);\n }\n\n return this.call((id, serializedArgs, transferable) => {\n this.messages.send([MESSAGE_CALL, id, property, serializedArgs], transferable);\n }, args);\n } catch (error) {\n return Promise.reject(error);\n }\n };\n }\n\n #resolveCall(...args) {\n const callID = args[0];\n const resolver = this.#idsToResolver.get(callID);\n\n if (resolver) {\n resolver(...args);\n this.#idsToResolver.delete(callID);\n }\n }\n\n #waitForResult(id) {\n const promise = new Promise((resolve, reject) => {\n this.#idsToResolver.set(id, async (_, value, error) => {\n try {\n if (error == null) {\n resolve(await this.serialization.deserialize(value, this));\n } else {\n reject(await this.serialization.deserialize(error, this));\n }\n } catch (deserializeError) {\n reject(deserializeError);\n }\n });\n });\n\n Object.defineProperty(promise, Symbol.asyncIterator, {\n async *value() {\n const result = await promise;\n\n Object.defineProperty(result, Symbol.asyncIterator, {\n value: () => result\n });\n\n yield* result;\n }\n });\n\n return promise;\n }\n}\n\nfunction createThreadImports(handlerForImport, imported) {\n let call;\n\n if (imported == null) {\n if (typeof Proxy !== 'function') {\n throw new Error(`You must pass an array of callable methods in environments without Proxies.`);\n }\n\n const cache = new Map();\n\n call = new Proxy({}, {\n get(_target, property) {\n if (cache.has(property)) {\n return cache.get(property);\n }\n\n const handler = handlerForImport(property);\n cache.set(property, handler);\n return handler;\n }\n });\n } else {\n call = {};\n\n for (const method of imported) {\n Object.defineProperty(call, method, {\n value: handlerForImport(method),\n writable: false,\n configurable: true,\n enumerable: true\n });\n }\n }\n\n return call;\n}\n\nfunction missingThreadFunction() {\n throw new Error(`You attempted to call a function that is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,SAAS,OAAO,eAAe,EACnD,OAAO,QAAQ;GACb,MAAM,SAAS,MAAM;GAErB,OAAO,eAAe,QAAQ,OAAO,eAAe,EAClD,aAAa,OACf,CAAC;GAED,OAAO;EACT,EACF,CAAC;EAED,OAAO;CACT;AACF;AAEA,SAAS,oBAAoB,kBAAkB,UAAU;CACvD,IAAI;CAEJ,IAAI,YAAY,MAAM;EACpB,IAAI,OAAO,UAAU,YACnB,MAAM,IAAI,MAAM,6EAA6E;EAG/F,MAAM,wBAAQ,IAAI,IAAI;EAEtB,OAAO,IAAI,MAAM,CAAC,GAAG,EACnB,IAAI,SAAS,UAAU;GACrB,IAAI,MAAM,IAAI,QAAQ,GACpB,OAAO,MAAM,IAAI,QAAQ;GAG3B,MAAM,UAAU,iBAAiB,QAAQ;GACzC,MAAM,IAAI,UAAU,OAAO;GAC3B,OAAO;EACT,EACF,CAAC;CACH,OAAO;EACL,OAAO,CAAC;EAER,KAAK,MAAM,UAAU,UACnB,OAAO,eAAe,MAAM,QAAQ;GAClC,OAAO,iBAAiB,MAAM;GAC9B,UAAU;GACV,cAAc;GACd,YAAY;EACd,CAAC;CAEL;CAEA,OAAO;AACT;AAEA,SAAS,wBAAwB;CAC/B,MAAM,IAAI,MAAM,yFAAyF;AAC3G"}
1
+ {"version":3,"file":"Thread.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/Thread.mjs"],"sourcesContent":["import { NestedAbortController } from '@quilted/events';\nimport { ThreadClosedError } from './errors.mjs';\nimport { nanoid } from './nanoid.mjs';\nimport { MESSAGE_FUNCTION_RELEASE, MESSAGE_FUNCTION_RESULT, MESSAGE_CALL_RESULT, MESSAGE_FUNCTION_CALL, MESSAGE_CALL } from './constants.mjs';\nimport { ThreadFunctionsAutomatic } from './functions/ThreadFunctionsAutomatic.mjs';\nimport { ThreadSerializationStructuredClone } from './serialization/ThreadSerializationStructuredClone.mjs';\n\n/**\n * A thread represents a target JavaScript environment that exposes a set\n * of callable, asynchronous methods. The thread takes care of automatically\n * encoding and decoding its arguments and return values, so you can interact\n * with it as if its methods were implemented in the same environment as your\n * own code.\n */\nclass Thread {\n get signal() {\n return this.#abort.signal;\n }\n\n get closed() {\n return this.#abort.signal.aborted;\n }\n\n #abort;\n #idsToResolver = (() => new Map())();\n\n /*\n * Serialization is async in this build, and the number of microtask turns a\n * payload takes is proportional to its size. Upstream is synchronous, so a\n * message was posted in the same stack frame as the call that produced it and\n * order came for free. Here two calls made in one task race, and the one whose\n * payload serializes in fewer turns wins — a larger batch followed by a smaller\n * one arrives second. For a stream of remote-DOM mutations that silently\n * applies the tree in the wrong order.\n *\n * So both directions get a queue. #sendQueue keeps `serialize` then post\n * atomic per call, #receiveQueue keeps `deserialize` then invoke atomic per\n * message. Each is a promise chain that never rejects, so one failed call\n * cannot wedge the thread.\n */\n #sendQueue = (() => Promise.resolve())();\n #receiveQueue = (() => Promise.resolve())();\n\n constructor(messages, {\n imports,\n exports,\n functions = new ThreadFunctionsAutomatic(),\n serialization = new ThreadSerializationStructuredClone(),\n signal\n } = {}) {\n this.messages = messages;\n this.#abort = signal ? new NestedAbortController(signal) : new AbortController();\n this.exports = exports ?? {};\n this.imports = createThreadImports(this.#handlerForCall.bind(this), imports);\n this.functions = functions;\n this.serialization = serialization;\n\n this.functions.start?.(this);\n this.serialization.start?.(this);\n\n this.signal.addEventListener('abort', () => {\n for (const id of this.#idsToResolver.keys()) {\n this.#resolveCall(id, undefined, new ThreadClosedError());\n }\n this.#idsToResolver.clear();\n }, { once: true });\n\n messages.listen(async (rawData) => {\n const isThreadMessageData = Array.isArray(rawData) && typeof rawData[0] === 'number';\n if (!isThreadMessageData) return;\n\n const data = rawData;\n\n switch (data[0]) {\n case MESSAGE_CALL: {\n const [, id, property, args] = data;\n const func = this.exports[property] ?? (() => {\n throw new Error(`No '${property}' method is exported from this thread`);\n });\n\n await this.#callLocal(func, args, (value, error, transferable) => {\n this.messages.send([MESSAGE_CALL_RESULT, id, value, error], transferable);\n });\n\n break;\n }\n\n case MESSAGE_FUNCTION_CALL: {\n const [, callID, funcID, args] = data;\n const func = this.functions.get(funcID, this) ?? missingThreadFunction;\n\n await this.#callLocal(func, args, (value, error, transferable) => {\n this.messages.send([MESSAGE_FUNCTION_RESULT, callID, value, error], transferable);\n });\n\n break;\n }\n\n case MESSAGE_CALL_RESULT:\n case MESSAGE_FUNCTION_RESULT: {\n this.#resolveCall(...data.slice(1));\n break;\n }\n\n case MESSAGE_FUNCTION_RELEASE: {\n const id = data[1];\n this.functions.release(id, this);\n break;\n }\n }\n }, { signal: this.signal });\n }\n\n close() {\n this.#abort.abort();\n }\n\n call(func, args) {\n if (this.closed) {\n return Promise.reject(new ThreadClosedError());\n }\n\n // Claim the id and its resolver before yielding, so the ids reflect call\n // order and a result cannot arrive before there is something to receive it.\n const id = nanoid();\n const done = this.#waitForResult(id);\n\n this.#sendQueue = this.#sendQueue.then(async () => {\n try {\n const transferable = [];\n const serialized = await this.serialization.serialize(args, this, transferable);\n\n func(id, serialized, transferable);\n } catch (error) {\n // Serializing the arguments failed, so nothing was sent and no result\n // will ever come back. Reject this call and leave the queue usable.\n this.#resolveCall(id, undefined, error);\n }\n });\n\n return done;\n }\n\n async #callLocal(func, args, withResult) {\n /*\n * The queue is handed on as soon as the function has been *invoked*, not\n * when it settles. Ordering only needs the calls to start in message order;\n * waiting for completion would let one slow export stall every later\n * message, and deadlock outright if that export awaits a call back to the\n * paired thread.\n */\n let releaseQueue;\n const invoked = new Promise((resolve) => {\n releaseQueue = resolve;\n });\n\n const predecessor = this.#receiveQueue;\n this.#receiveQueue = invoked;\n\n try {\n await predecessor;\n\n const pendingResult = this.functions.call\n ? this.functions.call(func, args, this) // keep original contract\n : func(...(await this.serialization.deserialize(args, this)));\n\n releaseQueue();\n\n const result = await pendingResult;\n\n const transferable = [];\n const serialized = await this.serialization.serialize(result, this, transferable);\n\n withResult(serialized, undefined, transferable);\n } catch (error) {\n releaseQueue();\n withResult(undefined, await this.serialization.serialize(error, this));\n }\n }\n\n #handlerForCall(property) {\n return (...args) => {\n try {\n if (typeof property !== 'string' && typeof property !== 'number') {\n throw new Error(`Can’t call a symbol method on a thread: ${property.toString()}`);\n }\n\n return this.call((id, serializedArgs, transferable) => {\n this.messages.send([MESSAGE_CALL, id, property, serializedArgs], transferable);\n }, args);\n } catch (error) {\n return Promise.reject(error);\n }\n };\n }\n\n #resolveCall(...args) {\n const callID = args[0];\n const resolver = this.#idsToResolver.get(callID);\n\n if (resolver) {\n resolver(...args);\n this.#idsToResolver.delete(callID);\n }\n }\n\n #waitForResult(id) {\n const promise = new Promise((resolve, reject) => {\n this.#idsToResolver.set(id, async (_, value, error) => {\n try {\n if (error == null) {\n resolve(await this.serialization.deserialize(value, this));\n } else {\n reject(await this.serialization.deserialize(error, this));\n }\n } catch (deserializeError) {\n reject(deserializeError);\n }\n });\n });\n\n Object.defineProperty(promise, Symbol.asyncIterator, {\n async *value() {\n const result = await promise;\n\n Object.defineProperty(result, Symbol.asyncIterator, {\n value: () => result\n });\n\n yield* result;\n }\n });\n\n return promise;\n }\n}\n\nfunction createThreadImports(handlerForImport, imported) {\n let call;\n\n if (imported == null) {\n if (typeof Proxy !== 'function') {\n throw new Error(`You must pass an array of callable methods in environments without Proxies.`);\n }\n\n const cache = new Map();\n\n call = new Proxy({}, {\n get(_target, property) {\n if (cache.has(property)) {\n return cache.get(property);\n }\n\n const handler = handlerForImport(property);\n cache.set(property, handler);\n return handler;\n }\n });\n } else {\n call = {};\n\n for (const method of imported) {\n Object.defineProperty(call, method, {\n value: handlerForImport(method),\n writable: false,\n configurable: true,\n enumerable: true\n });\n }\n }\n\n return call;\n}\n\nfunction missingThreadFunction() {\n throw new Error(`You attempted to call a function that is not stored. It may have already been released.`);\n}\n\nexport { Thread };\n"],"ignoreList":[0],"mappings":";;;;;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,OAAO,eAAe,QAAQ,OAAO,eAAe,EAClD,aAAa,OACf,CAAC;GAED,OAAO;EACT,EACF,CAAC;EAED,OAAO;CACT;AACF;AAEA,SAAS,oBAAoB,kBAAkB,UAAU;CACvD,IAAI;CAEJ,IAAI,YAAY,MAAM;EACpB,IAAI,OAAO,UAAU,YACnB,MAAM,IAAI,MAAM,6EAA6E;EAG/F,MAAM,wBAAQ,IAAI,IAAI;EAEtB,OAAO,IAAI,MAAM,CAAC,GAAG,EACnB,IAAI,SAAS,UAAU;GACrB,IAAI,MAAM,IAAI,QAAQ,GACpB,OAAO,MAAM,IAAI,QAAQ;GAG3B,MAAM,UAAU,iBAAiB,QAAQ;GACzC,MAAM,IAAI,UAAU,OAAO;GAC3B,OAAO;EACT,EACF,CAAC;CACH,OAAO;EACL,OAAO,CAAC;EAER,KAAK,MAAM,UAAU,UACnB,OAAO,eAAe,MAAM,QAAQ;GAClC,OAAO,iBAAiB,MAAM;GAC9B,UAAU;GACV,cAAc;GACd,YAAY;EACd,CAAC;CAEL;CAEA,OAAO;AACT;AAEA,SAAS,wBAAwB;CAC/B,MAAM,IAAI,MAAM,yFAAyF;AAC3G"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/constants.mjs"],"sourcesContent":["const MESSAGE_CALL = 1;\nconst MESSAGE_CALL_RESULT = 2;\nconst MESSAGE_FUNCTION_CALL = 3;\nconst MESSAGE_FUNCTION_RESULT = 4;\nconst MESSAGE_FUNCTION_RELEASE = 5;\nconst SERIALIZE_METHOD = Symbol.for('quilt.threads.serialize');\nconst TRANSFERABLE = Symbol.for('quilt.threads.transferable');\n\nexport { MESSAGE_CALL, MESSAGE_CALL_RESULT, MESSAGE_FUNCTION_CALL, MESSAGE_FUNCTION_RELEASE, MESSAGE_FUNCTION_RESULT, SERIALIZE_METHOD, TRANSFERABLE };\n"],"x_google_ignoreList":[0],"mappings":";AAKA,IAAM,mBAAmB,OAAO,IAAI,yBAAyB;AAC7D,IAAM,eAAe,OAAO,IAAI,4BAA4B"}
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/constants.mjs"],"sourcesContent":["const MESSAGE_CALL = 1;\nconst MESSAGE_CALL_RESULT = 2;\nconst MESSAGE_FUNCTION_CALL = 3;\nconst MESSAGE_FUNCTION_RESULT = 4;\nconst MESSAGE_FUNCTION_RELEASE = 5;\nconst SERIALIZE_METHOD = Symbol.for('quilt.threads.serialize');\nconst TRANSFERABLE = Symbol.for('quilt.threads.transferable');\n\nexport { MESSAGE_CALL, MESSAGE_CALL_RESULT, MESSAGE_FUNCTION_CALL, MESSAGE_FUNCTION_RELEASE, MESSAGE_FUNCTION_RESULT, SERIALIZE_METHOD, TRANSFERABLE };\n"],"ignoreList":[0],"mappings":";AAKA,IAAM,mBAAmB,OAAO,IAAI,yBAAyB;AAC7D,IAAM,eAAe,OAAO,IAAI,4BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/errors.mjs"],"sourcesContent":["class ThreadClosedError extends Error {\n constructor() {\n super('You attempted to call a function on a closed thread.');\n }\n}\n\nexport { ThreadClosedError };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAM,oBAAN,cAAgC,MAAM;CACpC,cAAc;EACZ,MAAM,sDAAsD;CAC9D;AACF"}
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/errors.mjs"],"sourcesContent":["class ThreadClosedError extends Error {\n constructor() {\n super('You attempted to call a function on a closed thread.');\n }\n}\n\nexport { ThreadClosedError };\n"],"ignoreList":[0],"mappings":";AAAA,IAAM,oBAAN,cAAgC,MAAM;CACpC,cAAc;EACZ,MAAM,sDAAsD;CAC9D;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadFunctionsAutomatic.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs"],"sourcesContent":["import { MESSAGE_FUNCTION_CALL, MESSAGE_FUNCTION_RELEASE } from '../constants.mjs';\nimport { nanoid } from '../nanoid.mjs';\n\n/**\n * A strategy for managing functions across threads that automatically releases\n * functions when they are no longer needed. This is done by deserializing functions\n * into a proxy that can be called, and wrapping that proxy in a `FinalizationRegistry`,\n * which allows us to send a message to the parent thread when the function is no\n * longer used.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\nclass ThreadFunctionsAutomatic {\n #functionsToId = (() => new Map())();\n #idsToFunction = (() => new Map())();\n #idsToProxy = (() => new Map())();\n #finalization = (() => new WeakMap())();\n get(id) {\n return this.#idsToFunction.get(id);\n }\n release(id) {\n const func = this.#idsToFunction.get(id);\n if (func) {\n this.#idsToFunction.delete(id);\n this.#functionsToId.delete(func);\n }\n return Boolean(func);\n }\n serialize(func) {\n let id = this.#functionsToId.get(func);\n if (id == null) {\n id = nanoid();\n this.#functionsToId.set(func, id);\n this.#idsToFunction.set(id, func);\n }\n return id;\n }\n deserialize(id, thread) {\n let proxy = this.#idsToProxy.get(id)?.deref();\n if (proxy) return proxy;\n proxy = (...args) => {\n if (!this.#idsToProxy.has(id)) {\n throw new Error('You attempted to call a function that was already revoked.');\n }\n return thread.call((callID, args, transferable) => {\n thread.messages.send([MESSAGE_FUNCTION_CALL, callID, id, args], transferable);\n }, args);\n };\n this.#finalizationRegistry(thread)?.register(proxy, id);\n this.#idsToProxy.set(id, new WeakRef(proxy));\n return proxy;\n }\n #finalizationRegistry(thread) {\n let finalization = this.#finalization.get(thread);\n if (typeof FinalizationRegistry === 'undefined') {\n return undefined;\n }\n if (!finalization) {\n finalization = new FinalizationRegistry(id => {\n thread.messages.send([MESSAGE_FUNCTION_RELEASE, id]);\n });\n this.#finalization.set(thread, finalization);\n }\n return finalization;\n }\n}\n\nexport { ThreadFunctionsAutomatic };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;AAYA,IAAM,2BAAN,MAA+B;CAC7B,wCAAwB,IAAI,IAAI,EAAA,CAAG;CACnC,wCAAwB,IAAI,IAAI,EAAA,CAAG;CACnC,qCAAqB,IAAI,IAAI,EAAA,CAAG;CAChC,uCAAuB,IAAI,QAAQ,EAAA,CAAG;CACtC,IAAI,IAAI;EACN,OAAO,KAAK,eAAe,IAAI,EAAE;CACnC;CACA,QAAQ,IAAI;EACV,MAAM,OAAO,KAAK,eAAe,IAAI,EAAE;EACvC,IAAI,MAAM;GACR,KAAK,eAAe,OAAO,EAAE;GAC7B,KAAK,eAAe,OAAO,IAAI;EACjC;EACA,OAAO,QAAQ,IAAI;CACrB;CACA,UAAU,MAAM;EACd,IAAI,KAAK,KAAK,eAAe,IAAI,IAAI;EACrC,IAAI,MAAM,MAAM;GACd,KAAK,OAAO;GACZ,KAAK,eAAe,IAAI,MAAM,EAAE;GAChC,KAAK,eAAe,IAAI,IAAI,IAAI;EAClC;EACA,OAAO;CACT;CACA,YAAY,IAAI,QAAQ;EACtB,IAAI,QAAQ,KAAK,YAAY,IAAI,EAAE,CAAC,EAAE,MAAM;EAC5C,IAAI,OAAO,OAAO;EAClB,SAAS,GAAG,SAAS;GACnB,IAAI,CAAC,KAAK,YAAY,IAAI,EAAE,GAC1B,MAAM,IAAI,MAAM,4DAA4D;GAE9E,OAAO,OAAO,MAAM,QAAQ,MAAM,iBAAiB;IACjD,OAAO,SAAS,KAAK;;KAAwB;KAAQ;KAAI;IAAI,GAAG,YAAY;GAC9E,GAAG,IAAI;EACT;EACA,KAAK,sBAAsB,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE;EACtD,KAAK,YAAY,IAAI,IAAI,IAAI,QAAQ,KAAK,CAAC;EAC3C,OAAO;CACT;CACA,sBAAsB,QAAQ;EAC5B,IAAI,eAAe,KAAK,cAAc,IAAI,MAAM;EAChD,IAAI,OAAO,yBAAyB,aAClC;EAEF,IAAI,CAAC,cAAc;GACjB,eAAe,IAAI,sBAAqB,OAAM;IAC5C,OAAO,SAAS,KAAK,CAAA,GAA2B,EAAE,CAAC;GACrD,CAAC;GACD,KAAK,cAAc,IAAI,QAAQ,YAAY;EAC7C;EACA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"ThreadFunctionsAutomatic.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs"],"sourcesContent":["import { MESSAGE_FUNCTION_CALL, MESSAGE_FUNCTION_RELEASE } from '../constants.mjs';\nimport { nanoid } from '../nanoid.mjs';\n\n/**\n * A strategy for managing functions across threads that automatically releases\n * functions when they are no longer needed. This is done by deserializing functions\n * into a proxy that can be called, and wrapping that proxy in a `FinalizationRegistry`,\n * which allows us to send a message to the parent thread when the function is no\n * longer used.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\nclass ThreadFunctionsAutomatic {\n #functionsToId = (() => new Map())();\n #idsToFunction = (() => new Map())();\n #idsToProxy = (() => new Map())();\n #finalization = (() => new WeakMap())();\n get(id) {\n return this.#idsToFunction.get(id);\n }\n release(id) {\n const func = this.#idsToFunction.get(id);\n if (func) {\n this.#idsToFunction.delete(id);\n this.#functionsToId.delete(func);\n }\n return Boolean(func);\n }\n serialize(func) {\n let id = this.#functionsToId.get(func);\n if (id == null) {\n id = nanoid();\n this.#functionsToId.set(func, id);\n this.#idsToFunction.set(id, func);\n }\n return id;\n }\n deserialize(id, thread) {\n let proxy = this.#idsToProxy.get(id)?.deref();\n if (proxy) return proxy;\n proxy = (...args) => {\n if (!this.#idsToProxy.has(id)) {\n throw new Error('You attempted to call a function that was already revoked.');\n }\n return thread.call((callID, args, transferable) => {\n thread.messages.send([MESSAGE_FUNCTION_CALL, callID, id, args], transferable);\n }, args);\n };\n this.#finalizationRegistry(thread)?.register(proxy, id);\n this.#idsToProxy.set(id, new WeakRef(proxy));\n return proxy;\n }\n #finalizationRegistry(thread) {\n let finalization = this.#finalization.get(thread);\n if (typeof FinalizationRegistry === 'undefined') {\n return undefined;\n }\n if (!finalization) {\n finalization = new FinalizationRegistry(id => {\n thread.messages.send([MESSAGE_FUNCTION_RELEASE, id]);\n });\n this.#finalization.set(thread, finalization);\n }\n return finalization;\n }\n}\n\nexport { ThreadFunctionsAutomatic };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;AAYA,IAAM,2BAAN,MAA+B;CAC7B,wCAAwB,IAAI,IAAI,EAAA,CAAG;CACnC,wCAAwB,IAAI,IAAI,EAAA,CAAG;CACnC,qCAAqB,IAAI,IAAI,EAAA,CAAG;CAChC,uCAAuB,IAAI,QAAQ,EAAA,CAAG;CACtC,IAAI,IAAI;EACN,OAAO,KAAK,eAAe,IAAI,EAAE;CACnC;CACA,QAAQ,IAAI;EACV,MAAM,OAAO,KAAK,eAAe,IAAI,EAAE;EACvC,IAAI,MAAM;GACR,KAAK,eAAe,OAAO,EAAE;GAC7B,KAAK,eAAe,OAAO,IAAI;EACjC;EACA,OAAO,QAAQ,IAAI;CACrB;CACA,UAAU,MAAM;EACd,IAAI,KAAK,KAAK,eAAe,IAAI,IAAI;EACrC,IAAI,MAAM,MAAM;GACd,KAAK,OAAO;GACZ,KAAK,eAAe,IAAI,MAAM,EAAE;GAChC,KAAK,eAAe,IAAI,IAAI,IAAI;EAClC;EACA,OAAO;CACT;CACA,YAAY,IAAI,QAAQ;EACtB,IAAI,QAAQ,KAAK,YAAY,IAAI,EAAE,CAAC,EAAE,MAAM;EAC5C,IAAI,OAAO,OAAO;EAClB,SAAS,GAAG,SAAS;GACnB,IAAI,CAAC,KAAK,YAAY,IAAI,EAAE,GAC1B,MAAM,IAAI,MAAM,4DAA4D;GAE9E,OAAO,OAAO,MAAM,QAAQ,MAAM,iBAAiB;IACjD,OAAO,SAAS,KAAK;;KAAwB;KAAQ;KAAI;IAAI,GAAG,YAAY;GAC9E,GAAG,IAAI;EACT;EACA,KAAK,sBAAsB,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE;EACtD,KAAK,YAAY,IAAI,IAAI,IAAI,QAAQ,KAAK,CAAC;EAC3C,OAAO;CACT;CACA,sBAAsB,QAAQ;EAC5B,IAAI,eAAe,KAAK,cAAc,IAAI,MAAM;EAChD,IAAI,OAAO,yBAAyB,aAClC;EAEF,IAAI,CAAC,cAAc;GACjB,eAAe,IAAI,sBAAqB,OAAM;IAC5C,OAAO,SAAS,KAAK,CAAA,GAA2B,EAAE,CAAC;GACrD,CAAC;GACD,KAAK,cAAc,IAAI,QAAQ,YAAY;EAC7C;EACA,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"nanoid.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/nanoid.mjs"],"sourcesContent":["// Copied from https://github.com/ai/nanoid/blob/main/nanoid.js\nlet a = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';\nfunction nanoid(e = 21) {\n let t = '',\n r = crypto.getRandomValues(new Uint8Array(e));\n for (let n = 0; n < e; n++) t += a[63 & r[n]];\n return t;\n}\n\nexport { nanoid };\n"],"x_google_ignoreList":[0],"mappings":";AACA,IAAI,IAAI;AACR,SAAS,OAAO,IAAI,IAAI;CACtB,IAAI,IAAI,IACN,IAAI,OAAO,gBAAgB,IAAI,WAAW,CAAC,CAAC;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK,KAAK,EAAE,KAAK,EAAE;CAC1C,OAAO;AACT"}
1
+ {"version":3,"file":"nanoid.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/nanoid.mjs"],"sourcesContent":["// Copied from https://github.com/ai/nanoid/blob/main/nanoid.js\nlet a = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';\nfunction nanoid(e = 21) {\n let t = '',\n r = crypto.getRandomValues(new Uint8Array(e));\n for (let n = 0; n < e; n++) t += a[63 & r[n]];\n return t;\n}\n\nexport { nanoid };\n"],"ignoreList":[0],"mappings":";AACA,IAAI,IAAI;AACR,SAAS,OAAO,IAAI,IAAI;CACtB,IAAI,IAAI,IACN,IAAI,OAAO,gBAAgB,IAAI,WAAW,CAAC,CAAC;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK,KAAK,EAAE,KAAK,EAAE;CAC1C,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadSerializationStructuredClone.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs"],"sourcesContent":["import { TRANSFERABLE, SERIALIZE_METHOD } from '../constants.mjs';\nimport { isIterator, isBasicObject } from './shared.mjs';\n\nconst FUNCTION = '_@f';\nconst ASYNC_ITERATOR = '_@i';\n\n/**\n * A thread encoder that can transfer supports a wide variety of JavaScript types by\n * converting them to a format that the [`structuredClone`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm)\n * algorithm can process. This\n *\n * Additionally, this encoder will convert functions into a JSON-friendly representation.\n * These functions will use a manual memory management technique to ensure they can be\n * garbage collected by default, but can be configured to use a `WeakRef`-based automatic\n * memory management system by setting the `garbageCollection: 'weak-ref'` option.\n */\nclass ThreadSerializationStructuredClone {\n #customSerializer;\n #customDeserializer;\n\n constructor(options) {\n this.#customSerializer = options?.serialize;\n this.#customDeserializer = options?.deserialize;\n }\n\n /**\n * Serializes a value into a structured cloning-compatible format that can be transferred between threads.\n */\n async serialize(value, thread, transferable) {\n return this.#serializeInternal(value, thread, transferable);\n }\n\n async #serializeInternal(value, thread, transferable, seen = new Map(), isApplyingDefault = false) {\n if (value == null) return value;\n if (seen.has(value)) return seen.get(value);\n\n /*\n * Prevent circular references. `undefined` parks a placeholder so a value\n * that reaches itself terminates instead of recursing forever; the real\n * result overwrites it once this frame is done.\n *\n * This only holds while serialization visits one value at a time. Upstream\n * is synchronous, so that is free. This build is async (Flow's serializers\n * await File reads), which makes it a rule the traversal has to keep: every\n * container below walks its members sequentially. Serialize them\n * concurrently and a second reference reaching the same value from a\n * parallel branch reads the placeholder while the first branch is still in\n * flight, and silently serializes to `undefined`.\n */\n seen.set(value, undefined);\n\n if (typeof value === 'object') {\n if (this.#customSerializer && !isApplyingDefault) {\n const customValue = await this.#customSerializer(\n value,\n (value) => this.#serializeInternal(value, thread, transferable, seen, true),\n thread,\n transferable,\n );\n\n if (customValue !== undefined) {\n seen.set(value, customValue);\n return customValue;\n }\n }\n\n if (value[TRANSFERABLE]) {\n transferable?.push(value);\n seen.set(value, value);\n return value;\n }\n\n const serializeValue = (value) => {\n return this.#serializeInternal(value, thread, transferable, seen);\n };\n\n if (typeof value[SERIALIZE_METHOD] === 'function') {\n const result = await value[SERIALIZE_METHOD]({\n serialize: serializeValue,\n });\n\n seen.set(value, result);\n return result;\n }\n\n if (Array.isArray(value)) {\n const result = [];\n\n for (const item of value) {\n result.push(await serializeValue(item));\n }\n\n seen.set(value, result);\n return result;\n }\n\n if (value instanceof Map) {\n const entries = [];\n\n for (const [entryKey, entryValue] of value.entries()) {\n entries.push([\n await serializeValue(entryKey),\n await serializeValue(entryValue),\n ]);\n }\n\n const result = new Map(entries);\n seen.set(value, result);\n return result;\n }\n\n if (value instanceof Set) {\n const entries = [];\n\n for (const entry of value) {\n entries.push(await serializeValue(entry));\n }\n\n const result = new Set(entries);\n seen.set(value, result);\n return result;\n }\n\n const valueIsIterator = isIterator(value);\n\n if (isBasicObject(value) || valueIsIterator) {\n const result = {};\n\n for (const key of Object.keys(value)) {\n result[key] = await serializeValue(value[key]);\n }\n\n if (valueIsIterator) {\n result.next ??= await serializeValue(value.next.bind(value));\n result.return ??= await serializeValue(value.return.bind(value));\n result.throw ??= await serializeValue(value.throw.bind(value));\n result[ASYNC_ITERATOR] = true;\n }\n\n seen.set(value, result);\n return result;\n }\n }\n\n if (typeof value === 'function') {\n const serialized = thread.functions.serialize(value, thread, transferable);\n const result = { [FUNCTION]: serialized };\n\n seen.set(value, result);\n return result;\n }\n\n seen.set(value, value);\n return value;\n }\n\n /**\n * Deserializes a structured cloning-compatible value from another thread.\n */\n async deserialize(value, thread) {\n return this.#deserializeInternal(value, thread);\n }\n\n async #deserializeInternal(value, thread, isApplyingDefault = false) {\n if (value == null) return value;\n\n if (typeof value === 'object') {\n if (this.#customDeserializer && !isApplyingDefault) {\n const customValue = await this.#customDeserializer(\n value,\n (value) => this.#deserializeInternal(value, thread, true),\n thread,\n );\n\n if (customValue !== undefined) {\n return customValue;\n }\n }\n\n if (value == null) {\n return value;\n }\n\n if (Array.isArray(value)) {\n return Promise.all(value.map((value) => this.#deserializeInternal(value, thread)));\n }\n\n if (value instanceof Map) {\n const entries = await Promise.all(\n [...value].map(async ([key, value]) => [\n await this.#deserializeInternal(key, thread),\n await this.#deserializeInternal(value, thread),\n ]),\n );\n\n return new Map(entries);\n }\n\n if (value instanceof Set) {\n const entries = await Promise.all(\n [...value].map((entry) => this.#deserializeInternal(entry, thread)),\n );\n\n return new Set(entries);\n }\n\n if (FUNCTION in value) {\n const func = thread.functions.deserialize(value[FUNCTION], thread);\n return func;\n }\n\n if (!isBasicObject(value)) {\n return value;\n }\n\n const result = {};\n\n for (const key of Object.keys(value)) {\n if (key === ASYNC_ITERATOR) {\n result[Symbol.asyncIterator] = () => result;\n } else {\n result[key] = await this.#deserializeInternal(value[key], thread);\n }\n }\n\n return result;\n }\n\n return value;\n }\n}\n\nexport { ThreadSerializationStructuredClone };\n"],"x_google_ignoreList":[0],"mappings":";;;AAGA,IAAM,WAAW;AACjB,IAAM,iBAAiB;;;;;;;;;;;AAYvB,IAAM,qCAAN,MAAyC;CACvC;CACA;CAEA,YAAY,SAAS;EACnB,KAAK,oBAAoB,SAAS;EAClC,KAAK,sBAAsB,SAAS;CACtC;;;;CAKA,MAAM,UAAU,OAAO,QAAQ,cAAc;EAC3C,OAAO,KAAK,mBAAmB,OAAO,QAAQ,YAAY;CAC5D;CAEA,MAAM,mBAAmB,OAAO,QAAQ,cAAc,uBAAO,IAAI,IAAI,GAAG,oBAAoB,OAAO;EACjG,IAAI,SAAS,MAAM,OAAO;EAC1B,IAAI,KAAK,IAAI,KAAK,GAAG,OAAO,KAAK,IAAI,KAAK;EAe1C,KAAK,IAAI,OAAO,KAAA,CAAS;EAEz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,KAAK;IACxB,MAAM,UAAU,MAAM,QAAQ,IAC5B,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,WAAW,CACrC,MAAM,KAAK,qBAAqB,KAAK,MAAM,GAC3C,MAAM,KAAK,qBAAqB,OAAO,MAAM,CAC/C,CAAC,CACH;IAEA,OAAO,IAAI,IAAI,OAAO;GACxB;GAEA,IAAI,iBAAiB,KAAK;IACxB,MAAM,UAAU,MAAM,QAAQ,IAC5B,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,UAAU,KAAK,qBAAqB,OAAO,MAAM,CAAC,CACpE;IAEA,OAAO,IAAI,IAAI,OAAO;GACxB;GAEA,IAAI,YAAY,OAEd,OADa,OAAO,UAAU,YAAY,MAAM,WAAW,MACjD;GAGZ,IAAI,CAAC,cAAc,KAAK,GACtB,OAAO;GAGT,MAAM,SAAS,CAAC;GAEhB,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GACjC,IAAI,QAAQ,gBACV,OAAO,OAAO,uBAAuB;QAErC,OAAO,OAAO,MAAM,KAAK,qBAAqB,MAAM,MAAM,MAAM;GAIpE,OAAO;EACT;EAEA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"ThreadSerializationStructuredClone.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs"],"sourcesContent":["import { TRANSFERABLE, SERIALIZE_METHOD } from '../constants.mjs';\nimport { isIterator, isBasicObject } from './shared.mjs';\n\nconst FUNCTION = '_@f';\nconst ASYNC_ITERATOR = '_@i';\n\n/**\n * A thread encoder that can transfer supports a wide variety of JavaScript types by\n * converting them to a format that the [`structuredClone`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm)\n * algorithm can process. This\n *\n * Additionally, this encoder will convert functions into a JSON-friendly representation.\n * These functions will use a manual memory management technique to ensure they can be\n * garbage collected by default, but can be configured to use a `WeakRef`-based automatic\n * memory management system by setting the `garbageCollection: 'weak-ref'` option.\n */\nclass ThreadSerializationStructuredClone {\n #customSerializer;\n #customDeserializer;\n\n constructor(options) {\n this.#customSerializer = options?.serialize;\n this.#customDeserializer = options?.deserialize;\n }\n\n /**\n * Serializes a value into a structured cloning-compatible format that can be transferred between threads.\n */\n async serialize(value, thread, transferable) {\n return this.#serializeInternal(value, thread, transferable);\n }\n\n async #serializeInternal(value, thread, transferable, seen = new Map(), isApplyingDefault = false) {\n if (value == null) return value;\n if (seen.has(value)) return seen.get(value);\n\n /*\n * Prevent circular references. `undefined` parks a placeholder so a value\n * that reaches itself terminates instead of recursing forever; the real\n * result overwrites it once this frame is done.\n *\n * This only holds while serialization visits one value at a time. Upstream\n * is synchronous, so that is free. This build is async (Flow's serializers\n * await File reads), which makes it a rule the traversal has to keep: every\n * container below walks its members sequentially. Serialize them\n * concurrently and a second reference reaching the same value from a\n * parallel branch reads the placeholder while the first branch is still in\n * flight, and silently serializes to `undefined`.\n */\n seen.set(value, undefined);\n\n if (typeof value === 'object') {\n if (this.#customSerializer && !isApplyingDefault) {\n const customValue = await this.#customSerializer(\n value,\n (value) => this.#serializeInternal(value, thread, transferable, seen, true),\n thread,\n transferable,\n );\n\n if (customValue !== undefined) {\n seen.set(value, customValue);\n return customValue;\n }\n }\n\n if (value[TRANSFERABLE]) {\n transferable?.push(value);\n seen.set(value, value);\n return value;\n }\n\n const serializeValue = (value) => {\n return this.#serializeInternal(value, thread, transferable, seen);\n };\n\n if (typeof value[SERIALIZE_METHOD] === 'function') {\n const result = await value[SERIALIZE_METHOD]({\n serialize: serializeValue,\n });\n\n seen.set(value, result);\n return result;\n }\n\n if (Array.isArray(value)) {\n const result = [];\n\n for (const item of value) {\n result.push(await serializeValue(item));\n }\n\n seen.set(value, result);\n return result;\n }\n\n if (value instanceof Map) {\n const entries = [];\n\n for (const [entryKey, entryValue] of value.entries()) {\n entries.push([\n await serializeValue(entryKey),\n await serializeValue(entryValue),\n ]);\n }\n\n const result = new Map(entries);\n seen.set(value, result);\n return result;\n }\n\n if (value instanceof Set) {\n const entries = [];\n\n for (const entry of value) {\n entries.push(await serializeValue(entry));\n }\n\n const result = new Set(entries);\n seen.set(value, result);\n return result;\n }\n\n const valueIsIterator = isIterator(value);\n\n if (isBasicObject(value) || valueIsIterator) {\n const result = {};\n\n for (const key of Object.keys(value)) {\n result[key] = await serializeValue(value[key]);\n }\n\n if (valueIsIterator) {\n result.next ??= await serializeValue(value.next.bind(value));\n result.return ??= await serializeValue(value.return.bind(value));\n result.throw ??= await serializeValue(value.throw.bind(value));\n result[ASYNC_ITERATOR] = true;\n }\n\n seen.set(value, result);\n return result;\n }\n }\n\n if (typeof value === 'function') {\n const serialized = thread.functions.serialize(value, thread, transferable);\n const result = { [FUNCTION]: serialized };\n\n seen.set(value, result);\n return result;\n }\n\n seen.set(value, value);\n return value;\n }\n\n /**\n * Deserializes a structured cloning-compatible value from another thread.\n */\n async deserialize(value, thread) {\n return this.#deserializeInternal(value, thread);\n }\n\n async #deserializeInternal(value, thread, isApplyingDefault = false) {\n if (value == null) return value;\n\n if (typeof value === 'object') {\n if (this.#customDeserializer && !isApplyingDefault) {\n const customValue = await this.#customDeserializer(\n value,\n (value) => this.#deserializeInternal(value, thread, true),\n thread,\n );\n\n if (customValue !== undefined) {\n return customValue;\n }\n }\n\n if (value == null) {\n return value;\n }\n\n if (Array.isArray(value)) {\n return Promise.all(value.map((value) => this.#deserializeInternal(value, thread)));\n }\n\n if (value instanceof Map) {\n const entries = await Promise.all(\n [...value].map(async ([key, value]) => [\n await this.#deserializeInternal(key, thread),\n await this.#deserializeInternal(value, thread),\n ]),\n );\n\n return new Map(entries);\n }\n\n if (value instanceof Set) {\n const entries = await Promise.all(\n [...value].map((entry) => this.#deserializeInternal(entry, thread)),\n );\n\n return new Set(entries);\n }\n\n if (FUNCTION in value) {\n const func = thread.functions.deserialize(value[FUNCTION], thread);\n return func;\n }\n\n if (!isBasicObject(value)) {\n return value;\n }\n\n const result = {};\n\n for (const key of Object.keys(value)) {\n if (key === ASYNC_ITERATOR) {\n result[Symbol.asyncIterator] = () => result;\n } else {\n result[key] = await this.#deserializeInternal(value[key], thread);\n }\n }\n\n return result;\n }\n\n return value;\n }\n}\n\nexport { ThreadSerializationStructuredClone };\n"],"ignoreList":[0],"mappings":";;;AAGA,IAAM,WAAW;AACjB,IAAM,iBAAiB;;;;;;;;;;;AAYvB,IAAM,qCAAN,MAAyC;CACvC;CACA;CAEA,YAAY,SAAS;EACnB,KAAK,oBAAoB,SAAS;EAClC,KAAK,sBAAsB,SAAS;CACtC;;;;CAKA,MAAM,UAAU,OAAO,QAAQ,cAAc;EAC3C,OAAO,KAAK,mBAAmB,OAAO,QAAQ,YAAY;CAC5D;CAEA,MAAM,mBAAmB,OAAO,QAAQ,cAAc,uBAAO,IAAI,IAAI,GAAG,oBAAoB,OAAO;EACjG,IAAI,SAAS,MAAM,OAAO;EAC1B,IAAI,KAAK,IAAI,KAAK,GAAG,OAAO,KAAK,IAAI,KAAK;EAe1C,KAAK,IAAI,OAAO,KAAA,CAAS;EAEzB,IAAI,OAAO,UAAU,UAAU;GAC7B,IAAI,KAAK,qBAAqB,CAAC,mBAAmB;IAChD,MAAM,cAAc,MAAM,KAAK,kBAC7B,QACC,UAAU,KAAK,mBAAmB,OAAO,QAAQ,cAAc,MAAM,IAAI,GAC1E,QACA,YACF;IAEA,IAAI,gBAAgB,KAAA,GAAW;KAC7B,KAAK,IAAI,OAAO,WAAW;KAC3B,OAAO;IACT;GACF;GAEA,IAAI,MAAM,eAAe;IACvB,cAAc,KAAK,KAAK;IACxB,KAAK,IAAI,OAAO,KAAK;IACrB,OAAO;GACT;GAEA,MAAM,kBAAkB,UAAU;IAChC,OAAO,KAAK,mBAAmB,OAAO,QAAQ,cAAc,IAAI;GAClE;GAEA,IAA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AAU,YAAY,MAAM,WAAW,MACjD;GAGZ,IAAI,CAAC,cAAc,KAAK,GACtB,OAAO;GAGT,MAAM,SAAS,CAAC;GAEhB,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GACjC,IAAI,QAAQ,gBACV,OAAO,OAAO,uBAAuB;QAErC,OAAO,OAAO,MAAM,KAAK,qBAAqB,MAAM,MAAM,MAAM;GAIpE,OAAO;EACT;EAEA,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"shared.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/serialization/shared.mjs"],"sourcesContent":["function isIterator(value) {\n return value != null && (Symbol.asyncIterator in value || Symbol.iterator in value) && typeof value.next === 'function';\n}\nfunction isBasicObject(value) {\n if (value == null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value);\n return prototype == null || prototype === Object.prototype;\n}\n\nexport { isBasicObject, isIterator };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,WAAW,OAAO;CACzB,OAAO,SAAS,SAAS,OAAO,iBAAiB,SAAS,OAAO,YAAY,UAAU,OAAO,MAAM,SAAS;AAC/G;AACA,SAAS,cAAc,OAAO;CAC5B,IAAI,SAAS,QAAQ,OAAO,UAAU,UAAU,OAAO;CACvD,MAAM,YAAY,OAAO,eAAe,KAAK;CAC7C,OAAO,aAAa,QAAQ,cAAc,OAAO;AACnD"}
1
+ {"version":3,"file":"shared.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/serialization/shared.mjs"],"sourcesContent":["function isIterator(value) {\n return value != null && (Symbol.asyncIterator in value || Symbol.iterator in value) && typeof value.next === 'function';\n}\nfunction isBasicObject(value) {\n if (value == null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value);\n return prototype == null || prototype === Object.prototype;\n}\n\nexport { isBasicObject, isIterator };\n"],"ignoreList":[0],"mappings":";AAAA,SAAS,WAAW,OAAO;CACzB,OAAO,SAAS,SAAS,OAAO,iBAAiB,SAAS,OAAO,YAAY,UAAU,OAAO,MAAM,SAAS;AAC/G;AACA,SAAS,cAAc,OAAO;CAC5B,IAAI,SAAS,QAAQ,OAAO,UAAU,UAAU,OAAO;CACvD,MAAM,YAAY,OAAO,eAAe,KAAK;CAC7C,OAAO,aAAa,QAAQ,cAAc,OAAO;AACnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadIframe.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs"],"sourcesContent":["import { Thread } from '../Thread.mjs';\nimport { windowToThreadTarget } from './window/ThreadWindow.mjs';\nimport { ThreadNestedIframe } from './ThreadNestedIframe.mjs';\n\n/**\n * Creates a thread from an iframe element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const iframe = document.querySelector('iframe#thread-iframe');\n * const thread = new ThreadIframe(iframe);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadIframe extends Thread {\n /**\n * Creates a thread from an iframe element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const iframe = document.querySelector('iframe#thread-iframe');\n * const thread = ThreadIframe.from(iframe);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(iframe, options) {\n return new ThreadIframe(iframe, options);\n }\n\n /**\n * Starts a thread wrapped around an iframe element, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.import(iframe);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the nested window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.parent.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(iframe, options) {\n return new ThreadIframe(iframe, options).imports;\n }\n\n /**\n * Starts a thread wrapped around an iframe element, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.export(iframe, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the nested iframe:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.parent.import();\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(iframe, exports, options) {\n new ThreadIframe(iframe, {\n ...options,\n exports\n });\n }\n\n /**\n * Creates a thread from a `window.parent`, a reference to the parent window when rendering\n * in a nested iframe.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/parent\n *\n * @example\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const thread = ThreadIframe.parent();\n * await thread.imports.sendMessage('Hello world!');\n */\n static parent = (() => Object.assign(options => new ThreadNestedIframe(options), {\n /**\n * Starts a thread wrapped around a parent window, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.parent.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.export(iframe, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n import: options => ThreadNestedIframe.import(options),\n /**\n * Starts a thread wrapped around a parent window, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.parent.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.import(iframe);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n export: (exports, options) => ThreadNestedIframe.export(exports, options)\n }))();\n constructor(iframe, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(windowToThreadTarget(iframe.contentWindow, {\n targetOrigin\n }), options);\n this.iframe = iframe;\n }\n}\n\nexport { ThreadIframe };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,eAAN,MAAM,qBAAqB,OAAO;;;;;;;;;;;;;CAahC,OAAO,KAAK,QAAQ,SAAS;EAC3B,OAAO,IAAI,aAAa,QAAQ,OAAO;CACzC;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS;EAC7B,OAAO,IAAI,aAAa,QAAQ,OAAO,CAAC,CAAC;CAC3C;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS,SAAS;EACtC,IAAI,aAAa,QAAQ;GACvB,GAAG;GACH;EACF,CAAC;CACH;;;;;;;;;;;;;CAcA,OAAO,gBAAgB,OAAO,QAAO,YAAW,IAAI,mBAAmB,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuB/E,SAAQ,YAAW,mBAAmB,OAAO,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAuBpD,SAAS,SAAS,YAAY,mBAAmB,OAAO,SAAS,OAAO;CAC1E,CAAC,EAAA,CAAG;CACJ,YAAY,QAAQ,EAClB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,MAAM,qBAAqB,OAAO,eAAe,EAC/C,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF"}
1
+ {"version":3,"file":"ThreadIframe.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs"],"sourcesContent":["import { Thread } from '../Thread.mjs';\nimport { windowToThreadTarget } from './window/ThreadWindow.mjs';\nimport { ThreadNestedIframe } from './ThreadNestedIframe.mjs';\n\n/**\n * Creates a thread from an iframe element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const iframe = document.querySelector('iframe#thread-iframe');\n * const thread = new ThreadIframe(iframe);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadIframe extends Thread {\n /**\n * Creates a thread from an iframe element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const iframe = document.querySelector('iframe#thread-iframe');\n * const thread = ThreadIframe.from(iframe);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(iframe, options) {\n return new ThreadIframe(iframe, options);\n }\n\n /**\n * Starts a thread wrapped around an iframe element, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.import(iframe);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the nested window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.parent.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(iframe, options) {\n return new ThreadIframe(iframe, options).imports;\n }\n\n /**\n * Starts a thread wrapped around an iframe element, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.export(iframe, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the nested iframe:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.parent.import();\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(iframe, exports, options) {\n new ThreadIframe(iframe, {\n ...options,\n exports\n });\n }\n\n /**\n * Creates a thread from a `window.parent`, a reference to the parent window when rendering\n * in a nested iframe.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/parent\n *\n * @example\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const thread = ThreadIframe.parent();\n * await thread.imports.sendMessage('Hello world!');\n */\n static parent = (() => Object.assign(options => new ThreadNestedIframe(options), {\n /**\n * Starts a thread wrapped around a parent window, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.parent.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.export(iframe, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n import: options => ThreadNestedIframe.import(options),\n /**\n * Starts a thread wrapped around a parent window, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.parent.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.import(iframe);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n export: (exports, options) => ThreadNestedIframe.export(exports, options)\n }))();\n constructor(iframe, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(windowToThreadTarget(iframe.contentWindow, {\n targetOrigin\n }), options);\n this.iframe = iframe;\n }\n}\n\nexport { ThreadIframe };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,eAAN,MAAM,qBAAqB,OAAO;;;;;;;;;;;;;CAahC,OAAO,KAAK,QAAQ,SAAS;EAC3B,OAAO,IAAI,aAAa,QAAQ,OAAO;CACzC;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS;EAC7B,OAAO,IAAI,aAAa,QAAQ,OAAO,CAAC,CAAC;CAC3C;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS,SAAS;EACtC,IAAI,aAAa,QAAQ;GACvB,GAAG;GACH;EACF,CAAC;CACH;;;;;;;;;;;;;CAcA,OAAO,gBAAgB,OAAO,QAAO,YAAW,IAAI,mBAAmB,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuB/E,SAAQ,YAAW,mBAAmB,OAAO,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAuBpD,SAAS,SAAS,YAAY,mBAAmB,OAAO,SAAS,OAAO;CAC1E,CAAC,EAAA,CAAG;CACJ,YAAY,QAAQ,EAClB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,MAAM,qBAAqB,OAAO,eAAe,EAC/C,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadNestedIframe.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs"],"sourcesContent":["import { Thread } from '../Thread.mjs';\nimport { nestedWindowToThreadTarget } from './window/ThreadNestedWindow.mjs';\n\n/**\n * Creates a thread from within an iframe nested in a top-level document.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadNestedIframe} from '@quilted/threads';\n *\n * const thread = new ThreadNestedIframe();\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadNestedIframe extends Thread {\n /**\n * Starts a thread wrapped around a parent window, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedIframe.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.export(iframe, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(options) {\n return new ThreadNestedIframe(options).imports;\n }\n\n /**\n * Starts a thread wrapped around a parent window, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedIframe} from '@quilted/threads';\n *\n * ThreadNestedIframe.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.import(iframe);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(exports, options) {\n new ThreadNestedIframe({\n ...options,\n exports\n });\n }\n constructor({\n parent = globalThis.parent,\n targetOrigin = '*',\n ...options\n } = {}) {\n if (typeof self === 'undefined' || parent == null) {\n throw new Error('You are not inside an iframe, because there is no parent window.');\n }\n super(nestedWindowToThreadTarget(parent, {\n targetOrigin\n }), options);\n this.parent = parent;\n }\n}\n\nexport { ThreadNestedIframe };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;AAcA,IAAM,qBAAN,MAAM,2BAA2B,OAAO;;;;;;;;;;;;;;;;;;;;;;;CAuBtC,OAAO,OAAO,SAAS;EACrB,OAAO,IAAI,mBAAmB,OAAO,CAAC,CAAC;CACzC;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,SAAS,SAAS;EAC9B,IAAI,mBAAmB;GACrB,GAAG;GACH;EACF,CAAC;CACH;CACA,YAAY,EACV,SAAS,WAAW,QACpB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,IAAI,OAAO,SAAS,eAAe,UAAU,MAC3C,MAAM,IAAI,MAAM,kEAAkE;EAEpF,MAAM,2BAA2B,QAAQ,EACvC,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF"}
1
+ {"version":3,"file":"ThreadNestedIframe.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs"],"sourcesContent":["import { Thread } from '../Thread.mjs';\nimport { nestedWindowToThreadTarget } from './window/ThreadNestedWindow.mjs';\n\n/**\n * Creates a thread from within an iframe nested in a top-level document.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadNestedIframe} from '@quilted/threads';\n *\n * const thread = new ThreadNestedIframe();\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadNestedIframe extends Thread {\n /**\n * Starts a thread wrapped around a parent window, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedIframe.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * ThreadIframe.export(iframe, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(options) {\n return new ThreadNestedIframe(options).imports;\n }\n\n /**\n * Starts a thread wrapped around a parent window, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedIframe} from '@quilted/threads';\n *\n * ThreadNestedIframe.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadIframe} from '@quilted/threads';\n *\n * const {getMessage} = ThreadIframe.import(iframe);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(exports, options) {\n new ThreadNestedIframe({\n ...options,\n exports\n });\n }\n constructor({\n parent = globalThis.parent,\n targetOrigin = '*',\n ...options\n } = {}) {\n if (typeof self === 'undefined' || parent == null) {\n throw new Error('You are not inside an iframe, because there is no parent window.');\n }\n super(nestedWindowToThreadTarget(parent, {\n targetOrigin\n }), options);\n this.parent = parent;\n }\n}\n\nexport { ThreadNestedIframe };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;AAcA,IAAM,qBAAN,MAAM,2BAA2B,OAAO;;;;;;;;;;;;;;;;;;;;;;;CAuBtC,OAAO,OAAO,SAAS;EACrB,OAAO,IAAI,mBAAmB,OAAO,CAAC,CAAC;CACzC;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,SAAS,SAAS;EAC9B,IAAI,mBAAmB;GACrB,GAAG;GACH;EACF,CAAC;CACH;CACA,YAAY,EACV,SAAS,WAAW,QACpB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,IAAI,OAAO,SAAS,eAAe,UAAU,MAC3C,MAAM,IAAI,MAAM,kEAAkE;EAEpF,MAAM,2BAA2B,QAAQ,EACvC,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadNestedWindow.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/ThreadNestedWindow.mjs"],"sourcesContent":["import { Thread } from '../../Thread.mjs';\nimport { CHECK_MESSAGE, RESPONSE_MESSAGE } from './shared.mjs';\n\n/**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = new ThreadNestedWindow(window.opener);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadNestedWindow extends Thread {\n /**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = ThreadNestedWindow.from(window.opener);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(window, options) {\n return new ThreadNestedWindow(window, options);\n }\n\n /**\n * Starts a thread wrapped around a nested `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedWindow.import(window.opener);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(window, options) {\n return new ThreadNestedWindow(window, options).imports;\n }\n\n /**\n * Starts a thread wrapped around a nested `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * ThreadNestedWindow.export(window.opener, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(window, exports, options) {\n new ThreadNestedWindow(window, {\n ...options,\n exports\n });\n }\n constructor(parent, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(nestedWindowToThreadTarget(parent, {\n targetOrigin\n }), options);\n this.parent = parent;\n }\n}\nfunction nestedWindowToThreadTarget(parent, {\n targetOrigin = '*'\n} = {}) {\n const ready = () => {\n const respond = () => parent.postMessage(RESPONSE_MESSAGE, targetOrigin);\n self.addEventListener('message', ({\n data,\n source\n }) => {\n if (source !== parent) return;\n if (data === CHECK_MESSAGE) respond();\n });\n respond();\n };\n if (document.readyState === 'complete') {\n ready();\n } else {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n ready();\n }\n });\n }\n return {\n send(message, transfer) {\n return parent.postMessage(message, targetOrigin, transfer);\n },\n listen(listen, {\n signal\n }) {\n self.addEventListener('message', event => {\n if (event.data === CHECK_MESSAGE) return;\n listen(event.data);\n }, {\n signal\n });\n }\n };\n}\n\nexport { ThreadNestedWindow, nestedWindowToThreadTarget };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,qBAAN,MAAM,2BAA2B,OAAO;;;;;;;;;;;;;;CActC,OAAO,KAAK,QAAQ,SAAS;EAC3B,OAAO,IAAI,mBAAmB,QAAQ,OAAO;CAC/C;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS;EAC7B,OAAO,IAAI,mBAAmB,QAAQ,OAAO,CAAC,CAAC;CACjD;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS,SAAS;EACtC,IAAI,mBAAmB,QAAQ;GAC7B,GAAG;GACH;EACF,CAAC;CACH;CACA,YAAY,QAAQ,EAClB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,MAAM,2BAA2B,QAAQ,EACvC,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF;AACA,SAAS,2BAA2B,QAAQ,EAC1C,eAAe,QACb,CAAC,GAAG;CACN,MAAM,cAAc;EAClB,MAAM,gBAAgB,OAAO,YAAY,kBAAkB,YAAY;EACvE,KAAK,iBAAiB,YAAY,EAChC,MACA,aACI;GACJ,IAAI,WAAW,QAAQ;GACvB,IAAI,SAAA,sBAAwB,QAAQ;EACtC,CAAC;EACD,QAAQ;CACV;CACA,IAAI,SAAS,eAAe,YAC1B,MAAM;MAEN,SAAS,iBAAiB,0BAA0B;EAClD,IAAI,SAAS,eAAe,YAC1B,MAAM;CAEV,CAAC;CAEH,OAAO;EACL,KAAK,SAAS,UAAU;GACtB,OAAO,OAAO,YAAY,SAAS,cAAc,QAAQ;EAC3D;EACA,OAAO,QAAQ,EACb,UACC;GACD,KAAK,iBAAiB,YAAW,UAAS;IACxC,IAAI,MAAM,SAAA,sBAAwB;IAClC,OAAO,MAAM,IAAI;GACnB,GAAG,EACD,OACF,CAAC;EACH;CACF;AACF"}
1
+ {"version":3,"file":"ThreadNestedWindow.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/ThreadNestedWindow.mjs"],"sourcesContent":["import { Thread } from '../../Thread.mjs';\nimport { CHECK_MESSAGE, RESPONSE_MESSAGE } from './shared.mjs';\n\n/**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = new ThreadNestedWindow(window.opener);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadNestedWindow extends Thread {\n /**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = ThreadNestedWindow.from(window.opener);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(window, options) {\n return new ThreadNestedWindow(window, options);\n }\n\n /**\n * Starts a thread wrapped around a nested `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedWindow.import(window.opener);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(window, options) {\n return new ThreadNestedWindow(window, options).imports;\n }\n\n /**\n * Starts a thread wrapped around a nested `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * ThreadNestedWindow.export(window.opener, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(window, exports, options) {\n new ThreadNestedWindow(window, {\n ...options,\n exports\n });\n }\n constructor(parent, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(nestedWindowToThreadTarget(parent, {\n targetOrigin\n }), options);\n this.parent = parent;\n }\n}\nfunction nestedWindowToThreadTarget(parent, {\n targetOrigin = '*'\n} = {}) {\n const ready = () => {\n const respond = () => parent.postMessage(RESPONSE_MESSAGE, targetOrigin);\n self.addEventListener('message', ({\n data,\n source\n }) => {\n if (source !== parent) return;\n if (data === CHECK_MESSAGE) respond();\n });\n respond();\n };\n if (document.readyState === 'complete') {\n ready();\n } else {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n ready();\n }\n });\n }\n return {\n send(message, transfer) {\n return parent.postMessage(message, targetOrigin, transfer);\n },\n listen(listen, {\n signal\n }) {\n self.addEventListener('message', event => {\n if (event.data === CHECK_MESSAGE) return;\n listen(event.data);\n }, {\n signal\n });\n }\n };\n}\n\nexport { ThreadNestedWindow, nestedWindowToThreadTarget };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,qBAAN,MAAM,2BAA2B,OAAO;;;;;;;;;;;;;;CActC,OAAO,KAAK,QAAQ,SAAS;EAC3B,OAAO,IAAI,mBAAmB,QAAQ,OAAO;CAC/C;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS;EAC7B,OAAO,IAAI,mBAAmB,QAAQ,OAAO,CAAC,CAAC;CACjD;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS,SAAS;EACtC,IAAI,mBAAmB,QAAQ;GAC7B,GAAG;GACH;EACF,CAAC;CACH;CACA,YAAY,QAAQ,EAClB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,MAAM,2BAA2B,QAAQ,EACvC,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF;AACA,SAAS,2BAA2B,QAAQ,EAC1C,eAAe,QACb,CAAC,GAAG;CACN,MAAM,cAAc;EAClB,MAAM,gBAAgB,OAAO,YAAY,kBAAkB,YAAY;EACvE,KAAK,iBAAiB,YAAY,EAChC,MACA,aACI;GACJ,IAAI,WAAW,QAAQ;GACvB,IAAI,SAAA,sBAAwB,QAAQ;EACtC,CAAC;EACD,QAAQ;CACV;CACA,IAAI,SAAS,eAAe,YAC1B,MAAM;MAEN,SAAS,iBAAiB,0BAA0B;EAClD,IAAI,SAAS,eAAe,YAC1B,MAAM;CAEV,CAAC;CAEH,OAAO;EACL,KAAK,SAAS,UAAU;GACtB,OAAO,OAAO,YAAY,SAAS,cAAc,QAAQ;EAC3D;EACA,OAAO,QAAQ,EACb,UACC;GACD,KAAK,iBAAiB,YAAW,UAAS;IACxC,IAAI,MAAM,SAAA,sBAAwB;IAClC,OAAO,MAAM,IAAI;GACnB,GAAG,EACD,OACF,CAAC;EACH;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadWindow.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs"],"sourcesContent":["import { Thread } from '../../Thread.mjs';\nimport { RESPONSE_MESSAGE, CHECK_MESSAGE } from './shared.mjs';\nimport { ThreadNestedWindow } from './ThreadNestedWindow.mjs';\n\n/**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = new ThreadWindow(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadWindow extends Thread {\n /**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = ThreadWindow.from(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(window, options) {\n return new ThreadWindow(window, options);\n }\n\n /**\n * Starts a thread wrapped around a `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * ThreadNestedWindow.export(window.opener, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(window, options) {\n return new ThreadWindow(window, options).imports;\n }\n\n /**\n * Starts a thread wrapped around a `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedWindow.import(window.opener);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(window, exports, options) {\n new ThreadWindow(window, {\n ...options,\n exports\n });\n }\n\n /**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = ThreadWindow.opener();\n * await thread.imports.sendMessage('Hello world!');\n */\n static opener = (() => Object.assign(options => ThreadNestedWindow.from(window.opener, options), {\n /**\n * Starts a thread wrapped around a nested `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.opener.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n import: options => ThreadNestedWindow.import(window.opener, options),\n /**\n * Starts a thread wrapped around a nested `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.opener.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n export: (exports, options) => ThreadNestedWindow.export(window.opener, {\n ...options,\n exports\n })\n }))();\n constructor(window, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(windowToThreadTarget(window, {\n targetOrigin\n }), options);\n this.window = window;\n }\n}\nfunction windowToThreadTarget(window, {\n targetOrigin = '*'\n} = {}) {\n let connected = false;\n const sendMessage = function send(message, transfer) {\n window.postMessage(message, targetOrigin, transfer);\n };\n const connectedPromise = new Promise(resolve => {\n const abort = new AbortController();\n globalThis.window.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) {\n connected = true;\n abort.abort();\n resolve();\n }\n }, {\n signal: abort.signal\n });\n abort.signal.addEventListener('abort', () => resolve(), {\n once: true\n });\n sendMessage(CHECK_MESSAGE);\n });\n return {\n send(message, transfer) {\n if (!connected) {\n return connectedPromise.then(() => {\n if (connected) return sendMessage(message, transfer);\n });\n }\n return sendMessage(message, transfer);\n },\n listen(listen, {\n signal\n }) {\n self.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) return;\n listen(event.data);\n }, {\n signal\n });\n }\n };\n}\n\nexport { ThreadWindow, windowToThreadTarget };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,eAAN,MAAM,qBAAqB,OAAO;;;;;;;;;;;;;CAahC,OAAO,KAAK,QAAQ,SAAS;EAC3B,OAAO,IAAI,aAAa,QAAQ,OAAO;CACzC;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS;EAC7B,OAAO,IAAI,aAAa,QAAQ,OAAO,CAAC,CAAC;CAC3C;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS,SAAS;EACtC,IAAI,aAAa,QAAQ;GACvB,GAAG;GACH;EACF,CAAC;CACH;;;;;;;;;;;;;;CAeA,OAAO,gBAAgB,OAAO,QAAO,YAAW,mBAAmB,KAAK,OAAO,QAAQ,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuB/F,SAAQ,YAAW,mBAAmB,OAAO,OAAO,QAAQ,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAuBnE,SAAS,SAAS,YAAY,mBAAmB,OAAO,OAAO,QAAQ;GACrE,GAAG;GACH;EACF,CAAC;CACH,CAAC,EAAA,CAAG;CACJ,YAAY,QAAQ,EAClB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,MAAM,qBAAqB,QAAQ,EACjC,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF;AACA,SAAS,qBAAqB,QAAQ,EACpC,eAAe,QACb,CAAC,GAAG;CACN,IAAI,YAAY;CAChB,MAAM,cAAc,SAAS,KAAK,SAAS,UAAU;EACnD,OAAO,YAAY,SAAS,cAAc,QAAQ;CACpD;CACA,MAAM,mBAAmB,IAAI,SAAQ,YAAW;EAC9C,MAAM,QAAQ,IAAI,gBAAgB;EAClC,WAAW,OAAO,iBAAiB,YAAW,UAAS;GACrD,IAAI,MAAM,WAAW,QAAQ;GAC7B,IAAI,MAAM,SAAA,sBAA2B;IACnC,YAAY;IACZ,MAAM,MAAM;IACZ,QAAQ;GACV;EACF,GAAG,EACD,QAAQ,MAAM,OAChB,CAAC;EACD,MAAM,OAAO,iBAAiB,eAAe,QAAQ,GAAG,EACtD,MAAM,KACR,CAAC;EACD,YAAY,aAAa;CAC3B,CAAC;CACD,OAAO;EACL,KAAK,SAAS,UAAU;GACtB,IAAI,CAAC,WACH,OAAO,iBAAiB,WAAW;IACjC,IAAI,WAAW,OAAO,YAAY,SAAS,QAAQ;GACrD,CAAC;GAEH,OAAO,YAAY,SAAS,QAAQ;EACtC;EACA,OAAO,QAAQ,EACb,UACC;GACD,KAAK,iBAAiB,YAAW,UAAS;IACxC,IAAI,MAAM,WAAW,QAAQ;IAC7B,IAAI,MAAM,SAAA,sBAA2B;IACrC,OAAO,MAAM,IAAI;GACnB,GAAG,EACD,OACF,CAAC;EACH;CACF;AACF"}
1
+ {"version":3,"file":"ThreadWindow.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs"],"sourcesContent":["import { Thread } from '../../Thread.mjs';\nimport { RESPONSE_MESSAGE, CHECK_MESSAGE } from './shared.mjs';\nimport { ThreadNestedWindow } from './ThreadNestedWindow.mjs';\n\n/**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = new ThreadWindow(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadWindow extends Thread {\n /**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = ThreadWindow.from(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(window, options) {\n return new ThreadWindow(window, options);\n }\n\n /**\n * Starts a thread wrapped around a `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * ThreadNestedWindow.export(window.opener, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(window, options) {\n return new ThreadWindow(window, options).imports;\n }\n\n /**\n * Starts a thread wrapped around a `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedWindow.import(window.opener);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(window, exports, options) {\n new ThreadWindow(window, {\n ...options,\n exports\n });\n }\n\n /**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = ThreadWindow.opener();\n * await thread.imports.sendMessage('Hello world!');\n */\n static opener = (() => Object.assign(options => ThreadNestedWindow.from(window.opener, options), {\n /**\n * Starts a thread wrapped around a nested `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.opener.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n import: options => ThreadNestedWindow.import(window.opener, options),\n /**\n * Starts a thread wrapped around a nested `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.opener.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n export: (exports, options) => ThreadNestedWindow.export(window.opener, {\n ...options,\n exports\n })\n }))();\n constructor(window, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(windowToThreadTarget(window, {\n targetOrigin\n }), options);\n this.window = window;\n }\n}\nfunction windowToThreadTarget(window, {\n targetOrigin = '*'\n} = {}) {\n let connected = false;\n const sendMessage = function send(message, transfer) {\n window.postMessage(message, targetOrigin, transfer);\n };\n const connectedPromise = new Promise(resolve => {\n const abort = new AbortController();\n globalThis.window.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) {\n connected = true;\n abort.abort();\n resolve();\n }\n }, {\n signal: abort.signal\n });\n abort.signal.addEventListener('abort', () => resolve(), {\n once: true\n });\n sendMessage(CHECK_MESSAGE);\n });\n return {\n send(message, transfer) {\n if (!connected) {\n return connectedPromise.then(() => {\n if (connected) return sendMessage(message, transfer);\n });\n }\n return sendMessage(message, transfer);\n },\n listen(listen, {\n signal\n }) {\n self.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) return;\n listen(event.data);\n }, {\n signal\n });\n }\n };\n}\n\nexport { ThreadWindow, windowToThreadTarget };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,eAAN,MAAM,qBAAqB,OAAO;;;;;;;;;;;;;CAahC,OAAO,KAAK,QAAQ,SAAS;EAC3B,OAAO,IAAI,aAAa,QAAQ,OAAO;CACzC;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS;EAC7B,OAAO,IAAI,aAAa,QAAQ,OAAO,CAAC,CAAC;CAC3C;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS,SAAS;EACtC,IAAI,aAAa,QAAQ;GACvB,GAAG;GACH;EACF,CAAC;CACH;;;;;;;;;;;;;;CAeA,OAAO,gBAAgB,OAAO,QAAO,YAAW,mBAAmB,KAAK,OAAO,QAAQ,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuB/F,SAAQ,YAAW,mBAAmB,OAAO,OAAO,QAAQ,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAuBnE,SAAS,SAAS,YAAY,mBAAmB,OAAO,OAAO,QAAQ;GACrE,GAAG;GACH;EACF,CAAC;CACH,CAAC,EAAA,CAAG;CACJ,YAAY,QAAQ,EAClB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,MAAM,qBAAqB,QAAQ,EACjC,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF;AACA,SAAS,qBAAqB,QAAQ,EACpC,eAAe,QACb,CAAC,GAAG;CACN,IAAI,YAAY;CAChB,MAAM,cAAc,SAAS,KAAK,SAAS,UAAU;EACnD,OAAO,YAAY,SAAS,cAAc,QAAQ;CACpD;CACA,MAAM,mBAAmB,IAAI,SAAQ,YAAW;EAC9C,MAAM,QAAQ,IAAI,gBAAgB;EAClC,WAAW,OAAO,iBAAiB,YAAW,UAAS;GACrD,IAAI,MAAM,WAAW,QAAQ;GAC7B,IAAI,MAAM,SAAA,sBAA2B;IACnC,YAAY;IACZ,MAAM,MAAM;IACZ,QAAQ;GACV;EACF,GAAG,EACD,QAAQ,MAAM,OAChB,CAAC;EACD,MAAM,OAAO,iBAAiB,eAAe,QAAQ,GAAG,EACtD,MAAM,KACR,CAAC;EACD,YAAY,aAAa;CAC3B,CAAC;CACD,OAAO;EACL,KAAK,SAAS,UAAU;GACtB,IAAI,CAAC,WACH,OAAO,iBAAiB,WAAW;IACjC,IAAI,WAAW,OAAO,YAAY,SAAS,QAAQ;GACrD,CAAC;GAEH,OAAO,YAAY,SAAS,QAAQ;EACtC;EACA,OAAO,QAAQ,EACb,UACC;GACD,KAAK,iBAAiB,YAAW,UAAS;IACxC,IAAI,MAAM,WAAW,QAAQ;IAC7B,IAAI,MAAM,SAAA,sBAA2B;IACrC,OAAO,MAAM,IAAI;GACnB,GAAG,EACD,OACF,CAAC;EACH;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"shared.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs"],"sourcesContent":["const CHECK_MESSAGE = 'quilt.threads.ping';\nconst RESPONSE_MESSAGE = 'quilt.threads.pong';\n\nexport { CHECK_MESSAGE, RESPONSE_MESSAGE };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAM,gBAAgB;AACtB,IAAM,mBAAmB"}
1
+ {"version":3,"file":"shared.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs"],"sourcesContent":["const CHECK_MESSAGE = 'quilt.threads.ping';\nconst RESPONSE_MESSAGE = 'quilt.threads.pong';\n\nexport { CHECK_MESSAGE, RESPONSE_MESSAGE };\n"],"ignoreList":[0],"mappings":";AAAA,IAAM,gBAAgB;AACtB,IAAM,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"transfer.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/transfer.mjs"],"sourcesContent":["import { TRANSFERABLE } from './constants.mjs';\n\n/**\n * Marks the value as being transferable between threads. The memory for this object\n * will be moved to the target thread once the object is sent.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects\n */\nfunction markAsTransferable(value) {\n Object.assign(value, {\n [TRANSFERABLE]: true\n });\n return value;\n}\n\nexport { markAsTransferable };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAQA,SAAS,mBAAmB,OAAO;CACjC,OAAO,OAAO,OAAO,GAClB,eAAe,KAClB,CAAC;CACD,OAAO;AACT"}
1
+ {"version":3,"file":"transfer.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=fa797cdfb8346ba050fd5d6367ccd451df47806c6ea34421e45e8_e52b779d86bc12aeba80f9d7805f6a15/node_modules/@quilted/threads/build/esm/transfer.mjs"],"sourcesContent":["import { TRANSFERABLE } from './constants.mjs';\n\n/**\n * Marks the value as being transferable between threads. The memory for this object\n * will be moved to the target thread once the object is sent.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects\n */\nfunction markAsTransferable(value) {\n Object.assign(value, {\n [TRANSFERABLE]: true\n });\n return value;\n}\n\nexport { markAsTransferable };\n"],"ignoreList":[0],"mappings":";;;;;;;;AAQA,SAAS,mBAAmB,OAAO;CACjC,OAAO,OAAO,OAAO,GAClB,eAAe,KAClB,CAAC;CACD,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"FlowThreadSerialization.mjs","names":[],"sources":["../../../../../../src/serialization/FlowThreadSerialization.ts"],"sourcesContent":["import {\n ThreadSerializationStructuredClone,\n type ThreadSerializationOptions,\n TRANSFERABLE,\n} from \"@quilted/threads\";\nimport * as serializerModules from \"./serializers\";\nimport { isObjectType } from \"remeda\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nconst serializers = Object.values(serializerModules).filter(\n (val) => val instanceof Serializer,\n);\n\n/*\n * React tags its elements, portals and lazy values with a symbol under\n * `$$typeof`. Symbols pass through serialization untouched and `postMessage`\n * refuses them — and it refuses the *whole* message, so a single element in one\n * prop takes down the entire mutation batch and the extension renders nothing at\n * all. The failure is silent apart from an unhandled `DataCloneError`.\n *\n * Rendered output belongs in a slot, not in a property (see `isSlot` in the\n * remote-components generator). Where it ends up in a property anyway, dropping\n * it keeps the batch intact: the one prop is missing instead of the whole tree.\n */\nconst isReactValue = (val: unknown): boolean =>\n isObjectType(val) &&\n \"$$typeof\" in val &&\n typeof (val as { $$typeof: unknown }).$$typeof === \"symbol\";\n\n/**\n * Names the component behind an element, for the warning below. `type` is a\n * string for a DOM element, a function for a component, and an object for a\n * context provider or a `memo`/`forwardRef` wrapper — the last of which is what\n * a rendered react-aria tree is mostly made of.\n */\nconst reactValueLabel = (val: unknown): string => {\n const type = (val as { type?: unknown }).type;\n\n if (typeof type === \"string\") {\n return type;\n }\n if (typeof type === \"function\" || isObjectType(type)) {\n const named = type as {\n displayName?: string;\n name?: string;\n $$typeof?: symbol;\n };\n return (\n named.displayName ??\n named.name ??\n named.$$typeof?.toString() ??\n \"anonymous\"\n );\n }\n\n return \"unknown\";\n};\n\nexport class FlowThreadSerialization extends ThreadSerializationStructuredClone {\n private readonly warnedAboutReactValues = new Set<string>();\n\n public constructor() {\n const options: ThreadSerializationOptions = {\n serialize: async (val, serialize) => {\n try {\n if (this.isSerializableByBase(val)) {\n return;\n }\n if (this.omitSerialization(val)) {\n return null;\n }\n if (isReactValue(val)) {\n this.warnAboutReactValue(val);\n return null;\n }\n for (const serializer of serializers) {\n const serialization = await serializer.serialize(val);\n\n if (serialization.applied) {\n return await serialize(serialization.result);\n }\n }\n\n if (isObjectType(val)) {\n return await serialize({ ...val });\n }\n\n return undefined;\n } catch (error) {\n console.error(\"Error while serializing\", error);\n throw error;\n }\n },\n\n deserialize: async (val, deserialize) => {\n try {\n for (const serializer of serializers) {\n const deserialization = await serializer.deserialize(val);\n\n if (deserialization.applied) {\n return deserialization.result.value;\n }\n }\n\n return await deserialize(val);\n } catch (error) {\n console.error(\"Error while deserializing\", error);\n throw error;\n }\n },\n };\n\n super(options);\n }\n\n /**\n * Values the base serializer hands to `postMessage` untouched, because\n * structured clone carries them itself.\n *\n * Everything not listed here reaches the object fallback below and is spread\n * into a plain object — which keeps only own enumerable properties. For a\n * built-in that holds its state internally that is total loss and completely\n * silent: a `Date` arrived as `{}`, a `RegExp` and an `Error` the same, a\n * `Uint8Array` as `{\"0\":1,\"1\":2}`.\n *\n * Extending this list is backwards compatible: the value crosses in its\n * native structured-clone form, and an older peer's base deserializer returns\n * a non-basic object unchanged. A named serializer would not be — an older\n * peer does not know the name and hands the wrapper object through as-is.\n */\n private isSerializableByBase(val: unknown) {\n return (\n val instanceof Map ||\n val instanceof Set ||\n Array.isArray(val) ||\n typeof val === \"function\" ||\n val instanceof Date ||\n val instanceof RegExp ||\n val instanceof Error ||\n val instanceof ArrayBuffer ||\n ArrayBuffer.isView(val) ||\n // `File` is a `Blob`, and `fileSerializer` owns it: it sends the content\n // as a transferable and its wire format is part of the protocol.\n (val instanceof Blob && !(val instanceof File)) ||\n (isObjectType(val) && TRANSFERABLE in val)\n );\n }\n\n private omitSerialization(val: unknown) {\n return val instanceof HTMLElement || val === window;\n }\n\n /**\n * Once per component, so a table of many rows reports its cause once instead\n * of once per cell.\n */\n private warnAboutReactValue(val: unknown) {\n const label = reactValueLabel(val);\n\n if (this.warnedAboutReactValues.has(label)) {\n return;\n }\n this.warnedAboutReactValues.add(label);\n\n console.error(\n `Cannot send the React element <${label} /> to the host: rendered output is not serializable, and it was replaced with null. Pass it as a slot instead of a property — a property would have dropped the whole update.`,\n );\n }\n}\n"],"mappings":";;;;;;AASA,IAAM,cAAc,OAAO,OAAO,mBAAiB,CAAC,CAAC,QAClD,QAAQ,eAAe,UAC1B;AAaA,IAAM,gBAAgB,QACpB,aAAa,GAAG,KAChB,cAAc,OACd,OAAQ,IAA8B,aAAa;;;;;;;AAQrD,IAAM,mBAAmB,QAAyB;CAChD,MAAM,OAAQ,IAA2B;CAEzC,IAAI,OAAO,SAAS,UAClB,OAAO;CAET,IAAI,OAAO,SAAS,cAAc,aAAa,IAAI,GAAG;EACpD,MAAM,QAAQ;EAKd,OACE,MAAM,eACN,MAAM,QACN,MAAM,UAAU,SAAS,KACzB;CAEJ;CAEA,OAAO;AACT;AAEA,IAAa,0BAAb,cAA6C,mCAAmC;CAC9E,yCAA0C,IAAI,IAAY;CAE1D,cAAqB;EAmDnB,MAAM;GAjDJ,WAAW,OAAO,KAAK,cAAc;IACnC,IAAI;KACF,IAAI,KAAK,qBAAqB,GAAG,GAC/B;KAEF,IAAI,KAAK,kBAAkB,GAAG,GAC5B,OAAO;KAET,IAAI,aAAa,GAAG,GAAG;MACrB,KAAK,oBAAoB,GAAG;MAC5B,OAAO;KACT;KACA,KAAK,MAAM,cAAc,aAAa;MACpC,MAAM,gBAAgB,MAAM,WAAW,UAAU,GAAG;MAEpD,IAAI,cAAc,SAChB,OAAO,MAAM,UAAU,cAAc,MAAM;KAE/C;KAEA,IAAI,aAAa,GAAG,GAClB,OAAO,MAAM,UAAU,EAAE,GAAG,IAAI,CAAC;KAGnC;IACF,SAAS,OAAO;KACd,QAAQ,MAAM,2BAA2B,KAAK;KAC9C,MAAM;IACR;GACF;GAEA,aAAa,OAAO,KAAK,gBAAgB;IACvC,IAAI;KACF,KAAK,MAAM,cAAc,aAAa;MACpC,MAAM,kBAAkB,MAAM,WAAW,YAAY,GAAG;MAExD,IAAI,gBAAgB,SAClB,OAAO,gBAAgB,OAAO;KAElC;KAEA,OAAO,MAAM,YAAY,GAAG;IAC9B,SAAS,OAAO;KACd,QAAQ,MAAM,6BAA6B,KAAK;KAChD,MAAM;IACR;GACF;EAGI,CAAO;CACf;;;;;;;;;;;;;;;;CAiBA,qBAA6B,KAAc;EACzC,OACE,eAAe,OACf,eAAe,OACf,MAAM,QAAQ,GAAG,KACjB,OAAO,QAAQ,cACf,eAAe,QACf,eAAe,UACf,eAAe,SACf,eAAe,eACf,YAAY,OAAO,GAAG,KAGrB,eAAe,QAAQ,EAAE,eAAe,SACxC,aAAa,GAAG,KAAK,gBAAgB;CAE1C;CAEA,kBAA0B,KAAc;EACtC,OAAO,eAAe,eAAe,QAAQ;CAC/C;;;;;CAMA,oBAA4B,KAAc;EACxC,MAAM,QAAQ,gBAAgB,GAAG;EAEjC,IAAI,KAAK,uBAAuB,IAAI,KAAK,GACvC;EAEF,KAAK,uBAAuB,IAAI,KAAK;EAErC,QAAQ,MACN,kCAAkC,MAAM,+KAC1C;CACF;AACF"}
1
+ {"version":3,"file":"FlowThreadSerialization.mjs","names":["serializerModules"],"sources":["../../../../../../src/serialization/FlowThreadSerialization.ts"],"sourcesContent":["import {\n ThreadSerializationStructuredClone,\n type ThreadSerializationOptions,\n TRANSFERABLE,\n} from \"@quilted/threads\";\nimport * as serializerModules from \"./serializers\";\nimport { isObjectType } from \"remeda\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nconst serializers = Object.values(serializerModules).filter(\n (val) => val instanceof Serializer,\n);\n\n/*\n * React tags its elements, portals and lazy values with a symbol under\n * `$$typeof`. Symbols pass through serialization untouched and `postMessage`\n * refuses them — and it refuses the *whole* message, so a single element in one\n * prop takes down the entire mutation batch and the extension renders nothing at\n * all. The failure is silent apart from an unhandled `DataCloneError`.\n *\n * Rendered output belongs in a slot, not in a property (see `isSlot` in the\n * remote-components generator). Where it ends up in a property anyway, dropping\n * it keeps the batch intact: the one prop is missing instead of the whole tree.\n */\nconst isReactValue = (val: unknown): boolean =>\n isObjectType(val) &&\n \"$$typeof\" in val &&\n typeof (val as { $$typeof: unknown }).$$typeof === \"symbol\";\n\n/**\n * Names the component behind an element, for the warning below. `type` is a\n * string for a DOM element, a function for a component, and an object for a\n * context provider or a `memo`/`forwardRef` wrapper — the last of which is what\n * a rendered react-aria tree is mostly made of.\n */\nconst reactValueLabel = (val: unknown): string => {\n const type = (val as { type?: unknown }).type;\n\n if (typeof type === \"string\") {\n return type;\n }\n if (typeof type === \"function\" || isObjectType(type)) {\n const named = type as {\n displayName?: string;\n name?: string;\n $$typeof?: symbol;\n };\n return (\n named.displayName ??\n named.name ??\n named.$$typeof?.toString() ??\n \"anonymous\"\n );\n }\n\n return \"unknown\";\n};\n\nexport class FlowThreadSerialization extends ThreadSerializationStructuredClone {\n private readonly warnedAboutReactValues = new Set<string>();\n\n public constructor() {\n const options: ThreadSerializationOptions = {\n serialize: async (val, serialize) => {\n try {\n if (this.isSerializableByBase(val)) {\n return;\n }\n if (this.omitSerialization(val)) {\n return null;\n }\n if (isReactValue(val)) {\n this.warnAboutReactValue(val);\n return null;\n }\n for (const serializer of serializers) {\n const serialization = await serializer.serialize(val);\n\n if (serialization.applied) {\n return await serialize(serialization.result);\n }\n }\n\n if (isObjectType(val)) {\n return await serialize({ ...val });\n }\n\n return undefined;\n } catch (error) {\n console.error(\"Error while serializing\", error);\n throw error;\n }\n },\n\n deserialize: async (val, deserialize) => {\n try {\n for (const serializer of serializers) {\n const deserialization = await serializer.deserialize(val);\n\n if (deserialization.applied) {\n return deserialization.result.value;\n }\n }\n\n return await deserialize(val);\n } catch (error) {\n console.error(\"Error while deserializing\", error);\n throw error;\n }\n },\n };\n\n super(options);\n }\n\n /**\n * Values the base serializer hands to `postMessage` untouched, because\n * structured clone carries them itself.\n *\n * Everything not listed here reaches the object fallback below and is spread\n * into a plain object — which keeps only own enumerable properties. For a\n * built-in that holds its state internally that is total loss and completely\n * silent: a `Date` arrived as `{}`, a `RegExp` and an `Error` the same, a\n * `Uint8Array` as `{\"0\":1,\"1\":2}`.\n *\n * Extending this list is backwards compatible: the value crosses in its\n * native structured-clone form, and an older peer's base deserializer returns\n * a non-basic object unchanged. A named serializer would not be — an older\n * peer does not know the name and hands the wrapper object through as-is.\n */\n private isSerializableByBase(val: unknown) {\n return (\n val instanceof Map ||\n val instanceof Set ||\n Array.isArray(val) ||\n typeof val === \"function\" ||\n val instanceof Date ||\n val instanceof RegExp ||\n val instanceof Error ||\n val instanceof ArrayBuffer ||\n ArrayBuffer.isView(val) ||\n // `File` is a `Blob`, and `fileSerializer` owns it: it sends the content\n // as a transferable and its wire format is part of the protocol.\n (val instanceof Blob && !(val instanceof File)) ||\n (isObjectType(val) && TRANSFERABLE in val)\n );\n }\n\n private omitSerialization(val: unknown) {\n return val instanceof HTMLElement || val === window;\n }\n\n /**\n * Once per component, so a table of many rows reports its cause once instead\n * of once per cell.\n */\n private warnAboutReactValue(val: unknown) {\n const label = reactValueLabel(val);\n\n if (this.warnedAboutReactValues.has(label)) {\n return;\n }\n this.warnedAboutReactValues.add(label);\n\n console.error(\n `Cannot send the React element <${label} /> to the host: rendered output is not serializable, and it was replaced with null. Pass it as a slot instead of a property — a property would have dropped the whole update.`,\n );\n }\n}\n"],"mappings":";;;;;;AASA,IAAM,cAAc,OAAO,OAAOA,mBAAiB,CAAC,CAAC,QAClD,QAAQ,eAAe,UAC1B;AAaA,IAAM,gBAAgB,QACpB,aAAa,GAAG,KAChB,cAAc,OACd,OAAQ,IAA8B,aAAa;;;;;;;AAQrD,IAAM,mBAAmB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e,SACf,eAAe,eACf,YAAY,OAAO,GAAG,KAGrB,eAAe,QAAQ,EAAE,eAAe,SACxC,aAAa,GAAG,KAAK,gBAAgB;CAE1C;CAEA,kBAA0B,KAAc;EACtC,OAAO,eAAe,eAAe,QAAQ;CAC/C;;;;;CAMA,oBAA4B,KAAc;EACxC,MAAM,QAAQ,gBAAgB,GAAG;EAEjC,IAAI,KAAK,uBAAuB,IAAI,KAAK,GACvC;EAEF,KAAK,uBAAuB,IAAI,KAAK;EAErC,QAAQ,MACN,kCAAkC,MAAM,+KAC1C;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-remote-core",
3
- "version": "1.5.0-next.9",
3
+ "version": "1.5.1",
4
4
  "type": "module",
5
5
  "description": "Core functionality to setup a remote/host environment",
6
6
  "homepage": "https://flow.mittwald.de",
@@ -36,10 +36,10 @@
36
36
  "zod": "^4.4.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@mittwald/ext-bridge": "1.5.0-next.9",
40
- "@mittwald/flow-core": "1.5.0-next.9",
41
- "@mittwald/flow-react-components": "1.5.0-next.9",
42
- "@mittwald/typescript-config": "1.5.0-next.9",
39
+ "@mittwald/ext-bridge": "1.5.1",
40
+ "@mittwald/flow-core": "1.5.1",
41
+ "@mittwald/flow-react-components": "1.5.1",
42
+ "@mittwald/typescript-config": "1.5.1",
43
43
  "@types/node": "^25.9.3",
44
44
  "nx": "^22.7.5",
45
45
  "rimraf": "^6.1.3",
@@ -51,13 +51,13 @@
51
51
  "vitest": "^4.1.11"
52
52
  },
53
53
  "peerDependencies": {
54
- "@mittwald/ext-bridge": "1.5.0-next.9",
55
- "@mittwald/flow-react-components": "1.5.0-next.9"
54
+ "@mittwald/ext-bridge": "1.5.1",
55
+ "@mittwald/flow-react-components": "1.5.1"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "@mittwald/ext-bridge": {
59
59
  "optional": true
60
60
  }
61
61
  },
62
- "gitHead": "0e23e83976d053838f8d02fd9b42093ad5c9bf14"
62
+ "gitHead": "59e49fe7ae9c4157fc348cbc1ffcc85e9db31433"
63
63
  }