@univer-cli/univer-collaboration-runtime-pool 1.5.2 → 1.6.0

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.
package/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  English | [简体中文](./README.zh-CN.md)
4
4
 
5
- Create, exclusively lease, cache, and recycle `UniverCollaborationRuntime` instances in separate worker processes by an application-owned opaque key.
6
-
7
- This lets multiple short tasks reuse expensive runtimes while isolating Univer and native/runtime state in workers. If you need only one runtime in the current process, use `@univer-cli/univer-collaboration-runtime` directly.
5
+ Use this package when your application repeatedly reads or edits the same Univer documents and you want tasks to reuse a loaded collaboration runtime. Each Unit has its own Univer instance and collaboration state. Several Units can share a Node.js worker process. To work with a single Unit in the current process, use the [collaboration runtime](../univer-collaboration-runtime/README.md) directly.
8
6
 
9
7
  ## Installation
10
8
 
@@ -12,25 +10,28 @@ This lets multiple short tasks reuse expensive runtimes while isolating Univer a
12
10
  pnpm add @univer-cli/univer-collaboration-runtime-pool
13
11
  ```
14
12
 
15
- Requires Node.js 22.12 or higher. Worker entry must be the built JavaScript ESM file and cannot point to TypeScript source.
13
+ Requires Node.js 22.12 or later. Your application supplies the backend, credentials, and Univer factory. The pool manages the lifetime of the runtimes in its workers.
16
14
 
17
- ## Worker entry
15
+ ## Define a worker entry
18
16
 
19
- The worker creates the backend in the process that hosts the runtime, reads credentials, and constructs Univer:
17
+ First, define a worker entry. In this Sheet example, the application supplies `loadSheetRuntime(unitId)`, which creates a collaboration runtime for the given workbook using your backend and a fresh Univer instance. Build the entry as a JavaScript ESM file named `worker.js`.
20
18
 
21
19
  ```ts
22
20
  import { defineUniverCollaborationRuntimeWorker } from "@univer-cli/univer-collaboration-runtime-pool";
21
+ import { loadSheetRuntime } from "./sheet-runtime.js";
23
22
 
