@powerhousedao/powerhouse-vetra-packages 6.2.2-dev.8 → 6.2.2-dev.80
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/browser/assets/{entry-Cvoo4_c9.js → entry-5_Eh4a2Z.js} +3 -2
- package/dist/browser/assets/{projection-entry-DVec8YRh.js → projection-entry-DgFDnTMt.js} +4 -4
- package/dist/browser/{linting-Dn6pXRkK.js → button-CuO8Gh3v.js} +20 -6
- package/dist/browser/button-CuO8Gh3v.js.map +1 -0
- package/dist/browser/{connect-KEU-HR3o.js → connect-Df8YBCmF.js} +916 -200
- package/dist/browser/connect-Df8YBCmF.js.map +1 -0
- package/dist/browser/{dist-CXoKspdx.js → dist-B4FWbuEM.js} +10 -2
- package/dist/browser/{dist-CXoKspdx.js.map → dist-B4FWbuEM.js.map} +1 -1
- package/dist/{node/dist-BeZaEP6S.mjs → browser/dist-BAJ5nRDl.js} +21 -2
- package/dist/browser/{dist-D8H48e8N.js.map → dist-BAJ5nRDl.js.map} +1 -1
- package/dist/browser/{dist-D5ra2aRj.js → dist-BIpFdiLp.js} +2388 -1848
- package/dist/browser/dist-BIpFdiLp.js.map +1 -0
- package/dist/browser/{document-drive-IdFV1QXL.js → document-drive-DU75CBKf.js} +1186 -124
- package/dist/browser/document-drive-DU75CBKf.js.map +1 -0
- package/dist/browser/document-models/index.js +1 -1
- package/dist/browser/{documents-D4ek7Ubv.js → documents-J_l59mSV.js} +5 -604
- package/dist/browser/documents-J_l59mSV.js.map +1 -0
- package/dist/browser/{editor-DiZF3ao3.js → editor-BuYbUTIt.js} +671 -236
- package/dist/browser/editor-BuYbUTIt.js.map +1 -0
- package/dist/browser/editor-y1bqyeB_.js +25 -0
- package/dist/browser/editor-y1bqyeB_.js.map +1 -0
- package/dist/browser/editors/document-model-editor/module.js +1 -1
- package/dist/browser/editors/generic-drive-explorer/index.js +5 -5
- package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
- package/dist/{node/folder-view-Cy-QxsDg.mjs → browser/folder-view-BzERbCoQ.js} +73 -46
- package/dist/browser/folder-view-BzERbCoQ.js.map +1 -0
- package/dist/browser/{graphql-editor-ZLRO_8Ce.js → graphql-editor-Dv1FDpax.js} +8 -7
- package/dist/browser/{graphql-editor-ZLRO_8Ce.js.map → graphql-editor-Dv1FDpax.js.map} +1 -1
- package/dist/browser/{hooks-CORHBNHb.js → hooks-KKcNp2X0.js} +2 -2
- package/dist/browser/{hooks-CORHBNHb.js.map → hooks-KKcNp2X0.js.map} +1 -1
- package/dist/browser/index.js +378 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{json-editor-DBuZ6gN7.js → json-editor-ZRgRDikU.js} +4 -4
- package/dist/browser/{json-editor-DBuZ6gN7.js.map → json-editor-ZRgRDikU.js.map} +1 -1
- package/dist/browser/{lib-C-f3izXz.js → lib-ewnRj2dJ.js} +13 -4
- package/dist/browser/lib-ewnRj2dJ.js.map +1 -0
- package/dist/browser/printer-CEYr4JOg.js +604 -0
- package/dist/browser/printer-CEYr4JOg.js.map +1 -0
- package/dist/browser/{schema-context-DY-GEGnY.js → schema-context-ZyeclQwy.js} +2 -2
- package/dist/browser/{schema-context-DY-GEGnY.js.map → schema-context-ZyeclQwy.js.map} +1 -1
- package/dist/browser/{state-schemas-BjQKM498.js → state-schemas-BBkkpjRl.js} +8 -18
- package/dist/browser/state-schemas-BBkkpjRl.js.map +1 -0
- package/dist/node/{linting-Dx50GuLN.mjs → button-Da7CxMn7.mjs} +20 -7
- package/dist/node/button-Da7CxMn7.mjs.map +1 -0
- package/dist/node/{connect-KcYZcy_Z.mjs → connect-DM43aaJZ.mjs} +916 -200
- package/dist/node/connect-DM43aaJZ.mjs.map +1 -0
- package/dist/node/{dist-DJEK2WVi.mjs → dist-4gA6tFmW.mjs} +2391 -1846
- package/dist/node/dist-4gA6tFmW.mjs.map +1 -0
- package/dist/{browser/dist-D8H48e8N.js → node/dist-CzYOpeXN.mjs} +21 -2
- package/dist/node/{dist-BeZaEP6S.mjs.map → dist-CzYOpeXN.mjs.map} +1 -1
- package/dist/node/{dist-fA4EItr0.mjs → dist-DT7jI9ol.mjs} +10 -2
- package/dist/node/{dist-fA4EItr0.mjs.map → dist-DT7jI9ol.mjs.map} +1 -1
- package/dist/node/{document-drive-C8hbqQ3C.mjs → document-drive-CRYbvD0-.mjs} +1186 -124
- package/dist/node/document-drive-CRYbvD0-.mjs.map +1 -0
- package/dist/node/document-models/index.mjs +1 -1
- package/dist/node/{documents-BFBPmyw1.mjs → documents-DCf53bzO.mjs} +3 -3
- package/dist/node/{documents-BFBPmyw1.mjs.map → documents-DCf53bzO.mjs.map} +1 -1
- package/dist/node/{editor-B1KhoF1f.mjs → editor-B5cnYfC7.mjs} +672 -237
- package/dist/node/editor-B5cnYfC7.mjs.map +1 -0
- package/dist/node/editor-Dn0DUR0W.mjs +25 -0
- package/dist/node/editor-Dn0DUR0W.mjs.map +1 -0
- package/dist/node/editors/document-model-editor/module.mjs +1 -1
- package/dist/node/editors/generic-drive-explorer/index.mjs +5 -5
- package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
- package/dist/{browser/folder-view-DMFqcJhc.js → node/folder-view-BAAfODx_.mjs} +73 -46
- package/dist/node/folder-view-BAAfODx_.mjs.map +1 -0
- package/dist/node/{graphql-DskHmkMe.mjs → graphql-BfAoPeWM.mjs} +2 -2
- package/dist/node/{graphql-DskHmkMe.mjs.map → graphql-BfAoPeWM.mjs.map} +1 -1
- package/dist/node/{graphql-editor-C5VLRqEf.mjs → graphql-editor-CUrJvXrG.mjs} +7 -7
- package/dist/node/{graphql-editor-C5VLRqEf.mjs.map → graphql-editor-CUrJvXrG.mjs.map} +1 -1
- package/dist/node/{hooks-DJrjfVaS.mjs → hooks-D0DcS3MV.mjs} +2 -2
- package/dist/node/{hooks-DJrjfVaS.mjs.map → hooks-D0DcS3MV.mjs.map} +1 -1
- package/dist/node/index.mjs +378 -9
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{json-editor-iI2s9a_4.mjs → json-editor-TvKShKo-.mjs} +4 -4
- package/dist/node/{json-editor-iI2s9a_4.mjs.map → json-editor-TvKShKo-.mjs.map} +1 -1
- package/dist/node/{main-D82dkD7g.mjs → main-B1tRsYOp.mjs} +15 -6
- package/dist/node/main-B1tRsYOp.mjs.map +1 -0
- package/dist/node/{schema-context-CX5ml_9t.mjs → schema-context-DL8jhi_d.mjs} +3 -3
- package/dist/node/{schema-context-CX5ml_9t.mjs.map → schema-context-DL8jhi_d.mjs.map} +1 -1
- package/dist/node/{state-schemas-Bl7nA8bB.mjs → state-schemas-CJK5hin3.mjs} +10 -20
- package/dist/{browser/state-schemas-BjQKM498.js.map → node/state-schemas-CJK5hin3.mjs.map} +1 -1
- package/package.json +8 -7
- package/dist/browser/connect-KEU-HR3o.js.map +0 -1
- package/dist/browser/dist-D5ra2aRj.js.map +0 -1
- package/dist/browser/document-drive-IdFV1QXL.js.map +0 -1
- package/dist/browser/documents-D4ek7Ubv.js.map +0 -1
- package/dist/browser/editor-DiZF3ao3.js.map +0 -1
- package/dist/browser/editor-SqNULDP-.js +0 -29
- package/dist/browser/editor-SqNULDP-.js.map +0 -1
- package/dist/browser/folder-view-DMFqcJhc.js.map +0 -1
- package/dist/browser/lib-C-f3izXz.js.map +0 -1
- package/dist/browser/linting-Dn6pXRkK.js.map +0 -1
- package/dist/node/connect-KcYZcy_Z.mjs.map +0 -1
- package/dist/node/dist-DJEK2WVi.mjs.map +0 -1
- package/dist/node/document-drive-C8hbqQ3C.mjs.map +0 -1
- package/dist/node/editor-B1KhoF1f.mjs.map +0 -1
- package/dist/node/editor-yBGEvMGD.mjs +0 -29
- package/dist/node/editor-yBGEvMGD.mjs.map +0 -1
- package/dist/node/folder-view-Cy-QxsDg.mjs.map +0 -1
- package/dist/node/linting-Dx50GuLN.mjs.map +0 -1
- package/dist/node/main-D82dkD7g.mjs.map +0 -1
- package/dist/node/state-schemas-Bl7nA8bB.mjs.map +0 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as SyncStatus, o as DriveCollectionId, s as ModuleNotFoundError, t as gql } from "./lib-
|
|
4
|
-
import
|
|
1
|
+
import { A as __toESM, D as __commonJSMin, t as capitalCase } from "./dist-B4FWbuEM.js";
|
|
2
|
+
import { C as baseLoadFromInputVersioned, O as createPresignedHeader, Q as setName, S as baseLoadFromInput, T as buildSignedAction, U as replayDocumentVersioned, a as handleTargetNameCollisions, ct as validateStateSchemaName, f as logger, h as UnsupportedDocumentModelVersionError, i as generateNodesCopy, j as createZip, l as moveNode, lt as generateId, n as copyNode, o as isFileNode, ot as validateInitialState, s as isFolderNode, st as validateModules, t as addFolder, u as updateNode, w as baseSaveToFileHandle, y as assertAuthPreservedOnDuplicate } from "./document-drive-DU75CBKf.js";
|
|
3
|
+
import { a as SyncStatus, o as DriveCollectionId, s as ModuleNotFoundError, t as gql } from "./lib-ewnRj2dJ.js";
|
|
4
|
+
import "./parser-CkF6Qt8V.js";
|
|
5
|
+
import "./printer-CEYr4JOg.js";
|
|
6
|
+
import { createContext, use, useCallback, useContext, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
5
7
|
import "react/jsx-runtime";
|
|
6
|
-
//#region ../reactor-browser/dist/make-ph-event-functions-
|
|
8
|
+
//#region ../reactor-browser/dist/make-ph-event-functions-DBq3iWYn.js
|
|
7
9
|
const isServer$1 = typeof window === "undefined";
|
|
8
10
|
function makePHEventFunctions(key) {
|
|
9
11
|
const setEventName = `ph:set${capitalCase(key)}`;
|
|
@@ -51,7 +53,7 @@ function makePHEventFunctions(key) {
|
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
//#endregion
|
|
54
|
-
//#region ../reactor-browser/dist/document-by-id-
|
|
56
|
+
//#region ../reactor-browser/dist/document-by-id-BSZqTN66.js
|
|
55
57
|
async function queueActions(document, actionOrActions) {
|
|
56
58
|
if (!document) throw new Error("No document provided");
|
|
57
59
|
if (!actionOrActions) throw new Error("No actions provided");
|
|
@@ -97,12 +99,12 @@ async function uploadOperations(documentId, allOperations, pushOperations, optio
|
|
|
97
99
|
logger.verbose(`uploadDocumentOperations:for:waitForUpdate(${documentId}): END`);
|
|
98
100
|
}
|
|
99
101
|
async function signAction(action, document) {
|
|
100
|
-
const reactor = window.ph?.reactorClient;
|
|
101
|
-
if (!reactor) return action;
|
|
102
|
-
const reducer = (await reactor.getDocumentModelModule(document.header.documentType)).reducer;
|
|
103
102
|
const renown = window.ph?.renown;
|
|
104
103
|
if (!renown?.user) return action;
|
|
105
104
|
if (!action.context?.signer) return action;
|
|
105
|
+
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
106
|
+
if (!reactorClient) return action;
|
|
107
|
+
const reducer = (await reactorClient.getDocumentModelModuleForDocument(document)).reducer;
|
|
106
108
|
const actionSigner = action.context.signer;
|
|
107
109
|
return await buildSignedAction(action, reducer, document, actionSigner, renown.crypto.sign);
|
|
108
110
|
}
|
|
@@ -180,6 +182,21 @@ async function dispatchActions(actionOrActions, documentOrDocumentId, onErrors,
|
|
|
180
182
|
if (onSuccess && result) onSuccess(result);
|
|
181
183
|
return result;
|
|
182
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* The reactor's `DocumentChangeType` members, typed as the enum so they can be
|
|
187
|
+
* assigned to `DocumentChangeEvent.type`. The assertion is unavoidable - a
|
|
188
|
+
* TypeScript string enum is nominal, so no string literal is assignable to it
|
|
189
|
+
* without one - and the two checks above are what make it safe.
|
|
190
|
+
*/
|
|
191
|
+
const DOCUMENT_CHANGE_TYPE = {
|
|
192
|
+
Created: "created",
|
|
193
|
+
Deleted: "deleted",
|
|
194
|
+
Updated: "updated",
|
|
195
|
+
ParentAdded: "parent_added",
|
|
196
|
+
ParentRemoved: "parent_removed",
|
|
197
|
+
ChildAdded: "child_added",
|
|
198
|
+
ChildRemoved: "child_removed"
|
|
199
|
+
};
|
|
183
200
|
const documentEventFunctions = makePHEventFunctions("documentCache");
|
|
184
201
|
/** Returns all documents in the reactor. */
|
|
185
202
|
const useDocumentCache = documentEventFunctions.useValue;
|
|
@@ -226,710 +243,29 @@ function useDocumentById(id) {
|
|
|
226
243
|
return [document, dispatch];
|
|
227
244
|
}
|
|
228
245
|
//#endregion
|
|
229
|
-
//#region
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
version
|
|
253
|
-
specification
|
|
254
|
-
}
|
|
255
|
-
totalCount
|
|
256
|
-
hasNextPage
|
|
257
|
-
hasPreviousPage
|
|
258
|
-
cursor
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
`;
|
|
262
|
-
const GetDocumentDocument = gql`
|
|
263
|
-
query GetDocument($identifier: String!, $view: ViewFilterInput) {
|
|
264
|
-
document(identifier: $identifier, view: $view) {
|
|
265
|
-
document {
|
|
266
|
-
...PHDocumentFields
|
|
267
|
-
}
|
|
268
|
-
childIds
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
${PhDocumentFieldsFragmentDoc}
|
|
272
|
-
`;
|
|
273
|
-
const GetDocumentWithOperationsDocument = gql`
|
|
274
|
-
query GetDocumentWithOperations(
|
|
275
|
-
$identifier: String!
|
|
276
|
-
$view: ViewFilterInput
|
|
277
|
-
$operationsFilter: DocumentOperationsFilterInput
|
|
278
|
-
$operationsPaging: PagingInput
|
|
279
|
-
) {
|
|
280
|
-
document(identifier: $identifier, view: $view) {
|
|
281
|
-
document {
|
|
282
|
-
...PHDocumentFields
|
|
283
|
-
operations(filter: $operationsFilter, paging: $operationsPaging) {
|
|
284
|
-
items {
|
|
285
|
-
index
|
|
286
|
-
timestampUtcMs
|
|
287
|
-
hash
|
|
288
|
-
skip
|
|
289
|
-
error
|
|
290
|
-
id
|
|
291
|
-
action {
|
|
292
|
-
id
|
|
293
|
-
type
|
|
294
|
-
timestampUtcMs
|
|
295
|
-
input
|
|
296
|
-
scope
|
|
297
|
-
context {
|
|
298
|
-
signer {
|
|
299
|
-
user {
|
|
300
|
-
address
|
|
301
|
-
networkId
|
|
302
|
-
chainId
|
|
303
|
-
}
|
|
304
|
-
app {
|
|
305
|
-
name
|
|
306
|
-
key
|
|
307
|
-
}
|
|
308
|
-
signatures
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
totalCount
|
|
314
|
-
hasNextPage
|
|
315
|
-
hasPreviousPage
|
|
316
|
-
cursor
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
childIds
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
${PhDocumentFieldsFragmentDoc}
|
|
323
|
-
`;
|
|
324
|
-
gql`
|
|
325
|
-
query GetDocumentOutgoingRelationships(
|
|
326
|
-
$sourceIdentifier: String!
|
|
327
|
-
$relationshipType: String!
|
|
328
|
-
$view: ViewFilterInput
|
|
329
|
-
$paging: PagingInput
|
|
330
|
-
) {
|
|
331
|
-
documentOutgoingRelationships(
|
|
332
|
-
sourceIdentifier: $sourceIdentifier
|
|
333
|
-
relationshipType: $relationshipType
|
|
334
|
-
view: $view
|
|
335
|
-
paging: $paging
|
|
336
|
-
) {
|
|
337
|
-
items {
|
|
338
|
-
...PHDocumentFields
|
|
339
|
-
}
|
|
340
|
-
totalCount
|
|
341
|
-
hasNextPage
|
|
342
|
-
hasPreviousPage
|
|
343
|
-
cursor
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
${PhDocumentFieldsFragmentDoc}
|
|
347
|
-
`;
|
|
348
|
-
gql`
|
|
349
|
-
query GetDocumentIncomingRelationships(
|
|
350
|
-
$targetIdentifier: String!
|
|
351
|
-
$relationshipType: String!
|
|
352
|
-
$view: ViewFilterInput
|
|
353
|
-
$paging: PagingInput
|
|
354
|
-
) {
|
|
355
|
-
documentIncomingRelationships(
|
|
356
|
-
targetIdentifier: $targetIdentifier
|
|
357
|
-
relationshipType: $relationshipType
|
|
358
|
-
view: $view
|
|
359
|
-
paging: $paging
|
|
360
|
-
) {
|
|
361
|
-
items {
|
|
362
|
-
...PHDocumentFields
|
|
363
|
-
}
|
|
364
|
-
totalCount
|
|
365
|
-
hasNextPage
|
|
366
|
-
hasPreviousPage
|
|
367
|
-
cursor
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
${PhDocumentFieldsFragmentDoc}
|
|
371
|
-
`;
|
|
372
|
-
gql`
|
|
373
|
-
query FindDocuments(
|
|
374
|
-
$search: SearchFilterInput
|
|
375
|
-
$view: ViewFilterInput
|
|
376
|
-
$paging: PagingInput
|
|
377
|
-
) {
|
|
378
|
-
findDocuments(search: $search, view: $view, paging: $paging) {
|
|
379
|
-
items {
|
|
380
|
-
...PHDocumentFields
|
|
381
|
-
}
|
|
382
|
-
totalCount
|
|
383
|
-
hasNextPage
|
|
384
|
-
hasPreviousPage
|
|
385
|
-
cursor
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
${PhDocumentFieldsFragmentDoc}
|
|
389
|
-
`;
|
|
390
|
-
const GetDocumentOperationsDocument = gql`
|
|
391
|
-
query GetDocumentOperations(
|
|
392
|
-
$filter: OperationsFilterInput!
|
|
393
|
-
$paging: PagingInput
|
|
394
|
-
) {
|
|
395
|
-
documentOperations(filter: $filter, paging: $paging) {
|
|
396
|
-
items {
|
|
397
|
-
index
|
|
398
|
-
timestampUtcMs
|
|
399
|
-
hash
|
|
400
|
-
skip
|
|
401
|
-
error
|
|
402
|
-
id
|
|
403
|
-
action {
|
|
404
|
-
id
|
|
405
|
-
type
|
|
406
|
-
timestampUtcMs
|
|
407
|
-
input
|
|
408
|
-
scope
|
|
409
|
-
context {
|
|
410
|
-
signer {
|
|
411
|
-
user {
|
|
412
|
-
address
|
|
413
|
-
networkId
|
|
414
|
-
chainId
|
|
415
|
-
}
|
|
416
|
-
app {
|
|
417
|
-
name
|
|
418
|
-
key
|
|
419
|
-
}
|
|
420
|
-
signatures
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
totalCount
|
|
426
|
-
hasNextPage
|
|
427
|
-
hasPreviousPage
|
|
428
|
-
cursor
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
`;
|
|
432
|
-
gql`
|
|
433
|
-
query GetJobStatus($jobId: String!) {
|
|
434
|
-
jobStatus(jobId: $jobId) {
|
|
435
|
-
id
|
|
436
|
-
status
|
|
437
|
-
result
|
|
438
|
-
error
|
|
439
|
-
createdAt
|
|
440
|
-
completedAt
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
`;
|
|
444
|
-
gql`
|
|
445
|
-
mutation CreateDocument($document: JSONObject!, $parentIdentifier: String) {
|
|
446
|
-
createDocument(document: $document, parentIdentifier: $parentIdentifier) {
|
|
447
|
-
...PHDocumentFields
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
${PhDocumentFieldsFragmentDoc}
|
|
451
|
-
`;
|
|
452
|
-
gql`
|
|
453
|
-
mutation CreateEmptyDocument(
|
|
454
|
-
$documentType: String!
|
|
455
|
-
$parentIdentifier: String
|
|
456
|
-
) {
|
|
457
|
-
createEmptyDocument(
|
|
458
|
-
documentType: $documentType
|
|
459
|
-
parentIdentifier: $parentIdentifier
|
|
460
|
-
) {
|
|
461
|
-
...PHDocumentFields
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
${PhDocumentFieldsFragmentDoc}
|
|
465
|
-
`;
|
|
466
|
-
gql`
|
|
467
|
-
mutation MutateDocument(
|
|
468
|
-
$documentIdentifier: String!
|
|
469
|
-
$actions: [JSONObject!]!
|
|
470
|
-
$view: ViewFilterInput
|
|
471
|
-
) {
|
|
472
|
-
mutateDocument(
|
|
473
|
-
documentIdentifier: $documentIdentifier
|
|
474
|
-
actions: $actions
|
|
475
|
-
view: $view
|
|
476
|
-
) {
|
|
477
|
-
...PHDocumentFields
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
${PhDocumentFieldsFragmentDoc}
|
|
481
|
-
`;
|
|
482
|
-
gql`
|
|
483
|
-
mutation MutateDocumentAsync(
|
|
484
|
-
$documentIdentifier: String!
|
|
485
|
-
$actions: [JSONObject!]!
|
|
486
|
-
$view: ViewFilterInput
|
|
487
|
-
) {
|
|
488
|
-
mutateDocumentAsync(
|
|
489
|
-
documentIdentifier: $documentIdentifier
|
|
490
|
-
actions: $actions
|
|
491
|
-
view: $view
|
|
492
|
-
)
|
|
493
|
-
}
|
|
494
|
-
`;
|
|
495
|
-
gql`
|
|
496
|
-
mutation RenameDocument(
|
|
497
|
-
$documentIdentifier: String!
|
|
498
|
-
$name: String!
|
|
499
|
-
$branch: String
|
|
500
|
-
) {
|
|
501
|
-
renameDocument(
|
|
502
|
-
documentIdentifier: $documentIdentifier
|
|
503
|
-
name: $name
|
|
504
|
-
branch: $branch
|
|
505
|
-
) {
|
|
506
|
-
...PHDocumentFields
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
${PhDocumentFieldsFragmentDoc}
|
|
510
|
-
`;
|
|
511
|
-
gql`
|
|
512
|
-
mutation SetPreferredEditor(
|
|
513
|
-
$documentIdentifier: String!
|
|
514
|
-
$preferredEditor: String
|
|
515
|
-
$branch: String
|
|
516
|
-
) {
|
|
517
|
-
setPreferredEditor(
|
|
518
|
-
documentIdentifier: $documentIdentifier
|
|
519
|
-
preferredEditor: $preferredEditor
|
|
520
|
-
branch: $branch
|
|
521
|
-
) {
|
|
522
|
-
...PHDocumentFields
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
${PhDocumentFieldsFragmentDoc}
|
|
526
|
-
`;
|
|
527
|
-
gql`
|
|
528
|
-
mutation AddRelationship(
|
|
529
|
-
$sourceIdentifier: String!
|
|
530
|
-
$targetIdentifier: String!
|
|
531
|
-
$relationshipType: String!
|
|
532
|
-
$branch: String
|
|
533
|
-
) {
|
|
534
|
-
addRelationship(
|
|
535
|
-
sourceIdentifier: $sourceIdentifier
|
|
536
|
-
targetIdentifier: $targetIdentifier
|
|
537
|
-
relationshipType: $relationshipType
|
|
538
|
-
branch: $branch
|
|
539
|
-
) {
|
|
540
|
-
...PHDocumentFields
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
${PhDocumentFieldsFragmentDoc}
|
|
544
|
-
`;
|
|
545
|
-
gql`
|
|
546
|
-
mutation RemoveRelationship(
|
|
547
|
-
$sourceIdentifier: String!
|
|
548
|
-
$targetIdentifier: String!
|
|
549
|
-
$relationshipType: String!
|
|
550
|
-
$branch: String
|
|
551
|
-
) {
|
|
552
|
-
removeRelationship(
|
|
553
|
-
sourceIdentifier: $sourceIdentifier
|
|
554
|
-
targetIdentifier: $targetIdentifier
|
|
555
|
-
relationshipType: $relationshipType
|
|
556
|
-
branch: $branch
|
|
557
|
-
) {
|
|
558
|
-
...PHDocumentFields
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
${PhDocumentFieldsFragmentDoc}
|
|
562
|
-
`;
|
|
563
|
-
gql`
|
|
564
|
-
mutation MoveRelationship(
|
|
565
|
-
$sourceParentIdentifier: String!
|
|
566
|
-
$targetParentIdentifier: String!
|
|
567
|
-
$targetIdentifier: String!
|
|
568
|
-
$relationshipType: String!
|
|
569
|
-
$branch: String
|
|
570
|
-
) {
|
|
571
|
-
moveRelationship(
|
|
572
|
-
sourceParentIdentifier: $sourceParentIdentifier
|
|
573
|
-
targetParentIdentifier: $targetParentIdentifier
|
|
574
|
-
targetIdentifier: $targetIdentifier
|
|
575
|
-
relationshipType: $relationshipType
|
|
576
|
-
branch: $branch
|
|
577
|
-
) {
|
|
578
|
-
source {
|
|
579
|
-
...PHDocumentFields
|
|
580
|
-
}
|
|
581
|
-
target {
|
|
582
|
-
...PHDocumentFields
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
${PhDocumentFieldsFragmentDoc}
|
|
587
|
-
`;
|
|
588
|
-
gql`
|
|
589
|
-
mutation DeleteDocument($identifier: String!, $propagate: PropagationMode) {
|
|
590
|
-
deleteDocument(identifier: $identifier, propagate: $propagate)
|
|
591
|
-
}
|
|
592
|
-
`;
|
|
593
|
-
gql`
|
|
594
|
-
mutation DeleteDocuments(
|
|
595
|
-
$identifiers: [String!]!
|
|
596
|
-
$propagate: PropagationMode
|
|
597
|
-
) {
|
|
598
|
-
deleteDocuments(identifiers: $identifiers, propagate: $propagate)
|
|
599
|
-
}
|
|
600
|
-
`;
|
|
601
|
-
gql`
|
|
602
|
-
subscription DocumentChanges(
|
|
603
|
-
$search: SearchFilterInput
|
|
604
|
-
$view: ViewFilterInput
|
|
605
|
-
) {
|
|
606
|
-
documentChanges(search: $search, view: $view) {
|
|
607
|
-
type
|
|
608
|
-
documents {
|
|
609
|
-
...PHDocumentFields
|
|
610
|
-
}
|
|
611
|
-
context {
|
|
612
|
-
parentId
|
|
613
|
-
childId
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
${PhDocumentFieldsFragmentDoc}
|
|
618
|
-
`;
|
|
619
|
-
gql`
|
|
620
|
-
subscription JobChanges($jobId: String!) {
|
|
621
|
-
jobChanges(jobId: $jobId) {
|
|
622
|
-
jobId
|
|
623
|
-
status
|
|
624
|
-
result
|
|
625
|
-
error
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
`;
|
|
629
|
-
gql`
|
|
630
|
-
query PollSyncEnvelopes(
|
|
631
|
-
$channelId: String!
|
|
632
|
-
$outboxAck: Int!
|
|
633
|
-
$outboxLatest: Int!
|
|
634
|
-
) {
|
|
635
|
-
pollSyncEnvelopes(
|
|
636
|
-
channelId: $channelId
|
|
637
|
-
outboxAck: $outboxAck
|
|
638
|
-
outboxLatest: $outboxLatest
|
|
639
|
-
) {
|
|
640
|
-
envelopes {
|
|
641
|
-
type
|
|
642
|
-
channelMeta {
|
|
643
|
-
id
|
|
644
|
-
}
|
|
645
|
-
operations {
|
|
646
|
-
operation {
|
|
647
|
-
index
|
|
648
|
-
timestampUtcMs
|
|
649
|
-
hash
|
|
650
|
-
skip
|
|
651
|
-
error
|
|
652
|
-
id
|
|
653
|
-
action {
|
|
654
|
-
id
|
|
655
|
-
type
|
|
656
|
-
timestampUtcMs
|
|
657
|
-
input
|
|
658
|
-
scope
|
|
659
|
-
context {
|
|
660
|
-
signer {
|
|
661
|
-
user {
|
|
662
|
-
address
|
|
663
|
-
networkId
|
|
664
|
-
chainId
|
|
665
|
-
}
|
|
666
|
-
app {
|
|
667
|
-
name
|
|
668
|
-
key
|
|
669
|
-
}
|
|
670
|
-
signatures
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
context {
|
|
676
|
-
documentId
|
|
677
|
-
documentType
|
|
678
|
-
scope
|
|
679
|
-
branch
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
cursor {
|
|
683
|
-
remoteName
|
|
684
|
-
cursorOrdinal
|
|
685
|
-
lastSyncedAtUtcMs
|
|
686
|
-
}
|
|
687
|
-
key
|
|
688
|
-
dependsOn
|
|
689
|
-
}
|
|
690
|
-
ackOrdinal
|
|
691
|
-
deadLetters {
|
|
692
|
-
documentId
|
|
693
|
-
error
|
|
694
|
-
}
|
|
695
|
-
hasMore
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
`;
|
|
699
|
-
gql`
|
|
700
|
-
mutation TouchChannel($input: TouchChannelInput!) {
|
|
701
|
-
touchChannel(input: $input) {
|
|
702
|
-
success
|
|
703
|
-
ackOrdinal
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
`;
|
|
707
|
-
gql`
|
|
708
|
-
mutation PushSyncEnvelopes($envelopes: [SyncEnvelopeInput!]!) {
|
|
709
|
-
pushSyncEnvelopes(envelopes: $envelopes)
|
|
710
|
-
}
|
|
711
|
-
`;
|
|
712
|
-
/** Get the source string from a GraphQL document (string or DocumentNode). */
|
|
713
|
-
function getDocumentSource(doc) {
|
|
714
|
-
return typeof doc === "string" ? doc : doc.loc?.source.body ?? "";
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Extract the inner selection set of a named field from a GraphQL document source.
|
|
718
|
-
* Returns the `{ ... }` block including braces.
|
|
719
|
-
*/
|
|
720
|
-
function extractSelectionSet(doc, fieldName, fallback) {
|
|
721
|
-
const source = getDocumentSource(doc);
|
|
722
|
-
return new RegExp(`${fieldName}\\([^)]*\\)\\s*(\\{[\\s\\S]*\\})\\s*\\}`).exec(source)?.[1] ?? fallback;
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* Extract the query body and any fragment definitions from a GraphQL document.
|
|
726
|
-
* Returns { body, fragments } where body is the content inside the query `{ ... }`
|
|
727
|
-
* and fragments are any trailing fragment definitions.
|
|
728
|
-
*/
|
|
729
|
-
function extractQueryParts(doc, fallbackBody) {
|
|
730
|
-
const source = getDocumentSource(doc);
|
|
731
|
-
const queryMatch = /^[^{]*\{([\s\S]*?)\}\s*(fragment[\s\S]*)?$/.exec(source);
|
|
732
|
-
return {
|
|
733
|
-
body: queryMatch?.[1]?.trim() ?? fallbackBody,
|
|
734
|
-
fragments: queryMatch?.[2]?.trim() ?? ""
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
extractSelectionSet(GetDocumentOperationsDocument, "documentOperations", "{ items { index } }");
|
|
738
|
-
extractQueryParts(GetDocumentDocument, "document(identifier: $identifier) { document { id name documentType state revisionsList { scope revision } createdAtUtcIso lastModifiedAtUtcIso } childIds }");
|
|
739
|
-
//#endregion
|
|
740
|
-
//#region ../reactor-browser/dist/renown-D-1c_Bvx.js
|
|
741
|
-
const { useValue: useLoading, setValue: setLoading, addEventHandler: addLoadingEventHandler } = makePHEventFunctions("loading");
|
|
742
|
-
const renownEventFunctions = makePHEventFunctions("renown");
|
|
743
|
-
renownEventFunctions.addEventHandler;
|
|
744
|
-
/** Returns the renown instance */
|
|
745
|
-
const useRenown = renownEventFunctions.useValue;
|
|
746
|
-
renownEventFunctions.setValue;
|
|
747
|
-
/** Returns the current user from the renown instance, subscribing to user events */
|
|
748
|
-
function useUser() {
|
|
749
|
-
const renown = useRenown();
|
|
750
|
-
const [user, setUser] = useState(renown?.user);
|
|
751
|
-
useEffect(() => {
|
|
752
|
-
setUser(renown?.user);
|
|
753
|
-
if (!renown) return;
|
|
754
|
-
return renown.on("user", setUser);
|
|
755
|
-
}, [renown]);
|
|
756
|
-
return user;
|
|
757
|
-
}
|
|
758
|
-
function mergeProps(parentProps, childProps) {
|
|
759
|
-
const merged = { ...parentProps };
|
|
760
|
-
for (const key of Object.keys(childProps)) {
|
|
761
|
-
const parentValue = parentProps[key];
|
|
762
|
-
const childValue = childProps[key];
|
|
763
|
-
if (key === "style") merged[key] = {
|
|
764
|
-
...parentValue,
|
|
765
|
-
...childValue
|
|
766
|
-
};
|
|
767
|
-
else if (key === "className") merged[key] = [parentValue, childValue].filter(Boolean).join(" ");
|
|
768
|
-
else if (typeof parentValue === "function" && typeof childValue === "function") merged[key] = (...args) => {
|
|
769
|
-
childValue(...args);
|
|
770
|
-
parentValue(...args);
|
|
771
|
-
};
|
|
772
|
-
else if (childValue !== void 0) merged[key] = childValue;
|
|
773
|
-
}
|
|
774
|
-
return merged;
|
|
775
|
-
}
|
|
776
|
-
const Slot = forwardRef(({ children, ...props }, ref) => {
|
|
777
|
-
const child = Children.only(children);
|
|
778
|
-
if (!isValidElement(child)) return null;
|
|
779
|
-
const childElement = child;
|
|
780
|
-
const mergedProps = mergeProps(props, childElement.props);
|
|
781
|
-
if (ref) mergedProps.ref = ref;
|
|
782
|
-
return cloneElement(childElement, mergedProps);
|
|
783
|
-
});
|
|
784
|
-
Slot.displayName = "Slot";
|
|
785
|
-
//#endregion
|
|
786
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
|
|
787
|
-
function e$8(e, t, n) {
|
|
788
|
-
let r = (n) => e(n, ...t);
|
|
789
|
-
return n === void 0 ? r : Object.assign(r, {
|
|
790
|
-
lazy: n,
|
|
791
|
-
lazyArgs: t
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
//#endregion
|
|
795
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/purry.js
|
|
796
|
-
function t$5(t, n, r) {
|
|
797
|
-
let i = t.length - n.length;
|
|
798
|
-
if (i === 0) return t(...n);
|
|
799
|
-
if (i === 1) return e$8(t, n, r);
|
|
800
|
-
throw Error(`Wrong number of arguments`);
|
|
801
|
-
}
|
|
802
|
-
//#endregion
|
|
803
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/allPass.js
|
|
804
|
-
function t$4(...t) {
|
|
805
|
-
return t$5(n$4, t);
|
|
806
|
-
}
|
|
807
|
-
const n$4 = (e, t) => t.every((t) => t(e));
|
|
808
|
-
//#endregion
|
|
809
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/conditional-CTEJD5TX.js
|
|
810
|
-
function e$7(e, t, n) {
|
|
811
|
-
return e(n[0]) ? (e) => t(e, ...n) : t(...n);
|
|
812
|
-
}
|
|
813
|
-
function t$3(...t) {
|
|
814
|
-
return e$7(r, n$3, t);
|
|
815
|
-
}
|
|
816
|
-
function n$3(e, ...t) {
|
|
817
|
-
for (let n of t) {
|
|
818
|
-
if (typeof n == `function`) return n(e);
|
|
819
|
-
let [t, r] = n;
|
|
820
|
-
if (t(e)) return r(e);
|
|
821
|
-
}
|
|
822
|
-
throw Error(`conditional: data failed for all cases`);
|
|
823
|
-
}
|
|
824
|
-
function r(e) {
|
|
825
|
-
if (!Array.isArray(e)) return !1;
|
|
826
|
-
let [t, n, ...r] = e;
|
|
827
|
-
return typeof t == `function` && t.length <= 1 && typeof n == `function` && n.length <= 1 && r.length === 0;
|
|
828
|
-
}
|
|
829
|
-
//#endregion
|
|
830
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/constant.js
|
|
831
|
-
function e$6(e) {
|
|
832
|
-
return () => e;
|
|
833
|
-
}
|
|
834
|
-
//#endregion
|
|
835
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/hasAtLeast.js
|
|
836
|
-
function t$2(...t) {
|
|
837
|
-
return t$5(n$2, t);
|
|
838
|
-
}
|
|
839
|
-
const n$2 = (e, t) => e.length >= t;
|
|
840
|
-
//#endregion
|
|
841
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/funnel.js
|
|
842
|
-
const e$5 = Symbol(`funnel/voidReducer`), t$1 = () => e$5;
|
|
843
|
-
function n$1(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs: a, minGapMs: o, reducer: s = t$1 }) {
|
|
844
|
-
let c, l, u, d, f = () => {
|
|
845
|
-
let t = u;
|
|
846
|
-
t !== void 0 && (u = void 0, t === e$5 ? n() : n(t), o !== void 0 && (l = setTimeout(p, o)));
|
|
847
|
-
}, p = () => {
|
|
848
|
-
clearTimeout(l), l = void 0, c === void 0 && f();
|
|
849
|
-
}, m = () => {
|
|
850
|
-
clearTimeout(c), c = void 0, d = void 0, l === void 0 && f();
|
|
851
|
-
};
|
|
852
|
-
return {
|
|
853
|
-
call: (...e) => {
|
|
854
|
-
let t = c === void 0 && l === void 0;
|
|
855
|
-
if ((r !== `start` || t) && (u = s(u, ...e)), !(c === void 0 && !t)) {
|
|
856
|
-
if (i !== void 0 || a !== void 0 || o === void 0) {
|
|
857
|
-
clearTimeout(c);
|
|
858
|
-
let e = Date.now();
|
|
859
|
-
d ??= e;
|
|
860
|
-
let t = a === void 0 ? i ?? 0 : Math.min(i ?? a, Math.max(0, a - (e - d)));
|
|
861
|
-
c = setTimeout(m, t);
|
|
862
|
-
}
|
|
863
|
-
r !== `end` && t && f();
|
|
864
|
-
}
|
|
865
|
-
},
|
|
866
|
-
cancel: () => {
|
|
867
|
-
clearTimeout(c), c = void 0, d = void 0, clearTimeout(l), l = void 0, u = void 0;
|
|
868
|
-
},
|
|
869
|
-
flush: () => {
|
|
870
|
-
m(), p();
|
|
871
|
-
},
|
|
872
|
-
get isIdle() {
|
|
873
|
-
return c === void 0 && l === void 0;
|
|
874
|
-
}
|
|
875
|
-
};
|
|
876
|
-
}
|
|
877
|
-
//#endregion
|
|
878
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isDefined.js
|
|
879
|
-
function e$4(e) {
|
|
880
|
-
return e !== void 0;
|
|
881
|
-
}
|
|
882
|
-
//#endregion
|
|
883
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isNot.js
|
|
884
|
-
function e$3(e) {
|
|
885
|
-
return (t) => !e(t);
|
|
886
|
-
}
|
|
887
|
-
//#endregion
|
|
888
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isStrictEqual.js
|
|
889
|
-
function t(...t) {
|
|
890
|
-
return t$5(n, t);
|
|
891
|
-
}
|
|
892
|
-
const n = (e, t) => e === t || Object.is(e, t);
|
|
893
|
-
//#endregion
|
|
894
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isString.js
|
|
895
|
-
function e$2(e) {
|
|
896
|
-
return typeof e == `string`;
|
|
897
|
-
}
|
|
898
|
-
//#endregion
|
|
899
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isTruthy.js
|
|
900
|
-
function e$1(e) {
|
|
901
|
-
return !!e;
|
|
902
|
-
}
|
|
903
|
-
//#endregion
|
|
904
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/once.js
|
|
905
|
-
function e(e) {
|
|
906
|
-
let t = !1, n;
|
|
907
|
-
return () => (t ||= (n = e(), !0), n);
|
|
908
|
-
}
|
|
909
|
-
//#endregion
|
|
910
|
-
//#region ../../node_modules/.pnpm/slug@11.0.1/node_modules/slug/slug.js
|
|
911
|
-
let base64;
|
|
912
|
-
if (typeof window !== "undefined") if (window.btoa) base64 = function(input) {
|
|
913
|
-
return btoa(unescape(encodeURIComponent(input)));
|
|
914
|
-
};
|
|
915
|
-
else base64 = function(input) {
|
|
916
|
-
const str = unescape(encodeURIComponent(input + ""));
|
|
917
|
-
let output = "";
|
|
918
|
-
for (let block, charCode, idx = 0, map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; str.charAt(idx | 0) || (map = "=", idx % 1); output += map.charAt(63 & block >> 8 - idx % 1 * 8)) {
|
|
919
|
-
charCode = str.charCodeAt(idx += 3 / 4);
|
|
920
|
-
/* c8 ignore next 3 */
|
|
921
|
-
if (charCode > 255) throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
|
|
922
|
-
block = block << 8 | charCode;
|
|
923
|
-
}
|
|
924
|
-
return output;
|
|
925
|
-
};
|
|
926
|
-
else base64 = function(input) {
|
|
927
|
-
return Buffer.from(input).toString("base64");
|
|
928
|
-
};
|
|
929
|
-
function slug(string, opts) {
|
|
930
|
-
let result = slugify(string, opts);
|
|
931
|
-
if ((opts && opts.fallback !== void 0 ? opts.fallback : slug.defaults.fallback) === true && result === "") result = slugify(base64(string), opts);
|
|
932
|
-
return result;
|
|
246
|
+
//#region ../../node_modules/.pnpm/slug@11.0.1/node_modules/slug/slug.js
|
|
247
|
+
let base64;
|
|
248
|
+
if (typeof window !== "undefined") if (window.btoa) base64 = function(input) {
|
|
249
|
+
return btoa(unescape(encodeURIComponent(input)));
|
|
250
|
+
};
|
|
251
|
+
else base64 = function(input) {
|
|
252
|
+
const str = unescape(encodeURIComponent(input + ""));
|
|
253
|
+
let output = "";
|
|
254
|
+
for (let block, charCode, idx = 0, map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; str.charAt(idx | 0) || (map = "=", idx % 1); output += map.charAt(63 & block >> 8 - idx % 1 * 8)) {
|
|
255
|
+
charCode = str.charCodeAt(idx += 3 / 4);
|
|
256
|
+
/* c8 ignore next 3 */
|
|
257
|
+
if (charCode > 255) throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
|
|
258
|
+
block = block << 8 | charCode;
|
|
259
|
+
}
|
|
260
|
+
return output;
|
|
261
|
+
};
|
|
262
|
+
else base64 = function(input) {
|
|
263
|
+
return Buffer.from(input).toString("base64");
|
|
264
|
+
};
|
|
265
|
+
function slug(string, opts) {
|
|
266
|
+
let result = slugify(string, opts);
|
|
267
|
+
if ((opts && opts.fallback !== void 0 ? opts.fallback : slug.defaults.fallback) === true && result === "") result = slugify(base64(string), opts);
|
|
268
|
+
return result;
|
|
933
269
|
}
|
|
934
270
|
const locales = {
|
|
935
271
|
bg: {
|
|
@@ -1693,715 +1029,1065 @@ slug.setLocale = function(locale) {
|
|
|
1693
1029
|
defaultLocale = locales[locale] || {};
|
|
1694
1030
|
};
|
|
1695
1031
|
//#endregion
|
|
1696
|
-
//#region
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
"message",
|
|
1705
|
-
"stack",
|
|
1706
|
-
"cause",
|
|
1707
|
-
"errors"
|
|
1708
|
-
];
|
|
1709
|
-
const normalizeDescriptor = (error, propName) => {
|
|
1710
|
-
const descriptor = getDescriptor(error, propName);
|
|
1711
|
-
if (descriptor === void 0) return;
|
|
1712
|
-
if (isReadonlyGetter(descriptor)) {
|
|
1713
|
-
setErrorProperty(error, propName, error[propName]);
|
|
1714
|
-
return;
|
|
1032
|
+
//#region ../reactor-browser/dist/document-model-modules-DMIR-uSD.js
|
|
1033
|
+
var UnsupportedDocumentTypeError = class extends Error {
|
|
1034
|
+
constructor(documentType) {
|
|
1035
|
+
super(`Document type ${documentType} is not supported`);
|
|
1036
|
+
this.name = "UnsupportedDocumentTypeError";
|
|
1037
|
+
}
|
|
1038
|
+
static isError(error) {
|
|
1039
|
+
return Error.isError(error) && error.name === "UnsupportedDocumentTypeError";
|
|
1715
1040
|
}
|
|
1716
|
-
if (isInvalidDescriptor(descriptor)) setErrorDescriptor(error, propName, descriptor);
|
|
1717
|
-
};
|
|
1718
|
-
const getDescriptor = (value, propName) => {
|
|
1719
|
-
const descriptor = Object.getOwnPropertyDescriptor(value, propName);
|
|
1720
|
-
if (descriptor !== void 0) return descriptor;
|
|
1721
|
-
const prototype = Object.getPrototypeOf(value);
|
|
1722
|
-
return prototype === null ? void 0 : getDescriptor(prototype, propName);
|
|
1723
|
-
};
|
|
1724
|
-
const isReadonlyGetter = ({ get, set }) => get !== void 0 && set === void 0;
|
|
1725
|
-
const isInvalidDescriptor = ({ enumerable, writable }) => enumerable || !writable;
|
|
1726
|
-
const setErrorProperty = (error, propName, value) => {
|
|
1727
|
-
setErrorDescriptor(error, propName, { value });
|
|
1728
1041
|
};
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
}
|
|
1042
|
+
var DocumentModelNotFoundError = class extends Error {
|
|
1043
|
+
documentType;
|
|
1044
|
+
name = "DocumentModelNotFoundError";
|
|
1045
|
+
constructor(documentType) {
|
|
1046
|
+
super(`Document model module for type ${documentType} not found`);
|
|
1047
|
+
this.documentType = documentType;
|
|
1048
|
+
}
|
|
1049
|
+
static isError(error) {
|
|
1050
|
+
return Error.isError(error) && error.name === "DocumentModelNotFoundError";
|
|
1051
|
+
}
|
|
1736
1052
|
};
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
else if (isAggregateError(error)) setErrorProperty(error, "errors", []);
|
|
1742
|
-
else if (error.errors !== void 0) deleteAggregateErrors(error);
|
|
1053
|
+
var DocumentTypeMismatchError = class extends Error {
|
|
1054
|
+
constructor(documentId, expectedType, actualType) {
|
|
1055
|
+
super(`Document ${documentId} is not of type ${expectedType}. Actual type: ${actualType}`);
|
|
1056
|
+
}
|
|
1743
1057
|
};
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
if (error.errors !== void 0) setErrorProperty(error, "errors", []);
|
|
1058
|
+
var NoSelectedDocumentError = class extends Error {
|
|
1059
|
+
constructor() {
|
|
1060
|
+
super("There is no selected document. Did you mean to call 'useSelectedDocumentSafe' instead?");
|
|
1061
|
+
}
|
|
1749
1062
|
};
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
const normalizeCause = (error, recurse) => {
|
|
1753
|
-
if (!("cause" in error)) return;
|
|
1754
|
-
const cause = error.cause === void 0 ? error.cause : recurse(error.cause);
|
|
1755
|
-
if (cause === void 0) delete error.cause;
|
|
1756
|
-
else setErrorProperty(error, "cause", cause);
|
|
1757
|
-
};
|
|
1758
|
-
//#endregion
|
|
1759
|
-
//#region ../../node_modules/.pnpm/is-error-instance@3.0.1/node_modules/is-error-instance/build/src/main.js
|
|
1760
|
-
const isErrorInstance = (value) => isInstanceOfError(value) || hasErrorTag(value);
|
|
1761
|
-
const isInstanceOfError = (value) => {
|
|
1762
|
-
try {
|
|
1763
|
-
return value instanceof Error;
|
|
1764
|
-
} catch {
|
|
1765
|
-
return false;
|
|
1766
|
-
}
|
|
1767
|
-
};
|
|
1768
|
-
const hasErrorTag = (value) => {
|
|
1769
|
-
try {
|
|
1770
|
-
return ERROR_TAGS.has(Object.prototype.toString.call(value));
|
|
1771
|
-
} catch {
|
|
1772
|
-
return false;
|
|
1773
|
-
}
|
|
1774
|
-
};
|
|
1775
|
-
const ERROR_TAGS = new Set([
|
|
1776
|
-
"[object Error]",
|
|
1777
|
-
"[object DOMException]",
|
|
1778
|
-
"[object DOMError]",
|
|
1779
|
-
"[object Exception]"
|
|
1780
|
-
]);
|
|
1781
|
-
//#endregion
|
|
1782
|
-
//#region ../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js
|
|
1783
|
-
function isPlainObject(value) {
|
|
1784
|
-
if (typeof value !== "object" || value === null) return false;
|
|
1785
|
-
const prototype = Object.getPrototypeOf(value);
|
|
1786
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
1063
|
+
function resolveUrlPathname(path) {
|
|
1064
|
+
return new URL(path.replace(/^\/+/, ""), window.location.origin + (window.ph?.basePath ?? "/")).pathname;
|
|
1787
1065
|
}
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
const
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1066
|
+
/** Returns the current path without the base path */
|
|
1067
|
+
function getPathWithoutBase(path) {
|
|
1068
|
+
const basePath = window.ph?.basePath ?? "/";
|
|
1069
|
+
return path.replace(basePath, basePath.endsWith("/") ? "/" : "");
|
|
1070
|
+
}
|
|
1071
|
+
/** Makes a URL component for a node. */
|
|
1072
|
+
function makeNodeSlug(node) {
|
|
1073
|
+
if (!node) return "";
|
|
1074
|
+
const nodeName = node.name;
|
|
1075
|
+
if (!nodeName) return slug(node.id);
|
|
1076
|
+
return slug(`${nodeName}-${node.id}`);
|
|
1077
|
+
}
|
|
1078
|
+
/** Extracts the node slug from a path.
|
|
1079
|
+
*
|
|
1080
|
+
* The path is expected to be in the format `/d/<drive-slug>/<node-slug>`.
|
|
1081
|
+
*/
|
|
1082
|
+
function extractNodeSlugFromPath(path) {
|
|
1083
|
+
const currentPath = getPathWithoutBase(path);
|
|
1084
|
+
return /^\/d\/[^/]+\/([^/]+)$/.exec(currentPath)?.[1];
|
|
1085
|
+
}
|
|
1086
|
+
/** Finds a UUID in a string, used for extracting node ids from node slugs in the URL. */
|
|
1087
|
+
function findUuid(input) {
|
|
1088
|
+
if (!input) return void 0;
|
|
1089
|
+
return /\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/.exec(input)?.[0];
|
|
1090
|
+
}
|
|
1091
|
+
function extractNodeIdFromSlug(nodeSlug) {
|
|
1092
|
+
return findUuid(nodeSlug);
|
|
1093
|
+
}
|
|
1094
|
+
/** Extracts the drive slug from a path.
|
|
1095
|
+
* Used for extracting drive ids from drive slugs in the URL.
|
|
1096
|
+
* Expects the path to be in the format `/d/<drive-slug>`.
|
|
1097
|
+
*/
|
|
1098
|
+
function extractDriveSlugFromPath(path) {
|
|
1099
|
+
const currentPath = getPathWithoutBase(path);
|
|
1100
|
+
return /^\/d\/([^/]+)/.exec(currentPath)?.[1] ?? "";
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Creates a URL string with the given pathname while preserving existing query parameters.
|
|
1104
|
+
*/
|
|
1105
|
+
function createUrlWithPreservedParams(pathname) {
|
|
1106
|
+
const search = window.location.search;
|
|
1107
|
+
return search ? `${pathname}${search}` : pathname;
|
|
1108
|
+
}
|
|
1109
|
+
const drivesEventFunctions = makePHEventFunctions("drives");
|
|
1110
|
+
/** Returns all of the drives in the reactor */
|
|
1111
|
+
const useDrives = drivesEventFunctions.useValue;
|
|
1112
|
+
/** Sets the drives in the reactor */
|
|
1113
|
+
const setDrives = drivesEventFunctions.setValue;
|
|
1114
|
+
drivesEventFunctions.addEventHandler;
|
|
1115
|
+
const selectedNodeIdEventFunctions = makePHEventFunctions("selectedNodeId");
|
|
1116
|
+
const useSelectedNodeId = selectedNodeIdEventFunctions.useValue;
|
|
1117
|
+
const setSelectedNodeId = selectedNodeIdEventFunctions.setValue;
|
|
1118
|
+
selectedNodeIdEventFunctions.addEventHandler;
|
|
1119
|
+
/** Sets the selected node (file or folder). */
|
|
1120
|
+
function setSelectedNode(nodeOrNodeSlug) {
|
|
1121
|
+
const nodeSlug = typeof nodeOrNodeSlug === "string" ? nodeOrNodeSlug : makeNodeSlug(nodeOrNodeSlug);
|
|
1122
|
+
setSelectedNodeId(extractNodeIdFromSlug(nodeSlug));
|
|
1123
|
+
const driveSlugFromPath = extractDriveSlugFromPath(window.location.pathname);
|
|
1124
|
+
if (!driveSlugFromPath) return;
|
|
1125
|
+
if (!nodeSlug) {
|
|
1126
|
+
const pathname = resolveUrlPathname(`/d/${driveSlugFromPath}`);
|
|
1127
|
+
if (pathname === window.location.pathname) return;
|
|
1128
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
1129
|
+
return;
|
|
1801
1130
|
}
|
|
1802
|
-
};
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
const
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
const value = object[propName];
|
|
1829
|
-
const { enumerable, configurable, writable = true } = getDescriptor(object, propName);
|
|
1830
|
-
Object.defineProperty(objectCopy, propName, {
|
|
1831
|
-
value,
|
|
1832
|
-
enumerable,
|
|
1833
|
-
configurable,
|
|
1834
|
-
writable
|
|
1835
|
-
});
|
|
1836
|
-
} catch {}
|
|
1837
|
-
return objectCopy;
|
|
1838
|
-
};
|
|
1839
|
-
const getPropsToCopy = (object) => {
|
|
1840
|
-
const propNames = getOwnKeys(object);
|
|
1841
|
-
for (const propName of CORE_ERROR_PROPS) if (isInheritedProp(object, propName)) propNames.push(propName);
|
|
1842
|
-
return propNames;
|
|
1843
|
-
};
|
|
1844
|
-
const getOwnKeys = (object) => {
|
|
1845
|
-
try {
|
|
1846
|
-
return Reflect.ownKeys(object);
|
|
1847
|
-
} catch {
|
|
1848
|
-
return [];
|
|
1131
|
+
const pathname = resolveUrlPathname(`/d/${driveSlugFromPath}/${nodeSlug}`);
|
|
1132
|
+
if (pathname === window.location.pathname) return;
|
|
1133
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
1134
|
+
}
|
|
1135
|
+
const selectedDriveIdEventFunctions = makePHEventFunctions("selectedDriveId");
|
|
1136
|
+
/** Returns the selected drive id */
|
|
1137
|
+
const useSelectedDriveId = selectedDriveIdEventFunctions.useValue;
|
|
1138
|
+
/** Sets the selected drive id */
|
|
1139
|
+
const setSelectedDriveId = selectedDriveIdEventFunctions.setValue;
|
|
1140
|
+
selectedDriveIdEventFunctions.addEventHandler;
|
|
1141
|
+
/** Returns the selected drive, or undefined if no drive is selected */
|
|
1142
|
+
function useSelectedDriveSafe() {
|
|
1143
|
+
const selectedDriveId = useSelectedDriveId();
|
|
1144
|
+
const selectedDrive = useDrives()?.find((drive) => drive.header.id === selectedDriveId);
|
|
1145
|
+
const [drive, dispatch] = useDispatch(selectedDrive);
|
|
1146
|
+
if (!selectedDrive) return [void 0, void 0];
|
|
1147
|
+
return [drive, dispatch];
|
|
1148
|
+
}
|
|
1149
|
+
function setSelectedDrive(driveOrDriveSlug) {
|
|
1150
|
+
const driveSlug = typeof driveOrDriveSlug === "string" ? driveOrDriveSlug : driveOrDriveSlug?.header.slug;
|
|
1151
|
+
const drives = window.ph?.drives;
|
|
1152
|
+
const driveId = (typeof driveOrDriveSlug === "object" && driveOrDriveSlug !== null ? driveOrDriveSlug : drives?.find((d) => d.header.slug === driveSlug))?.header.id;
|
|
1153
|
+
if (!driveId && driveSlug && extractDriveSlugFromPath(window.location.pathname) === driveSlug) {
|
|
1154
|
+
if (window.ph?.selectedDriveId) setSelectedDriveId(void 0);
|
|
1155
|
+
deferDriveSelection(driveSlug);
|
|
1156
|
+
return;
|
|
1849
1157
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1158
|
+
cancelPendingDriveSelection();
|
|
1159
|
+
setSelectedDriveId(driveId);
|
|
1160
|
+
if (!driveId) {
|
|
1161
|
+
const pathname = resolveUrlPathname("/");
|
|
1162
|
+
if (pathname === window.location.pathname) return;
|
|
1163
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
1164
|
+
return;
|
|
1856
1165
|
}
|
|
1857
|
-
};
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1166
|
+
const pathname = resolveUrlPathname(`/d/${driveSlug}`);
|
|
1167
|
+
if (pathname === window.location.pathname) return;
|
|
1168
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
1169
|
+
}
|
|
1170
|
+
const DEFERRED_DRIVE_TICK_MS = 2e3;
|
|
1171
|
+
const DEFERRED_DRIVE_MAX_WAIT_MS = 15e3;
|
|
1172
|
+
function isInitialSyncInFlight() {
|
|
1173
|
+
const remotes = window.ph?.reactorClientModule?.reactorModule?.syncModule?.syncManager?.list();
|
|
1174
|
+
if (!remotes?.length) return false;
|
|
1175
|
+
return remotes.some((remote) => {
|
|
1176
|
+
try {
|
|
1177
|
+
const snapshot = remote.channel.getConnectionState();
|
|
1178
|
+
return snapshot.receivingPages || !snapshot.lastSuccessUtcMs && snapshot.state !== "error";
|
|
1179
|
+
} catch {
|
|
1180
|
+
return false;
|
|
1181
|
+
}
|
|
1872
1182
|
});
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
} catch {
|
|
1881
|
-
return safeStringify(object);
|
|
1183
|
+
}
|
|
1184
|
+
let pendingHandler;
|
|
1185
|
+
let pendingTimeout;
|
|
1186
|
+
function cancelPendingDriveSelection() {
|
|
1187
|
+
if (pendingHandler) {
|
|
1188
|
+
window.removeEventListener("ph:drivesUpdated", pendingHandler);
|
|
1189
|
+
pendingHandler = void 0;
|
|
1882
1190
|
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
return String(object);
|
|
1887
|
-
} catch {
|
|
1888
|
-
return "Invalid error";
|
|
1889
|
-
}
|
|
1890
|
-
};
|
|
1891
|
-
const truncateMessage = (message) => message.length < MESSAGE_MAX_SIZE ? message : `${message.slice(0, MESSAGE_MAX_SIZE)}...`;
|
|
1892
|
-
const MESSAGE_MAX_SIZE = 1e3;
|
|
1893
|
-
const newError = (name, message) => {
|
|
1894
|
-
if (name === "AggregateError" && "AggregateError" in globalThis) return new AggregateError([], message);
|
|
1895
|
-
if (name in NATIVE_ERRORS) return new NATIVE_ERRORS[name](message);
|
|
1896
|
-
return new Error(message);
|
|
1897
|
-
};
|
|
1898
|
-
const NATIVE_ERRORS = {
|
|
1899
|
-
Error,
|
|
1900
|
-
ReferenceError,
|
|
1901
|
-
TypeError,
|
|
1902
|
-
SyntaxError,
|
|
1903
|
-
RangeError,
|
|
1904
|
-
URIError,
|
|
1905
|
-
EvalError
|
|
1906
|
-
};
|
|
1907
|
-
const assignObjectProps = (error, object) => {
|
|
1908
|
-
for (const propName in object) if (!(propName in error)) error[propName] = object[propName];
|
|
1909
|
-
};
|
|
1910
|
-
const setNewErrorProperty = (error, propName, propValue) => {
|
|
1911
|
-
if (propValue !== void 0) setErrorProperty(error, propName, propValue);
|
|
1912
|
-
};
|
|
1913
|
-
//#endregion
|
|
1914
|
-
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/string.js
|
|
1915
|
-
const stringifyError = (value) => {
|
|
1916
|
-
try {
|
|
1917
|
-
const error = new Error(String(value));
|
|
1918
|
-
setStack(error);
|
|
1919
|
-
return error;
|
|
1920
|
-
} catch (error_) {
|
|
1921
|
-
return error_;
|
|
1922
|
-
}
|
|
1923
|
-
};
|
|
1924
|
-
//#endregion
|
|
1925
|
-
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/main.js
|
|
1926
|
-
const { toString: objectToString } = Object.prototype;
|
|
1927
|
-
const createError = (value) => {
|
|
1928
|
-
if (isErrorPlainObj(value)) return objectifyError(value);
|
|
1929
|
-
if (!isErrorInstance(value)) return stringifyError(value);
|
|
1930
|
-
if (isInvalidError(value)) return objectifyError(value);
|
|
1931
|
-
return value;
|
|
1932
|
-
};
|
|
1933
|
-
const isErrorPlainObj = (value) => {
|
|
1934
|
-
try {
|
|
1935
|
-
return isPlainObject(value);
|
|
1936
|
-
} catch {
|
|
1937
|
-
return false;
|
|
1191
|
+
if (pendingTimeout) {
|
|
1192
|
+
clearTimeout(pendingTimeout);
|
|
1193
|
+
pendingTimeout = void 0;
|
|
1938
1194
|
}
|
|
1195
|
+
}
|
|
1196
|
+
function deferDriveSelection(driveSlug) {
|
|
1197
|
+
cancelPendingDriveSelection();
|
|
1198
|
+
const nodeSlug = extractNodeSlugFromPath(window.location.pathname);
|
|
1199
|
+
const handler = () => {
|
|
1200
|
+
if (!window.ph?.drives?.find((d) => d.header.slug === driveSlug)) return;
|
|
1201
|
+
cancelPendingDriveSelection();
|
|
1202
|
+
setSelectedDrive(driveSlug);
|
|
1203
|
+
setSelectedNode(nodeSlug);
|
|
1204
|
+
};
|
|
1205
|
+
pendingHandler = handler;
|
|
1206
|
+
window.addEventListener("ph:drivesUpdated", handler);
|
|
1207
|
+
const deadline = Date.now() + DEFERRED_DRIVE_MAX_WAIT_MS;
|
|
1208
|
+
const scheduleTick = () => {
|
|
1209
|
+
pendingTimeout = setTimeout(() => {
|
|
1210
|
+
if (Date.now() < deadline && isInitialSyncInFlight()) {
|
|
1211
|
+
scheduleTick();
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
cancelPendingDriveSelection();
|
|
1215
|
+
const pathname = resolveUrlPathname("/");
|
|
1216
|
+
if (pathname === window.location.pathname) return;
|
|
1217
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
1218
|
+
}, DEFERRED_DRIVE_TICK_MS);
|
|
1219
|
+
};
|
|
1220
|
+
scheduleTick();
|
|
1221
|
+
}
|
|
1222
|
+
/** Sorts nodes by name. */
|
|
1223
|
+
function sortNodesByName(nodes) {
|
|
1224
|
+
return nodes.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
1225
|
+
}
|
|
1226
|
+
/** Returns whether a node is a file. */
|
|
1227
|
+
function isFileNodeKind(node) {
|
|
1228
|
+
if (!node) return false;
|
|
1229
|
+
return node.kind.toUpperCase() === "FILE";
|
|
1230
|
+
}
|
|
1231
|
+
/** Returns whether a node is a folder. */
|
|
1232
|
+
function isFolderNodeKind(node) {
|
|
1233
|
+
if (!node) return false;
|
|
1234
|
+
return node.kind.toUpperCase() === "FOLDER";
|
|
1235
|
+
}
|
|
1236
|
+
/** Returns the nodes in the selected drive. */
|
|
1237
|
+
function useNodesInSelectedDrive() {
|
|
1238
|
+
const [selectedDrive] = useSelectedDriveSafe();
|
|
1239
|
+
return selectedDrive?.state.global.nodes;
|
|
1240
|
+
}
|
|
1241
|
+
/** Returns the folder nodes in the selected drive. */
|
|
1242
|
+
function useFolderNodesInSelectedDrive() {
|
|
1243
|
+
return useNodesInSelectedDrive()?.filter((n) => isFolderNodeKind(n));
|
|
1244
|
+
}
|
|
1245
|
+
/** Returns the selected node. */
|
|
1246
|
+
function useSelectedNode() {
|
|
1247
|
+
const selectedNodeId = useSelectedNodeId();
|
|
1248
|
+
return useNodesInSelectedDrive()?.find((n) => n.id === selectedNodeId);
|
|
1249
|
+
}
|
|
1250
|
+
const vetraPackageManagerFunctions = makePHEventFunctions("vetraPackageManager");
|
|
1251
|
+
const useVetraPackageManager = vetraPackageManagerFunctions.useValue;
|
|
1252
|
+
/** Returns all of the Vetra packages loaded by the Connect instance */
|
|
1253
|
+
const useVetraPackages = () => {
|
|
1254
|
+
const packageManager = useVetraPackageManager();
|
|
1255
|
+
return useSyncExternalStore((cb) => packageManager ? packageManager.subscribe(cb) : () => {}, () => packageManager?.packages ?? []);
|
|
1939
1256
|
};
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1257
|
+
vetraPackageManagerFunctions.addEventHandler;
|
|
1258
|
+
function useDocumentModelModules() {
|
|
1259
|
+
return useVetraPackages().flatMap((pkg) => pkg.documentModels).filter((module, index, modules) => modules.findIndex((m) => m.documentModel.global.id === module.documentModel.global.id && m.version === module.version) === index);
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Resolves a document model module by document type, mirroring the registry's
|
|
1263
|
+
* semantics (`IDocumentModelRegistry.getModule`): with `version` omitted the
|
|
1264
|
+
* LATEST version of the type wins (`version ?? 1` as each module's default),
|
|
1265
|
+
* with `version` given only an exact match is returned. The reactor resolves
|
|
1266
|
+
* modules the same way when a document is created, so metadata read through
|
|
1267
|
+
* this hook and the version a creation actually uses cannot disagree.
|
|
1268
|
+
*/
|
|
1269
|
+
function useDocumentModelModuleById(id, version) {
|
|
1270
|
+
const documentModelModules = useDocumentModelModules();
|
|
1271
|
+
if (!id || !documentModelModules) return void 0;
|
|
1272
|
+
let latestModule;
|
|
1273
|
+
let latestVersion = -1;
|
|
1274
|
+
for (const module of documentModelModules) {
|
|
1275
|
+
if (module.documentModel.global.id !== id) continue;
|
|
1276
|
+
const moduleVersion = module.version ?? 1;
|
|
1277
|
+
if (version !== void 0) {
|
|
1278
|
+
if (moduleVersion === version) return module;
|
|
1279
|
+
continue;
|
|
1280
|
+
}
|
|
1281
|
+
if (moduleVersion > latestVersion) {
|
|
1282
|
+
latestVersion = moduleVersion;
|
|
1283
|
+
latestModule = module;
|
|
1284
|
+
}
|
|
1946
1285
|
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
const normalizeException = (error, { shallow = false } = {}) => recurseException(error, [], shallow);
|
|
1952
|
-
const recurseException = (error, parents, shallow) => {
|
|
1953
|
-
if (parents.includes(error)) return;
|
|
1954
|
-
const recurse = shallow ? identity : (innerError) => recurseException(innerError, [...parents, error], shallow);
|
|
1955
|
-
const errorA = createError(error);
|
|
1956
|
-
normalizeProps(errorA, recurse);
|
|
1957
|
-
return errorA;
|
|
1958
|
-
};
|
|
1959
|
-
const identity = (error) => error;
|
|
1960
|
-
const normalizeProps = (error, recurse) => {
|
|
1961
|
-
normalizeName(error);
|
|
1962
|
-
normalizeMessage(error);
|
|
1963
|
-
normalizeStack(error);
|
|
1964
|
-
normalizeCause(error, recurse);
|
|
1965
|
-
normalizeAggregate(error, recurse);
|
|
1966
|
-
normalizeDescriptors(error);
|
|
1967
|
-
};
|
|
1968
|
-
const normalizeName = (error) => {
|
|
1969
|
-
if (isDefinedString(error.name)) return;
|
|
1970
|
-
const prototypeName = Object.getPrototypeOf(error).name;
|
|
1971
|
-
setErrorProperty(error, "name", isDefinedString(prototypeName) ? prototypeName : error.constructor.name);
|
|
1972
|
-
};
|
|
1973
|
-
const normalizeMessage = (error) => {
|
|
1974
|
-
if (!isDefinedString(error.message)) setErrorProperty(error, "message", "");
|
|
1975
|
-
};
|
|
1976
|
-
const normalizeStack = (error) => {
|
|
1977
|
-
if (!isDefinedString(error.stack)) setStack(error);
|
|
1978
|
-
};
|
|
1979
|
-
const isDefinedString = (value) => typeof value === "string" && value !== "";
|
|
1286
|
+
return latestModule;
|
|
1287
|
+
}
|
|
1288
|
+
Error;
|
|
1289
|
+
JSON;
|
|
1980
1290
|
//#endregion
|
|
1981
|
-
//#region ../reactor-browser/dist/
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
1291
|
+
//#region ../reactor-browser/dist/client-D66jVnot.js
|
|
1292
|
+
let DocumentChangeType = /* @__PURE__ */ function(DocumentChangeType) {
|
|
1293
|
+
DocumentChangeType["ChildAdded"] = "CHILD_ADDED";
|
|
1294
|
+
DocumentChangeType["ChildRemoved"] = "CHILD_REMOVED";
|
|
1295
|
+
DocumentChangeType["Created"] = "CREATED";
|
|
1296
|
+
DocumentChangeType["Deleted"] = "DELETED";
|
|
1297
|
+
DocumentChangeType["ParentAdded"] = "PARENT_ADDED";
|
|
1298
|
+
DocumentChangeType["ParentRemoved"] = "PARENT_REMOVED";
|
|
1299
|
+
DocumentChangeType["Updated"] = "UPDATED";
|
|
1300
|
+
return DocumentChangeType;
|
|
1301
|
+
}({});
|
|
1302
|
+
let PropagationMode = /* @__PURE__ */ function(PropagationMode) {
|
|
1303
|
+
PropagationMode["Cascade"] = "CASCADE";
|
|
1304
|
+
PropagationMode["Orphan"] = "ORPHAN";
|
|
1305
|
+
return PropagationMode;
|
|
1306
|
+
}({});
|
|
1307
|
+
const PhDocumentFieldsFragmentDoc = gql`
|
|
1308
|
+
fragment PHDocumentFields on PHDocument {
|
|
1309
|
+
id
|
|
1310
|
+
slug
|
|
1311
|
+
name
|
|
1312
|
+
documentType
|
|
1313
|
+
state
|
|
1314
|
+
revisionsList {
|
|
1315
|
+
scope
|
|
1316
|
+
revision
|
|
1317
|
+
}
|
|
1318
|
+
createdAtUtcIso
|
|
1319
|
+
lastModifiedAtUtcIso
|
|
1320
|
+
}
|
|
1321
|
+
`;
|
|
1322
|
+
gql`
|
|
1323
|
+
query GetDocumentModels($namespace: String, $paging: PagingInput) {
|
|
1324
|
+
documentModels(namespace: $namespace, paging: $paging) {
|
|
1325
|
+
items {
|
|
1326
|
+
id
|
|
1327
|
+
name
|
|
1328
|
+
namespace
|
|
1329
|
+
version
|
|
1330
|
+
specification
|
|
1331
|
+
}
|
|
1332
|
+
totalCount
|
|
1333
|
+
hasNextPage
|
|
1334
|
+
hasPreviousPage
|
|
1335
|
+
cursor
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
`;
|
|
1339
|
+
const GetDocumentDocument = gql`
|
|
1340
|
+
query GetDocument($identifier: String!, $view: ViewFilterInput) {
|
|
1341
|
+
document(identifier: $identifier, view: $view) {
|
|
1342
|
+
document {
|
|
1343
|
+
...PHDocumentFields
|
|
1344
|
+
}
|
|
1345
|
+
childIds
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1349
|
+
`;
|
|
1350
|
+
const GetDocumentWithOperationsDocument = gql`
|
|
1351
|
+
query GetDocumentWithOperations(
|
|
1352
|
+
$identifier: String!
|
|
1353
|
+
$view: ViewFilterInput
|
|
1354
|
+
$operationsFilter: DocumentOperationsFilterInput
|
|
1355
|
+
$operationsPaging: PagingInput
|
|
1356
|
+
) {
|
|
1357
|
+
document(identifier: $identifier, view: $view) {
|
|
1358
|
+
document {
|
|
1359
|
+
...PHDocumentFields
|
|
1360
|
+
operations(filter: $operationsFilter, paging: $operationsPaging) {
|
|
1361
|
+
items {
|
|
1362
|
+
index
|
|
1363
|
+
timestampUtcMs
|
|
1364
|
+
hash
|
|
1365
|
+
skip
|
|
1366
|
+
error
|
|
1367
|
+
deniedReason
|
|
1368
|
+
id
|
|
1369
|
+
action {
|
|
1370
|
+
id
|
|
1371
|
+
type
|
|
1372
|
+
timestampUtcMs
|
|
1373
|
+
input
|
|
1374
|
+
scope
|
|
1375
|
+
context {
|
|
1376
|
+
signer {
|
|
1377
|
+
user {
|
|
1378
|
+
address
|
|
1379
|
+
networkId
|
|
1380
|
+
chainId
|
|
1381
|
+
}
|
|
1382
|
+
app {
|
|
1383
|
+
name
|
|
1384
|
+
key
|
|
1385
|
+
}
|
|
1386
|
+
signatures
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
totalCount
|
|
1392
|
+
hasNextPage
|
|
1393
|
+
hasPreviousPage
|
|
1394
|
+
cursor
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
childIds
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1401
|
+
`;
|
|
1402
|
+
gql`
|
|
1403
|
+
query GetDocumentOutgoingRelationships(
|
|
1404
|
+
$sourceIdentifier: String!
|
|
1405
|
+
$relationshipType: String!
|
|
1406
|
+
$view: ViewFilterInput
|
|
1407
|
+
$paging: PagingInput
|
|
1408
|
+
) {
|
|
1409
|
+
documentOutgoingRelationships(
|
|
1410
|
+
sourceIdentifier: $sourceIdentifier
|
|
1411
|
+
relationshipType: $relationshipType
|
|
1412
|
+
view: $view
|
|
1413
|
+
paging: $paging
|
|
1414
|
+
) {
|
|
1415
|
+
items {
|
|
1416
|
+
...PHDocumentFields
|
|
1417
|
+
}
|
|
1418
|
+
totalCount
|
|
1419
|
+
hasNextPage
|
|
1420
|
+
hasPreviousPage
|
|
1421
|
+
cursor
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1425
|
+
`;
|
|
1426
|
+
gql`
|
|
1427
|
+
query GetDocumentIncomingRelationships(
|
|
1428
|
+
$targetIdentifier: String!
|
|
1429
|
+
$relationshipType: String!
|
|
1430
|
+
$view: ViewFilterInput
|
|
1431
|
+
$paging: PagingInput
|
|
1432
|
+
) {
|
|
1433
|
+
documentIncomingRelationships(
|
|
1434
|
+
targetIdentifier: $targetIdentifier
|
|
1435
|
+
relationshipType: $relationshipType
|
|
1436
|
+
view: $view
|
|
1437
|
+
paging: $paging
|
|
1438
|
+
) {
|
|
1439
|
+
items {
|
|
1440
|
+
...PHDocumentFields
|
|
1441
|
+
}
|
|
1442
|
+
totalCount
|
|
1443
|
+
hasNextPage
|
|
1444
|
+
hasPreviousPage
|
|
1445
|
+
cursor
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1449
|
+
`;
|
|
1450
|
+
gql`
|
|
1451
|
+
query FindDocuments(
|
|
1452
|
+
$search: SearchFilterInput
|
|
1453
|
+
$view: ViewFilterInput
|
|
1454
|
+
$paging: PagingInput
|
|
1455
|
+
) {
|
|
1456
|
+
findDocuments(search: $search, view: $view, paging: $paging) {
|
|
1457
|
+
items {
|
|
1458
|
+
...PHDocumentFields
|
|
1459
|
+
}
|
|
1460
|
+
totalCount
|
|
1461
|
+
hasNextPage
|
|
1462
|
+
hasPreviousPage
|
|
1463
|
+
cursor
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1467
|
+
`;
|
|
1468
|
+
const GetDocumentOperationsDocument = gql`
|
|
1469
|
+
query GetDocumentOperations(
|
|
1470
|
+
$filter: OperationsFilterInput!
|
|
1471
|
+
$paging: PagingInput
|
|
1472
|
+
) {
|
|
1473
|
+
documentOperations(filter: $filter, paging: $paging) {
|
|
1474
|
+
items {
|
|
1475
|
+
index
|
|
1476
|
+
timestampUtcMs
|
|
1477
|
+
hash
|
|
1478
|
+
skip
|
|
1479
|
+
error
|
|
1480
|
+
deniedReason
|
|
1481
|
+
id
|
|
1482
|
+
action {
|
|
1483
|
+
id
|
|
1484
|
+
type
|
|
1485
|
+
timestampUtcMs
|
|
1486
|
+
input
|
|
1487
|
+
scope
|
|
1488
|
+
context {
|
|
1489
|
+
signer {
|
|
1490
|
+
user {
|
|
1491
|
+
address
|
|
1492
|
+
networkId
|
|
1493
|
+
chainId
|
|
1494
|
+
}
|
|
1495
|
+
app {
|
|
1496
|
+
name
|
|
1497
|
+
key
|
|
1498
|
+
}
|
|
1499
|
+
signatures
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
totalCount
|
|
1505
|
+
hasNextPage
|
|
1506
|
+
hasPreviousPage
|
|
1507
|
+
cursor
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
`;
|
|
1511
|
+
gql`
|
|
1512
|
+
query GetJobStatus($jobId: String!) {
|
|
1513
|
+
jobStatus(jobId: $jobId) {
|
|
1514
|
+
id
|
|
1515
|
+
status
|
|
1516
|
+
result
|
|
1517
|
+
error
|
|
1518
|
+
createdAt
|
|
1519
|
+
completedAt
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
`;
|
|
1523
|
+
gql`
|
|
1524
|
+
query EvaluateActions(
|
|
1525
|
+
$documentIdentifier: String!
|
|
1526
|
+
$branch: String
|
|
1527
|
+
$candidates: [ActionCandidateInput!]!
|
|
1528
|
+
) {
|
|
1529
|
+
evaluateActions(
|
|
1530
|
+
documentIdentifier: $documentIdentifier
|
|
1531
|
+
branch: $branch
|
|
1532
|
+
candidates: $candidates
|
|
1533
|
+
) {
|
|
1534
|
+
evaluations {
|
|
1535
|
+
decision
|
|
1536
|
+
reason
|
|
1537
|
+
}
|
|
1538
|
+
allAllowed
|
|
1539
|
+
anyAllowed
|
|
1540
|
+
allDenied
|
|
1541
|
+
anyDenied
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
`;
|
|
1545
|
+
gql`
|
|
1546
|
+
mutation CreateDocument($document: JSONObject!, $parentIdentifier: String) {
|
|
1547
|
+
createDocument(document: $document, parentIdentifier: $parentIdentifier) {
|
|
1548
|
+
...PHDocumentFields
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1552
|
+
`;
|
|
1553
|
+
gql`
|
|
1554
|
+
mutation CreateEmptyDocument(
|
|
1555
|
+
$documentType: String!
|
|
1556
|
+
$parentIdentifier: String
|
|
1557
|
+
) {
|
|
1558
|
+
createEmptyDocument(
|
|
1559
|
+
documentType: $documentType
|
|
1560
|
+
parentIdentifier: $parentIdentifier
|
|
1561
|
+
) {
|
|
1562
|
+
...PHDocumentFields
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1566
|
+
`;
|
|
1567
|
+
gql`
|
|
1568
|
+
mutation MutateDocument(
|
|
1569
|
+
$documentIdentifier: String!
|
|
1570
|
+
$actions: [ActionInput!]!
|
|
1571
|
+
$branch: String
|
|
1572
|
+
) {
|
|
1573
|
+
mutateDocument: execute(
|
|
1574
|
+
documentIdentifier: $documentIdentifier
|
|
1575
|
+
actions: $actions
|
|
1576
|
+
branch: $branch
|
|
1577
|
+
) {
|
|
1578
|
+
...PHDocumentFields
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1582
|
+
`;
|
|
1583
|
+
gql`
|
|
1584
|
+
mutation MutateDocumentAsync(
|
|
1585
|
+
$documentIdentifier: String!
|
|
1586
|
+
$actions: [ActionInput!]!
|
|
1587
|
+
$branch: String
|
|
1588
|
+
) {
|
|
1589
|
+
mutateDocumentAsync: executeAsync(
|
|
1590
|
+
documentIdentifier: $documentIdentifier
|
|
1591
|
+
actions: $actions
|
|
1592
|
+
branch: $branch
|
|
1593
|
+
) {
|
|
1594
|
+
id
|
|
1595
|
+
status
|
|
1596
|
+
result
|
|
1597
|
+
error
|
|
1598
|
+
createdAt
|
|
1599
|
+
completedAt
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
`;
|
|
1603
|
+
gql`
|
|
1604
|
+
mutation RenameDocument(
|
|
1605
|
+
$documentIdentifier: String!
|
|
1606
|
+
$name: String!
|
|
1607
|
+
$branch: String
|
|
1608
|
+
) {
|
|
1609
|
+
renameDocument(
|
|
1610
|
+
documentIdentifier: $documentIdentifier
|
|
1611
|
+
name: $name
|
|
1612
|
+
branch: $branch
|
|
1613
|
+
) {
|
|
1614
|
+
...PHDocumentFields
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1618
|
+
`;
|
|
1619
|
+
gql`
|
|
1620
|
+
mutation SetPreferredEditor(
|
|
1621
|
+
$documentIdentifier: String!
|
|
1622
|
+
$preferredEditor: String
|
|
1623
|
+
$branch: String
|
|
1624
|
+
) {
|
|
1625
|
+
setPreferredEditor(
|
|
1626
|
+
documentIdentifier: $documentIdentifier
|
|
1627
|
+
preferredEditor: $preferredEditor
|
|
1628
|
+
branch: $branch
|
|
1629
|
+
) {
|
|
1630
|
+
...PHDocumentFields
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1634
|
+
`;
|
|
1635
|
+
gql`
|
|
1636
|
+
mutation AddRelationship(
|
|
1637
|
+
$sourceIdentifier: String!
|
|
1638
|
+
$targetIdentifier: String!
|
|
1639
|
+
$relationshipType: String!
|
|
1640
|
+
$branch: String
|
|
1641
|
+
) {
|
|
1642
|
+
addRelationship(
|
|
1643
|
+
sourceIdentifier: $sourceIdentifier
|
|
1644
|
+
targetIdentifier: $targetIdentifier
|
|
1645
|
+
relationshipType: $relationshipType
|
|
1646
|
+
branch: $branch
|
|
1647
|
+
) {
|
|
1648
|
+
...PHDocumentFields
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1652
|
+
`;
|
|
1653
|
+
gql`
|
|
1654
|
+
mutation RemoveRelationship(
|
|
1655
|
+
$sourceIdentifier: String!
|
|
1656
|
+
$targetIdentifier: String!
|
|
1657
|
+
$relationshipType: String!
|
|
1658
|
+
$branch: String
|
|
1659
|
+
) {
|
|
1660
|
+
removeRelationship(
|
|
1661
|
+
sourceIdentifier: $sourceIdentifier
|
|
1662
|
+
targetIdentifier: $targetIdentifier
|
|
1663
|
+
relationshipType: $relationshipType
|
|
1664
|
+
branch: $branch
|
|
1665
|
+
) {
|
|
1666
|
+
...PHDocumentFields
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1670
|
+
`;
|
|
1671
|
+
gql`
|
|
1672
|
+
mutation MoveRelationship(
|
|
1673
|
+
$sourceParentIdentifier: String!
|
|
1674
|
+
$targetParentIdentifier: String!
|
|
1675
|
+
$targetIdentifier: String!
|
|
1676
|
+
$relationshipType: String!
|
|
1677
|
+
$branch: String
|
|
1678
|
+
) {
|
|
1679
|
+
moveRelationship(
|
|
1680
|
+
sourceParentIdentifier: $sourceParentIdentifier
|
|
1681
|
+
targetParentIdentifier: $targetParentIdentifier
|
|
1682
|
+
targetIdentifier: $targetIdentifier
|
|
1683
|
+
relationshipType: $relationshipType
|
|
1684
|
+
branch: $branch
|
|
1685
|
+
) {
|
|
1686
|
+
source {
|
|
1687
|
+
...PHDocumentFields
|
|
1688
|
+
}
|
|
1689
|
+
target {
|
|
1690
|
+
...PHDocumentFields
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1695
|
+
`;
|
|
1696
|
+
gql`
|
|
1697
|
+
mutation DeleteDocument($identifier: String!, $propagate: PropagationMode) {
|
|
1698
|
+
deleteDocument(identifier: $identifier, propagate: $propagate)
|
|
1699
|
+
}
|
|
1700
|
+
`;
|
|
1701
|
+
gql`
|
|
1702
|
+
mutation DeleteDocuments(
|
|
1703
|
+
$identifiers: [String!]!
|
|
1704
|
+
$propagate: PropagationMode
|
|
1705
|
+
) {
|
|
1706
|
+
deleteDocuments(identifiers: $identifiers, propagate: $propagate)
|
|
1707
|
+
}
|
|
1708
|
+
`;
|
|
1709
|
+
gql`
|
|
1710
|
+
subscription DocumentChanges(
|
|
1711
|
+
$search: SearchFilterInput
|
|
1712
|
+
$view: ViewFilterInput
|
|
1713
|
+
) {
|
|
1714
|
+
documentChanges(search: $search, view: $view) {
|
|
1715
|
+
type
|
|
1716
|
+
documents {
|
|
1717
|
+
...PHDocumentFields
|
|
1718
|
+
}
|
|
1719
|
+
context {
|
|
1720
|
+
parentId
|
|
1721
|
+
childId
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
${PhDocumentFieldsFragmentDoc}
|
|
1726
|
+
`;
|
|
1727
|
+
gql`
|
|
1728
|
+
subscription JobChanges($jobId: String!) {
|
|
1729
|
+
jobChanges(jobId: $jobId) {
|
|
1730
|
+
jobId
|
|
1731
|
+
status
|
|
1732
|
+
result
|
|
1733
|
+
error
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
`;
|
|
1737
|
+
gql`
|
|
1738
|
+
query PollSyncEnvelopes(
|
|
1739
|
+
$channelId: String!
|
|
1740
|
+
$outboxAck: Int!
|
|
1741
|
+
$outboxLatest: Int!
|
|
1742
|
+
) {
|
|
1743
|
+
pollSyncEnvelopes(
|
|
1744
|
+
channelId: $channelId
|
|
1745
|
+
outboxAck: $outboxAck
|
|
1746
|
+
outboxLatest: $outboxLatest
|
|
1747
|
+
) {
|
|
1748
|
+
envelopes {
|
|
1749
|
+
type
|
|
1750
|
+
channelMeta {
|
|
1751
|
+
id
|
|
1752
|
+
}
|
|
1753
|
+
operations {
|
|
1754
|
+
operation {
|
|
1755
|
+
index
|
|
1756
|
+
timestampUtcMs
|
|
1757
|
+
hash
|
|
1758
|
+
skip
|
|
1759
|
+
error
|
|
1760
|
+
deniedReason
|
|
1761
|
+
id
|
|
1762
|
+
action {
|
|
1763
|
+
id
|
|
1764
|
+
type
|
|
1765
|
+
timestampUtcMs
|
|
1766
|
+
input
|
|
1767
|
+
scope
|
|
1768
|
+
context {
|
|
1769
|
+
signer {
|
|
1770
|
+
user {
|
|
1771
|
+
address
|
|
1772
|
+
networkId
|
|
1773
|
+
chainId
|
|
1774
|
+
}
|
|
1775
|
+
app {
|
|
1776
|
+
name
|
|
1777
|
+
key
|
|
1778
|
+
}
|
|
1779
|
+
signatures
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
context {
|
|
1785
|
+
documentId
|
|
1786
|
+
documentType
|
|
1787
|
+
scope
|
|
1788
|
+
branch
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
cursor {
|
|
1792
|
+
remoteName
|
|
1793
|
+
cursorOrdinal
|
|
1794
|
+
lastSyncedAtUtcMs
|
|
1795
|
+
}
|
|
1796
|
+
key
|
|
1797
|
+
dependsOn
|
|
1798
|
+
}
|
|
1799
|
+
ackOrdinal
|
|
1800
|
+
deadLetters {
|
|
1801
|
+
documentId
|
|
1802
|
+
error
|
|
1803
|
+
errorType
|
|
1804
|
+
}
|
|
1805
|
+
hasMore
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
`;
|
|
1809
|
+
gql`
|
|
1810
|
+
mutation TouchChannel($input: TouchChannelInput!) {
|
|
1811
|
+
touchChannel(input: $input) {
|
|
1812
|
+
success
|
|
1813
|
+
ackOrdinal
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
`;
|
|
1817
|
+
gql`
|
|
1818
|
+
mutation PushSyncEnvelopes($envelopes: [SyncEnvelopeInput!]!) {
|
|
1819
|
+
pushSyncEnvelopes(envelopes: $envelopes)
|
|
1820
|
+
}
|
|
1821
|
+
`;
|
|
1822
|
+
/** Get the source string from a GraphQL document (string or DocumentNode). */
|
|
1823
|
+
function getDocumentSource(doc) {
|
|
1824
|
+
return typeof doc === "string" ? doc : doc.loc?.source.body ?? "";
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Extract the inner selection set of a named field from a GraphQL document source.
|
|
1828
|
+
* Returns the `{ ... }` block including braces.
|
|
1829
|
+
*/
|
|
1830
|
+
function extractSelectionSet(doc, fieldName, fallback) {
|
|
1831
|
+
const source = getDocumentSource(doc);
|
|
1832
|
+
return new RegExp(`${fieldName}\\([^)]*\\)\\s*(\\{[\\s\\S]*\\})\\s*\\}`).exec(source)?.[1] ?? fallback;
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Extract the query body and any fragment definitions from a GraphQL document.
|
|
1836
|
+
* Returns { body, fragments } where body is the content inside the query `{ ... }`
|
|
1837
|
+
* and fragments are any trailing fragment definitions.
|
|
1838
|
+
*/
|
|
1839
|
+
function extractQueryParts(doc, fallbackBody) {
|
|
1840
|
+
const source = getDocumentSource(doc);
|
|
1841
|
+
const queryMatch = /^[^{]*\{([\s\S]*?)\}\s*(fragment[\s\S]*)?$/.exec(source);
|
|
1842
|
+
return {
|
|
1843
|
+
body: queryMatch?.[1]?.trim() ?? fallbackBody,
|
|
1844
|
+
fragments: queryMatch?.[2]?.trim() ?? ""
|
|
1845
|
+
};
|
|
1846
|
+
}
|
|
1847
|
+
extractSelectionSet(GetDocumentOperationsDocument, "documentOperations", "{ items { index } }");
|
|
1848
|
+
extractQueryParts(GetDocumentDocument, "document(identifier: $identifier) { document { id name documentType state revisionsList { scope revision } createdAtUtcIso lastModifiedAtUtcIso } childIds }");
|
|
1849
|
+
//#endregion
|
|
1850
|
+
//#region ../reactor-browser/dist/renown-BHxwP7xU.js
|
|
1851
|
+
const { useValue: useLoading, setValue: setLoading, addEventHandler: addLoadingEventHandler } = makePHEventFunctions("loading");
|
|
1852
|
+
const RenownInitialUserContext = createContext({ state: "unknown" });
|
|
1853
|
+
/** First-render auth as a three-state value; use this to skip a spinner when anonymous. */
|
|
1854
|
+
function useRenownInitialAuth() {
|
|
1855
|
+
return useContext(RenownInitialUserContext);
|
|
1856
|
+
}
|
|
1857
|
+
function useRenownInitialUser() {
|
|
1858
|
+
const initial = useRenownInitialAuth();
|
|
1859
|
+
return initial.state === "authenticated" ? initial.user : void 0;
|
|
1860
|
+
}
|
|
1861
|
+
const renownEventFunctions = makePHEventFunctions("renown");
|
|
1862
|
+
renownEventFunctions.addEventHandler;
|
|
1863
|
+
/** Returns the renown instance */
|
|
1864
|
+
const useRenown = renownEventFunctions.useValue;
|
|
1865
|
+
renownEventFunctions.setValue;
|
|
1866
|
+
function jsonEqual(a, b) {
|
|
1867
|
+
if (a === b) return true;
|
|
1868
|
+
if (typeof a !== "object" || typeof b !== "object" || !a || !b) return false;
|
|
1869
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
1870
|
+
const ra = a;
|
|
1871
|
+
const rb = b;
|
|
1872
|
+
const keys = Object.keys(ra).filter((k) => ra[k] !== void 0);
|
|
1873
|
+
if (keys.length !== Object.keys(rb).filter((k) => rb[k] !== void 0).length) return false;
|
|
1874
|
+
return keys.every((k) => jsonEqual(ra[k], rb[k]));
|
|
1875
|
+
}
|
|
1876
|
+
function sameUser(a, b) {
|
|
1877
|
+
return jsonEqual(a, b);
|
|
1878
|
+
}
|
|
1879
|
+
function resolveInstanceUser(instance, seed) {
|
|
1880
|
+
const restored = instance.user;
|
|
1881
|
+
if (restored) return sameUser(seed, restored) ? seed : restored;
|
|
1882
|
+
return instance.status === "initial" ? void 0 : seed;
|
|
1883
|
+
}
|
|
1884
|
+
/** Returns the current user from the renown instance, subscribing to user events */
|
|
1885
|
+
function useUser() {
|
|
1886
|
+
const renown = useRenown();
|
|
1887
|
+
const initialUser = useRenownInitialUser();
|
|
1888
|
+
const instance = renown ? renown : void 0;
|
|
1889
|
+
const [tracked, setTracked] = useState(() => ({
|
|
1890
|
+
instance,
|
|
1891
|
+
user: instance ? resolveInstanceUser(instance, initialUser) : initialUser
|
|
1892
|
+
}));
|
|
1893
|
+
const current = tracked.instance === instance ? tracked : {
|
|
1894
|
+
instance,
|
|
1895
|
+
user: instance ? resolveInstanceUser(instance, tracked.user ?? initialUser) : tracked.user
|
|
1896
|
+
};
|
|
1897
|
+
useEffect(() => {
|
|
1898
|
+
if (current !== tracked) setTracked(current);
|
|
1899
|
+
}, [current, tracked]);
|
|
1900
|
+
useEffect(() => {
|
|
1901
|
+
if (!instance) return;
|
|
1902
|
+
return instance.on("user", (user) => setTracked((prev) => ({
|
|
1903
|
+
instance,
|
|
1904
|
+
user: sameUser(prev.user, user) ? prev.user : user
|
|
1905
|
+
})));
|
|
1906
|
+
}, [instance]);
|
|
1907
|
+
return instance ? current.user : initialUser ?? current.user;
|
|
1908
|
+
}
|
|
1909
|
+
//#endregion
|
|
1910
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
|
|
1911
|
+
function e$8(e, t, n) {
|
|
1912
|
+
let r = (n) => e(n, ...t);
|
|
1913
|
+
return n === void 0 ? r : Object.assign(r, {
|
|
1914
|
+
lazy: n,
|
|
1915
|
+
lazyArgs: t
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
//#endregion
|
|
1919
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/purry.js
|
|
1920
|
+
function t$5(t, n, r) {
|
|
1921
|
+
let i = t.length - n.length;
|
|
1922
|
+
if (i === 0) return t(...n);
|
|
1923
|
+
if (i === 1) return e$8(t, n, r);
|
|
1924
|
+
throw Error(`Wrong number of arguments`);
|
|
1925
|
+
}
|
|
1926
|
+
//#endregion
|
|
1927
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/allPass.js
|
|
1928
|
+
function t$4(...t) {
|
|
1929
|
+
return t$5(n$4, t);
|
|
1930
|
+
}
|
|
1931
|
+
const n$4 = (e, t) => t.every((t) => t(e));
|
|
1932
|
+
//#endregion
|
|
1933
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/conditional-CTEJD5TX.js
|
|
1934
|
+
function e$7(e, t, n) {
|
|
1935
|
+
return e(n[0]) ? (e) => t(e, ...n) : t(...n);
|
|
1936
|
+
}
|
|
1937
|
+
function t$3(...t) {
|
|
1938
|
+
return e$7(r, n$3, t);
|
|
1939
|
+
}
|
|
1940
|
+
function n$3(e, ...t) {
|
|
1941
|
+
for (let n of t) {
|
|
1942
|
+
if (typeof n == `function`) return n(e);
|
|
1943
|
+
let [t, r] = n;
|
|
1944
|
+
if (t(e)) return r(e);
|
|
1945
|
+
}
|
|
1946
|
+
throw Error(`conditional: data failed for all cases`);
|
|
1947
|
+
}
|
|
1948
|
+
function r(e) {
|
|
1949
|
+
if (!Array.isArray(e)) return !1;
|
|
1950
|
+
let [t, n, ...r] = e;
|
|
1951
|
+
return typeof t == `function` && t.length <= 1 && typeof n == `function` && n.length <= 1 && r.length === 0;
|
|
1952
|
+
}
|
|
1953
|
+
//#endregion
|
|
1954
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/constant.js
|
|
1955
|
+
function e$6(e) {
|
|
1956
|
+
return () => e;
|
|
1957
|
+
}
|
|
1958
|
+
//#endregion
|
|
1959
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/hasAtLeast.js
|
|
1960
|
+
function t$2(...t) {
|
|
1961
|
+
return t$5(n$2, t);
|
|
1962
|
+
}
|
|
1963
|
+
const n$2 = (e, t) => e.length >= t;
|
|
1964
|
+
//#endregion
|
|
1965
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/funnel.js
|
|
1966
|
+
const e$5 = Symbol(`funnel/voidReducer`), t$1 = () => e$5;
|
|
1967
|
+
function n$1(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs: a, minGapMs: o, reducer: s = t$1 }) {
|
|
1968
|
+
let c, l, u, d, f = () => {
|
|
1969
|
+
let t = u;
|
|
1970
|
+
t !== void 0 && (u = void 0, t === e$5 ? n() : n(t), o !== void 0 && (l = setTimeout(p, o)));
|
|
1971
|
+
}, p = () => {
|
|
1972
|
+
clearTimeout(l), l = void 0, c === void 0 && f();
|
|
1973
|
+
}, m = () => {
|
|
1974
|
+
clearTimeout(c), c = void 0, d = void 0, l === void 0 && f();
|
|
1975
|
+
};
|
|
1976
|
+
return {
|
|
1977
|
+
call: (...e) => {
|
|
1978
|
+
let t = c === void 0 && l === void 0;
|
|
1979
|
+
if ((r !== `start` || t) && (u = s(u, ...e)), !(c === void 0 && !t)) {
|
|
1980
|
+
if (i !== void 0 || a !== void 0 || o === void 0) {
|
|
1981
|
+
clearTimeout(c);
|
|
1982
|
+
let e = Date.now();
|
|
1983
|
+
d ??= e;
|
|
1984
|
+
let t = a === void 0 ? i ?? 0 : Math.min(i ?? a, Math.max(0, a - (e - d)));
|
|
1985
|
+
c = setTimeout(m, t);
|
|
2371
1986
|
}
|
|
1987
|
+
r !== `end` && t && f();
|
|
2372
1988
|
}
|
|
2373
|
-
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
1989
|
+
},
|
|
1990
|
+
cancel: () => {
|
|
1991
|
+
clearTimeout(c), c = void 0, d = void 0, clearTimeout(l), l = void 0, u = void 0;
|
|
1992
|
+
},
|
|
1993
|
+
flush: () => {
|
|
1994
|
+
m(), p();
|
|
1995
|
+
},
|
|
1996
|
+
get isIdle() {
|
|
1997
|
+
return c === void 0 && l === void 0;
|
|
1998
|
+
}
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
//#endregion
|
|
2002
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isDefined.js
|
|
2003
|
+
function e$4(e) {
|
|
2004
|
+
return e !== void 0;
|
|
2005
|
+
}
|
|
2006
|
+
//#endregion
|
|
2007
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isNot.js
|
|
2008
|
+
function e$3(e) {
|
|
2009
|
+
return (t) => !e(t);
|
|
2010
|
+
}
|
|
2011
|
+
//#endregion
|
|
2012
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isStrictEqual.js
|
|
2013
|
+
function t(...t) {
|
|
2014
|
+
return t$5(n, t);
|
|
2015
|
+
}
|
|
2016
|
+
const n = (e, t) => e === t || Object.is(e, t);
|
|
2017
|
+
//#endregion
|
|
2018
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isString.js
|
|
2019
|
+
function e$2(e) {
|
|
2020
|
+
return typeof e == `string`;
|
|
2021
|
+
}
|
|
2022
|
+
//#endregion
|
|
2023
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isTruthy.js
|
|
2024
|
+
function e$1(e) {
|
|
2025
|
+
return !!e;
|
|
2026
|
+
}
|
|
2027
|
+
//#endregion
|
|
2028
|
+
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/once.js
|
|
2029
|
+
function e(e) {
|
|
2030
|
+
let t = !1, n;
|
|
2031
|
+
return () => (t ||= (n = e(), !0), n);
|
|
2032
|
+
}
|
|
2033
|
+
var CloseCode = /* @__PURE__ */ ((CloseCode2) => {
|
|
2034
|
+
CloseCode2[CloseCode2["InternalServerError"] = 4500] = "InternalServerError";
|
|
2035
|
+
CloseCode2[CloseCode2["InternalClientError"] = 4005] = "InternalClientError";
|
|
2036
|
+
CloseCode2[CloseCode2["BadRequest"] = 4400] = "BadRequest";
|
|
2037
|
+
CloseCode2[CloseCode2["BadResponse"] = 4004] = "BadResponse";
|
|
2038
|
+
CloseCode2[CloseCode2["Unauthorized"] = 4401] = "Unauthorized";
|
|
2039
|
+
CloseCode2[CloseCode2["Forbidden"] = 4403] = "Forbidden";
|
|
2040
|
+
CloseCode2[CloseCode2["SubprotocolNotAcceptable"] = 4406] = "SubprotocolNotAcceptable";
|
|
2041
|
+
CloseCode2[CloseCode2["ConnectionInitialisationTimeout"] = 4408] = "ConnectionInitialisationTimeout";
|
|
2042
|
+
CloseCode2[CloseCode2["ConnectionAcknowledgementTimeout"] = 4504] = "ConnectionAcknowledgementTimeout";
|
|
2043
|
+
CloseCode2[CloseCode2["SubscriberAlreadyExists"] = 4409] = "SubscriberAlreadyExists";
|
|
2044
|
+
CloseCode2[CloseCode2["TooManyInitialisationRequests"] = 4429] = "TooManyInitialisationRequests";
|
|
2045
|
+
return CloseCode2;
|
|
2046
|
+
})(CloseCode || {});
|
|
2047
|
+
var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
|
2048
|
+
MessageType2["ConnectionInit"] = "connection_init";
|
|
2049
|
+
MessageType2["ConnectionAck"] = "connection_ack";
|
|
2050
|
+
MessageType2["Ping"] = "ping";
|
|
2051
|
+
MessageType2["Pong"] = "pong";
|
|
2052
|
+
MessageType2["Subscribe"] = "subscribe";
|
|
2053
|
+
MessageType2["Next"] = "next";
|
|
2054
|
+
MessageType2["Error"] = "error";
|
|
2055
|
+
MessageType2["Complete"] = "complete";
|
|
2056
|
+
return MessageType2;
|
|
2057
|
+
})(MessageType || {});
|
|
2058
|
+
Error;
|
|
2059
|
+
//#endregion
|
|
2060
|
+
//#region ../reactor-browser/dist/document-operations-BO-SlTDw.js
|
|
2061
|
+
const modalEventFunctions = makePHEventFunctions("modal");
|
|
2062
|
+
modalEventFunctions.useValue;
|
|
2063
|
+
/** Sets the current modal */
|
|
2064
|
+
const setPHModal = modalEventFunctions.setValue;
|
|
2065
|
+
modalEventFunctions.addEventHandler;
|
|
2066
|
+
/** Shows a modal */
|
|
2067
|
+
function showPHModal(modal) {
|
|
2068
|
+
setPHModal(modal);
|
|
2069
|
+
}
|
|
2070
|
+
/** Shows the delete node modal */
|
|
2071
|
+
function showDeleteNodeModal(nodeOrId) {
|
|
2072
|
+
setPHModal({
|
|
2073
|
+
type: "deleteItem",
|
|
2074
|
+
id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
|
|
2378
2075
|
});
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2076
|
+
}
|
|
2077
|
+
function isDocumentTypeSupported(documentType, supportedDocuments) {
|
|
2078
|
+
if (!supportedDocuments?.length) return true;
|
|
2079
|
+
return supportedDocuments.some((pattern) => {
|
|
2080
|
+
if (pattern.endsWith("/*")) {
|
|
2081
|
+
const prefix = pattern.slice(0, -2);
|
|
2082
|
+
return documentType.startsWith(prefix + "/");
|
|
2083
|
+
}
|
|
2084
|
+
if (pattern.endsWith("*") && !pattern.endsWith("/*")) {
|
|
2085
|
+
const prefix = pattern.slice(0, -1);
|
|
2086
|
+
return documentType.startsWith(prefix);
|
|
2087
|
+
}
|
|
2088
|
+
return pattern === documentType;
|
|
2382
2089
|
});
|
|
2383
|
-
}
|
|
2384
|
-
var DocumentModelNotFoundError = class extends Error {
|
|
2385
|
-
documentType;
|
|
2386
|
-
name = "DocumentModelNotFoundError";
|
|
2387
|
-
constructor(documentType) {
|
|
2388
|
-
super(`Document model module for type ${documentType} not found`);
|
|
2389
|
-
this.documentType = documentType;
|
|
2390
|
-
}
|
|
2391
|
-
static isError(error) {
|
|
2392
|
-
return Error.isError(error) && error.name === "DocumentModelNotFoundError";
|
|
2393
|
-
}
|
|
2394
|
-
};
|
|
2395
|
-
var DocumentTypeMismatchError = class extends Error {
|
|
2396
|
-
constructor(documentId, expectedType, actualType) {
|
|
2397
|
-
super(`Document ${documentId} is not of type ${expectedType}. Actual type: ${actualType}`);
|
|
2398
|
-
}
|
|
2399
|
-
};
|
|
2400
|
-
var NoSelectedDocumentError = class extends Error {
|
|
2401
|
-
constructor() {
|
|
2402
|
-
super("There is no selected document. Did you mean to call 'useSelectedDocumentSafe' instead?");
|
|
2403
|
-
}
|
|
2404
|
-
};
|
|
2090
|
+
}
|
|
2405
2091
|
function getUserPermissions() {
|
|
2406
2092
|
const user = window.ph?.renown?.user;
|
|
2407
2093
|
const allowList = window.ph?.allowList;
|
|
@@ -2414,8 +2100,41 @@ function getUserPermissions() {
|
|
|
2414
2100
|
isAllowedToEditDocuments: allowList.includes(user?.address ?? "")
|
|
2415
2101
|
};
|
|
2416
2102
|
}
|
|
2417
|
-
const BASE_STATE_KEYS = new Set(["auth"]);
|
|
2418
2103
|
const NON_DOMAIN_SCOPES = new Set(["auth", "document"]);
|
|
2104
|
+
/** An unreadable drive cannot be shown to hold no duplicate, so reads throw. */
|
|
2105
|
+
async function isDocumentInLocation(reactorClient, document, driveId, parentFolder) {
|
|
2106
|
+
const drive = await reactorClient.get(driveId);
|
|
2107
|
+
const nodeById = drive.state.global.nodes.find((node) => node.id === document.header.id);
|
|
2108
|
+
if (nodeById && nodeById.parentFolder === (parentFolder ?? null)) return {
|
|
2109
|
+
isDuplicate: true,
|
|
2110
|
+
duplicateType: "id",
|
|
2111
|
+
nodeId: nodeById.id
|
|
2112
|
+
};
|
|
2113
|
+
const nodeByNameAndType = drive.state.global.nodes.find((node) => isFileNode(node) && node.name === document.header.name && node.documentType === document.header.documentType && node.parentFolder === (parentFolder ?? null));
|
|
2114
|
+
if (nodeByNameAndType) return {
|
|
2115
|
+
isDuplicate: true,
|
|
2116
|
+
duplicateType: "name",
|
|
2117
|
+
nodeId: nodeByNameAndType.id
|
|
2118
|
+
};
|
|
2119
|
+
return { isDuplicate: false };
|
|
2120
|
+
}
|
|
2121
|
+
function getDocumentTypeIcon(document) {
|
|
2122
|
+
switch (document.header.documentType) {
|
|
2123
|
+
case "powerhouse/document-model": return "document-model";
|
|
2124
|
+
case "powerhouse/app": return "app";
|
|
2125
|
+
case "powerhouse/document-editor": return "editor";
|
|
2126
|
+
case "powerhouse/subgraph": return "subgraph";
|
|
2127
|
+
case "powerhouse/package": return "package";
|
|
2128
|
+
case "powerhouse/processor": {
|
|
2129
|
+
const processorType = document.state.global?.type;
|
|
2130
|
+
if (processorType === "analytics") return "analytics-processor";
|
|
2131
|
+
if (processorType === "relational") return "relational-processor";
|
|
2132
|
+
if (processorType === "codegen") return "codegen-processor";
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
default: return;
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2419
2138
|
async function downloadFile(document, fileName) {
|
|
2420
2139
|
try {
|
|
2421
2140
|
const data = await createZip(document);
|
|
@@ -2436,7 +2155,7 @@ async function getDocumentExtension(document) {
|
|
|
2436
2155
|
let rawExtension;
|
|
2437
2156
|
if (documentType === "powerhouse/document-model") rawExtension = document.state.global?.extension;
|
|
2438
2157
|
else {
|
|
2439
|
-
const reactorClient = window.ph?.
|
|
2158
|
+
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
2440
2159
|
if (reactorClient) {
|
|
2441
2160
|
const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
|
|
2442
2161
|
rawExtension = documentModelModules.find((m) => m.documentModel.global.id === documentType)?.utils.fileExtension;
|
|
@@ -2450,7 +2169,7 @@ async function getDocumentExtension(document) {
|
|
|
2450
2169
|
* composite cursors, so all scopes are fetched in a single paginated stream.
|
|
2451
2170
|
*/
|
|
2452
2171
|
async function fetchDocumentOperations(reactorClient, document, pageSize = 100) {
|
|
2453
|
-
const scopes = Object.keys(document.state)
|
|
2172
|
+
const scopes = Object.keys(document.state);
|
|
2454
2173
|
const operations = {};
|
|
2455
2174
|
for (const scope of scopes) operations[scope] = [];
|
|
2456
2175
|
let cursor = "";
|
|
@@ -2478,6 +2197,67 @@ function extractInitialState(documentScopeOps) {
|
|
|
2478
2197
|
function filterDomainOperations(operations) {
|
|
2479
2198
|
return Object.fromEntries(Object.entries(operations).filter(([scope]) => !NON_DOMAIN_SCOPES.has(scope)));
|
|
2480
2199
|
}
|
|
2200
|
+
function countOperations(operations) {
|
|
2201
|
+
let total = 0;
|
|
2202
|
+
for (const ops of Object.values(operations)) total += ops?.length ?? 0;
|
|
2203
|
+
return total;
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* Split an imported document's domain operations at its mid-history upgrade
|
|
2207
|
+
* boundaries, so the caller can re-dispatch each upgrade between segments.
|
|
2208
|
+
*
|
|
2209
|
+
* The seed's CREATE_DOCUMENT and 0 -> N upgrade are replayed by the creation
|
|
2210
|
+
* path and must not be repeated. A later upgrade must be: it is where the
|
|
2211
|
+
* reducer version changes, and dropping it replays everything after it through
|
|
2212
|
+
* the module the document was created with.
|
|
2213
|
+
*/
|
|
2214
|
+
function splitAtUpgradeBoundaries(operations) {
|
|
2215
|
+
const upgrades = (operations.document ?? []).filter((op) => op.action.type === "UPGRADE_DOCUMENT").filter((op) => op.action.input.fromVersion > 0).sort((a, b) => a.index - b.index);
|
|
2216
|
+
const domain = filterDomainOperations(operations);
|
|
2217
|
+
if (upgrades.length === 0) return [{ operations: domain }];
|
|
2218
|
+
const segments = [];
|
|
2219
|
+
const consumed = /* @__PURE__ */ new Map();
|
|
2220
|
+
const take = (until) => {
|
|
2221
|
+
const slice = {};
|
|
2222
|
+
for (const [scope, ops] of Object.entries(domain)) {
|
|
2223
|
+
if (!ops) continue;
|
|
2224
|
+
const from = consumed.get(scope) ?? 0;
|
|
2225
|
+
const stop = Math.max(from, until(scope, ops));
|
|
2226
|
+
const chunk = ops.slice(from, stop);
|
|
2227
|
+
if (chunk.length > 0) slice[scope] = chunk;
|
|
2228
|
+
consumed.set(scope, stop);
|
|
2229
|
+
}
|
|
2230
|
+
return slice;
|
|
2231
|
+
};
|
|
2232
|
+
for (const upgrade of upgrades) {
|
|
2233
|
+
const input = upgrade.action.input;
|
|
2234
|
+
const slice = take((scope, ops) => boundary(upgrade, scope, ops));
|
|
2235
|
+
segments.push({
|
|
2236
|
+
operations: slice,
|
|
2237
|
+
upgradeTo: input.toVersion
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
const tail = take((_scope, ops) => ops.length);
|
|
2241
|
+
if (countOperations(tail) > 0) segments.push({ operations: tail });
|
|
2242
|
+
return segments;
|
|
2243
|
+
}
|
|
2244
|
+
/**
|
|
2245
|
+
* How many of a scope's operations precede an upgrade. Must stay identical to
|
|
2246
|
+
* the boundary computation in `replayDocumentVersioned` — snapshots compare
|
|
2247
|
+
* against operation indices, not array positions, and the timestamp fallback
|
|
2248
|
+
* excludes the upgrade's own instant.
|
|
2249
|
+
*/
|
|
2250
|
+
function boundary(upgrade, scope, ops) {
|
|
2251
|
+
const snapshot = upgrade.action.input.revision;
|
|
2252
|
+
if (snapshot !== void 0) {
|
|
2253
|
+
const revision = snapshot[scope] ?? 0;
|
|
2254
|
+
let count = 0;
|
|
2255
|
+
for (let i = 0; i < ops.length; i++) if (ops[i].index < revision) count = i + 1;
|
|
2256
|
+
return count;
|
|
2257
|
+
}
|
|
2258
|
+
for (let i = 0; i < ops.length; i++) if (ops[i].timestampUtcMs >= upgrade.timestampUtcMs) return i;
|
|
2259
|
+
return ops.length;
|
|
2260
|
+
}
|
|
2481
2261
|
async function exportFile(document, suggestedName) {
|
|
2482
2262
|
const reactorClient = window.ph?.reactorClient;
|
|
2483
2263
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
@@ -2507,7 +2287,7 @@ async function exportFile(document, suggestedName) {
|
|
|
2507
2287
|
*/
|
|
2508
2288
|
async function loadFile(path) {
|
|
2509
2289
|
const baseDocument = await baseLoadFromInput(path, (state) => state, { checkHashes: true });
|
|
2510
|
-
const reactorClient = window.ph?.
|
|
2290
|
+
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
2511
2291
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2512
2292
|
const documentType = baseDocument.header.documentType;
|
|
2513
2293
|
const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
|
|
@@ -2525,13 +2305,20 @@ async function loadFile(path) {
|
|
|
2525
2305
|
upgradeManifest
|
|
2526
2306
|
});
|
|
2527
2307
|
}
|
|
2528
|
-
async function addDocument(driveId, name, documentType, parentFolder, document, id, preferredEditor) {
|
|
2308
|
+
async function addDocument(driveId, name, documentType, parentFolder, document, id, preferredEditor, documentModelVersion) {
|
|
2529
2309
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2530
2310
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create documents");
|
|
2531
|
-
const reactorClient = window.ph?.
|
|
2311
|
+
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
2532
2312
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2533
|
-
|
|
2313
|
+
let documentModelModule;
|
|
2314
|
+
if (documentModelVersion !== void 0) {
|
|
2315
|
+
const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
|
|
2316
|
+
const module = documentModelModules.find((m) => m.documentModel.global.id === documentType && (m.version ?? 1) === documentModelVersion);
|
|
2317
|
+
if (!module) throw new Error(`Document model not found for type: ${documentType} with version: ${documentModelVersion}`);
|
|
2318
|
+
documentModelModule = module;
|
|
2319
|
+
} else documentModelModule = await reactorClient.getDocumentModelModule(documentType);
|
|
2534
2320
|
const newDocument = document ?? documentModelModule.utils.createDocument();
|
|
2321
|
+
if (!document) newDocument.state.document.version = documentModelModule.version ?? 1;
|
|
2535
2322
|
newDocument.header.name = name;
|
|
2536
2323
|
if (preferredEditor) newDocument.header.meta = {
|
|
2537
2324
|
...newDocument.header.meta,
|
|
@@ -2552,43 +2339,210 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
|
|
|
2552
2339
|
kind: "file"
|
|
2553
2340
|
};
|
|
2554
2341
|
}
|
|
2555
|
-
|
|
2556
|
-
|
|
2342
|
+
/**
|
|
2343
|
+
* How many ids an import will try before giving up. The check before the create
|
|
2344
|
+
* catches an id that is already taken; this bound covers the window between the
|
|
2345
|
+
* two, where a create can still lose to a claim made in the meantime.
|
|
2346
|
+
*/
|
|
2347
|
+
const IMPORT_ID_ATTEMPTS = 3;
|
|
2348
|
+
/** True when this error, or anything it wraps, is a taken document id. */
|
|
2349
|
+
function isDocumentAlreadyExists(error) {
|
|
2350
|
+
let current = error;
|
|
2351
|
+
while (current instanceof Error) {
|
|
2352
|
+
if (current.name === "DocumentAlreadyExistsError") return true;
|
|
2353
|
+
current = current.cause;
|
|
2354
|
+
}
|
|
2355
|
+
return false;
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Creates the imported document under an id that is free, retrying on a
|
|
2359
|
+
* collision.
|
|
2360
|
+
*
|
|
2361
|
+
* The check cannot stand on its own: it answers for the moment it ran, and the
|
|
2362
|
+
* create that follows can still land on an id claimed in between. The store
|
|
2363
|
+
* rejects that create as DocumentAlreadyExistsError, which is not retryable
|
|
2364
|
+
* under the same id and is resolved by minting another one. A create that
|
|
2365
|
+
* fails leaves the drive untouched, so a retry has nothing to clean up.
|
|
2366
|
+
*/
|
|
2367
|
+
async function createImportedDocument(reactor, document, driveId, name, parentFolder) {
|
|
2368
|
+
let documentId = await reactor.isDocumentIdTaken(document.header.id) ? generateId() : document.header.id;
|
|
2369
|
+
for (let attempt = 1;; attempt++) {
|
|
2370
|
+
const header = createPresignedHeader(documentId, document.header.documentType);
|
|
2371
|
+
header.lastModifiedAtUtcIso = document.header.createdAtUtcIso;
|
|
2372
|
+
header.meta = document.header.meta;
|
|
2373
|
+
header.name = name || document.header.name;
|
|
2374
|
+
const initialDocument = {
|
|
2375
|
+
...document,
|
|
2376
|
+
header,
|
|
2377
|
+
state: document.initialState,
|
|
2378
|
+
operations: Object.keys(document.operations).reduce((acc, key) => {
|
|
2379
|
+
acc[key] = [];
|
|
2380
|
+
return acc;
|
|
2381
|
+
}, {})
|
|
2382
|
+
};
|
|
2383
|
+
try {
|
|
2384
|
+
const fileNode = await addDocument(driveId, name || document.header.name, document.header.documentType, parentFolder, initialDocument, documentId, document.header.meta?.preferredEditor);
|
|
2385
|
+
if (!fileNode) throw new Error("There was an error adding file");
|
|
2386
|
+
return {
|
|
2387
|
+
documentId,
|
|
2388
|
+
fileNode
|
|
2389
|
+
};
|
|
2390
|
+
} catch (error) {
|
|
2391
|
+
if (!isDocumentAlreadyExists(error) || attempt === IMPORT_ID_ATTEMPTS) throw error;
|
|
2392
|
+
logger.warn(`Document id ${documentId} was taken between the check and the create; importing under a new id`);
|
|
2393
|
+
documentId = generateId();
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
async function addFileWithProgress(file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict) {
|
|
2398
|
+
logger.verbose(`addFileWithProgress(drive: ${driveId}, name: ${name}, folder: ${parentFolder})`);
|
|
2399
|
+
const reactor = window.ph?.reactorClientModule?.client;
|
|
2400
|
+
if (!reactor) {
|
|
2401
|
+
onProgress?.({
|
|
2402
|
+
stage: "failed",
|
|
2403
|
+
progress: 100,
|
|
2404
|
+
error: "ReactorClient not initialized"
|
|
2405
|
+
});
|
|
2406
|
+
throw new Error("ReactorClient not initialized");
|
|
2407
|
+
}
|
|
2557
2408
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2558
2409
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create files");
|
|
2559
|
-
const document = await loadFile(file);
|
|
2560
|
-
let duplicateId = false;
|
|
2561
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2562
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2563
2410
|
try {
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2411
|
+
onProgress?.({
|
|
2412
|
+
stage: "loading",
|
|
2413
|
+
progress: 0
|
|
2414
|
+
});
|
|
2415
|
+
let document;
|
|
2416
|
+
try {
|
|
2417
|
+
document = await loadFile(file);
|
|
2418
|
+
} catch (loadError) {
|
|
2419
|
+
if (UnsupportedDocumentModelVersionError.isError(loadError)) {
|
|
2420
|
+
showPHModal({
|
|
2421
|
+
type: "documentVersionUnsupported",
|
|
2422
|
+
documentType: loadError.documentType,
|
|
2423
|
+
requiredVersion: loadError.requiredVersion,
|
|
2424
|
+
availableVersions: loadError.availableVersions
|
|
2425
|
+
});
|
|
2426
|
+
onProgress?.({
|
|
2427
|
+
stage: "failed",
|
|
2428
|
+
progress: 100,
|
|
2429
|
+
error: loadError.message
|
|
2430
|
+
});
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
const discoveryService = window.ph?.packageDiscoveryService;
|
|
2434
|
+
if (discoveryService && DocumentModelNotFoundError.isError(loadError)) {
|
|
2435
|
+
retryAfterDiscovery(discoveryService, loadError.documentType, file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict).catch((retryError) => {
|
|
2436
|
+
logger.error("Import retry after discovery failed: @error", retryError);
|
|
2437
|
+
onProgress?.({
|
|
2438
|
+
stage: "failed",
|
|
2439
|
+
progress: 100,
|
|
2440
|
+
error: retryError instanceof Error ? retryError.message : String(retryError)
|
|
2441
|
+
});
|
|
2442
|
+
});
|
|
2443
|
+
return;
|
|
2444
|
+
}
|
|
2445
|
+
throw loadError;
|
|
2446
|
+
}
|
|
2447
|
+
const duplicateCheck = await isDocumentInLocation(reactor, document, driveId, parentFolder);
|
|
2448
|
+
if (duplicateCheck.isDuplicate && !resolveConflict) {
|
|
2449
|
+
onProgress?.({
|
|
2450
|
+
stage: "conflict",
|
|
2451
|
+
progress: 0,
|
|
2452
|
+
duplicateType: duplicateCheck.duplicateType
|
|
2453
|
+
});
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2456
|
+
const documentType = getDocumentTypeIcon(document);
|
|
2457
|
+
if (documentType) onProgress?.({
|
|
2458
|
+
stage: "loading",
|
|
2459
|
+
progress: 10,
|
|
2460
|
+
documentType
|
|
2461
|
+
});
|
|
2462
|
+
else onProgress?.({
|
|
2463
|
+
stage: "loading",
|
|
2464
|
+
progress: 10
|
|
2465
|
+
});
|
|
2466
|
+
if (!isDocumentTypeSupported(document.header.documentType, documentTypes)) {
|
|
2467
|
+
onProgress?.({
|
|
2468
|
+
stage: "unsupported-document-type",
|
|
2469
|
+
progress: 100,
|
|
2470
|
+
error: `Document type ${document.header.documentType} is not supported`
|
|
2471
|
+
});
|
|
2472
|
+
throw new UnsupportedDocumentTypeError(document.header.documentType);
|
|
2473
|
+
}
|
|
2474
|
+
await reactor.getDocumentModelModule(document.header.documentType);
|
|
2475
|
+
onProgress?.({
|
|
2476
|
+
stage: "initializing",
|
|
2477
|
+
progress: 10
|
|
2478
|
+
});
|
|
2479
|
+
const created = await createImportedDocument(reactor, document, driveId, name, parentFolder);
|
|
2480
|
+
const documentId = created.documentId;
|
|
2481
|
+
const fileNode = created.fileNode;
|
|
2482
|
+
onProgress?.({
|
|
2483
|
+
stage: "initializing",
|
|
2484
|
+
progress: 20
|
|
2485
|
+
});
|
|
2486
|
+
await reactor.get(documentId);
|
|
2487
|
+
console.log("Document created, starting upload of operations");
|
|
2488
|
+
const segments = splitAtUpgradeBoundaries(document.operations);
|
|
2489
|
+
const totalOperations = segments.reduce((total, segment) => total + countOperations(segment.operations), 0);
|
|
2490
|
+
let uploadedBefore = 0;
|
|
2491
|
+
for (const segment of segments) {
|
|
2492
|
+
await uploadOperations(documentId, segment.operations, queueOperations, { onProgress: (uploadProgress) => {
|
|
2493
|
+
if (uploadProgress.uploadedOperations === void 0) return;
|
|
2494
|
+
const uploaded = uploadedBefore + uploadProgress.uploadedOperations;
|
|
2495
|
+
const uploadPercent = totalOperations > 0 ? uploaded / totalOperations : 0;
|
|
2496
|
+
onProgress?.({
|
|
2497
|
+
stage: "uploading",
|
|
2498
|
+
progress: 20 + Math.round(uploadPercent * 80),
|
|
2499
|
+
totalOperations,
|
|
2500
|
+
uploadedOperations: uploaded
|
|
2501
|
+
});
|
|
2502
|
+
} });
|
|
2503
|
+
uploadedBefore += countOperations(segment.operations);
|
|
2504
|
+
if (segment.upgradeTo !== void 0) await reactor.upgradeDocument(documentId, segment.upgradeTo);
|
|
2505
|
+
}
|
|
2506
|
+
onProgress?.({
|
|
2507
|
+
stage: "complete",
|
|
2508
|
+
progress: 100,
|
|
2509
|
+
fileNode
|
|
2510
|
+
});
|
|
2511
|
+
return fileNode;
|
|
2512
|
+
} catch (error) {
|
|
2513
|
+
if (!UnsupportedDocumentTypeError.isError(error)) {
|
|
2514
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2515
|
+
onProgress?.({
|
|
2516
|
+
stage: "failed",
|
|
2517
|
+
progress: 100,
|
|
2518
|
+
error: errorMessage
|
|
2519
|
+
});
|
|
2520
|
+
}
|
|
2521
|
+
throw error;
|
|
2522
|
+
}
|
|
2583
2523
|
}
|
|
2584
|
-
async function
|
|
2524
|
+
async function retryAfterDiscovery(discoveryService, documentType, file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict) {
|
|
2525
|
+
if (!discoveryService) return;
|
|
2526
|
+
try {
|
|
2527
|
+
await discoveryService.load(documentType);
|
|
2528
|
+
} catch {
|
|
2529
|
+
onProgress?.({
|
|
2530
|
+
stage: "unsupported-document-type",
|
|
2531
|
+
progress: 100,
|
|
2532
|
+
error: `Document type ${documentType} is not supported`
|
|
2533
|
+
});
|
|
2534
|
+
return;
|
|
2535
|
+
}
|
|
2536
|
+
await addFileWithProgress(file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict);
|
|
2537
|
+
}
|
|
2538
|
+
async function addFolder$1(driveId, name, parentFolder) {
|
|
2585
2539
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2586
2540
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create folders");
|
|
2587
2541
|
const reactorClient = window.ph?.reactorClient;
|
|
2588
2542
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2589
2543
|
await reactorClient.get(driveId);
|
|
2590
2544
|
const folderId = generateId();
|
|
2591
|
-
const node = (await reactorClient.execute(driveId, "main", [addFolder
|
|
2545
|
+
const node = (await reactorClient.execute(driveId, "main", [addFolder({
|
|
2592
2546
|
id: folderId,
|
|
2593
2547
|
name,
|
|
2594
2548
|
parentFolder
|
|
@@ -2666,10 +2620,12 @@ async function _duplicateDocument(reactor, document, newId = generateId()) {
|
|
|
2666
2620
|
upgradeManifest
|
|
2667
2621
|
};
|
|
2668
2622
|
const header = createPresignedHeader(newId, documentType);
|
|
2669
|
-
|
|
2623
|
+
const duplicated = replayDocumentVersioned(document.initialState, document.operations, config, header);
|
|
2624
|
+
assertAuthPreservedOnDuplicate(document.header.id, document.state.auth, duplicated.state.auth);
|
|
2625
|
+
return duplicated;
|
|
2670
2626
|
}
|
|
2671
2627
|
async function copyNode$1(driveId, src, target) {
|
|
2672
|
-
const reactor = window.ph?.
|
|
2628
|
+
const reactor = window.ph?.reactorClientModule?.client;
|
|
2673
2629
|
if (!reactor) return;
|
|
2674
2630
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2675
2631
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to copy documents");
|
|
@@ -2689,48 +2645,86 @@ async function copyNode$1(driveId, src, target) {
|
|
|
2689
2645
|
srcKind: isFileNode(node) ? "file" : "folder",
|
|
2690
2646
|
targetParentFolder: copyNodeInput.targetParentFolder || null
|
|
2691
2647
|
});
|
|
2692
|
-
resolvedNamesMap.set(copyNodeInput.targetId, resolvedName);
|
|
2693
|
-
}
|
|
2694
|
-
}
|
|
2695
|
-
const fileNodesToCopy = copyNodesInput.filter((copyNodeInput) => {
|
|
2696
|
-
const node = drive.state.global.nodes.find((node) => node.id === copyNodeInput.srcId);
|
|
2697
|
-
return node !== void 0 && isFileNode(node);
|
|
2698
|
-
});
|
|
2699
|
-
for (const fileNodeToCopy of fileNodesToCopy) try {
|
|
2700
|
-
const duplicatedDocument = await _duplicateDocument(reactor, await reactor.get(fileNodeToCopy.srcId), fileNodeToCopy.targetId);
|
|
2701
|
-
const resolvedName = resolvedNamesMap.get(fileNodeToCopy.targetId);
|
|
2702
|
-
if (resolvedName) duplicatedDocument.header.name = resolvedName;
|
|
2703
|
-
await reactor.drives.addFile(driveId, duplicatedDocument, target?.id);
|
|
2704
|
-
} catch (e) {
|
|
2705
|
-
logger.error(`Error copying document ${fileNodeToCopy.srcId}: ${String(e)}`);
|
|
2706
|
-
}
|
|
2707
|
-
return await queueActions(drive, copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput)));
|
|
2708
|
-
}
|
|
2709
|
-
const modalEventFunctions = makePHEventFunctions("modal");
|
|
2710
|
-
modalEventFunctions.useValue;
|
|
2711
|
-
/** Sets the current modal */
|
|
2712
|
-
const setPHModal = modalEventFunctions.setValue;
|
|
2713
|
-
modalEventFunctions.addEventHandler;
|
|
2714
|
-
/** Shows a modal */
|
|
2715
|
-
function showPHModal(modal) {
|
|
2716
|
-
setPHModal(modal);
|
|
2717
|
-
}
|
|
2718
|
-
/** Shows the create document modal */
|
|
2719
|
-
function showCreateDocumentModal(documentType) {
|
|
2720
|
-
setPHModal({
|
|
2721
|
-
type: "createDocument",
|
|
2722
|
-
documentType
|
|
2723
|
-
});
|
|
2724
|
-
}
|
|
2725
|
-
/** Shows the delete node modal */
|
|
2726
|
-
function showDeleteNodeModal(nodeOrId) {
|
|
2727
|
-
setPHModal({
|
|
2728
|
-
type: "deleteItem",
|
|
2729
|
-
id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
|
|
2648
|
+
resolvedNamesMap.set(copyNodeInput.targetId, resolvedName);
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
const fileNodesToCopy = copyNodesInput.filter((copyNodeInput) => {
|
|
2652
|
+
const node = drive.state.global.nodes.find((node) => node.id === copyNodeInput.srcId);
|
|
2653
|
+
return node !== void 0 && isFileNode(node);
|
|
2730
2654
|
});
|
|
2655
|
+
for (const fileNodeToCopy of fileNodesToCopy) try {
|
|
2656
|
+
const duplicatedDocument = await _duplicateDocument(reactor, await reactor.get(fileNodeToCopy.srcId), fileNodeToCopy.targetId);
|
|
2657
|
+
const resolvedName = resolvedNamesMap.get(fileNodeToCopy.targetId);
|
|
2658
|
+
if (resolvedName) duplicatedDocument.header.name = resolvedName;
|
|
2659
|
+
await reactor.drives.addFile(driveId, duplicatedDocument, target?.id);
|
|
2660
|
+
} catch (e) {
|
|
2661
|
+
logger.error(`Error copying document ${fileNodeToCopy.srcId}: ${String(e)}`);
|
|
2662
|
+
}
|
|
2663
|
+
return await queueActions(drive, copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput)));
|
|
2731
2664
|
}
|
|
2732
|
-
|
|
2733
|
-
|
|
2665
|
+
gql`
|
|
2666
|
+
mutation MutateDocumentWithOperations(
|
|
2667
|
+
$documentIdentifier: String!
|
|
2668
|
+
$actions: [ActionInput!]!
|
|
2669
|
+
$sinceRevision: Int
|
|
2670
|
+
$scopes: [String!]
|
|
2671
|
+
$branch: String
|
|
2672
|
+
) {
|
|
2673
|
+
mutateDocument: execute(
|
|
2674
|
+
documentIdentifier: $documentIdentifier
|
|
2675
|
+
actions: $actions
|
|
2676
|
+
branch: $branch
|
|
2677
|
+
) {
|
|
2678
|
+
...PHDocumentFields
|
|
2679
|
+
operations(
|
|
2680
|
+
filter: {
|
|
2681
|
+
sinceRevision: $sinceRevision
|
|
2682
|
+
scopes: $scopes
|
|
2683
|
+
branch: $branch
|
|
2684
|
+
}
|
|
2685
|
+
) {
|
|
2686
|
+
items {
|
|
2687
|
+
...ReactorOperationFields
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
${PhDocumentFieldsFragmentDoc}
|
|
2693
|
+
${gql`
|
|
2694
|
+
fragment ReactorOperationFields on ReactorOperation {
|
|
2695
|
+
index
|
|
2696
|
+
timestampUtcMs
|
|
2697
|
+
hash
|
|
2698
|
+
skip
|
|
2699
|
+
error
|
|
2700
|
+
deniedReason
|
|
2701
|
+
id
|
|
2702
|
+
action {
|
|
2703
|
+
id
|
|
2704
|
+
type
|
|
2705
|
+
timestampUtcMs
|
|
2706
|
+
input
|
|
2707
|
+
scope
|
|
2708
|
+
context {
|
|
2709
|
+
signer {
|
|
2710
|
+
user {
|
|
2711
|
+
address
|
|
2712
|
+
networkId
|
|
2713
|
+
chainId
|
|
2714
|
+
}
|
|
2715
|
+
app {
|
|
2716
|
+
name
|
|
2717
|
+
key
|
|
2718
|
+
}
|
|
2719
|
+
signatures
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
`}
|
|
2725
|
+
`;
|
|
2726
|
+
DocumentChangeType.Created, DOCUMENT_CHANGE_TYPE.Created, DocumentChangeType.Deleted, DOCUMENT_CHANGE_TYPE.Deleted, DocumentChangeType.Updated, DOCUMENT_CHANGE_TYPE.Updated, DocumentChangeType.ParentAdded, DOCUMENT_CHANGE_TYPE.ParentAdded, DocumentChangeType.ParentRemoved, DOCUMENT_CHANGE_TYPE.ParentRemoved, DocumentChangeType.ChildAdded, DOCUMENT_CHANGE_TYPE.ChildAdded, DocumentChangeType.ChildRemoved, DOCUMENT_CHANGE_TYPE.ChildRemoved;
|
|
2727
|
+
PropagationMode.Cascade, PropagationMode.Orphan;
|
|
2734
2728
|
const isExternalControlsEnabledEventFunctions = makePHEventFunctions("isExternalControlsEnabled");
|
|
2735
2729
|
/** Sets whether external controls are enabled for a given editor. */
|
|
2736
2730
|
const setIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.setValue;
|
|
@@ -2796,6 +2790,8 @@ const { useValue: useIsDriveAnalyticsEnabled, setValue: setIsDriveAnalyticsEnabl
|
|
|
2796
2790
|
const { useValue: useRenownUrl, setValue: setRenownUrl, addEventHandler: addRenownUrlEventHandler } = makePHEventFunctions("renownUrl");
|
|
2797
2791
|
const { useValue: useRenownNetworkId, setValue: setRenownNetworkId, addEventHandler: addRenownNetworkIdEventHandler } = makePHEventFunctions("renownNetworkId");
|
|
2798
2792
|
const { useValue: useRenownChainId, setValue: setRenownChainId, addEventHandler: addRenownChainIdEventHandler } = makePHEventFunctions("renownChainId");
|
|
2793
|
+
const { useValue: useSwitchboardUrl, setValue: setSwitchboardUrl, addEventHandler: addSwitchboardUrlEventHandler } = makePHEventFunctions("switchboardUrl");
|
|
2794
|
+
const { useValue: useRenownAdapters, setValue: setRenownAdapters, addEventHandler: addRenownAdaptersEventHandler } = makePHEventFunctions("renownAdapters");
|
|
2799
2795
|
const { useValue: useSentryRelease, setValue: setSentryRelease, addEventHandler: addSentryReleaseEventHandler } = makePHEventFunctions("sentryRelease");
|
|
2800
2796
|
const { useValue: useSentryDsn, setValue: setSentryDsn, addEventHandler: addSentryDsnEventHandler } = makePHEventFunctions("sentryDsn");
|
|
2801
2797
|
const { useValue: useSentryEnv, setValue: setSentryEnv, addEventHandler: addSentryEnvEventHandler } = makePHEventFunctions("sentryEnv");
|
|
@@ -2893,6 +2889,8 @@ const nonUserConfigSetters = {
|
|
|
2893
2889
|
renownUrl: setRenownUrl,
|
|
2894
2890
|
renownNetworkId: setRenownNetworkId,
|
|
2895
2891
|
renownChainId: setRenownChainId,
|
|
2892
|
+
switchboardUrl: setSwitchboardUrl,
|
|
2893
|
+
renownAdapters: setRenownAdapters,
|
|
2896
2894
|
sentryRelease: setSentryRelease,
|
|
2897
2895
|
sentryDsn: setSentryDsn,
|
|
2898
2896
|
sentryEnv: setSentryEnv,
|
|
@@ -2941,6 +2939,8 @@ const nonUserConfigHooks = {
|
|
|
2941
2939
|
renownUrl: useRenownUrl,
|
|
2942
2940
|
renownNetworkId: useRenownNetworkId,
|
|
2943
2941
|
renownChainId: useRenownChainId,
|
|
2942
|
+
switchboardUrl: useSwitchboardUrl,
|
|
2943
|
+
renownAdapters: useRenownAdapters,
|
|
2944
2944
|
sentryRelease: useSentryRelease,
|
|
2945
2945
|
sentryDsn: useSentryDsn,
|
|
2946
2946
|
sentryEnv: useSentryEnv,
|
|
@@ -2970,366 +2970,884 @@ const featuresEventFunctions = makePHEventFunctions("features");
|
|
|
2970
2970
|
featuresEventFunctions.useValue;
|
|
2971
2971
|
featuresEventFunctions.setValue;
|
|
2972
2972
|
featuresEventFunctions.addEventHandler;
|
|
2973
|
-
function
|
|
2974
|
-
|
|
2973
|
+
function useDropTarget() {
|
|
2974
|
+
const [isDropTarget, setIsDropTarget] = useState(false);
|
|
2975
|
+
const isDragAndDropEnabled = useIsDragAndDropEnabled();
|
|
2976
|
+
const targetSetter = n$1(() => setIsDropTarget(true), {
|
|
2977
|
+
triggerAt: "start",
|
|
2978
|
+
minQuietPeriodMs: 100
|
|
2979
|
+
});
|
|
2980
|
+
const targetUnsetter = n$1(() => setIsDropTarget(false), {
|
|
2981
|
+
triggerAt: "start",
|
|
2982
|
+
minQuietPeriodMs: 100
|
|
2983
|
+
});
|
|
2984
|
+
function setTarget() {
|
|
2985
|
+
if (!isDragAndDropEnabled) return;
|
|
2986
|
+
targetUnsetter.cancel();
|
|
2987
|
+
targetSetter.call();
|
|
2988
|
+
}
|
|
2989
|
+
function unsetTarget() {
|
|
2990
|
+
if (!isDragAndDropEnabled) return;
|
|
2991
|
+
targetSetter.cancel();
|
|
2992
|
+
targetUnsetter.call();
|
|
2993
|
+
}
|
|
2994
|
+
return {
|
|
2995
|
+
isDropTarget,
|
|
2996
|
+
setTarget,
|
|
2997
|
+
unsetTarget
|
|
2998
|
+
};
|
|
2975
2999
|
}
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
3000
|
+
const draggingNodeEventFunctions = makePHEventFunctions("draggingNode");
|
|
3001
|
+
const useDraggingNode = draggingNodeEventFunctions.useValue;
|
|
3002
|
+
const setDraggingNode = draggingNodeEventFunctions.setValue;
|
|
3003
|
+
draggingNodeEventFunctions.addEventHandler;
|
|
3004
|
+
const draggingNodeSetter = n$1((node) => setDraggingNode(node), {
|
|
3005
|
+
reducer: (_, newNode) => newNode,
|
|
3006
|
+
triggerAt: "start",
|
|
3007
|
+
minQuietPeriodMs: 100
|
|
3008
|
+
});
|
|
3009
|
+
const draggingNodeUnsetter = n$1(() => setDraggingNode(void 0), {
|
|
3010
|
+
triggerAt: "start",
|
|
3011
|
+
minQuietPeriodMs: 100
|
|
3012
|
+
});
|
|
3013
|
+
function setDragging(node) {
|
|
3014
|
+
draggingNodeUnsetter.cancel();
|
|
3015
|
+
draggingNodeSetter.call(node);
|
|
2980
3016
|
}
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
const nodeName = node.name;
|
|
2985
|
-
if (!nodeName) return slug(node.id);
|
|
2986
|
-
return slug(`${nodeName}-${node.id}`);
|
|
3017
|
+
function unsetDragging() {
|
|
3018
|
+
draggingNodeSetter.cancel();
|
|
3019
|
+
draggingNodeUnsetter.call();
|
|
2987
3020
|
}
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
const
|
|
2994
|
-
|
|
3021
|
+
const isNodeDrag = (params) => t$3(params, [({ srcId }) => e$3(e$1)(srcId), e$6(false)], [({ driveId }) => e$3(e$1)(driveId), e$6(false)], [({ driveId, srcId }) => t(driveId, srcId), e$6(false)], e$6(true));
|
|
3022
|
+
function useDragNode(args) {
|
|
3023
|
+
const { srcId, parentId } = args;
|
|
3024
|
+
const driveId = useSelectedDriveId();
|
|
3025
|
+
const draggingNodeId = useDraggingNode()?.srcId;
|
|
3026
|
+
const params = {
|
|
3027
|
+
driveId,
|
|
3028
|
+
srcId,
|
|
3029
|
+
parentId
|
|
3030
|
+
};
|
|
3031
|
+
const draggable = isNodeDrag(params);
|
|
3032
|
+
const isDragging = t$4({
|
|
3033
|
+
srcId,
|
|
3034
|
+
draggingNodeId
|
|
3035
|
+
}, [
|
|
3036
|
+
() => draggable,
|
|
3037
|
+
({ srcId }) => e$2(srcId),
|
|
3038
|
+
({ draggingNodeId }) => e$2(draggingNodeId),
|
|
3039
|
+
({ srcId, draggingNodeId }) => t(srcId, draggingNodeId)
|
|
3040
|
+
]);
|
|
3041
|
+
const onDragStart = () => {
|
|
3042
|
+
if (!draggable) return;
|
|
3043
|
+
setDragging(params);
|
|
3044
|
+
};
|
|
3045
|
+
const onDragEnd = () => {
|
|
3046
|
+
if (!draggable) return;
|
|
3047
|
+
unsetDragging();
|
|
3048
|
+
};
|
|
3049
|
+
return {
|
|
3050
|
+
isDragging,
|
|
3051
|
+
draggable,
|
|
3052
|
+
onDragStart,
|
|
3053
|
+
onDragEnd
|
|
3054
|
+
};
|
|
2995
3055
|
}
|
|
2996
|
-
|
|
2997
|
-
function
|
|
2998
|
-
|
|
2999
|
-
|
|
3056
|
+
const isNodeDrop = (params) => t$3(params, [({ srcId }) => e$3(e$1)(srcId), e$6(false)], [({ driveId }) => e$3(e$4)(driveId), e$6(false)], [({ srcId, targetId }) => t(srcId, targetId), e$6(false)], [({ driveId, parentId, targetId }) => e$3(e$1)(parentId) && t(targetId, driveId), e$6(false)], [({ targetId, parentId }) => t(targetId, parentId), e$6(false)], e$6(true));
|
|
3057
|
+
function useDropNode(targetId) {
|
|
3058
|
+
const driveId = useSelectedDriveId();
|
|
3059
|
+
const { srcId, parentId } = useDraggingNode() ?? {};
|
|
3060
|
+
const { isDropTarget, setTarget, unsetTarget } = useDropTarget();
|
|
3061
|
+
const params = {
|
|
3062
|
+
driveId,
|
|
3063
|
+
parentId,
|
|
3064
|
+
targetId,
|
|
3065
|
+
srcId
|
|
3066
|
+
};
|
|
3067
|
+
function handleNodeDrop(event, cb) {
|
|
3068
|
+
if (!isNodeDrop(params)) return;
|
|
3069
|
+
event.preventDefault();
|
|
3070
|
+
event.stopPropagation();
|
|
3071
|
+
cb?.();
|
|
3072
|
+
}
|
|
3073
|
+
const onDragEnter = (event) => handleNodeDrop(event);
|
|
3074
|
+
const onDragOver = (event) => handleNodeDrop(event, e(setTarget));
|
|
3075
|
+
const onDragLeave = (event) => handleNodeDrop(event, e(unsetTarget));
|
|
3076
|
+
const onDrop = (event) => handleNodeDrop(event, e(() => {
|
|
3077
|
+
unsetDragging();
|
|
3078
|
+
unsetTarget();
|
|
3079
|
+
moveNodeById(params).catch(console.error);
|
|
3080
|
+
}));
|
|
3081
|
+
return {
|
|
3082
|
+
isDropTarget,
|
|
3083
|
+
onDragEnter,
|
|
3084
|
+
onDragOver,
|
|
3085
|
+
onDragLeave,
|
|
3086
|
+
onDrop
|
|
3087
|
+
};
|
|
3000
3088
|
}
|
|
3001
|
-
|
|
3002
|
-
|
|
3089
|
+
const graphQLReactorClientEventFunctions = makePHEventFunctions("reactorGraphQLClient");
|
|
3090
|
+
graphQLReactorClientEventFunctions.useValue;
|
|
3091
|
+
graphQLReactorClientEventFunctions.setValue;
|
|
3092
|
+
graphQLReactorClientEventFunctions.addEventHandler;
|
|
3093
|
+
const packageDiscoveryFunctions = makePHEventFunctions("packageDiscoveryService");
|
|
3094
|
+
packageDiscoveryFunctions.useValue;
|
|
3095
|
+
packageDiscoveryFunctions.setValue;
|
|
3096
|
+
packageDiscoveryFunctions.addEventHandler;
|
|
3097
|
+
const reactorClientModuleEventFunctions = makePHEventFunctions("reactorClientModule");
|
|
3098
|
+
const reactorClientEventFunctions = makePHEventFunctions("reactorClient");
|
|
3099
|
+
/** Returns the reactor client module (in-process or worker-backed) */
|
|
3100
|
+
const useReactorClientModule = reactorClientModuleEventFunctions.useValue;
|
|
3101
|
+
reactorClientModuleEventFunctions.setValue;
|
|
3102
|
+
reactorClientModuleEventFunctions.addEventHandler;
|
|
3103
|
+
reactorClientEventFunctions.useValue;
|
|
3104
|
+
reactorClientEventFunctions.setValue;
|
|
3105
|
+
reactorClientEventFunctions.addEventHandler;
|
|
3106
|
+
const useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager;
|
|
3107
|
+
const useSyncList = () => {
|
|
3108
|
+
return useSync()?.list() ?? [];
|
|
3109
|
+
};
|
|
3110
|
+
const useModelRegistry = () => useReactorClientModule()?.reactorModule?.documentModelRegistry;
|
|
3111
|
+
const revisionHistoryEventFunctions = makePHEventFunctions("revisionHistoryVisible");
|
|
3112
|
+
revisionHistoryEventFunctions.useValue;
|
|
3113
|
+
/** Sets revision history visibility */
|
|
3114
|
+
const setRevisionHistoryVisible = revisionHistoryEventFunctions.setValue;
|
|
3115
|
+
revisionHistoryEventFunctions.addEventHandler;
|
|
3116
|
+
/** Shows the revision history */
|
|
3117
|
+
function showRevisionHistory() {
|
|
3118
|
+
setRevisionHistoryVisible(true);
|
|
3003
3119
|
}
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3120
|
+
const selectedTimelineItemEventFunctions = makePHEventFunctions("selectedTimelineItem");
|
|
3121
|
+
selectedTimelineItemEventFunctions.useValue;
|
|
3122
|
+
selectedTimelineItemEventFunctions.setValue;
|
|
3123
|
+
selectedTimelineItemEventFunctions.addEventHandler;
|
|
3124
|
+
const selectedTimelineRevisionEventFunctions = makePHEventFunctions("selectedTimelineRevision");
|
|
3125
|
+
selectedTimelineRevisionEventFunctions.useValue;
|
|
3126
|
+
selectedTimelineRevisionEventFunctions.setValue;
|
|
3127
|
+
selectedTimelineRevisionEventFunctions.addEventHandler;
|
|
3128
|
+
const toastEventFunctions = makePHEventFunctions("toast");
|
|
3129
|
+
/** Returns the toast function */
|
|
3130
|
+
const usePHToast = toastEventFunctions.useValue;
|
|
3131
|
+
toastEventFunctions.setValue;
|
|
3132
|
+
toastEventFunctions.addEventHandler;
|
|
3133
|
+
//#endregion
|
|
3134
|
+
//#region ../reactor-browser/dist/selected-document-xFBNPc9Q.js
|
|
3135
|
+
/** Returns a document of a specific type, throws an error if the found document has a different type */
|
|
3136
|
+
function useDocumentOfType(documentId, documentType) {
|
|
3137
|
+
const [document, dispatch] = useDocumentById(documentId);
|
|
3138
|
+
const documentModelModule = useDocumentModelModuleById(documentType);
|
|
3139
|
+
if (!documentId || !documentType) return [];
|
|
3140
|
+
if (!document) throw new Error(`Document not found: ${documentId}`);
|
|
3141
|
+
if (!documentModelModule) throw new ModuleNotFoundError(documentType);
|
|
3142
|
+
if (document.header.documentType !== documentType) throw new DocumentTypeMismatchError(documentId, documentType, document.header.documentType);
|
|
3143
|
+
return [document, dispatch];
|
|
3011
3144
|
}
|
|
3012
|
-
/**
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3145
|
+
/** Returns the selected document id */
|
|
3146
|
+
function useSelectedDocumentId() {
|
|
3147
|
+
const selectedNode = useSelectedNode();
|
|
3148
|
+
return selectedNode && isFileNode(selectedNode) ? selectedNode.id : void 0;
|
|
3149
|
+
}
|
|
3150
|
+
/** Returns the selected document. */
|
|
3151
|
+
function useSelectedDocumentSafe() {
|
|
3152
|
+
return useDocumentById(useSelectedDocumentId());
|
|
3153
|
+
}
|
|
3154
|
+
function useSelectedDocumentOfType(documentType) {
|
|
3155
|
+
const documentId = useSelectedDocumentId();
|
|
3156
|
+
if (!documentType) return [];
|
|
3157
|
+
if (!documentId) throw new NoSelectedDocumentError();
|
|
3158
|
+
return useDocumentOfType(documentId, documentType);
|
|
3018
3159
|
}
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
const
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
const
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
if (
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
3160
|
+
//#endregion
|
|
3161
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/descriptors.js
|
|
3162
|
+
const normalizeDescriptors = (error) => {
|
|
3163
|
+
CORE_ERROR_PROPS.forEach((propName) => {
|
|
3164
|
+
normalizeDescriptor(error, propName);
|
|
3165
|
+
});
|
|
3166
|
+
};
|
|
3167
|
+
const CORE_ERROR_PROPS = [
|
|
3168
|
+
"name",
|
|
3169
|
+
"message",
|
|
3170
|
+
"stack",
|
|
3171
|
+
"cause",
|
|
3172
|
+
"errors"
|
|
3173
|
+
];
|
|
3174
|
+
const normalizeDescriptor = (error, propName) => {
|
|
3175
|
+
const descriptor = getDescriptor(error, propName);
|
|
3176
|
+
if (descriptor === void 0) return;
|
|
3177
|
+
if (isReadonlyGetter(descriptor)) {
|
|
3178
|
+
setErrorProperty(error, propName, error[propName]);
|
|
3039
3179
|
return;
|
|
3040
3180
|
}
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
const
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3181
|
+
if (isInvalidDescriptor(descriptor)) setErrorDescriptor(error, propName, descriptor);
|
|
3182
|
+
};
|
|
3183
|
+
const getDescriptor = (value, propName) => {
|
|
3184
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, propName);
|
|
3185
|
+
if (descriptor !== void 0) return descriptor;
|
|
3186
|
+
const prototype = Object.getPrototypeOf(value);
|
|
3187
|
+
return prototype === null ? void 0 : getDescriptor(prototype, propName);
|
|
3188
|
+
};
|
|
3189
|
+
const isReadonlyGetter = ({ get, set }) => get !== void 0 && set === void 0;
|
|
3190
|
+
const isInvalidDescriptor = ({ enumerable, writable }) => enumerable || !writable;
|
|
3191
|
+
const setErrorProperty = (error, propName, value) => {
|
|
3192
|
+
setErrorDescriptor(error, propName, { value });
|
|
3193
|
+
};
|
|
3194
|
+
const setErrorDescriptor = (error, propName, descriptor) => {
|
|
3195
|
+
Object.defineProperty(error, propName, {
|
|
3196
|
+
...descriptor,
|
|
3197
|
+
..."get" in descriptor || "set" in descriptor ? {} : { writable: true },
|
|
3198
|
+
enumerable: false,
|
|
3199
|
+
configurable: true
|
|
3200
|
+
});
|
|
3201
|
+
};
|
|
3202
|
+
//#endregion
|
|
3203
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/aggregate.js
|
|
3204
|
+
const normalizeAggregate = (error, recurse) => {
|
|
3205
|
+
if (Array.isArray(error.errors)) setErrorProperty(error, "errors", error.errors.filter(isDefined).map(recurse).filter(Boolean));
|
|
3206
|
+
else if (isAggregateError(error)) setErrorProperty(error, "errors", []);
|
|
3207
|
+
else if (error.errors !== void 0) deleteAggregateErrors(error);
|
|
3208
|
+
};
|
|
3209
|
+
const isDefined = (error) => error !== void 0;
|
|
3210
|
+
const isAggregateError = (error) => "AggregateError" in globalThis && (error.name === "AggregateError" || error instanceof AggregateError);
|
|
3211
|
+
const deleteAggregateErrors = (error) => {
|
|
3212
|
+
delete error.errors;
|
|
3213
|
+
if (error.errors !== void 0) setErrorProperty(error, "errors", []);
|
|
3214
|
+
};
|
|
3215
|
+
//#endregion
|
|
3216
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/cause.js
|
|
3217
|
+
const normalizeCause = (error, recurse) => {
|
|
3218
|
+
if (!("cause" in error)) return;
|
|
3219
|
+
const cause = error.cause === void 0 ? error.cause : recurse(error.cause);
|
|
3220
|
+
if (cause === void 0) delete error.cause;
|
|
3221
|
+
else setErrorProperty(error, "cause", cause);
|
|
3222
|
+
};
|
|
3223
|
+
//#endregion
|
|
3224
|
+
//#region ../../node_modules/.pnpm/is-error-instance@3.0.1/node_modules/is-error-instance/build/src/main.js
|
|
3225
|
+
const isErrorInstance = (value) => isInstanceOfError(value) || hasErrorTag(value);
|
|
3226
|
+
const isInstanceOfError = (value) => {
|
|
3227
|
+
try {
|
|
3228
|
+
return value instanceof Error;
|
|
3229
|
+
} catch {
|
|
3230
|
+
return false;
|
|
3231
|
+
}
|
|
3232
|
+
};
|
|
3233
|
+
const hasErrorTag = (value) => {
|
|
3234
|
+
try {
|
|
3235
|
+
return ERROR_TAGS.has(Object.prototype.toString.call(value));
|
|
3236
|
+
} catch {
|
|
3237
|
+
return false;
|
|
3238
|
+
}
|
|
3239
|
+
};
|
|
3240
|
+
const ERROR_TAGS = new Set([
|
|
3241
|
+
"[object Error]",
|
|
3242
|
+
"[object DOMException]",
|
|
3243
|
+
"[object DOMError]",
|
|
3244
|
+
"[object Exception]"
|
|
3245
|
+
]);
|
|
3246
|
+
//#endregion
|
|
3247
|
+
//#region ../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js
|
|
3248
|
+
function isPlainObject(value) {
|
|
3249
|
+
if (typeof value !== "object" || value === null) return false;
|
|
3250
|
+
const prototype = Object.getPrototypeOf(value);
|
|
3251
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
3058
3252
|
}
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3253
|
+
//#endregion
|
|
3254
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/modifiable.js
|
|
3255
|
+
const isNonModifiableError = (error) => !Object.isExtensible(error) || CORE_ERROR_PROPS.some((propName) => isNonConfigurableProp(error, propName) || isThrowingProp(error, propName));
|
|
3256
|
+
const isNonConfigurableProp = (error, propName) => {
|
|
3257
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, propName);
|
|
3258
|
+
return descriptor !== void 0 && !descriptor.configurable;
|
|
3259
|
+
};
|
|
3260
|
+
const isThrowingProp = (error, propName) => {
|
|
3261
|
+
try {
|
|
3262
|
+
error[propName];
|
|
3263
|
+
return false;
|
|
3264
|
+
} catch {
|
|
3265
|
+
return true;
|
|
3067
3266
|
}
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3267
|
+
};
|
|
3268
|
+
//#endregion
|
|
3269
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/stack.js
|
|
3270
|
+
const setStack = (error) => {
|
|
3271
|
+
setErrorProperty(error, "stack", getStack(error.message, error.name));
|
|
3272
|
+
};
|
|
3273
|
+
const getStack = (message = "", name = "Error") => {
|
|
3274
|
+
const { stack } = new (getErrorClass(name))(message);
|
|
3275
|
+
return typeof stack === "string" && stack !== "" ? stack : `${name}: ${message}`;
|
|
3276
|
+
};
|
|
3277
|
+
const getErrorClass = (name) => {
|
|
3278
|
+
const descriptor = {
|
|
3279
|
+
value: name,
|
|
3280
|
+
enumerable: false,
|
|
3281
|
+
writable: true,
|
|
3282
|
+
configurable: true
|
|
3283
|
+
};
|
|
3284
|
+
const StackError = Object.defineProperty(class extends Error {}, "name", descriptor);
|
|
3285
|
+
Object.defineProperty(StackError.prototype, "name", descriptor);
|
|
3286
|
+
return StackError;
|
|
3287
|
+
};
|
|
3288
|
+
//#endregion
|
|
3289
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/copy.js
|
|
3290
|
+
const copyObject = (object) => {
|
|
3291
|
+
const objectCopy = {};
|
|
3292
|
+
for (const propName of getPropsToCopy(object)) try {
|
|
3293
|
+
const value = object[propName];
|
|
3294
|
+
const { enumerable, configurable, writable = true } = getDescriptor(object, propName);
|
|
3295
|
+
Object.defineProperty(objectCopy, propName, {
|
|
3296
|
+
value,
|
|
3297
|
+
enumerable,
|
|
3298
|
+
configurable,
|
|
3299
|
+
writable
|
|
3300
|
+
});
|
|
3301
|
+
} catch {}
|
|
3302
|
+
return objectCopy;
|
|
3303
|
+
};
|
|
3304
|
+
const getPropsToCopy = (object) => {
|
|
3305
|
+
const propNames = getOwnKeys(object);
|
|
3306
|
+
for (const propName of CORE_ERROR_PROPS) if (isInheritedProp(object, propName)) propNames.push(propName);
|
|
3307
|
+
return propNames;
|
|
3308
|
+
};
|
|
3309
|
+
const getOwnKeys = (object) => {
|
|
3310
|
+
try {
|
|
3311
|
+
return Reflect.ownKeys(object);
|
|
3312
|
+
} catch {
|
|
3313
|
+
return [];
|
|
3314
|
+
}
|
|
3315
|
+
};
|
|
3316
|
+
const isInheritedProp = (object, propName) => {
|
|
3317
|
+
try {
|
|
3318
|
+
return propName in object && !Object.hasOwn(object, propName);
|
|
3319
|
+
} catch {
|
|
3320
|
+
return false;
|
|
3321
|
+
}
|
|
3322
|
+
};
|
|
3323
|
+
//#endregion
|
|
3324
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/object.js
|
|
3325
|
+
const objectifyError = (object) => {
|
|
3326
|
+
const { name, message, stack, cause, errors, ...objectA } = copyObject(object);
|
|
3327
|
+
const messageA = getMessage(message, objectA);
|
|
3328
|
+
const error = newError(name, messageA);
|
|
3329
|
+
if (message === messageA) assignObjectProps(error, objectA);
|
|
3330
|
+
Object.entries({
|
|
3331
|
+
name,
|
|
3332
|
+
stack,
|
|
3333
|
+
cause,
|
|
3334
|
+
errors
|
|
3335
|
+
}).forEach(([propName, propValue]) => {
|
|
3336
|
+
setNewErrorProperty(error, propName, propValue);
|
|
3337
|
+
});
|
|
3338
|
+
if (stack === void 0) setStack(error);
|
|
3339
|
+
return error;
|
|
3340
|
+
};
|
|
3341
|
+
const getMessage = (message, object) => typeof message === "string" && message !== "" ? message : truncateMessage(safeJsonStringify(object));
|
|
3342
|
+
const safeJsonStringify = (object) => {
|
|
3343
|
+
try {
|
|
3344
|
+
return JSON.stringify(object);
|
|
3345
|
+
} catch {
|
|
3346
|
+
return safeStringify(object);
|
|
3347
|
+
}
|
|
3348
|
+
};
|
|
3349
|
+
const safeStringify = (object) => {
|
|
3350
|
+
try {
|
|
3351
|
+
return String(object);
|
|
3352
|
+
} catch {
|
|
3353
|
+
return "Invalid error";
|
|
3354
|
+
}
|
|
3355
|
+
};
|
|
3356
|
+
const truncateMessage = (message) => message.length < MESSAGE_MAX_SIZE ? message : `${message.slice(0, MESSAGE_MAX_SIZE)}...`;
|
|
3357
|
+
const MESSAGE_MAX_SIZE = 1e3;
|
|
3358
|
+
const newError = (name, message) => {
|
|
3359
|
+
if (name === "AggregateError" && "AggregateError" in globalThis) return new AggregateError([], message);
|
|
3360
|
+
if (name in NATIVE_ERRORS) return new NATIVE_ERRORS[name](message);
|
|
3361
|
+
return new Error(message);
|
|
3362
|
+
};
|
|
3363
|
+
const NATIVE_ERRORS = {
|
|
3364
|
+
Error,
|
|
3365
|
+
ReferenceError,
|
|
3366
|
+
TypeError,
|
|
3367
|
+
SyntaxError,
|
|
3368
|
+
RangeError,
|
|
3369
|
+
URIError,
|
|
3370
|
+
EvalError
|
|
3371
|
+
};
|
|
3372
|
+
const assignObjectProps = (error, object) => {
|
|
3373
|
+
for (const propName in object) if (!(propName in error)) error[propName] = object[propName];
|
|
3374
|
+
};
|
|
3375
|
+
const setNewErrorProperty = (error, propName, propValue) => {
|
|
3376
|
+
if (propValue !== void 0) setErrorProperty(error, propName, propValue);
|
|
3377
|
+
};
|
|
3378
|
+
//#endregion
|
|
3379
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/string.js
|
|
3380
|
+
const stringifyError = (value) => {
|
|
3381
|
+
try {
|
|
3382
|
+
const error = new Error(String(value));
|
|
3383
|
+
setStack(error);
|
|
3384
|
+
return error;
|
|
3385
|
+
} catch (error_) {
|
|
3386
|
+
return error_;
|
|
3075
3387
|
}
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
}
|
|
3080
|
-
const
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
}
|
|
3092
|
-
});
|
|
3093
|
-
}
|
|
3094
|
-
let pendingHandler;
|
|
3095
|
-
let pendingTimeout;
|
|
3096
|
-
function cancelPendingDriveSelection() {
|
|
3097
|
-
if (pendingHandler) {
|
|
3098
|
-
window.removeEventListener("ph:drivesUpdated", pendingHandler);
|
|
3099
|
-
pendingHandler = void 0;
|
|
3388
|
+
};
|
|
3389
|
+
//#endregion
|
|
3390
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/main.js
|
|
3391
|
+
const { toString: objectToString } = Object.prototype;
|
|
3392
|
+
const createError = (value) => {
|
|
3393
|
+
if (isErrorPlainObj(value)) return objectifyError(value);
|
|
3394
|
+
if (!isErrorInstance(value)) return stringifyError(value);
|
|
3395
|
+
if (isInvalidError(value)) return objectifyError(value);
|
|
3396
|
+
return value;
|
|
3397
|
+
};
|
|
3398
|
+
const isErrorPlainObj = (value) => {
|
|
3399
|
+
try {
|
|
3400
|
+
return isPlainObject(value);
|
|
3401
|
+
} catch {
|
|
3402
|
+
return false;
|
|
3100
3403
|
}
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3404
|
+
};
|
|
3405
|
+
const isInvalidError = (value) => isProxy(value) || isNonModifiableError(value) || hasInvalidConstructor(value);
|
|
3406
|
+
const isProxy = (value) => {
|
|
3407
|
+
try {
|
|
3408
|
+
return objectToString.call(value) === "[object Object]";
|
|
3409
|
+
} catch {
|
|
3410
|
+
return true;
|
|
3104
3411
|
}
|
|
3105
|
-
}
|
|
3106
|
-
function
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3412
|
+
};
|
|
3413
|
+
const hasInvalidConstructor = (error) => typeof error.constructor !== "function" || typeof error.constructor.name !== "string" || error.constructor.name === "" || error.constructor.prototype !== Object.getPrototypeOf(error);
|
|
3414
|
+
//#endregion
|
|
3415
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/main.js
|
|
3416
|
+
const normalizeException = (error, { shallow = false } = {}) => recurseException(error, [], shallow);
|
|
3417
|
+
const recurseException = (error, parents, shallow) => {
|
|
3418
|
+
if (parents.includes(error)) return;
|
|
3419
|
+
const recurse = shallow ? identity : (innerError) => recurseException(innerError, [...parents, error], shallow);
|
|
3420
|
+
const errorA = createError(error);
|
|
3421
|
+
normalizeProps(errorA, recurse);
|
|
3422
|
+
return errorA;
|
|
3423
|
+
};
|
|
3424
|
+
const identity = (error) => error;
|
|
3425
|
+
const normalizeProps = (error, recurse) => {
|
|
3426
|
+
normalizeName(error);
|
|
3427
|
+
normalizeMessage(error);
|
|
3428
|
+
normalizeStack(error);
|
|
3429
|
+
normalizeCause(error, recurse);
|
|
3430
|
+
normalizeAggregate(error, recurse);
|
|
3431
|
+
normalizeDescriptors(error);
|
|
3432
|
+
};
|
|
3433
|
+
const normalizeName = (error) => {
|
|
3434
|
+
if (isDefinedString(error.name)) return;
|
|
3435
|
+
const prototypeName = Object.getPrototypeOf(error).name;
|
|
3436
|
+
setErrorProperty(error, "name", isDefinedString(prototypeName) ? prototypeName : error.constructor.name);
|
|
3437
|
+
};
|
|
3438
|
+
const normalizeMessage = (error) => {
|
|
3439
|
+
if (!isDefinedString(error.message)) setErrorProperty(error, "message", "");
|
|
3440
|
+
};
|
|
3441
|
+
const normalizeStack = (error) => {
|
|
3442
|
+
if (!isDefinedString(error.stack)) setStack(error);
|
|
3443
|
+
};
|
|
3444
|
+
const isDefinedString = (value) => typeof value === "string" && value !== "";
|
|
3445
|
+
//#endregion
|
|
3446
|
+
//#region ../reactor-browser/dist/index.js
|
|
3447
|
+
var import_lz_string = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3448
|
+
var LZString = (function() {
|
|
3449
|
+
var f = String.fromCharCode;
|
|
3450
|
+
var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
3451
|
+
var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
|
|
3452
|
+
var baseReverseDic = {};
|
|
3453
|
+
function getBaseValue(alphabet, character) {
|
|
3454
|
+
if (!baseReverseDic[alphabet]) {
|
|
3455
|
+
baseReverseDic[alphabet] = {};
|
|
3456
|
+
for (var i = 0; i < alphabet.length; i++) baseReverseDic[alphabet][alphabet.charAt(i)] = i;
|
|
3457
|
+
}
|
|
3458
|
+
return baseReverseDic[alphabet][character];
|
|
3459
|
+
}
|
|
3460
|
+
var LZString = {
|
|
3461
|
+
compressToBase64: function(input) {
|
|
3462
|
+
if (input == null) return "";
|
|
3463
|
+
var res = LZString._compress(input, 6, function(a) {
|
|
3464
|
+
return keyStrBase64.charAt(a);
|
|
3465
|
+
});
|
|
3466
|
+
switch (res.length % 4) {
|
|
3467
|
+
default:
|
|
3468
|
+
case 0: return res;
|
|
3469
|
+
case 1: return res + "===";
|
|
3470
|
+
case 2: return res + "==";
|
|
3471
|
+
case 3: return res + "=";
|
|
3472
|
+
}
|
|
3473
|
+
},
|
|
3474
|
+
decompressFromBase64: function(input) {
|
|
3475
|
+
if (input == null) return "";
|
|
3476
|
+
if (input == "") return null;
|
|
3477
|
+
return LZString._decompress(input.length, 32, function(index) {
|
|
3478
|
+
return getBaseValue(keyStrBase64, input.charAt(index));
|
|
3479
|
+
});
|
|
3480
|
+
},
|
|
3481
|
+
compressToUTF16: function(input) {
|
|
3482
|
+
if (input == null) return "";
|
|
3483
|
+
return LZString._compress(input, 15, function(a) {
|
|
3484
|
+
return f(a + 32);
|
|
3485
|
+
}) + " ";
|
|
3486
|
+
},
|
|
3487
|
+
decompressFromUTF16: function(compressed) {
|
|
3488
|
+
if (compressed == null) return "";
|
|
3489
|
+
if (compressed == "") return null;
|
|
3490
|
+
return LZString._decompress(compressed.length, 16384, function(index) {
|
|
3491
|
+
return compressed.charCodeAt(index) - 32;
|
|
3492
|
+
});
|
|
3493
|
+
},
|
|
3494
|
+
compressToUint8Array: function(uncompressed) {
|
|
3495
|
+
var compressed = LZString.compress(uncompressed);
|
|
3496
|
+
var buf = new Uint8Array(compressed.length * 2);
|
|
3497
|
+
for (var i = 0, TotalLen = compressed.length; i < TotalLen; i++) {
|
|
3498
|
+
var current_value = compressed.charCodeAt(i);
|
|
3499
|
+
buf[i * 2] = current_value >>> 8;
|
|
3500
|
+
buf[i * 2 + 1] = current_value % 256;
|
|
3501
|
+
}
|
|
3502
|
+
return buf;
|
|
3503
|
+
},
|
|
3504
|
+
decompressFromUint8Array: function(compressed) {
|
|
3505
|
+
if (compressed === null || compressed === void 0) return LZString.decompress(compressed);
|
|
3506
|
+
else {
|
|
3507
|
+
var buf = new Array(compressed.length / 2);
|
|
3508
|
+
for (var i = 0, TotalLen = buf.length; i < TotalLen; i++) buf[i] = compressed[i * 2] * 256 + compressed[i * 2 + 1];
|
|
3509
|
+
var result = [];
|
|
3510
|
+
buf.forEach(function(c) {
|
|
3511
|
+
result.push(f(c));
|
|
3512
|
+
});
|
|
3513
|
+
return LZString.decompress(result.join(""));
|
|
3514
|
+
}
|
|
3515
|
+
},
|
|
3516
|
+
compressToEncodedURIComponent: function(input) {
|
|
3517
|
+
if (input == null) return "";
|
|
3518
|
+
return LZString._compress(input, 6, function(a) {
|
|
3519
|
+
return keyStrUriSafe.charAt(a);
|
|
3520
|
+
});
|
|
3521
|
+
},
|
|
3522
|
+
decompressFromEncodedURIComponent: function(input) {
|
|
3523
|
+
if (input == null) return "";
|
|
3524
|
+
if (input == "") return null;
|
|
3525
|
+
input = input.replace(/ /g, "+");
|
|
3526
|
+
return LZString._decompress(input.length, 32, function(index) {
|
|
3527
|
+
return getBaseValue(keyStrUriSafe, input.charAt(index));
|
|
3528
|
+
});
|
|
3529
|
+
},
|
|
3530
|
+
compress: function(uncompressed) {
|
|
3531
|
+
return LZString._compress(uncompressed, 16, function(a) {
|
|
3532
|
+
return f(a);
|
|
3533
|
+
});
|
|
3534
|
+
},
|
|
3535
|
+
_compress: function(uncompressed, bitsPerChar, getCharFromInt) {
|
|
3536
|
+
if (uncompressed == null) return "";
|
|
3537
|
+
var i, value, context_dictionary = {}, context_dictionaryToCreate = {}, context_c = "", context_wc = "", context_w = "", context_enlargeIn = 2, context_dictSize = 3, context_numBits = 2, context_data = [], context_data_val = 0, context_data_position = 0, ii;
|
|
3538
|
+
for (ii = 0; ii < uncompressed.length; ii += 1) {
|
|
3539
|
+
context_c = uncompressed.charAt(ii);
|
|
3540
|
+
if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
|
|
3541
|
+
context_dictionary[context_c] = context_dictSize++;
|
|
3542
|
+
context_dictionaryToCreate[context_c] = true;
|
|
3543
|
+
}
|
|
3544
|
+
context_wc = context_w + context_c;
|
|
3545
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) context_w = context_wc;
|
|
3546
|
+
else {
|
|
3547
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
3548
|
+
if (context_w.charCodeAt(0) < 256) {
|
|
3549
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3550
|
+
context_data_val = context_data_val << 1;
|
|
3551
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3552
|
+
context_data_position = 0;
|
|
3553
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3554
|
+
context_data_val = 0;
|
|
3555
|
+
} else context_data_position++;
|
|
3556
|
+
}
|
|
3557
|
+
value = context_w.charCodeAt(0);
|
|
3558
|
+
for (i = 0; i < 8; i++) {
|
|
3559
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3560
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3561
|
+
context_data_position = 0;
|
|
3562
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3563
|
+
context_data_val = 0;
|
|
3564
|
+
} else context_data_position++;
|
|
3565
|
+
value = value >> 1;
|
|
3566
|
+
}
|
|
3567
|
+
} else {
|
|
3568
|
+
value = 1;
|
|
3569
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3570
|
+
context_data_val = context_data_val << 1 | value;
|
|
3571
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3572
|
+
context_data_position = 0;
|
|
3573
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3574
|
+
context_data_val = 0;
|
|
3575
|
+
} else context_data_position++;
|
|
3576
|
+
value = 0;
|
|
3577
|
+
}
|
|
3578
|
+
value = context_w.charCodeAt(0);
|
|
3579
|
+
for (i = 0; i < 16; i++) {
|
|
3580
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3581
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3582
|
+
context_data_position = 0;
|
|
3583
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3584
|
+
context_data_val = 0;
|
|
3585
|
+
} else context_data_position++;
|
|
3586
|
+
value = value >> 1;
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
context_enlargeIn--;
|
|
3590
|
+
if (context_enlargeIn == 0) {
|
|
3591
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
3592
|
+
context_numBits++;
|
|
3593
|
+
}
|
|
3594
|
+
delete context_dictionaryToCreate[context_w];
|
|
3595
|
+
} else {
|
|
3596
|
+
value = context_dictionary[context_w];
|
|
3597
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3598
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3599
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3600
|
+
context_data_position = 0;
|
|
3601
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3602
|
+
context_data_val = 0;
|
|
3603
|
+
} else context_data_position++;
|
|
3604
|
+
value = value >> 1;
|
|
3605
|
+
}
|
|
3606
|
+
}
|
|
3607
|
+
context_enlargeIn--;
|
|
3608
|
+
if (context_enlargeIn == 0) {
|
|
3609
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
3610
|
+
context_numBits++;
|
|
3611
|
+
}
|
|
3612
|
+
context_dictionary[context_wc] = context_dictSize++;
|
|
3613
|
+
context_w = String(context_c);
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
if (context_w !== "") {
|
|
3617
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
3618
|
+
if (context_w.charCodeAt(0) < 256) {
|
|
3619
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3620
|
+
context_data_val = context_data_val << 1;
|
|
3621
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3622
|
+
context_data_position = 0;
|
|
3623
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3624
|
+
context_data_val = 0;
|
|
3625
|
+
} else context_data_position++;
|
|
3626
|
+
}
|
|
3627
|
+
value = context_w.charCodeAt(0);
|
|
3628
|
+
for (i = 0; i < 8; i++) {
|
|
3629
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3630
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3631
|
+
context_data_position = 0;
|
|
3632
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3633
|
+
context_data_val = 0;
|
|
3634
|
+
} else context_data_position++;
|
|
3635
|
+
value = value >> 1;
|
|
3636
|
+
}
|
|
3637
|
+
} else {
|
|
3638
|
+
value = 1;
|
|
3639
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3640
|
+
context_data_val = context_data_val << 1 | value;
|
|
3641
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3642
|
+
context_data_position = 0;
|
|
3643
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3644
|
+
context_data_val = 0;
|
|
3645
|
+
} else context_data_position++;
|
|
3646
|
+
value = 0;
|
|
3647
|
+
}
|
|
3648
|
+
value = context_w.charCodeAt(0);
|
|
3649
|
+
for (i = 0; i < 16; i++) {
|
|
3650
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3651
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3652
|
+
context_data_position = 0;
|
|
3653
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3654
|
+
context_data_val = 0;
|
|
3655
|
+
} else context_data_position++;
|
|
3656
|
+
value = value >> 1;
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
context_enlargeIn--;
|
|
3660
|
+
if (context_enlargeIn == 0) {
|
|
3661
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
3662
|
+
context_numBits++;
|
|
3663
|
+
}
|
|
3664
|
+
delete context_dictionaryToCreate[context_w];
|
|
3665
|
+
} else {
|
|
3666
|
+
value = context_dictionary[context_w];
|
|
3667
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3668
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3669
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3670
|
+
context_data_position = 0;
|
|
3671
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3672
|
+
context_data_val = 0;
|
|
3673
|
+
} else context_data_position++;
|
|
3674
|
+
value = value >> 1;
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
context_enlargeIn--;
|
|
3678
|
+
if (context_enlargeIn == 0) {
|
|
3679
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
3680
|
+
context_numBits++;
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
value = 2;
|
|
3684
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3685
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3686
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3687
|
+
context_data_position = 0;
|
|
3688
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3689
|
+
context_data_val = 0;
|
|
3690
|
+
} else context_data_position++;
|
|
3691
|
+
value = value >> 1;
|
|
3692
|
+
}
|
|
3693
|
+
while (true) {
|
|
3694
|
+
context_data_val = context_data_val << 1;
|
|
3695
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3696
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3697
|
+
break;
|
|
3698
|
+
} else context_data_position++;
|
|
3699
|
+
}
|
|
3700
|
+
return context_data.join("");
|
|
3701
|
+
},
|
|
3702
|
+
decompress: function(compressed) {
|
|
3703
|
+
if (compressed == null) return "";
|
|
3704
|
+
if (compressed == "") return null;
|
|
3705
|
+
return LZString._decompress(compressed.length, 32768, function(index) {
|
|
3706
|
+
return compressed.charCodeAt(index);
|
|
3707
|
+
});
|
|
3708
|
+
},
|
|
3709
|
+
_decompress: function(length, resetValue, getNextValue) {
|
|
3710
|
+
var dictionary = [], enlargeIn = 4, dictSize = 4, numBits = 3, entry = "", result = [], i, w, bits, resb, maxpower, power, c, data = {
|
|
3711
|
+
val: getNextValue(0),
|
|
3712
|
+
position: resetValue,
|
|
3713
|
+
index: 1
|
|
3714
|
+
};
|
|
3715
|
+
for (i = 0; i < 3; i += 1) dictionary[i] = i;
|
|
3716
|
+
bits = 0;
|
|
3717
|
+
maxpower = Math.pow(2, 2);
|
|
3718
|
+
power = 1;
|
|
3719
|
+
while (power != maxpower) {
|
|
3720
|
+
resb = data.val & data.position;
|
|
3721
|
+
data.position >>= 1;
|
|
3722
|
+
if (data.position == 0) {
|
|
3723
|
+
data.position = resetValue;
|
|
3724
|
+
data.val = getNextValue(data.index++);
|
|
3725
|
+
}
|
|
3726
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3727
|
+
power <<= 1;
|
|
3728
|
+
}
|
|
3729
|
+
switch (bits) {
|
|
3730
|
+
case 0:
|
|
3731
|
+
bits = 0;
|
|
3732
|
+
maxpower = Math.pow(2, 8);
|
|
3733
|
+
power = 1;
|
|
3734
|
+
while (power != maxpower) {
|
|
3735
|
+
resb = data.val & data.position;
|
|
3736
|
+
data.position >>= 1;
|
|
3737
|
+
if (data.position == 0) {
|
|
3738
|
+
data.position = resetValue;
|
|
3739
|
+
data.val = getNextValue(data.index++);
|
|
3740
|
+
}
|
|
3741
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3742
|
+
power <<= 1;
|
|
3743
|
+
}
|
|
3744
|
+
c = f(bits);
|
|
3745
|
+
break;
|
|
3746
|
+
case 1:
|
|
3747
|
+
bits = 0;
|
|
3748
|
+
maxpower = Math.pow(2, 16);
|
|
3749
|
+
power = 1;
|
|
3750
|
+
while (power != maxpower) {
|
|
3751
|
+
resb = data.val & data.position;
|
|
3752
|
+
data.position >>= 1;
|
|
3753
|
+
if (data.position == 0) {
|
|
3754
|
+
data.position = resetValue;
|
|
3755
|
+
data.val = getNextValue(data.index++);
|
|
3756
|
+
}
|
|
3757
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3758
|
+
power <<= 1;
|
|
3759
|
+
}
|
|
3760
|
+
c = f(bits);
|
|
3761
|
+
break;
|
|
3762
|
+
case 2: return "";
|
|
3763
|
+
}
|
|
3764
|
+
dictionary[3] = c;
|
|
3765
|
+
w = c;
|
|
3766
|
+
result.push(c);
|
|
3767
|
+
while (true) {
|
|
3768
|
+
if (data.index > length) return "";
|
|
3769
|
+
bits = 0;
|
|
3770
|
+
maxpower = Math.pow(2, numBits);
|
|
3771
|
+
power = 1;
|
|
3772
|
+
while (power != maxpower) {
|
|
3773
|
+
resb = data.val & data.position;
|
|
3774
|
+
data.position >>= 1;
|
|
3775
|
+
if (data.position == 0) {
|
|
3776
|
+
data.position = resetValue;
|
|
3777
|
+
data.val = getNextValue(data.index++);
|
|
3778
|
+
}
|
|
3779
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3780
|
+
power <<= 1;
|
|
3781
|
+
}
|
|
3782
|
+
switch (c = bits) {
|
|
3783
|
+
case 0:
|
|
3784
|
+
bits = 0;
|
|
3785
|
+
maxpower = Math.pow(2, 8);
|
|
3786
|
+
power = 1;
|
|
3787
|
+
while (power != maxpower) {
|
|
3788
|
+
resb = data.val & data.position;
|
|
3789
|
+
data.position >>= 1;
|
|
3790
|
+
if (data.position == 0) {
|
|
3791
|
+
data.position = resetValue;
|
|
3792
|
+
data.val = getNextValue(data.index++);
|
|
3793
|
+
}
|
|
3794
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3795
|
+
power <<= 1;
|
|
3796
|
+
}
|
|
3797
|
+
dictionary[dictSize++] = f(bits);
|
|
3798
|
+
c = dictSize - 1;
|
|
3799
|
+
enlargeIn--;
|
|
3800
|
+
break;
|
|
3801
|
+
case 1:
|
|
3802
|
+
bits = 0;
|
|
3803
|
+
maxpower = Math.pow(2, 16);
|
|
3804
|
+
power = 1;
|
|
3805
|
+
while (power != maxpower) {
|
|
3806
|
+
resb = data.val & data.position;
|
|
3807
|
+
data.position >>= 1;
|
|
3808
|
+
if (data.position == 0) {
|
|
3809
|
+
data.position = resetValue;
|
|
3810
|
+
data.val = getNextValue(data.index++);
|
|
3811
|
+
}
|
|
3812
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3813
|
+
power <<= 1;
|
|
3814
|
+
}
|
|
3815
|
+
dictionary[dictSize++] = f(bits);
|
|
3816
|
+
c = dictSize - 1;
|
|
3817
|
+
enlargeIn--;
|
|
3818
|
+
break;
|
|
3819
|
+
case 2: return result.join("");
|
|
3820
|
+
}
|
|
3821
|
+
if (enlargeIn == 0) {
|
|
3822
|
+
enlargeIn = Math.pow(2, numBits);
|
|
3823
|
+
numBits++;
|
|
3824
|
+
}
|
|
3825
|
+
if (dictionary[c]) entry = dictionary[c];
|
|
3826
|
+
else if (c === dictSize) entry = w + w.charAt(0);
|
|
3827
|
+
else return null;
|
|
3828
|
+
result.push(entry);
|
|
3829
|
+
dictionary[dictSize++] = w + entry.charAt(0);
|
|
3830
|
+
enlargeIn--;
|
|
3831
|
+
w = entry;
|
|
3832
|
+
if (enlargeIn == 0) {
|
|
3833
|
+
enlargeIn = Math.pow(2, numBits);
|
|
3834
|
+
numBits++;
|
|
3835
|
+
}
|
|
3836
|
+
}
|
|
3123
3837
|
}
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
};
|
|
3130
|
-
scheduleTick();
|
|
3131
|
-
}
|
|
3132
|
-
function useDropTarget() {
|
|
3133
|
-
const [isDropTarget, setIsDropTarget] = useState(false);
|
|
3134
|
-
const isDragAndDropEnabled = useIsDragAndDropEnabled();
|
|
3135
|
-
const targetSetter = n$1(() => setIsDropTarget(true), {
|
|
3136
|
-
triggerAt: "start",
|
|
3137
|
-
minQuietPeriodMs: 100
|
|
3838
|
+
};
|
|
3839
|
+
return LZString;
|
|
3840
|
+
})();
|
|
3841
|
+
if (typeof define === "function" && define.amd) define(function() {
|
|
3842
|
+
return LZString;
|
|
3138
3843
|
});
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3844
|
+
else if (typeof module !== "undefined" && module != null) module.exports = LZString;
|
|
3845
|
+
else if (typeof angular !== "undefined" && angular != null) angular.module("LZString", []).factory("LZString", function() {
|
|
3846
|
+
return LZString;
|
|
3142
3847
|
});
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
targetSetter.call();
|
|
3147
|
-
}
|
|
3148
|
-
function unsetTarget() {
|
|
3149
|
-
if (!isDragAndDropEnabled) return;
|
|
3150
|
-
targetSetter.cancel();
|
|
3151
|
-
targetUnsetter.call();
|
|
3152
|
-
}
|
|
3153
|
-
return {
|
|
3154
|
-
isDropTarget,
|
|
3155
|
-
setTarget,
|
|
3156
|
-
unsetTarget
|
|
3157
|
-
};
|
|
3158
|
-
}
|
|
3159
|
-
const draggingNodeEventFunctions = makePHEventFunctions("draggingNode");
|
|
3160
|
-
const useDraggingNode = draggingNodeEventFunctions.useValue;
|
|
3161
|
-
const setDraggingNode = draggingNodeEventFunctions.setValue;
|
|
3162
|
-
draggingNodeEventFunctions.addEventHandler;
|
|
3163
|
-
const draggingNodeSetter = n$1((node) => setDraggingNode(node), {
|
|
3164
|
-
reducer: (_, newNode) => newNode,
|
|
3165
|
-
triggerAt: "start",
|
|
3166
|
-
minQuietPeriodMs: 100
|
|
3167
|
-
});
|
|
3168
|
-
const draggingNodeUnsetter = n$1(() => setDraggingNode(void 0), {
|
|
3169
|
-
triggerAt: "start",
|
|
3170
|
-
minQuietPeriodMs: 100
|
|
3171
|
-
});
|
|
3172
|
-
function setDragging(node) {
|
|
3173
|
-
draggingNodeUnsetter.cancel();
|
|
3174
|
-
draggingNodeSetter.call(node);
|
|
3175
|
-
}
|
|
3176
|
-
function unsetDragging() {
|
|
3177
|
-
draggingNodeSetter.cancel();
|
|
3178
|
-
draggingNodeUnsetter.call();
|
|
3179
|
-
}
|
|
3180
|
-
const isNodeDrag = (params) => t$3(params, [({ srcId }) => e$3(e$1)(srcId), e$6(false)], [({ driveId }) => e$3(e$1)(driveId), e$6(false)], [({ driveId, srcId }) => t(driveId, srcId), e$6(false)], e$6(true));
|
|
3181
|
-
function useDragNode(args) {
|
|
3182
|
-
const { srcId, parentId } = args;
|
|
3183
|
-
const driveId = useSelectedDriveId();
|
|
3184
|
-
const draggingNodeId = useDraggingNode()?.srcId;
|
|
3185
|
-
const params = {
|
|
3186
|
-
driveId,
|
|
3187
|
-
srcId,
|
|
3188
|
-
parentId
|
|
3189
|
-
};
|
|
3190
|
-
const draggable = isNodeDrag(params);
|
|
3191
|
-
const isDragging = t$4({
|
|
3192
|
-
srcId,
|
|
3193
|
-
draggingNodeId
|
|
3194
|
-
}, [
|
|
3195
|
-
() => draggable,
|
|
3196
|
-
({ srcId }) => e$2(srcId),
|
|
3197
|
-
({ draggingNodeId }) => e$2(draggingNodeId),
|
|
3198
|
-
({ srcId, draggingNodeId }) => t(srcId, draggingNodeId)
|
|
3199
|
-
]);
|
|
3200
|
-
const onDragStart = () => {
|
|
3201
|
-
if (!draggable) return;
|
|
3202
|
-
setDragging(params);
|
|
3203
|
-
};
|
|
3204
|
-
const onDragEnd = () => {
|
|
3205
|
-
if (!draggable) return;
|
|
3206
|
-
unsetDragging();
|
|
3207
|
-
};
|
|
3208
|
-
return {
|
|
3209
|
-
isDragging,
|
|
3210
|
-
draggable,
|
|
3211
|
-
onDragStart,
|
|
3212
|
-
onDragEnd
|
|
3213
|
-
};
|
|
3214
|
-
}
|
|
3215
|
-
const isNodeDrop = (params) => t$3(params, [({ srcId }) => e$3(e$1)(srcId), e$6(false)], [({ driveId }) => e$3(e$4)(driveId), e$6(false)], [({ srcId, targetId }) => t(srcId, targetId), e$6(false)], [({ driveId, parentId, targetId }) => e$3(e$1)(parentId) && t(targetId, driveId), e$6(false)], [({ targetId, parentId }) => t(targetId, parentId), e$6(false)], e$6(true));
|
|
3216
|
-
function useDropNode(targetId) {
|
|
3217
|
-
const driveId = useSelectedDriveId();
|
|
3218
|
-
const { srcId, parentId } = useDraggingNode() ?? {};
|
|
3219
|
-
const { isDropTarget, setTarget, unsetTarget } = useDropTarget();
|
|
3220
|
-
const params = {
|
|
3221
|
-
driveId,
|
|
3222
|
-
parentId,
|
|
3223
|
-
targetId,
|
|
3224
|
-
srcId
|
|
3225
|
-
};
|
|
3226
|
-
function handleNodeDrop(event, cb) {
|
|
3227
|
-
if (!isNodeDrop(params)) return;
|
|
3228
|
-
event.preventDefault();
|
|
3229
|
-
event.stopPropagation();
|
|
3230
|
-
cb?.();
|
|
3231
|
-
}
|
|
3232
|
-
const onDragEnter = (event) => handleNodeDrop(event);
|
|
3233
|
-
const onDragOver = (event) => handleNodeDrop(event, e(setTarget));
|
|
3234
|
-
const onDragLeave = (event) => handleNodeDrop(event, e(unsetTarget));
|
|
3235
|
-
const onDrop = (event) => handleNodeDrop(event, e(() => {
|
|
3236
|
-
unsetDragging();
|
|
3237
|
-
unsetTarget();
|
|
3238
|
-
moveNodeById(params).catch(console.error);
|
|
3239
|
-
}));
|
|
3240
|
-
return {
|
|
3241
|
-
isDropTarget,
|
|
3242
|
-
onDragEnter,
|
|
3243
|
-
onDragOver,
|
|
3244
|
-
onDragLeave,
|
|
3245
|
-
onDrop
|
|
3246
|
-
};
|
|
3247
|
-
}
|
|
3248
|
-
const graphQLReactorClientEventFunctions = makePHEventFunctions("reactorGraphQLClient");
|
|
3249
|
-
graphQLReactorClientEventFunctions.useValue;
|
|
3250
|
-
graphQLReactorClientEventFunctions.setValue;
|
|
3251
|
-
graphQLReactorClientEventFunctions.addEventHandler;
|
|
3252
|
-
const packageDiscoveryFunctions = makePHEventFunctions("packageDiscoveryService");
|
|
3253
|
-
packageDiscoveryFunctions.useValue;
|
|
3254
|
-
packageDiscoveryFunctions.setValue;
|
|
3255
|
-
packageDiscoveryFunctions.addEventHandler;
|
|
3256
|
-
const reactorClientModuleEventFunctions = makePHEventFunctions("reactorClientModule");
|
|
3257
|
-
const reactorClientEventFunctions = makePHEventFunctions("reactorClient");
|
|
3258
|
-
/** Returns the reactor client module (in-process or worker-backed) */
|
|
3259
|
-
const useReactorClientModule = reactorClientModuleEventFunctions.useValue;
|
|
3260
|
-
reactorClientModuleEventFunctions.setValue;
|
|
3261
|
-
reactorClientModuleEventFunctions.addEventHandler;
|
|
3262
|
-
reactorClientEventFunctions.useValue;
|
|
3263
|
-
reactorClientEventFunctions.setValue;
|
|
3264
|
-
reactorClientEventFunctions.addEventHandler;
|
|
3265
|
-
const useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager;
|
|
3266
|
-
const useSyncList = () => {
|
|
3267
|
-
return useSync()?.list() ?? [];
|
|
3268
|
-
};
|
|
3269
|
-
const revisionHistoryEventFunctions = makePHEventFunctions("revisionHistoryVisible");
|
|
3270
|
-
revisionHistoryEventFunctions.useValue;
|
|
3271
|
-
/** Sets revision history visibility */
|
|
3272
|
-
const setRevisionHistoryVisible = revisionHistoryEventFunctions.setValue;
|
|
3273
|
-
revisionHistoryEventFunctions.addEventHandler;
|
|
3274
|
-
/** Shows the revision history */
|
|
3275
|
-
function showRevisionHistory() {
|
|
3276
|
-
setRevisionHistoryVisible(true);
|
|
3277
|
-
}
|
|
3278
|
-
/** Sorts nodes by name. */
|
|
3279
|
-
function sortNodesByName(nodes) {
|
|
3280
|
-
return nodes.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
3281
|
-
}
|
|
3282
|
-
/** Returns whether a node is a file. */
|
|
3283
|
-
function isFileNodeKind(node) {
|
|
3284
|
-
if (!node) return false;
|
|
3285
|
-
return node.kind.toUpperCase() === "FILE";
|
|
3286
|
-
}
|
|
3287
|
-
/** Returns whether a node is a folder. */
|
|
3288
|
-
function isFolderNodeKind(node) {
|
|
3289
|
-
if (!node) return false;
|
|
3290
|
-
return node.kind.toUpperCase() === "FOLDER";
|
|
3291
|
-
}
|
|
3292
|
-
/** Returns the nodes in the selected drive. */
|
|
3293
|
-
function useNodesInSelectedDrive() {
|
|
3294
|
-
const [selectedDrive] = useSelectedDriveSafe();
|
|
3295
|
-
return selectedDrive?.state.global.nodes;
|
|
3296
|
-
}
|
|
3297
|
-
/** Returns the folder nodes in the selected drive. */
|
|
3298
|
-
function useFolderNodesInSelectedDrive() {
|
|
3299
|
-
return useNodesInSelectedDrive()?.filter((n) => isFolderNodeKind(n));
|
|
3300
|
-
}
|
|
3301
|
-
/** Returns the selected node. */
|
|
3302
|
-
function useSelectedNode() {
|
|
3303
|
-
const selectedNodeId = useSelectedNodeId();
|
|
3304
|
-
return useNodesInSelectedDrive()?.find((n) => n.id === selectedNodeId);
|
|
3305
|
-
}
|
|
3306
|
-
const selectedTimelineItemEventFunctions = makePHEventFunctions("selectedTimelineItem");
|
|
3307
|
-
selectedTimelineItemEventFunctions.useValue;
|
|
3308
|
-
selectedTimelineItemEventFunctions.setValue;
|
|
3309
|
-
selectedTimelineItemEventFunctions.addEventHandler;
|
|
3310
|
-
const selectedTimelineRevisionEventFunctions = makePHEventFunctions("selectedTimelineRevision");
|
|
3311
|
-
selectedTimelineRevisionEventFunctions.useValue;
|
|
3312
|
-
selectedTimelineRevisionEventFunctions.setValue;
|
|
3313
|
-
selectedTimelineRevisionEventFunctions.addEventHandler;
|
|
3314
|
-
const toastEventFunctions = makePHEventFunctions("toast");
|
|
3315
|
-
/** Returns the toast function */
|
|
3316
|
-
const usePHToast = toastEventFunctions.useValue;
|
|
3317
|
-
toastEventFunctions.setValue;
|
|
3318
|
-
toastEventFunctions.addEventHandler;
|
|
3319
|
-
const vetraPackageManagerFunctions = makePHEventFunctions("vetraPackageManager");
|
|
3320
|
-
const useVetraPackageManager = vetraPackageManagerFunctions.useValue;
|
|
3321
|
-
/** Returns all of the Vetra packages loaded by the Connect instance */
|
|
3322
|
-
const useVetraPackages = () => {
|
|
3323
|
-
const packageManager = useVetraPackageManager();
|
|
3324
|
-
return useSyncExternalStore((cb) => packageManager ? packageManager.subscribe(cb) : () => {}, () => packageManager?.packages ?? []);
|
|
3325
|
-
};
|
|
3326
|
-
vetraPackageManagerFunctions.addEventHandler;
|
|
3327
|
-
function useDocumentModelModules() {
|
|
3328
|
-
return useVetraPackages().flatMap((pkg) => pkg.documentModels).filter((module, index, modules) => modules.findIndex((m) => m.documentModel.global.id === module.documentModel.global.id && m.version === module.version) === index);
|
|
3329
|
-
}
|
|
3330
|
-
function useDocumentModelModuleById(id) {
|
|
3331
|
-
return useDocumentModelModules()?.find((module) => module.documentModel.global.id === id);
|
|
3332
|
-
}
|
|
3848
|
+
})))(), 1);
|
|
3849
|
+
/** Document types that represent a "drive": a container of nodes. */
|
|
3850
|
+
const DRIVE_DOCUMENT_TYPES = ["powerhouse/document-drive", "powerhouse/reactor-drive"];
|
|
3333
3851
|
function useAllowedDocumentModelModules() {
|
|
3334
3852
|
const documentModelModules = useDocumentModelModules();
|
|
3335
3853
|
const allowedDocumentTypes = useAllowedDocumentTypes();
|
|
@@ -3395,15 +3913,49 @@ function useSetPHDocumentEditorConfig(config) {
|
|
|
3395
3913
|
setIsInitialized(true);
|
|
3396
3914
|
}, [config, isInitialized]);
|
|
3397
3915
|
}
|
|
3398
|
-
/**
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
if (
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
return
|
|
3916
|
+
/**
|
|
3917
|
+
* Classifies a document's model version against the installed module
|
|
3918
|
+
* versions. Pure logic, extracted for testing.
|
|
3919
|
+
*/
|
|
3920
|
+
function getDocumentVersionStatus(documentVersion, availableVersions, hasUpgradePath) {
|
|
3921
|
+
if (availableVersions.length === 0) return;
|
|
3922
|
+
const sorted = [...availableVersions].sort((a, b) => a - b);
|
|
3923
|
+
const latestVersion = sorted[sorted.length - 1];
|
|
3924
|
+
if (documentVersion > latestVersion) return {
|
|
3925
|
+
kind: "unsupported",
|
|
3926
|
+
documentVersion,
|
|
3927
|
+
availableVersions: sorted
|
|
3928
|
+
};
|
|
3929
|
+
if (documentVersion === latestVersion) return {
|
|
3930
|
+
kind: "current",
|
|
3931
|
+
documentVersion
|
|
3932
|
+
};
|
|
3933
|
+
return {
|
|
3934
|
+
kind: "upgrade-available",
|
|
3935
|
+
documentVersion,
|
|
3936
|
+
latestVersion,
|
|
3937
|
+
canUpgrade: hasUpgradePath(documentVersion, latestVersion)
|
|
3938
|
+
};
|
|
3939
|
+
}
|
|
3940
|
+
/**
|
|
3941
|
+
* Compares the given document's model version against the versions available
|
|
3942
|
+
* from installed Vetra packages. Returns undefined while packages load or
|
|
3943
|
+
* when the document type has no installed modules.
|
|
3944
|
+
*/
|
|
3945
|
+
function useDocumentVersionStatus(document) {
|
|
3946
|
+
const modules = useDocumentModelModules();
|
|
3947
|
+
const registry = useModelRegistry();
|
|
3948
|
+
if (!document || !modules) return;
|
|
3949
|
+
const documentType = document.header.documentType;
|
|
3950
|
+
return getDocumentVersionStatus(document.state.document.version || 1, modules.filter((m) => m.documentModel.global.id === documentType).map((m) => m.version ?? 1), (fromVersion, toVersion) => {
|
|
3951
|
+
if (!registry) return false;
|
|
3952
|
+
try {
|
|
3953
|
+
registry.computeUpgradePath(documentType, fromVersion, toVersion);
|
|
3954
|
+
return true;
|
|
3955
|
+
} catch {
|
|
3956
|
+
return false;
|
|
3957
|
+
}
|
|
3958
|
+
});
|
|
3407
3959
|
}
|
|
3408
3960
|
const validateDocument = (document) => {
|
|
3409
3961
|
const errors = [];
|
|
@@ -3510,11 +4062,11 @@ function useNodeActions() {
|
|
|
3510
4062
|
const drives = useDrives();
|
|
3511
4063
|
async function onAddFile(file, parent) {
|
|
3512
4064
|
if (!selectedDriveId) return;
|
|
3513
|
-
return
|
|
4065
|
+
return addFileWithProgress(file, selectedDriveId, file.name.replace(/\..+/gim, ""), resolveNode(selectedDriveId, parent)?.id, void 0, void 0, "duplicate");
|
|
3514
4066
|
}
|
|
3515
4067
|
async function onAddFolder(name, parent) {
|
|
3516
4068
|
if (!selectedDriveId) return;
|
|
3517
|
-
return addFolder(selectedDriveId, name, resolveNode(selectedDriveId, parent)?.id);
|
|
4069
|
+
return addFolder$1(selectedDriveId, name, resolveNode(selectedDriveId, parent)?.id);
|
|
3518
4070
|
}
|
|
3519
4071
|
async function onRenameNode(newName, node) {
|
|
3520
4072
|
if (!selectedDriveId) return;
|
|
@@ -3601,20 +4153,8 @@ function useSelectedNodePath() {
|
|
|
3601
4153
|
function useNodeParentFolderById(id) {
|
|
3602
4154
|
return useFolderById(useNodeById(id)?.parentFolder);
|
|
3603
4155
|
}
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
const selectedNode = useSelectedNode();
|
|
3607
|
-
return selectedNode && isFileNode(selectedNode) ? selectedNode.id : void 0;
|
|
3608
|
-
}
|
|
3609
|
-
/** Returns the selected document. */
|
|
3610
|
-
function useSelectedDocumentSafe() {
|
|
3611
|
-
return useDocumentById(useSelectedDocumentId());
|
|
3612
|
-
}
|
|
3613
|
-
function useSelectedDocumentOfType(documentType) {
|
|
3614
|
-
const documentId = useSelectedDocumentId();
|
|
3615
|
-
if (!documentType) return [];
|
|
3616
|
-
if (!documentId) throw new NoSelectedDocumentError();
|
|
3617
|
-
return useDocumentOfType(documentId, documentType);
|
|
4156
|
+
function useParentFolderForSelectedNode() {
|
|
4157
|
+
return useNodeParentFolderById(useSelectedNode()?.id);
|
|
3618
4158
|
}
|
|
3619
4159
|
const STORED_THEME_KEY = "ph:theme";
|
|
3620
4160
|
const UPDATE_STORED_THEME = "ph:updateStoredTheme";
|
|
@@ -3829,6 +4369,6 @@ function createDebouncedRefreshReactorDataClient(debounceDelayMs = DEFAULT_DEBOU
|
|
|
3829
4369
|
createDebouncedRefreshReactorData();
|
|
3830
4370
|
createDebouncedRefreshReactorDataClient();
|
|
3831
4371
|
//#endregion
|
|
3832
|
-
export {
|
|
4372
|
+
export { usePHToast as A, useSelectedDriveId as B, addFolder$1 as C, useDisabledEditors as D, showRevisionHistory as E, t$5 as F, useDocumentById as H, isFileNodeKind as I, isFolderNodeKind as L, e$1 as M, e$4 as N, useDragNode as O, t$2 as P, setSelectedDrive as R, addDocument as S, showPHModal as T, useSelectedDriveSafe as V, useSetPHDocumentEditorConfig as _, useDownloadDocument as a, useSelectedDocumentOfType as b, useGetSwitchboardLink as c, useNodeParentFolderById as d, useNodesInSelectedDriveOrFolder as f, useSetPHAppConfig as g, useSelectedNodePath as h, useDocumentVersionStatus as i, useStudioMode as j, useDropNode as k, useNodeActions as l, useSelectedFolder as m, preloadEditorModule as n, useEditorModules as o, useParentFolderForSelectedNode as p, useAllowedDocumentModelModules as r, useEditorModulesForDocumentType as s, getSyncStatusSync as t, useNodeById as u, useTheme as v, showDeleteNodeModal as w, useSelectedDocumentSafe as x, useUserPermissions as y, setSelectedNode as z };
|
|
3833
4373
|
|
|
3834
|
-
//# sourceMappingURL=dist-
|
|
4374
|
+
//# sourceMappingURL=dist-BIpFdiLp.js.map
|