@tangle-network/sandbox 0.9.1 → 0.9.3
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/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1026 -1
- package/dist/auth/index.js +273 -1
- package/dist/client-BBZ7YLmq.js +2193 -0
- package/dist/{client-DPVYHFLS.d.ts → client-D3FqPlde.d.ts} +11 -2
- package/dist/collaboration/index.js +2 -1
- package/dist/collaboration-BxlfZ2Uh.js +201 -1
- package/dist/core.d.ts +2 -2
- package/dist/core.js +4 -1
- package/dist/errors-DZsfJUuc.js +262 -1
- package/dist/{index-Bm9jAzE2.d.ts → index-Dy1fHLYz.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1180 -1
- package/dist/intelligence/index.js +225 -1
- package/dist/openai/index.js +1760 -1
- package/dist/{sandbox-jfc8yiwF.d.ts → sandbox-B55j2q9K.d.ts} +3 -1
- package/dist/sandbox-joKtQ5y3.js +4457 -0
- package/dist/session-gateway/index.js +667 -1
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +2 -1
- package/dist/tangle-DM0o66lW.js +831 -0
- package/package.json +4 -4
- package/dist/client-BZn0szu8.js +0 -1
- package/dist/sandbox-CfuxtBeD.js +0 -1
- package/dist/tangle-DbX32r-5.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as CreateRequestOptions, $n as SandboxFleetToken, B as BatchResult, Bn as SandboxFleetDispatchResponse, Cn as PublishPublicTemplateOptions, Ct as FleetDispatchResultBufferOptions, Dn as ReconcileSandboxFleetsOptions, Dt as FleetMachineId, En as ReapExpiredSandboxFleetsResult, Et as FleetExecDispatchResult, Ht as IntelligenceReport, In as SandboxFleetArtifact, Kr as TokenRefreshHandler, Kt as IntelligenceReportWindow, Ln as SandboxFleetArtifactSpec, Mn as SandboxClientConfig, On as ReconcileSandboxFleetsResult, Ot as FleetPromptDispatchOptions, Pn as SandboxEnvironment, Pr as SshKeysManager, Q as CreateIntelligenceReportOptions, Qr as UsageInfo, R as BatchEvent, Rn as SandboxFleetCostEstimate, Rr as SubscriptionInfo, Sn as PublicTemplateVersionInfo, St as FleetDispatchResultBuffer, Tn as ReapExpiredSandboxFleetsOptions, Tr as SecretsManager, Tt as FleetExecDispatchOptions, Un as SandboxFleetInfo, Ut as IntelligenceReportBudget, V as BatchTask, Vn as SandboxFleetDriverCapability, Wt as IntelligenceReportCompareTo, Xt as ListSandboxOptions, Yn as SandboxFleetManifest, Yt as ListSandboxFleetOptions, Zn as SandboxFleetOperationsSummary, _t as ExecOptions, a as TraceExportSink, cr as SandboxFleetWorkspaceSnapshotResult, er as SandboxFleetTraceBundle, et as CreateSandboxFleetOptions, gn as PromptResult, hn as PromptOptions, i as TraceExportResult, ir as SandboxFleetUsage, j as AttachSandboxFleetMachineOptions, kt as FleetPromptDispatchResult, lr as SandboxInfo, mn as PromptInputPart, n as SandboxInstance, nt as CreateSandboxFleetWithCoordinatorOptions, or as SandboxFleetWorkspaceReconcileResult, qn as SandboxFleetMachineRecord, rr as SandboxFleetTraceOptions, rt as CreateSandboxOptions, sr as SandboxFleetWorkspaceRestoreResult, t as HttpClient, tt as CreateSandboxFleetTokenOptions, vt as ExecResult, wn as PublishPublicTemplateVersionOptions, wt as FleetDispatchStreamOptions, xn as PublicTemplateInfo, xt as FleetDispatchCancelResult, z as BatchOptions } from "./sandbox-
|
|
1
|
+
import { $ as CreateRequestOptions, $n as SandboxFleetToken, B as BatchResult, Bn as SandboxFleetDispatchResponse, Cn as PublishPublicTemplateOptions, Ct as FleetDispatchResultBufferOptions, Dn as ReconcileSandboxFleetsOptions, Dt as FleetMachineId, En as ReapExpiredSandboxFleetsResult, Et as FleetExecDispatchResult, Ht as IntelligenceReport, In as SandboxFleetArtifact, Kr as TokenRefreshHandler, Kt as IntelligenceReportWindow, Ln as SandboxFleetArtifactSpec, Mn as SandboxClientConfig, On as ReconcileSandboxFleetsResult, Ot as FleetPromptDispatchOptions, Pn as SandboxEnvironment, Pr as SshKeysManager, Q as CreateIntelligenceReportOptions, Qr as UsageInfo, R as BatchEvent, Rn as SandboxFleetCostEstimate, Rr as SubscriptionInfo, Sn as PublicTemplateVersionInfo, St as FleetDispatchResultBuffer, Tn as ReapExpiredSandboxFleetsOptions, Tr as SecretsManager, Tt as FleetExecDispatchOptions, Un as SandboxFleetInfo, Ut as IntelligenceReportBudget, V as BatchTask, Vn as SandboxFleetDriverCapability, Wt as IntelligenceReportCompareTo, Xt as ListSandboxOptions, Yn as SandboxFleetManifest, Yt as ListSandboxFleetOptions, Zn as SandboxFleetOperationsSummary, _t as ExecOptions, a as TraceExportSink, cr as SandboxFleetWorkspaceSnapshotResult, er as SandboxFleetTraceBundle, et as CreateSandboxFleetOptions, gn as PromptResult, hn as PromptOptions, i as TraceExportResult, ir as SandboxFleetUsage, j as AttachSandboxFleetMachineOptions, kt as FleetPromptDispatchResult, lr as SandboxInfo, mn as PromptInputPart, n as SandboxInstance, nt as CreateSandboxFleetWithCoordinatorOptions, or as SandboxFleetWorkspaceReconcileResult, qn as SandboxFleetMachineRecord, rr as SandboxFleetTraceOptions, rt as CreateSandboxOptions, sr as SandboxFleetWorkspaceRestoreResult, t as HttpClient, tt as CreateSandboxFleetTokenOptions, vt as ExecResult, wn as PublishPublicTemplateVersionOptions, wt as FleetDispatchStreamOptions, xn as PublicTemplateInfo, xt as FleetDispatchCancelResult, z as BatchOptions } from "./sandbox-B55j2q9K.js";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/sse-parser.d.ts
|
|
4
4
|
/**
|
|
@@ -465,8 +465,17 @@ declare class SandboxClient implements HttpClient {
|
|
|
465
465
|
/**
|
|
466
466
|
* Make an authenticated HTTP request to the API.
|
|
467
467
|
* This is exposed for use by SandboxInstance.
|
|
468
|
+
*
|
|
469
|
+
* `fetchOptions.timeoutMs` overrides the client-wide `this.timeoutMs`
|
|
470
|
+
* for a single request. Slow data-plane operations (snapshot create
|
|
471
|
+
* blocks the server up to 600s while the host-agent compresses and
|
|
472
|
+
* uploads the rootfs) must pass a higher ceiling, otherwise the
|
|
473
|
+
* default client timeout aborts mid-operation with a `TimeoutError`
|
|
474
|
+
* even though the server is still working.
|
|
468
475
|
*/
|
|
469
|
-
fetch(path: string, options?: RequestInit
|
|
476
|
+
fetch(path: string, options?: RequestInit, fetchOptions?: {
|
|
477
|
+
timeoutMs?: number;
|
|
478
|
+
}): Promise<Response>;
|
|
470
479
|
private parseInfo;
|
|
471
480
|
private readonly _tokenRefreshHandlers;
|
|
472
481
|
/**
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-BxlfZ2Uh.js";
|
|
2
|
+
export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -1 +1,201 @@
|
|
|
1
|
-
const a0_0x5d7379=a0_0x421d;(function(_0xdc79d8,_0x553f86){const _0xcaa332=a0_0x421d,_0x5c92d8=_0xdc79d8();while(!![]){try{const _0x12369b=-parseInt(_0xcaa332(0x1d8))/0x1*(parseInt(_0xcaa332(0x1bc))/0x2)+parseInt(_0xcaa332(0x1e7))/0x3+parseInt(_0xcaa332(0x1df))/0x4*(-parseInt(_0xcaa332(0x1cf))/0x5)+-parseInt(_0xcaa332(0x1ce))/0x6+parseInt(_0xcaa332(0x1c3))/0x7+parseInt(_0xcaa332(0x21f))/0x8+-parseInt(_0xcaa332(0x206))/0x9*(parseInt(_0xcaa332(0x20e))/0xa);if(_0x12369b===_0x553f86)break;else _0x5c92d8['push'](_0x5c92d8['shift']());}catch(_0x39039f){_0x5c92d8['push'](_0x5c92d8['shift']());}}}(a0_0x148f,0x2bc0c));function a0_0x148f(){const _0x4b8671=['\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x73\x77\x71\x47\x42\x78\x76\x5a\x44\x63\x62\x55\x42\x33\x71\x47\x79\x32\x39\x55\x44\x67\x66\x50\x42\x49\x62\x57\x79\x78\x72\x4f\x69\x68\x6e\x4c\x43\x67\x66\x59\x79\x78\x72\x56\x43\x4e\x6d\x47\x42\x33\x69\x47\x42\x4e\x76\x53\x42\x63\x62\x49\x45\x78\x72\x4c\x43\x57','\x43\x4d\x76\x58\x44\x77\x76\x5a\x44\x65\x50\x5a\x42\x32\x34','\x44\x68\x4c\x57\x7a\x71','\x41\x4d\x39\x50\x42\x47','\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x73\x77\x71','\x76\x32\x6a\x6c\x42\x4d\x4f','\x7a\x67\x76\x5a\x44\x68\x6a\x56\x45\x71','\x6d\x5a\x65\x59\x6e\x5a\x61\x59\x41\x78\x6a\x54\x77\x67\x48\x41','\x6d\x74\x43\x57\x6f\x74\x43\x34\x6d\x68\x48\x73\x76\x75\x7a\x55\x43\x57','\x74\x4b\x7a\x58\x75\x77\x4b','\x7a\x32\x76\x30\x75\x67\x66\x30\x41\x61','\x7a\x32\x76\x30\x71\x32\x39\x55\x44\x67\x76\x55\x44\x61','\x79\x76\x66\x6e\x43\x65\x38','\x43\x33\x76\x49\x43\x32\x6e\x59\x41\x77\x6a\x4c\x76\x67\x39\x67\x41\x77\x58\x4c\x72\x78\x7a\x4c\x42\x4e\x72\x5a','\x72\x32\x7a\x5a\x41\x31\x43','\x41\x75\x35\x65\x71\x75\x53','\x76\x75\x7a\x49\x7a\x4b\x75','\x6d\x74\x69\x59\x44\x4e\x66\x62\x7a\x77\x6e\x34','\x79\x4e\x6a\x50\x7a\x67\x44\x4c\x6f\x4d\x7a\x50\x42\x67\x75','\x42\x77\x76\x30\x41\x67\x39\x4b','\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x6f\x47','\x44\x78\x62\x4b\x79\x78\x72\x4c\x7a\x61','\x72\x4d\x66\x50\x42\x67\x76\x4b\x69\x68\x72\x56\x69\x67\x6e\x56\x42\x4d\x35\x4c\x79\x33\x71\x47\x44\x67\x38\x47\x79\x32\x39\x53\x42\x67\x66\x49\x42\x33\x6a\x48\x44\x67\x4c\x56\x42\x49\x62\x62\x75\x65\x4b\x36\x69\x61','\x44\x67\x31\x65\x44\x4b\x79','\x6e\x65\x66\x6f\x7a\x30\x31\x35\x74\x61','\x6c\x32\x66\x57\x41\x73\x39\x4a\x42\x32\x58\x53\x79\x77\x6a\x56\x43\x4d\x66\x30\x41\x77\x39\x55\x6c\x32\x6a\x56\x42\x33\x72\x5a\x44\x68\x6a\x48\x43\x61','\x43\x32\x58\x50\x79\x32\x75','\x44\x67\x76\x34\x44\x61','\x6c\x32\x66\x57\x41\x73\x39\x4a\x42\x32\x58\x53\x79\x77\x6a\x56\x43\x4d\x66\x30\x41\x77\x39\x55\x6c\x33\x6e\x55\x79\x78\x62\x5a\x41\x67\x39\x30','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f','\x44\x75\x39\x4e\x73\x75\x30','\x42\x32\x35\x67\x41\x77\x58\x4c\x72\x67\x76\x53\x7a\x78\x72\x4c\x7a\x61','\x6e\x5a\x43\x35\x6e\x64\x65\x59\x72\x32\x48\x4f\x42\x31\x4c\x71','\x43\x32\x66\x32\x7a\x76\x6e\x55\x79\x78\x62\x5a\x41\x67\x39\x30','\x6c\x32\x66\x57\x41\x73\x39\x4a\x42\x32\x58\x53\x79\x77\x6a\x56\x43\x4d\x66\x30\x41\x77\x39\x55\x6c\x33\x72\x56\x41\x32\x76\x55','\x7a\x4d\x76\x30\x79\x32\x47','\x42\x4d\x66\x54\x7a\x71','\x44\x77\x35\x5a\x44\x77\x6a\x5a\x79\x33\x6a\x50\x79\x4d\x76\x65\x42\x32\x6e\x31\x42\x77\x76\x55\x44\x61','\x43\x32\x4c\x4e\x42\x4d\x66\x53','\x41\x77\x35\x4a\x42\x68\x76\x4b\x7a\x78\x6d','\x44\x33\x6a\x50\x44\x67\x75','\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x73\x77\x71\x47\x41\x78\x6d\x47\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x77\x71','\x7a\x4d\x4c\x53\x44\x67\x76\x59','\x75\x65\x39\x74\x76\x61','\x44\x32\x76\x4e\x74\x33\x4b','\x44\x4e\x44\x64\x72\x30\x75','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f\x69\x67\x31\x31\x43\x33\x71\x47\x42\x4d\x39\x30\x69\x67\x6e\x56\x42\x4e\x72\x48\x41\x77\x34\x47\x42\x4e\x76\x53\x42\x63\x62\x49\x45\x78\x72\x4c\x43\x57','\x79\x31\x6e\x73\x42\x33\x6d','\x43\x4d\x76\x57\x42\x67\x66\x4a\x7a\x75\x6e\x56\x42\x4e\x72\x4c\x42\x4e\x71','\x79\x78\x62\x57\x42\x67\x4c\x4a\x79\x78\x72\x50\x42\x32\x34\x56\x41\x4e\x6e\x56\x42\x47','\x79\x32\x39\x4b\x7a\x71','\x42\x32\x35\x67\x41\x77\x58\x4c\x75\x4d\x76\x55\x79\x77\x31\x4c\x7a\x61','\x79\x75\x44\x6a\x44\x4d\x47','\x41\x77\x35\x4b\x7a\x78\x48\x70\x7a\x47','\x79\x4d\x4c\x55\x7a\x61','\x41\x77\x6e\x51\x79\x30\x6d','\x43\x67\x76\x55\x7a\x67\x4c\x55\x7a\x31\x44\x59\x41\x78\x72\x4c\x76\x67\x4c\x54\x7a\x78\x69','\x7a\x4d\x58\x31\x43\x32\x47','\x79\x4d\x39\x31\x42\x4d\x72\x71\x79\x78\x72\x4f','\x43\x32\x6e\x4f\x7a\x77\x72\x31\x42\x67\x76\x78\x43\x4d\x4c\x30\x7a\x71','\x41\x67\x76\x48\x7a\x67\x76\x59\x43\x57','\x43\x33\x72\x59\x41\x77\x35\x4e\x41\x77\x7a\x35','\x73\x33\x6a\x69\x75\x68\x4f','\x6d\x4a\x4b\x33\x77\x4b\x54\x5a\x45\x4d\x44\x63','\x73\x65\x76\x63\x43\x4c\x65','\x43\x33\x72\x48\x43\x4e\x72\x5a\x76\x32\x4c\x30\x41\x61','\x42\x67\x66\x5a\x44\x66\x44\x59\x41\x78\x72\x30\x7a\x77\x35\x64\x42\x32\x35\x30\x7a\x77\x35\x30','\x42\x4d\x76\x34\x44\x66\x62\x48\x44\x67\x47','\x7a\x67\x76\x49\x42\x33\x76\x55\x79\x32\x76\x6e\x43\x57','\x71\x32\x39\x55\x44\x67\x76\x55\x44\x63\x31\x75\x45\x78\x62\x4c','\x43\x33\x72\x59\x41\x77\x35\x4e','\x6d\x5a\x43\x32\x6d\x4a\x62\x58\x72\x65\x6a\x71\x73\x77\x79','\x79\x4d\x66\x5a\x7a\x76\x76\x59\x42\x61','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x31\x5a','\x43\x4d\x76\x4d\x43\x4d\x76\x5a\x41\x66\x72\x56\x41\x32\x76\x55','\x79\x76\x6e\x6c\x77\x76\x79','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f\x69\x67\x4c\x5a\x69\x68\x6a\x4c\x43\x78\x76\x50\x43\x4d\x76\x4b','\x7a\x4d\x76\x30\x79\x32\x48\x6a\x42\x78\x62\x53','\x79\x77\x6a\x56\x43\x4e\x71','\x42\x4d\x6e\x70\x76\x30\x47','\x71\x77\x6a\x56\x43\x4e\x72\x66\x43\x4e\x6a\x56\x43\x47','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x43\x4d\x76\x57\x42\x67\x66\x4a\x7a\x71','\x44\x33\x6a\x50\x44\x67\x76\x67\x41\x77\x58\x4c','\x41\x67\x66\x55\x7a\x67\x58\x4c\x72\x4d\x4c\x53\x7a\x75\x76\x32\x7a\x77\x35\x30','\x79\x77\x72\x48\x43\x68\x72\x4c\x43\x47','\x43\x32\x76\x30','\x7a\x67\x76\x5a\x44\x68\x6a\x56\x45\x77\x76\x4b','\x6d\x74\x71\x32\x6f\x74\x79\x57\x6f\x68\x72\x31\x72\x32\x6e\x33\x43\x57','\x44\x77\x35\x5a\x44\x77\x6a\x5a\x79\x33\x6a\x50\x79\x4d\x76\x67\x41\x77\x58\x4c\x72\x78\x7a\x4c\x42\x4e\x72\x5a','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f\x69\x67\x31\x31\x43\x33\x71\x47\x42\x4d\x39\x30\x69\x67\x6a\x4c\x69\x67\x76\x54\x43\x68\x72\x35','\x7a\x76\x6e\x51\x45\x75\x4b','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x61','\x6d\x5a\x75\x34\x73\x4e\x50\x63\x71\x32\x50\x4f','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f\x69\x67\x31\x31\x43\x33\x71\x47\x42\x4d\x39\x30\x69\x67\x6e\x56\x42\x4e\x72\x48\x41\x77\x34\x47\x69\x49\x34\x55\x69\x47','\x42\x33\x6a\x50\x7a\x32\x4c\x55','\x42\x67\x76\x55\x7a\x33\x72\x4f','\x43\x33\x72\x48\x44\x68\x76\x5a','\x42\x4d\x58\x75\x76\x4d\x34','\x43\x4d\x76\x55\x79\x77\x31\x4c\x7a\x61','\x6d\x74\x4b\x5a\x6d\x64\x6d\x30\x6f\x67\x39\x33\x76\x4b\x31\x73\x77\x61','\x42\x33\x62\x30\x41\x77\x39\x55\x43\x57','\x77\x4e\x6a\x4c\x79\x32\x4b','\x43\x4d\x76\x5a\x42\x32\x58\x32\x7a\x75\x48\x4c\x79\x77\x72\x4c\x43\x4e\x6d'];a0_0x148f=function(){return _0x4b8671;};return a0_0x148f();}import{f as a0_0x3282f4,r as a0_0x3dfe4a,u as a0_0x3d219b}from'\x2e\x2f\x65\x72\x72\x6f\x72\x73\x2d\x44\x5a\x73\x66\x4a\x55\x75\x63\x2e\x6a\x73';const DEFAULT_TIMEOUT_MS=0x7530;function normalizeBaseUrl(_0xe5f36e){const _0x1269a0=a0_0x421d;return _0xe5f36e[_0x1269a0(0x219)](/\/+$/,'');}var CollaborationClient=class{[a0_0x5d7379(0x20f)];[a0_0x5d7379(0x210)];[a0_0x5d7379(0x214)];[a0_0x5d7379(0x203)];constructor(_0x437b36){const _0xbcb9d0=a0_0x5d7379,_0x4bab64={'\x61\x53\x4b\x59\x56':function(_0xb93b1c,_0x5920a9){return _0xb93b1c(_0x5920a9);}};this[_0xbcb9d0(0x20f)]=_0x4bab64[_0xbcb9d0(0x212)](normalizeBaseUrl,_0x437b36[_0xbcb9d0(0x20f)]),this[_0xbcb9d0(0x210)]=_0x437b36[_0xbcb9d0(0x210)]??DEFAULT_TIMEOUT_MS,this[_0xbcb9d0(0x214)]=_0x437b36['\x66\x65\x74\x63\x68']??globalThis[_0xbcb9d0(0x1ea)][_0xbcb9d0(0x1fd)](globalThis),this[_0xbcb9d0(0x203)]=_0x437b36['\x68\x65\x61\x64\x65\x72\x73'];}async['\x62\x6f\x6f\x74\x73\x74\x72\x61\x70'](_0xa5f6cc){const _0x1f03f2=a0_0x5d7379,_0x5b6afb={'\x77\x65\x67\x4f\x79':_0x1f03f2(0x1e0),'\x45\x74\x75\x74\x61':_0x1f03f2(0x1f2)};return this[_0x1f03f2(0x1c8)](_0x5b6afb[_0x1f03f2(0x1f3)],{'\x6d\x65\x74\x68\x6f\x64':_0x5b6afb['\x45\x74\x75\x74\x61'],'\x62\x6f\x64\x79':JSON[_0x1f03f2(0x204)](_0xa5f6cc)});}async[a0_0x5d7379(0x211)](_0x103678){const _0x235d14=a0_0x5d7379,_0x2e9583={'\x63\x53\x52\x6f\x73':_0x235d14(0x1f2)};return this[_0x235d14(0x1c8)](_0x235d14(0x1e9),{'\x6d\x65\x74\x68\x6f\x64':_0x2e9583[_0x235d14(0x1f6)],'\x62\x6f\x64\x79':JSON[_0x235d14(0x204)](_0x103678)});}async[a0_0x5d7379(0x1e8)](_0x52ac33){const _0x45db1c=a0_0x5d7379;return this[_0x45db1c(0x1c8)](_0x45db1c(0x1e3),{'\x6d\x65\x74\x68\x6f\x64':_0x45db1c(0x1f2),'\x62\x6f\x64\x79':JSON[_0x45db1c(0x204)](_0x52ac33)});}async[a0_0x5d7379(0x1c8)](_0x516e0d,_0x3ebbec){const _0x38026d=a0_0x5d7379,_0x4dce73={'\x57\x62\x4b\x6e\x6a':function(_0x3d237f,_0x1bc7d7,_0x259384){return _0x3d237f(_0x1bc7d7,_0x259384);},'\x75\x4f\x67\x49\x4d':_0x38026d(0x20c),'\x6e\x63\x4f\x57\x48':function(_0x270992,_0x4dc3bc,_0x2c1858,_0x5499bb,_0x10f86c){return _0x270992(_0x4dc3bc,_0x2c1858,_0x5499bb,_0x10f86c);},'\x65\x53\x6a\x79\x49':_0x38026d(0x217),'\x47\x66\x73\x6b\x57':function(_0x22230d,_0x2e3b81){return _0x22230d instanceof _0x2e3b81;}},_0x5678c6=new AbortController(),_0x599db7=_0x4dce73[_0x38026d(0x1cc)](setTimeout,()=>_0x5678c6[_0x38026d(0x215)](),this['\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73']);try{const _0x5b6b30=new Headers(await this[_0x38026d(0x1c6)]());if(!_0x5b6b30['\x68\x61\x73'](_0x4dce73[_0x38026d(0x1e5)]))_0x5b6b30[_0x38026d(0x21d)](_0x38026d(0x20c),_0x38026d(0x1f8));const _0x2727c0=await this[_0x38026d(0x214)](''+this[_0x38026d(0x20f)]+_0x516e0d,{..._0x3ebbec,'\x68\x65\x61\x64\x65\x72\x73':_0x5b6b30,'\x73\x69\x67\x6e\x61\x6c':_0x3ebbec[_0x38026d(0x1ed)]??_0x5678c6['\x73\x69\x67\x6e\x61\x6c']});if(!_0x2727c0['\x6f\x6b']){const _0x74a284=await _0x2727c0[_0x38026d(0x1e2)]();throw _0x4dce73[_0x38026d(0x216)](a0_0x3282f4,_0x2727c0[_0x38026d(0x1c0)],_0x74a284,{'\x6d\x65\x74\x68\x6f\x64':_0x3ebbec[_0x38026d(0x1da)],'\x70\x61\x74\x68':_0x516e0d},_0x2727c0[_0x38026d(0x203)]);}return _0x2727c0['\x6a\x73\x6f\x6e']();}catch(_0x33957c){if(_0x33957c instanceof Error&&_0x33957c[_0x38026d(0x1eb)]===_0x4dce73[_0x38026d(0x222)])throw new a0_0x3d219b(this['\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73']);if(_0x4dce73[_0x38026d(0x1d5)](_0x33957c,Error)&&_0x38026d(0x1f9)in _0x33957c)throw _0x33957c;throw new a0_0x3dfe4a(_0x38026d(0x1dd)+(_0x33957c instanceof Error?_0x33957c[_0x38026d(0x218)]:String(_0x33957c)),_0x33957c instanceof Error?_0x33957c:void 0x0);}finally{clearTimeout(_0x599db7);}}async['\x72\x65\x73\x6f\x6c\x76\x65\x48\x65\x61\x64\x65\x72\x73'](){const _0x1864dd=a0_0x5d7379;if(typeof this[_0x1864dd(0x203)]==='\x66\x75\x6e\x63\x74\x69\x6f\x6e')return this['\x68\x65\x61\x64\x65\x72\x73']();return this[_0x1864dd(0x203)];}};const DOCUMENT_PREFIX=a0_0x5d7379(0x1db),FILE_SEGMENT='\x3a\x66\x69\x6c\x65\x3a';function assertValidWorkspaceId(_0x332f06){const _0x223396=a0_0x5d7379,_0x141b26={'\x55\x46\x62\x66\x45':_0x223396(0x1f0),'\x4b\x72\x48\x50\x7a':_0x223396(0x1c7)};if(!_0x332f06)throw new Error(_0x141b26[_0x223396(0x1d7)]);if(_0x332f06['\x69\x6e\x63\x6c\x75\x64\x65\x73']('\x2f')||_0x332f06[_0x223396(0x1ee)]('\x5c')||_0x332f06['\x69\x6e\x63\x6c\x75\x64\x65\x73']('\x00'))throw new Error(_0x141b26[_0x223396(0x205)]);}function normalizeCollaborationPath(_0x33c092){const _0x54c360=a0_0x5d7379,_0x3601fc={'\x69\x63\x6a\x63\x43':function(_0x59c889,_0x224443){return _0x59c889===_0x224443;},'\x5a\x72\x65\x63\x69':_0x54c360(0x221),'\x76\x77\x43\x47\x45':_0x54c360(0x1f5)};if(!_0x33c092)throw new Error(_0x54c360(0x213));const _0x3dfcde=_0x33c092[_0x54c360(0x219)](/\\/g,'\x2f')['\x73\x70\x6c\x69\x74']('\x2f')[_0x54c360(0x1f1)](_0x1cc26f=>_0x1cc26f[_0x54c360(0x1bf)]>0x0&&_0x1cc26f!=='\x2e');if(_0x3601fc[_0x54c360(0x1fe)](_0x3dfcde[_0x54c360(0x1bf)],0x0))throw new Error(_0x3601fc[_0x54c360(0x1c5)]);for(const _0x5a6744 of _0x3dfcde){if(_0x5a6744==='\x2e\x2e')throw new Error(_0x54c360(0x1bd));if(_0x5a6744[_0x54c360(0x1ee)]('\x00'))throw new Error(_0x3601fc[_0x54c360(0x1f4)]);}return _0x3dfcde[_0x54c360(0x1ca)]('\x2f');}function a0_0x421d(_0x4d2132,_0xb5d34f){_0x4d2132=_0x4d2132-0x1bc;const _0x148fc2=a0_0x148f();let _0x421d41=_0x148fc2[_0x4d2132];if(a0_0x421d['\x73\x48\x41\x44\x50\x5a']===undefined){var _0x1e7aa7=function(_0x4ccf84){const _0x55a769='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x2226c4='',_0xf35b08='';for(let _0x1634ab=0x0,_0x501e78,_0x49f7ba,_0x105b07=0x0;_0x49f7ba=_0x4ccf84['\x63\x68\x61\x72\x41\x74'](_0x105b07++);~_0x49f7ba&&(_0x501e78=_0x1634ab%0x4?_0x501e78*0x40+_0x49f7ba:_0x49f7ba,_0x1634ab++%0x4)?_0x2226c4+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x501e78>>(-0x2*_0x1634ab&0x6)):0x0){_0x49f7ba=_0x55a769['\x69\x6e\x64\x65\x78\x4f\x66'](_0x49f7ba);}for(let _0x3acb6c=0x0,_0x363d40=_0x2226c4['\x6c\x65\x6e\x67\x74\x68'];_0x3acb6c<_0x363d40;_0x3acb6c++){_0xf35b08+='\x25'+('\x30\x30'+_0x2226c4['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x3acb6c)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0xf35b08);};a0_0x421d['\x43\x6e\x6b\x78\x51\x6e']=_0x1e7aa7,a0_0x421d['\x52\x42\x75\x6e\x63\x74']={},a0_0x421d['\x73\x48\x41\x44\x50\x5a']=!![];}const _0x30b1c0=_0x148fc2[0x0],_0x5c3d8b=_0x4d2132+_0x30b1c0,_0x5de769=a0_0x421d['\x52\x42\x75\x6e\x63\x74'][_0x5c3d8b];return!_0x5de769?(_0x421d41=a0_0x421d['\x43\x6e\x6b\x78\x51\x6e'](_0x421d41),a0_0x421d['\x52\x42\x75\x6e\x63\x74'][_0x5c3d8b]=_0x421d41):_0x421d41=_0x5de769,_0x421d41;}function buildCollaborationDocumentId(_0x393047){const _0x4f24f1=a0_0x5d7379;assertValidWorkspaceId(_0x393047[_0x4f24f1(0x1cb)]);const _0x4bf15f=normalizeCollaborationPath(_0x393047[_0x4f24f1(0x1e4)]);return''+DOCUMENT_PREFIX+_0x393047[_0x4f24f1(0x1cb)]+FILE_SEGMENT+_0x4bf15f;}function parseCollaborationDocumentId(_0x517388){const _0x1bfb6d=a0_0x5d7379,_0x3eaf9d={'\x69\x4e\x44\x41\x4b':function(_0x35356a,_0x1c444c){return _0x35356a+_0x1c444c;},'\x4e\x46\x71\x51\x69':function(_0x31b77f,_0x162e9c){return _0x31b77f(_0x162e9c);}};if(!_0x517388[_0x1bfb6d(0x208)](DOCUMENT_PREFIX))return null;const _0x3f1ada=_0x517388[_0x1bfb6d(0x1fc)](FILE_SEGMENT,0xa);if(_0x3f1ada===-0x1)return null;const _0x2319af=_0x517388['\x73\x6c\x69\x63\x65'](0xa,_0x3f1ada),_0x380cb9=_0x517388[_0x1bfb6d(0x1e1)](_0x3eaf9d[_0x1bfb6d(0x1d6)](_0x3f1ada,0x6));try{return assertValidWorkspaceId(_0x2319af),{'\x77\x6f\x72\x6b\x73\x70\x61\x63\x65\x49\x64':_0x2319af,'\x72\x65\x6c\x61\x74\x69\x76\x65\x50\x61\x74\x68':_0x3eaf9d[_0x1bfb6d(0x1d0)](normalizeCollaborationPath,_0x380cb9)};}catch{return null;}}const DEFAULT_DEBOUNCE_MS=0x1f4,FILE_ORIGIN=a0_0x5d7379(0x1d9);var CollaborationFileBridge=class{[a0_0x5d7379(0x20b)];['\x6f\x70\x74\x69\x6f\x6e\x73'];[a0_0x5d7379(0x21c)]=null;[a0_0x5d7379(0x1ec)]=null;[a0_0x5d7379(0x220)]=null;[a0_0x5d7379(0x1ff)]=null;['\x64\x65\x73\x74\x72\x6f\x79\x65\x64']=![];[a0_0x5d7379(0x201)];['\x6c\x61\x73\x74\x57\x72\x69\x74\x74\x65\x6e\x43\x6f\x6e\x74\x65\x6e\x74']=null;constructor(_0xd96e69){const _0x4dd79f=a0_0x5d7379;this[_0x4dd79f(0x1c4)]=_0xd96e69,this[_0x4dd79f(0x201)]=_0xd96e69[_0x4dd79f(0x1e4)],this[_0x4dd79f(0x20b)]=_0xd96e69[_0x4dd79f(0x20b)]??DEFAULT_DEBOUNCE_MS;}[a0_0x5d7379(0x1fd)](_0x397c6a){const _0x176e41=a0_0x5d7379,_0x40dbad={'\x6e\x6c\x54\x56\x6e':function(_0x578093,_0x7c9067){return _0x578093!==_0x7c9067;}};this[_0x176e41(0x1cd)](),this[_0x176e41(0x21e)]=![],this['\x61\x64\x61\x70\x74\x65\x72']=_0x397c6a,this[_0x176e41(0x201)]=this['\x6f\x70\x74\x69\x6f\x6e\x73'][_0x176e41(0x1e4)],this[_0x176e41(0x1ec)]=_0x397c6a['\x73\x75\x62\x73\x63\x72\x69\x62\x65'](_0x2222e=>{const _0x3fde78=_0x176e41;if(_0x2222e[_0x3fde78(0x1be)]===FILE_ORIGIN)return;if(_0x40dbad[_0x3fde78(0x1c1)](this['\x6c\x61\x73\x74\x57\x72\x69\x74\x74\x65\x6e\x43\x6f\x6e\x74\x65\x6e\x74'],null)&&_0x2222e[_0x3fde78(0x223)]===this[_0x3fde78(0x209)])return;this[_0x3fde78(0x202)](_0x2222e[_0x3fde78(0x223)]);}),this[_0x176e41(0x220)]=this['\x6f\x70\x74\x69\x6f\x6e\x73'][_0x176e41(0x1d4)](this[_0x176e41(0x201)],_0x81aff=>{this['\x68\x61\x6e\x64\x6c\x65\x46\x69\x6c\x65\x45\x76\x65\x6e\x74'](_0x81aff);});}async[a0_0x5d7379(0x200)](){const _0x350c39=a0_0x5d7379;if(!this[_0x350c39(0x21c)])return;this[_0x350c39(0x1ff)]&&(clearTimeout(this[_0x350c39(0x1ff)]),this[_0x350c39(0x1ff)]=null);const _0xc69f34=this[_0x350c39(0x21c)][_0x350c39(0x1d2)]();await this[_0x350c39(0x1ef)](_0xc69f34);}[a0_0x5d7379(0x1d1)](){const _0x2d9a53=a0_0x5d7379;return this[_0x2d9a53(0x201)];}[a0_0x5d7379(0x1cd)](){const _0x590acd=a0_0x5d7379;this[_0x590acd(0x21e)]=!![],this[_0x590acd(0x1ff)]&&(clearTimeout(this[_0x590acd(0x1ff)]),this['\x70\x65\x6e\x64\x69\x6e\x67\x57\x72\x69\x74\x65\x54\x69\x6d\x65\x72']=null),this['\x75\x6e\x73\x75\x62\x73\x63\x72\x69\x62\x65\x44\x6f\x63\x75\x6d\x65\x6e\x74']?.(),this[_0x590acd(0x1ec)]=null,this[_0x590acd(0x220)]?.(),this[_0x590acd(0x220)]=null,this[_0x590acd(0x21c)]=null;}[a0_0x5d7379(0x202)](_0x1b1246){const _0x535e16=a0_0x5d7379,_0x47925d={'\x48\x45\x42\x72\x51':function(_0x117647,_0x44b1aa,_0x3c3a01){return _0x117647(_0x44b1aa,_0x3c3a01);}};if(this[_0x535e16(0x1ff)])clearTimeout(this[_0x535e16(0x1ff)]);this['\x70\x65\x6e\x64\x69\x6e\x67\x57\x72\x69\x74\x65\x54\x69\x6d\x65\x72']=_0x47925d[_0x535e16(0x207)](setTimeout,()=>{const _0x215f97=_0x535e16;this[_0x215f97(0x1ff)]=null,this[_0x215f97(0x1ef)](_0x1b1246);},this[_0x535e16(0x20b)]);}async[a0_0x5d7379(0x1ef)](_0x236cec){const _0x34c2cf=a0_0x5d7379;if(this[_0x34c2cf(0x21e)])return;this['\x6c\x61\x73\x74\x57\x72\x69\x74\x74\x65\x6e\x43\x6f\x6e\x74\x65\x6e\x74']=_0x236cec,await this[_0x34c2cf(0x1c4)][_0x34c2cf(0x21a)](this[_0x34c2cf(0x201)],_0x236cec);}[a0_0x5d7379(0x21b)](_0x210591){const _0xcb6b43=a0_0x5d7379,_0x59aea1={'\x61\x47\x49\x76\x68':_0xcb6b43(0x1c2),'\x74\x6d\x44\x76\x46':function(_0x3f05a5,_0x5ecb6e){return _0x3f05a5!==_0x5ecb6e;},'\x61\x51\x4d\x70\x4f':_0xcb6b43(0x20d)};if(!this['\x61\x64\x61\x70\x74\x65\x72']||this[_0xcb6b43(0x21e)])return;if(_0x210591[_0xcb6b43(0x1c9)]===_0x59aea1[_0xcb6b43(0x1fb)]&&_0x210591[_0xcb6b43(0x20a)]){this[_0xcb6b43(0x201)]=_0x210591[_0xcb6b43(0x20a)],this['\x6f\x70\x74\x69\x6f\x6e\x73'][_0xcb6b43(0x1fa)]?.(_0x210591);return;}if(_0x210591['\x74\x79\x70\x65']==='\x64\x65\x6c\x65\x74\x65\x64'){this[_0xcb6b43(0x1c4)][_0xcb6b43(0x1e6)]?.(_0x210591);return;}if(_0x59aea1[_0xcb6b43(0x1de)](_0x210591[_0xcb6b43(0x1c9)],_0xcb6b43(0x1dc))||_0x59aea1['\x74\x6d\x44\x76\x46'](typeof _0x210591['\x63\x6f\x6e\x74\x65\x6e\x74'],_0x59aea1[_0xcb6b43(0x1d3)]))return;if(_0x210591['\x63\x6f\x6e\x74\x65\x6e\x74']===this[_0xcb6b43(0x21c)][_0xcb6b43(0x1d2)]())return;if(this[_0xcb6b43(0x209)]!==null&&_0x210591[_0xcb6b43(0x223)]===this[_0xcb6b43(0x209)])return;this['\x61\x64\x61\x70\x74\x65\x72'][_0xcb6b43(0x1f7)](_0x210591['\x63\x6f\x6e\x74\x65\x6e\x74'],{'\x6f\x72\x69\x67\x69\x6e':FILE_ORIGIN,'\x76\x65\x72\x73\x69\x6f\x6e':_0x210591['\x76\x65\x72\x73\x69\x6f\x6e']});}};export{CollaborationClient as a,parseCollaborationDocumentId as i,buildCollaborationDocumentId as n,normalizeCollaborationPath as r,CollaborationFileBridge as t};
|
|
1
|
+
import { f as parseErrorResponse, r as NetworkError, u as TimeoutError } from "./errors-DZsfJUuc.js";
|
|
2
|
+
//#region src/collaboration/client.ts
|
|
3
|
+
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
4
|
+
function normalizeBaseUrl(url) {
|
|
5
|
+
return url.replace(/\/+$/, "");
|
|
6
|
+
}
|
|
7
|
+
var CollaborationClient = class {
|
|
8
|
+
baseUrl;
|
|
9
|
+
timeoutMs;
|
|
10
|
+
fetchImpl;
|
|
11
|
+
headers;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.baseUrl = normalizeBaseUrl(config.baseUrl);
|
|
14
|
+
this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
15
|
+
this.fetchImpl = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
16
|
+
this.headers = config.headers;
|
|
17
|
+
}
|
|
18
|
+
async bootstrap(request) {
|
|
19
|
+
return this.requestJson("/api/collaboration/bootstrap", {
|
|
20
|
+
method: "POST",
|
|
21
|
+
body: JSON.stringify(request)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async refreshToken(request) {
|
|
25
|
+
return this.requestJson("/api/collaboration/token", {
|
|
26
|
+
method: "POST",
|
|
27
|
+
body: JSON.stringify(request)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async saveSnapshot(request) {
|
|
31
|
+
return this.requestJson("/api/collaboration/snapshot", {
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: JSON.stringify(request)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async requestJson(path, init) {
|
|
37
|
+
const controller = new AbortController();
|
|
38
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
39
|
+
try {
|
|
40
|
+
const headers = new Headers(await this.resolveHeaders());
|
|
41
|
+
if (!headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
42
|
+
const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
43
|
+
...init,
|
|
44
|
+
headers,
|
|
45
|
+
signal: init.signal ?? controller.signal
|
|
46
|
+
});
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const body = await response.text();
|
|
49
|
+
throw parseErrorResponse(response.status, body, {
|
|
50
|
+
method: init.method,
|
|
51
|
+
path
|
|
52
|
+
}, response.headers);
|
|
53
|
+
}
|
|
54
|
+
return response.json();
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error instanceof Error && error.name === "AbortError") throw new TimeoutError(this.timeoutMs);
|
|
57
|
+
if (error instanceof Error && "code" in error) throw error;
|
|
58
|
+
throw new NetworkError(`Failed to connect to collaboration API: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : void 0);
|
|
59
|
+
} finally {
|
|
60
|
+
clearTimeout(timeoutId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async resolveHeaders() {
|
|
64
|
+
if (typeof this.headers === "function") return this.headers();
|
|
65
|
+
return this.headers;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/collaboration/document-id.ts
|
|
70
|
+
const DOCUMENT_PREFIX = "workspace:";
|
|
71
|
+
const FILE_SEGMENT = ":file:";
|
|
72
|
+
function assertValidWorkspaceId(workspaceId) {
|
|
73
|
+
if (!workspaceId) throw new Error("workspaceId is required");
|
|
74
|
+
if (workspaceId.includes("/") || workspaceId.includes("\\") || workspaceId.includes("\0")) throw new Error("workspaceId must not contain path separators or null bytes");
|
|
75
|
+
}
|
|
76
|
+
function normalizeCollaborationPath(path) {
|
|
77
|
+
if (!path) throw new Error("relativePath is required");
|
|
78
|
+
const normalized = path.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0 && segment !== ".");
|
|
79
|
+
if (normalized.length === 0) throw new Error("relativePath must not be empty");
|
|
80
|
+
for (const segment of normalized) {
|
|
81
|
+
if (segment === "..") throw new Error("relativePath must not contain \"..\"");
|
|
82
|
+
if (segment.includes("\0")) throw new Error("relativePath must not contain null bytes");
|
|
83
|
+
}
|
|
84
|
+
return normalized.join("/");
|
|
85
|
+
}
|
|
86
|
+
function buildCollaborationDocumentId(ref) {
|
|
87
|
+
assertValidWorkspaceId(ref.workspaceId);
|
|
88
|
+
const relativePath = normalizeCollaborationPath(ref.relativePath);
|
|
89
|
+
return `${DOCUMENT_PREFIX}${ref.workspaceId}${FILE_SEGMENT}${relativePath}`;
|
|
90
|
+
}
|
|
91
|
+
function parseCollaborationDocumentId(documentId) {
|
|
92
|
+
if (!documentId.startsWith(DOCUMENT_PREFIX)) return null;
|
|
93
|
+
const separatorIndex = documentId.indexOf(FILE_SEGMENT, 10);
|
|
94
|
+
if (separatorIndex === -1) return null;
|
|
95
|
+
const workspaceId = documentId.slice(10, separatorIndex);
|
|
96
|
+
const relativePath = documentId.slice(separatorIndex + 6);
|
|
97
|
+
try {
|
|
98
|
+
assertValidWorkspaceId(workspaceId);
|
|
99
|
+
return {
|
|
100
|
+
workspaceId,
|
|
101
|
+
relativePath: normalizeCollaborationPath(relativePath)
|
|
102
|
+
};
|
|
103
|
+
} catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/collaboration/file-bridge.ts
|
|
109
|
+
const DEFAULT_DEBOUNCE_MS = 500;
|
|
110
|
+
const FILE_ORIGIN = "bridge:file";
|
|
111
|
+
/**
|
|
112
|
+
* Headless bridge between a collaborative document adapter and the sandbox
|
|
113
|
+
* filesystem. Keeps this package free of direct Yjs assumptions.
|
|
114
|
+
*/
|
|
115
|
+
var CollaborationFileBridge = class {
|
|
116
|
+
debounceMs;
|
|
117
|
+
options;
|
|
118
|
+
adapter = null;
|
|
119
|
+
unsubscribeDocument = null;
|
|
120
|
+
unsubscribeFileEvents = null;
|
|
121
|
+
pendingWriteTimer = null;
|
|
122
|
+
destroyed = false;
|
|
123
|
+
boundPath;
|
|
124
|
+
lastWrittenContent = null;
|
|
125
|
+
constructor(options) {
|
|
126
|
+
this.options = options;
|
|
127
|
+
this.boundPath = options.relativePath;
|
|
128
|
+
this.debounceMs = options.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
129
|
+
}
|
|
130
|
+
bind(adapter) {
|
|
131
|
+
this.destroy();
|
|
132
|
+
this.destroyed = false;
|
|
133
|
+
this.adapter = adapter;
|
|
134
|
+
this.boundPath = this.options.relativePath;
|
|
135
|
+
this.unsubscribeDocument = adapter.subscribe((change) => {
|
|
136
|
+
if (change.origin === FILE_ORIGIN) return;
|
|
137
|
+
if (this.lastWrittenContent !== null && change.content === this.lastWrittenContent) return;
|
|
138
|
+
this.scheduleWrite(change.content);
|
|
139
|
+
});
|
|
140
|
+
this.unsubscribeFileEvents = this.options.subscribeToFileEvents(this.boundPath, (event) => {
|
|
141
|
+
this.handleFileEvent(event);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async flush() {
|
|
145
|
+
if (!this.adapter) return;
|
|
146
|
+
if (this.pendingWriteTimer) {
|
|
147
|
+
clearTimeout(this.pendingWriteTimer);
|
|
148
|
+
this.pendingWriteTimer = null;
|
|
149
|
+
}
|
|
150
|
+
const content = this.adapter.getContent();
|
|
151
|
+
await this.write(content);
|
|
152
|
+
}
|
|
153
|
+
getPath() {
|
|
154
|
+
return this.boundPath;
|
|
155
|
+
}
|
|
156
|
+
destroy() {
|
|
157
|
+
this.destroyed = true;
|
|
158
|
+
if (this.pendingWriteTimer) {
|
|
159
|
+
clearTimeout(this.pendingWriteTimer);
|
|
160
|
+
this.pendingWriteTimer = null;
|
|
161
|
+
}
|
|
162
|
+
this.unsubscribeDocument?.();
|
|
163
|
+
this.unsubscribeDocument = null;
|
|
164
|
+
this.unsubscribeFileEvents?.();
|
|
165
|
+
this.unsubscribeFileEvents = null;
|
|
166
|
+
this.adapter = null;
|
|
167
|
+
}
|
|
168
|
+
scheduleWrite(content) {
|
|
169
|
+
if (this.pendingWriteTimer) clearTimeout(this.pendingWriteTimer);
|
|
170
|
+
this.pendingWriteTimer = setTimeout(() => {
|
|
171
|
+
this.pendingWriteTimer = null;
|
|
172
|
+
this.write(content);
|
|
173
|
+
}, this.debounceMs);
|
|
174
|
+
}
|
|
175
|
+
async write(content) {
|
|
176
|
+
if (this.destroyed) return;
|
|
177
|
+
this.lastWrittenContent = content;
|
|
178
|
+
await this.options.writeFile(this.boundPath, content);
|
|
179
|
+
}
|
|
180
|
+
handleFileEvent(event) {
|
|
181
|
+
if (!this.adapter || this.destroyed) return;
|
|
182
|
+
if (event.type === "renamed" && event.nextPath) {
|
|
183
|
+
this.boundPath = event.nextPath;
|
|
184
|
+
this.options.onFileRenamed?.(event);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (event.type === "deleted") {
|
|
188
|
+
this.options.onFileDeleted?.(event);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (event.type !== "updated" || typeof event.content !== "string") return;
|
|
192
|
+
if (event.content === this.adapter.getContent()) return;
|
|
193
|
+
if (this.lastWrittenContent !== null && event.content === this.lastWrittenContent) return;
|
|
194
|
+
this.adapter.replaceContent(event.content, {
|
|
195
|
+
origin: FILE_ORIGIN,
|
|
196
|
+
version: event.version
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
//#endregion
|
|
201
|
+
export { CollaborationClient as a, parseCollaborationDocumentId as i, buildCollaborationDocumentId as n, normalizeCollaborationPath as r, CollaborationFileBridge as t };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mn as SandboxClientConfig, _t as ExecOptions, an as PreviewLinkInfo, en as NetworkConfig, lr as SandboxInfo, mr as SandboxStatus, n as SandboxInstance, on as PreviewLinkManager, rt as CreateSandboxOptions, vt as ExecResult } from "./sandbox-
|
|
2
|
-
import { i as SandboxClient } from "./client-
|
|
1
|
+
import { Mn as SandboxClientConfig, _t as ExecOptions, an as PreviewLinkInfo, en as NetworkConfig, lr as SandboxInfo, mr as SandboxStatus, n as SandboxInstance, on as PreviewLinkManager, rt as CreateSandboxOptions, vt as ExecResult } from "./sandbox-B55j2q9K.js";
|
|
2
|
+
import { i as SandboxClient } from "./client-D3FqPlde.js";
|
|
3
3
|
import { a as PartialFailureError, c as SandboxErrorJson, d as StateError, f as TimeoutError, i as NotFoundError, l as SandboxFailureDetail, n as CapabilityError, o as QuotaError, p as ValidationError, r as NetworkError, s as SandboxError, t as AuthError, u as ServerError } from "./errors-1Se5ATyZ.js";
|
|
4
4
|
export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, QuotaError, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError };
|
package/dist/core.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as SandboxInstance } from "./sandbox-joKtQ5y3.js";
|
|
2
|
+
import { a as PartialFailureError, c as ServerError, d as ValidationError, i as NotFoundError, l as StateError, n as CapabilityError, o as QuotaError, r as NetworkError, s as SandboxError, t as AuthError, u as TimeoutError } from "./errors-DZsfJUuc.js";
|
|
3
|
+
import { n as SandboxClient } from "./client-BBZ7YLmq.js";
|
|
4
|
+
export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError };
|
package/dist/errors-DZsfJUuc.js
CHANGED
|
@@ -1 +1,262 @@
|
|
|
1
|
-
const a0_0x12cd09=a0_0x4a89;(function(_0x4076f7,_0x510a19){const _0x5c0f29=a0_0x4a89,_0x478f2c=_0x4076f7();while(!![]){try{const _0x4a389c=parseInt(_0x5c0f29(0x195))/0x1*(-parseInt(_0x5c0f29(0x190))/0x2)+-parseInt(_0x5c0f29(0x1ef))/0x3+-parseInt(_0x5c0f29(0x216))/0x4+parseInt(_0x5c0f29(0x19e))/0x5*(-parseInt(_0x5c0f29(0x1d1))/0x6)+parseInt(_0x5c0f29(0x1d4))/0x7*(parseInt(_0x5c0f29(0x193))/0x8)+-parseInt(_0x5c0f29(0x1e8))/0x9*(-parseInt(_0x5c0f29(0x1dd))/0xa)+-parseInt(_0x5c0f29(0x1ed))/0xb*(-parseInt(_0x5c0f29(0x1f9))/0xc);if(_0x4a389c===_0x510a19)break;else _0x478f2c['push'](_0x478f2c['shift']());}catch(_0x4a97c6){_0x478f2c['push'](_0x478f2c['shift']());}}}(a0_0x452a,0x75e1b));var SandboxError=class extends Error{['\x73\x74\x61\x74\x75\x73'];['\x63\x6f\x64\x65'];['\x6f\x72\x69\x67\x69\x6e'];['\x65\x6e\x64\x70\x6f\x69\x6e\x74'];['\x72\x65\x74\x72\x79\x41\x66\x74\x65\x72\x4d\x73'];['\x73\x69\x64\x65\x63\x61\x72\x56\x65\x72\x73\x69\x6f\x6e'];[a0_0x12cd09(0x1b8)];constructor(_0x3dadaf,_0x16cc80,_0x351296,_0x4b1d7e){const _0x2e8810=a0_0x12cd09;super(_0x3dadaf),this[_0x2e8810(0x207)]='\x53\x61\x6e\x64\x62\x6f\x78\x45\x72\x72\x6f\x72',this[_0x2e8810(0x19b)]=_0x16cc80,this[_0x2e8810(0x1a2)]=_0x351296,this[_0x2e8810(0x1c6)]=_0x4b1d7e?.['\x6f\x72\x69\x67\x69\x6e'],this[_0x2e8810(0x1a3)]=_0x4b1d7e?.[_0x2e8810(0x1a3)],this['\x72\x65\x74\x72\x79\x41\x66\x74\x65\x72\x4d\x73']=_0x4b1d7e?.['\x72\x65\x74\x72\x79\x41\x66\x74\x65\x72\x4d\x73'],this['\x73\x69\x64\x65\x63\x61\x72\x56\x65\x72\x73\x69\x6f\x6e']=_0x4b1d7e?.[_0x2e8810(0x1cd)],this[_0x2e8810(0x1b8)]=_0x4b1d7e?.[_0x2e8810(0x1b8)];}},AuthError=class extends SandboxError{constructor(_0x450d20=a0_0x12cd09(0x1c4),_0x46514b){const _0xaab3a6=a0_0x12cd09;super(_0x450d20,_0xaab3a6(0x20c),0x191,_0x46514b),this[_0xaab3a6(0x207)]=_0xaab3a6(0x1fa);}},NotFoundError=class extends SandboxError{[a0_0x12cd09(0x1b3)];[a0_0x12cd09(0x1b2)];constructor(_0x48095d,_0x190aac,_0x46ae41){const _0x4143ad=a0_0x12cd09,_0x47d47e={'\x76\x59\x76\x4f\x66':'\x4e\x6f\x74\x46\x6f\x75\x6e\x64\x45\x72\x72\x6f\x72'};super(_0x48095d+_0x4143ad(0x1bc)+_0x190aac,_0x4143ad(0x198),0x194,_0x46ae41),this['\x6e\x61\x6d\x65']=_0x47d47e[_0x4143ad(0x1a5)],this[_0x4143ad(0x1b3)]=_0x48095d,this[_0x4143ad(0x1b2)]=_0x190aac;}},QuotaError=class extends SandboxError{[a0_0x12cd09(0x211)];[a0_0x12cd09(0x1ca)];[a0_0x12cd09(0x197)];[a0_0x12cd09(0x208)];constructor(_0x2ce4b8,_0x54e215,_0xf34733,_0x2b3982,_0x48b327,_0x44a0b1=0x1ad){const _0x637950=a0_0x12cd09,_0x317e00={'\x46\x64\x6a\x67\x77':_0x637950(0x1f7)},_0x445212=_0x317e00[_0x637950(0x1f1)][_0x637950(0x20e)]('\x7c');let _0xe3dac4=0x0;while(!![]){switch(_0x445212[_0xe3dac4++]){case'\x30':super(_0x54e215??_0x637950(0x1aa)+_0x2ce4b8,_0x637950(0x1b4),_0x44a0b1,_0x48b327);continue;case'\x31':this[_0x637950(0x1ca)]=_0xf34733;continue;case'\x32':this[_0x637950(0x208)]=_0x48b327?.[_0x637950(0x208)];continue;case'\x33':this['\x6e\x61\x6d\x65']='\x51\x75\x6f\x74\x61\x45\x72\x72\x6f\x72';continue;case'\x34':this[_0x637950(0x197)]=_0x2b3982;continue;case'\x35':this[_0x637950(0x211)]=_0x2ce4b8;continue;}break;}}},CapabilityError=class extends SandboxError{[a0_0x12cd09(0x1b7)];constructor(_0x437ab9,_0x381b61='\x43\x41\x50\x41\x42\x49\x4c\x49\x54\x59\x5f\x55\x4e\x53\x55\x50\x50\x4f\x52\x54\x45\x44',_0x458910=0x190,_0x425a30,_0x371c28){const _0x2bdca1=a0_0x12cd09,_0x518162={'\x57\x6f\x6c\x51\x43':_0x2bdca1(0x1f0)};super(_0x437ab9,_0x381b61,_0x458910,_0x425a30),this[_0x2bdca1(0x207)]=_0x518162[_0x2bdca1(0x20b)],this[_0x2bdca1(0x1b7)]=_0x371c28;}},PartialFailureError=class extends SandboxError{['\x66\x61\x69\x6c\x75\x72\x65\x73'];constructor(_0x2e4d15,_0x84e124=a0_0x12cd09(0x1b5),_0x4e268c=0x1f6,_0x2a5fbf,_0x2d5c89){const _0x36b9e3=a0_0x12cd09,_0x816724={'\x50\x6b\x6f\x65\x70':_0x36b9e3(0x213)};super(_0x2e4d15,_0x84e124,_0x4e268c,_0x2a5fbf),this[_0x36b9e3(0x207)]=_0x816724[_0x36b9e3(0x19d)],this[_0x36b9e3(0x1e0)]=_0x2d5c89;}},ValidationError=class extends SandboxError{[a0_0x12cd09(0x1b0)];constructor(_0x36f0a2,_0x159bc1,_0x5e531f){const _0x437c0b=a0_0x12cd09,_0x4a310e={'\x50\x6f\x6a\x42\x66':_0x437c0b(0x205),'\x54\x61\x75\x44\x4e':_0x437c0b(0x1e5)};super(_0x36f0a2,_0x4a310e[_0x437c0b(0x1fc)],0x190,_0x5e531f),this[_0x437c0b(0x207)]=_0x4a310e[_0x437c0b(0x1fd)],this[_0x437c0b(0x1b0)]=_0x159bc1;}},StateError=class extends SandboxError{[a0_0x12cd09(0x1dc)];[a0_0x12cd09(0x1a9)];constructor(_0x262b1b,_0x2f4a22,_0x463440,_0x2a9c6f){const _0x7e31ae=a0_0x12cd09,_0x1bbed9={'\x67\x68\x45\x55\x7a':_0x7e31ae(0x1da)};super(_0x262b1b,_0x1bbed9['\x67\x68\x45\x55\x7a'],0x199,_0x2a9c6f),this['\x6e\x61\x6d\x65']=_0x7e31ae(0x1c2),this[_0x7e31ae(0x1dc)]=_0x2f4a22,this[_0x7e31ae(0x1a9)]=_0x463440;}},TimeoutError=class extends SandboxError{['\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73'];constructor(_0x3e1727,_0xa2467b,_0x3e5142){const _0x14301c=a0_0x12cd09,_0x2f0194={'\x6c\x51\x44\x45\x4a':_0x14301c(0x1a8)};super(_0xa2467b??_0x14301c(0x1cf)+_0x3e1727+'\x6d\x73',_0x2f0194[_0x14301c(0x199)],0x198,_0x3e5142),this['\x6e\x61\x6d\x65']=_0x14301c(0x1b1),this[_0x14301c(0x1eb)]=_0x3e1727;}},NetworkError=class extends SandboxError{[a0_0x12cd09(0x1af)];constructor(_0x3b255e,_0x196d67,_0x1a6466){const _0x109cd3=a0_0x12cd09,_0x958601={'\x61\x78\x49\x52\x41':function(_0x2e77dc,_0x40365f){return _0x2e77dc instanceof _0x40365f;},'\x64\x58\x4a\x76\x4b':_0x109cd3(0x1cc)},_0x1d55f1=_0x958601['\x61\x78\x49\x52\x41'](_0x196d67,Error)?_0x196d67:void 0x0,_0x1ac078=_0x196d67 instanceof Error?_0x1a6466:_0x196d67??_0x1a6466;super(_0x3b255e,_0x958601[_0x109cd3(0x1ba)],void 0x0,_0x1ac078),this[_0x109cd3(0x207)]='\x4e\x65\x74\x77\x6f\x72\x6b\x45\x72\x72\x6f\x72',this['\x63\x61\x75\x73\x65']=_0x1d55f1;}},ServerError=class extends SandboxError{constructor(_0x2862d7,_0x35c3eb=0x1f4,_0x5f41cb){const _0x5bc213=a0_0x12cd09,_0x4351c4={'\x49\x6f\x76\x56\x45':_0x5bc213(0x1a6)};super(_0x2862d7,_0x5bc213(0x1a4),_0x35c3eb,_0x5f41cb),this['\x6e\x61\x6d\x65']=_0x4351c4[_0x5bc213(0x1fe)];}};function parseRetryAfterMs(_0x4260c7,_0x32e961){const _0x455a2d=a0_0x12cd09,_0x55141a={'\x6a\x5a\x4a\x4d\x75':_0x455a2d(0x1bb),'\x44\x4b\x55\x45\x6e':function(_0x543258,_0x1e9d7b){return _0x543258*_0x1e9d7b;}};if(typeof _0x32e961[_0x455a2d(0x208)]===_0x55141a[_0x455a2d(0x1ab)]&&Number[_0x455a2d(0x1db)](_0x32e961['\x72\x65\x74\x72\x79\x41\x66\x74\x65\x72\x4d\x73']))return Math[_0x455a2d(0x1c1)](0x0,_0x32e961['\x72\x65\x74\x72\x79\x41\x66\x74\x65\x72\x4d\x73']);if(!_0x4260c7)return void 0x0;const _0x27c19b=_0x4260c7[_0x455a2d(0x201)]();if(!_0x27c19b)return void 0x0;const _0x47ee1d=Number(_0x27c19b);if(Number[_0x455a2d(0x1db)](_0x47ee1d))return _0x55141a[_0x455a2d(0x19f)](Math[_0x455a2d(0x1c1)](0x0,_0x47ee1d),0x3e8);const _0x26ed00=Date[_0x455a2d(0x1c8)](_0x27c19b);if(!Number[_0x455a2d(0x1f4)](_0x26ed00))return Math[_0x455a2d(0x1c1)](0x0,_0x26ed00-Date[_0x455a2d(0x1de)]());}function inferOrigin(_0x43fae3,_0x260c86){const _0x34cd4c=a0_0x12cd09,_0x5b8581={'\x46\x46\x43\x76\x5a':'\x78\x2d\x73\x69\x64\x65\x63\x61\x72\x2d\x76\x65\x72\x73\x69\x6f\x6e','\x4a\x77\x7a\x61\x5a':_0x34cd4c(0x20a),'\x63\x43\x4a\x59\x77':'\x78\x2d\x6f\x72\x63\x68\x65\x73\x74\x72\x61\x74\x6f\x72\x2d\x76\x65\x72\x73\x69\x6f\x6e','\x78\x4e\x7a\x77\x58':_0x34cd4c(0x214),'\x65\x76\x51\x76\x4d':_0x34cd4c(0x1c7),'\x4b\x58\x45\x47\x76':_0x34cd4c(0x1a7),'\x53\x59\x46\x74\x70':_0x34cd4c(0x1be)},_0x4c7534=_0x260c86?.['\x70\x61\x74\x68']??_0x43fae3?.['\x67\x65\x74'](_0x34cd4c(0x19c))??void 0x0;if(!_0x43fae3)return _0x260c86?.[_0x34cd4c(0x1f3)]?_0x34cd4c(0x1a7):void 0x0;if(_0x43fae3[_0x34cd4c(0x200)](_0x5b8581[_0x34cd4c(0x1d6)])||_0x43fae3[_0x34cd4c(0x200)](_0x34cd4c(0x1f2))||_0x43fae3[_0x34cd4c(0x200)](_0x5b8581[_0x34cd4c(0x1bd)]))return _0x34cd4c(0x1d3);if(_0x43fae3[_0x34cd4c(0x200)](_0x5b8581[_0x34cd4c(0x194)]))return _0x5b8581[_0x34cd4c(0x1df)];if(_0x4c7534?.[_0x34cd4c(0x1f5)](_0x5b8581[_0x34cd4c(0x1e9)]))return _0x5b8581[_0x34cd4c(0x1fb)];if(_0x4c7534){if(_0x4c7534[_0x34cd4c(0x1f5)](_0x34cd4c(0x19a))||_0x4c7534[_0x34cd4c(0x1f5)](_0x34cd4c(0x1ea))||_0x4c7534['\x73\x74\x61\x72\x74\x73\x57\x69\x74\x68'](_0x34cd4c(0x1ae)))return _0x34cd4c(0x214);return'\x72\x75\x6e\x74\x69\x6d\x65';}return _0x5b8581[_0x34cd4c(0x1ce)];}function isQuotaCode(_0x55c317){const _0x355530=a0_0x12cd09,_0x373103={'\x65\x7a\x4c\x42\x62':function(_0x22a3ae,_0x15e610){return _0x22a3ae===_0x15e610;}};return _0x373103['\x65\x7a\x4c\x42\x62'](_0x55c317,_0x355530(0x1b4))||_0x55c317?.[_0x355530(0x191)]('\x5f\x51\x55\x4f\x54\x41\x5f\x45\x58\x43\x45\x45\x44\x45\x44')===!![];}function isCapabilityCode(_0x2f1187){const _0x220d1f=a0_0x12cd09,_0x588507={'\x68\x46\x4a\x76\x48':function(_0xe24207,_0x22c7e8){return _0xe24207===_0x22c7e8;},'\x46\x78\x6f\x78\x58':_0x220d1f(0x1d2),'\x52\x57\x49\x7a\x4e':_0x220d1f(0x206),'\x58\x6e\x70\x73\x52':_0x220d1f(0x1ee)};return _0x588507[_0x220d1f(0x1e4)](_0x2f1187,_0x588507[_0x220d1f(0x1e2)])||_0x588507['\x68\x46\x4a\x76\x48'](_0x2f1187,_0x588507[_0x220d1f(0x1ac)])||_0x2f1187===_0x588507['\x58\x6e\x70\x73\x52']||_0x2f1187===_0x220d1f(0x1c0)||_0x2f1187==='\x53\x48\x41\x52\x45\x44\x5f\x57\x4f\x52\x4b\x53\x50\x41\x43\x45\x5f\x55\x4e\x53\x55\x50\x50\x4f\x52\x54\x45\x44';}function a0_0x4a89(_0x3f0ecb,_0x125627){_0x3f0ecb=_0x3f0ecb-0x190;const _0x452a1f=a0_0x452a();let _0x4a89da=_0x452a1f[_0x3f0ecb];if(a0_0x4a89['\x65\x42\x6a\x4b\x62\x70']===undefined){var _0x410957=function(_0xdbc7f5){const _0x4a7cb6='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x44d2bb='',_0x450287='';for(let _0x1ecaf3=0x0,_0x19b818,_0x45dd16,_0x50ca27=0x0;_0x45dd16=_0xdbc7f5['\x63\x68\x61\x72\x41\x74'](_0x50ca27++);~_0x45dd16&&(_0x19b818=_0x1ecaf3%0x4?_0x19b818*0x40+_0x45dd16:_0x45dd16,_0x1ecaf3++%0x4)?_0x44d2bb+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x19b818>>(-0x2*_0x1ecaf3&0x6)):0x0){_0x45dd16=_0x4a7cb6['\x69\x6e\x64\x65\x78\x4f\x66'](_0x45dd16);}for(let _0x488daf=0x0,_0x52b8a0=_0x44d2bb['\x6c\x65\x6e\x67\x74\x68'];_0x488daf<_0x52b8a0;_0x488daf++){_0x450287+='\x25'+('\x30\x30'+_0x44d2bb['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x488daf)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x450287);};a0_0x4a89['\x4b\x78\x61\x45\x56\x66']=_0x410957,a0_0x4a89['\x75\x67\x49\x49\x4f\x6a']={},a0_0x4a89['\x65\x42\x6a\x4b\x62\x70']=!![];}const _0x30d15e=_0x452a1f[0x0],_0x3cb700=_0x3f0ecb+_0x30d15e,_0x234c00=a0_0x4a89['\x75\x67\x49\x49\x4f\x6a'][_0x3cb700];return!_0x234c00?(_0x4a89da=a0_0x4a89['\x4b\x78\x61\x45\x56\x66'](_0x4a89da),a0_0x4a89['\x75\x67\x49\x49\x4f\x6a'][_0x3cb700]=_0x4a89da):_0x4a89da=_0x234c00,_0x4a89da;}function a0_0x452a(){const _0x2826fe=['\x7a\x77\x35\x4b\x43\x67\x39\x50\x42\x4e\x71','\x75\x30\x76\x73\x76\x4b\x76\x73\x78\x30\x76\x73\x75\x4b\x39\x73','\x44\x4c\x4c\x32\x74\x32\x79','\x75\x32\x76\x59\x44\x4d\x76\x59\x72\x78\x6a\x59\x42\x33\x69','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x31\x48\x43\x67\x4b','\x76\x65\x4c\x6e\x72\x75\x39\x76\x76\x61','\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x77\x72\x74\x44\x67\x66\x30\x7a\x71','\x75\x78\x76\x56\x44\x67\x65\x47\x7a\x78\x48\x4a\x7a\x77\x76\x4b\x7a\x77\x71\x36\x69\x61','\x41\x4c\x50\x6b\x74\x78\x75','\x75\x4c\x44\x6a\x45\x4b\x34','\x7a\x77\x58\x63\x45\x68\x4f','\x6c\x32\x4c\x55\x43\x33\x72\x48\x42\x4d\x6e\x4c\x43\x57','\x79\x32\x66\x31\x43\x32\x75','\x7a\x4d\x4c\x4c\x42\x67\x72\x5a','\x76\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x76\x59\x43\x4d\x39\x59','\x43\x4d\x76\x5a\x42\x33\x76\x59\x79\x32\x76\x6a\x7a\x61','\x43\x4d\x76\x5a\x42\x33\x76\x59\x79\x32\x76\x75\x45\x78\x62\x4c','\x75\x76\x76\x70\x76\x65\x66\x46\x72\x76\x48\x64\x72\x75\x76\x65\x72\x75\x71','\x75\x65\x66\x73\x76\x65\x4c\x62\x74\x66\x39\x67\x71\x75\x4c\x6d\x76\x76\x6a\x66','\x44\x67\x7a\x32\x72\x77\x79','\x79\x32\x66\x57\x79\x77\x6a\x50\x42\x67\x4c\x30\x45\x71','\x79\x32\x39\x55\x44\x67\x66\x50\x42\x4d\x76\x59\x73\x77\x31\x48\x7a\x32\x75','\x74\x75\x6e\x6c\x79\x76\x4b','\x7a\x66\x48\x6b\x44\x4b\x53','\x42\x4e\x76\x54\x79\x4d\x76\x59','\x69\x67\x35\x56\x44\x63\x62\x4d\x42\x33\x76\x55\x7a\x64\x4f\x47','\x73\x4e\x44\x36\x79\x76\x4f','\x44\x77\x35\x52\x42\x4d\x39\x33\x42\x47','\x72\x4b\x58\x66\x72\x76\x72\x46\x72\x65\x4c\x74\x75\x65\x66\x75\x71\x30\x48\x46\x75\x65\x66\x73\x76\x65\x4c\x62\x74\x66\x39\x67\x71\x75\x4c\x6d\x76\x76\x6a\x66','\x72\x4b\x58\x66\x72\x76\x72\x46\x75\x30\x48\x62\x75\x4b\x76\x65\x78\x31\x44\x70\x75\x4b\x54\x74\x75\x65\x66\x64\x72\x76\x39\x76\x74\x4c\x6e\x76\x75\x66\x62\x70\x75\x4c\x72\x66\x72\x61','\x42\x77\x66\x34','\x75\x33\x72\x48\x44\x67\x76\x66\x43\x4e\x6a\x56\x43\x47','\x73\x4e\x44\x56\x75\x66\x47','\x71\x78\x76\x30\x41\x67\x76\x55\x44\x67\x4c\x4a\x79\x78\x72\x50\x42\x32\x34\x47\x7a\x4d\x66\x50\x42\x67\x76\x4b','\x7a\x67\x76\x30\x79\x77\x4c\x53\x43\x57','\x42\x33\x6a\x50\x7a\x32\x4c\x55','\x6c\x33\x79\x58\x6c\x57','\x43\x67\x66\x59\x43\x32\x75','\x72\x4b\x58\x66\x72\x76\x72\x46\x75\x65\x66\x73\x76\x65\x4c\x62\x74\x66\x39\x67\x71\x75\x4c\x6d\x76\x76\x6a\x66','\x79\x33\x76\x59\x43\x4d\x76\x55\x44\x61','\x44\x67\x76\x5a\x44\x61','\x74\x4b\x76\x75\x76\x30\x39\x73\x73\x31\x39\x66\x75\x4c\x6a\x70\x75\x47','\x43\x32\x4c\x4b\x7a\x77\x6e\x48\x43\x4c\x7a\x4c\x43\x4e\x6e\x50\x42\x32\x34','\x75\x31\x4c\x67\x44\x68\x61','\x75\x4d\x76\x58\x44\x77\x76\x5a\x44\x63\x62\x30\x41\x77\x31\x4c\x7a\x63\x62\x56\x44\x78\x71\x47\x79\x77\x7a\x30\x7a\x78\x69\x47','\x7a\x4d\x4c\x53\x44\x67\x76\x59','\x6e\x5a\x61\x34\x42\x4d\x54\x78\x41\x77\x31\x6a','\x71\x30\x66\x71\x71\x75\x6a\x6a\x74\x65\x4c\x75\x77\x76\x39\x6f\x74\x31\x72\x46\x72\x75\x35\x62\x71\x4b\x58\x66\x72\x61','\x43\x32\x4c\x4b\x7a\x77\x6e\x48\x43\x47','\x6e\x4a\x6d\x35\x6e\x74\x47\x59\x6d\x33\x6e\x4b\x71\x31\x50\x4f\x76\x47','\x74\x4b\x54\x66\x45\x65\x75','\x72\x4b\x7a\x64\x44\x4c\x4f','\x42\x67\x76\x55\x7a\x33\x72\x4f','\x45\x76\x66\x79\x41\x77\x6d','\x43\x33\x72\x59\x41\x77\x35\x4e','\x73\x75\x35\x77\x71\x75\x58\x6a\x72\x66\x39\x74\x76\x65\x66\x75\x72\x71','\x41\x78\x6e\x67\x41\x77\x35\x50\x44\x67\x75','\x79\x33\x76\x59\x43\x4d\x76\x55\x44\x66\x6e\x30\x79\x78\x72\x4c','\x6e\x74\x71\x59\x6f\x74\x43\x57\x44\x65\x66\x64\x7a\x66\x72\x65','\x42\x4d\x39\x33','\x45\x65\x35\x36\x44\x31\x47','\x7a\x4d\x66\x50\x42\x68\x76\x59\x7a\x78\x6d','\x7a\x68\x6e\x58\x45\x4b\x30','\x72\x4e\x48\x56\x45\x66\x47','\x77\x77\x72\x4a\x73\x4c\x75','\x41\x65\x7a\x6b\x44\x4b\x47','\x76\x4d\x66\x53\x41\x77\x72\x48\x44\x67\x4c\x56\x42\x4b\x76\x59\x43\x4d\x39\x59','\x45\x63\x31\x5a\x41\x77\x72\x4c\x79\x32\x66\x59\x6c\x78\x7a\x4c\x43\x4e\x6e\x50\x42\x32\x34','\x42\x77\x76\x30\x41\x67\x39\x4b','\x6f\x75\x7a\x65\x72\x65\x35\x71\x41\x57','\x7a\x78\x7a\x72\x44\x4b\x30','\x6c\x33\x6e\x50\x7a\x67\x76\x4a\x79\x78\x6a\x5a','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x31\x5a','\x7a\x32\x76\x30','\x6d\x74\x66\x56\x43\x4c\x44\x64\x71\x75\x34','\x76\x75\x35\x74\x76\x76\x62\x71\x74\x31\x6a\x75\x72\x75\x72\x46\x71\x30\x66\x71\x71\x75\x6a\x6a\x74\x65\x4c\x75\x77\x71','\x6e\x4a\x79\x58\x6d\x5a\x69\x57\x72\x32\x72\x78\x71\x78\x50\x72','\x71\x32\x66\x57\x79\x77\x6a\x50\x42\x67\x4c\x30\x45\x75\x76\x59\x43\x4d\x39\x59','\x72\x4d\x72\x51\x7a\x33\x43','\x45\x63\x31\x5a\x41\x77\x72\x4c\x79\x32\x66\x59\x6c\x77\x4c\x54\x79\x77\x44\x4c','\x43\x67\x66\x30\x41\x61','\x41\x78\x6e\x6f\x79\x75\x34','\x43\x33\x72\x48\x43\x4e\x72\x5a\x76\x32\x4c\x30\x41\x61','\x41\x78\x6e\x62\x43\x4e\x6a\x48\x45\x71','\x6d\x68\x57\x5a\x46\x64\x76\x38\x6d\x78\x57\x30\x46\x64\x69','\x74\x4d\x76\x35\x77\x66\x69','\x6d\x4a\x65\x57\x6d\x4a\x61\x5a\x6f\x64\x48\x6d\x42\x77\x58\x59\x42\x31\x43','\x71\x78\x76\x30\x41\x65\x76\x59\x43\x4d\x39\x59','\x73\x31\x48\x66\x72\x33\x79','\x75\x67\x39\x51\x71\x4d\x79','\x76\x67\x66\x31\x72\x65\x34','\x73\x77\x39\x32\x76\x4b\x75','\x45\x4d\x39\x68\x41\x78\x4f','\x41\x67\x66\x5a','\x44\x68\x6a\x50\x42\x71','\x42\x4c\x48\x4a\x42\x68\x61','\x76\x76\x50\x31\x42\x32\x6d','\x76\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x4c\x43\x4e\x6a\x56\x43\x47','\x76\x4b\x66\x6d\x73\x75\x72\x62\x76\x65\x4c\x70\x74\x4c\x39\x66\x75\x4c\x6a\x70\x75\x47','\x71\x30\x66\x71\x71\x75\x6a\x6a\x74\x65\x4c\x75\x77\x76\x39\x76\x74\x4c\x6e\x76\x75\x66\x62\x70\x75\x4c\x72\x66\x72\x61','\x42\x4d\x66\x54\x7a\x71','\x43\x4d\x76\x30\x43\x4e\x4c\x62\x7a\x4e\x72\x4c\x43\x4b\x31\x5a','\x77\x4c\x66\x30\x42\x4e\x47','\x45\x63\x31\x5a\x41\x77\x72\x4c\x79\x32\x66\x59\x6c\x77\x4c\x54\x79\x77\x44\x4c\x6c\x78\x72\x48\x7a\x57','\x76\x32\x39\x53\x75\x75\x6d','\x71\x76\x76\x75\x73\x66\x39\x66\x75\x4c\x6a\x70\x75\x47','\x73\x76\x50\x53\x7a\x31\x61','\x43\x33\x62\x53\x41\x78\x71','\x75\x4d\x76\x5a\x42\x33\x76\x59\x79\x32\x75','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x43\x78\x76\x56\x44\x67\x66\x75\x45\x78\x62\x4c','\x43\x4d\x66\x30\x7a\x76\x39\x53\x41\x77\x31\x50\x44\x61','\x75\x67\x66\x59\x44\x67\x4c\x48\x42\x65\x7a\x48\x41\x77\x58\x31\x43\x4d\x76\x66\x43\x4e\x6a\x56\x43\x47','\x79\x32\x39\x55\x44\x68\x6a\x56\x42\x63\x31\x57\x42\x67\x66\x55\x7a\x71','\x43\x76\x62\x77\x44\x4d\x47','\x6d\x4a\x65\x57\x6e\x5a\x71\x59\x6e\x68\x6a\x31\x41\x78\x66\x59\x71\x71','\x43\x65\x4c\x6b\x72\x4b\x65','\x6f\x67\x54\x30\x73\x67\x7a\x69\x76\x57','\x7a\x77\x35\x4b\x43\x31\x44\x50\x44\x67\x47','\x43\x4d\x76\x5a\x44\x77\x58\x30\x43\x57','\x6f\x68\x6e\x74\x74\x33\x66\x62\x45\x71','\x79\x30\x6e\x6b\x77\x78\x43','\x6d\x74\x79\x30\x6e\x4a\x65\x34\x75\x65\x31\x4b\x74\x32\x50\x59','\x75\x4b\x76\x72\x76\x75\x76\x74\x76\x61','\x42\x67\x4c\x54\x41\x78\x71','\x74\x4b\x39\x75\x78\x30\x7a\x70\x76\x75\x35\x65','\x42\x66\x66\x65\x72\x75\x4f','\x6c\x33\x62\x59\x42\x32\x50\x4c\x79\x33\x72\x5a','\x79\x32\x39\x4b\x7a\x71','\x45\x63\x31\x30\x79\x77\x35\x4e\x42\x67\x75\x54\x43\x4d\x76\x58\x44\x77\x76\x5a\x44\x63\x31\x57\x79\x78\x72\x4f','\x75\x67\x54\x56\x7a\x78\x61','\x6d\x5a\x75\x59\x6d\x74\x76\x48\x44\x32\x58\x78\x43\x77\x69','\x72\x65\x54\x76\x72\x77\x34','\x76\x77\x7a\x50\x44\x77\x71','\x42\x32\x6a\x51\x7a\x77\x6e\x30','\x43\x33\x72\x48\x44\x68\x76\x5a'];a0_0x452a=function(){return _0x2826fe;};return a0_0x452a();}function isPartialFailureCode(_0x53f4ae){const _0x26c300=a0_0x12cd09,_0x4d1a23={'\x4f\x47\x44\x50\x61':function(_0x512502,_0x3c69de){return _0x512502===_0x3c69de;},'\x4e\x4b\x45\x78\x45':_0x26c300(0x1b5),'\x6e\x78\x6d\x6e\x57':_0x26c300(0x1c9),'\x4d\x43\x4b\x61\x59':_0x26c300(0x1bf),'\x64\x73\x71\x7a\x4d':function(_0x3ec3c2,_0x2700bb){return _0x3ec3c2===_0x2700bb;},'\x6e\x58\x63\x6c\x70':'\x46\x4c\x45\x45\x54\x5f\x44\x45\x50\x52\x4f\x56\x49\x53\x49\x4f\x4e\x5f\x46\x41\x49\x4c\x45\x44'};return _0x4d1a23['\x4f\x47\x44\x50\x61'](_0x53f4ae,_0x4d1a23[_0x26c300(0x1d5)])||_0x4d1a23['\x4f\x47\x44\x50\x61'](_0x53f4ae,_0x4d1a23['\x6e\x78\x6d\x6e\x57'])||_0x53f4ae===_0x4d1a23[_0x26c300(0x1b9)]||_0x4d1a23[_0x26c300(0x1e1)](_0x53f4ae,_0x4d1a23[_0x26c300(0x202)]);}function asString(_0x454762){const _0xfae5b1=a0_0x12cd09,_0x468276={'\x6a\x69\x66\x73\x45':function(_0x43d0e3,_0x4f73f1){return _0x43d0e3>_0x4f73f1;}};return typeof _0x454762===_0xfae5b1(0x1d9)&&_0x468276['\x6a\x69\x66\x73\x45'](_0x454762[_0xfae5b1(0x201)]()[_0xfae5b1(0x1d7)],0x0)?_0x454762:void 0x0;}function isFailureDetail(_0x510fc0){const _0xa710f2=a0_0x12cd09,_0x38da25={'\x59\x64\x63\x4a\x55':'\x6f\x62\x6a\x65\x63\x74'};return typeof _0x510fc0===_0x38da25[_0xa710f2(0x1e3)]&&_0x510fc0!==null&&!Array[_0xa710f2(0x1f6)](_0x510fc0);}function readCapability(_0x5b66e7,_0x2f79e9){const _0x27bf7b=a0_0x12cd09,_0x4c8dc9=typeof _0x2f79e9===_0x27bf7b(0x1a1)&&_0x2f79e9!==null?asString(_0x2f79e9['\x63\x61\x70\x61\x62\x69\x6c\x69\x74\x79']):void 0x0;return asString(_0x5b66e7[_0x27bf7b(0x1b7)])??_0x4c8dc9;}function readFailures(_0x339fd9,_0x300b73){const _0x44ec86=a0_0x12cd09;if(Array[_0x44ec86(0x1f6)](_0x339fd9[_0x44ec86(0x1e0)]))return _0x339fd9[_0x44ec86(0x1e0)][_0x44ec86(0x1d0)](isFailureDetail);if(Array[_0x44ec86(0x1f6)](_0x339fd9['\x72\x65\x73\x75\x6c\x74\x73'])){const _0x500960=_0x339fd9[_0x44ec86(0x192)][_0x44ec86(0x1d0)](_0x36ab44=>typeof _0x36ab44===_0x44ec86(0x1a1)&&_0x36ab44!==null&&_0x36ab44['\x6f\x6b']===![]);if(_0x500960[_0x44ec86(0x1d7)]>0x0)return _0x500960[_0x44ec86(0x1d0)](isFailureDetail);}if(typeof _0x300b73===_0x44ec86(0x1a1)&&_0x300b73!==null&&Array[_0x44ec86(0x1f6)](_0x300b73['\x66\x61\x69\x6c\x75\x72\x65\x73']))return _0x300b73['\x66\x61\x69\x6c\x75\x72\x65\x73'][_0x44ec86(0x1d0)](isFailureDetail);}function parseErrorResponse(_0x3d347a,_0x31ae7d,_0xc4c46a,_0x1e9dd3){const _0x90a3be=a0_0x12cd09,_0x550c80={'\x7a\x6f\x47\x69\x7a':function(_0x353c7d,_0x6bc9da){return _0x353c7d===_0x6bc9da;},'\x55\x66\x69\x75\x64':function(_0x407dc1,_0x21a51d){return _0x407dc1===_0x21a51d;},'\x5a\x51\x74\x6e\x78':'\x73\x74\x72\x69\x6e\x67','\x55\x5a\x75\x6f\x63':'\x55\x6e\x6b\x6e\x6f\x77\x6e\x20\x65\x72\x72\x6f\x72','\x79\x51\x58\x69\x63':_0x90a3be(0x196),'\x67\x42\x53\x6a\x4e':_0x90a3be(0x19c),'\x4a\x77\x6f\x50\x58':function(_0x58299f,_0x2ae47b,_0x271afd){return _0x58299f(_0x2ae47b,_0x271afd);},'\x70\x49\x4a\x46\x41':_0x90a3be(0x1e6),'\x74\x66\x76\x45\x66':function(_0x2d607a,_0xc3573a){return _0x2d607a(_0xc3573a);},'\x49\x5a\x6c\x67\x50':function(_0x542dbd,_0x47beab){return _0x542dbd||_0x47beab;},'\x65\x6c\x42\x78\x7a':'\x4e\x4f\x54\x5f\x49\x4d\x50\x4c\x45\x4d\x45\x4e\x54\x45\x44','\x4e\x65\x79\x58\x52':function(_0x4213e6,_0x5acde9){return _0x4213e6>=_0x5acde9;},'\x71\x50\x56\x76\x68':'\x55\x4e\x4b\x4e\x4f\x57\x4e\x5f\x45\x52\x52\x4f\x52'};let _0x32d80f;try{_0x32d80f=JSON[_0x90a3be(0x1c8)](_0x31ae7d);}catch{_0x32d80f={'\x6d\x65\x73\x73\x61\x67\x65':_0x31ae7d};}const _0x32c22b=_0x32d80f['\x65\x72\x72\x6f\x72'],_0x375cac=_0x550c80[_0x90a3be(0x1ff)](typeof _0x32c22b,_0x90a3be(0x1a1))&&_0x32c22b!==null?_0x32c22b['\x6d\x65\x73\x73\x61\x67\x65']:void 0x0,_0x5020da=_0x550c80[_0x90a3be(0x1a0)](typeof _0x32c22b,_0x90a3be(0x1a1))&&_0x32c22b!==null?_0x32c22b['\x63\x6f\x64\x65']:void 0x0,_0x302a33=_0x32d80f[_0x90a3be(0x210)]||_0x375cac||(_0x550c80[_0x90a3be(0x1ff)](typeof _0x32c22b,_0x550c80[_0x90a3be(0x209)])?_0x32c22b:void 0x0)||_0x31ae7d||_0x550c80[_0x90a3be(0x203)],_0x71e03c=typeof _0x32d80f['\x64\x65\x74\x61\x69\x6c\x73']===_0x550c80[_0x90a3be(0x209)]&&_0x32d80f[_0x90a3be(0x1c5)][_0x90a3be(0x201)]()[_0x90a3be(0x1d7)]>0x0?_0x32d80f[_0x90a3be(0x1c5)]['\x74\x72\x69\x6d']():void 0x0,_0x26769a=!!_0x71e03c&&_0x71e03c!==_0x302a33&&(_0x302a33===_0x90a3be(0x204)||/^failed\b/i[_0x90a3be(0x1cb)](_0x302a33)||/^provision failed\b/i[_0x90a3be(0x1cb)](_0x302a33)||/^deprovision failed\b/i[_0x90a3be(0x1cb)](_0x302a33)),_0x3f2b72=_0x32d80f[_0x90a3be(0x19b)]||_0x5020da,_0x181033=''+(_0xc4c46a?(_0xc4c46a[_0x90a3be(0x1e7)]??_0x550c80[_0x90a3be(0x1d8)])+'\x20'+(_0xc4c46a[_0x90a3be(0x1f3)]??'')+'\x3a\x20':'')+(_0x26769a?_0x302a33+'\x3a\x20'+_0x71e03c:_0x302a33),_0x28ce3e={'\x6f\x72\x69\x67\x69\x6e':inferOrigin(_0x1e9dd3,_0xc4c46a),'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0xc4c46a?.[_0x90a3be(0x1f3)]??_0x1e9dd3?.[_0x90a3be(0x1ec)](_0x550c80['\x67\x42\x53\x6a\x4e'])??void 0x0,'\x72\x65\x74\x72\x79\x41\x66\x74\x65\x72\x4d\x73':_0x550c80[_0x90a3be(0x1c3)](parseRetryAfterMs,_0x1e9dd3?.['\x67\x65\x74']('\x72\x65\x74\x72\x79\x2d\x61\x66\x74\x65\x72')??void 0x0,_0x32d80f),'\x73\x69\x64\x65\x63\x61\x72\x56\x65\x72\x73\x69\x6f\x6e':_0x1e9dd3?.[_0x90a3be(0x1ec)](_0x550c80[_0x90a3be(0x217)])??void 0x0,'\x63\x6f\x6e\x74\x61\x69\x6e\x65\x72\x49\x6d\x61\x67\x65':_0x1e9dd3?.[_0x90a3be(0x1ec)]('\x78\x2d\x73\x69\x64\x65\x63\x61\x72\x2d\x69\x6d\x61\x67\x65')??_0x1e9dd3?.[_0x90a3be(0x1ec)](_0x90a3be(0x20a))??void 0x0};if(isQuotaCode(_0x3f2b72))return new QuotaError(_0x32d80f['\x71\x75\x6f\x74\x61\x54\x79\x70\x65']||_0x90a3be(0x212),_0x181033,_0x32d80f[_0x90a3be(0x1ca)],_0x32d80f[_0x90a3be(0x197)],_0x28ce3e,_0x3d347a);if(_0x550c80[_0x90a3be(0x1b6)](isCapabilityCode,_0x3f2b72))return new CapabilityError(_0x181033,_0x3f2b72,_0x3d347a,_0x28ce3e,readCapability(_0x32d80f,_0x32c22b));if(_0x550c80[_0x90a3be(0x1b6)](isPartialFailureCode,_0x3f2b72))return new PartialFailureError(_0x181033,_0x3f2b72,_0x3d347a,_0x28ce3e,readFailures(_0x32d80f,_0x32c22b));switch(_0x3d347a){case 0x190:return new ValidationError(_0x181033,_0x32d80f[_0x90a3be(0x1b0)],_0x28ce3e);case 0x191:return new AuthError(_0x181033,_0x28ce3e);case 0x194:return new NotFoundError(_0x32d80f[_0x90a3be(0x1b3)]||_0x90a3be(0x20f),_0x32d80f['\x72\x65\x73\x6f\x75\x72\x63\x65\x49\x64']||_0x90a3be(0x1be),_0x28ce3e);case 0x198:return new TimeoutError(_0x32d80f[_0x90a3be(0x1eb)]||0x7530,_0x181033,_0x28ce3e);case 0x199:return new StateError(_0x181033,_0x32d80f['\x63\x75\x72\x72\x65\x6e\x74\x53\x74\x61\x74\x65']||'\x75\x6e\x6b\x6e\x6f\x77\x6e',_0x32d80f[_0x90a3be(0x1a9)],_0x28ce3e);case 0x1ad:return new QuotaError(_0x32d80f[_0x90a3be(0x211)]||_0x90a3be(0x212),_0x181033,_0x32d80f[_0x90a3be(0x1ca)],_0x32d80f[_0x90a3be(0x197)],_0x28ce3e);case 0x1f5:return new SandboxError(_0x181033,_0x550c80[_0x90a3be(0x20d)](_0x3f2b72,_0x550c80[_0x90a3be(0x1ad)]),_0x3d347a,_0x28ce3e);default:if(_0x550c80[_0x90a3be(0x1f8)](_0x3d347a,0x1f4))return new ServerError(_0x181033,_0x3d347a,_0x28ce3e);return new SandboxError(_0x181033,_0x3f2b72||_0x550c80[_0x90a3be(0x215)],_0x3d347a,_0x28ce3e);}}export{PartialFailureError as a,ServerError as c,ValidationError as d,parseErrorResponse as f,NotFoundError as i,StateError as l,CapabilityError as n,QuotaError as o,NetworkError as r,SandboxError as s,AuthError as t,TimeoutError as u};
|
|
1
|
+
//#region src/errors.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sandbox SDK Errors
|
|
4
|
+
*
|
|
5
|
+
* Error classes for the Sandbox client SDK.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base error class for all Sandbox SDK errors.
|
|
9
|
+
*/
|
|
10
|
+
var SandboxError = class extends Error {
|
|
11
|
+
/** HTTP status code if applicable */
|
|
12
|
+
status;
|
|
13
|
+
/** Error code for programmatic handling */
|
|
14
|
+
code;
|
|
15
|
+
/** Best-effort origin of the failing request */
|
|
16
|
+
origin;
|
|
17
|
+
/** Request path or endpoint when known */
|
|
18
|
+
endpoint;
|
|
19
|
+
/** Retry-after duration in ms when surfaced by the upstream */
|
|
20
|
+
retryAfterMs;
|
|
21
|
+
/** Sidecar version when the runtime emitted it */
|
|
22
|
+
sidecarVersion;
|
|
23
|
+
/** Sidecar image/tag/sha when the runtime emitted it */
|
|
24
|
+
containerImage;
|
|
25
|
+
constructor(message, code, status, metadata) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "SandboxError";
|
|
28
|
+
this.code = code;
|
|
29
|
+
this.status = status;
|
|
30
|
+
this.origin = metadata?.origin;
|
|
31
|
+
this.endpoint = metadata?.endpoint;
|
|
32
|
+
this.retryAfterMs = metadata?.retryAfterMs;
|
|
33
|
+
this.sidecarVersion = metadata?.sidecarVersion;
|
|
34
|
+
this.containerImage = metadata?.containerImage;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Authentication failed or API key is invalid.
|
|
39
|
+
*/
|
|
40
|
+
var AuthError = class extends SandboxError {
|
|
41
|
+
constructor(message = "Authentication failed", metadata) {
|
|
42
|
+
super(message, "AUTH_ERROR", 401, metadata);
|
|
43
|
+
this.name = "AuthError";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The requested resource was not found.
|
|
48
|
+
*/
|
|
49
|
+
var NotFoundError = class extends SandboxError {
|
|
50
|
+
/** The resource type that was not found */
|
|
51
|
+
resourceType;
|
|
52
|
+
/** The resource ID that was not found */
|
|
53
|
+
resourceId;
|
|
54
|
+
constructor(resourceType, resourceId, metadata) {
|
|
55
|
+
super(`${resourceType} not found: ${resourceId}`, "NOT_FOUND", 404, metadata);
|
|
56
|
+
this.name = "NotFoundError";
|
|
57
|
+
this.resourceType = resourceType;
|
|
58
|
+
this.resourceId = resourceId;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Account quota or rate limit exceeded.
|
|
63
|
+
*/
|
|
64
|
+
var QuotaError = class extends SandboxError {
|
|
65
|
+
/** The type of quota that was exceeded */
|
|
66
|
+
quotaType;
|
|
67
|
+
/** Current usage */
|
|
68
|
+
current;
|
|
69
|
+
/** Maximum allowed */
|
|
70
|
+
limit;
|
|
71
|
+
/** Suggested retry-after duration in ms */
|
|
72
|
+
retryAfterMs;
|
|
73
|
+
constructor(quotaType, message, current, limit, metadata, status = 429) {
|
|
74
|
+
super(message ?? `Quota exceeded: ${quotaType}`, "QUOTA_EXCEEDED", status, metadata);
|
|
75
|
+
this.name = "QuotaError";
|
|
76
|
+
this.quotaType = quotaType;
|
|
77
|
+
this.current = current;
|
|
78
|
+
this.limit = limit;
|
|
79
|
+
this.retryAfterMs = metadata?.retryAfterMs;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The requested capability is unavailable for the account, driver, or sandbox.
|
|
84
|
+
*/
|
|
85
|
+
var CapabilityError = class extends SandboxError {
|
|
86
|
+
/** Capability or feature that was rejected when known */
|
|
87
|
+
capability;
|
|
88
|
+
constructor(message, code = "CAPABILITY_UNSUPPORTED", status = 400, metadata, capability) {
|
|
89
|
+
super(message, code, status, metadata);
|
|
90
|
+
this.name = "CapabilityError";
|
|
91
|
+
this.capability = capability;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* A multi-resource operation failed for one or more branches.
|
|
96
|
+
*/
|
|
97
|
+
var PartialFailureError = class extends SandboxError {
|
|
98
|
+
/** Per-resource failures returned by the API when available */
|
|
99
|
+
failures;
|
|
100
|
+
constructor(message, code = "PARTIAL_FAILURE", status = 502, metadata, failures) {
|
|
101
|
+
super(message, code, status, metadata);
|
|
102
|
+
this.name = "PartialFailureError";
|
|
103
|
+
this.failures = failures;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The request was invalid or malformed.
|
|
108
|
+
*/
|
|
109
|
+
var ValidationError = class extends SandboxError {
|
|
110
|
+
/** Field-level validation errors */
|
|
111
|
+
fields;
|
|
112
|
+
constructor(message, fields, metadata) {
|
|
113
|
+
super(message, "VALIDATION_ERROR", 400, metadata);
|
|
114
|
+
this.name = "ValidationError";
|
|
115
|
+
this.fields = fields;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* The sandbox is not in a valid state for the requested operation.
|
|
120
|
+
*/
|
|
121
|
+
var StateError = class extends SandboxError {
|
|
122
|
+
/** Current state of the sandbox */
|
|
123
|
+
currentState;
|
|
124
|
+
/** Required state for the operation */
|
|
125
|
+
requiredState;
|
|
126
|
+
constructor(message, currentState, requiredState, metadata) {
|
|
127
|
+
super(message, "INVALID_STATE", 409, metadata);
|
|
128
|
+
this.name = "StateError";
|
|
129
|
+
this.currentState = currentState;
|
|
130
|
+
this.requiredState = requiredState;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* The request timed out.
|
|
135
|
+
*/
|
|
136
|
+
var TimeoutError = class extends SandboxError {
|
|
137
|
+
/** Timeout duration in milliseconds */
|
|
138
|
+
timeoutMs;
|
|
139
|
+
constructor(timeoutMs, message, metadata) {
|
|
140
|
+
super(message ?? `Request timed out after ${timeoutMs}ms`, "TIMEOUT", 408, metadata);
|
|
141
|
+
this.name = "TimeoutError";
|
|
142
|
+
this.timeoutMs = timeoutMs;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* A network or connection error occurred.
|
|
147
|
+
*/
|
|
148
|
+
var NetworkError = class extends SandboxError {
|
|
149
|
+
/** The underlying error */
|
|
150
|
+
cause;
|
|
151
|
+
constructor(message, causeOrMetadata, metadata) {
|
|
152
|
+
const cause = causeOrMetadata instanceof Error ? causeOrMetadata : void 0;
|
|
153
|
+
const resolvedMetadata = causeOrMetadata instanceof Error ? metadata : causeOrMetadata ?? metadata;
|
|
154
|
+
super(message, "NETWORK_ERROR", void 0, resolvedMetadata);
|
|
155
|
+
this.name = "NetworkError";
|
|
156
|
+
this.cause = cause;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The server returned an unexpected error.
|
|
161
|
+
*/
|
|
162
|
+
var ServerError = class extends SandboxError {
|
|
163
|
+
constructor(message, status = 500, metadata) {
|
|
164
|
+
super(message, "SERVER_ERROR", status, metadata);
|
|
165
|
+
this.name = "ServerError";
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
function parseRetryAfterMs(rawValue, data) {
|
|
169
|
+
if (typeof data.retryAfterMs === "number" && Number.isFinite(data.retryAfterMs)) return Math.max(0, data.retryAfterMs);
|
|
170
|
+
if (!rawValue) return void 0;
|
|
171
|
+
const trimmed = rawValue.trim();
|
|
172
|
+
if (!trimmed) return void 0;
|
|
173
|
+
const seconds = Number(trimmed);
|
|
174
|
+
if (Number.isFinite(seconds)) return Math.max(0, seconds) * 1e3;
|
|
175
|
+
const targetTs = Date.parse(trimmed);
|
|
176
|
+
if (!Number.isNaN(targetTs)) return Math.max(0, targetTs - Date.now());
|
|
177
|
+
}
|
|
178
|
+
function inferOrigin(headers, context) {
|
|
179
|
+
const derivedPath = context?.path ?? headers?.get("x-tangle-request-path") ?? void 0;
|
|
180
|
+
if (!headers) return context?.path ? "sandbox-api" : void 0;
|
|
181
|
+
if (headers.has("x-sidecar-version") || headers.has("x-sidecar-image") || headers.has("x-sidecar-image-tag")) return "sidecar";
|
|
182
|
+
if (headers.has("x-orchestrator-version")) return "control-plane";
|
|
183
|
+
if (derivedPath?.startsWith("/v1/")) return "sandbox-api";
|
|
184
|
+
if (derivedPath) {
|
|
185
|
+
if (derivedPath.startsWith("/projects") || derivedPath.startsWith("/sidecars") || derivedPath.startsWith("/instances")) return "control-plane";
|
|
186
|
+
return "runtime";
|
|
187
|
+
}
|
|
188
|
+
return "unknown";
|
|
189
|
+
}
|
|
190
|
+
function isQuotaCode(code) {
|
|
191
|
+
return code === "QUOTA_EXCEEDED" || code?.endsWith("_QUOTA_EXCEEDED") === true;
|
|
192
|
+
}
|
|
193
|
+
function isCapabilityCode(code) {
|
|
194
|
+
return code === "CAPABILITY_NOT_ENABLED" || code === "CAPABILITY_UNSUPPORTED" || code === "UNSUPPORTED_CAPABILITY" || code === "FLEET_SHARED_WORKSPACE_UNSUPPORTED" || code === "SHARED_WORKSPACE_UNSUPPORTED";
|
|
195
|
+
}
|
|
196
|
+
function isPartialFailureCode(code) {
|
|
197
|
+
return code === "PARTIAL_FAILURE" || code === "FLEET_PARTIAL_FAILURE" || code === "FLEET_DISPATCH_PARTIAL_FAILURE" || code === "FLEET_DEPROVISION_FAILED";
|
|
198
|
+
}
|
|
199
|
+
function asString(value) {
|
|
200
|
+
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
201
|
+
}
|
|
202
|
+
function isFailureDetail(value) {
|
|
203
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
204
|
+
}
|
|
205
|
+
function readCapability(data, errorObj) {
|
|
206
|
+
const nested = typeof errorObj === "object" && errorObj !== null ? asString(errorObj.capability) : void 0;
|
|
207
|
+
return asString(data.capability) ?? nested;
|
|
208
|
+
}
|
|
209
|
+
function readFailures(data, errorObj) {
|
|
210
|
+
if (Array.isArray(data.failures)) return data.failures.filter(isFailureDetail);
|
|
211
|
+
if (Array.isArray(data.results)) {
|
|
212
|
+
const failures = data.results.filter((result) => typeof result === "object" && result !== null && result.ok === false);
|
|
213
|
+
if (failures.length > 0) return failures.filter(isFailureDetail);
|
|
214
|
+
}
|
|
215
|
+
if (typeof errorObj === "object" && errorObj !== null && Array.isArray(errorObj.failures)) return errorObj.failures.filter(isFailureDetail);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Parse an error response from the API.
|
|
219
|
+
* @param status - HTTP status code
|
|
220
|
+
* @param body - Response body text
|
|
221
|
+
* @param context - Optional request context for better error messages
|
|
222
|
+
*/
|
|
223
|
+
function parseErrorResponse(status, body, context, headers) {
|
|
224
|
+
let data;
|
|
225
|
+
try {
|
|
226
|
+
data = JSON.parse(body);
|
|
227
|
+
} catch {
|
|
228
|
+
data = { message: body };
|
|
229
|
+
}
|
|
230
|
+
const errorObj = data.error;
|
|
231
|
+
const nestedMessage = typeof errorObj === "object" && errorObj !== null ? errorObj.message : void 0;
|
|
232
|
+
const nestedCode = typeof errorObj === "object" && errorObj !== null ? errorObj.code : void 0;
|
|
233
|
+
const baseMessage = data.message || nestedMessage || (typeof errorObj === "string" ? errorObj : void 0) || body || "Unknown error";
|
|
234
|
+
const details = typeof data.details === "string" && data.details.trim().length > 0 ? data.details.trim() : void 0;
|
|
235
|
+
const shouldAppendDetails = !!details && details !== baseMessage && (baseMessage === "Unknown error" || /^failed\b/i.test(baseMessage) || /^provision failed\b/i.test(baseMessage) || /^deprovision failed\b/i.test(baseMessage));
|
|
236
|
+
const code = data.code || nestedCode;
|
|
237
|
+
const message = `${context ? `${context.method ?? "REQUEST"} ${context.path ?? ""}: ` : ""}${shouldAppendDetails ? `${baseMessage}: ${details}` : baseMessage}`;
|
|
238
|
+
const metadata = {
|
|
239
|
+
origin: inferOrigin(headers, context),
|
|
240
|
+
endpoint: context?.path ?? headers?.get("x-tangle-request-path") ?? void 0,
|
|
241
|
+
retryAfterMs: parseRetryAfterMs(headers?.get("retry-after") ?? void 0, data),
|
|
242
|
+
sidecarVersion: headers?.get("x-sidecar-version") ?? void 0,
|
|
243
|
+
containerImage: headers?.get("x-sidecar-image") ?? headers?.get("x-sidecar-image-tag") ?? void 0
|
|
244
|
+
};
|
|
245
|
+
if (isQuotaCode(code)) return new QuotaError(data.quotaType || "rate_limit", message, data.current, data.limit, metadata, status);
|
|
246
|
+
if (isCapabilityCode(code)) return new CapabilityError(message, code, status, metadata, readCapability(data, errorObj));
|
|
247
|
+
if (isPartialFailureCode(code)) return new PartialFailureError(message, code, status, metadata, readFailures(data, errorObj));
|
|
248
|
+
switch (status) {
|
|
249
|
+
case 400: return new ValidationError(message, data.fields, metadata);
|
|
250
|
+
case 401: return new AuthError(message, metadata);
|
|
251
|
+
case 404: return new NotFoundError(data.resourceType || "Resource", data.resourceId || "unknown", metadata);
|
|
252
|
+
case 408: return new TimeoutError(data.timeoutMs || 3e4, message, metadata);
|
|
253
|
+
case 409: return new StateError(message, data.currentState || "unknown", data.requiredState, metadata);
|
|
254
|
+
case 429: return new QuotaError(data.quotaType || "rate_limit", message, data.current, data.limit, metadata);
|
|
255
|
+
case 501: return new SandboxError(message, code || "NOT_IMPLEMENTED", status, metadata);
|
|
256
|
+
default:
|
|
257
|
+
if (status >= 500) return new ServerError(message, status, metadata);
|
|
258
|
+
return new SandboxError(message, code || "UNKNOWN_ERROR", status, metadata);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
export { PartialFailureError as a, ServerError as c, ValidationError as d, parseErrorResponse as f, NotFoundError as i, StateError as l, CapabilityError as n, QuotaError as o, NetworkError as r, SandboxError as s, AuthError as t, TimeoutError as u };
|