@univer-cli/univer-collaboration-runtime-pool 1.4.0 → 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 +48 -34
- package/README.zh-CN.md +48 -43
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +1 -1
- package/dist/worker-child.mjs +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
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
|
|
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
|
-
##
|
|
15
|
+
## Define a worker entry
|
|
18
16
|
|
|
19
|
-
|
|
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
|
-
|
|
26
|
-
return
|
|
24
|
+
createRuntime({ unitId }: { unitId: string }) {
|
|
25
|
+
return loadSheetRuntime(unitId);
|
|
27
26
|
},
|
|
28
27
|
});
|
|
29
28
|
```
|
|
30
29
|
|
|
31
|
-
|
|
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
|
-
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
71
|
+
Call `pool.close()` at application shutdown.
|
|
62
72
|
|
|
63
|
-
|
|
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
|
-
|
|
75
|
+
## Edit and save
|
|
66
76
|
|
|
67
|
-
|
|
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
|
-
##
|
|
79
|
+
## Capacity and process isolation
|
|
70
80
|
|
|
71
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
13
|
+
要求 Node.js 22.12 或更高版本。应用负责提供 backend、凭证和 Univer factory,pool 负责在 worker 中创建、复用和释放 runtime。
|
|
18
14
|
|
|
19
|
-
##
|
|
15
|
+
## 准备 worker 入口
|
|
20
16
|
|
|
21
|
-
|
|
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
|
-
|
|
28
|
-
return
|
|
24
|
+
createRuntime({ unitId }: { unitId: string }) {
|
|
25
|
+
return loadSheetRuntime(unitId);
|
|
29
26
|
},
|
|
30
27
|
});
|
|
31
28
|
```
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
## 在多次工具调用之间复用 runtime
|
|
31
|
+
|
|
32
|
+
应用可以为多个工具调用共用一个 pool。每次调用按 key 获取 lease,完成后归还。后续调用使用同一个 key 时,只要 runtime 仍在缓存中,就可以继续操作已加载的 Unit。
|
|
35
33
|
|
|
36
|
-
|
|
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
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
71
|
+
应用退出时调用 `pool.close()`。
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
示例假设工作簿 ID 在应用的数据源中唯一。如果应用可以访问多个服务或同一文档的多个 worktree,请将这些信息也纳入 `key`。相同 key 的请求按顺序取得 lease。只有创建或重新加载 runtime 时才会使用 `init`,其内容须支持 structured clone。
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
eviction 中断。Invalidate 表示 worker/runtime 已不可信,会在 release 时销毁。Invalidate、TTL 与 LRU eviction 会在
|
|
70
|
-
worker 销毁开始前同步发出 `destroy-start`;与该 generation 绑定的状态应在此清理,不要等待随后发出的 `evicted`。
|
|
71
|
-
Pool event 可用于日志和 metrics。
|
|
75
|
+
## 编辑与保存
|
|
72
76
|
|
|
73
|
-
|
|
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
|
-
##
|
|
79
|
+
## 容量与进程隔离
|
|
77
80
|
|
|
78
|
-
|
|
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
|
-
|
|
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
|
-
/**
|
|
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 _0x5f4dee=_0x45d8;(function(_0xcd757f,_0x3249ca){const _0x57ad3e=_0x45d8,_0x440325=_0xcd757f();while(!![]){try{const _0x5d50aa=parseInt(_0x57ad3e(0x184))/0x1*(-parseInt(_0x57ad3e(0x1ba))/0x2)+parseInt(_0x57ad3e(0x169))/0x3*(parseInt(_0x57ad3e(0x194))/0x4)+-parseInt(_0x57ad3e(0x1d9))/0x5*(parseInt(_0x57ad3e(0x177))/0x6)+parseInt(_0x57ad3e(0x1be))/0x7*(-parseInt(_0x57ad3e(0x1d6))/0x8)+parseInt(_0x57ad3e(0x1ce))/0x9+parseInt(_0x57ad3e(0x1c4))/0xa+parseInt(_0x57ad3e(0x18b))/0xb;if(_0x5d50aa===_0x3249ca)break;else _0x440325['push'](_0x440325['shift']());}catch(_0x31e817){_0x440325['push'](_0x440325['shift']());}}}(_0x4e57,0xc00f3));import{InstancePoolError as _0x3dac63,createGenericKeyedInstancePool as _0x5c4d3}from'@univer-cli/generic-keyed-instance-pool';import{fork as _0x53282c}from'node:child_process';import{dirname as _0x5628a7,extname as _0x12c634,join as _0x1e69f6}from'node:path';import{fileURLToPath as _0x31dc22}from'node:url';var s=class extends Error{[_0x5f4dee(0x181)];[_0x5f4dee(0x168)];constructor(_0xceb83c,_0x11477f,_0x4d541c={}){const _0x1e394e=_0x5f4dee;super(_0x11477f,_0x4d541c),this['name']=_0x1e394e(0x15a),this[_0x1e394e(0x181)]=_0xceb83c,this['invalidatesInstance']=_0x4d541c[_0x1e394e(0x168)]??!0x1;}},c=_0x5f4dee(0x163);function l(_0x5b46a2){const _0x137906=_0x5f4dee;return _0x5b46a2 instanceof Error&&_0x5b46a2['name']==='CollaborationRuntimeError'&&_0x137906(0x181)in _0x5b46a2&&typeof _0x5b46a2['code']==_0x137906(0x16c);}async function u(_0x4540eb){const _0x24799b=_0x5f4dee;let _0x6350a9=_0x31dc22(import.meta.url),_0x5a9a6a=_0x5628a7(_0x6350a9),_0x56a707=_0x1e69f6(_0x5a9a6a,_0x12c634(_0x6350a9)===_0x24799b(0x156)?_0x24799b(0x19e):_0x24799b(0x182)),_0x14d8b6=d(_0x53282c(_0x56a707,[],{..._0x4540eb[_0x24799b(0x1db)]===void 0x0?{}:{'env':_0x4540eb[_0x24799b(0x1db)]},'serialization':'advanced','stdio':[_0x24799b(0x1da),_0x24799b(0x1da),'ignore',_0x24799b(0x192)]}),_0x4540eb[_0x24799b(0x17f)]);try{let _0x2954b0=f(await _0x14d8b6[_0x24799b(0x191)]({'entry':_0x4540eb[_0x24799b(0x1b9)],'id':_0x14d8b6[_0x24799b(0x1bb)](),'init':_0x4540eb[_0x24799b(0x1d8)],'type':_0x24799b(0x17c)},_0x4540eb[_0x24799b(0x16a)],_0x24799b(0x18a))),_0x5a2020,_0x5339a5=async _0x1fb187=>await _0x14d8b6['request']({..._0x1fb187,'id':_0x14d8b6[_0x24799b(0x1bb)]()},_0x4540eb[_0x24799b(0x17b)]);return{..._0x2954b0,async 'close'(){_0x5a2020??=_0x14d8b6['close'](),await _0x5a2020;},async 'getState'(){const _0x1f0852=_0x24799b;return p(await _0x5339a5({'type':_0x1f0852(0x19d)}));},async 'getPendingMutations'(){const _0x35cea5=_0x24799b;let _0x428181=await _0x5339a5({'type':'get-pending-mutations'});if(!w(_0x428181))throw v(_0x35cea5(0x1a9));return _0x428181;},async 'executeReadCode'(_0x84d06a){const _0x557a2b=_0x24799b;let _0x385acf=m(await _0x5339a5({'code':_0x84d06a,'type':_0x557a2b(0x1a5)}));if(!(_0x557a2b(0x1d5)in _0x385acf)||!T(_0x385acf['value']))throw v(_0x557a2b(0x165));return _0x385acf;},async 'executeWriteCode'(_0xa52246){const _0x1d838f=_0x24799b;let _0x3c8a47=m(await _0x5339a5({'code':_0xa52246,'type':_0x1d838f(0x158)}));if(!T(_0x3c8a47['value'])||!w(_0x3c8a47[_0x1d838f(0x1e2)]))throw v(_0x1d838f(0x1dd));return _0x3c8a47;},async 'replacePendingMutations'(_0x4031fc){const _0x32af21=_0x24799b;let _0x1f0823=m(await _0x5339a5({'mutations':_0x4031fc,'type':_0x32af21(0x18e)}));if(!E(_0x1f0823['previousMutationCount'])||!E(_0x1f0823[_0x32af21(0x1d0)]))throw v(_0x32af21(0x1e9));return _0x1f0823;},async 'fetch'(){const _0x510dab=_0x24799b;return h(await _0x5339a5({'type':_0x510dab(0x16e)}),[_0x510dab(0x167),_0x510dab(0x1cf)]);},async 'pull'(){const _0x57871e=_0x24799b;return h(await _0x5339a5({'type':_0x57871e(0x1c3)}),[_0x57871e(0x1d7),_0x57871e(0x1b5),'conflict']);},async 'commit'(){const _0x34accb=_0x24799b;return h(await _0x5339a5({'type':'commit'}),[_0x34accb(0x1c1),_0x34accb(0x171),_0x34accb(0x1ea),_0x34accb(0x1dc),_0x34accb(0x185),'conflict']);},async 'exportUnitData'(){const _0xe03232=_0x24799b;let _0x37ebdc=await _0x5339a5({'type':_0xe03232(0x1e5)});if(!D(_0x37ebdc))throw v(_0xe03232(0x1cb));return _0x37ebdc;}};}catch(_0x21e089){throw await _0x14d8b6['close'](),_0x21e089;}}function d(_0x5cc439,_0x318e8d){const _0x4abca2=_0x5f4dee;let _0x5e6f5e=new Map(),_0x3f47fe=0x0,_0x41696f,_0x5a67a4=!0x1,_0x8afaf9,_0x40a028,_0x3d6bb3=new Promise(_0x423c0b=>{_0x40a028=_0x423c0b;});return _0x5cc439['on'](_0x4abca2(0x1a3),_0x246fb3=>{const _0x59ed32=_0x4abca2;if(!y(_0x246fb3))return;let _0x51df6c=_0x5e6f5e[_0x59ed32(0x162)](_0x246fb3['id']);_0x51df6c&&(_0x5e6f5e[_0x59ed32(0x17a)](_0x246fb3['id']),_0x51df6c[_0x59ed32(0x1ae)]&&clearTimeout(_0x51df6c[_0x59ed32(0x1ae)]),_0x246fb3[_0x59ed32(0x1b7)]===_0x59ed32(0x179)?_0x51df6c[_0x59ed32(0x176)](g(_0x246fb3['error'])):_0x51df6c[_0x59ed32(0x1ca)](_0x246fb3[_0x59ed32(0x175)]));}),_0x5cc439['on']('error',_0x29ff24=>_0x58dd50(_(_0x4abca2(0x18f)+_0x318e8d+_0x4abca2(0x1c9)+_0x29ff24[_0x4abca2(0x1a3)],_0x29ff24))),_0x5cc439['on']('exit',(_0x2197e7,_0x2346ec)=>{const _0x5da1f1=_0x4abca2;_0x5a67a4||_0x58dd50(_('Worker\x20'+_0x318e8d+_0x5da1f1(0x18d)+(_0x2346ec?'signal\x20'+_0x2346ec:_0x5da1f1(0x161)+String(_0x2197e7))));}),_0x5cc439['on'](_0x4abca2(0x1c0),()=>_0x40a028()),{async 'close'(){if(_0x8afaf9)return await _0x8afaf9;_0x8afaf9=_0x1e3cc2(),await _0x8afaf9;},'nextId'(){return++_0x3f47fe;},async 'request'(_0x460e5b,_0x3de8d0,_0x27f847=_0x4abca2(0x1de)){if(_0x41696f)throw _0x41696f;return await new Promise((_0x5cb9c7,_0x3d1090)=>{const _0x492c4a=_0x45d8;let _0x7109ee={'reject':_0x3d1090,'resolve':_0x5cb9c7,'timer':setTimeout(()=>{const _0x42d3eb=_0x45d8;_0x58dd50(new s(_0x27f847,'Collaboration\x20worker\x20'+_0x318e8d+_0x42d3eb(0x1bd)+_0x3de8d0+'ms',{'invalidatesInstance':!0x0})),_0x501e97();},_0x3de8d0)};_0x5e6f5e[_0x492c4a(0x1e6)](_0x460e5b['id'],_0x7109ee),_0x5cc439['send'](_0x460e5b,_0xc2a5a3=>{const _0x5abd2c=_0x492c4a;_0xc2a5a3&&_0x58dd50(_(_0x5abd2c(0x1b6)+_0x318e8d,_0xc2a5a3));});});}};async function _0x1e3cc2(){const _0x327915=_0x4abca2;if(_0x5a67a4=!0x0,!_0x41696f&&_0x5cc439[_0x327915(0x1bc)])try{await Promise[_0x327915(0x19c)]([new Promise((_0x3311ec,_0x5d345b)=>{const _0x1577cd=_0x327915;let _0x171b3d=++_0x3f47fe;_0x5e6f5e[_0x1577cd(0x1e6)](_0x171b3d,{'reject':_0x5d345b,'resolve':_0x3311ec}),_0x5cc439[_0x1577cd(0x15b)]({'id':_0x171b3d,'type':_0x1577cd(0x1c0)},_0x515e0f=>{_0x515e0f&&_0x5d345b(_0x515e0f);});}),new Promise((_0x5a480f,_0x369394)=>{const _0x98c603=_0x327915;setTimeout(()=>_0x369394(Error(_0x98c603(0x1e3))),0x1388)[_0x98c603(0x1d3)]();})]);}catch{}_0x501e97(),await _0x3d6bb3,_0x58dd50(new s(_0x327915(0x198),_0x327915(0x16d)+_0x318e8d+_0x327915(0x183),{'invalidatesInstance':!0x0}));}function _0x58dd50(_0x4dfe1c){const _0x5e6a5d=_0x4abca2;_0x41696f??=_0x4dfe1c;for(let _0x1d3c14 of _0x5e6f5e[_0x5e6a5d(0x1ad)]())_0x1d3c14[_0x5e6a5d(0x1ae)]&&clearTimeout(_0x1d3c14[_0x5e6a5d(0x1ae)]),_0x1d3c14[_0x5e6a5d(0x176)](_0x41696f);_0x5e6f5e[_0x5e6a5d(0x1c2)]();}function _0x501e97(){const _0x29c560=_0x4abca2;_0x5cc439[_0x29c560(0x195)]===null&&_0x5cc439['signalCode']===null&&_0x5cc439[_0x29c560(0x17e)]('SIGKILL');}}function f(_0x5a1c24){const _0x3c85c4=_0x5f4dee;if(!D(_0x5a1c24)||typeof _0x5a1c24[_0x3c85c4(0x199)]!=_0x3c85c4(0x16c)||!b(_0x5a1c24[_0x3c85c4(0x1af)]))throw v(_0x3c85c4(0x1ac));return{'unitId':_0x5a1c24['unitId'],'unitType':_0x5a1c24[_0x3c85c4(0x1af)]};}function p(_0x31fcb2){const _0x577a43=_0x5f4dee;if(!D(_0x31fcb2)||!x(_0x31fcb2[_0x577a43(0x1c8)])||!E(_0x31fcb2[_0x577a43(0x1ab)])||!E(_0x31fcb2['knownHeadRevision'])||Number(_0x31fcb2[_0x577a43(0x1b4)])<Number(_0x31fcb2['baseRevision'])||!E(_0x31fcb2[_0x577a43(0x1d0)])||!E(_0x31fcb2[_0x577a43(0x1c7)])||!S(_0x31fcb2[_0x577a43(0x172)])||!C(_0x31fcb2[_0x577a43(0x155)]))throw v(_0x577a43(0x160));return _0x31fcb2;}function m(_0x53df26){const _0x52016f=_0x5f4dee;if(!D(_0x53df26))throw v(_0x52016f(0x1a7));return{..._0x53df26,'state':p(_0x53df26['state'])};}function h(_0x3f9e58,_0x57e219){const _0x1809a7=_0x5f4dee;let _0x13dc7b=m(_0x3f9e58);if(typeof _0x13dc7b[_0x1809a7(0x1e1)]!=_0x1809a7(0x16c)||!_0x57e219['includes'](_0x13dc7b['status']))throw v(_0x1809a7(0x1e4));return _0x13dc7b;}function g(_0x216f86){const _0x2dc6e8=_0x5f4dee;let _0x37388f=Error(_0x216f86[_0x2dc6e8(0x1a3)]);return _0x216f86[_0x2dc6e8(0x181)]?.[_0x2dc6e8(0x1c6)](_0x2dc6e8(0x174))&&!_0x216f86[_0x2dc6e8(0x181)][_0x2dc6e8(0x1c6)](_0x2dc6e8(0x1a4))?(_0x37388f[_0x2dc6e8(0x1cd)]=c,Object[_0x2dc6e8(0x188)](_0x37388f,{'code':_0x216f86['code'],'retryable':_0x216f86[_0x2dc6e8(0x1e7)]??!0x1})):(_0x37388f[_0x2dc6e8(0x1cd)]=_0x216f86[_0x2dc6e8(0x1cd)],_0x216f86[_0x2dc6e8(0x181)]!==void 0x0&&Object[_0x2dc6e8(0x188)](_0x37388f,{'code':_0x216f86[_0x2dc6e8(0x181)]})),_0x216f86[_0x2dc6e8(0x168)]&&Object['assign'](_0x37388f,{'invalidatesInstance':!0x0}),_0x216f86['stack']!==void 0x0&&(_0x37388f[_0x2dc6e8(0x16f)]=_0x216f86[_0x2dc6e8(0x16f)]),_0x37388f;}function _(_0x478039,_0x15bac3){return new s('COLLABORATION_WORKER_CRASHED',_0x478039,{..._0x15bac3===void 0x0?{}:{'cause':_0x15bac3},'invalidatesInstance':!0x0});}function v(_0x34842d){return new s('COLLABORATION_WORKER_PROTOCOL_ERROR',_0x34842d,{'invalidatesInstance':!0x0});}function y(_0x2e6cce){const _0xdf3a49=_0x5f4dee;return D(_0x2e6cce)&&Number[_0xdf3a49(0x157)](_0x2e6cce['id'])&&(_0x2e6cce[_0xdf3a49(0x1b7)]===_0xdf3a49(0x175)||_0x2e6cce[_0xdf3a49(0x1b7)]===_0xdf3a49(0x179));}function b(_0x1f5d16){return _0x1f5d16===0x1||_0x1f5d16===0x2||_0x1f5d16===0x3||_0x1f5d16===0x5||_0x1f5d16===0x6||_0x1f5d16===0x7;}function x(_0x3f2c6d){const _0x21c8b9=_0x5f4dee;return _0x3f2c6d===_0x21c8b9(0x15d)||_0x3f2c6d===_0x21c8b9(0x1a1)||_0x3f2c6d===_0x21c8b9(0x1cc)||_0x3f2c6d===_0x21c8b9(0x186);}function S(_0x4c2b88){const _0x54d659=_0x5f4dee;return _0x4c2b88===null||D(_0x4c2b88)&&E(_0x4c2b88['baseRevision'])&&E(_0x4c2b88['revision'])&&E(_0x4c2b88[_0x54d659(0x16b)])&&(_0x4c2b88[_0x54d659(0x1a8)]===void 0x0||typeof _0x4c2b88[_0x54d659(0x1a8)]==_0x54d659(0x16c))&&(_0x4c2b88[_0x54d659(0x1a2)]===void 0x0||E(_0x4c2b88[_0x54d659(0x1a2)]));}function C(_0x3c7c52){const _0x4486ac=_0x5f4dee;return _0x3c7c52===null||D(_0x3c7c52)&&(_0x3c7c52[_0x4486ac(0x190)]===_0x4486ac(0x1c3)||_0x3c7c52[_0x4486ac(0x190)]===_0x4486ac(0x1b2))&&(_0x3c7c52[_0x4486ac(0x196)]==='transform-failed'||_0x3c7c52[_0x4486ac(0x196)]===_0x4486ac(0x1a6)||_0x3c7c52['reason']===_0x4486ac(0x159))&&typeof _0x3c7c52[_0x4486ac(0x1a3)]=='string'&&(_0x3c7c52[_0x4486ac(0x181)]===void 0x0||Number[_0x4486ac(0x1c5)](_0x3c7c52['code']));}function w(_0x18697c){const _0x1ca93e=_0x5f4dee;return Array[_0x1ca93e(0x193)](_0x18697c)&&_0x18697c[_0x1ca93e(0x1d4)](_0xdd2c64=>D(_0xdd2c64)&&typeof _0xdd2c64['id']=='string'&&_0xdd2c64['id']['length']>0x0&&typeof _0xdd2c64['data']==_0x1ca93e(0x16c));}function T(_0x1bdb45){const _0x2d5fcb=_0x5f4dee;return _0x1bdb45===null||typeof _0x1bdb45=='boolean'||typeof _0x1bdb45==_0x2d5fcb(0x16c)||typeof _0x1bdb45==_0x2d5fcb(0x187)&&Number[_0x2d5fcb(0x15e)](_0x1bdb45)?!0x0:Array['isArray'](_0x1bdb45)?_0x1bdb45[_0x2d5fcb(0x1d4)](T):D(_0x1bdb45)&&Object['values'](_0x1bdb45)[_0x2d5fcb(0x1d4)](T);}function E(_0x30fd63){const _0x3e6bf3=_0x5f4dee;return Number[_0x3e6bf3(0x157)](_0x30fd63)&&Number(_0x30fd63)>=0x0;}function _0x45d8(_0x5340c7,_0x29ebc7){_0x5340c7=_0x5340c7-0x155;const _0x4e574f=_0x4e57();let _0x45d814=_0x4e574f[_0x5340c7];return _0x45d814;}function D(_0x2e4be0){return typeof _0x2e4be0=='object'&&!!_0x2e4be0&&!Array['isArray'](_0x2e4be0);}var O=0x7530,k=0x7530;function _0x4e57(){const _0x1fdb6e=['Worker\x20returned\x20an\x20invalid\x20operation\x20result','sid','Worker\x20returned\x20invalid\x20pending\x20mutations','href','baseRevision','Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20metadata','values','timer','unitType','\x20must\x20be\x20a\x20finite\x20positive\x20number','instance-failed','commit','state','knownHeadRevision','pulled','Failed\x20to\x20send\x20a\x20request\x20to\x20worker\x20','type','COLLABORATION_POOL_CLOSED','entry','198shyPIq','nextId','connected','\x20timed\x20out\x20after\x20','9863OKGuTO','length','close','nothing-to-commit','clear','pull','15559010DBInqH','isInteger','startsWith','bufferedChangesetCount','connection','\x20failed:\x20','resolve','Worker\x20returned\x20invalid\x20UnitData','offline','name','6345990ycKVUv','fetched','pendingMutationCount','INSTANCE_POOL_CLOSED','instance','unref','every','value','152mNmFTz','up-to-date','init','6799010aDupCY','ignore','env','retry','Worker\x20returned\x20an\x20invalid\x20write\x20result','COLLABORATION_WORKER_OPERATION_TIMEOUT','COLLABORATION_LEASE_CLOSED','pending-mutations','status','mutations','Worker\x20close\x20timed\x20out','Worker\x20returned\x20an\x20invalid\x20operation\x20status','export','set','retryable','getPendingMutations','Worker\x20returned\x20an\x20invalid\x20mutation\x20replacement\x20result','confirmed','conflict','.ts','isSafeInteger','execute-write','permission-rejected','UniverCollaborationRuntimePoolError','send','now','online','isFinite','COLLABORATION_PROTOCOL_ERROR','Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20state','exit\x20code\x20','get','CollaborationRuntimeError','onEvent','Worker\x20returned\x20an\x20invalid\x20read\x20value','entry\x20must\x20be\x20an\x20absolute\x20file\x20URL\x20or\x20another\x20importable\x20URL','unchanged','invalidatesInstance','1122MqeDnj','openTimeoutMs','mutationCount','string','Collaboration\x20worker\x20','fetch','stack','COLLABORATION_POOL_INVALID_INPUT','pull-required','awaitingChangeset','invalidate','COLLABORATION_','result','reject','6DVmrWV','read','error','delete','operationTimeoutMs','open','replacePendingMutations','kill','key','object','code','worker-child.mjs','\x20is\x20closed','7796KAjfkp','unknown','closed','number','assign','getState','COLLABORATION_WORKER_OPEN_TIMEOUT','1949981UjMLPn','COLLABORATION_CLOSED','\x20exited\x20unexpectedly\x20with\x20','replace-mutations','Worker\x20','operation','request','ipc','isArray','5420rcoeJX','exitCode','reason','COLLABORATION_LOAD_FAILED','COLLABORATION_WORKER_CLOSED','unitId','operation-complete','entry\x20must\x20not\x20be\x20empty','race','get-state','worker-child.ts','cache','mode','reconnecting','reqId','message','COLLABORATION_WORKER_','execute-read','changeset-rejected'];_0x4e57=function(){return _0x1fdb6e;};return _0x4e57();}function A(_0xb69d21){const _0x133b1a=_0x5f4dee;let _0x5b0730=j(_0xb69d21['entry']),_0x5326d9=_0xb69d21[_0x133b1a(0x16a)]??O,_0x2d098e=_0xb69d21['operationTimeoutMs']??k;M(_0x5326d9,_0x133b1a(0x16a)),M(_0x2d098e,'operationTimeoutMs');let _0x1f9ede;try{_0x1f9ede=_0x5c4d3({'factory':{async 'create'(_0x4d4297){const _0x1614e8=_0x133b1a;return await u({'entry':_0x5b0730,..._0xb69d21[_0x1614e8(0x1db)]===void 0x0?{}:{'env':_0xb69d21[_0x1614e8(0x1db)]},'init':_0x4d4297[_0x1614e8(0x1d8)],'key':_0x4d4297['key'],'openTimeoutMs':_0x5326d9,'operationTimeoutMs':_0x2d098e});},async 'destroy'({instance:_0x4984a6}){const _0xb64a99=_0x133b1a;await _0x4984a6[_0xb64a99(0x1c0)]();}},..._0xb69d21[_0x133b1a(0x19f)]===void 0x0?{}:{'cache':_0xb69d21['cache']},'onEvent':_0x444cdc});}catch(_0x1bd6ce){throw N(_0x1bd6ce);}return{async 'acquire'(_0x10c7dd){let _0x593624;try{_0x593624=await _0x1f9ede['acquire'](_0x10c7dd);}catch(_0xc6faf){throw N(_0xc6faf);}return _0x380768(_0x593624);},async 'close'(){const _0x1e8750=_0x133b1a;try{await _0x1f9ede[_0x1e8750(0x1c0)]();}catch(_0x585941){throw N(_0x585941);}}};function _0x380768(_0x2917a7){const _0x837a1c=_0x133b1a;let _0x11b214=_0x2917a7[_0x837a1c(0x1d2)],_0x467ea1=!0x1,_0x47030e,_0x388d0c=!0x1;return{'key':_0x2917a7[_0x837a1c(0x17f)],'unitId':_0x11b214[_0x837a1c(0x199)],'unitType':_0x11b214[_0x837a1c(0x1af)],async 'getState'(){const _0x4f68e5=_0x837a1c;return await _0xf725db(_0x4f68e5(0x1b3),async()=>await _0x11b214[_0x4f68e5(0x189)]());},async 'getPendingMutations'(){const _0x5f0edf=_0x837a1c;return await _0xf725db(_0x5f0edf(0x1e0),async()=>await _0x11b214[_0x5f0edf(0x1e8)]());},async 'execute'(_0x5b734a){const _0x1709bb=_0x837a1c;return _0x5b734a[_0x1709bb(0x1a0)]===_0x1709bb(0x178)?await _0xf725db(_0x1709bb(0x178),async()=>await _0x11b214['executeReadCode'](_0x5b734a[_0x1709bb(0x181)])):await _0xf725db('write',async()=>await _0x11b214['executeWriteCode'](_0x5b734a[_0x1709bb(0x181)]));},async 'replacePendingMutations'(_0x2722de){const _0x3a367e=_0x837a1c;return await _0xf725db(_0x3a367e(0x18e),async()=>await _0x11b214[_0x3a367e(0x17d)](_0x2722de));},async 'fetch'(){const _0xaa8c30=_0x837a1c;return await _0xf725db('fetch',async()=>await _0x11b214[_0xaa8c30(0x16e)]());},async 'pull'(){const _0x3f60d6=_0x837a1c;return await _0xf725db('pull',async()=>await _0x11b214[_0x3f60d6(0x1c3)]());},async 'commit'(){const _0x640b9=_0x837a1c;return await _0xf725db(_0x640b9(0x1b2),async()=>await _0x11b214['commit']());},async 'exportUnitData'(){const _0x1fe6fc=_0x837a1c;return await _0xf725db(_0x1fe6fc(0x1e5),async()=>await _0x11b214['exportUnitData']());},async 'invalidate'(){const _0x2549ef=_0x837a1c;_0x467ea1||(_0x467ea1=!0x0,await _0x2917a7[_0x2549ef(0x173)]());},async 'release'(){const _0x5dcead=_0x837a1c;_0x467ea1||(_0x467ea1=!0x0,_0x388d0c?await _0x2917a7[_0x5dcead(0x173)]():await _0x2917a7['release']());}};async function _0xf725db(_0x437ec9,_0x59b1ba){const _0x321406=_0x837a1c;_0x3706f1();try{return await _0x44556e(_0x2917a7[_0x321406(0x17f)],_0x437ec9,_0x59b1ba);}catch(_0x10e5c3){throw _0x17e1bf(_0x10e5c3),_0x10e5c3;}}function _0x3706f1(){const _0x56d4e8=_0x837a1c;if(_0x467ea1)throw new s(_0x56d4e8(0x1df),'Collaboration\x20runtime\x20lease\x20'+_0x2917a7['key']+_0x56d4e8(0x183));if(_0x47030e)throw _0x47030e;}function _0x17e1bf(_0x3f9cba){const _0x3fcbd0=_0x837a1c;(_0x3f9cba instanceof s&&_0x3f9cba[_0x3fcbd0(0x168)]||l(_0x3f9cba)&&(_0x3f9cba['code']===_0x3fcbd0(0x15f)||_0x3f9cba[_0x3fcbd0(0x181)]===_0x3fcbd0(0x18c)||_0x3f9cba['code']===_0x3fcbd0(0x197))||typeof _0x3f9cba=='object'&&_0x3f9cba&&'invalidatesInstance'in _0x3f9cba&&_0x3f9cba[_0x3fcbd0(0x168)]===!0x0)&&(_0x388d0c=!0x0,_0x47030e=_0x3f9cba,_0xbb4e30({'errorCode':P(_0x3f9cba),'key':_0x2917a7[_0x3fcbd0(0x17f)],'type':_0x3fcbd0(0x1b1)}));}}async function _0x44556e(_0x23366b,_0x19eaa0,_0x276e4c){const _0xd35ee0=_0x133b1a;let _0x4a6866=Date[_0xd35ee0(0x15c)](),_0x586cc9=await _0x276e4c();return _0xbb4e30({'durationMs':Date[_0xd35ee0(0x15c)]()-_0x4a6866,'key':_0x23366b,'operation':_0x19eaa0,'type':_0xd35ee0(0x19a)}),_0x586cc9;}function _0x444cdc(_0x3dab2d){_0xbb4e30(_0x3dab2d);}function _0xbb4e30(_0x8da220){const _0x44594b=_0x133b1a;try{_0xb69d21[_0x44594b(0x164)]?.(_0x8da220);}catch{}}}function j(_0x3ba067){const _0x1e2edc=_0x5f4dee;let _0x56c8f6=_0x3ba067 instanceof URL?_0x3ba067[_0x1e2edc(0x1aa)]:_0x3ba067;if(_0x56c8f6[_0x1e2edc(0x1bf)]===0x0)throw new s(_0x1e2edc(0x170),_0x1e2edc(0x19b));try{return new URL(_0x56c8f6)[_0x1e2edc(0x1aa)];}catch{throw new s(_0x1e2edc(0x170),_0x1e2edc(0x166));}}function M(_0x1dea3a,_0x33e4e9){const _0x1de778=_0x5f4dee;if(!Number[_0x1de778(0x15e)](_0x1dea3a)||_0x1dea3a<=0x0)throw new s(_0x1de778(0x170),_0x33e4e9+_0x1de778(0x1b0));}function N(_0x2dfa6a){const _0x43acf0=_0x5f4dee;return _0x2dfa6a instanceof _0x3dac63?new s(_0x2dfa6a[_0x43acf0(0x181)]==='INSTANCE_POOL_CAPACITY_EXCEEDED'?'COLLABORATION_POOL_CAPACITY_EXCEEDED':_0x2dfa6a[_0x43acf0(0x181)]===_0x43acf0(0x1d1)?_0x43acf0(0x1b8):_0x43acf0(0x170),_0x2dfa6a[_0x43acf0(0x1a3)],{'cause':_0x2dfa6a}):_0x2dfa6a;}function P(_0x5e35e6){const _0x2c5ea3=_0x5f4dee;return typeof _0x5e35e6==_0x2c5ea3(0x180)&&_0x5e35e6&&_0x2c5ea3(0x181)in _0x5e35e6&&typeof _0x5e35e6['code']==_0x2c5ea3(0x16c)?_0x5e35e6[_0x2c5ea3(0x181)]:'UNKNOWN';}function F(_0x1e4e10){return _0x1e4e10;}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};
|
package/dist/worker-child.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
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.
|
|
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.
|
|
22
|
-
"@univer-cli/univer-collaboration-runtime": "1.
|
|
23
|
-
"@univerjs/protocol": "1.
|
|
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
|
}
|