{
  "version": 3,
  "sources": ["../../../src/symbols.ts", "../../../src/master/thread.ts"],
  "sourcesContent": ["/** Symbol key for accessing a thread's error observable. */\nexport const $errors = Symbol('thread.errors')\n/** Symbol key for accessing a thread's event observable. */\nexport const $events = Symbol('thread.events')\n/** Symbol key for accessing a thread's terminate function. */\nexport const $terminate = Symbol('thread.terminate')\n/** Symbol key for marking an object as a transferable descriptor. */\nexport const $transferable = Symbol('thread.transferable')\n/** Symbol key for accessing the underlying worker instance of a thread. */\nexport const $worker = Symbol('thread.worker')\n", "/* eslint-disable import-x/no-internal-modules */\nimport type { Observable } from 'observable-fns'\n\nimport {\n  $errors, $events, $terminate,\n} from '../symbols.ts'\nimport type { Thread as ThreadType, WorkerEvent } from '../types/master.ts'\n\nfunction fail(message: string): never {\n  throw new Error(message)\n}\n\n/** Re-exported Thread type from the master types module. */\nexport type Thread = ThreadType\n\n/** Thread utility functions. Use them to manage or inspect a `spawn()`-ed thread. */\nexport const Thread = {\n  /** Return an observable that can be used to subscribe to all errors happening in the thread. */\n  errors<ThreadT extends ThreadType>(thread: ThreadT): Observable<Error> {\n    return thread[$errors] ?? fail('Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.')\n  },\n  /** Return an observable that can be used to subscribe to internal events happening in the thread. Useful for debugging. */\n  events<ThreadT extends ThreadType>(thread: ThreadT): Observable<WorkerEvent> {\n    return thread[$events] ?? fail('Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.')\n  },\n  /** Terminate a thread. Remember to terminate every thread when you are done using it. */\n  terminate<ThreadT extends ThreadType>(thread: ThreadT) {\n    return thread[$terminate]()\n  },\n}\n"],
  "mappings": ";AACO,IAAM,UAAU,uBAAO,eAAe;AAEtC,IAAM,UAAU,uBAAO,eAAe;AAEtC,IAAM,aAAa,uBAAO,kBAAkB;;;ACGnD,SAAS,KAAK,SAAwB;AACpC,QAAM,IAAI,MAAM,OAAO;AACzB;AAMO,IAAM,SAAS;AAAA;AAAA,EAEpB,OAAmC,QAAoC;AACrE,WAAO,OAAO,OAAO,KAAK,KAAK,qGAAqG;AAAA,EACtI;AAAA;AAAA,EAEA,OAAmC,QAA0C;AAC3E,WAAO,OAAO,OAAO,KAAK,KAAK,sGAAsG;AAAA,EACvI;AAAA;AAAA,EAEA,UAAsC,QAAiB;AACrD,WAAO,OAAO,UAAU,EAAE;AAAA,EAC5B;AACF;",
  "names": []
}