24
23
  export default defineUniverCollaborationRuntimeWorker({
25
- async createRuntime(init) {
26
- return createRuntimeFromApplicationInit(init);
24
+ createRuntime({ unitId }: { unitId: string }) {
25
+ return loadSheetRuntime(unitId);
27
26
  },
28
27
  });
29
28
  ```
30
29
 
31
- Initialization data must be compatible with structured clone. The worker can read credentials directly from the environment or secure storage, avoiding the need to route remote Snapshots, changesets, and blocks through a daemon or parent process.
30
+ ## Reuse a runtime across tool calls
31
+
32
+ An application can share one pool across tool calls. Each call acquires a lease by key and releases it when finished. A later call using the same key can continue working with the loaded Unit as long as its runtime is still cached.
32
33
 
33
- ## Use pool
34
+ Agents are a typical example. Suppose a user asks, “If A1 is less than 40, add 10.” An agent might call a tool to read A1, get `32`, then call a tool to write `42`. Using the same workbook key lets both calls reuse its runtime.
34
35
 
35
36
  ```ts
36
37
  import { createUniverCollaborationRuntimePool } from "@univer-cli/univer-collaboration-runtime-pool";
@@ -39,37 +40,50 @@ const pool = createUniverCollaborationRuntimePool({
39
40
  entry: new URL("./worker.js", import.meta.url),
40
41
  });
41
42
 
42
- const lease = await pool.acquire({
43
- key: "server-a:book-1:sheet",
44
- init: { unitId: "book-1", unitType: "sheet" },
45
- });
46
-
47
- try {
48
- await lease.pull();
49
- const result = await lease.execute({ mode: "read", code: "return workbook.getId();" });
50
- console.log(result.value);
51
- } catch (error) {
52
- await lease.invalidate();
53
- throw error;
54
- } finally {
55
- await lease.release();
43
+ const unitId = "book-1";
44
+ const target = { key: unitId, init: { unitId } };
45
+
46
+ // First tool call: read A1.
47
+ const readLease = await pool.acquire(target);
48
+ const { value } = await readLease
49
+ .execute({
50
+ mode: "read",
51
+ code: 'return univerAPI.getActiveWorkbook().getActiveSheet().getRange("A1").getValue();',
52
+ })
53
+ .finally(() => readLease.release());
54
+
55
+ // The agent decides what to do with the result. For example, reading 32 leads to a second call to write 42.
56
+ if (typeof value === "number" && value < 40) {
57
+ const writeLease = await pool.acquire(target);
58
+ try {
59
+ await writeLease.execute({
60
+ mode: "write",
61
+ code: `univerAPI.getActiveWorkbook().getActiveSheet().getRange("A1").setValue(${value + 10});`,
62
+ });
63
+ const result = await writeLease.commit();
64
+ console.log(result.status);
65
+ } finally {
66
+ await writeLease.release();
67
+ }
56
68
  }
57
-
58
- await pool.close();
59
69
  ```
60
70
 
61
- The lease proxies the collaboration runtime's complete public interface, so callers do not need to design RPC methods.
71
+ Call `pool.close()` at application shutdown.
62
72
 
63
- ## Pool behavior
73
+ This example assumes workbook IDs are unique within your data source. If your application can access multiple servers or multiple worktrees of a document, include that information in the `key`. Requests for the same key receive leases in order. The pool uses `init` only when creating or reloading a runtime, and its contents must support structured clone.
64
74
 
65
- Creation for a key is single-flight, and leases for the same key are granted in FIFO order. Idle runtimes can be evicted by TTL and LRU; idle eviction never interrupts an active lease. Invalidation marks a worker/runtime as untrustworthy, so it is destroyed during release. For invalidation, TTL, and LRU eviction, `destroy-start` is emitted synchronously before worker destruction starts; generation-specific state should be discarded then rather than waiting for the later `evicted` event. Pool events can feed logs and metrics.
75
+ ## Edit and save
66
76
 
67
- The application defines both key and initialization data. The pool knows nothing about Workspace, Worktree, URLs, authentication, or target-to-key algorithms, and does not verify whether two initialization values for the same key are semantically compatible.
77
+ Call `lease.pull()` when you need to synchronize remote changes. After editing with `lease.execute({ mode: "write", code })`, call `lease.commit()` and check the returned status before releasing the lease. Pending edits live in runtime memory until committed. To discard the entire runtime, call `lease.invalidate()`. See the [collaboration runtime](../univer-collaboration-runtime/README.md) for synchronization, commit results, and conflict handling.
68
78
 
69
- ## Mutation transport
79
+ ## Capacity and process isolation
70
80
 
71
- Mutation replacements transferred across workers preserve the collaboration runtime's structured contract. Values unsupported by structured clone fail at the boundary. Business logic should not depend on the internal worker protocol or serialization format.
81
+ The defaults let multiple tasks share a group of workers. Adjust these options for the number of documents you access, the memory available, and the process isolation you need.
72
82
 
73
- ## Responsibility boundaries
83
+ | Option | Default | When to adjust |
84
+ | ------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `cache.maxEntries` | `50` | Limits the total number of resident runtimes. A full pool evicts the least recently used idle runtime. When all entries are in use or loading, acquiring a new key returns a capacity error. |
86
+ | `cache.idleTtlMs` | `300_000` (5 minutes) | Shorten this to free memory sooner after a task finishes, or lengthen it to reuse loaded documents between visits. |
87
+ | `maxUnitsPerWorker` | `10` | Increase this to spread process overhead across more Units. Set it to `1` when each Unit needs a dedicated process. |
74
88
 
75
- The package owns worker lifecycle, runtime proxies, leases, and caching. It does not define daemon methods, Commander commands, backends, or remote data-loading workflows.
89
+ If a worker crashes or an operation times out, all Units in that worker lose their in-memory state, including pending edits. Other workers continue serving their Units.
package/README.zh-CN.md CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  [English](./README.md) | 简体中文
4
4
 
5
- 在独立 worker process 中按 application-owned opaque key 创建、独占租用、缓存和回收
6
- `UniverCollaborationRuntime`。
7
-
8
- 它适合多个短任务复用昂贵 runtime,同时把 Univer 与 native/runtime 状态隔离在 worker 中。若只需要当前进程内的
9
- 单个 runtime,直接使用 `@univer-cli/univer-collaboration-runtime`。
5
+ 如果你的应用需要反复读取或编辑同一个 Univer 文档,可以用这个包在多个任务之间复用已加载的协同 runtime。每个 Unit 拥有独立的 Univer 实例和协同状态,多个 Unit 可以共享一个 Node.js worker 进程。只需在当前进程处理单个 Unit 时,可以直接使用 [collaboration runtime](../univer-collaboration-runtime/README.zh-CN.md)。
10
6
 
11
7
  ## 安装
12
8
 
@@ -14,26 +10,28 @@
14
10
  pnpm add @univer-cli/univer-collaboration-runtime-pool
15
11
  ```
16
12
 
17
- 要求 Node.js 22.12 或更高版本。Worker entry 必须是构建后的 JavaScript ESM 文件,不能指向 TypeScript source。
13
+ 要求 Node.js 22.12 或更高版本。应用负责提供 backend、凭证和 Univer factory,pool 负责在 worker 中创建、复用和释放 runtime。
18
14
 
19
- ## Worker entry
15
+ ## 准备 worker 入口
20
16
 
21
- Worker 在 runtime 所在进程创建 backend、读取凭证并构造 Univer:
17
+ 先准备 worker 入口。在这个 Sheet 示例中,`loadSheetRuntime(unitId)` 由应用提供,用配置好的 backend 和独立的 Univer 实例为指定工作簿创建协同 runtime。将入口构建为 JavaScript ESM 文件 `worker.js`。
22
18
 
23
19
  ```ts
24
20
  import { defineUniverCollaborationRuntimeWorker } from "@univer-cli/univer-collaboration-runtime-pool";
21
+ import { loadSheetRuntime } from "./sheet-runtime.js";
25
22
 
26
23
  export default defineUniverCollaborationRuntimeWorker({
27
- async createRuntime(init) {
28
- return createRuntimeFromApplicationInit(init);
24
+ createRuntime({ unitId }: { unitId: string }) {
25
+ return loadSheetRuntime(unitId);
29
26
  },
30
27
  });
31
28
  ```
32
29
 
33
- Init 必须是 structured-clone compatible value。凭证也可以由 worker 自己从环境或安全存储读取,避免经过 daemon
34
- 或 parent process 转发远端 Snapshot、changeset 与 block。
30
+ ## 在多次工具调用之间复用 runtime
31
+
32
+ 应用可以为多个工具调用共用一个 pool。每次调用按 key 获取 lease,完成后归还。后续调用使用同一个 key 时,只要 runtime 仍在缓存中,就可以继续操作已加载的 Unit。
35
33
 
36
- ## 使用 pool
34
+ Agent 是典型场景。例如,用户要求“如果 A1 小于 40,就加 10”。Agent 可能先调用工具读取 A1,得到 `32`,再调用工具写入 `42`。两次调用使用同一个工作簿的 key,即可复用它的 runtime。
37
35
 
38
36
  ```ts
39
37
  import { createUniverCollaborationRuntimePool } from "@univer-cli/univer-collaboration-runtime-pool";
@@ -42,43 +40,50 @@ const pool = createUniverCollaborationRuntimePool({
42
40
  entry: new URL("./worker.js", import.meta.url),
43
41
  });
44
42
 
45
- const lease = await pool.acquire({
46
- key: "server-a:book-1:sheet",
47
- init: { unitId: "book-1", unitType: "sheet" },
48
- });
49
-
50
- try {
51
- await lease.pull();
52
- const result = await lease.execute({ mode: "read", code: "return workbook.getId();" });
53
- console.log(result.value);
54
- } catch (error) {
55
- await lease.invalidate();
56
- throw error;
57
- } finally {
58
- await lease.release();
43
+ const unitId = "book-1";
44
+ const target = { key: unitId, init: { unitId } };
45
+
46
+ // 第一次工具调用:读取 A1。
47
+ const readLease = await pool.acquire(target);
48
+ const { value } = await readLease
49
+ .execute({
50
+ mode: "read",
51
+ code: 'return univerAPI.getActiveWorkbook().getActiveSheet().getRange("A1").getValue();',
52
+ })
53
+ .finally(() => readLease.release());
54
+
55
+ // Agent 根据读数决定下一步。例如,读到 32 时,再调用工具写入 42。
56
+ if (typeof value === "number" && value < 40) {
57
+ const writeLease = await pool.acquire(target);
58
+ try {
59
+ await writeLease.execute({
60
+ mode: "write",
61
+ code: `univerAPI.getActiveWorkbook().getActiveSheet().getRange("A1").setValue(${value + 10});`,
62
+ });
63
+ const result = await writeLease.commit();
64
+ console.log(result.status);
65
+ } finally {
66
+ await writeLease.release();
67
+ }
59
68
  }
60
-
61
- await pool.close();
62
69
  ```
63
70
 
64
- Lease 代理 collaboration runtime 的完整 public interface;调用方不需要设计 RPC method。
71
+ 应用退出时调用 `pool.close()`。
65
72
 
66
- ## Pool 行为
73
+ 示例假设工作簿 ID 在应用的数据源中唯一。如果应用可以访问多个服务或同一文档的多个 worktree,请将这些信息也纳入 `key`。相同 key 的请求按顺序取得 lease。只有创建或重新加载 runtime 时才会使用 `init`,其内容须支持 structured clone。
67
74
 
68
- 同一个 key 使用 single-flight 创建和 FIFO lease;idle runtime 可按 TTL 与 LRU 回收。Active lease 不会被 idle
69
- eviction 中断。Invalidate 表示 worker/runtime 已不可信,会在 release 时销毁。Invalidate、TTL 与 LRU eviction 会在
70
- worker 销毁开始前同步发出 `destroy-start`;与该 generation 绑定的状态应在此清理,不要等待随后发出的 `evicted`。
71
- Pool event 可用于日志和 metrics。
75
+ ## 编辑与保存
72
76
 
73
- Key 与 init 完全由 application 定义。Pool 不知道 Workspace、Worktree、URL、认证或 target-to-key 算法,也不会
74
- 验证相同 key 的两次 init 是否语义兼容。
77
+ 需要同步远端更改时调用 `lease.pull()`。用 `lease.execute({ mode: "write", code })` 编辑后,调用 `lease.commit()` 并检查返回状态,再归还 lease。未提交的修改只保留在 runtime 内存中,归还 lease 时不会自动保存。如果要丢弃整个 runtime,调用 `lease.invalidate()`。同步、提交和冲突处理的完整语义见 [collaboration runtime](../univer-collaboration-runtime/README.zh-CN.md)。
75
78
 
76
- ## Mutation replacement
79
+ ## 容量与进程隔离
77
80
 
78
- 跨 worker 传输的 mutation replacement 保留 collaboration runtime 的结构化合同;不支持 structured clone 的值
79
- 会在边界失败。业务层不应依赖 worker protocol 或序列化内部格式。
81
+ 默认配置适合让多个任务共享一组 worker。可以根据同时访问的文档数、可用内存和进程隔离需求调整这些选项。
80
82
 
81
- ## 职责边界
83
+ | 选项 | 默认值 | 何时调整 |
84
+ | ------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `cache.maxEntries` | `50` | 控制整个 pool 可驻留的 runtime 总数。容量已满时优先回收最久未使用的空闲 runtime。全部在用或正在加载时,申请新 key 会返回容量错误。 |
86
+ | `cache.idleTtlMs` | `300_000`(5 分钟) | 希望任务结束后更快释放内存时缩短。希望下次访问时复用已加载文档时延长。 |
87
+ | `maxUnitsPerWorker` | `10` | 调高可让更多 Unit 分摊进程开销。需要每个 Unit 独占进程时设为 `1`。 |
82
88
 
83
- Package 拥有 worker lifecycle、runtime proxy、lease 与 cache;不定义 daemon method、Commander command、
84
- backend 或远程数据加载流程。
89
+ worker 崩溃或操作超时时,其中所有 Unit 都会失去内存状态,包括待提交的修改。其他 worker 可以继续服务。
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ interface UniverCollaborationRuntimeLease {
34
34
  exportUnitData(): Promise<CollaborationUnitData$1>;
35
35
  /** Releases the current runtime for reuse. */
36
36
  release(): Promise<void>;
37
- /** Permanently removes this runtime and its worker from the pool. */
37
+ /** Ends the lease and permanently removes its runtime from the pool. */
38
38
  invalidate(): Promise<void>;
39
39
  }
40
40
  interface UniverCollaborationRuntimePool<TInit = unknown> {
@@ -71,9 +71,12 @@ type UniverCollaborationRuntimePoolEvent = {
71
71
  readonly type: "instance-failed";
72
72
  };
73
73
  interface UniverCollaborationRuntimePoolOptions {
74
+ /** Cache policy for this pool. maxEntries defaults to 50. */
74
75
  readonly cache?: InstancePoolCacheOptions;
75
76
  readonly entry: string | URL;
76
77
  readonly env?: NodeJS.ProcessEnv;
78
+ /** Maximum resident Unit runtimes per child process. Defaults to 10. */
79
+ readonly maxUnitsPerWorker?: number;
77
80
  readonly onEvent?: (event: UniverCollaborationRuntimePoolEvent) => void;
78
81
  readonly openTimeoutMs?: number;
79
82
  readonly operationTimeoutMs?: number;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- const _0x3e1b99=_0x2138;(function(_0x1dd729,_0x2809bf){const _0x25bf09=_0x2138,_0x4d69b2=_0x1dd729();while(!![]){try{const _0x7a90e6=-parseInt(_0x25bf09(0xdb))/0x1+-parseInt(_0x25bf09(0xa6))/0x2*(parseInt(_0x25bf09(0xe5))/0x3)+-parseInt(_0x25bf09(0xab))/0x4+parseInt(_0x25bf09(0xd0))/0x5+-parseInt(_0x25bf09(0x98))/0x6+parseInt(_0x25bf09(0x10c))/0x7+-parseInt(_0x25bf09(0x10b))/0x8*(-parseInt(_0x25bf09(0xaf))/0x9);if(_0x7a90e6===_0x2809bf)break;else _0x4d69b2['push'](_0x4d69b2['shift']());}catch(_0x1e0ffb){_0x4d69b2['push'](_0x4d69b2['shift']());}}}(_0x2822,0x7532e));import{InstancePoolError as _0x3afe5a,createGenericKeyedInstancePool as _0xea6852}from'@univer-cli/generic-keyed-instance-pool';import{fork as _0x4eed7a}from'node:child_process';import{dirname as _0x2fdcd5,extname as _0xc0453f,join as _0x2fed0b}from'node:path';import{fileURLToPath as _0x2a681c}from'node:url';var s=class extends Error{[_0x3e1b99(0xdc)];['invalidatesInstance'];constructor(_0x496037,_0xd96762,_0x57f81d={}){const _0x3f1f13=_0x3e1b99;super(_0xd96762,_0x57f81d),this[_0x3f1f13(0x9c)]=_0x3f1f13(0xfb),this[_0x3f1f13(0xdc)]=_0x496037,this[_0x3f1f13(0xeb)]=_0x57f81d['invalidatesInstance']??!0x1;}},c=_0x3e1b99(0xd9);function l(_0x23a69d){const _0x529264=_0x3e1b99;return _0x23a69d instanceof Error&&_0x23a69d['name']===_0x529264(0xd9)&&_0x529264(0xdc)in _0x23a69d&&typeof _0x23a69d['code']==_0x529264(0xca);}async function u(_0x427dd7){const _0x4f1deb=_0x3e1b99;let _0x32e38a=_0x2a681c(import.meta.url),_0x431251=_0x2fdcd5(_0x32e38a),_0x5040b9=_0x2fed0b(_0x431251,_0xc0453f(_0x32e38a)===_0x4f1deb(0xf0)?_0x4f1deb(0x91):_0x4f1deb(0xbd)),_0x1297ed=d(_0x4eed7a(_0x5040b9,[],{..._0x427dd7['env']===void 0x0?{}:{'env':_0x427dd7[_0x4f1deb(0xfe)]},'serialization':_0x4f1deb(0xbe),'stdio':[_0x4f1deb(0x109),_0x4f1deb(0x109),_0x4f1deb(0x109),_0x4f1deb(0xf5)]}),_0x427dd7[_0x4f1deb(0xcc)]);try{let _0x1182e1=f(await _0x1297ed[_0x4f1deb(0x8a)]({'entry':_0x427dd7[_0x4f1deb(0xf6)],'id':_0x1297ed[_0x4f1deb(0x7f)](),'init':_0x427dd7[_0x4f1deb(0x8d)],'type':'open'},_0x427dd7[_0x4f1deb(0xb4)],_0x4f1deb(0xc1))),_0x446d90,_0x4864f8=async _0x52d032=>await _0x1297ed['request']({..._0x52d032,'id':_0x1297ed[_0x4f1deb(0x7f)]()},_0x427dd7[_0x4f1deb(0xe9)]);return{..._0x1182e1,async 'close'(){const _0x28e4c1=_0x4f1deb;_0x446d90??=_0x1297ed[_0x28e4c1(0xaa)](),await _0x446d90;},async 'getState'(){const _0xead9ce=_0x4f1deb;return p(await _0x4864f8({'type':_0xead9ce(0xef)}));},async 'getPendingMutations'(){const _0x15e76e=_0x4f1deb;let _0x30ca65=await _0x4864f8({'type':_0x15e76e(0xbc)});if(!w(_0x30ca65))throw v(_0x15e76e(0xc7));return _0x30ca65;},async 'executeReadCode'(_0x3dedf3){const _0x2c468a=_0x4f1deb;let _0x2fd700=m(await _0x4864f8({'code':_0x3dedf3,'type':_0x2c468a(0xc9)}));if(!('value'in _0x2fd700)||!T(_0x2fd700['value']))throw v('Worker\x20returned\x20an\x20invalid\x20read\x20value');return _0x2fd700;},async 'executeWriteCode'(_0x334f5d){const _0xabc308=_0x4f1deb;let _0x3390f3=m(await _0x4864f8({'code':_0x334f5d,'type':_0xabc308(0x86)}));if(!T(_0x3390f3[_0xabc308(0xa1)])||!w(_0x3390f3[_0xabc308(0xb7)]))throw v(_0xabc308(0x84));return _0x3390f3;},async 'replacePendingMutations'(_0x1b0942){const _0x4c0a1e=_0x4f1deb;let _0x15737c=m(await _0x4864f8({'mutations':_0x1b0942,'type':'replace-mutations'}));if(!E(_0x15737c['previousMutationCount'])||!E(_0x15737c[_0x4c0a1e(0xe4)]))throw v('Worker\x20returned\x20an\x20invalid\x20mutation\x20replacement\x20result');return _0x15737c;},async 'fetch'(){const _0x1a5b5f=_0x4f1deb;return h(await _0x4864f8({'type':'fetch'}),['unchanged',_0x1a5b5f(0xf2)]);},async 'pull'(){const _0x2c6ff9=_0x4f1deb;return h(await _0x4864f8({'type':_0x2c6ff9(0xcb)}),['up-to-date',_0x2c6ff9(0xf3),_0x2c6ff9(0xd4)]);},async 'commit'(){const _0x37dd2b=_0x4f1deb;return h(await _0x4864f8({'type':_0x37dd2b(0xc0)}),[_0x37dd2b(0xa0),_0x37dd2b(0xd7),'confirmed','retry','unknown','conflict']);},async 'exportUnitData'(){const _0x56ce41=_0x4f1deb;let _0x1b2bb5=await _0x4864f8({'type':'export'});if(!D(_0x1b2bb5))throw v(_0x56ce41(0xd6));return _0x1b2bb5;}};}catch(_0xa40cf3){throw await _0x1297ed[_0x4f1deb(0xaa)](),_0xa40cf3;}}function d(_0x5a3874,_0x435fd8){const _0x1272c1=_0x3e1b99;let _0x50d0d5=new Map(),_0x40bbf6=0x0,_0x20bcb3,_0x576dc3=!0x1,_0x251364,_0x5d9305,_0x46767b=new Promise(_0x246bcc=>{_0x5d9305=_0x246bcc;});return _0x5a3874['on'](_0x1272c1(0xcd),_0xef8f93=>{const _0x30f3ad=_0x1272c1;if(!y(_0xef8f93))return;let _0x52e6b5=_0x50d0d5[_0x30f3ad(0xb9)](_0xef8f93['id']);_0x52e6b5&&(_0x50d0d5['delete'](_0xef8f93['id']),_0x52e6b5['timer']&&clearTimeout(_0x52e6b5[_0x30f3ad(0xfc)]),_0xef8f93[_0x30f3ad(0xe1)]===_0x30f3ad(0xd3)?_0x52e6b5['reject'](g(_0xef8f93[_0x30f3ad(0xd3)])):_0x52e6b5['resolve'](_0xef8f93[_0x30f3ad(0x88)]));}),_0x5a3874['on'](_0x1272c1(0xd3),_0x17c556=>_0x2f964b(_(_0x1272c1(0xc8)+_0x435fd8+'\x20failed:\x20'+_0x17c556['message'],_0x17c556))),_0x5a3874['on']('exit',(_0x5189a4,_0x428d08)=>{const _0x4c4b0a=_0x1272c1;_0x576dc3||_0x2f964b(_(_0x4c4b0a(0xc8)+_0x435fd8+_0x4c4b0a(0xc4)+(_0x428d08?'signal\x20'+_0x428d08:_0x4c4b0a(0xa2)+String(_0x5189a4))));}),_0x5a3874['on'](_0x1272c1(0xaa),()=>_0x5d9305()),{async 'close'(){if(_0x251364)return await _0x251364;_0x251364=_0x201499(),await _0x251364;},'nextId'(){return++_0x40bbf6;},async 'request'(_0x52b270,_0x5aabf3,_0x410b17=_0x1272c1(0xff)){if(_0x20bcb3)throw _0x20bcb3;return await new Promise((_0x5ae694,_0x190808)=>{const _0x5cd970=_0x2138;let _0x179c8e={'reject':_0x190808,'resolve':_0x5ae694,'timer':setTimeout(()=>{const _0x5e0c40=_0x2138;_0x2f964b(new s(_0x410b17,'Collaboration\x20worker\x20'+_0x435fd8+_0x5e0c40(0xda)+_0x5aabf3+'ms',{'invalidatesInstance':!0x0})),_0x3190c7();},_0x5aabf3)};_0x50d0d5[_0x5cd970(0xb0)](_0x52b270['id'],_0x179c8e),_0x5a3874['send'](_0x52b270,_0x15fc95=>{const _0x5e22dc=_0x5cd970;_0x15fc95&&_0x2f964b(_(_0x5e22dc(0xb3)+_0x435fd8,_0x15fc95));});});}};async function _0x201499(){const _0x1fe0b4=_0x1272c1;if(_0x576dc3=!0x0,!_0x20bcb3&&_0x5a3874[_0x1fe0b4(0xcf)])try{await Promise[_0x1fe0b4(0x105)]([new Promise((_0x1213f6,_0x5a3c89)=>{const _0xc9da46=_0x1fe0b4;let _0x7f805a=++_0x40bbf6;_0x50d0d5[_0xc9da46(0xb0)](_0x7f805a,{'reject':_0x5a3c89,'resolve':_0x1213f6}),_0x5a3874[_0xc9da46(0xad)]({'id':_0x7f805a,'type':_0xc9da46(0xaa)},_0x33f155=>{_0x33f155&&_0x5a3c89(_0x33f155);});}),new Promise((_0x205746,_0x42ac4c)=>{const _0x1b2346=_0x1fe0b4;setTimeout(()=>_0x42ac4c(Error('Worker\x20close\x20timed\x20out')),0x1388)[_0x1b2346(0xc6)]();})]);}catch{}_0x3190c7(),await _0x46767b,_0x2f964b(new s(_0x1fe0b4(0x93),_0x1fe0b4(0x8e)+_0x435fd8+_0x1fe0b4(0x8b),{'invalidatesInstance':!0x0}));}function _0x2f964b(_0x214600){const _0x3e867b=_0x1272c1;_0x20bcb3??=_0x214600;for(let _0x1c82b1 of _0x50d0d5['values']())_0x1c82b1[_0x3e867b(0xfc)]&&clearTimeout(_0x1c82b1[_0x3e867b(0xfc)]),_0x1c82b1[_0x3e867b(0xe8)](_0x20bcb3);_0x50d0d5[_0x3e867b(0xd5)]();}function _0x3190c7(){const _0x912eb3=_0x1272c1;_0x5a3874[_0x912eb3(0xdd)]===null&&_0x5a3874[_0x912eb3(0x103)]===null&&_0x5a3874[_0x912eb3(0xf8)](_0x912eb3(0xde));}}function f(_0x24d96d){const _0x22d89b=_0x3e1b99;if(!D(_0x24d96d)||typeof _0x24d96d[_0x22d89b(0x9b)]!=_0x22d89b(0xca)||!b(_0x24d96d[_0x22d89b(0xae)]))throw v('Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20metadata');return{'unitId':_0x24d96d[_0x22d89b(0x9b)],'unitType':_0x24d96d[_0x22d89b(0xae)]};}function p(_0x3433f6){const _0x8f1a17=_0x3e1b99;if(!D(_0x3433f6)||!x(_0x3433f6[_0x8f1a17(0xce)])||!E(_0x3433f6['baseRevision'])||!E(_0x3433f6[_0x8f1a17(0x89)])||Number(_0x3433f6[_0x8f1a17(0x89)])<Number(_0x3433f6[_0x8f1a17(0xb1)])||!E(_0x3433f6[_0x8f1a17(0xe4)])||!E(_0x3433f6[_0x8f1a17(0xd2)])||!S(_0x3433f6[_0x8f1a17(0x80)])||!C(_0x3433f6[_0x8f1a17(0xd4)]))throw v('Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20state');return _0x3433f6;}function m(_0x158615){const _0x59b895=_0x3e1b99;if(!D(_0x158615))throw v('Worker\x20returned\x20an\x20invalid\x20operation\x20result');return{..._0x158615,'state':p(_0x158615[_0x59b895(0x108)])};}function h(_0x3cfd7f,_0x3853f0){const _0x479370=_0x3e1b99;let _0x1b47a5=m(_0x3cfd7f);if(typeof _0x1b47a5['status']!=_0x479370(0xca)||!_0x3853f0[_0x479370(0xa9)](_0x1b47a5['status']))throw v(_0x479370(0xee));return _0x1b47a5;}function g(_0x3dfbe2){const _0xa7d8dc=_0x3e1b99;let _0x226c2f=Error(_0x3dfbe2['message']);return _0x3dfbe2['code']?.[_0xa7d8dc(0x9a)](_0xa7d8dc(0xb2))&&!_0x3dfbe2[_0xa7d8dc(0xdc)][_0xa7d8dc(0x9a)](_0xa7d8dc(0x8f))?(_0x226c2f[_0xa7d8dc(0x9c)]=c,Object[_0xa7d8dc(0xa8)](_0x226c2f,{'code':_0x3dfbe2['code'],'retryable':_0x3dfbe2[_0xa7d8dc(0x82)]??!0x1})):(_0x226c2f[_0xa7d8dc(0x9c)]=_0x3dfbe2[_0xa7d8dc(0x9c)],_0x3dfbe2[_0xa7d8dc(0xdc)]!==void 0x0&&Object['assign'](_0x226c2f,{'code':_0x3dfbe2['code']})),_0x3dfbe2[_0xa7d8dc(0xeb)]&&Object['assign'](_0x226c2f,{'invalidatesInstance':!0x0}),_0x3dfbe2[_0xa7d8dc(0xbb)]!==void 0x0&&(_0x226c2f[_0xa7d8dc(0xbb)]=_0x3dfbe2[_0xa7d8dc(0xbb)]),_0x226c2f;}function _(_0x276daa,_0xb4ca5f){const _0x54e313=_0x3e1b99;return new s(_0x54e313(0xf4),_0x276daa,{..._0xb4ca5f===void 0x0?{}:{'cause':_0xb4ca5f},'invalidatesInstance':!0x0});}function v(_0x46c2f2){const _0x19444a=_0x3e1b99;return new s(_0x19444a(0xed),_0x46c2f2,{'invalidatesInstance':!0x0});}function y(_0x58c8cf){const _0x167dcb=_0x3e1b99;return D(_0x58c8cf)&&Number[_0x167dcb(0x106)](_0x58c8cf['id'])&&(_0x58c8cf['type']===_0x167dcb(0x88)||_0x58c8cf[_0x167dcb(0xe1)]===_0x167dcb(0xd3));}function b(_0x21809c){return _0x21809c===0x1||_0x21809c===0x2||_0x21809c===0x3||_0x21809c===0x5||_0x21809c===0x6||_0x21809c===0x7;}function x(_0x162ef8){const _0x2d1de4=_0x3e1b99;return _0x162ef8==='online'||_0x162ef8===_0x2d1de4(0xc2)||_0x162ef8===_0x2d1de4(0x94)||_0x162ef8===_0x2d1de4(0xdf);}function S(_0x5b49d6){const _0x3d372d=_0x3e1b99;return _0x5b49d6===null||D(_0x5b49d6)&&E(_0x5b49d6[_0x3d372d(0xb1)])&&E(_0x5b49d6[_0x3d372d(0x8c)])&&E(_0x5b49d6[_0x3d372d(0xea)])&&(_0x5b49d6[_0x3d372d(0x85)]===void 0x0||typeof _0x5b49d6['sid']=='string')&&(_0x5b49d6[_0x3d372d(0x104)]===void 0x0||E(_0x5b49d6[_0x3d372d(0x104)]));}function _0x2822(){const _0x31e381=['timer','isFinite','env','COLLABORATION_WORKER_OPERATION_TIMEOUT','instance-failed','COLLABORATION_LEASE_CLOSED','UNKNOWN','signalCode','reqId','race','isSafeInteger','COLLABORATION_PROTOCOL_ERROR','state','ignore','object','8TEUcnr','4665234eEwsQZ','nextId','awaitingChangeset','number','retryable','boolean','Worker\x20returned\x20an\x20invalid\x20write\x20result','sid','execute-write','onEvent','result','knownHeadRevision','request','\x20is\x20closed','revision','init','Collaboration\x20worker\x20','COLLABORATION_WORKER_','COLLABORATION_POOL_CLOSED','worker-child.ts','pending-mutations','COLLABORATION_WORKER_CLOSED','offline','Collaboration\x20runtime\x20lease\x20','exportUnitData','mode','4311360lesyNg','permission-rejected','startsWith','unitId','name','COLLABORATION_POOL_INVALID_INPUT','invalidate','executeWriteCode','nothing-to-commit','value','exit\x20code\x20','reason','isArray','entry\x20must\x20be\x20an\x20absolute\x20file\x20URL\x20or\x20another\x20importable\x20URL','8fxJKDJ','href','assign','includes','close','2221308xhnnFt','entry\x20must\x20not\x20be\x20empty','send','unitType','15607602JKgmiC','set','baseRevision','COLLABORATION_','Failed\x20to\x20send\x20a\x20request\x20to\x20worker\x20','openTimeoutMs','export','fetch','mutations','getPendingMutations','get','changeset-rejected','stack','get-pending-mutations','worker-child.mjs','advanced','values','commit','COLLABORATION_WORKER_OPEN_TIMEOUT','reconnecting','isInteger','\x20exited\x20unexpectedly\x20with\x20','read','unref','Worker\x20returned\x20invalid\x20pending\x20mutations','Worker\x20','execute-read','string','pull','key','message','connection','connected','82565yVReBG','every','bufferedChangesetCount','error','conflict','clear','Worker\x20returned\x20invalid\x20UnitData','pull-required','release','CollaborationRuntimeError','\x20timed\x20out\x20after\x20','425656hVimUb','code','exitCode','SIGKILL','closed','now','type','length','instance','pendingMutationCount','178173wjsPfm','operation','INSTANCE_POOL_CLOSED','reject','operationTimeoutMs','mutationCount','invalidatesInstance','data','COLLABORATION_WORKER_PROTOCOL_ERROR','Worker\x20returned\x20an\x20invalid\x20operation\x20status','get-state','.ts','\x20must\x20be\x20a\x20finite\x20positive\x20number','fetched','pulled','COLLABORATION_WORKER_CRASHED','ipc','entry','replacePendingMutations','kill','COLLABORATION_LOAD_FAILED','executeReadCode','UniverCollaborationRuntimePoolError'];_0x2822=function(){return _0x31e381;};return _0x2822();}function C(_0x4e5fc8){const _0x75c4aa=_0x3e1b99;return _0x4e5fc8===null||D(_0x4e5fc8)&&(_0x4e5fc8[_0x75c4aa(0xe6)]===_0x75c4aa(0xcb)||_0x4e5fc8[_0x75c4aa(0xe6)]===_0x75c4aa(0xc0))&&(_0x4e5fc8[_0x75c4aa(0xa3)]==='transform-failed'||_0x4e5fc8[_0x75c4aa(0xa3)]===_0x75c4aa(0xba)||_0x4e5fc8[_0x75c4aa(0xa3)]===_0x75c4aa(0x99))&&typeof _0x4e5fc8['message']==_0x75c4aa(0xca)&&(_0x4e5fc8[_0x75c4aa(0xdc)]===void 0x0||Number[_0x75c4aa(0xc3)](_0x4e5fc8[_0x75c4aa(0xdc)]));}function w(_0x23e46c){const _0x4d381b=_0x3e1b99;return Array[_0x4d381b(0xa4)](_0x23e46c)&&_0x23e46c['every'](_0x1eb2f8=>D(_0x1eb2f8)&&typeof _0x1eb2f8['id']==_0x4d381b(0xca)&&_0x1eb2f8['id'][_0x4d381b(0xe2)]>0x0&&typeof _0x1eb2f8[_0x4d381b(0xec)]==_0x4d381b(0xca));}function _0x2138(_0x2d92ed,_0x483f9a){_0x2d92ed=_0x2d92ed-0x7f;const _0x2822de=_0x2822();let _0x213875=_0x2822de[_0x2d92ed];return _0x213875;}function T(_0x274e6e){const _0x8bac7d=_0x3e1b99;return _0x274e6e===null||typeof _0x274e6e==_0x8bac7d(0x83)||typeof _0x274e6e==_0x8bac7d(0xca)||typeof _0x274e6e==_0x8bac7d(0x81)&&Number[_0x8bac7d(0xfd)](_0x274e6e)?!0x0:Array[_0x8bac7d(0xa4)](_0x274e6e)?_0x274e6e[_0x8bac7d(0xd1)](T):D(_0x274e6e)&&Object[_0x8bac7d(0xbf)](_0x274e6e)[_0x8bac7d(0xd1)](T);}function E(_0x3c4ff7){const _0x46d5e1=_0x3e1b99;return Number[_0x46d5e1(0x106)](_0x3c4ff7)&&Number(_0x3c4ff7)>=0x0;}function D(_0x3d5851){const _0x333a7f=_0x3e1b99;return typeof _0x3d5851=='object'&&!!_0x3d5851&&!Array[_0x333a7f(0xa4)](_0x3d5851);}var O=0x7530,k=0x7530;function A(_0xe0d4a7){const _0x5509db=_0x3e1b99;let _0x3cf753=j(_0xe0d4a7[_0x5509db(0xf6)]),_0x251599=_0xe0d4a7[_0x5509db(0xb4)]??O,_0x2e9c3f=_0xe0d4a7['operationTimeoutMs']??k;M(_0x251599,'openTimeoutMs'),M(_0x2e9c3f,_0x5509db(0xe9));let _0x4daba5;try{_0x4daba5=_0xea6852({'factory':{async 'create'(_0x4e1031){const _0x290708=_0x5509db;return await u({'entry':_0x3cf753,..._0xe0d4a7[_0x290708(0xfe)]===void 0x0?{}:{'env':_0xe0d4a7[_0x290708(0xfe)]},'init':_0x4e1031[_0x290708(0x8d)],'key':_0x4e1031['key'],'openTimeoutMs':_0x251599,'operationTimeoutMs':_0x2e9c3f});},async 'destroy'({instance:_0x3e6657}){await _0x3e6657['close']();}},..._0xe0d4a7['cache']===void 0x0?{}:{'cache':_0xe0d4a7['cache']},'onEvent':_0x4df4e6});}catch(_0xc5b6c2){throw N(_0xc5b6c2);}return{async 'acquire'(_0x3888b6){let _0x4cd335;try{_0x4cd335=await _0x4daba5['acquire'](_0x3888b6);}catch(_0x5a60cc){throw N(_0x5a60cc);}return _0x124ae9(_0x4cd335);},async 'close'(){const _0x1fbe52=_0x5509db;try{await _0x4daba5[_0x1fbe52(0xaa)]();}catch(_0x477034){throw N(_0x477034);}}};function _0x124ae9(_0x281262){const _0x41dbe2=_0x5509db;let _0x50bbd2=_0x281262[_0x41dbe2(0xe3)],_0x4e7e97=!0x1,_0x3a13e1,_0x2e1f07=!0x1;return{'key':_0x281262[_0x41dbe2(0xcc)],'unitId':_0x50bbd2[_0x41dbe2(0x9b)],'unitType':_0x50bbd2['unitType'],async 'getState'(){return await _0x3d97db('state',async()=>await _0x50bbd2['getState']());},async 'getPendingMutations'(){const _0x3ceac1=_0x41dbe2;return await _0x3d97db(_0x3ceac1(0x92),async()=>await _0x50bbd2[_0x3ceac1(0xb8)]());},async 'execute'(_0xfdf3e1){const _0x2911ad=_0x41dbe2;return _0xfdf3e1[_0x2911ad(0x97)]==='read'?await _0x3d97db(_0x2911ad(0xc5),async()=>await _0x50bbd2[_0x2911ad(0xfa)](_0xfdf3e1[_0x2911ad(0xdc)])):await _0x3d97db('write',async()=>await _0x50bbd2[_0x2911ad(0x9f)](_0xfdf3e1[_0x2911ad(0xdc)]));},async 'replacePendingMutations'(_0x1b616b){const _0x401563=_0x41dbe2;return await _0x3d97db('replace-mutations',async()=>await _0x50bbd2[_0x401563(0xf7)](_0x1b616b));},async 'fetch'(){const _0x492d76=_0x41dbe2;return await _0x3d97db(_0x492d76(0xb6),async()=>await _0x50bbd2[_0x492d76(0xb6)]());},async 'pull'(){return await _0x3d97db('pull',async()=>await _0x50bbd2['pull']());},async 'commit'(){const _0x2bcc1f=_0x41dbe2;return await _0x3d97db(_0x2bcc1f(0xc0),async()=>await _0x50bbd2[_0x2bcc1f(0xc0)]());},async 'exportUnitData'(){const _0x2d9561=_0x41dbe2;return await _0x3d97db(_0x2d9561(0xb5),async()=>await _0x50bbd2[_0x2d9561(0x96)]());},async 'invalidate'(){_0x4e7e97||(_0x4e7e97=!0x0,await _0x281262['invalidate']());},async 'release'(){const _0x4721d9=_0x41dbe2;_0x4e7e97||(_0x4e7e97=!0x0,_0x2e1f07?await _0x281262[_0x4721d9(0x9e)]():await _0x281262[_0x4721d9(0xd8)]());}};async function _0x3d97db(_0x4627f2,_0x1238f1){const _0x1d5100=_0x41dbe2;_0x4003fe();try{return await _0x3ccd44(_0x281262[_0x1d5100(0xcc)],_0x4627f2,_0x1238f1);}catch(_0x2d18b7){throw _0x59cabb(_0x2d18b7),_0x2d18b7;}}function _0x4003fe(){const _0x5d46f6=_0x41dbe2;if(_0x4e7e97)throw new s(_0x5d46f6(0x101),_0x5d46f6(0x95)+_0x281262[_0x5d46f6(0xcc)]+_0x5d46f6(0x8b));if(_0x3a13e1)throw _0x3a13e1;}function _0x59cabb(_0x354e6e){const _0x2ed9c5=_0x41dbe2;(_0x354e6e instanceof s&&_0x354e6e[_0x2ed9c5(0xeb)]||l(_0x354e6e)&&(_0x354e6e[_0x2ed9c5(0xdc)]===_0x2ed9c5(0x107)||_0x354e6e[_0x2ed9c5(0xdc)]==='COLLABORATION_CLOSED'||_0x354e6e[_0x2ed9c5(0xdc)]===_0x2ed9c5(0xf9))||typeof _0x354e6e==_0x2ed9c5(0x10a)&&_0x354e6e&&'invalidatesInstance'in _0x354e6e&&_0x354e6e[_0x2ed9c5(0xeb)]===!0x0)&&(_0x2e1f07=!0x0,_0x3a13e1=_0x354e6e,_0x946064({'errorCode':P(_0x354e6e),'key':_0x281262[_0x2ed9c5(0xcc)],'type':_0x2ed9c5(0x100)}));}}async function _0x3ccd44(_0x56326d,_0x3618a1,_0xd576f){const _0x16c17d=_0x5509db;let _0x5ccdfd=Date[_0x16c17d(0xe0)](),_0x486c03=await _0xd576f();return _0x946064({'durationMs':Date[_0x16c17d(0xe0)]()-_0x5ccdfd,'key':_0x56326d,'operation':_0x3618a1,'type':'operation-complete'}),_0x486c03;}function _0x4df4e6(_0x3b24fb){_0x946064(_0x3b24fb);}function _0x946064(_0x1be79a){const _0x2d66c6=_0x5509db;try{_0xe0d4a7[_0x2d66c6(0x87)]?.(_0x1be79a);}catch{}}}function j(_0x2d08e3){const _0x64210d=_0x3e1b99;let _0xb37e72=_0x2d08e3 instanceof URL?_0x2d08e3['href']:_0x2d08e3;if(_0xb37e72['length']===0x0)throw new s(_0x64210d(0x9d),_0x64210d(0xac));try{return new URL(_0xb37e72)[_0x64210d(0xa7)];}catch{throw new s(_0x64210d(0x9d),_0x64210d(0xa5));}}function M(_0x35c6c6,_0x1d8367){const _0x56bdfd=_0x3e1b99;if(!Number[_0x56bdfd(0xfd)](_0x35c6c6)||_0x35c6c6<=0x0)throw new s('COLLABORATION_POOL_INVALID_INPUT',_0x1d8367+_0x56bdfd(0xf1));}function N(_0x288ef6){const _0x58b3cc=_0x3e1b99;return _0x288ef6 instanceof _0x3afe5a?new s(_0x288ef6[_0x58b3cc(0xdc)]==='INSTANCE_POOL_CAPACITY_EXCEEDED'?'COLLABORATION_POOL_CAPACITY_EXCEEDED':_0x288ef6[_0x58b3cc(0xdc)]===_0x58b3cc(0xe7)?_0x58b3cc(0x90):_0x58b3cc(0x9d),_0x288ef6['message'],{'cause':_0x288ef6}):_0x288ef6;}function P(_0x2702ef){const _0x50d545=_0x3e1b99;return typeof _0x2702ef==_0x50d545(0x10a)&&_0x2702ef&&_0x50d545(0xdc)in _0x2702ef&&typeof _0x2702ef[_0x50d545(0xdc)]==_0x50d545(0xca)?_0x2702ef[_0x50d545(0xdc)]:_0x50d545(0x102);}function F(_0x4ed198){return _0x4ed198;}export{s as UniverCollaborationRuntimePoolError,A as createUniverCollaborationRuntimePool,F as defineUniverCollaborationRuntimeWorker};
1
+ const _0x200859=_0x3b7e;(function(_0x3491c8,_0x371d25){const _0x4e7c0d=_0x3b7e,_0x4d35d4=_0x3491c8();while(!![]){try{const _0x52891=-parseInt(_0x4e7c0d(0xf5))/0x1+-parseInt(_0x4e7c0d(0x12d))/0x2+parseInt(_0x4e7c0d(0xc0))/0x3*(-parseInt(_0x4e7c0d(0xc7))/0x4)+parseInt(_0x4e7c0d(0xc3))/0x5+parseInt(_0x4e7c0d(0x142))/0x6+parseInt(_0x4e7c0d(0xe7))/0x7*(parseInt(_0x4e7c0d(0xdf))/0x8)+-parseInt(_0x4e7c0d(0x12b))/0x9;if(_0x52891===_0x371d25)break;else _0x4d35d4['push'](_0x4d35d4['shift']());}catch(_0x2d9bcf){_0x4d35d4['push'](_0x4d35d4['shift']());}}}(_0x2a9b,0xc3839));import{InstancePoolError as _0x354870,createGenericKeyedInstancePool as _0x366d0f}from'@univer-cli/generic-keyed-instance-pool';import{fork as _0xcc4fae}from'node:child_process';import{fileURLToPath as _0x6d00b0}from'node:url';var i=class extends Error{['code'];['invalidatesInstance'];constructor(_0x308804,_0x324fcd,_0x3c8dd6={}){const _0xb316d2=_0x3b7e;super(_0x324fcd,_0x3c8dd6),this[_0xb316d2(0x130)]=_0xb316d2(0xed),this[_0xb316d2(0x101)]=_0x308804,this[_0xb316d2(0xd8)]=_0x3c8dd6['invalidatesInstance']??!0x1;}},a=_0x200859(0xf9);function o(_0x596472){const _0x4b7f35=_0x200859;return _0x596472 instanceof Error&&_0x596472['name']===_0x4b7f35(0xf9)&&_0x4b7f35(0x101)in _0x596472&&typeof _0x596472[_0x4b7f35(0x101)]=='string';}function s(_0x1e1a90){const _0x3838d3=_0x200859;let _0x15d8e6=import.meta.url[_0x3838d3(0xdd)]('.ts')?_0x3838d3(0xbf):'./worker-child.mjs',_0x5aae58=_0xcc4fae(_0x6d00b0(new URL(_0x15d8e6,import.meta.url)),[],{..._0x1e1a90===void 0x0?{}:{'env':_0x1e1a90},'serialization':'advanced','stdio':['ignore',_0x3838d3(0xf6),'ignore',_0x3838d3(0xb7)]}),_0x8ef984=0x0,_0x5bd550,_0x1feae5=new Map(),_0x32900a=new Promise(_0x2200ac=>_0x5aae58['once'](_0x3838d3(0xcf),()=>_0x2200ac()));_0x5aae58['on'](_0x3838d3(0xdb),_0x18823a=>_0x3bb6dd(l(_0x18823a[_0x3838d3(0x11d)],_0x18823a))),_0x5aae58['on'](_0x3838d3(0xc1),(_0x116572,_0x5799ca)=>_0x3bb6dd(l(_0x3838d3(0xf3)+(_0x5799ca??_0x116572)))),_0x5aae58['on'](_0x3838d3(0xd2),()=>_0x3bb6dd(l('Worker\x20IPC\x20disconnected'))),_0x5aae58['on'](_0x3838d3(0x11d),_0x3dc030=>{const _0xb82d1b=_0x3838d3;if(!u(_0x3dc030))return;let _0x54767b=_0x1feae5[_0xb82d1b(0x145)](_0x3dc030['id']);_0x54767b&&(_0x1feae5[_0xb82d1b(0x119)](_0x3dc030['id']),clearTimeout(_0x54767b[_0xb82d1b(0x127)]),_0x3dc030[_0xb82d1b(0xd3)]===_0xb82d1b(0xdb)?_0x54767b[_0xb82d1b(0x13e)](c(_0x3dc030[_0xb82d1b(0xdb)])):_0x54767b[_0xb82d1b(0x11b)](_0x3dc030['result']));});function _0x3bb6dd(_0x58ccca){const _0x146104=_0x3838d3;if(!_0x5bd550){_0x5bd550=_0x58ccca;for(let _0x3fc634 of _0x1feae5[_0x146104(0x126)]())clearTimeout(_0x3fc634['timer']),_0x3fc634['reject'](_0x58ccca);_0x1feae5[_0x146104(0xd7)](),_0x5aae58[_0x146104(0xbb)]===null&&_0x5aae58[_0x146104(0x117)]===null&&_0x5aae58[_0x146104(0xea)](_0x146104(0x10c));}}return{'units':0x0,'exited':_0x32900a,get 'available'(){return!_0x5bd550;},'terminate'(){const _0x3e2260=_0x3838d3;_0x3bb6dd(new i(_0x3e2260(0x147),_0x3e2260(0xef),{'invalidatesInstance':!0x0}));},async 'request'(_0x47170c,_0x1ffe45,_0x1a7a56){if(_0x5bd550)throw _0x5bd550;let _0x3ec6cf=++_0x8ef984;return await new Promise((_0x249a9c,_0x886efc)=>{const _0x390341=_0x3b7e;let _0x5bba0f=setTimeout(()=>_0x3bb6dd(new i(_0x1ffe45['type']===_0x390341(0xe0)?_0x390341(0x11f):_0x390341(0xc9),_0x390341(0x114)+_0x1ffe45['type']+_0x390341(0xf2)+_0x1a7a56+'ms',{'invalidatesInstance':!0x0})),_0x1a7a56);_0x1feae5['set'](_0x3ec6cf,{'reject':_0x886efc,'resolve':_0x249a9c,'timer':_0x5bba0f});try{_0x5aae58[_0x390341(0x13a)]({..._0x1ffe45,'id':_0x3ec6cf,'runtimeId':_0x47170c},_0x16c2ea=>{_0x16c2ea&&_0x3bb6dd(l(_0x16c2ea['message'],_0x16c2ea));});}catch(_0xee5613){clearTimeout(_0x5bba0f),_0x1feae5['delete'](_0x3ec6cf),_0x886efc(_0xee5613);}});}};}function c(_0x51a255){const _0xb4cd9a=_0x200859;let _0x15629d=Error(_0x51a255['message']);return _0x51a255['code']?.['startsWith']('COLLABORATION_')&&!_0x51a255[_0xb4cd9a(0x101)][_0xb4cd9a(0x11c)]('COLLABORATION_WORKER_')?(_0x15629d[_0xb4cd9a(0x130)]=a,Object[_0xb4cd9a(0x129)](_0x15629d,{'code':_0x51a255[_0xb4cd9a(0x101)],'retryable':_0x51a255[_0xb4cd9a(0x121)]??!0x1})):(_0x15629d[_0xb4cd9a(0x130)]=_0x51a255['name'],_0x51a255['code']!==void 0x0&&Object[_0xb4cd9a(0x129)](_0x15629d,{'code':_0x51a255[_0xb4cd9a(0x101)]})),_0x51a255['invalidatesInstance']&&Object[_0xb4cd9a(0x129)](_0x15629d,{'invalidatesInstance':!0x0}),_0x51a255[_0xb4cd9a(0xc4)]!==void 0x0&&(_0x15629d[_0xb4cd9a(0xc4)]=_0x51a255[_0xb4cd9a(0xc4)]),_0x15629d;}function l(_0xb09155,_0x3807ef){const _0x2b4237=_0x200859;return new i(_0x2b4237(0xf0),_0xb09155,{..._0x3807ef===void 0x0?{}:{'cause':_0x3807ef},'invalidatesInstance':!0x0});}function u(_0xfe38e9){const _0x1c298b=_0x200859;return typeof _0xfe38e9=='object'&&!!_0xfe38e9&&'id'in _0xfe38e9&&'type'in _0xfe38e9&&Number[_0x1c298b(0xd4)](_0xfe38e9['id'])&&(_0xfe38e9[_0x1c298b(0xd3)]===_0x1c298b(0x128)||_0xfe38e9[_0x1c298b(0xd3)]===_0x1c298b(0xdb));}var d=0x1388;function f(_0xf85b0e){let _0x1b4c1c=new Set(),_0x225844=0x0;function _0x5182d0(){const _0x39ed19=_0x3b7e;for(let _0x41d2bb of _0x1b4c1c)if(_0x41d2bb['available']&&_0x41d2bb[_0x39ed19(0xc2)]<_0xf85b0e['maxUnitsPerWorker'])return _0x41d2bb[_0x39ed19(0xc2)]++,_0x41d2bb;let _0x360170=s(_0xf85b0e[_0x39ed19(0xc6)]);return _0x360170[_0x39ed19(0xc2)]++,_0x1b4c1c[_0x39ed19(0xba)](_0x360170),_0x360170[_0x39ed19(0x107)][_0x39ed19(0x12c)](()=>_0x1b4c1c[_0x39ed19(0x119)](_0x360170)),_0x360170;}return{async 'create'({init:_0x231c12}){const _0xd3adef=_0x3b7e;let _0x312a86=_0x5182d0(),_0x5a0da=++_0x225844,_0x56aa11=async()=>{const _0x21a14c=_0x3b7e;try{_0x312a86[_0x21a14c(0xdc)]&&await _0x312a86[_0x21a14c(0x137)](_0x5a0da,{'type':'close'},d);}catch{_0x312a86[_0x21a14c(0x110)]();}finally{--_0x312a86['units']===0x0&&(_0x312a86[_0x21a14c(0x110)](),await _0x312a86[_0x21a14c(0x107)]);}};try{return p(_0x312a86,_0x5a0da,m(await _0x312a86[_0xd3adef(0x137)](_0x5a0da,{'entry':_0xf85b0e['entry'],'init':_0x231c12,'type':_0xd3adef(0xe0)},_0xf85b0e[_0xd3adef(0x138)])),_0xf85b0e[_0xd3adef(0x103)],_0x56aa11);}catch(_0x587b96){throw await _0x56aa11(),_0x587b96;}},async 'destroy'({instance:_0x1283f7}){await _0x1283f7['close']();},async 'waitForExit'(){const _0xd221aa=_0x3b7e;await Promise[_0xd221aa(0xcd)](Array[_0xd221aa(0x10b)](_0x1b4c1c,_0x2461ec=>_0x2461ec[_0xd221aa(0x107)]));}};}function p(_0x131e85,_0x1be878,_0x6fb552,_0x3bad99,_0x19d61a){const _0x3189ef=_0x200859;let _0x47de32=_0x5c5ec2=>_0x131e85[_0x3189ef(0x137)](_0x1be878,_0x5c5ec2,_0x3bad99);return{..._0x6fb552,get 'available'(){const _0x52090f=_0x3189ef;return _0x131e85[_0x52090f(0xdc)];},'close':_0x19d61a,async 'getState'(){return h(await _0x47de32({'type':'get-state'}));},async 'getPendingMutations'(){const _0xe9722=_0x3189ef;let _0x52aa02=await _0x47de32({'type':_0xe9722(0xfa)});if(!C(_0x52aa02))throw v('Worker\x20returned\x20invalid\x20pending\x20mutations');return _0x52aa02;},async 'executeReadCode'(_0x18a5c0){const _0x3af4be=_0x3189ef;let _0xe70f24=g(await _0x47de32({'code':_0x18a5c0,'type':_0x3af4be(0xfe)}));if(!(_0x3af4be(0x133)in _0xe70f24)||!w(_0xe70f24[_0x3af4be(0x133)]))throw v(_0x3af4be(0xf7));return _0xe70f24;},async 'executeWriteCode'(_0x3fb207){const _0x3eed4f=_0x3189ef;let _0x45e700=g(await _0x47de32({'code':_0x3fb207,'type':_0x3eed4f(0xd0)}));if(!w(_0x45e700['value'])||!C(_0x45e700[_0x3eed4f(0xe3)]))throw v(_0x3eed4f(0x112));return _0x45e700;},async 'replacePendingMutations'(_0x5a8771){const _0x483e70=_0x3189ef;let _0x412a4b=g(await _0x47de32({'mutations':_0x5a8771,'type':_0x483e70(0x106)}));if(!T(_0x412a4b['previousMutationCount'])||!T(_0x412a4b[_0x483e70(0xd5)]))throw v(_0x483e70(0x144));return _0x412a4b;},async 'fetch'(){const _0x2380c5=_0x3189ef;return _(await _0x47de32({'type':_0x2380c5(0x123)}),[_0x2380c5(0x10e),_0x2380c5(0x134)]);},async 'pull'(){const _0x204c61=_0x3189ef;return _(await _0x47de32({'type':_0x204c61(0xfd)}),[_0x204c61(0xf1),'pulled','conflict']);},async 'commit'(){const _0x4445cd=_0x3189ef;return _(await _0x47de32({'type':_0x4445cd(0x105)}),[_0x4445cd(0xcb),_0x4445cd(0x140),_0x4445cd(0x132),'retry',_0x4445cd(0xbe),_0x4445cd(0xff)]);},async 'exportUnitData'(){const _0x35a408=_0x3189ef;let _0x169b74=await _0x47de32({'type':'export'});if(!E(_0x169b74))throw v(_0x35a408(0xe6));return _0x169b74;}};}function m(_0x367088){const _0x2e17a7=_0x200859;if(!E(_0x367088)||typeof _0x367088[_0x2e17a7(0x13f)]!=_0x2e17a7(0xd6)||!y(_0x367088[_0x2e17a7(0xe5)]))throw v(_0x2e17a7(0xb8));return{'unitId':_0x367088[_0x2e17a7(0x13f)],'unitType':_0x367088[_0x2e17a7(0xe5)]};}function h(_0x51a66d){const _0x3dc670=_0x200859;if(!E(_0x51a66d)||!b(_0x51a66d['connection'])||!T(_0x51a66d[_0x3dc670(0xe1)])||!T(_0x51a66d[_0x3dc670(0x136)])||Number(_0x51a66d[_0x3dc670(0x136)])<Number(_0x51a66d[_0x3dc670(0xe1)])||!T(_0x51a66d[_0x3dc670(0xd5)])||!T(_0x51a66d[_0x3dc670(0x141)])||!x(_0x51a66d[_0x3dc670(0x104)])||!S(_0x51a66d['conflict']))throw v(_0x3dc670(0x13b));return _0x51a66d;}function g(_0x4d0b48){const _0x536cea=_0x200859;if(!E(_0x4d0b48))throw v('Worker\x20returned\x20an\x20invalid\x20operation\x20result');return{..._0x4d0b48,'state':h(_0x4d0b48[_0x536cea(0xb9)])};}function _(_0xa9d3a5,_0x1b7858){const _0x37ccb5=_0x200859;let _0x60313f=g(_0xa9d3a5);if(typeof _0x60313f[_0x37ccb5(0xbc)]!=_0x37ccb5(0xd6)||!_0x1b7858[_0x37ccb5(0xe9)](_0x60313f[_0x37ccb5(0xbc)]))throw v(_0x37ccb5(0x146));return _0x60313f;}function v(_0x3b8bf8){const _0x53bfc3=_0x200859;return new i(_0x53bfc3(0x122),_0x3b8bf8,{'invalidatesInstance':!0x0});}function y(_0x139a9e){return _0x139a9e===0x1||_0x139a9e===0x2||_0x139a9e===0x3||_0x139a9e===0x5||_0x139a9e===0x6||_0x139a9e===0x7;}function b(_0xbcf791){return _0xbcf791==='online'||_0xbcf791==='reconnecting'||_0xbcf791==='offline'||_0xbcf791==='closed';}function x(_0xd7abb5){const _0xf1832e=_0x200859;return _0xd7abb5===null||E(_0xd7abb5)&&T(_0xd7abb5[_0xf1832e(0xe1)])&&T(_0xd7abb5[_0xf1832e(0xf8)])&&T(_0xd7abb5[_0xf1832e(0xde)])&&(_0xd7abb5[_0xf1832e(0xda)]===void 0x0||typeof _0xd7abb5[_0xf1832e(0xda)]=='string')&&(_0xd7abb5[_0xf1832e(0x108)]===void 0x0||T(_0xd7abb5[_0xf1832e(0x108)]));}function S(_0xfa6235){const _0x42419e=_0x200859;return _0xfa6235===null||E(_0xfa6235)&&(_0xfa6235[_0x42419e(0x111)]===_0x42419e(0xfd)||_0xfa6235[_0x42419e(0x111)]===_0x42419e(0x105))&&(_0xfa6235[_0x42419e(0xce)]===_0x42419e(0xcc)||_0xfa6235[_0x42419e(0xce)]==='changeset-rejected'||_0xfa6235[_0x42419e(0xce)]===_0x42419e(0xeb))&&typeof _0xfa6235[_0x42419e(0x11d)]==_0x42419e(0xd6)&&(_0xfa6235[_0x42419e(0x101)]===void 0x0||Number[_0x42419e(0x10d)](_0xfa6235[_0x42419e(0x101)]));}function C(_0xb9476c){const _0x360961=_0x200859;return Array[_0x360961(0x139)](_0xb9476c)&&_0xb9476c['every'](_0x3184ab=>E(_0x3184ab)&&typeof _0x3184ab['id']==_0x360961(0xd6)&&_0x3184ab['id'][_0x360961(0x115)]>0x0&&typeof _0x3184ab['data']==_0x360961(0xd6));}function w(_0x315105){const _0x440e8c=_0x200859;return _0x315105===null||typeof _0x315105=='boolean'||typeof _0x315105==_0x440e8c(0xd6)||typeof _0x315105==_0x440e8c(0x124)&&Number['isFinite'](_0x315105)?!0x0:Array[_0x440e8c(0x139)](_0x315105)?_0x315105['every'](w):E(_0x315105)&&Object[_0x440e8c(0x126)](_0x315105)[_0x440e8c(0x135)](w);}function _0x3b7e(_0x43f125,_0x37230e){_0x43f125=_0x43f125-0xb6;const _0x2a9b4a=_0x2a9b();let _0x3b7ef9=_0x2a9b4a[_0x43f125];return _0x3b7ef9;}function T(_0x4796ea){const _0x5d940b=_0x200859;return Number[_0x5d940b(0xd4)](_0x4796ea)&&Number(_0x4796ea)>=0x0;}function E(_0x4f8ceb){const _0xa9889d=_0x200859;return typeof _0x4f8ceb==_0xa9889d(0x13d)&&!!_0x4f8ceb&&!Array[_0xa9889d(0x139)](_0x4f8ceb);}var D=0x32,O=0xa,k=0x7530,A=0x7530;function j(_0x151351){const _0x15b79b=_0x200859;let _0x188735=M(_0x151351[_0x15b79b(0x143)]),_0x3fc989=_0x151351[_0x15b79b(0x138)]??k,_0x1fa06f=_0x151351[_0x15b79b(0x103)]??A;N(_0x3fc989,_0x15b79b(0x138)),N(_0x1fa06f,_0x15b79b(0x103));let _0x33d8f2=_0x151351['maxUnitsPerWorker']??O;if(!Number[_0x15b79b(0xd4)](_0x33d8f2)||_0x33d8f2<=0x0)throw new i('COLLABORATION_POOL_INVALID_INPUT','maxUnitsPerWorker\x20must\x20be\x20a\x20positive\x20integer');let _0x28285c=f({'entry':_0x188735,'maxUnitsPerWorker':_0x33d8f2,'openTimeoutMs':_0x3fc989,'operationTimeoutMs':_0x1fa06f,..._0x151351['env']===void 0x0?{}:{'env':_0x151351[_0x15b79b(0xc6)]}}),_0x54e66a;try{_0x54e66a=_0x366d0f({'factory':_0x28285c,'cache':{..._0x151351[_0x15b79b(0x125)],'maxEntries':_0x151351[_0x15b79b(0x125)]?.['maxEntries']??D},'onEvent':_0xc57c6b});}catch(_0x37b7a7){throw P(_0x37b7a7);}return{async 'acquire'(_0x2b1b5e){const _0x4d5f9e=_0x15b79b;try{let _0x484006=await _0x54e66a['acquire'](_0x2b1b5e);if(_0x484006['instance'][_0x4d5f9e(0xdc)])return _0x7021ca(_0x484006);let [,_0x23573b]=await Promise[_0x4d5f9e(0xcd)]([_0x484006['invalidate'](),_0x54e66a['acquire'](_0x2b1b5e)]);if(_0x23573b[_0x4d5f9e(0xe4)][_0x4d5f9e(0xdc)])return _0x7021ca(_0x23573b);throw await _0x23573b[_0x4d5f9e(0x12f)](),new i(_0x4d5f9e(0x147),_0x4d5f9e(0xd1)+_0x2b1b5e['key']+'\x20is\x20unavailable',{'invalidatesInstance':!0x0});}catch(_0x199ebb){throw P(_0x199ebb);}},async 'close'(){try{await _0x54e66a['close'](),await _0x28285c['waitForExit']();}catch(_0xebe23f){throw P(_0xebe23f);}}};function _0x7021ca(_0x466bdd){const _0x4da714=_0x15b79b;let _0x184c7c=_0x466bdd[_0x4da714(0xe4)],_0x37d722=!0x1,_0x23245c,_0x31ab95=!0x1;return{'key':_0x466bdd[_0x4da714(0xca)],'unitId':_0x184c7c['unitId'],'unitType':_0x184c7c['unitType'],async 'getState'(){const _0x37c328=_0x4da714;return await _0x88fc1e(_0x37c328(0xb9),async()=>await _0x184c7c[_0x37c328(0xec)]());},async 'getPendingMutations'(){const _0x1a06e7=_0x4da714;return await _0x88fc1e('pending-mutations',async()=>await _0x184c7c[_0x1a06e7(0x10f)]());},async 'execute'(_0x42976f){const _0x47979c=_0x4da714;return _0x42976f[_0x47979c(0x109)]==='read'?await _0x88fc1e(_0x47979c(0xb6),async()=>await _0x184c7c[_0x47979c(0x10a)](_0x42976f[_0x47979c(0x101)])):await _0x88fc1e('write',async()=>await _0x184c7c[_0x47979c(0xfb)](_0x42976f[_0x47979c(0x101)]));},async 'replacePendingMutations'(_0x45c49a){const _0x43b8b2=_0x4da714;return await _0x88fc1e(_0x43b8b2(0x106),async()=>await _0x184c7c[_0x43b8b2(0xd9)](_0x45c49a));},async 'fetch'(){const _0x2eee79=_0x4da714;return await _0x88fc1e(_0x2eee79(0x123),async()=>await _0x184c7c[_0x2eee79(0x123)]());},async 'pull'(){const _0x6eb07e=_0x4da714;return await _0x88fc1e(_0x6eb07e(0xfd),async()=>await _0x184c7c[_0x6eb07e(0xfd)]());},async 'commit'(){const _0x4189cf=_0x4da714;return await _0x88fc1e('commit',async()=>await _0x184c7c[_0x4189cf(0x105)]());},async 'exportUnitData'(){const _0x54dbb2=_0x4da714;return await _0x88fc1e(_0x54dbb2(0x13c),async()=>await _0x184c7c['exportUnitData']());},async 'invalidate'(){const _0x199718=_0x4da714;_0x37d722||(_0x37d722=!0x0,await _0x466bdd[_0x199718(0x12f)]());},async 'release'(){const _0x4abb7d=_0x4da714;_0x37d722||(_0x37d722=!0x0,_0x31ab95||!_0x184c7c[_0x4abb7d(0xdc)]?await _0x466bdd[_0x4abb7d(0x12f)]():await _0x466bdd[_0x4abb7d(0xe2)]());}};async function _0x88fc1e(_0x478051,_0x27b865){const _0x50e146=_0x4da714;_0x2e0426();try{return await _0x2d0325(_0x466bdd[_0x50e146(0xca)],_0x478051,_0x27b865);}catch(_0x2493b2){throw _0x1da63c(_0x2493b2),_0x2493b2;}}function _0x2e0426(){const _0x535155=_0x4da714;if(_0x37d722)throw new i('COLLABORATION_LEASE_CLOSED',_0x535155(0xfc)+_0x466bdd[_0x535155(0xca)]+_0x535155(0x11e));if(_0x23245c)throw _0x23245c;}function _0x1da63c(_0xd73094){const _0x21f15f=_0x4da714;(_0xd73094 instanceof i&&_0xd73094[_0x21f15f(0xd8)]||o(_0xd73094)&&(_0xd73094[_0x21f15f(0x101)]===_0x21f15f(0x116)||_0xd73094[_0x21f15f(0x101)]===_0x21f15f(0x11a)||_0xd73094[_0x21f15f(0x101)]===_0x21f15f(0x12a))||typeof _0xd73094=='object'&&_0xd73094&&_0x21f15f(0xd8)in _0xd73094&&_0xd73094[_0x21f15f(0xd8)]===!0x0)&&(_0x31ab95=!0x0,_0x23245c=_0xd73094,_0x2732b5({'errorCode':F(_0xd73094),'key':_0x466bdd[_0x21f15f(0xca)],'type':'instance-failed'}));}}async function _0x2d0325(_0xefedcc,_0x21388c,_0x39441b){const _0x26b457=_0x15b79b;let _0x86bb3a=Date[_0x26b457(0xe8)](),_0x5a134d=await _0x39441b();return _0x2732b5({'durationMs':Date[_0x26b457(0xe8)]()-_0x86bb3a,'key':_0xefedcc,'operation':_0x21388c,'type':_0x26b457(0x118)}),_0x5a134d;}function _0xc57c6b(_0x2e8309){_0x2732b5(_0x2e8309);}function _0x2732b5(_0x1846ac){const _0x5a0b57=_0x15b79b;try{_0x151351[_0x5a0b57(0x100)]?.(_0x1846ac);}catch{}}}function M(_0x50163f){const _0x36be9e=_0x200859;let _0x195553=_0x50163f instanceof URL?_0x50163f[_0x36be9e(0x102)]:_0x50163f;if(_0x195553[_0x36be9e(0x115)]===0x0)throw new i(_0x36be9e(0xc5),'entry\x20must\x20not\x20be\x20empty');try{return new URL(_0x195553)[_0x36be9e(0x102)];}catch{throw new i(_0x36be9e(0xc5),_0x36be9e(0x12e));}}function N(_0x1a680e,_0x25f89d){const _0x56ff7e=_0x200859;if(!Number[_0x56ff7e(0xee)](_0x1a680e)||_0x1a680e<=0x0)throw new i(_0x56ff7e(0xc5),_0x25f89d+_0x56ff7e(0x113));}function _0x2a9b(){const _0x594bef=['confirmed','value','fetched','every','knownHeadRevision','request','openTimeoutMs','isArray','send','Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20state','export','object','reject','unitId','pull-required','bufferedChangesetCount','7978830oScUWj','entry','Worker\x20returned\x20an\x20invalid\x20mutation\x20replacement\x20result','get','Worker\x20returned\x20an\x20invalid\x20operation\x20status','COLLABORATION_WORKER_CLOSED','read','ipc','Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20metadata','state','add','exitCode','status','INSTANCE_POOL_CLOSED','unknown','./worker-child.ts','961326XKEgJs','exit','units','5584500VgCxjv','stack','COLLABORATION_POOL_INVALID_INPUT','env','4RiodYZ','INSTANCE_POOL_CAPACITY_EXCEEDED','COLLABORATION_WORKER_OPERATION_TIMEOUT','key','nothing-to-commit','transform-failed','all','reason','close','execute-write','Replacement\x20worker\x20for\x20','disconnect','type','isSafeInteger','pendingMutationCount','string','clear','invalidatesInstance','replacePendingMutations','sid','error','available','endsWith','mutationCount','8jHUhjC','open','baseRevision','release','mutations','instance','unitType','Worker\x20returned\x20invalid\x20UnitData','4883235dCEZcg','now','includes','kill','permission-rejected','getState','UniverCollaborationRuntimePoolError','isFinite','Worker\x20closed','COLLABORATION_WORKER_CRASHED','up-to-date','\x20timed\x20out\x20after\x20','Worker\x20exited\x20with\x20','COLLABORATION_POOL_CAPACITY_EXCEEDED','714799OTLgLq','ignore','Worker\x20returned\x20an\x20invalid\x20read\x20value','revision','CollaborationRuntimeError','get-pending-mutations','executeWriteCode','Collaboration\x20runtime\x20lease\x20','pull','execute-read','conflict','onEvent','code','href','operationTimeoutMs','awaitingChangeset','commit','replace-mutations','exited','reqId','mode','executeReadCode','from','SIGKILL','isInteger','unchanged','getPendingMutations','terminate','operation','Worker\x20returned\x20an\x20invalid\x20write\x20result','\x20must\x20be\x20a\x20finite\x20positive\x20number','Worker\x20','length','COLLABORATION_PROTOCOL_ERROR','signalCode','operation-complete','delete','COLLABORATION_CLOSED','resolve','startsWith','message','\x20is\x20closed','COLLABORATION_WORKER_OPEN_TIMEOUT','UNKNOWN','retryable','COLLABORATION_WORKER_PROTOCOL_ERROR','fetch','number','cache','values','timer','result','assign','COLLABORATION_LOAD_FAILED','9091944nEnarl','then','596056KMedAA','entry\x20must\x20be\x20an\x20absolute\x20file\x20URL\x20or\x20another\x20importable\x20URL','invalidate','name','COLLABORATION_POOL_CLOSED'];_0x2a9b=function(){return _0x594bef;};return _0x2a9b();}function P(_0x462499){const _0x4685e7=_0x200859;return _0x462499 instanceof _0x354870?new i(_0x462499[_0x4685e7(0x101)]===_0x4685e7(0xc8)?_0x4685e7(0xf4):_0x462499[_0x4685e7(0x101)]===_0x4685e7(0xbd)?_0x4685e7(0x131):_0x4685e7(0xc5),_0x462499[_0x4685e7(0x11d)],{'cause':_0x462499}):_0x462499;}function F(_0x45f3a8){const _0x5255eb=_0x200859;return typeof _0x45f3a8==_0x5255eb(0x13d)&&_0x45f3a8&&'code'in _0x45f3a8&&typeof _0x45f3a8[_0x5255eb(0x101)]==_0x5255eb(0xd6)?_0x45f3a8['code']:_0x5255eb(0x120);}function I(_0x41b128){return _0x41b128;}export{i as UniverCollaborationRuntimePoolError,j as createUniverCollaborationRuntimePool,I as defineUniverCollaborationRuntimeWorker};
@@ -1 +1 @@
1
- (function(_0x23b808,_0x2e484e){const _0x3ba641=_0x1643,_0x5574a1=_0x23b808();while(!![]){try{const _0x15777c=-parseInt(_0x3ba641(0xc1))/0x1+parseInt(_0x3ba641(0xbb))/0x2+parseInt(_0x3ba641(0xaf))/0x3+parseInt(_0x3ba641(0xa7))/0x4*(parseInt(_0x3ba641(0xa8))/0x5)+-parseInt(_0x3ba641(0xb6))/0x6+parseInt(_0x3ba641(0xb9))/0x7*(parseInt(_0x3ba641(0xba))/0x8)+-parseInt(_0x3ba641(0xa9))/0x9*(parseInt(_0x3ba641(0xc3))/0xa);if(_0x15777c===_0x2e484e)break;else _0x5574a1['push'](_0x5574a1['shift']());}catch(_0xa3b262){_0x5574a1['push'](_0x5574a1['shift']());}}}(_0x48bd,0x1f279));var e;function _0x48bd(){const _0x26275e=['execute-read','execute-write','Collaboration\x20worker\x20is\x20already\x20open','get-pending-mutations','default','object','function','result','send','string','2180OPtfNY','185UccOuw','27873XLkTCC','Collaboration\x20worker\x20entry\x20must\x20default-export\x20a\x20worker\x20definition','isSafeInteger','execute','message','getPendingMutations','265671NoljoX','open','error','commit','type','close','unitId','1018404gxPxxY','exportUnitData','replace-mutations','112JlKQzu','110904wouOYJ','401046IUmBCO','code','replacePendingMutations','connection','createRuntime','boolean','106733ywoHAA','retryable','410WolaBJ','mutations','name','fetch','getState','stack','then','pull','get-state','Error'];_0x48bd=function(){return _0x26275e;};return _0x48bd();}function _0x1643(_0x363e41,_0x3db602){_0x363e41=_0x363e41-0xa6;const _0x48bddc=_0x48bd();let _0x1643a2=_0x48bddc[_0x363e41];return _0x1643a2;}process['on']('message',_0x3dbe0d=>{const _0x5c1d70=_0x1643;a(_0x3dbe0d)&&t(_0x3dbe0d)[_0x5c1d70(0xc9)](_0x62b2d4=>s({'id':_0x3dbe0d['id'],'result':_0x62b2d4,'type':_0x5c1d70(0xd4)}),_0x5427c5=>s({'error':o(_0x5427c5,e?.[_0x5c1d70(0xc7)]()[_0x5c1d70(0xbe)]==='closed'),'id':_0x3dbe0d['id'],'type':_0x5c1d70(0xb1)}));});async function t(_0x4b0793){const _0xc2281d=_0x1643;if(_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xb0)){if(e!==void 0x0)throw Error(_0xc2281d(0xcf));let _0x180663=await import(_0x4b0793.entry);if(!i(_0x180663[_0xc2281d(0xd1)]))throw Error(_0xc2281d(0xaa));return e=await _0x180663[_0xc2281d(0xd1)][_0xc2281d(0xbf)](_0x4b0793['init']),r(e);}if(_0x4b0793['type']===_0xc2281d(0xb4))return await e?.[_0xc2281d(0xb4)](),e=void 0x0,null;let _0x43d964=n();return _0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xcb)?_0x43d964[_0xc2281d(0xc7)]():_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xd0)?_0x43d964[_0xc2281d(0xae)]():_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xcd)?await _0x43d964[_0xc2281d(0xac)]({'code':_0x4b0793[_0xc2281d(0xbc)],'mode':'read'}):_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xce)?await _0x43d964[_0xc2281d(0xac)]({'code':_0x4b0793[_0xc2281d(0xbc)],'mode':'write'}):_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xb8)?await _0x43d964[_0xc2281d(0xbd)](_0x4b0793[_0xc2281d(0xc4)]):_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xc6)?await _0x43d964[_0xc2281d(0xc6)]():_0x4b0793[_0xc2281d(0xb3)]==='pull'?await _0x43d964[_0xc2281d(0xca)]():_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xb2)?await _0x43d964['commit']():await _0x43d964[_0xc2281d(0xb7)]();}function n(){if(!e)throw Error('Collaboration\x20worker\x20is\x20not\x20open');return e;}function r(_0xb000ef){const _0x4e92ef=_0x1643;return{'unitId':_0xb000ef[_0x4e92ef(0xb5)],'unitType':_0xb000ef['unitType']};}function i(_0x4f236b){const _0x4061e2=_0x1643;return typeof _0x4f236b=='object'&&!!_0x4f236b&&'createRuntime'in _0x4f236b&&typeof _0x4f236b[_0x4061e2(0xbf)]==_0x4061e2(0xd3);}function a(_0x17e79e){const _0x25949a=_0x1643;return typeof _0x17e79e==_0x25949a(0xd2)&&!!_0x17e79e&&'id'in _0x17e79e&&Number[_0x25949a(0xab)](_0x17e79e['id'])&&'type'in _0x17e79e&&typeof _0x17e79e['type']=='string';}function o(_0x253efd,_0x2cee23){const _0x37fe79=_0x1643;if(!(_0x253efd instanceof Error))return{'invalidatesInstance':_0x2cee23,'message':String(_0x253efd),'name':_0x37fe79(0xcc)};let _0x1fb9fc=_0x253efd;return{...typeof _0x1fb9fc['code']==_0x37fe79(0xa6)?{'code':_0x1fb9fc['code']}:{},..._0x2cee23?{'invalidatesInstance':!0x0}:{},'message':_0x253efd[_0x37fe79(0xad)],'name':_0x253efd[_0x37fe79(0xc5)],...typeof _0x1fb9fc[_0x37fe79(0xc2)]==_0x37fe79(0xc0)?{'retryable':_0x1fb9fc[_0x37fe79(0xc2)]}:{},..._0x253efd[_0x37fe79(0xc8)]===void 0x0?{}:{'stack':_0x253efd[_0x37fe79(0xc8)]}};}function s(_0x43bc2c){const _0x69bacf=_0x1643;process['connected']&&process[_0x69bacf(0xd5)]?.(_0x43bc2c);}
1
+ function _0x36c2(){const _0xc11370=['6978125EgZnlg','replace-mutations','stack','133880ZBKhNi','runtimeId','execute-write','1094095fTcTWa','get-state','close','get','425028gNCGCN','closed','get-pending-mutations','code','retryable','281DqTysF','getState','1094NBnsCq','pull','createRuntime','write','string','boolean','getPendingMutations','isSafeInteger','init','3caOWEi','exportUnitData','default','1344eqFWsV','5451980RgwqoT','send','delete','20512ICGbJD','6bwttXX','then','read','unitId','function','Collaboration\x20runtime\x20is\x20not\x20open','replacePendingMutations','name','9FsTtWe','error','type','message','object','execute','result'];_0x36c2=function(){return _0xc11370;};return _0x36c2();}const _0x5681c4=_0x5062;(function(_0x261a27,_0x2f6676){const _0x25feda=_0x5062,_0x5ca666=_0x261a27();while(!![]){try{const _0x5d0a08=parseInt(_0x25feda(0x21b))/0x1*(parseInt(_0x25feda(0x21d))/0x2)+parseInt(_0x25feda(0x1f5))/0x3*(parseInt(_0x25feda(0x20f))/0x4)+parseInt(_0x25feda(0x212))/0x5*(-parseInt(_0x25feda(0x1fd))/0x6)+parseInt(_0x25feda(0x1f8))/0x7*(parseInt(_0x25feda(0x1fc))/0x8)+-parseInt(_0x25feda(0x205))/0x9*(-parseInt(_0x25feda(0x1f9))/0xa)+-parseInt(_0x25feda(0x20c))/0xb+-parseInt(_0x25feda(0x216))/0xc;if(_0x5d0a08===_0x2f6676)break;else _0x5ca666['push'](_0x5ca666['shift']());}catch(_0x58919c){_0x5ca666['push'](_0x5ca666['shift']());}}}(_0x36c2,0x520b2));var e=new Map();process['on'](_0x5681c4(0x208),_0x5c547d=>{const _0x32474c=_0x5681c4;i(_0x5c547d)&&t(_0x5c547d)[_0x32474c(0x1fe)](_0x160a32=>o({'id':_0x5c547d['id'],'result':_0x160a32,'type':_0x32474c(0x20b)}),_0x518534=>o({'error':a(_0x518534,e['get'](_0x5c547d[_0x32474c(0x210)])?.[_0x32474c(0x21c)]()['connection']===_0x32474c(0x217)),'id':_0x5c547d['id'],'type':_0x32474c(0x206)}));});async function t(_0x5b46fe){const _0x22617d=_0x5681c4;if(_0x5b46fe[_0x22617d(0x207)]==='open'){let _0x443873=await import(_0x5b46fe.entry);if(!r(_0x443873[_0x22617d(0x1f7)]))throw Error('Collaboration\x20worker\x20entry\x20must\x20default-export\x20a\x20worker\x20definition');let _0x41ede4=await _0x443873[_0x22617d(0x1f7)][_0x22617d(0x21f)](_0x5b46fe[_0x22617d(0x1f4)]);return e['set'](_0x5b46fe['runtimeId'],_0x41ede4),n(_0x41ede4);}let _0x193239=e[_0x22617d(0x215)](_0x5b46fe[_0x22617d(0x210)]);if(_0x5b46fe[_0x22617d(0x207)]===_0x22617d(0x214))return await _0x193239?.[_0x22617d(0x214)](),e[_0x22617d(0x1fb)](_0x5b46fe['runtimeId']),null;if(!_0x193239)throw Error(_0x22617d(0x202));return _0x5b46fe[_0x22617d(0x207)]===_0x22617d(0x213)?_0x193239[_0x22617d(0x21c)]():_0x5b46fe[_0x22617d(0x207)]===_0x22617d(0x218)?_0x193239[_0x22617d(0x223)]():_0x5b46fe[_0x22617d(0x207)]==='execute-read'?await _0x193239[_0x22617d(0x20a)]({'code':_0x5b46fe['code'],'mode':_0x22617d(0x1ff)}):_0x5b46fe[_0x22617d(0x207)]===_0x22617d(0x211)?await _0x193239['execute']({'code':_0x5b46fe['code'],'mode':_0x22617d(0x220)}):_0x5b46fe[_0x22617d(0x207)]===_0x22617d(0x20d)?await _0x193239[_0x22617d(0x203)](_0x5b46fe['mutations']):_0x5b46fe['type']==='fetch'?await _0x193239['fetch']():_0x5b46fe[_0x22617d(0x207)]===_0x22617d(0x21e)?await _0x193239[_0x22617d(0x21e)]():_0x5b46fe[_0x22617d(0x207)]==='commit'?await _0x193239['commit']():await _0x193239[_0x22617d(0x1f6)]();}function n(_0x87b2b2){const _0x50ccb6=_0x5681c4;return{'unitId':_0x87b2b2[_0x50ccb6(0x200)],'unitType':_0x87b2b2['unitType']};}function _0x5062(_0x361262,_0x199210){_0x361262=_0x361262-0x1f4;const _0x36c25a=_0x36c2();let _0x5062d3=_0x36c25a[_0x361262];return _0x5062d3;}function r(_0x2e32b8){const _0x14d843=_0x5681c4;return typeof _0x2e32b8=='object'&&!!_0x2e32b8&&_0x14d843(0x21f)in _0x2e32b8&&typeof _0x2e32b8[_0x14d843(0x21f)]==_0x14d843(0x201);}function i(_0x108e55){const _0x162d4c=_0x5681c4;return typeof _0x108e55==_0x162d4c(0x209)&&!!_0x108e55&&'id'in _0x108e55&&Number['isSafeInteger'](_0x108e55['id'])&&_0x162d4c(0x210)in _0x108e55&&Number[_0x162d4c(0x224)](_0x108e55[_0x162d4c(0x210)])&&'type'in _0x108e55&&typeof _0x108e55['type']==_0x162d4c(0x221);}function a(_0x56d09a,_0x13cca9){const _0x2cea01=_0x5681c4;if(!(_0x56d09a instanceof Error))return{'invalidatesInstance':_0x13cca9,'message':String(_0x56d09a),'name':'Error'};let _0x33d16d=_0x56d09a;return{...typeof _0x33d16d[_0x2cea01(0x219)]==_0x2cea01(0x221)?{'code':_0x33d16d[_0x2cea01(0x219)]}:{},..._0x13cca9?{'invalidatesInstance':!0x0}:{},'message':_0x56d09a[_0x2cea01(0x208)],'name':_0x56d09a[_0x2cea01(0x204)],...typeof _0x33d16d[_0x2cea01(0x21a)]==_0x2cea01(0x222)?{'retryable':_0x33d16d['retryable']}:{},..._0x56d09a[_0x2cea01(0x20e)]===void 0x0?{}:{'stack':_0x56d09a[_0x2cea01(0x20e)]}};}function o(_0x145890){const _0x205d03=_0x5681c4;process['connected']&&process[_0x205d03(0x1fa)]?.(_0x145890);}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@univer-cli/univer-collaboration-runtime-pool",
3
3
  "type": "module",
4
- "version": "1.5.2",
4
+ "version": "1.6.0",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "README.zh-CN.md"
19
19
  ],
20
20
  "dependencies": {
21
- "@univer-cli/generic-keyed-instance-pool": "1.5.2",
22
- "@univer-cli/univer-collaboration-runtime": "1.5.2",
23
- "@univerjs/protocol": "1.5.2"
21
+ "@univer-cli/generic-keyed-instance-pool": "1.6.0",
22
+ "@univer-cli/univer-collaboration-runtime": "1.6.0",
23
+ "@univerjs/protocol": "1.6.0"
24
24
  }
25
25
  }