@powerhousedao/powerhouse-vetra-packages 6.2.2-dev.4 → 6.2.2-dev.41
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-Db_lIhQq.js} +3 -2
- package/dist/browser/assets/{projection-entry-DVec8YRh.js → projection-entry-DqgHaUSy.js} +4 -4
- package/dist/browser/{connect-CV-z3DqA.js → connect-BUnNjGUW.js} +874 -200
- package/dist/browser/connect-BUnNjGUW.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-BEs8jMgM.js → dist-BatmWBzA.js} +1782 -1640
- package/dist/browser/dist-BatmWBzA.js.map +1 -0
- package/dist/browser/{document-drive-sTKoi6L4.js → document-drive-D3Z9vXTQ.js} +864 -118
- package/dist/browser/document-drive-D3Z9vXTQ.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-BLeFoOh6.js +25 -0
- package/dist/browser/editor-BLeFoOh6.js.map +1 -0
- package/dist/browser/{editor-Cw38euRs.js → editor-Bn6uXvxG.js} +10 -142
- package/dist/browser/editor-Bn6uXvxG.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-DjKO1mAh.mjs → browser/folder-view-DNzFnfW2.js} +53 -45
- package/dist/browser/folder-view-DNzFnfW2.js.map +1 -0
- package/dist/browser/{graphql-editor-B-dNI5hD.js → graphql-editor-DWo8N_z4.js} +8 -7
- package/dist/browser/{graphql-editor-B-dNI5hD.js.map → graphql-editor-DWo8N_z4.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 +2 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{json-editor-v_MnzQVs.js → json-editor-CEugjpFj.js} +4 -4
- package/dist/browser/{json-editor-v_MnzQVs.js.map → json-editor-CEugjpFj.js.map} +1 -1
- package/dist/browser/{lib-C-f3izXz.js → lib-CiaHsAaR.js} +12 -2
- package/dist/browser/lib-CiaHsAaR.js.map +1 -0
- package/dist/browser/{linting-Dn6pXRkK.js → linting-_AQWr8aE.js} +5 -4
- package/dist/browser/{linting-Dn6pXRkK.js.map → linting-_AQWr8aE.js.map} +1 -1
- 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-65Tp0ZuG.js → state-schemas-VrticHe4.js} +7 -7
- package/dist/browser/{state-schemas-65Tp0ZuG.js.map → state-schemas-VrticHe4.js.map} +1 -1
- package/dist/node/{connect-Bbi5wHyR.mjs → connect-wMkkAckX.mjs} +874 -200
- package/dist/node/connect-wMkkAckX.mjs.map +1 -0
- package/dist/node/{dist-8nCvrie2.mjs → dist-CUHBOv3P.mjs} +1593 -1446
- package/dist/node/dist-CUHBOv3P.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-DjL9iikf.mjs → document-drive-CI0J7nMj.mjs} +864 -118
- package/dist/node/document-drive-CI0J7nMj.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-DkT0krRE.mjs → editor-Cr-mNQca.mjs} +10 -142
- package/dist/node/editor-Cr-mNQca.mjs.map +1 -0
- package/dist/node/editor-aIeTo2EE.mjs +25 -0
- package/dist/node/editor-aIeTo2EE.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-BQWrt8wh.js → node/folder-view-_x1OBYZN.mjs} +53 -45
- package/dist/node/folder-view-_x1OBYZN.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-x-d_DoqN.mjs → graphql-editor-Dd2_z5QJ.mjs} +7 -7
- package/dist/node/{graphql-editor-x-d_DoqN.mjs.map → graphql-editor-Dd2_z5QJ.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 +2 -2
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{json-editor-D8QbP3jl.mjs → json-editor-Dphg6ZeL.mjs} +4 -4
- package/dist/node/{json-editor-D8QbP3jl.mjs.map → json-editor-Dphg6ZeL.mjs.map} +1 -1
- package/dist/node/{linting-Dx50GuLN.mjs → linting-BjvRPjCY.mjs} +5 -5
- package/dist/node/{linting-Dx50GuLN.mjs.map → linting-BjvRPjCY.mjs.map} +1 -1
- package/dist/node/{main-D82dkD7g.mjs → main-Db0ei9wX.mjs} +14 -4
- package/dist/node/main-Db0ei9wX.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-BwvZVEhR.mjs → state-schemas-BSLgTw2O.mjs} +8 -8
- package/dist/node/{state-schemas-BwvZVEhR.mjs.map → state-schemas-BSLgTw2O.mjs.map} +1 -1
- package/package.json +6 -6
- package/dist/browser/connect-CV-z3DqA.js.map +0 -1
- package/dist/browser/dist-BEs8jMgM.js.map +0 -1
- package/dist/browser/document-drive-sTKoi6L4.js.map +0 -1
- package/dist/browser/documents-D4ek7Ubv.js.map +0 -1
- package/dist/browser/editor-Cw38euRs.js.map +0 -1
- package/dist/browser/editor-DY3JsQJ3.js +0 -29
- package/dist/browser/editor-DY3JsQJ3.js.map +0 -1
- package/dist/browser/folder-view-BQWrt8wh.js.map +0 -1
- package/dist/browser/lib-C-f3izXz.js.map +0 -1
- package/dist/node/connect-Bbi5wHyR.mjs.map +0 -1
- package/dist/node/dist-8nCvrie2.mjs.map +0 -1
- package/dist/node/document-drive-DjL9iikf.mjs.map +0 -1
- package/dist/node/editor-BH2gCDjt.mjs +0 -29
- package/dist/node/editor-BH2gCDjt.mjs.map +0 -1
- package/dist/node/editor-DkT0krRE.mjs.map +0 -1
- package/dist/node/folder-view-DjKO1mAh.mjs.map +0 -1
- package/dist/node/main-D82dkD7g.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 { $ as generateId, P as replayDocumentVersioned, Q as validateStateSchemaName, S as createPresignedHeader, T as createZip, U as setName, X as validateInitialState, Z as validateModules, a as handleTargetNameCollisions, b as baseSaveToFileHandle, f as logger, g as assertAuthPreservedOnDuplicate, i as generateNodesCopy, l as moveNode, n as copyNode, o as isFileNode, s as isFolderNode, t as addFolder, u as updateNode, v as baseLoadFromInput, x as buildSignedAction, y as baseLoadFromInputVersioned } from "./document-drive-D3Z9vXTQ.js";
|
|
3
|
+
import { a as SyncStatus, o as DriveCollectionId, s as ModuleNotFoundError, t as gql } from "./lib-CiaHsAaR.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-BPj6Gd7n.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.getDocumentModelModule(document.header.documentType)).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;
|
|
@@ -225,8 +242,25 @@ function useDocumentById(id) {
|
|
|
225
242
|
const [, dispatch] = useDispatch(document);
|
|
226
243
|
return [document, dispatch];
|
|
227
244
|
}
|
|
245
|
+
Error;
|
|
246
|
+
JSON;
|
|
228
247
|
//#endregion
|
|
229
|
-
//#region ../reactor-browser/dist/client-
|
|
248
|
+
//#region ../reactor-browser/dist/client-s_ISz_Zs.js
|
|
249
|
+
let DocumentChangeType = /* @__PURE__ */ function(DocumentChangeType) {
|
|
250
|
+
DocumentChangeType["ChildAdded"] = "CHILD_ADDED";
|
|
251
|
+
DocumentChangeType["ChildRemoved"] = "CHILD_REMOVED";
|
|
252
|
+
DocumentChangeType["Created"] = "CREATED";
|
|
253
|
+
DocumentChangeType["Deleted"] = "DELETED";
|
|
254
|
+
DocumentChangeType["ParentAdded"] = "PARENT_ADDED";
|
|
255
|
+
DocumentChangeType["ParentRemoved"] = "PARENT_REMOVED";
|
|
256
|
+
DocumentChangeType["Updated"] = "UPDATED";
|
|
257
|
+
return DocumentChangeType;
|
|
258
|
+
}({});
|
|
259
|
+
let PropagationMode = /* @__PURE__ */ function(PropagationMode) {
|
|
260
|
+
PropagationMode["Cascade"] = "CASCADE";
|
|
261
|
+
PropagationMode["Orphan"] = "ORPHAN";
|
|
262
|
+
return PropagationMode;
|
|
263
|
+
}({});
|
|
230
264
|
const PhDocumentFieldsFragmentDoc = gql`
|
|
231
265
|
fragment PHDocumentFields on PHDocument {
|
|
232
266
|
id
|
|
@@ -287,6 +321,7 @@ const GetDocumentWithOperationsDocument = gql`
|
|
|
287
321
|
hash
|
|
288
322
|
skip
|
|
289
323
|
error
|
|
324
|
+
deniedReason
|
|
290
325
|
id
|
|
291
326
|
action {
|
|
292
327
|
id
|
|
@@ -399,6 +434,7 @@ const GetDocumentOperationsDocument = gql`
|
|
|
399
434
|
hash
|
|
400
435
|
skip
|
|
401
436
|
error
|
|
437
|
+
deniedReason
|
|
402
438
|
id
|
|
403
439
|
action {
|
|
404
440
|
id
|
|
@@ -649,6 +685,7 @@ gql`
|
|
|
649
685
|
hash
|
|
650
686
|
skip
|
|
651
687
|
error
|
|
688
|
+
deniedReason
|
|
652
689
|
id
|
|
653
690
|
action {
|
|
654
691
|
id
|
|
@@ -691,6 +728,7 @@ gql`
|
|
|
691
728
|
deadLetters {
|
|
692
729
|
documentId
|
|
693
730
|
error
|
|
731
|
+
errorType
|
|
694
732
|
}
|
|
695
733
|
hasMore
|
|
696
734
|
}
|
|
@@ -737,8 +775,17 @@ function extractQueryParts(doc, fallbackBody) {
|
|
|
737
775
|
extractSelectionSet(GetDocumentOperationsDocument, "documentOperations", "{ items { index } }");
|
|
738
776
|
extractQueryParts(GetDocumentDocument, "document(identifier: $identifier) { document { id name documentType state revisionsList { scope revision } createdAtUtcIso lastModifiedAtUtcIso } childIds }");
|
|
739
777
|
//#endregion
|
|
740
|
-
//#region ../reactor-browser/dist/renown-
|
|
778
|
+
//#region ../reactor-browser/dist/renown-BZabzj4l.js
|
|
741
779
|
const { useValue: useLoading, setValue: setLoading, addEventHandler: addLoadingEventHandler } = makePHEventFunctions("loading");
|
|
780
|
+
const RenownInitialUserContext = createContext({ state: "unknown" });
|
|
781
|
+
/** First-render auth as a three-state value; use this to skip a spinner when anonymous. */
|
|
782
|
+
function useRenownInitialAuth() {
|
|
783
|
+
return useContext(RenownInitialUserContext);
|
|
784
|
+
}
|
|
785
|
+
function useRenownInitialUser() {
|
|
786
|
+
const initial = useRenownInitialAuth();
|
|
787
|
+
return initial.state === "authenticated" ? initial.user : void 0;
|
|
788
|
+
}
|
|
742
789
|
const renownEventFunctions = makePHEventFunctions("renown");
|
|
743
790
|
renownEventFunctions.addEventHandler;
|
|
744
791
|
/** Returns the renown instance */
|
|
@@ -747,41 +794,17 @@ renownEventFunctions.setValue;
|
|
|
747
794
|
/** Returns the current user from the renown instance, subscribing to user events */
|
|
748
795
|
function useUser() {
|
|
749
796
|
const renown = useRenown();
|
|
750
|
-
const
|
|
797
|
+
const initialUser = useRenownInitialUser();
|
|
798
|
+
const instance = renown ? renown : void 0;
|
|
799
|
+
const [user, setUser] = useState(instance ? instance.user : initialUser);
|
|
751
800
|
useEffect(() => {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
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";
|
|
801
|
+
if (instance) {
|
|
802
|
+
setUser(instance.user);
|
|
803
|
+
return instance.on("user", setUser);
|
|
804
|
+
}
|
|
805
|
+
}, [instance]);
|
|
806
|
+
return instance ? user : initialUser ?? user;
|
|
807
|
+
}
|
|
785
808
|
//#endregion
|
|
786
809
|
//#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
|
|
787
810
|
function e$8(e, t, n) {
|
|
@@ -906,6 +929,32 @@ function e(e) {
|
|
|
906
929
|
let t = !1, n;
|
|
907
930
|
return () => (t ||= (n = e(), !0), n);
|
|
908
931
|
}
|
|
932
|
+
var CloseCode = /* @__PURE__ */ ((CloseCode2) => {
|
|
933
|
+
CloseCode2[CloseCode2["InternalServerError"] = 4500] = "InternalServerError";
|
|
934
|
+
CloseCode2[CloseCode2["InternalClientError"] = 4005] = "InternalClientError";
|
|
935
|
+
CloseCode2[CloseCode2["BadRequest"] = 4400] = "BadRequest";
|
|
936
|
+
CloseCode2[CloseCode2["BadResponse"] = 4004] = "BadResponse";
|
|
937
|
+
CloseCode2[CloseCode2["Unauthorized"] = 4401] = "Unauthorized";
|
|
938
|
+
CloseCode2[CloseCode2["Forbidden"] = 4403] = "Forbidden";
|
|
939
|
+
CloseCode2[CloseCode2["SubprotocolNotAcceptable"] = 4406] = "SubprotocolNotAcceptable";
|
|
940
|
+
CloseCode2[CloseCode2["ConnectionInitialisationTimeout"] = 4408] = "ConnectionInitialisationTimeout";
|
|
941
|
+
CloseCode2[CloseCode2["ConnectionAcknowledgementTimeout"] = 4504] = "ConnectionAcknowledgementTimeout";
|
|
942
|
+
CloseCode2[CloseCode2["SubscriberAlreadyExists"] = 4409] = "SubscriberAlreadyExists";
|
|
943
|
+
CloseCode2[CloseCode2["TooManyInitialisationRequests"] = 4429] = "TooManyInitialisationRequests";
|
|
944
|
+
return CloseCode2;
|
|
945
|
+
})(CloseCode || {});
|
|
946
|
+
var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
|
947
|
+
MessageType2["ConnectionInit"] = "connection_init";
|
|
948
|
+
MessageType2["ConnectionAck"] = "connection_ack";
|
|
949
|
+
MessageType2["Ping"] = "ping";
|
|
950
|
+
MessageType2["Pong"] = "pong";
|
|
951
|
+
MessageType2["Subscribe"] = "subscribe";
|
|
952
|
+
MessageType2["Next"] = "next";
|
|
953
|
+
MessageType2["Error"] = "error";
|
|
954
|
+
MessageType2["Complete"] = "complete";
|
|
955
|
+
return MessageType2;
|
|
956
|
+
})(MessageType || {});
|
|
957
|
+
Error;
|
|
909
958
|
//#endregion
|
|
910
959
|
//#region ../../node_modules/.pnpm/slug@11.0.1/node_modules/slug/slug.js
|
|
911
960
|
let base64;
|
|
@@ -1693,1643 +1742,1733 @@ slug.setLocale = function(locale) {
|
|
|
1693
1742
|
defaultLocale = locales[locale] || {};
|
|
1694
1743
|
};
|
|
1695
1744
|
//#endregion
|
|
1696
|
-
//#region
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
};
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
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;
|
|
1745
|
+
//#region ../reactor-browser/dist/document-operations-DvhxGXqI.js
|
|
1746
|
+
var DocumentModelNotFoundError = class extends Error {
|
|
1747
|
+
documentType;
|
|
1748
|
+
name = "DocumentModelNotFoundError";
|
|
1749
|
+
constructor(documentType) {
|
|
1750
|
+
super(`Document model module for type ${documentType} not found`);
|
|
1751
|
+
this.documentType = documentType;
|
|
1752
|
+
}
|
|
1753
|
+
static isError(error) {
|
|
1754
|
+
return Error.isError(error) && error.name === "DocumentModelNotFoundError";
|
|
1715
1755
|
}
|
|
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
|
-
};
|
|
1729
|
-
const setErrorDescriptor = (error, propName, descriptor) => {
|
|
1730
|
-
Object.defineProperty(error, propName, {
|
|
1731
|
-
...descriptor,
|
|
1732
|
-
..."get" in descriptor || "set" in descriptor ? {} : { writable: true },
|
|
1733
|
-
enumerable: false,
|
|
1734
|
-
configurable: true
|
|
1735
|
-
});
|
|
1736
|
-
};
|
|
1737
|
-
//#endregion
|
|
1738
|
-
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/aggregate.js
|
|
1739
|
-
const normalizeAggregate = (error, recurse) => {
|
|
1740
|
-
if (Array.isArray(error.errors)) setErrorProperty(error, "errors", error.errors.filter(isDefined).map(recurse).filter(Boolean));
|
|
1741
|
-
else if (isAggregateError(error)) setErrorProperty(error, "errors", []);
|
|
1742
|
-
else if (error.errors !== void 0) deleteAggregateErrors(error);
|
|
1743
|
-
};
|
|
1744
|
-
const isDefined = (error) => error !== void 0;
|
|
1745
|
-
const isAggregateError = (error) => "AggregateError" in globalThis && (error.name === "AggregateError" || error instanceof AggregateError);
|
|
1746
|
-
const deleteAggregateErrors = (error) => {
|
|
1747
|
-
delete error.errors;
|
|
1748
|
-
if (error.errors !== void 0) setErrorProperty(error, "errors", []);
|
|
1749
|
-
};
|
|
1750
|
-
//#endregion
|
|
1751
|
-
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/cause.js
|
|
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
1756
|
};
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
const isInstanceOfError = (value) => {
|
|
1762
|
-
try {
|
|
1763
|
-
return value instanceof Error;
|
|
1764
|
-
} catch {
|
|
1765
|
-
return false;
|
|
1757
|
+
var DocumentTypeMismatchError = class extends Error {
|
|
1758
|
+
constructor(documentId, expectedType, actualType) {
|
|
1759
|
+
super(`Document ${documentId} is not of type ${expectedType}. Actual type: ${actualType}`);
|
|
1766
1760
|
}
|
|
1767
1761
|
};
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
} catch {
|
|
1772
|
-
return false;
|
|
1762
|
+
var NoSelectedDocumentError = class extends Error {
|
|
1763
|
+
constructor() {
|
|
1764
|
+
super("There is no selected document. Did you mean to call 'useSelectedDocumentSafe' instead?");
|
|
1773
1765
|
}
|
|
1774
1766
|
};
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
1767
|
+
function getUserPermissions() {
|
|
1768
|
+
const user = window.ph?.renown?.user;
|
|
1769
|
+
const allowList = window.ph?.allowList;
|
|
1770
|
+
if (!allowList) return {
|
|
1771
|
+
isAllowedToCreateDocuments: true,
|
|
1772
|
+
isAllowedToEditDocuments: true
|
|
1773
|
+
};
|
|
1774
|
+
return {
|
|
1775
|
+
isAllowedToCreateDocuments: allowList.includes(user?.address ?? ""),
|
|
1776
|
+
isAllowedToEditDocuments: allowList.includes(user?.address ?? "")
|
|
1777
|
+
};
|
|
1787
1778
|
}
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
const isNonModifiableError = (error) => !Object.isExtensible(error) || CORE_ERROR_PROPS.some((propName) => isNonConfigurableProp(error, propName) || isThrowingProp(error, propName));
|
|
1791
|
-
const isNonConfigurableProp = (error, propName) => {
|
|
1792
|
-
const descriptor = Object.getOwnPropertyDescriptor(error, propName);
|
|
1793
|
-
return descriptor !== void 0 && !descriptor.configurable;
|
|
1794
|
-
};
|
|
1795
|
-
const isThrowingProp = (error, propName) => {
|
|
1779
|
+
const NON_DOMAIN_SCOPES = new Set(["auth", "document"]);
|
|
1780
|
+
async function downloadFile(document, fileName) {
|
|
1796
1781
|
try {
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1782
|
+
const data = await createZip(document);
|
|
1783
|
+
const blob = new Blob([new Uint8Array(data)], { type: "application/zip" });
|
|
1784
|
+
const link = window.document.createElement("a");
|
|
1785
|
+
link.style.display = "none";
|
|
1786
|
+
link.href = URL.createObjectURL(blob);
|
|
1787
|
+
link.download = fileName;
|
|
1788
|
+
window.document.body.appendChild(link);
|
|
1789
|
+
link.click();
|
|
1790
|
+
window.document.body.removeChild(link);
|
|
1791
|
+
} catch (e) {
|
|
1792
|
+
logger.error(e instanceof Error ? e.message : String(e));
|
|
1801
1793
|
}
|
|
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
|
-
|
|
1829
|
-
|
|
1830
|
-
Object.defineProperty(objectCopy, propName, {
|
|
1831
|
-
value,
|
|
1832
|
-
enumerable,
|
|
1833
|
-
configurable,
|
|
1834
|
-
writable
|
|
1794
|
+
}
|
|
1795
|
+
async function getDocumentExtension(document) {
|
|
1796
|
+
const documentType = document.header.documentType;
|
|
1797
|
+
let rawExtension;
|
|
1798
|
+
if (documentType === "powerhouse/document-model") rawExtension = document.state.global?.extension;
|
|
1799
|
+
else {
|
|
1800
|
+
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
1801
|
+
if (reactorClient) {
|
|
1802
|
+
const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
|
|
1803
|
+
rawExtension = documentModelModules.find((m) => m.documentModel.global.id === documentType)?.utils.fileExtension;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return (rawExtension ?? "").replace(/^\.+|\.+$/g, "");
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* Fetches all operations for a document using cursor-based pagination.
|
|
1810
|
+
* The reactor client handles multi-scope cursors transparently via
|
|
1811
|
+
* composite cursors, so all scopes are fetched in a single paginated stream.
|
|
1812
|
+
*/
|
|
1813
|
+
async function fetchDocumentOperations(reactorClient, document, pageSize = 100) {
|
|
1814
|
+
const scopes = Object.keys(document.state);
|
|
1815
|
+
const operations = {};
|
|
1816
|
+
for (const scope of scopes) operations[scope] = [];
|
|
1817
|
+
let cursor = "";
|
|
1818
|
+
do {
|
|
1819
|
+
const page = await reactorClient.getOperations(document.header.id, { scopes }, void 0, {
|
|
1820
|
+
cursor,
|
|
1821
|
+
limit: pageSize
|
|
1835
1822
|
});
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
return
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1823
|
+
for (const op of page.results) {
|
|
1824
|
+
const scope = op.action.scope ?? "global";
|
|
1825
|
+
if (operations[scope]) operations[scope].push(op);
|
|
1826
|
+
}
|
|
1827
|
+
cursor = page.nextCursor ?? "";
|
|
1828
|
+
} while (cursor);
|
|
1829
|
+
return operations;
|
|
1830
|
+
}
|
|
1831
|
+
function extractInitialState(documentScopeOps) {
|
|
1832
|
+
const upgradeOp = documentScopeOps.find((op) => op.action.type === "UPGRADE_DOCUMENT");
|
|
1833
|
+
if (!upgradeOp) throw new Error("No UPGRADE_DOCUMENT operation found — document is invalid");
|
|
1834
|
+
const input = upgradeOp.action.input;
|
|
1835
|
+
const initialState = input.initialState ?? input.state;
|
|
1836
|
+
if (!initialState) throw new Error("UPGRADE_DOCUMENT operation has no initialState — document is invalid");
|
|
1837
|
+
return initialState;
|
|
1838
|
+
}
|
|
1839
|
+
function filterDomainOperations(operations) {
|
|
1840
|
+
return Object.fromEntries(Object.entries(operations).filter(([scope]) => !NON_DOMAIN_SCOPES.has(scope)));
|
|
1841
|
+
}
|
|
1842
|
+
async function exportFile(document, suggestedName) {
|
|
1843
|
+
const reactorClient = window.ph?.reactorClient;
|
|
1844
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
1845
|
+
const operations = await fetchDocumentOperations(reactorClient, document);
|
|
1846
|
+
const initialState = extractInitialState(operations["document"] ?? []);
|
|
1847
|
+
const documentWithOps = {
|
|
1848
|
+
...document,
|
|
1849
|
+
operations,
|
|
1850
|
+
initialState
|
|
1851
|
+
};
|
|
1852
|
+
const extension = await getDocumentExtension(documentWithOps);
|
|
1853
|
+
const baseName = suggestedName || documentWithOps.header.name || "Untitled";
|
|
1854
|
+
const name = extension ? `${baseName}.${extension}.phd` : `${baseName}.phd`;
|
|
1855
|
+
if (!window.showSaveFilePicker) return await downloadFile(documentWithOps, name);
|
|
1845
1856
|
try {
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
return
|
|
1857
|
+
const fileHandle = await window.showSaveFilePicker({ suggestedName: name });
|
|
1858
|
+
await baseSaveToFileHandle(documentWithOps, fileHandle);
|
|
1859
|
+
return fileHandle;
|
|
1860
|
+
} catch (e) {
|
|
1861
|
+
if (!(e instanceof DOMException && e.name === "AbortError")) throw e;
|
|
1849
1862
|
}
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
};
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
const {
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1863
|
+
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Loads a document file and replays it with version-aware reducers from the registry.
|
|
1866
|
+
* Falls back to single-version legacy replay when no upgrade manifest is registered for
|
|
1867
|
+
* the document type.
|
|
1868
|
+
*/
|
|
1869
|
+
async function loadFile(path) {
|
|
1870
|
+
const baseDocument = await baseLoadFromInput(path, (state) => state, { checkHashes: true });
|
|
1871
|
+
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
1872
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
1873
|
+
const documentType = baseDocument.header.documentType;
|
|
1874
|
+
const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
|
|
1875
|
+
const modulesForType = documentModelModules.filter((module) => module.documentModel.global.id === documentType);
|
|
1876
|
+
if (modulesForType.length === 0) throw new DocumentModelNotFoundError(documentType);
|
|
1877
|
+
const reducers = {};
|
|
1878
|
+
for (const module of modulesForType) reducers[module.version ?? 1] = module.reducer;
|
|
1879
|
+
const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
|
|
1880
|
+
let upgradeManifest;
|
|
1881
|
+
if (registry) try {
|
|
1882
|
+
upgradeManifest = registry.getUpgradeManifest(documentType);
|
|
1883
|
+
} catch {}
|
|
1884
|
+
return baseLoadFromInputVersioned(path, {
|
|
1885
|
+
reducers,
|
|
1886
|
+
upgradeManifest
|
|
1872
1887
|
});
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
};
|
|
1876
|
-
|
|
1877
|
-
const
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1888
|
+
}
|
|
1889
|
+
async function addDocument(driveId, name, documentType, parentFolder, document, id, preferredEditor) {
|
|
1890
|
+
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
1891
|
+
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create documents");
|
|
1892
|
+
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
1893
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
1894
|
+
const documentModelModule = await reactorClient.getDocumentModelModule(documentType);
|
|
1895
|
+
const newDocument = document ?? documentModelModule.utils.createDocument();
|
|
1896
|
+
newDocument.header.name = name;
|
|
1897
|
+
if (preferredEditor) newDocument.header.meta = {
|
|
1898
|
+
...newDocument.header.meta,
|
|
1899
|
+
preferredEditor
|
|
1900
|
+
};
|
|
1901
|
+
let newDoc;
|
|
1885
1902
|
try {
|
|
1886
|
-
|
|
1887
|
-
} catch {
|
|
1888
|
-
|
|
1903
|
+
newDoc = await reactorClient.drives.addFile(driveId, newDocument, parentFolder);
|
|
1904
|
+
} catch (e) {
|
|
1905
|
+
logger.error("Error adding document: @error", e);
|
|
1906
|
+
throw new Error("There was an error adding document", { cause: e });
|
|
1889
1907
|
}
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
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) => {
|
|
1908
|
+
return {
|
|
1909
|
+
id: newDoc.header.id,
|
|
1910
|
+
name: newDoc.header.name,
|
|
1911
|
+
documentType,
|
|
1912
|
+
parentFolder: parentFolder ?? null,
|
|
1913
|
+
kind: "file"
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1916
|
+
async function addFile(file, driveId, name, parentFolder) {
|
|
1917
|
+
logger.verbose(`addFile(drive: ${driveId}, name: ${name}, folder: ${parentFolder})`);
|
|
1918
|
+
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
1919
|
+
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create files");
|
|
1920
|
+
const document = await loadFile(file);
|
|
1921
|
+
let duplicateId = false;
|
|
1922
|
+
const reactorClient = window.ph?.reactorClient;
|
|
1923
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
1916
1924
|
try {
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1925
|
+
await reactorClient.get(document.header.id);
|
|
1926
|
+
duplicateId = true;
|
|
1927
|
+
} catch {}
|
|
1928
|
+
const documentId = duplicateId ? generateId() : document.header.id;
|
|
1929
|
+
const header = createPresignedHeader(documentId, document.header.documentType);
|
|
1930
|
+
header.lastModifiedAtUtcIso = document.header.createdAtUtcIso;
|
|
1931
|
+
header.meta = document.header.meta;
|
|
1932
|
+
header.name = name || document.header.name;
|
|
1933
|
+
const initialDocument = {
|
|
1934
|
+
...document,
|
|
1935
|
+
header,
|
|
1936
|
+
state: document.initialState,
|
|
1937
|
+
operations: Object.keys(document.operations).reduce((acc, key) => {
|
|
1938
|
+
acc[key] = [];
|
|
1939
|
+
return acc;
|
|
1940
|
+
}, {})
|
|
1941
|
+
};
|
|
1942
|
+
await addDocument(driveId, name || document.header.name, document.header.documentType, parentFolder, initialDocument, documentId, document.header.meta?.preferredEditor);
|
|
1943
|
+
await uploadOperations(documentId, filterDomainOperations(document.operations), queueOperations);
|
|
1944
|
+
}
|
|
1945
|
+
async function addFolder$1(driveId, name, parentFolder) {
|
|
1946
|
+
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
1947
|
+
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create folders");
|
|
1948
|
+
const reactorClient = window.ph?.reactorClient;
|
|
1949
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
1950
|
+
await reactorClient.get(driveId);
|
|
1951
|
+
const folderId = generateId();
|
|
1952
|
+
const node = (await reactorClient.execute(driveId, "main", [addFolder({
|
|
1953
|
+
id: folderId,
|
|
1954
|
+
name,
|
|
1955
|
+
parentFolder
|
|
1956
|
+
})])).state.global.nodes.find((node) => node.id === folderId);
|
|
1957
|
+
if (!node || !isFolderNode(node)) throw new Error("There was an error adding folder");
|
|
1958
|
+
return node;
|
|
1959
|
+
}
|
|
1960
|
+
async function renameNode(driveId, nodeId, name) {
|
|
1961
|
+
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
1962
|
+
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to rename documents");
|
|
1963
|
+
const reactorClient = window.ph?.reactorClient;
|
|
1964
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
1965
|
+
if ((await reactorClient.execute(nodeId, "main", [setName({ name })])).header.name !== name) throw new Error("There was an error renaming the node");
|
|
1966
|
+
const node = (await reactorClient.execute(driveId, "main", [updateNode({
|
|
1967
|
+
id: nodeId,
|
|
1968
|
+
name
|
|
1969
|
+
})])).state.global.nodes.find((n) => n.id === nodeId);
|
|
1970
|
+
if (!node) throw new Error("There was an error renaming node in the drive");
|
|
1971
|
+
return node;
|
|
1972
|
+
}
|
|
1973
|
+
async function renameDriveNode(driveId, nodeId, name) {
|
|
1974
|
+
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
1975
|
+
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to rename documents");
|
|
1976
|
+
const reactorClient = window.ph?.reactorClient;
|
|
1977
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
1978
|
+
if ((await reactorClient.execute(nodeId, "main", [setName({ name })])).header.name !== name) throw new Error("There was an error renaming the node");
|
|
1979
|
+
await reactorClient.execute(driveId, "main", [updateNode({
|
|
1980
|
+
id: nodeId,
|
|
1981
|
+
name
|
|
1982
|
+
})]);
|
|
1983
|
+
return (await reactorClient.get(driveId)).state.global.nodes.find((n) => n.id === nodeId);
|
|
1984
|
+
}
|
|
1985
|
+
async function moveNodeById(args) {
|
|
1986
|
+
const { driveId, srcId, targetId } = args;
|
|
1987
|
+
if (!driveId || !srcId) return;
|
|
1988
|
+
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
1989
|
+
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
|
|
1990
|
+
const reactorClient = window.ph?.reactorClient;
|
|
1991
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
1992
|
+
const targetParentFolder = t$3(targetId, [e$3(e$4), e$6(void 0)], [t(driveId), e$6(void 0)], e$6(targetId));
|
|
1993
|
+
if (t(targetParentFolder, srcId)) return;
|
|
1994
|
+
return await reactorClient.execute(driveId, "main", [moveNode({
|
|
1995
|
+
srcFolder: srcId,
|
|
1996
|
+
targetParentFolder
|
|
1997
|
+
})]);
|
|
1998
|
+
}
|
|
1999
|
+
async function moveNode$1(driveId, src, target) {
|
|
2000
|
+
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2001
|
+
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
|
|
2002
|
+
const reactorClient = window.ph?.reactorClient;
|
|
2003
|
+
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2004
|
+
return await reactorClient.execute(driveId, "main", [moveNode({
|
|
2005
|
+
srcFolder: src.id,
|
|
2006
|
+
targetParentFolder: target?.id
|
|
2007
|
+
})]);
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Duplicates a document under a new id using version-aware replay.
|
|
2011
|
+
* Falls back gracefully when no upgrade manifest is registered for the document type.
|
|
2012
|
+
*/
|
|
2013
|
+
async function _duplicateDocument(reactor, document, newId = generateId()) {
|
|
2014
|
+
const documentType = document.header.documentType;
|
|
2015
|
+
const { results: allModules } = await reactor.getDocumentModelModules();
|
|
2016
|
+
const modulesForType = allModules.filter((m) => m.documentModel.global.id === documentType);
|
|
2017
|
+
const reducers = {};
|
|
2018
|
+
for (const m of modulesForType) reducers[m.version ?? 1] = m.reducer;
|
|
2019
|
+
if (Object.keys(reducers).length === 0) throw new Error(`Document model module not found for type: ${documentType}`);
|
|
2020
|
+
const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
|
|
2021
|
+
let upgradeManifest;
|
|
2022
|
+
if (registry) try {
|
|
2023
|
+
upgradeManifest = registry.getUpgradeManifest(documentType);
|
|
2024
|
+
} catch {}
|
|
2025
|
+
const config = {
|
|
2026
|
+
reducers,
|
|
2027
|
+
upgradeManifest
|
|
2028
|
+
};
|
|
2029
|
+
const header = createPresignedHeader(newId, documentType);
|
|
2030
|
+
const duplicated = replayDocumentVersioned(document.initialState, document.operations, config, header);
|
|
2031
|
+
assertAuthPreservedOnDuplicate(document.header.id, document.state.auth, duplicated.state.auth);
|
|
2032
|
+
return duplicated;
|
|
2033
|
+
}
|
|
2034
|
+
async function copyNode$1(driveId, src, target) {
|
|
2035
|
+
const reactor = window.ph?.reactorClientModule?.client;
|
|
2036
|
+
if (!reactor) return;
|
|
2037
|
+
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2038
|
+
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to copy documents");
|
|
2039
|
+
const drive = await reactor.get(driveId);
|
|
2040
|
+
const copyNodesInput = generateNodesCopy({
|
|
2041
|
+
srcId: src.id,
|
|
2042
|
+
targetParentFolder: target?.id,
|
|
2043
|
+
targetName: src.name
|
|
2044
|
+
}, () => generateId(), drive.state.global.nodes);
|
|
2045
|
+
const resolvedNamesMap = /* @__PURE__ */ new Map();
|
|
2046
|
+
for (const copyNodeInput of copyNodesInput) {
|
|
2047
|
+
const node = drive.state.global.nodes.find((n) => n.id === copyNodeInput.srcId);
|
|
2048
|
+
if (node) {
|
|
2049
|
+
const resolvedName = handleTargetNameCollisions({
|
|
2050
|
+
nodes: drive.state.global.nodes,
|
|
2051
|
+
srcName: copyNodeInput.targetName || node.name,
|
|
2052
|
+
srcKind: isFileNode(node) ? "file" : "folder",
|
|
2053
|
+
targetParentFolder: copyNodeInput.targetParentFolder || null
|
|
2054
|
+
});
|
|
2055
|
+
resolvedNamesMap.set(copyNodeInput.targetId, resolvedName);
|
|
2056
|
+
}
|
|
1922
2057
|
}
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
try {
|
|
1935
|
-
return isPlainObject(value);
|
|
1936
|
-
} catch {
|
|
1937
|
-
return false;
|
|
2058
|
+
const fileNodesToCopy = copyNodesInput.filter((copyNodeInput) => {
|
|
2059
|
+
const node = drive.state.global.nodes.find((node) => node.id === copyNodeInput.srcId);
|
|
2060
|
+
return node !== void 0 && isFileNode(node);
|
|
2061
|
+
});
|
|
2062
|
+
for (const fileNodeToCopy of fileNodesToCopy) try {
|
|
2063
|
+
const duplicatedDocument = await _duplicateDocument(reactor, await reactor.get(fileNodeToCopy.srcId), fileNodeToCopy.targetId);
|
|
2064
|
+
const resolvedName = resolvedNamesMap.get(fileNodeToCopy.targetId);
|
|
2065
|
+
if (resolvedName) duplicatedDocument.header.name = resolvedName;
|
|
2066
|
+
await reactor.drives.addFile(driveId, duplicatedDocument, target?.id);
|
|
2067
|
+
} catch (e) {
|
|
2068
|
+
logger.error(`Error copying document ${fileNodeToCopy.srcId}: ${String(e)}`);
|
|
1938
2069
|
}
|
|
2070
|
+
return await queueActions(drive, copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput)));
|
|
2071
|
+
}
|
|
2072
|
+
const modalEventFunctions = makePHEventFunctions("modal");
|
|
2073
|
+
modalEventFunctions.useValue;
|
|
2074
|
+
/** Sets the current modal */
|
|
2075
|
+
const setPHModal = modalEventFunctions.setValue;
|
|
2076
|
+
modalEventFunctions.addEventHandler;
|
|
2077
|
+
/** Shows a modal */
|
|
2078
|
+
function showPHModal(modal) {
|
|
2079
|
+
setPHModal(modal);
|
|
2080
|
+
}
|
|
2081
|
+
/** Shows the delete node modal */
|
|
2082
|
+
function showDeleteNodeModal(nodeOrId) {
|
|
2083
|
+
setPHModal({
|
|
2084
|
+
type: "deleteItem",
|
|
2085
|
+
id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
gql`
|
|
2089
|
+
mutation MutateDocumentWithOperations(
|
|
2090
|
+
$documentIdentifier: String!
|
|
2091
|
+
$actions: [JSONObject!]!
|
|
2092
|
+
$view: ViewFilterInput
|
|
2093
|
+
$sinceRevision: Int
|
|
2094
|
+
$scopes: [String!]
|
|
2095
|
+
$branch: String
|
|
2096
|
+
) {
|
|
2097
|
+
mutateDocument(
|
|
2098
|
+
documentIdentifier: $documentIdentifier
|
|
2099
|
+
actions: $actions
|
|
2100
|
+
view: $view
|
|
2101
|
+
) {
|
|
2102
|
+
...PHDocumentFields
|
|
2103
|
+
operations(
|
|
2104
|
+
filter: {
|
|
2105
|
+
sinceRevision: $sinceRevision
|
|
2106
|
+
scopes: $scopes
|
|
2107
|
+
branch: $branch
|
|
2108
|
+
}
|
|
2109
|
+
) {
|
|
2110
|
+
items {
|
|
2111
|
+
...ReactorOperationFields
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
${PhDocumentFieldsFragmentDoc}
|
|
2117
|
+
${gql`
|
|
2118
|
+
fragment ReactorOperationFields on ReactorOperation {
|
|
2119
|
+
index
|
|
2120
|
+
timestampUtcMs
|
|
2121
|
+
hash
|
|
2122
|
+
skip
|
|
2123
|
+
error
|
|
2124
|
+
deniedReason
|
|
2125
|
+
id
|
|
2126
|
+
action {
|
|
2127
|
+
id
|
|
2128
|
+
type
|
|
2129
|
+
timestampUtcMs
|
|
2130
|
+
input
|
|
2131
|
+
scope
|
|
2132
|
+
context {
|
|
2133
|
+
signer {
|
|
2134
|
+
user {
|
|
2135
|
+
address
|
|
2136
|
+
networkId
|
|
2137
|
+
chainId
|
|
2138
|
+
}
|
|
2139
|
+
app {
|
|
2140
|
+
name
|
|
2141
|
+
key
|
|
2142
|
+
}
|
|
2143
|
+
signatures
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
`}
|
|
2149
|
+
`;
|
|
2150
|
+
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;
|
|
2151
|
+
PropagationMode.Cascade, PropagationMode.Orphan;
|
|
2152
|
+
const isExternalControlsEnabledEventFunctions = makePHEventFunctions("isExternalControlsEnabled");
|
|
2153
|
+
/** Sets whether external controls are enabled for a given editor. */
|
|
2154
|
+
const setIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.setValue;
|
|
2155
|
+
/** Gets whether external controls are enabled for a given editor. */
|
|
2156
|
+
const useIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.useValue;
|
|
2157
|
+
isExternalControlsEnabledEventFunctions.addEventHandler;
|
|
2158
|
+
const isDragAndDropEnabledEventFunctions = makePHEventFunctions("isDragAndDropEnabled");
|
|
2159
|
+
/** Sets whether drag and drop is enabled for a given app. */
|
|
2160
|
+
const setIsDragAndDropEnabled = isDragAndDropEnabledEventFunctions.setValue;
|
|
2161
|
+
/** Gets whether drag and drop is enabled for a given app. */
|
|
2162
|
+
const useIsDragAndDropEnabled = isDragAndDropEnabledEventFunctions.useValue;
|
|
2163
|
+
isDragAndDropEnabledEventFunctions.addEventHandler;
|
|
2164
|
+
const allowedDocumentTypesEventFunctions = makePHEventFunctions("allowedDocumentTypes");
|
|
2165
|
+
/** Sets the allowed document types for a given app. */
|
|
2166
|
+
const setAllowedDocumentTypes = allowedDocumentTypesEventFunctions.setValue;
|
|
2167
|
+
/** Defines the document types a drive supports.
|
|
2168
|
+
*
|
|
2169
|
+
* Defaults to all of the document types registered in the reactor.
|
|
2170
|
+
*/
|
|
2171
|
+
function useAllowedDocumentTypes() {
|
|
2172
|
+
return allowedDocumentTypesEventFunctions.useValue();
|
|
2173
|
+
}
|
|
2174
|
+
allowedDocumentTypesEventFunctions.addEventHandler;
|
|
2175
|
+
const phAppConfigSetters = {
|
|
2176
|
+
allowedDocumentTypes: setAllowedDocumentTypes,
|
|
2177
|
+
isDragAndDropEnabled: setIsDragAndDropEnabled
|
|
1939
2178
|
};
|
|
1940
|
-
const
|
|
1941
|
-
const
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
} catch {
|
|
1945
|
-
return true;
|
|
1946
|
-
}
|
|
2179
|
+
const phDocumentEditorConfigSetters = { isExternalControlsEnabled: setIsExternalControlsEnabled };
|
|
2180
|
+
const phAppConfigHooks = {
|
|
2181
|
+
allowedDocumentTypes: useAllowedDocumentTypes,
|
|
2182
|
+
isDragAndDropEnabled: useIsDragAndDropEnabled
|
|
1947
2183
|
};
|
|
1948
|
-
const
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
const
|
|
1952
|
-
const
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
2184
|
+
const phDocumentEditorConfigHooks = { isExternalControlsEnabled: useIsExternalControlsEnabled };
|
|
2185
|
+
const { useValue: useRouterBasename, setValue: setRouterBasename, addEventHandler: addRouterBasenameEventHandler } = makePHEventFunctions("routerBasename");
|
|
2186
|
+
const { useValue: useVersion, setValue: setVersion, addEventHandler: addVersionEventHandler } = makePHEventFunctions("version");
|
|
2187
|
+
const { useValue: useRequiresHardRefresh, setValue: setRequiresHardRefresh, addEventHandler: addRequiresHardRefreshEventHandler } = makePHEventFunctions("requiresHardRefresh");
|
|
2188
|
+
const { useValue: useWarnOutdatedApp, setValue: setWarnOutdatedApp, addEventHandler: addWarnOutdatedAppEventHandler } = makePHEventFunctions("warnOutdatedApp");
|
|
2189
|
+
const { useValue: useStudioMode, setValue: setStudioMode, addEventHandler: addStudioModeEventHandler } = makePHEventFunctions("studioMode");
|
|
2190
|
+
const { useValue: useBasePath, setValue: setBasePath, addEventHandler: addBasePathEventHandler } = makePHEventFunctions("basePath");
|
|
2191
|
+
const { useValue: useVersionCheckInterval, setValue: setVersionCheckInterval, addEventHandler: addVersionCheckIntervalEventHandler } = makePHEventFunctions("versionCheckInterval");
|
|
2192
|
+
const { useValue: useCliVersion, setValue: setCliVersion, addEventHandler: addCliVersionEventHandler } = makePHEventFunctions("cliVersion");
|
|
2193
|
+
const { useValue: useFileUploadOperationsChunkSize, setValue: setFileUploadOperationsChunkSize, addEventHandler: addFileUploadOperationsChunkSizeEventHandler } = makePHEventFunctions("fileUploadOperationsChunkSize");
|
|
2194
|
+
const { useValue: useIsDocumentModelSelectionSettingsEnabled, setValue: setIsDocumentModelSelectionSettingsEnabled, addEventHandler: addIsDocumentModelSelectionSettingsEnabledEventHandler } = makePHEventFunctions("isDocumentModelSelectionSettingsEnabled");
|
|
2195
|
+
const { useValue: useGaTrackingId, setValue: setGaTrackingId, addEventHandler: addGaTrackingIdEventHandler } = makePHEventFunctions("gaTrackingId");
|
|
2196
|
+
const { useValue: useDefaultDrivesUrl, setValue: setDefaultDrivesUrl, addEventHandler: addDefaultDrivesUrlEventHandler } = makePHEventFunctions("defaultDrivesUrl");
|
|
2197
|
+
const { useValue: useDrivesPreserveStrategy, setValue: setDrivesPreserveStrategy, addEventHandler: addDrivesPreserveStrategyEventHandler } = makePHEventFunctions("drivesPreserveStrategy");
|
|
2198
|
+
const { useValue: useIsLocalDrivesEnabled, setValue: setIsLocalDrivesEnabled, addEventHandler: addIsLocalDrivesEnabledEventHandler } = makePHEventFunctions("isLocalDrivesEnabled");
|
|
2199
|
+
const { useValue: useIsAddDriveEnabled, setValue: setIsAddDriveEnabled, addEventHandler: addIsAddDriveEnabledEventHandler } = makePHEventFunctions("isAddDriveEnabled");
|
|
2200
|
+
const { useValue: useIsPublicDrivesEnabled, setValue: setIsPublicDrivesEnabled, addEventHandler: addIsPublicDrivesEnabledEventHandler } = makePHEventFunctions("isPublicDrivesEnabled");
|
|
2201
|
+
const { useValue: useIsAddPublicDrivesEnabled, setValue: setIsAddPublicDrivesEnabled, addEventHandler: addIsAddPublicDrivesEnabledEventHandler } = makePHEventFunctions("isAddPublicDrivesEnabled");
|
|
2202
|
+
const { useValue: useIsDeletePublicDrivesEnabled, setValue: setIsDeletePublicDrivesEnabled, addEventHandler: addIsDeletePublicDrivesEnabledEventHandler } = makePHEventFunctions("isDeletePublicDrivesEnabled");
|
|
2203
|
+
const { useValue: useIsCloudDrivesEnabled, setValue: setIsCloudDrivesEnabled, addEventHandler: addIsCloudDrivesEnabledEventHandler } = makePHEventFunctions("isCloudDrivesEnabled");
|
|
2204
|
+
const { useValue: useIsAddCloudDrivesEnabled, setValue: setIsAddCloudDrivesEnabled, addEventHandler: addIsAddCloudDrivesEnabledEventHandler } = makePHEventFunctions("isAddCloudDrivesEnabled");
|
|
2205
|
+
const { useValue: useIsDeleteCloudDrivesEnabled, setValue: setIsDeleteCloudDrivesEnabled, addEventHandler: addIsDeleteCloudDrivesEnabledEventHandler } = makePHEventFunctions("isDeleteCloudDrivesEnabled");
|
|
2206
|
+
const { useValue: useLocalDrivesEnabled, setValue: setLocalDrivesEnabled, addEventHandler: addLocalDrivesEnabledEventHandler } = makePHEventFunctions("isLocalDrivesEnabled");
|
|
2207
|
+
const { useValue: useIsAddLocalDrivesEnabled, setValue: setIsAddLocalDrivesEnabled, addEventHandler: addIsAddLocalDrivesEnabledEventHandler } = makePHEventFunctions("isAddLocalDrivesEnabled");
|
|
2208
|
+
const { useValue: useIsDeleteLocalDrivesEnabled, setValue: setIsDeleteLocalDrivesEnabled, addEventHandler: addIsDeleteLocalDrivesEnabledEventHandler } = makePHEventFunctions("isDeleteLocalDrivesEnabled");
|
|
2209
|
+
const { useValue: useIsEditorDebugModeEnabled, setValue: setIsEditorDebugModeEnabled, addEventHandler: addIsEditorDebugModeEnabledEventHandler } = makePHEventFunctions("isEditorDebugModeEnabled");
|
|
2210
|
+
const { useValue: useIsEditorReadModeEnabled, setValue: setIsEditorReadModeEnabled, addEventHandler: addIsEditorReadModeEnabledEventHandler } = makePHEventFunctions("isEditorReadModeEnabled");
|
|
2211
|
+
const { useValue: useIsAnalyticsDatabaseWorkerEnabled, setValue: setIsAnalyticsDatabaseWorkerEnabled, addEventHandler: addIsAnalyticsDatabaseWorkerEnabledEventHandler } = makePHEventFunctions("isAnalyticsDatabaseWorkerEnabled");
|
|
2212
|
+
const { useValue: useIsDiffAnalyticsEnabled, setValue: setIsDiffAnalyticsEnabled, addEventHandler: addIsDiffAnalyticsEnabledEventHandler } = makePHEventFunctions("isDiffAnalyticsEnabled");
|
|
2213
|
+
const { useValue: useIsDriveAnalyticsEnabled, setValue: setIsDriveAnalyticsEnabled, addEventHandler: addIsDriveAnalyticsEnabledEventHandler } = makePHEventFunctions("isDriveAnalyticsEnabled");
|
|
2214
|
+
const { useValue: useRenownUrl, setValue: setRenownUrl, addEventHandler: addRenownUrlEventHandler } = makePHEventFunctions("renownUrl");
|
|
2215
|
+
const { useValue: useRenownNetworkId, setValue: setRenownNetworkId, addEventHandler: addRenownNetworkIdEventHandler } = makePHEventFunctions("renownNetworkId");
|
|
2216
|
+
const { useValue: useRenownChainId, setValue: setRenownChainId, addEventHandler: addRenownChainIdEventHandler } = makePHEventFunctions("renownChainId");
|
|
2217
|
+
const { useValue: useSwitchboardUrl, setValue: setSwitchboardUrl, addEventHandler: addSwitchboardUrlEventHandler } = makePHEventFunctions("switchboardUrl");
|
|
2218
|
+
const { useValue: useRenownAdapters, setValue: setRenownAdapters, addEventHandler: addRenownAdaptersEventHandler } = makePHEventFunctions("renownAdapters");
|
|
2219
|
+
const { useValue: useSentryRelease, setValue: setSentryRelease, addEventHandler: addSentryReleaseEventHandler } = makePHEventFunctions("sentryRelease");
|
|
2220
|
+
const { useValue: useSentryDsn, setValue: setSentryDsn, addEventHandler: addSentryDsnEventHandler } = makePHEventFunctions("sentryDsn");
|
|
2221
|
+
const { useValue: useSentryEnv, setValue: setSentryEnv, addEventHandler: addSentryEnvEventHandler } = makePHEventFunctions("sentryEnv");
|
|
2222
|
+
const { useValue: useIsSentryTracingEnabled, setValue: setIsSentryTracingEnabled, addEventHandler: addIsSentryTracingEnabledEventHandler } = makePHEventFunctions("isSentryTracingEnabled");
|
|
2223
|
+
const { useValue: useIsExternalProcessorsEnabled, setValue: setIsExternalProcessorsEnabled, addEventHandler: addIsExternalProcessorsEnabledEventHandler } = makePHEventFunctions("isExternalProcessorsEnabled");
|
|
2224
|
+
const { useValue: useIsExternalPackagesEnabled, setValue: setIsExternalPackagesEnabled, addEventHandler: addIsExternalPackagesEnabledEventHandler } = makePHEventFunctions("isExternalPackagesEnabled");
|
|
2225
|
+
const enabledEditorsEventFunctions = makePHEventFunctions("enabledEditors");
|
|
2226
|
+
/** Sets the enabled editors for Connect. */
|
|
2227
|
+
const setEnabledEditors = enabledEditorsEventFunctions.setValue;
|
|
2228
|
+
/** Gets the enabled editors for Connect. */
|
|
2229
|
+
const useEnabledEditors = enabledEditorsEventFunctions.useValue;
|
|
2230
|
+
enabledEditorsEventFunctions.addEventHandler;
|
|
2231
|
+
const disabledEditorsEventFunctions = makePHEventFunctions("disabledEditors");
|
|
2232
|
+
/** Sets the disabled editors for Connect. */
|
|
2233
|
+
const setDisabledEditors = disabledEditorsEventFunctions.setValue;
|
|
2234
|
+
/** Gets the disabled editors for Connect. */
|
|
2235
|
+
const useDisabledEditors = disabledEditorsEventFunctions.useValue;
|
|
2236
|
+
disabledEditorsEventFunctions.addEventHandler;
|
|
2237
|
+
const isRelationalProcessorsEnabled = makePHEventFunctions("isRelationalProcessorsEnabled");
|
|
2238
|
+
/** Sets the isRelationalProcessorsEnabled for Connect. */
|
|
2239
|
+
const setIsRelationalProcessorsEnabled = isRelationalProcessorsEnabled.setValue;
|
|
2240
|
+
/** Gets the isRelationalProcessorsEnabled for Connect. */
|
|
2241
|
+
const useIsRelationalProcessorsEnabled = isRelationalProcessorsEnabled.useValue;
|
|
2242
|
+
isRelationalProcessorsEnabled.addEventHandler;
|
|
2243
|
+
const isExternalRelationalProcessorsEnabled = makePHEventFunctions("isExternalRelationalProcessorsEnabled");
|
|
2244
|
+
/** Sets the isExternalRelationalProcessorsEnabled for Connect. */
|
|
2245
|
+
const setIsExternalRelationalProcessorsEnabled = isExternalRelationalProcessorsEnabled.setValue;
|
|
2246
|
+
/** Gets the isExternalRelationalProcessorsEnabled for Connect. */
|
|
2247
|
+
const useIsExternalRelationalProcessorsEnabled = isExternalRelationalProcessorsEnabled.useValue;
|
|
2248
|
+
isExternalRelationalProcessorsEnabled.addEventHandler;
|
|
2249
|
+
const isAnalyticsEnabledEventFunctions = makePHEventFunctions("isAnalyticsEnabled");
|
|
2250
|
+
/** Sets the isAnalyticsEnabled for Connect. */
|
|
2251
|
+
const setIsAnalyticsEnabled = isAnalyticsEnabledEventFunctions.setValue;
|
|
2252
|
+
/** Gets the isAnalyticsEnabled for Connect. */
|
|
2253
|
+
const useIsAnalyticsEnabled = isAnalyticsEnabledEventFunctions.useValue;
|
|
2254
|
+
isAnalyticsEnabledEventFunctions.addEventHandler;
|
|
2255
|
+
const isAnalyticsExternalProcessorsEnabled = makePHEventFunctions("isAnalyticsExternalProcessorsEnabled");
|
|
2256
|
+
/** Sets the isAnalyticsExternalProcessorsEnabled for Connect. */
|
|
2257
|
+
const setIsAnalyticsExternalProcessorsEnabled = isAnalyticsExternalProcessorsEnabled.setValue;
|
|
2258
|
+
/** Gets the isAnalyticsExternalProcessorsEnabled for Connect. */
|
|
2259
|
+
const useIsAnalyticsExternalProcessorsEnabled = isAnalyticsExternalProcessorsEnabled.useValue;
|
|
2260
|
+
isAnalyticsExternalProcessorsEnabled.addEventHandler;
|
|
2261
|
+
const analyticsDatabaseNameEventFunctions = makePHEventFunctions("analyticsDatabaseName");
|
|
2262
|
+
/** Sets the analytics database name for Connect. */
|
|
2263
|
+
const setAnalyticsDatabaseName = analyticsDatabaseNameEventFunctions.setValue;
|
|
2264
|
+
/** Gets the analytics database name for Connect. */
|
|
2265
|
+
const useAnalyticsDatabaseName = analyticsDatabaseNameEventFunctions.useValue;
|
|
2266
|
+
analyticsDatabaseNameEventFunctions.addEventHandler;
|
|
2267
|
+
const logLevelEventFunctions = makePHEventFunctions("logLevel");
|
|
2268
|
+
/** Sets the log level for Connect. */
|
|
2269
|
+
const setLogLevel = logLevelEventFunctions.setValue;
|
|
2270
|
+
/** Gets the log level for Connect. */
|
|
2271
|
+
const useLogLevel = logLevelEventFunctions.useValue;
|
|
2272
|
+
logLevelEventFunctions.addEventHandler;
|
|
2273
|
+
const allowListEventFunctions = makePHEventFunctions("allowList");
|
|
2274
|
+
/** Sets the allow list for Connect. */
|
|
2275
|
+
const setAllowList = allowListEventFunctions.setValue;
|
|
2276
|
+
/** Gets the allow list for Connect. */
|
|
2277
|
+
const useAllowList = allowListEventFunctions.useValue;
|
|
2278
|
+
allowListEventFunctions.addEventHandler;
|
|
2279
|
+
const nonUserConfigSetters = {
|
|
2280
|
+
routerBasename: setRouterBasename,
|
|
2281
|
+
version: setVersion,
|
|
2282
|
+
requiresHardRefresh: setRequiresHardRefresh,
|
|
2283
|
+
warnOutdatedApp: setWarnOutdatedApp,
|
|
2284
|
+
studioMode: setStudioMode,
|
|
2285
|
+
basePath: setBasePath,
|
|
2286
|
+
versionCheckInterval: setVersionCheckInterval,
|
|
2287
|
+
cliVersion: setCliVersion,
|
|
2288
|
+
fileUploadOperationsChunkSize: setFileUploadOperationsChunkSize,
|
|
2289
|
+
isDocumentModelSelectionSettingsEnabled: setIsDocumentModelSelectionSettingsEnabled,
|
|
2290
|
+
gaTrackingId: setGaTrackingId,
|
|
2291
|
+
defaultDrivesUrl: setDefaultDrivesUrl,
|
|
2292
|
+
drivesPreserveStrategy: setDrivesPreserveStrategy,
|
|
2293
|
+
isLocalDrivesEnabled: setIsLocalDrivesEnabled,
|
|
2294
|
+
isAddDriveEnabled: setIsAddDriveEnabled,
|
|
2295
|
+
isPublicDrivesEnabled: setIsPublicDrivesEnabled,
|
|
2296
|
+
isAddPublicDrivesEnabled: setIsAddPublicDrivesEnabled,
|
|
2297
|
+
isDeletePublicDrivesEnabled: setIsDeletePublicDrivesEnabled,
|
|
2298
|
+
isCloudDrivesEnabled: setIsCloudDrivesEnabled,
|
|
2299
|
+
isAddCloudDrivesEnabled: setIsAddCloudDrivesEnabled,
|
|
2300
|
+
isDeleteCloudDrivesEnabled: setIsDeleteCloudDrivesEnabled,
|
|
2301
|
+
isAddLocalDrivesEnabled: setIsAddLocalDrivesEnabled,
|
|
2302
|
+
isDeleteLocalDrivesEnabled: setIsDeleteLocalDrivesEnabled,
|
|
2303
|
+
isEditorDebugModeEnabled: setIsEditorDebugModeEnabled,
|
|
2304
|
+
isEditorReadModeEnabled: setIsEditorReadModeEnabled,
|
|
2305
|
+
isRelationalProcessorsEnabled: setIsRelationalProcessorsEnabled,
|
|
2306
|
+
isExternalRelationalProcessorsEnabled: setIsExternalRelationalProcessorsEnabled,
|
|
2307
|
+
isAnalyticsEnabled: setIsAnalyticsEnabled,
|
|
2308
|
+
analyticsDatabaseName: setAnalyticsDatabaseName,
|
|
2309
|
+
isAnalyticsExternalProcessorsEnabled: setIsAnalyticsExternalProcessorsEnabled,
|
|
2310
|
+
isAnalyticsDatabaseWorkerEnabled: setIsAnalyticsDatabaseWorkerEnabled,
|
|
2311
|
+
isDiffAnalyticsEnabled: setIsDiffAnalyticsEnabled,
|
|
2312
|
+
isDriveAnalyticsEnabled: setIsDriveAnalyticsEnabled,
|
|
2313
|
+
renownUrl: setRenownUrl,
|
|
2314
|
+
renownNetworkId: setRenownNetworkId,
|
|
2315
|
+
renownChainId: setRenownChainId,
|
|
2316
|
+
switchboardUrl: setSwitchboardUrl,
|
|
2317
|
+
renownAdapters: setRenownAdapters,
|
|
2318
|
+
sentryRelease: setSentryRelease,
|
|
2319
|
+
sentryDsn: setSentryDsn,
|
|
2320
|
+
sentryEnv: setSentryEnv,
|
|
2321
|
+
isSentryTracingEnabled: setIsSentryTracingEnabled,
|
|
2322
|
+
isExternalProcessorsEnabled: setIsExternalProcessorsEnabled,
|
|
2323
|
+
isExternalPackagesEnabled: setIsExternalPackagesEnabled,
|
|
2324
|
+
allowList: setAllowList,
|
|
2325
|
+
logLevel: setLogLevel,
|
|
2326
|
+
disabledEditors: setDisabledEditors,
|
|
2327
|
+
enabledEditors: setEnabledEditors
|
|
1958
2328
|
};
|
|
1959
|
-
const
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
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", "");
|
|
2329
|
+
const phGlobalConfigSetters = {
|
|
2330
|
+
...phAppConfigSetters,
|
|
2331
|
+
...phDocumentEditorConfigSetters,
|
|
2332
|
+
...nonUserConfigSetters
|
|
1975
2333
|
};
|
|
1976
|
-
const
|
|
1977
|
-
|
|
2334
|
+
const nonUserConfigHooks = {
|
|
2335
|
+
routerBasename: useRouterBasename,
|
|
2336
|
+
version: useVersion,
|
|
2337
|
+
requiresHardRefresh: useRequiresHardRefresh,
|
|
2338
|
+
warnOutdatedApp: useWarnOutdatedApp,
|
|
2339
|
+
studioMode: useStudioMode,
|
|
2340
|
+
basePath: useBasePath,
|
|
2341
|
+
versionCheckInterval: useVersionCheckInterval,
|
|
2342
|
+
cliVersion: useCliVersion,
|
|
2343
|
+
fileUploadOperationsChunkSize: useFileUploadOperationsChunkSize,
|
|
2344
|
+
isDocumentModelSelectionSettingsEnabled: useIsDocumentModelSelectionSettingsEnabled,
|
|
2345
|
+
gaTrackingId: useGaTrackingId,
|
|
2346
|
+
defaultDrivesUrl: useDefaultDrivesUrl,
|
|
2347
|
+
drivesPreserveStrategy: useDrivesPreserveStrategy,
|
|
2348
|
+
isAddDriveEnabled: useIsAddDriveEnabled,
|
|
2349
|
+
isPublicDrivesEnabled: useIsPublicDrivesEnabled,
|
|
2350
|
+
isAddPublicDrivesEnabled: useIsAddPublicDrivesEnabled,
|
|
2351
|
+
isDeletePublicDrivesEnabled: useIsDeletePublicDrivesEnabled,
|
|
2352
|
+
isCloudDrivesEnabled: useIsCloudDrivesEnabled,
|
|
2353
|
+
isAddCloudDrivesEnabled: useIsAddCloudDrivesEnabled,
|
|
2354
|
+
isDeleteCloudDrivesEnabled: useIsDeleteCloudDrivesEnabled,
|
|
2355
|
+
isLocalDrivesEnabled: useIsLocalDrivesEnabled,
|
|
2356
|
+
isAddLocalDrivesEnabled: useIsAddLocalDrivesEnabled,
|
|
2357
|
+
isDeleteLocalDrivesEnabled: useIsDeleteLocalDrivesEnabled,
|
|
2358
|
+
isEditorDebugModeEnabled: useIsEditorDebugModeEnabled,
|
|
2359
|
+
isEditorReadModeEnabled: useIsEditorReadModeEnabled,
|
|
2360
|
+
isAnalyticsDatabaseWorkerEnabled: useIsAnalyticsDatabaseWorkerEnabled,
|
|
2361
|
+
isDiffAnalyticsEnabled: useIsDiffAnalyticsEnabled,
|
|
2362
|
+
isDriveAnalyticsEnabled: useIsDriveAnalyticsEnabled,
|
|
2363
|
+
renownUrl: useRenownUrl,
|
|
2364
|
+
renownNetworkId: useRenownNetworkId,
|
|
2365
|
+
renownChainId: useRenownChainId,
|
|
2366
|
+
switchboardUrl: useSwitchboardUrl,
|
|
2367
|
+
renownAdapters: useRenownAdapters,
|
|
2368
|
+
sentryRelease: useSentryRelease,
|
|
2369
|
+
sentryDsn: useSentryDsn,
|
|
2370
|
+
sentryEnv: useSentryEnv,
|
|
2371
|
+
isSentryTracingEnabled: useIsSentryTracingEnabled,
|
|
2372
|
+
isExternalProcessorsEnabled: useIsExternalProcessorsEnabled,
|
|
2373
|
+
isExternalPackagesEnabled: useIsExternalPackagesEnabled,
|
|
2374
|
+
allowList: useAllowList,
|
|
2375
|
+
isAnalyticsEnabled: useIsAnalyticsEnabled,
|
|
2376
|
+
isAnalyticsExternalProcessorsEnabled: useIsAnalyticsExternalProcessorsEnabled,
|
|
2377
|
+
isRelationalProcessorsEnabled: useIsRelationalProcessorsEnabled,
|
|
2378
|
+
isExternalRelationalProcessorsEnabled: useIsExternalRelationalProcessorsEnabled,
|
|
2379
|
+
analyticsDatabaseName: useAnalyticsDatabaseName,
|
|
2380
|
+
logLevel: useLogLevel,
|
|
2381
|
+
disabledEditors: useDisabledEditors,
|
|
2382
|
+
enabledEditors: useEnabledEditors
|
|
1978
2383
|
};
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
2384
|
+
({
|
|
2385
|
+
...phAppConfigHooks,
|
|
2386
|
+
...phDocumentEditorConfigHooks,
|
|
2387
|
+
...nonUserConfigHooks
|
|
2388
|
+
});
|
|
2389
|
+
const attachmentServiceEventFunctions = makePHEventFunctions("attachmentService");
|
|
2390
|
+
attachmentServiceEventFunctions.useValue;
|
|
2391
|
+
attachmentServiceEventFunctions.setValue;
|
|
2392
|
+
attachmentServiceEventFunctions.addEventHandler;
|
|
2393
|
+
const featuresEventFunctions = makePHEventFunctions("features");
|
|
2394
|
+
featuresEventFunctions.useValue;
|
|
2395
|
+
featuresEventFunctions.setValue;
|
|
2396
|
+
featuresEventFunctions.addEventHandler;
|
|
2397
|
+
function resolveUrlPathname(path) {
|
|
2398
|
+
return new URL(path.replace(/^\/+/, ""), window.location.origin + (window.ph?.basePath ?? "/")).pathname;
|
|
2399
|
+
}
|
|
2400
|
+
/** Returns the current path without the base path */
|
|
2401
|
+
function getPathWithoutBase(path) {
|
|
2402
|
+
const basePath = window.ph?.basePath ?? "/";
|
|
2403
|
+
return path.replace(basePath, basePath.endsWith("/") ? "/" : "");
|
|
2404
|
+
}
|
|
2405
|
+
/** Makes a URL component for a node. */
|
|
2406
|
+
function makeNodeSlug(node) {
|
|
2407
|
+
if (!node) return "";
|
|
2408
|
+
const nodeName = node.name;
|
|
2409
|
+
if (!nodeName) return slug(node.id);
|
|
2410
|
+
return slug(`${nodeName}-${node.id}`);
|
|
2411
|
+
}
|
|
2412
|
+
/** Extracts the node slug from a path.
|
|
2413
|
+
*
|
|
2414
|
+
* The path is expected to be in the format `/d/<drive-slug>/<node-slug>`.
|
|
2415
|
+
*/
|
|
2416
|
+
function extractNodeSlugFromPath(path) {
|
|
2417
|
+
const currentPath = getPathWithoutBase(path);
|
|
2418
|
+
return /^\/d\/[^/]+\/([^/]+)$/.exec(currentPath)?.[1];
|
|
2419
|
+
}
|
|
2420
|
+
/** Finds a UUID in a string, used for extracting node ids from node slugs in the URL. */
|
|
2421
|
+
function findUuid(input) {
|
|
2422
|
+
if (!input) return void 0;
|
|
2423
|
+
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];
|
|
2424
|
+
}
|
|
2425
|
+
function extractNodeIdFromSlug(nodeSlug) {
|
|
2426
|
+
return findUuid(nodeSlug);
|
|
2427
|
+
}
|
|
2428
|
+
/** Extracts the drive slug from a path.
|
|
2429
|
+
* Used for extracting drive ids from drive slugs in the URL.
|
|
2430
|
+
* Expects the path to be in the format `/d/<drive-slug>`.
|
|
2431
|
+
*/
|
|
2432
|
+
function extractDriveSlugFromPath(path) {
|
|
2433
|
+
const currentPath = getPathWithoutBase(path);
|
|
2434
|
+
return /^\/d\/([^/]+)/.exec(currentPath)?.[1] ?? "";
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Creates a URL string with the given pathname while preserving existing query parameters.
|
|
2438
|
+
*/
|
|
2439
|
+
function createUrlWithPreservedParams(pathname) {
|
|
2440
|
+
const search = window.location.search;
|
|
2441
|
+
return search ? `${pathname}${search}` : pathname;
|
|
2442
|
+
}
|
|
2443
|
+
const drivesEventFunctions = makePHEventFunctions("drives");
|
|
2444
|
+
/** Returns all of the drives in the reactor */
|
|
2445
|
+
const useDrives = drivesEventFunctions.useValue;
|
|
2446
|
+
/** Sets the drives in the reactor */
|
|
2447
|
+
const setDrives = drivesEventFunctions.setValue;
|
|
2448
|
+
drivesEventFunctions.addEventHandler;
|
|
2449
|
+
const selectedNodeIdEventFunctions = makePHEventFunctions("selectedNodeId");
|
|
2450
|
+
const useSelectedNodeId = selectedNodeIdEventFunctions.useValue;
|
|
2451
|
+
const setSelectedNodeId = selectedNodeIdEventFunctions.setValue;
|
|
2452
|
+
selectedNodeIdEventFunctions.addEventHandler;
|
|
2453
|
+
/** Sets the selected node (file or folder). */
|
|
2454
|
+
function setSelectedNode(nodeOrNodeSlug) {
|
|
2455
|
+
const nodeSlug = typeof nodeOrNodeSlug === "string" ? nodeOrNodeSlug : makeNodeSlug(nodeOrNodeSlug);
|
|
2456
|
+
setSelectedNodeId(extractNodeIdFromSlug(nodeSlug));
|
|
2457
|
+
const driveSlugFromPath = extractDriveSlugFromPath(window.location.pathname);
|
|
2458
|
+
if (!driveSlugFromPath) return;
|
|
2459
|
+
if (!nodeSlug) {
|
|
2460
|
+
const pathname = resolveUrlPathname(`/d/${driveSlugFromPath}`);
|
|
2461
|
+
if (pathname === window.location.pathname) return;
|
|
2462
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
const pathname = resolveUrlPathname(`/d/${driveSlugFromPath}/${nodeSlug}`);
|
|
2466
|
+
if (pathname === window.location.pathname) return;
|
|
2467
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
2468
|
+
}
|
|
2469
|
+
const selectedDriveIdEventFunctions = makePHEventFunctions("selectedDriveId");
|
|
2470
|
+
/** Returns the selected drive id */
|
|
2471
|
+
const useSelectedDriveId = selectedDriveIdEventFunctions.useValue;
|
|
2472
|
+
/** Sets the selected drive id */
|
|
2473
|
+
const setSelectedDriveId = selectedDriveIdEventFunctions.setValue;
|
|
2474
|
+
selectedDriveIdEventFunctions.addEventHandler;
|
|
2475
|
+
/** Returns the selected drive, or undefined if no drive is selected */
|
|
2476
|
+
function useSelectedDriveSafe() {
|
|
2477
|
+
const selectedDriveId = useSelectedDriveId();
|
|
2478
|
+
const selectedDrive = useDrives()?.find((drive) => drive.header.id === selectedDriveId);
|
|
2479
|
+
const [drive, dispatch] = useDispatch(selectedDrive);
|
|
2480
|
+
if (!selectedDrive) return [void 0, void 0];
|
|
2481
|
+
return [drive, dispatch];
|
|
2482
|
+
}
|
|
2483
|
+
function setSelectedDrive(driveOrDriveSlug) {
|
|
2484
|
+
const driveSlug = typeof driveOrDriveSlug === "string" ? driveOrDriveSlug : driveOrDriveSlug?.header.slug;
|
|
2485
|
+
const drives = window.ph?.drives;
|
|
2486
|
+
const driveId = (typeof driveOrDriveSlug === "object" && driveOrDriveSlug !== null ? driveOrDriveSlug : drives?.find((d) => d.header.slug === driveSlug))?.header.id;
|
|
2487
|
+
if (!driveId && driveSlug && extractDriveSlugFromPath(window.location.pathname) === driveSlug) {
|
|
2488
|
+
if (window.ph?.selectedDriveId) setSelectedDriveId(void 0);
|
|
2489
|
+
deferDriveSelection(driveSlug);
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2492
|
+
cancelPendingDriveSelection();
|
|
2493
|
+
setSelectedDriveId(driveId);
|
|
2494
|
+
if (!driveId) {
|
|
2495
|
+
const pathname = resolveUrlPathname("/");
|
|
2496
|
+
if (pathname === window.location.pathname) return;
|
|
2497
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
const pathname = resolveUrlPathname(`/d/${driveSlug}`);
|
|
2501
|
+
if (pathname === window.location.pathname) return;
|
|
2502
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
2503
|
+
}
|
|
2504
|
+
const DEFERRED_DRIVE_TICK_MS = 2e3;
|
|
2505
|
+
const DEFERRED_DRIVE_MAX_WAIT_MS = 15e3;
|
|
2506
|
+
function isInitialSyncInFlight() {
|
|
2507
|
+
const remotes = window.ph?.reactorClientModule?.reactorModule?.syncModule?.syncManager?.list();
|
|
2508
|
+
if (!remotes?.length) return false;
|
|
2509
|
+
return remotes.some((remote) => {
|
|
2510
|
+
try {
|
|
2511
|
+
const snapshot = remote.channel.getConnectionState();
|
|
2512
|
+
return snapshot.receivingPages || !snapshot.lastSuccessUtcMs && snapshot.state !== "error";
|
|
2513
|
+
} catch {
|
|
2514
|
+
return false;
|
|
1994
2515
|
}
|
|
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
|
-
return
|
|
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
|
-
_compress: function(uncompressed, bitsPerChar, getCharFromInt) {
|
|
2071
|
-
if (uncompressed == null) return "";
|
|
2072
|
-
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;
|
|
2073
|
-
for (ii = 0; ii < uncompressed.length; ii += 1) {
|
|
2074
|
-
context_c = uncompressed.charAt(ii);
|
|
2075
|
-
if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
|
|
2076
|
-
context_dictionary[context_c] = context_dictSize++;
|
|
2077
|
-
context_dictionaryToCreate[context_c] = true;
|
|
2078
|
-
}
|
|
2079
|
-
context_wc = context_w + context_c;
|
|
2080
|
-
if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) context_w = context_wc;
|
|
2081
|
-
else {
|
|
2082
|
-
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
2083
|
-
if (context_w.charCodeAt(0) < 256) {
|
|
2084
|
-
for (i = 0; i < context_numBits; i++) {
|
|
2085
|
-
context_data_val = context_data_val << 1;
|
|
2086
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2087
|
-
context_data_position = 0;
|
|
2088
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2089
|
-
context_data_val = 0;
|
|
2090
|
-
} else context_data_position++;
|
|
2091
|
-
}
|
|
2092
|
-
value = context_w.charCodeAt(0);
|
|
2093
|
-
for (i = 0; i < 8; i++) {
|
|
2094
|
-
context_data_val = context_data_val << 1 | value & 1;
|
|
2095
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2096
|
-
context_data_position = 0;
|
|
2097
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2098
|
-
context_data_val = 0;
|
|
2099
|
-
} else context_data_position++;
|
|
2100
|
-
value = value >> 1;
|
|
2101
|
-
}
|
|
2102
|
-
} else {
|
|
2103
|
-
value = 1;
|
|
2104
|
-
for (i = 0; i < context_numBits; i++) {
|
|
2105
|
-
context_data_val = context_data_val << 1 | value;
|
|
2106
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2107
|
-
context_data_position = 0;
|
|
2108
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2109
|
-
context_data_val = 0;
|
|
2110
|
-
} else context_data_position++;
|
|
2111
|
-
value = 0;
|
|
2112
|
-
}
|
|
2113
|
-
value = context_w.charCodeAt(0);
|
|
2114
|
-
for (i = 0; i < 16; i++) {
|
|
2115
|
-
context_data_val = context_data_val << 1 | value & 1;
|
|
2116
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2117
|
-
context_data_position = 0;
|
|
2118
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2119
|
-
context_data_val = 0;
|
|
2120
|
-
} else context_data_position++;
|
|
2121
|
-
value = value >> 1;
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
context_enlargeIn--;
|
|
2125
|
-
if (context_enlargeIn == 0) {
|
|
2126
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
2127
|
-
context_numBits++;
|
|
2128
|
-
}
|
|
2129
|
-
delete context_dictionaryToCreate[context_w];
|
|
2130
|
-
} else {
|
|
2131
|
-
value = context_dictionary[context_w];
|
|
2132
|
-
for (i = 0; i < context_numBits; i++) {
|
|
2133
|
-
context_data_val = context_data_val << 1 | value & 1;
|
|
2134
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2135
|
-
context_data_position = 0;
|
|
2136
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2137
|
-
context_data_val = 0;
|
|
2138
|
-
} else context_data_position++;
|
|
2139
|
-
value = value >> 1;
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
context_enlargeIn--;
|
|
2143
|
-
if (context_enlargeIn == 0) {
|
|
2144
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
2145
|
-
context_numBits++;
|
|
2146
|
-
}
|
|
2147
|
-
context_dictionary[context_wc] = context_dictSize++;
|
|
2148
|
-
context_w = String(context_c);
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
if (context_w !== "") {
|
|
2152
|
-
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
2153
|
-
if (context_w.charCodeAt(0) < 256) {
|
|
2154
|
-
for (i = 0; i < context_numBits; i++) {
|
|
2155
|
-
context_data_val = context_data_val << 1;
|
|
2156
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2157
|
-
context_data_position = 0;
|
|
2158
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2159
|
-
context_data_val = 0;
|
|
2160
|
-
} else context_data_position++;
|
|
2161
|
-
}
|
|
2162
|
-
value = context_w.charCodeAt(0);
|
|
2163
|
-
for (i = 0; i < 8; i++) {
|
|
2164
|
-
context_data_val = context_data_val << 1 | value & 1;
|
|
2165
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2166
|
-
context_data_position = 0;
|
|
2167
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2168
|
-
context_data_val = 0;
|
|
2169
|
-
} else context_data_position++;
|
|
2170
|
-
value = value >> 1;
|
|
2171
|
-
}
|
|
2172
|
-
} else {
|
|
2173
|
-
value = 1;
|
|
2174
|
-
for (i = 0; i < context_numBits; i++) {
|
|
2175
|
-
context_data_val = context_data_val << 1 | value;
|
|
2176
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2177
|
-
context_data_position = 0;
|
|
2178
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2179
|
-
context_data_val = 0;
|
|
2180
|
-
} else context_data_position++;
|
|
2181
|
-
value = 0;
|
|
2182
|
-
}
|
|
2183
|
-
value = context_w.charCodeAt(0);
|
|
2184
|
-
for (i = 0; i < 16; i++) {
|
|
2185
|
-
context_data_val = context_data_val << 1 | value & 1;
|
|
2186
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2187
|
-
context_data_position = 0;
|
|
2188
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2189
|
-
context_data_val = 0;
|
|
2190
|
-
} else context_data_position++;
|
|
2191
|
-
value = value >> 1;
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
context_enlargeIn--;
|
|
2195
|
-
if (context_enlargeIn == 0) {
|
|
2196
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
2197
|
-
context_numBits++;
|
|
2198
|
-
}
|
|
2199
|
-
delete context_dictionaryToCreate[context_w];
|
|
2200
|
-
} else {
|
|
2201
|
-
value = context_dictionary[context_w];
|
|
2202
|
-
for (i = 0; i < context_numBits; i++) {
|
|
2203
|
-
context_data_val = context_data_val << 1 | value & 1;
|
|
2204
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2205
|
-
context_data_position = 0;
|
|
2206
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2207
|
-
context_data_val = 0;
|
|
2208
|
-
} else context_data_position++;
|
|
2209
|
-
value = value >> 1;
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
context_enlargeIn--;
|
|
2213
|
-
if (context_enlargeIn == 0) {
|
|
2214
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
2215
|
-
context_numBits++;
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
value = 2;
|
|
2219
|
-
for (i = 0; i < context_numBits; i++) {
|
|
2220
|
-
context_data_val = context_data_val << 1 | value & 1;
|
|
2221
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2222
|
-
context_data_position = 0;
|
|
2223
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2224
|
-
context_data_val = 0;
|
|
2225
|
-
} else context_data_position++;
|
|
2226
|
-
value = value >> 1;
|
|
2227
|
-
}
|
|
2228
|
-
while (true) {
|
|
2229
|
-
context_data_val = context_data_val << 1;
|
|
2230
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
2231
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
2232
|
-
break;
|
|
2233
|
-
} else context_data_position++;
|
|
2234
|
-
}
|
|
2235
|
-
return context_data.join("");
|
|
2236
|
-
},
|
|
2237
|
-
decompress: function(compressed) {
|
|
2238
|
-
if (compressed == null) return "";
|
|
2239
|
-
if (compressed == "") return null;
|
|
2240
|
-
return LZString._decompress(compressed.length, 32768, function(index) {
|
|
2241
|
-
return compressed.charCodeAt(index);
|
|
2242
|
-
});
|
|
2243
|
-
},
|
|
2244
|
-
_decompress: function(length, resetValue, getNextValue) {
|
|
2245
|
-
var dictionary = [], enlargeIn = 4, dictSize = 4, numBits = 3, entry = "", result = [], i, w, bits, resb, maxpower, power, c, data = {
|
|
2246
|
-
val: getNextValue(0),
|
|
2247
|
-
position: resetValue,
|
|
2248
|
-
index: 1
|
|
2249
|
-
};
|
|
2250
|
-
for (i = 0; i < 3; i += 1) dictionary[i] = i;
|
|
2251
|
-
bits = 0;
|
|
2252
|
-
maxpower = Math.pow(2, 2);
|
|
2253
|
-
power = 1;
|
|
2254
|
-
while (power != maxpower) {
|
|
2255
|
-
resb = data.val & data.position;
|
|
2256
|
-
data.position >>= 1;
|
|
2257
|
-
if (data.position == 0) {
|
|
2258
|
-
data.position = resetValue;
|
|
2259
|
-
data.val = getNextValue(data.index++);
|
|
2260
|
-
}
|
|
2261
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
2262
|
-
power <<= 1;
|
|
2263
|
-
}
|
|
2264
|
-
switch (bits) {
|
|
2265
|
-
case 0:
|
|
2266
|
-
bits = 0;
|
|
2267
|
-
maxpower = Math.pow(2, 8);
|
|
2268
|
-
power = 1;
|
|
2269
|
-
while (power != maxpower) {
|
|
2270
|
-
resb = data.val & data.position;
|
|
2271
|
-
data.position >>= 1;
|
|
2272
|
-
if (data.position == 0) {
|
|
2273
|
-
data.position = resetValue;
|
|
2274
|
-
data.val = getNextValue(data.index++);
|
|
2275
|
-
}
|
|
2276
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
2277
|
-
power <<= 1;
|
|
2278
|
-
}
|
|
2279
|
-
c = f(bits);
|
|
2280
|
-
break;
|
|
2281
|
-
case 1:
|
|
2282
|
-
bits = 0;
|
|
2283
|
-
maxpower = Math.pow(2, 16);
|
|
2284
|
-
power = 1;
|
|
2285
|
-
while (power != maxpower) {
|
|
2286
|
-
resb = data.val & data.position;
|
|
2287
|
-
data.position >>= 1;
|
|
2288
|
-
if (data.position == 0) {
|
|
2289
|
-
data.position = resetValue;
|
|
2290
|
-
data.val = getNextValue(data.index++);
|
|
2291
|
-
}
|
|
2292
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
2293
|
-
power <<= 1;
|
|
2294
|
-
}
|
|
2295
|
-
c = f(bits);
|
|
2296
|
-
break;
|
|
2297
|
-
case 2: return "";
|
|
2298
|
-
}
|
|
2299
|
-
dictionary[3] = c;
|
|
2300
|
-
w = c;
|
|
2301
|
-
result.push(c);
|
|
2302
|
-
while (true) {
|
|
2303
|
-
if (data.index > length) return "";
|
|
2304
|
-
bits = 0;
|
|
2305
|
-
maxpower = Math.pow(2, numBits);
|
|
2306
|
-
power = 1;
|
|
2307
|
-
while (power != maxpower) {
|
|
2308
|
-
resb = data.val & data.position;
|
|
2309
|
-
data.position >>= 1;
|
|
2310
|
-
if (data.position == 0) {
|
|
2311
|
-
data.position = resetValue;
|
|
2312
|
-
data.val = getNextValue(data.index++);
|
|
2313
|
-
}
|
|
2314
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
2315
|
-
power <<= 1;
|
|
2316
|
-
}
|
|
2317
|
-
switch (c = bits) {
|
|
2318
|
-
case 0:
|
|
2319
|
-
bits = 0;
|
|
2320
|
-
maxpower = Math.pow(2, 8);
|
|
2321
|
-
power = 1;
|
|
2322
|
-
while (power != maxpower) {
|
|
2323
|
-
resb = data.val & data.position;
|
|
2324
|
-
data.position >>= 1;
|
|
2325
|
-
if (data.position == 0) {
|
|
2326
|
-
data.position = resetValue;
|
|
2327
|
-
data.val = getNextValue(data.index++);
|
|
2328
|
-
}
|
|
2329
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
2330
|
-
power <<= 1;
|
|
2331
|
-
}
|
|
2332
|
-
dictionary[dictSize++] = f(bits);
|
|
2333
|
-
c = dictSize - 1;
|
|
2334
|
-
enlargeIn--;
|
|
2335
|
-
break;
|
|
2336
|
-
case 1:
|
|
2337
|
-
bits = 0;
|
|
2338
|
-
maxpower = Math.pow(2, 16);
|
|
2339
|
-
power = 1;
|
|
2340
|
-
while (power != maxpower) {
|
|
2341
|
-
resb = data.val & data.position;
|
|
2342
|
-
data.position >>= 1;
|
|
2343
|
-
if (data.position == 0) {
|
|
2344
|
-
data.position = resetValue;
|
|
2345
|
-
data.val = getNextValue(data.index++);
|
|
2346
|
-
}
|
|
2347
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
2348
|
-
power <<= 1;
|
|
2349
|
-
}
|
|
2350
|
-
dictionary[dictSize++] = f(bits);
|
|
2351
|
-
c = dictSize - 1;
|
|
2352
|
-
enlargeIn--;
|
|
2353
|
-
break;
|
|
2354
|
-
case 2: return result.join("");
|
|
2355
|
-
}
|
|
2356
|
-
if (enlargeIn == 0) {
|
|
2357
|
-
enlargeIn = Math.pow(2, numBits);
|
|
2358
|
-
numBits++;
|
|
2359
|
-
}
|
|
2360
|
-
if (dictionary[c]) entry = dictionary[c];
|
|
2361
|
-
else if (c === dictSize) entry = w + w.charAt(0);
|
|
2362
|
-
else return null;
|
|
2363
|
-
result.push(entry);
|
|
2364
|
-
dictionary[dictSize++] = w + entry.charAt(0);
|
|
2365
|
-
enlargeIn--;
|
|
2366
|
-
w = entry;
|
|
2367
|
-
if (enlargeIn == 0) {
|
|
2368
|
-
enlargeIn = Math.pow(2, numBits);
|
|
2369
|
-
numBits++;
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
}
|
|
2373
|
-
};
|
|
2374
|
-
return LZString;
|
|
2375
|
-
})();
|
|
2376
|
-
if (typeof define === "function" && define.amd) define(function() {
|
|
2377
|
-
return LZString;
|
|
2378
|
-
});
|
|
2379
|
-
else if (typeof module !== "undefined" && module != null) module.exports = LZString;
|
|
2380
|
-
else if (typeof angular !== "undefined" && angular != null) angular.module("LZString", []).factory("LZString", function() {
|
|
2381
|
-
return LZString;
|
|
2382
|
-
});
|
|
2383
|
-
})))(), 1);
|
|
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
|
-
};
|
|
2405
|
-
function getUserPermissions() {
|
|
2406
|
-
const user = window.ph?.renown?.user;
|
|
2407
|
-
const allowList = window.ph?.allowList;
|
|
2408
|
-
if (!allowList) return {
|
|
2409
|
-
isAllowedToCreateDocuments: true,
|
|
2410
|
-
isAllowedToEditDocuments: true
|
|
2411
|
-
};
|
|
2412
|
-
return {
|
|
2413
|
-
isAllowedToCreateDocuments: allowList.includes(user?.address ?? ""),
|
|
2414
|
-
isAllowedToEditDocuments: allowList.includes(user?.address ?? "")
|
|
2415
|
-
};
|
|
2416
|
-
}
|
|
2417
|
-
const BASE_STATE_KEYS = new Set(["auth"]);
|
|
2418
|
-
const NON_DOMAIN_SCOPES = new Set(["auth", "document"]);
|
|
2419
|
-
async function downloadFile(document, fileName) {
|
|
2420
|
-
try {
|
|
2421
|
-
const data = await createZip(document);
|
|
2422
|
-
const blob = new Blob([new Uint8Array(data)], { type: "application/zip" });
|
|
2423
|
-
const link = window.document.createElement("a");
|
|
2424
|
-
link.style.display = "none";
|
|
2425
|
-
link.href = URL.createObjectURL(blob);
|
|
2426
|
-
link.download = fileName;
|
|
2427
|
-
window.document.body.appendChild(link);
|
|
2428
|
-
link.click();
|
|
2429
|
-
window.document.body.removeChild(link);
|
|
2430
|
-
} catch (e) {
|
|
2431
|
-
logger.error(e instanceof Error ? e.message : String(e));
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
async function getDocumentExtension(document) {
|
|
2435
|
-
const documentType = document.header.documentType;
|
|
2436
|
-
let rawExtension;
|
|
2437
|
-
if (documentType === "powerhouse/document-model") rawExtension = document.state.global?.extension;
|
|
2438
|
-
else {
|
|
2439
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2440
|
-
if (reactorClient) {
|
|
2441
|
-
const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
|
|
2442
|
-
rawExtension = documentModelModules.find((m) => m.documentModel.global.id === documentType)?.utils.fileExtension;
|
|
2443
|
-
}
|
|
2444
|
-
}
|
|
2445
|
-
return (rawExtension ?? "").replace(/^\.+|\.+$/g, "");
|
|
2446
|
-
}
|
|
2447
|
-
/**
|
|
2448
|
-
* Fetches all operations for a document using cursor-based pagination.
|
|
2449
|
-
* The reactor client handles multi-scope cursors transparently via
|
|
2450
|
-
* composite cursors, so all scopes are fetched in a single paginated stream.
|
|
2451
|
-
*/
|
|
2452
|
-
async function fetchDocumentOperations(reactorClient, document, pageSize = 100) {
|
|
2453
|
-
const scopes = Object.keys(document.state).filter((k) => !BASE_STATE_KEYS.has(k));
|
|
2454
|
-
const operations = {};
|
|
2455
|
-
for (const scope of scopes) operations[scope] = [];
|
|
2456
|
-
let cursor = "";
|
|
2457
|
-
do {
|
|
2458
|
-
const page = await reactorClient.getOperations(document.header.id, { scopes }, void 0, {
|
|
2459
|
-
cursor,
|
|
2460
|
-
limit: pageSize
|
|
2461
|
-
});
|
|
2462
|
-
for (const op of page.results) {
|
|
2463
|
-
const scope = op.action.scope ?? "global";
|
|
2464
|
-
if (operations[scope]) operations[scope].push(op);
|
|
2465
|
-
}
|
|
2466
|
-
cursor = page.nextCursor ?? "";
|
|
2467
|
-
} while (cursor);
|
|
2468
|
-
return operations;
|
|
2469
|
-
}
|
|
2470
|
-
function extractInitialState(documentScopeOps) {
|
|
2471
|
-
const upgradeOp = documentScopeOps.find((op) => op.action.type === "UPGRADE_DOCUMENT");
|
|
2472
|
-
if (!upgradeOp) throw new Error("No UPGRADE_DOCUMENT operation found — document is invalid");
|
|
2473
|
-
const input = upgradeOp.action.input;
|
|
2474
|
-
const initialState = input.initialState ?? input.state;
|
|
2475
|
-
if (!initialState) throw new Error("UPGRADE_DOCUMENT operation has no initialState — document is invalid");
|
|
2476
|
-
return initialState;
|
|
2477
|
-
}
|
|
2478
|
-
function filterDomainOperations(operations) {
|
|
2479
|
-
return Object.fromEntries(Object.entries(operations).filter(([scope]) => !NON_DOMAIN_SCOPES.has(scope)));
|
|
2480
|
-
}
|
|
2481
|
-
async function exportFile(document, suggestedName) {
|
|
2482
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2483
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2484
|
-
const operations = await fetchDocumentOperations(reactorClient, document);
|
|
2485
|
-
const initialState = extractInitialState(operations["document"] ?? []);
|
|
2486
|
-
const documentWithOps = {
|
|
2487
|
-
...document,
|
|
2488
|
-
operations,
|
|
2489
|
-
initialState
|
|
2490
|
-
};
|
|
2491
|
-
const extension = await getDocumentExtension(documentWithOps);
|
|
2492
|
-
const baseName = suggestedName || documentWithOps.header.name || "Untitled";
|
|
2493
|
-
const name = extension ? `${baseName}.${extension}.phd` : `${baseName}.phd`;
|
|
2494
|
-
if (!window.showSaveFilePicker) return await downloadFile(documentWithOps, name);
|
|
2495
|
-
try {
|
|
2496
|
-
const fileHandle = await window.showSaveFilePicker({ suggestedName: name });
|
|
2497
|
-
await baseSaveToFileHandle(documentWithOps, fileHandle);
|
|
2498
|
-
return fileHandle;
|
|
2499
|
-
} catch (e) {
|
|
2500
|
-
if (!(e instanceof DOMException && e.name === "AbortError")) throw e;
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
/**
|
|
2504
|
-
* Loads a document file and replays it with version-aware reducers from the registry.
|
|
2505
|
-
* Falls back to single-version legacy replay when no upgrade manifest is registered for
|
|
2506
|
-
* the document type.
|
|
2507
|
-
*/
|
|
2508
|
-
async function loadFile(path) {
|
|
2509
|
-
const baseDocument = await baseLoadFromInput(path, (state) => state, { checkHashes: true });
|
|
2510
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2511
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2512
|
-
const documentType = baseDocument.header.documentType;
|
|
2513
|
-
const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
|
|
2514
|
-
const modulesForType = documentModelModules.filter((module) => module.documentModel.global.id === documentType);
|
|
2515
|
-
if (modulesForType.length === 0) throw new DocumentModelNotFoundError(documentType);
|
|
2516
|
-
const reducers = {};
|
|
2517
|
-
for (const module of modulesForType) reducers[module.version ?? 1] = module.reducer;
|
|
2518
|
-
const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
|
|
2519
|
-
let upgradeManifest;
|
|
2520
|
-
if (registry) try {
|
|
2521
|
-
upgradeManifest = registry.getUpgradeManifest(documentType);
|
|
2522
|
-
} catch {}
|
|
2523
|
-
return baseLoadFromInputVersioned(path, {
|
|
2524
|
-
reducers,
|
|
2525
|
-
upgradeManifest
|
|
2526
|
-
});
|
|
2527
|
-
}
|
|
2528
|
-
async function addDocument(driveId, name, documentType, parentFolder, document, id, preferredEditor) {
|
|
2529
|
-
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2530
|
-
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create documents");
|
|
2531
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2532
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2533
|
-
const documentModelModule = await reactorClient.getDocumentModelModule(documentType);
|
|
2534
|
-
const newDocument = document ?? documentModelModule.utils.createDocument();
|
|
2535
|
-
newDocument.header.name = name;
|
|
2536
|
-
if (preferredEditor) newDocument.header.meta = {
|
|
2537
|
-
...newDocument.header.meta,
|
|
2538
|
-
preferredEditor
|
|
2539
|
-
};
|
|
2540
|
-
let newDoc;
|
|
2541
|
-
try {
|
|
2542
|
-
newDoc = await reactorClient.drives.addFile(driveId, newDocument, parentFolder);
|
|
2543
|
-
} catch (e) {
|
|
2544
|
-
logger.error("Error adding document: @error", e);
|
|
2545
|
-
throw new Error("There was an error adding document", { cause: e });
|
|
2546
|
-
}
|
|
2547
|
-
return {
|
|
2548
|
-
id: newDoc.header.id,
|
|
2549
|
-
name: newDoc.header.name,
|
|
2550
|
-
documentType,
|
|
2551
|
-
parentFolder: parentFolder ?? null,
|
|
2552
|
-
kind: "file"
|
|
2553
|
-
};
|
|
2554
|
-
}
|
|
2555
|
-
async function addFile(file, driveId, name, parentFolder) {
|
|
2556
|
-
logger.verbose(`addFile(drive: ${driveId}, name: ${name}, folder: ${parentFolder})`);
|
|
2557
|
-
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2558
|
-
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
|
-
try {
|
|
2564
|
-
await reactorClient.get(document.header.id);
|
|
2565
|
-
duplicateId = true;
|
|
2566
|
-
} catch {}
|
|
2567
|
-
const documentId = duplicateId ? generateId() : document.header.id;
|
|
2568
|
-
const header = createPresignedHeader(documentId, document.header.documentType);
|
|
2569
|
-
header.lastModifiedAtUtcIso = document.header.createdAtUtcIso;
|
|
2570
|
-
header.meta = document.header.meta;
|
|
2571
|
-
header.name = name || document.header.name;
|
|
2572
|
-
const initialDocument = {
|
|
2573
|
-
...document,
|
|
2574
|
-
header,
|
|
2575
|
-
state: document.initialState,
|
|
2576
|
-
operations: Object.keys(document.operations).reduce((acc, key) => {
|
|
2577
|
-
acc[key] = [];
|
|
2578
|
-
return acc;
|
|
2579
|
-
}, {})
|
|
2580
|
-
};
|
|
2581
|
-
await addDocument(driveId, name || document.header.name, document.header.documentType, parentFolder, initialDocument, documentId, document.header.meta?.preferredEditor);
|
|
2582
|
-
await uploadOperations(documentId, filterDomainOperations(document.operations), queueOperations);
|
|
2583
|
-
}
|
|
2584
|
-
async function addFolder(driveId, name, parentFolder) {
|
|
2585
|
-
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2586
|
-
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create folders");
|
|
2587
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2588
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2589
|
-
await reactorClient.get(driveId);
|
|
2590
|
-
const folderId = generateId();
|
|
2591
|
-
const node = (await reactorClient.execute(driveId, "main", [addFolder$1({
|
|
2592
|
-
id: folderId,
|
|
2593
|
-
name,
|
|
2594
|
-
parentFolder
|
|
2595
|
-
})])).state.global.nodes.find((node) => node.id === folderId);
|
|
2596
|
-
if (!node || !isFolderNode(node)) throw new Error("There was an error adding folder");
|
|
2597
|
-
return node;
|
|
2598
|
-
}
|
|
2599
|
-
async function renameNode(driveId, nodeId, name) {
|
|
2600
|
-
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2601
|
-
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to rename documents");
|
|
2602
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2603
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2604
|
-
if ((await reactorClient.execute(nodeId, "main", [setName({ name })])).header.name !== name) throw new Error("There was an error renaming the node");
|
|
2605
|
-
const node = (await reactorClient.execute(driveId, "main", [updateNode({
|
|
2606
|
-
id: nodeId,
|
|
2607
|
-
name
|
|
2608
|
-
})])).state.global.nodes.find((n) => n.id === nodeId);
|
|
2609
|
-
if (!node) throw new Error("There was an error renaming node in the drive");
|
|
2610
|
-
return node;
|
|
2611
|
-
}
|
|
2612
|
-
async function renameDriveNode(driveId, nodeId, name) {
|
|
2613
|
-
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2614
|
-
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to rename documents");
|
|
2615
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2616
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2617
|
-
if ((await reactorClient.execute(nodeId, "main", [setName({ name })])).header.name !== name) throw new Error("There was an error renaming the node");
|
|
2618
|
-
await reactorClient.execute(driveId, "main", [updateNode({
|
|
2619
|
-
id: nodeId,
|
|
2620
|
-
name
|
|
2621
|
-
})]);
|
|
2622
|
-
return (await reactorClient.get(driveId)).state.global.nodes.find((n) => n.id === nodeId);
|
|
2623
|
-
}
|
|
2624
|
-
async function moveNodeById(args) {
|
|
2625
|
-
const { driveId, srcId, targetId } = args;
|
|
2626
|
-
if (!driveId || !srcId) return;
|
|
2627
|
-
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2628
|
-
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
|
|
2629
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2630
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2631
|
-
const targetParentFolder = t$3(targetId, [e$3(e$4), e$6(void 0)], [t(driveId), e$6(void 0)], e$6(targetId));
|
|
2632
|
-
if (t(targetParentFolder, srcId)) return;
|
|
2633
|
-
return await reactorClient.execute(driveId, "main", [moveNode({
|
|
2634
|
-
srcFolder: srcId,
|
|
2635
|
-
targetParentFolder
|
|
2636
|
-
})]);
|
|
2637
|
-
}
|
|
2638
|
-
async function moveNode$1(driveId, src, target) {
|
|
2639
|
-
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2640
|
-
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
|
|
2641
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2642
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2643
|
-
return await reactorClient.execute(driveId, "main", [moveNode({
|
|
2644
|
-
srcFolder: src.id,
|
|
2645
|
-
targetParentFolder: target?.id
|
|
2646
|
-
})]);
|
|
2647
|
-
}
|
|
2648
|
-
/**
|
|
2649
|
-
* Duplicates a document under a new id using version-aware replay.
|
|
2650
|
-
* Falls back gracefully when no upgrade manifest is registered for the document type.
|
|
2651
|
-
*/
|
|
2652
|
-
async function _duplicateDocument(reactor, document, newId = generateId()) {
|
|
2653
|
-
const documentType = document.header.documentType;
|
|
2654
|
-
const { results: allModules } = await reactor.getDocumentModelModules();
|
|
2655
|
-
const modulesForType = allModules.filter((m) => m.documentModel.global.id === documentType);
|
|
2656
|
-
const reducers = {};
|
|
2657
|
-
for (const m of modulesForType) reducers[m.version ?? 1] = m.reducer;
|
|
2658
|
-
if (Object.keys(reducers).length === 0) throw new Error(`Document model module not found for type: ${documentType}`);
|
|
2659
|
-
const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
|
|
2660
|
-
let upgradeManifest;
|
|
2661
|
-
if (registry) try {
|
|
2662
|
-
upgradeManifest = registry.getUpgradeManifest(documentType);
|
|
2663
|
-
} catch {}
|
|
2664
|
-
const config = {
|
|
2665
|
-
reducers,
|
|
2666
|
-
upgradeManifest
|
|
2667
|
-
};
|
|
2668
|
-
const header = createPresignedHeader(newId, documentType);
|
|
2669
|
-
return replayDocumentVersioned(document.initialState, document.operations, config, header);
|
|
2670
|
-
}
|
|
2671
|
-
async function copyNode$1(driveId, src, target) {
|
|
2672
|
-
const reactor = window.ph?.reactorClient;
|
|
2673
|
-
if (!reactor) return;
|
|
2674
|
-
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2675
|
-
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to copy documents");
|
|
2676
|
-
const drive = await reactor.get(driveId);
|
|
2677
|
-
const copyNodesInput = generateNodesCopy({
|
|
2678
|
-
srcId: src.id,
|
|
2679
|
-
targetParentFolder: target?.id,
|
|
2680
|
-
targetName: src.name
|
|
2681
|
-
}, () => generateId(), drive.state.global.nodes);
|
|
2682
|
-
const resolvedNamesMap = /* @__PURE__ */ new Map();
|
|
2683
|
-
for (const copyNodeInput of copyNodesInput) {
|
|
2684
|
-
const node = drive.state.global.nodes.find((n) => n.id === copyNodeInput.srcId);
|
|
2685
|
-
if (node) {
|
|
2686
|
-
const resolvedName = handleTargetNameCollisions({
|
|
2687
|
-
nodes: drive.state.global.nodes,
|
|
2688
|
-
srcName: copyNodeInput.targetName || node.name,
|
|
2689
|
-
srcKind: isFileNode(node) ? "file" : "folder",
|
|
2690
|
-
targetParentFolder: copyNodeInput.targetParentFolder || null
|
|
2691
|
-
});
|
|
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
|
|
2730
|
-
});
|
|
2731
|
-
}
|
|
2732
|
-
/** Document types that represent a "drive": a container of nodes. */
|
|
2733
|
-
const DRIVE_DOCUMENT_TYPES = ["powerhouse/document-drive", "powerhouse/reactor-drive"];
|
|
2734
|
-
const isExternalControlsEnabledEventFunctions = makePHEventFunctions("isExternalControlsEnabled");
|
|
2735
|
-
/** Sets whether external controls are enabled for a given editor. */
|
|
2736
|
-
const setIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.setValue;
|
|
2737
|
-
/** Gets whether external controls are enabled for a given editor. */
|
|
2738
|
-
const useIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.useValue;
|
|
2739
|
-
isExternalControlsEnabledEventFunctions.addEventHandler;
|
|
2740
|
-
const isDragAndDropEnabledEventFunctions = makePHEventFunctions("isDragAndDropEnabled");
|
|
2741
|
-
/** Sets whether drag and drop is enabled for a given app. */
|
|
2742
|
-
const setIsDragAndDropEnabled = isDragAndDropEnabledEventFunctions.setValue;
|
|
2743
|
-
/** Gets whether drag and drop is enabled for a given app. */
|
|
2744
|
-
const useIsDragAndDropEnabled = isDragAndDropEnabledEventFunctions.useValue;
|
|
2745
|
-
isDragAndDropEnabledEventFunctions.addEventHandler;
|
|
2746
|
-
const allowedDocumentTypesEventFunctions = makePHEventFunctions("allowedDocumentTypes");
|
|
2747
|
-
/** Sets the allowed document types for a given app. */
|
|
2748
|
-
const setAllowedDocumentTypes = allowedDocumentTypesEventFunctions.setValue;
|
|
2749
|
-
/** Defines the document types a drive supports.
|
|
2750
|
-
*
|
|
2751
|
-
* Defaults to all of the document types registered in the reactor.
|
|
2752
|
-
*/
|
|
2753
|
-
function useAllowedDocumentTypes() {
|
|
2754
|
-
return allowedDocumentTypesEventFunctions.useValue();
|
|
2755
|
-
}
|
|
2756
|
-
allowedDocumentTypesEventFunctions.addEventHandler;
|
|
2757
|
-
const phAppConfigSetters = {
|
|
2758
|
-
allowedDocumentTypes: setAllowedDocumentTypes,
|
|
2759
|
-
isDragAndDropEnabled: setIsDragAndDropEnabled
|
|
2760
|
-
};
|
|
2761
|
-
const phDocumentEditorConfigSetters = { isExternalControlsEnabled: setIsExternalControlsEnabled };
|
|
2762
|
-
const phAppConfigHooks = {
|
|
2763
|
-
allowedDocumentTypes: useAllowedDocumentTypes,
|
|
2764
|
-
isDragAndDropEnabled: useIsDragAndDropEnabled
|
|
2765
|
-
};
|
|
2766
|
-
const phDocumentEditorConfigHooks = { isExternalControlsEnabled: useIsExternalControlsEnabled };
|
|
2767
|
-
const { useValue: useRouterBasename, setValue: setRouterBasename, addEventHandler: addRouterBasenameEventHandler } = makePHEventFunctions("routerBasename");
|
|
2768
|
-
const { useValue: useVersion, setValue: setVersion, addEventHandler: addVersionEventHandler } = makePHEventFunctions("version");
|
|
2769
|
-
const { useValue: useRequiresHardRefresh, setValue: setRequiresHardRefresh, addEventHandler: addRequiresHardRefreshEventHandler } = makePHEventFunctions("requiresHardRefresh");
|
|
2770
|
-
const { useValue: useWarnOutdatedApp, setValue: setWarnOutdatedApp, addEventHandler: addWarnOutdatedAppEventHandler } = makePHEventFunctions("warnOutdatedApp");
|
|
2771
|
-
const { useValue: useStudioMode, setValue: setStudioMode, addEventHandler: addStudioModeEventHandler } = makePHEventFunctions("studioMode");
|
|
2772
|
-
const { useValue: useBasePath, setValue: setBasePath, addEventHandler: addBasePathEventHandler } = makePHEventFunctions("basePath");
|
|
2773
|
-
const { useValue: useVersionCheckInterval, setValue: setVersionCheckInterval, addEventHandler: addVersionCheckIntervalEventHandler } = makePHEventFunctions("versionCheckInterval");
|
|
2774
|
-
const { useValue: useCliVersion, setValue: setCliVersion, addEventHandler: addCliVersionEventHandler } = makePHEventFunctions("cliVersion");
|
|
2775
|
-
const { useValue: useFileUploadOperationsChunkSize, setValue: setFileUploadOperationsChunkSize, addEventHandler: addFileUploadOperationsChunkSizeEventHandler } = makePHEventFunctions("fileUploadOperationsChunkSize");
|
|
2776
|
-
const { useValue: useIsDocumentModelSelectionSettingsEnabled, setValue: setIsDocumentModelSelectionSettingsEnabled, addEventHandler: addIsDocumentModelSelectionSettingsEnabledEventHandler } = makePHEventFunctions("isDocumentModelSelectionSettingsEnabled");
|
|
2777
|
-
const { useValue: useGaTrackingId, setValue: setGaTrackingId, addEventHandler: addGaTrackingIdEventHandler } = makePHEventFunctions("gaTrackingId");
|
|
2778
|
-
const { useValue: useDefaultDrivesUrl, setValue: setDefaultDrivesUrl, addEventHandler: addDefaultDrivesUrlEventHandler } = makePHEventFunctions("defaultDrivesUrl");
|
|
2779
|
-
const { useValue: useDrivesPreserveStrategy, setValue: setDrivesPreserveStrategy, addEventHandler: addDrivesPreserveStrategyEventHandler } = makePHEventFunctions("drivesPreserveStrategy");
|
|
2780
|
-
const { useValue: useIsLocalDrivesEnabled, setValue: setIsLocalDrivesEnabled, addEventHandler: addIsLocalDrivesEnabledEventHandler } = makePHEventFunctions("isLocalDrivesEnabled");
|
|
2781
|
-
const { useValue: useIsAddDriveEnabled, setValue: setIsAddDriveEnabled, addEventHandler: addIsAddDriveEnabledEventHandler } = makePHEventFunctions("isAddDriveEnabled");
|
|
2782
|
-
const { useValue: useIsPublicDrivesEnabled, setValue: setIsPublicDrivesEnabled, addEventHandler: addIsPublicDrivesEnabledEventHandler } = makePHEventFunctions("isPublicDrivesEnabled");
|
|
2783
|
-
const { useValue: useIsAddPublicDrivesEnabled, setValue: setIsAddPublicDrivesEnabled, addEventHandler: addIsAddPublicDrivesEnabledEventHandler } = makePHEventFunctions("isAddPublicDrivesEnabled");
|
|
2784
|
-
const { useValue: useIsDeletePublicDrivesEnabled, setValue: setIsDeletePublicDrivesEnabled, addEventHandler: addIsDeletePublicDrivesEnabledEventHandler } = makePHEventFunctions("isDeletePublicDrivesEnabled");
|
|
2785
|
-
const { useValue: useIsCloudDrivesEnabled, setValue: setIsCloudDrivesEnabled, addEventHandler: addIsCloudDrivesEnabledEventHandler } = makePHEventFunctions("isCloudDrivesEnabled");
|
|
2786
|
-
const { useValue: useIsAddCloudDrivesEnabled, setValue: setIsAddCloudDrivesEnabled, addEventHandler: addIsAddCloudDrivesEnabledEventHandler } = makePHEventFunctions("isAddCloudDrivesEnabled");
|
|
2787
|
-
const { useValue: useIsDeleteCloudDrivesEnabled, setValue: setIsDeleteCloudDrivesEnabled, addEventHandler: addIsDeleteCloudDrivesEnabledEventHandler } = makePHEventFunctions("isDeleteCloudDrivesEnabled");
|
|
2788
|
-
const { useValue: useLocalDrivesEnabled, setValue: setLocalDrivesEnabled, addEventHandler: addLocalDrivesEnabledEventHandler } = makePHEventFunctions("isLocalDrivesEnabled");
|
|
2789
|
-
const { useValue: useIsAddLocalDrivesEnabled, setValue: setIsAddLocalDrivesEnabled, addEventHandler: addIsAddLocalDrivesEnabledEventHandler } = makePHEventFunctions("isAddLocalDrivesEnabled");
|
|
2790
|
-
const { useValue: useIsDeleteLocalDrivesEnabled, setValue: setIsDeleteLocalDrivesEnabled, addEventHandler: addIsDeleteLocalDrivesEnabledEventHandler } = makePHEventFunctions("isDeleteLocalDrivesEnabled");
|
|
2791
|
-
const { useValue: useIsEditorDebugModeEnabled, setValue: setIsEditorDebugModeEnabled, addEventHandler: addIsEditorDebugModeEnabledEventHandler } = makePHEventFunctions("isEditorDebugModeEnabled");
|
|
2792
|
-
const { useValue: useIsEditorReadModeEnabled, setValue: setIsEditorReadModeEnabled, addEventHandler: addIsEditorReadModeEnabledEventHandler } = makePHEventFunctions("isEditorReadModeEnabled");
|
|
2793
|
-
const { useValue: useIsAnalyticsDatabaseWorkerEnabled, setValue: setIsAnalyticsDatabaseWorkerEnabled, addEventHandler: addIsAnalyticsDatabaseWorkerEnabledEventHandler } = makePHEventFunctions("isAnalyticsDatabaseWorkerEnabled");
|
|
2794
|
-
const { useValue: useIsDiffAnalyticsEnabled, setValue: setIsDiffAnalyticsEnabled, addEventHandler: addIsDiffAnalyticsEnabledEventHandler } = makePHEventFunctions("isDiffAnalyticsEnabled");
|
|
2795
|
-
const { useValue: useIsDriveAnalyticsEnabled, setValue: setIsDriveAnalyticsEnabled, addEventHandler: addIsDriveAnalyticsEnabledEventHandler } = makePHEventFunctions("isDriveAnalyticsEnabled");
|
|
2796
|
-
const { useValue: useRenownUrl, setValue: setRenownUrl, addEventHandler: addRenownUrlEventHandler } = makePHEventFunctions("renownUrl");
|
|
2797
|
-
const { useValue: useRenownNetworkId, setValue: setRenownNetworkId, addEventHandler: addRenownNetworkIdEventHandler } = makePHEventFunctions("renownNetworkId");
|
|
2798
|
-
const { useValue: useRenownChainId, setValue: setRenownChainId, addEventHandler: addRenownChainIdEventHandler } = makePHEventFunctions("renownChainId");
|
|
2799
|
-
const { useValue: useSentryRelease, setValue: setSentryRelease, addEventHandler: addSentryReleaseEventHandler } = makePHEventFunctions("sentryRelease");
|
|
2800
|
-
const { useValue: useSentryDsn, setValue: setSentryDsn, addEventHandler: addSentryDsnEventHandler } = makePHEventFunctions("sentryDsn");
|
|
2801
|
-
const { useValue: useSentryEnv, setValue: setSentryEnv, addEventHandler: addSentryEnvEventHandler } = makePHEventFunctions("sentryEnv");
|
|
2802
|
-
const { useValue: useIsSentryTracingEnabled, setValue: setIsSentryTracingEnabled, addEventHandler: addIsSentryTracingEnabledEventHandler } = makePHEventFunctions("isSentryTracingEnabled");
|
|
2803
|
-
const { useValue: useIsExternalProcessorsEnabled, setValue: setIsExternalProcessorsEnabled, addEventHandler: addIsExternalProcessorsEnabledEventHandler } = makePHEventFunctions("isExternalProcessorsEnabled");
|
|
2804
|
-
const { useValue: useIsExternalPackagesEnabled, setValue: setIsExternalPackagesEnabled, addEventHandler: addIsExternalPackagesEnabledEventHandler } = makePHEventFunctions("isExternalPackagesEnabled");
|
|
2805
|
-
const enabledEditorsEventFunctions = makePHEventFunctions("enabledEditors");
|
|
2806
|
-
/** Sets the enabled editors for Connect. */
|
|
2807
|
-
const setEnabledEditors = enabledEditorsEventFunctions.setValue;
|
|
2808
|
-
/** Gets the enabled editors for Connect. */
|
|
2809
|
-
const useEnabledEditors = enabledEditorsEventFunctions.useValue;
|
|
2810
|
-
enabledEditorsEventFunctions.addEventHandler;
|
|
2811
|
-
const disabledEditorsEventFunctions = makePHEventFunctions("disabledEditors");
|
|
2812
|
-
/** Sets the disabled editors for Connect. */
|
|
2813
|
-
const setDisabledEditors = disabledEditorsEventFunctions.setValue;
|
|
2814
|
-
/** Gets the disabled editors for Connect. */
|
|
2815
|
-
const useDisabledEditors = disabledEditorsEventFunctions.useValue;
|
|
2816
|
-
disabledEditorsEventFunctions.addEventHandler;
|
|
2817
|
-
const isRelationalProcessorsEnabled = makePHEventFunctions("isRelationalProcessorsEnabled");
|
|
2818
|
-
/** Sets the isRelationalProcessorsEnabled for Connect. */
|
|
2819
|
-
const setIsRelationalProcessorsEnabled = isRelationalProcessorsEnabled.setValue;
|
|
2820
|
-
/** Gets the isRelationalProcessorsEnabled for Connect. */
|
|
2821
|
-
const useIsRelationalProcessorsEnabled = isRelationalProcessorsEnabled.useValue;
|
|
2822
|
-
isRelationalProcessorsEnabled.addEventHandler;
|
|
2823
|
-
const isExternalRelationalProcessorsEnabled = makePHEventFunctions("isExternalRelationalProcessorsEnabled");
|
|
2824
|
-
/** Sets the isExternalRelationalProcessorsEnabled for Connect. */
|
|
2825
|
-
const setIsExternalRelationalProcessorsEnabled = isExternalRelationalProcessorsEnabled.setValue;
|
|
2826
|
-
/** Gets the isExternalRelationalProcessorsEnabled for Connect. */
|
|
2827
|
-
const useIsExternalRelationalProcessorsEnabled = isExternalRelationalProcessorsEnabled.useValue;
|
|
2828
|
-
isExternalRelationalProcessorsEnabled.addEventHandler;
|
|
2829
|
-
const isAnalyticsEnabledEventFunctions = makePHEventFunctions("isAnalyticsEnabled");
|
|
2830
|
-
/** Sets the isAnalyticsEnabled for Connect. */
|
|
2831
|
-
const setIsAnalyticsEnabled = isAnalyticsEnabledEventFunctions.setValue;
|
|
2832
|
-
/** Gets the isAnalyticsEnabled for Connect. */
|
|
2833
|
-
const useIsAnalyticsEnabled = isAnalyticsEnabledEventFunctions.useValue;
|
|
2834
|
-
isAnalyticsEnabledEventFunctions.addEventHandler;
|
|
2835
|
-
const isAnalyticsExternalProcessorsEnabled = makePHEventFunctions("isAnalyticsExternalProcessorsEnabled");
|
|
2836
|
-
/** Sets the isAnalyticsExternalProcessorsEnabled for Connect. */
|
|
2837
|
-
const setIsAnalyticsExternalProcessorsEnabled = isAnalyticsExternalProcessorsEnabled.setValue;
|
|
2838
|
-
/** Gets the isAnalyticsExternalProcessorsEnabled for Connect. */
|
|
2839
|
-
const useIsAnalyticsExternalProcessorsEnabled = isAnalyticsExternalProcessorsEnabled.useValue;
|
|
2840
|
-
isAnalyticsExternalProcessorsEnabled.addEventHandler;
|
|
2841
|
-
const analyticsDatabaseNameEventFunctions = makePHEventFunctions("analyticsDatabaseName");
|
|
2842
|
-
/** Sets the analytics database name for Connect. */
|
|
2843
|
-
const setAnalyticsDatabaseName = analyticsDatabaseNameEventFunctions.setValue;
|
|
2844
|
-
/** Gets the analytics database name for Connect. */
|
|
2845
|
-
const useAnalyticsDatabaseName = analyticsDatabaseNameEventFunctions.useValue;
|
|
2846
|
-
analyticsDatabaseNameEventFunctions.addEventHandler;
|
|
2847
|
-
const logLevelEventFunctions = makePHEventFunctions("logLevel");
|
|
2848
|
-
/** Sets the log level for Connect. */
|
|
2849
|
-
const setLogLevel = logLevelEventFunctions.setValue;
|
|
2850
|
-
/** Gets the log level for Connect. */
|
|
2851
|
-
const useLogLevel = logLevelEventFunctions.useValue;
|
|
2852
|
-
logLevelEventFunctions.addEventHandler;
|
|
2853
|
-
const allowListEventFunctions = makePHEventFunctions("allowList");
|
|
2854
|
-
/** Sets the allow list for Connect. */
|
|
2855
|
-
const setAllowList = allowListEventFunctions.setValue;
|
|
2856
|
-
/** Gets the allow list for Connect. */
|
|
2857
|
-
const useAllowList = allowListEventFunctions.useValue;
|
|
2858
|
-
allowListEventFunctions.addEventHandler;
|
|
2859
|
-
const nonUserConfigSetters = {
|
|
2860
|
-
routerBasename: setRouterBasename,
|
|
2861
|
-
version: setVersion,
|
|
2862
|
-
requiresHardRefresh: setRequiresHardRefresh,
|
|
2863
|
-
warnOutdatedApp: setWarnOutdatedApp,
|
|
2864
|
-
studioMode: setStudioMode,
|
|
2865
|
-
basePath: setBasePath,
|
|
2866
|
-
versionCheckInterval: setVersionCheckInterval,
|
|
2867
|
-
cliVersion: setCliVersion,
|
|
2868
|
-
fileUploadOperationsChunkSize: setFileUploadOperationsChunkSize,
|
|
2869
|
-
isDocumentModelSelectionSettingsEnabled: setIsDocumentModelSelectionSettingsEnabled,
|
|
2870
|
-
gaTrackingId: setGaTrackingId,
|
|
2871
|
-
defaultDrivesUrl: setDefaultDrivesUrl,
|
|
2872
|
-
drivesPreserveStrategy: setDrivesPreserveStrategy,
|
|
2873
|
-
isLocalDrivesEnabled: setIsLocalDrivesEnabled,
|
|
2874
|
-
isAddDriveEnabled: setIsAddDriveEnabled,
|
|
2875
|
-
isPublicDrivesEnabled: setIsPublicDrivesEnabled,
|
|
2876
|
-
isAddPublicDrivesEnabled: setIsAddPublicDrivesEnabled,
|
|
2877
|
-
isDeletePublicDrivesEnabled: setIsDeletePublicDrivesEnabled,
|
|
2878
|
-
isCloudDrivesEnabled: setIsCloudDrivesEnabled,
|
|
2879
|
-
isAddCloudDrivesEnabled: setIsAddCloudDrivesEnabled,
|
|
2880
|
-
isDeleteCloudDrivesEnabled: setIsDeleteCloudDrivesEnabled,
|
|
2881
|
-
isAddLocalDrivesEnabled: setIsAddLocalDrivesEnabled,
|
|
2882
|
-
isDeleteLocalDrivesEnabled: setIsDeleteLocalDrivesEnabled,
|
|
2883
|
-
isEditorDebugModeEnabled: setIsEditorDebugModeEnabled,
|
|
2884
|
-
isEditorReadModeEnabled: setIsEditorReadModeEnabled,
|
|
2885
|
-
isRelationalProcessorsEnabled: setIsRelationalProcessorsEnabled,
|
|
2886
|
-
isExternalRelationalProcessorsEnabled: setIsExternalRelationalProcessorsEnabled,
|
|
2887
|
-
isAnalyticsEnabled: setIsAnalyticsEnabled,
|
|
2888
|
-
analyticsDatabaseName: setAnalyticsDatabaseName,
|
|
2889
|
-
isAnalyticsExternalProcessorsEnabled: setIsAnalyticsExternalProcessorsEnabled,
|
|
2890
|
-
isAnalyticsDatabaseWorkerEnabled: setIsAnalyticsDatabaseWorkerEnabled,
|
|
2891
|
-
isDiffAnalyticsEnabled: setIsDiffAnalyticsEnabled,
|
|
2892
|
-
isDriveAnalyticsEnabled: setIsDriveAnalyticsEnabled,
|
|
2893
|
-
renownUrl: setRenownUrl,
|
|
2894
|
-
renownNetworkId: setRenownNetworkId,
|
|
2895
|
-
renownChainId: setRenownChainId,
|
|
2896
|
-
sentryRelease: setSentryRelease,
|
|
2897
|
-
sentryDsn: setSentryDsn,
|
|
2898
|
-
sentryEnv: setSentryEnv,
|
|
2899
|
-
isSentryTracingEnabled: setIsSentryTracingEnabled,
|
|
2900
|
-
isExternalProcessorsEnabled: setIsExternalProcessorsEnabled,
|
|
2901
|
-
isExternalPackagesEnabled: setIsExternalPackagesEnabled,
|
|
2902
|
-
allowList: setAllowList,
|
|
2903
|
-
logLevel: setLogLevel,
|
|
2904
|
-
disabledEditors: setDisabledEditors,
|
|
2905
|
-
enabledEditors: setEnabledEditors
|
|
2906
|
-
};
|
|
2907
|
-
const phGlobalConfigSetters = {
|
|
2908
|
-
...phAppConfigSetters,
|
|
2909
|
-
...phDocumentEditorConfigSetters,
|
|
2910
|
-
...nonUserConfigSetters
|
|
2911
|
-
};
|
|
2912
|
-
const nonUserConfigHooks = {
|
|
2913
|
-
routerBasename: useRouterBasename,
|
|
2914
|
-
version: useVersion,
|
|
2915
|
-
requiresHardRefresh: useRequiresHardRefresh,
|
|
2916
|
-
warnOutdatedApp: useWarnOutdatedApp,
|
|
2917
|
-
studioMode: useStudioMode,
|
|
2918
|
-
basePath: useBasePath,
|
|
2919
|
-
versionCheckInterval: useVersionCheckInterval,
|
|
2920
|
-
cliVersion: useCliVersion,
|
|
2921
|
-
fileUploadOperationsChunkSize: useFileUploadOperationsChunkSize,
|
|
2922
|
-
isDocumentModelSelectionSettingsEnabled: useIsDocumentModelSelectionSettingsEnabled,
|
|
2923
|
-
gaTrackingId: useGaTrackingId,
|
|
2924
|
-
defaultDrivesUrl: useDefaultDrivesUrl,
|
|
2925
|
-
drivesPreserveStrategy: useDrivesPreserveStrategy,
|
|
2926
|
-
isAddDriveEnabled: useIsAddDriveEnabled,
|
|
2927
|
-
isPublicDrivesEnabled: useIsPublicDrivesEnabled,
|
|
2928
|
-
isAddPublicDrivesEnabled: useIsAddPublicDrivesEnabled,
|
|
2929
|
-
isDeletePublicDrivesEnabled: useIsDeletePublicDrivesEnabled,
|
|
2930
|
-
isCloudDrivesEnabled: useIsCloudDrivesEnabled,
|
|
2931
|
-
isAddCloudDrivesEnabled: useIsAddCloudDrivesEnabled,
|
|
2932
|
-
isDeleteCloudDrivesEnabled: useIsDeleteCloudDrivesEnabled,
|
|
2933
|
-
isLocalDrivesEnabled: useIsLocalDrivesEnabled,
|
|
2934
|
-
isAddLocalDrivesEnabled: useIsAddLocalDrivesEnabled,
|
|
2935
|
-
isDeleteLocalDrivesEnabled: useIsDeleteLocalDrivesEnabled,
|
|
2936
|
-
isEditorDebugModeEnabled: useIsEditorDebugModeEnabled,
|
|
2937
|
-
isEditorReadModeEnabled: useIsEditorReadModeEnabled,
|
|
2938
|
-
isAnalyticsDatabaseWorkerEnabled: useIsAnalyticsDatabaseWorkerEnabled,
|
|
2939
|
-
isDiffAnalyticsEnabled: useIsDiffAnalyticsEnabled,
|
|
2940
|
-
isDriveAnalyticsEnabled: useIsDriveAnalyticsEnabled,
|
|
2941
|
-
renownUrl: useRenownUrl,
|
|
2942
|
-
renownNetworkId: useRenownNetworkId,
|
|
2943
|
-
renownChainId: useRenownChainId,
|
|
2944
|
-
sentryRelease: useSentryRelease,
|
|
2945
|
-
sentryDsn: useSentryDsn,
|
|
2946
|
-
sentryEnv: useSentryEnv,
|
|
2947
|
-
isSentryTracingEnabled: useIsSentryTracingEnabled,
|
|
2948
|
-
isExternalProcessorsEnabled: useIsExternalProcessorsEnabled,
|
|
2949
|
-
isExternalPackagesEnabled: useIsExternalPackagesEnabled,
|
|
2950
|
-
allowList: useAllowList,
|
|
2951
|
-
isAnalyticsEnabled: useIsAnalyticsEnabled,
|
|
2952
|
-
isAnalyticsExternalProcessorsEnabled: useIsAnalyticsExternalProcessorsEnabled,
|
|
2953
|
-
isRelationalProcessorsEnabled: useIsRelationalProcessorsEnabled,
|
|
2954
|
-
isExternalRelationalProcessorsEnabled: useIsExternalRelationalProcessorsEnabled,
|
|
2955
|
-
analyticsDatabaseName: useAnalyticsDatabaseName,
|
|
2956
|
-
logLevel: useLogLevel,
|
|
2957
|
-
disabledEditors: useDisabledEditors,
|
|
2958
|
-
enabledEditors: useEnabledEditors
|
|
2959
|
-
};
|
|
2960
|
-
({
|
|
2961
|
-
...phAppConfigHooks,
|
|
2962
|
-
...phDocumentEditorConfigHooks,
|
|
2963
|
-
...nonUserConfigHooks
|
|
2516
|
+
});
|
|
2517
|
+
}
|
|
2518
|
+
let pendingHandler;
|
|
2519
|
+
let pendingTimeout;
|
|
2520
|
+
function cancelPendingDriveSelection() {
|
|
2521
|
+
if (pendingHandler) {
|
|
2522
|
+
window.removeEventListener("ph:drivesUpdated", pendingHandler);
|
|
2523
|
+
pendingHandler = void 0;
|
|
2524
|
+
}
|
|
2525
|
+
if (pendingTimeout) {
|
|
2526
|
+
clearTimeout(pendingTimeout);
|
|
2527
|
+
pendingTimeout = void 0;
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
function deferDriveSelection(driveSlug) {
|
|
2531
|
+
cancelPendingDriveSelection();
|
|
2532
|
+
const nodeSlug = extractNodeSlugFromPath(window.location.pathname);
|
|
2533
|
+
const handler = () => {
|
|
2534
|
+
if (!window.ph?.drives?.find((d) => d.header.slug === driveSlug)) return;
|
|
2535
|
+
cancelPendingDriveSelection();
|
|
2536
|
+
setSelectedDrive(driveSlug);
|
|
2537
|
+
setSelectedNode(nodeSlug);
|
|
2538
|
+
};
|
|
2539
|
+
pendingHandler = handler;
|
|
2540
|
+
window.addEventListener("ph:drivesUpdated", handler);
|
|
2541
|
+
const deadline = Date.now() + DEFERRED_DRIVE_MAX_WAIT_MS;
|
|
2542
|
+
const scheduleTick = () => {
|
|
2543
|
+
pendingTimeout = setTimeout(() => {
|
|
2544
|
+
if (Date.now() < deadline && isInitialSyncInFlight()) {
|
|
2545
|
+
scheduleTick();
|
|
2546
|
+
return;
|
|
2547
|
+
}
|
|
2548
|
+
cancelPendingDriveSelection();
|
|
2549
|
+
const pathname = resolveUrlPathname("/");
|
|
2550
|
+
if (pathname === window.location.pathname) return;
|
|
2551
|
+
window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
|
|
2552
|
+
}, DEFERRED_DRIVE_TICK_MS);
|
|
2553
|
+
};
|
|
2554
|
+
scheduleTick();
|
|
2555
|
+
}
|
|
2556
|
+
function useDropTarget() {
|
|
2557
|
+
const [isDropTarget, setIsDropTarget] = useState(false);
|
|
2558
|
+
const isDragAndDropEnabled = useIsDragAndDropEnabled();
|
|
2559
|
+
const targetSetter = n$1(() => setIsDropTarget(true), {
|
|
2560
|
+
triggerAt: "start",
|
|
2561
|
+
minQuietPeriodMs: 100
|
|
2562
|
+
});
|
|
2563
|
+
const targetUnsetter = n$1(() => setIsDropTarget(false), {
|
|
2564
|
+
triggerAt: "start",
|
|
2565
|
+
minQuietPeriodMs: 100
|
|
2566
|
+
});
|
|
2567
|
+
function setTarget() {
|
|
2568
|
+
if (!isDragAndDropEnabled) return;
|
|
2569
|
+
targetUnsetter.cancel();
|
|
2570
|
+
targetSetter.call();
|
|
2571
|
+
}
|
|
2572
|
+
function unsetTarget() {
|
|
2573
|
+
if (!isDragAndDropEnabled) return;
|
|
2574
|
+
targetSetter.cancel();
|
|
2575
|
+
targetUnsetter.call();
|
|
2576
|
+
}
|
|
2577
|
+
return {
|
|
2578
|
+
isDropTarget,
|
|
2579
|
+
setTarget,
|
|
2580
|
+
unsetTarget
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
const draggingNodeEventFunctions = makePHEventFunctions("draggingNode");
|
|
2584
|
+
const useDraggingNode = draggingNodeEventFunctions.useValue;
|
|
2585
|
+
const setDraggingNode = draggingNodeEventFunctions.setValue;
|
|
2586
|
+
draggingNodeEventFunctions.addEventHandler;
|
|
2587
|
+
const draggingNodeSetter = n$1((node) => setDraggingNode(node), {
|
|
2588
|
+
reducer: (_, newNode) => newNode,
|
|
2589
|
+
triggerAt: "start",
|
|
2590
|
+
minQuietPeriodMs: 100
|
|
2964
2591
|
});
|
|
2965
|
-
const
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
featuresEventFunctions.addEventHandler;
|
|
2973
|
-
function resolveUrlPathname(path) {
|
|
2974
|
-
return new URL(path.replace(/^\/+/, ""), window.location.origin + (window.ph?.basePath ?? "/")).pathname;
|
|
2592
|
+
const draggingNodeUnsetter = n$1(() => setDraggingNode(void 0), {
|
|
2593
|
+
triggerAt: "start",
|
|
2594
|
+
minQuietPeriodMs: 100
|
|
2595
|
+
});
|
|
2596
|
+
function setDragging(node) {
|
|
2597
|
+
draggingNodeUnsetter.cancel();
|
|
2598
|
+
draggingNodeSetter.call(node);
|
|
2975
2599
|
}
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
return path.replace(basePath, basePath.endsWith("/") ? "/" : "");
|
|
2600
|
+
function unsetDragging() {
|
|
2601
|
+
draggingNodeSetter.cancel();
|
|
2602
|
+
draggingNodeUnsetter.call();
|
|
2980
2603
|
}
|
|
2981
|
-
|
|
2982
|
-
function
|
|
2983
|
-
|
|
2984
|
-
const
|
|
2985
|
-
|
|
2986
|
-
|
|
2604
|
+
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));
|
|
2605
|
+
function useDragNode(args) {
|
|
2606
|
+
const { srcId, parentId } = args;
|
|
2607
|
+
const driveId = useSelectedDriveId();
|
|
2608
|
+
const draggingNodeId = useDraggingNode()?.srcId;
|
|
2609
|
+
const params = {
|
|
2610
|
+
driveId,
|
|
2611
|
+
srcId,
|
|
2612
|
+
parentId
|
|
2613
|
+
};
|
|
2614
|
+
const draggable = isNodeDrag(params);
|
|
2615
|
+
const isDragging = t$4({
|
|
2616
|
+
srcId,
|
|
2617
|
+
draggingNodeId
|
|
2618
|
+
}, [
|
|
2619
|
+
() => draggable,
|
|
2620
|
+
({ srcId }) => e$2(srcId),
|
|
2621
|
+
({ draggingNodeId }) => e$2(draggingNodeId),
|
|
2622
|
+
({ srcId, draggingNodeId }) => t(srcId, draggingNodeId)
|
|
2623
|
+
]);
|
|
2624
|
+
const onDragStart = () => {
|
|
2625
|
+
if (!draggable) return;
|
|
2626
|
+
setDragging(params);
|
|
2627
|
+
};
|
|
2628
|
+
const onDragEnd = () => {
|
|
2629
|
+
if (!draggable) return;
|
|
2630
|
+
unsetDragging();
|
|
2631
|
+
};
|
|
2632
|
+
return {
|
|
2633
|
+
isDragging,
|
|
2634
|
+
draggable,
|
|
2635
|
+
onDragStart,
|
|
2636
|
+
onDragEnd
|
|
2637
|
+
};
|
|
2987
2638
|
}
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
const
|
|
2994
|
-
|
|
2639
|
+
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));
|
|
2640
|
+
function useDropNode(targetId) {
|
|
2641
|
+
const driveId = useSelectedDriveId();
|
|
2642
|
+
const { srcId, parentId } = useDraggingNode() ?? {};
|
|
2643
|
+
const { isDropTarget, setTarget, unsetTarget } = useDropTarget();
|
|
2644
|
+
const params = {
|
|
2645
|
+
driveId,
|
|
2646
|
+
parentId,
|
|
2647
|
+
targetId,
|
|
2648
|
+
srcId
|
|
2649
|
+
};
|
|
2650
|
+
function handleNodeDrop(event, cb) {
|
|
2651
|
+
if (!isNodeDrop(params)) return;
|
|
2652
|
+
event.preventDefault();
|
|
2653
|
+
event.stopPropagation();
|
|
2654
|
+
cb?.();
|
|
2655
|
+
}
|
|
2656
|
+
const onDragEnter = (event) => handleNodeDrop(event);
|
|
2657
|
+
const onDragOver = (event) => handleNodeDrop(event, e(setTarget));
|
|
2658
|
+
const onDragLeave = (event) => handleNodeDrop(event, e(unsetTarget));
|
|
2659
|
+
const onDrop = (event) => handleNodeDrop(event, e(() => {
|
|
2660
|
+
unsetDragging();
|
|
2661
|
+
unsetTarget();
|
|
2662
|
+
moveNodeById(params).catch(console.error);
|
|
2663
|
+
}));
|
|
2664
|
+
return {
|
|
2665
|
+
isDropTarget,
|
|
2666
|
+
onDragEnter,
|
|
2667
|
+
onDragOver,
|
|
2668
|
+
onDragLeave,
|
|
2669
|
+
onDrop
|
|
2670
|
+
};
|
|
2995
2671
|
}
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
2672
|
+
const graphQLReactorClientEventFunctions = makePHEventFunctions("reactorGraphQLClient");
|
|
2673
|
+
graphQLReactorClientEventFunctions.useValue;
|
|
2674
|
+
graphQLReactorClientEventFunctions.setValue;
|
|
2675
|
+
graphQLReactorClientEventFunctions.addEventHandler;
|
|
2676
|
+
const packageDiscoveryFunctions = makePHEventFunctions("packageDiscoveryService");
|
|
2677
|
+
packageDiscoveryFunctions.useValue;
|
|
2678
|
+
packageDiscoveryFunctions.setValue;
|
|
2679
|
+
packageDiscoveryFunctions.addEventHandler;
|
|
2680
|
+
const reactorClientModuleEventFunctions = makePHEventFunctions("reactorClientModule");
|
|
2681
|
+
const reactorClientEventFunctions = makePHEventFunctions("reactorClient");
|
|
2682
|
+
/** Returns the reactor client module (in-process or worker-backed) */
|
|
2683
|
+
const useReactorClientModule = reactorClientModuleEventFunctions.useValue;
|
|
2684
|
+
reactorClientModuleEventFunctions.setValue;
|
|
2685
|
+
reactorClientModuleEventFunctions.addEventHandler;
|
|
2686
|
+
reactorClientEventFunctions.useValue;
|
|
2687
|
+
reactorClientEventFunctions.setValue;
|
|
2688
|
+
reactorClientEventFunctions.addEventHandler;
|
|
2689
|
+
const useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager;
|
|
2690
|
+
const useSyncList = () => {
|
|
2691
|
+
return useSync()?.list() ?? [];
|
|
2692
|
+
};
|
|
2693
|
+
const revisionHistoryEventFunctions = makePHEventFunctions("revisionHistoryVisible");
|
|
2694
|
+
revisionHistoryEventFunctions.useValue;
|
|
2695
|
+
/** Sets revision history visibility */
|
|
2696
|
+
const setRevisionHistoryVisible = revisionHistoryEventFunctions.setValue;
|
|
2697
|
+
revisionHistoryEventFunctions.addEventHandler;
|
|
2698
|
+
/** Shows the revision history */
|
|
2699
|
+
function showRevisionHistory() {
|
|
2700
|
+
setRevisionHistoryVisible(true);
|
|
3000
2701
|
}
|
|
3001
|
-
|
|
3002
|
-
|
|
2702
|
+
/** Sorts nodes by name. */
|
|
2703
|
+
function sortNodesByName(nodes) {
|
|
2704
|
+
return nodes.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
2705
|
+
}
|
|
2706
|
+
/** Returns whether a node is a file. */
|
|
2707
|
+
function isFileNodeKind(node) {
|
|
2708
|
+
if (!node) return false;
|
|
2709
|
+
return node.kind.toUpperCase() === "FILE";
|
|
2710
|
+
}
|
|
2711
|
+
/** Returns whether a node is a folder. */
|
|
2712
|
+
function isFolderNodeKind(node) {
|
|
2713
|
+
if (!node) return false;
|
|
2714
|
+
return node.kind.toUpperCase() === "FOLDER";
|
|
2715
|
+
}
|
|
2716
|
+
/** Returns the nodes in the selected drive. */
|
|
2717
|
+
function useNodesInSelectedDrive() {
|
|
2718
|
+
const [selectedDrive] = useSelectedDriveSafe();
|
|
2719
|
+
return selectedDrive?.state.global.nodes;
|
|
2720
|
+
}
|
|
2721
|
+
/** Returns the folder nodes in the selected drive. */
|
|
2722
|
+
function useFolderNodesInSelectedDrive() {
|
|
2723
|
+
return useNodesInSelectedDrive()?.filter((n) => isFolderNodeKind(n));
|
|
2724
|
+
}
|
|
2725
|
+
/** Returns the selected node. */
|
|
2726
|
+
function useSelectedNode() {
|
|
2727
|
+
const selectedNodeId = useSelectedNodeId();
|
|
2728
|
+
return useNodesInSelectedDrive()?.find((n) => n.id === selectedNodeId);
|
|
3003
2729
|
}
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
2730
|
+
const selectedTimelineItemEventFunctions = makePHEventFunctions("selectedTimelineItem");
|
|
2731
|
+
selectedTimelineItemEventFunctions.useValue;
|
|
2732
|
+
selectedTimelineItemEventFunctions.setValue;
|
|
2733
|
+
selectedTimelineItemEventFunctions.addEventHandler;
|
|
2734
|
+
const selectedTimelineRevisionEventFunctions = makePHEventFunctions("selectedTimelineRevision");
|
|
2735
|
+
selectedTimelineRevisionEventFunctions.useValue;
|
|
2736
|
+
selectedTimelineRevisionEventFunctions.setValue;
|
|
2737
|
+
selectedTimelineRevisionEventFunctions.addEventHandler;
|
|
2738
|
+
const toastEventFunctions = makePHEventFunctions("toast");
|
|
2739
|
+
/** Returns the toast function */
|
|
2740
|
+
const usePHToast = toastEventFunctions.useValue;
|
|
2741
|
+
toastEventFunctions.setValue;
|
|
2742
|
+
toastEventFunctions.addEventHandler;
|
|
2743
|
+
const vetraPackageManagerFunctions = makePHEventFunctions("vetraPackageManager");
|
|
2744
|
+
const useVetraPackageManager = vetraPackageManagerFunctions.useValue;
|
|
2745
|
+
/** Returns all of the Vetra packages loaded by the Connect instance */
|
|
2746
|
+
const useVetraPackages = () => {
|
|
2747
|
+
const packageManager = useVetraPackageManager();
|
|
2748
|
+
return useSyncExternalStore((cb) => packageManager ? packageManager.subscribe(cb) : () => {}, () => packageManager?.packages ?? []);
|
|
2749
|
+
};
|
|
2750
|
+
vetraPackageManagerFunctions.addEventHandler;
|
|
2751
|
+
function useDocumentModelModules() {
|
|
2752
|
+
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);
|
|
3011
2753
|
}
|
|
3012
2754
|
/**
|
|
3013
|
-
*
|
|
2755
|
+
* Resolves a document model module by document type, mirroring the registry's
|
|
2756
|
+
* semantics (`IDocumentModelRegistry.getModule`): with `version` omitted the
|
|
2757
|
+
* LATEST version of the type wins (`version ?? 1` as each module's default),
|
|
2758
|
+
* with `version` given only an exact match is returned. The reactor resolves
|
|
2759
|
+
* modules the same way when a document is created, so metadata read through
|
|
2760
|
+
* this hook and the version a creation actually uses cannot disagree.
|
|
3014
2761
|
*/
|
|
3015
|
-
function
|
|
3016
|
-
const
|
|
3017
|
-
|
|
2762
|
+
function useDocumentModelModuleById(id, version) {
|
|
2763
|
+
const documentModelModules = useDocumentModelModules();
|
|
2764
|
+
if (!id || !documentModelModules) return void 0;
|
|
2765
|
+
let latestModule;
|
|
2766
|
+
let latestVersion = -1;
|
|
2767
|
+
for (const module of documentModelModules) {
|
|
2768
|
+
if (module.documentModel.global.id !== id) continue;
|
|
2769
|
+
const moduleVersion = module.version ?? 1;
|
|
2770
|
+
if (version !== void 0) {
|
|
2771
|
+
if (moduleVersion === version) return module;
|
|
2772
|
+
continue;
|
|
2773
|
+
}
|
|
2774
|
+
if (moduleVersion > latestVersion) {
|
|
2775
|
+
latestVersion = moduleVersion;
|
|
2776
|
+
latestModule = module;
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
return latestModule;
|
|
3018
2780
|
}
|
|
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));
|
|
2781
|
+
//#endregion
|
|
2782
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/descriptors.js
|
|
2783
|
+
const normalizeDescriptors = (error) => {
|
|
2784
|
+
CORE_ERROR_PROPS.forEach((propName) => {
|
|
2785
|
+
normalizeDescriptor(error, propName);
|
|
2786
|
+
});
|
|
2787
|
+
};
|
|
2788
|
+
const CORE_ERROR_PROPS = [
|
|
2789
|
+
"name",
|
|
2790
|
+
"message",
|
|
2791
|
+
"stack",
|
|
2792
|
+
"cause",
|
|
2793
|
+
"errors"
|
|
2794
|
+
];
|
|
2795
|
+
const normalizeDescriptor = (error, propName) => {
|
|
2796
|
+
const descriptor = getDescriptor(error, propName);
|
|
2797
|
+
if (descriptor === void 0) return;
|
|
2798
|
+
if (isReadonlyGetter(descriptor)) {
|
|
2799
|
+
setErrorProperty(error, propName, error[propName]);
|
|
3039
2800
|
return;
|
|
3040
2801
|
}
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
const
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
2802
|
+
if (isInvalidDescriptor(descriptor)) setErrorDescriptor(error, propName, descriptor);
|
|
2803
|
+
};
|
|
2804
|
+
const getDescriptor = (value, propName) => {
|
|
2805
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, propName);
|
|
2806
|
+
if (descriptor !== void 0) return descriptor;
|
|
2807
|
+
const prototype = Object.getPrototypeOf(value);
|
|
2808
|
+
return prototype === null ? void 0 : getDescriptor(prototype, propName);
|
|
2809
|
+
};
|
|
2810
|
+
const isReadonlyGetter = ({ get, set }) => get !== void 0 && set === void 0;
|
|
2811
|
+
const isInvalidDescriptor = ({ enumerable, writable }) => enumerable || !writable;
|
|
2812
|
+
const setErrorProperty = (error, propName, value) => {
|
|
2813
|
+
setErrorDescriptor(error, propName, { value });
|
|
2814
|
+
};
|
|
2815
|
+
const setErrorDescriptor = (error, propName, descriptor) => {
|
|
2816
|
+
Object.defineProperty(error, propName, {
|
|
2817
|
+
...descriptor,
|
|
2818
|
+
..."get" in descriptor || "set" in descriptor ? {} : { writable: true },
|
|
2819
|
+
enumerable: false,
|
|
2820
|
+
configurable: true
|
|
2821
|
+
});
|
|
2822
|
+
};
|
|
2823
|
+
//#endregion
|
|
2824
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/aggregate.js
|
|
2825
|
+
const normalizeAggregate = (error, recurse) => {
|
|
2826
|
+
if (Array.isArray(error.errors)) setErrorProperty(error, "errors", error.errors.filter(isDefined).map(recurse).filter(Boolean));
|
|
2827
|
+
else if (isAggregateError(error)) setErrorProperty(error, "errors", []);
|
|
2828
|
+
else if (error.errors !== void 0) deleteAggregateErrors(error);
|
|
2829
|
+
};
|
|
2830
|
+
const isDefined = (error) => error !== void 0;
|
|
2831
|
+
const isAggregateError = (error) => "AggregateError" in globalThis && (error.name === "AggregateError" || error instanceof AggregateError);
|
|
2832
|
+
const deleteAggregateErrors = (error) => {
|
|
2833
|
+
delete error.errors;
|
|
2834
|
+
if (error.errors !== void 0) setErrorProperty(error, "errors", []);
|
|
2835
|
+
};
|
|
2836
|
+
//#endregion
|
|
2837
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/cause.js
|
|
2838
|
+
const normalizeCause = (error, recurse) => {
|
|
2839
|
+
if (!("cause" in error)) return;
|
|
2840
|
+
const cause = error.cause === void 0 ? error.cause : recurse(error.cause);
|
|
2841
|
+
if (cause === void 0) delete error.cause;
|
|
2842
|
+
else setErrorProperty(error, "cause", cause);
|
|
2843
|
+
};
|
|
2844
|
+
//#endregion
|
|
2845
|
+
//#region ../../node_modules/.pnpm/is-error-instance@3.0.1/node_modules/is-error-instance/build/src/main.js
|
|
2846
|
+
const isErrorInstance = (value) => isInstanceOfError(value) || hasErrorTag(value);
|
|
2847
|
+
const isInstanceOfError = (value) => {
|
|
2848
|
+
try {
|
|
2849
|
+
return value instanceof Error;
|
|
2850
|
+
} catch {
|
|
2851
|
+
return false;
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
const hasErrorTag = (value) => {
|
|
2855
|
+
try {
|
|
2856
|
+
return ERROR_TAGS.has(Object.prototype.toString.call(value));
|
|
2857
|
+
} catch {
|
|
2858
|
+
return false;
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
const ERROR_TAGS = new Set([
|
|
2862
|
+
"[object Error]",
|
|
2863
|
+
"[object DOMException]",
|
|
2864
|
+
"[object DOMError]",
|
|
2865
|
+
"[object Exception]"
|
|
2866
|
+
]);
|
|
2867
|
+
//#endregion
|
|
2868
|
+
//#region ../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js
|
|
2869
|
+
function isPlainObject(value) {
|
|
2870
|
+
if (typeof value !== "object" || value === null) return false;
|
|
2871
|
+
const prototype = Object.getPrototypeOf(value);
|
|
2872
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
3058
2873
|
}
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
2874
|
+
//#endregion
|
|
2875
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/modifiable.js
|
|
2876
|
+
const isNonModifiableError = (error) => !Object.isExtensible(error) || CORE_ERROR_PROPS.some((propName) => isNonConfigurableProp(error, propName) || isThrowingProp(error, propName));
|
|
2877
|
+
const isNonConfigurableProp = (error, propName) => {
|
|
2878
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, propName);
|
|
2879
|
+
return descriptor !== void 0 && !descriptor.configurable;
|
|
2880
|
+
};
|
|
2881
|
+
const isThrowingProp = (error, propName) => {
|
|
2882
|
+
try {
|
|
2883
|
+
error[propName];
|
|
2884
|
+
return false;
|
|
2885
|
+
} catch {
|
|
2886
|
+
return true;
|
|
2887
|
+
}
|
|
2888
|
+
};
|
|
2889
|
+
//#endregion
|
|
2890
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/stack.js
|
|
2891
|
+
const setStack = (error) => {
|
|
2892
|
+
setErrorProperty(error, "stack", getStack(error.message, error.name));
|
|
2893
|
+
};
|
|
2894
|
+
const getStack = (message = "", name = "Error") => {
|
|
2895
|
+
const { stack } = new (getErrorClass(name))(message);
|
|
2896
|
+
return typeof stack === "string" && stack !== "" ? stack : `${name}: ${message}`;
|
|
2897
|
+
};
|
|
2898
|
+
const getErrorClass = (name) => {
|
|
2899
|
+
const descriptor = {
|
|
2900
|
+
value: name,
|
|
2901
|
+
enumerable: false,
|
|
2902
|
+
writable: true,
|
|
2903
|
+
configurable: true
|
|
2904
|
+
};
|
|
2905
|
+
const StackError = Object.defineProperty(class extends Error {}, "name", descriptor);
|
|
2906
|
+
Object.defineProperty(StackError.prototype, "name", descriptor);
|
|
2907
|
+
return StackError;
|
|
2908
|
+
};
|
|
2909
|
+
//#endregion
|
|
2910
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/copy.js
|
|
2911
|
+
const copyObject = (object) => {
|
|
2912
|
+
const objectCopy = {};
|
|
2913
|
+
for (const propName of getPropsToCopy(object)) try {
|
|
2914
|
+
const value = object[propName];
|
|
2915
|
+
const { enumerable, configurable, writable = true } = getDescriptor(object, propName);
|
|
2916
|
+
Object.defineProperty(objectCopy, propName, {
|
|
2917
|
+
value,
|
|
2918
|
+
enumerable,
|
|
2919
|
+
configurable,
|
|
2920
|
+
writable
|
|
2921
|
+
});
|
|
2922
|
+
} catch {}
|
|
2923
|
+
return objectCopy;
|
|
2924
|
+
};
|
|
2925
|
+
const getPropsToCopy = (object) => {
|
|
2926
|
+
const propNames = getOwnKeys(object);
|
|
2927
|
+
for (const propName of CORE_ERROR_PROPS) if (isInheritedProp(object, propName)) propNames.push(propName);
|
|
2928
|
+
return propNames;
|
|
2929
|
+
};
|
|
2930
|
+
const getOwnKeys = (object) => {
|
|
2931
|
+
try {
|
|
2932
|
+
return Reflect.ownKeys(object);
|
|
2933
|
+
} catch {
|
|
2934
|
+
return [];
|
|
2935
|
+
}
|
|
2936
|
+
};
|
|
2937
|
+
const isInheritedProp = (object, propName) => {
|
|
2938
|
+
try {
|
|
2939
|
+
return propName in object && !Object.hasOwn(object, propName);
|
|
2940
|
+
} catch {
|
|
2941
|
+
return false;
|
|
2942
|
+
}
|
|
2943
|
+
};
|
|
2944
|
+
//#endregion
|
|
2945
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/object.js
|
|
2946
|
+
const objectifyError = (object) => {
|
|
2947
|
+
const { name, message, stack, cause, errors, ...objectA } = copyObject(object);
|
|
2948
|
+
const messageA = getMessage(message, objectA);
|
|
2949
|
+
const error = newError(name, messageA);
|
|
2950
|
+
if (message === messageA) assignObjectProps(error, objectA);
|
|
2951
|
+
Object.entries({
|
|
2952
|
+
name,
|
|
2953
|
+
stack,
|
|
2954
|
+
cause,
|
|
2955
|
+
errors
|
|
2956
|
+
}).forEach(([propName, propValue]) => {
|
|
2957
|
+
setNewErrorProperty(error, propName, propValue);
|
|
2958
|
+
});
|
|
2959
|
+
if (stack === void 0) setStack(error);
|
|
2960
|
+
return error;
|
|
2961
|
+
};
|
|
2962
|
+
const getMessage = (message, object) => typeof message === "string" && message !== "" ? message : truncateMessage(safeJsonStringify(object));
|
|
2963
|
+
const safeJsonStringify = (object) => {
|
|
2964
|
+
try {
|
|
2965
|
+
return JSON.stringify(object);
|
|
2966
|
+
} catch {
|
|
2967
|
+
return safeStringify(object);
|
|
3067
2968
|
}
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
return;
|
|
2969
|
+
};
|
|
2970
|
+
const safeStringify = (object) => {
|
|
2971
|
+
try {
|
|
2972
|
+
return String(object);
|
|
2973
|
+
} catch {
|
|
2974
|
+
return "Invalid error";
|
|
3075
2975
|
}
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
if (
|
|
3098
|
-
|
|
3099
|
-
|
|
2976
|
+
};
|
|
2977
|
+
const truncateMessage = (message) => message.length < MESSAGE_MAX_SIZE ? message : `${message.slice(0, MESSAGE_MAX_SIZE)}...`;
|
|
2978
|
+
const MESSAGE_MAX_SIZE = 1e3;
|
|
2979
|
+
const newError = (name, message) => {
|
|
2980
|
+
if (name === "AggregateError" && "AggregateError" in globalThis) return new AggregateError([], message);
|
|
2981
|
+
if (name in NATIVE_ERRORS) return new NATIVE_ERRORS[name](message);
|
|
2982
|
+
return new Error(message);
|
|
2983
|
+
};
|
|
2984
|
+
const NATIVE_ERRORS = {
|
|
2985
|
+
Error,
|
|
2986
|
+
ReferenceError,
|
|
2987
|
+
TypeError,
|
|
2988
|
+
SyntaxError,
|
|
2989
|
+
RangeError,
|
|
2990
|
+
URIError,
|
|
2991
|
+
EvalError
|
|
2992
|
+
};
|
|
2993
|
+
const assignObjectProps = (error, object) => {
|
|
2994
|
+
for (const propName in object) if (!(propName in error)) error[propName] = object[propName];
|
|
2995
|
+
};
|
|
2996
|
+
const setNewErrorProperty = (error, propName, propValue) => {
|
|
2997
|
+
if (propValue !== void 0) setErrorProperty(error, propName, propValue);
|
|
2998
|
+
};
|
|
2999
|
+
//#endregion
|
|
3000
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/string.js
|
|
3001
|
+
const stringifyError = (value) => {
|
|
3002
|
+
try {
|
|
3003
|
+
const error = new Error(String(value));
|
|
3004
|
+
setStack(error);
|
|
3005
|
+
return error;
|
|
3006
|
+
} catch (error_) {
|
|
3007
|
+
return error_;
|
|
3100
3008
|
}
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3009
|
+
};
|
|
3010
|
+
//#endregion
|
|
3011
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/main.js
|
|
3012
|
+
const { toString: objectToString } = Object.prototype;
|
|
3013
|
+
const createError = (value) => {
|
|
3014
|
+
if (isErrorPlainObj(value)) return objectifyError(value);
|
|
3015
|
+
if (!isErrorInstance(value)) return stringifyError(value);
|
|
3016
|
+
if (isInvalidError(value)) return objectifyError(value);
|
|
3017
|
+
return value;
|
|
3018
|
+
};
|
|
3019
|
+
const isErrorPlainObj = (value) => {
|
|
3020
|
+
try {
|
|
3021
|
+
return isPlainObject(value);
|
|
3022
|
+
} catch {
|
|
3023
|
+
return false;
|
|
3104
3024
|
}
|
|
3105
|
-
}
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3025
|
+
};
|
|
3026
|
+
const isInvalidError = (value) => isProxy(value) || isNonModifiableError(value) || hasInvalidConstructor(value);
|
|
3027
|
+
const isProxy = (value) => {
|
|
3028
|
+
try {
|
|
3029
|
+
return objectToString.call(value) === "[object Object]";
|
|
3030
|
+
} catch {
|
|
3031
|
+
return true;
|
|
3032
|
+
}
|
|
3033
|
+
};
|
|
3034
|
+
const hasInvalidConstructor = (error) => typeof error.constructor !== "function" || typeof error.constructor.name !== "string" || error.constructor.name === "" || error.constructor.prototype !== Object.getPrototypeOf(error);
|
|
3035
|
+
//#endregion
|
|
3036
|
+
//#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/main.js
|
|
3037
|
+
const normalizeException = (error, { shallow = false } = {}) => recurseException(error, [], shallow);
|
|
3038
|
+
const recurseException = (error, parents, shallow) => {
|
|
3039
|
+
if (parents.includes(error)) return;
|
|
3040
|
+
const recurse = shallow ? identity : (innerError) => recurseException(innerError, [...parents, error], shallow);
|
|
3041
|
+
const errorA = createError(error);
|
|
3042
|
+
normalizeProps(errorA, recurse);
|
|
3043
|
+
return errorA;
|
|
3044
|
+
};
|
|
3045
|
+
const identity = (error) => error;
|
|
3046
|
+
const normalizeProps = (error, recurse) => {
|
|
3047
|
+
normalizeName(error);
|
|
3048
|
+
normalizeMessage(error);
|
|
3049
|
+
normalizeStack(error);
|
|
3050
|
+
normalizeCause(error, recurse);
|
|
3051
|
+
normalizeAggregate(error, recurse);
|
|
3052
|
+
normalizeDescriptors(error);
|
|
3053
|
+
};
|
|
3054
|
+
const normalizeName = (error) => {
|
|
3055
|
+
if (isDefinedString(error.name)) return;
|
|
3056
|
+
const prototypeName = Object.getPrototypeOf(error).name;
|
|
3057
|
+
setErrorProperty(error, "name", isDefinedString(prototypeName) ? prototypeName : error.constructor.name);
|
|
3058
|
+
};
|
|
3059
|
+
const normalizeMessage = (error) => {
|
|
3060
|
+
if (!isDefinedString(error.message)) setErrorProperty(error, "message", "");
|
|
3061
|
+
};
|
|
3062
|
+
const normalizeStack = (error) => {
|
|
3063
|
+
if (!isDefinedString(error.stack)) setStack(error);
|
|
3064
|
+
};
|
|
3065
|
+
const isDefinedString = (value) => typeof value === "string" && value !== "";
|
|
3066
|
+
//#endregion
|
|
3067
|
+
//#region ../reactor-browser/dist/index.js
|
|
3068
|
+
var import_lz_string = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3069
|
+
var LZString = (function() {
|
|
3070
|
+
var f = String.fromCharCode;
|
|
3071
|
+
var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
3072
|
+
var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
|
|
3073
|
+
var baseReverseDic = {};
|
|
3074
|
+
function getBaseValue(alphabet, character) {
|
|
3075
|
+
if (!baseReverseDic[alphabet]) {
|
|
3076
|
+
baseReverseDic[alphabet] = {};
|
|
3077
|
+
for (var i = 0; i < alphabet.length; i++) baseReverseDic[alphabet][alphabet.charAt(i)] = i;
|
|
3078
|
+
}
|
|
3079
|
+
return baseReverseDic[alphabet][character];
|
|
3080
|
+
}
|
|
3081
|
+
var LZString = {
|
|
3082
|
+
compressToBase64: function(input) {
|
|
3083
|
+
if (input == null) return "";
|
|
3084
|
+
var res = LZString._compress(input, 6, function(a) {
|
|
3085
|
+
return keyStrBase64.charAt(a);
|
|
3086
|
+
});
|
|
3087
|
+
switch (res.length % 4) {
|
|
3088
|
+
default:
|
|
3089
|
+
case 0: return res;
|
|
3090
|
+
case 1: return res + "===";
|
|
3091
|
+
case 2: return res + "==";
|
|
3092
|
+
case 3: return res + "=";
|
|
3093
|
+
}
|
|
3094
|
+
},
|
|
3095
|
+
decompressFromBase64: function(input) {
|
|
3096
|
+
if (input == null) return "";
|
|
3097
|
+
if (input == "") return null;
|
|
3098
|
+
return LZString._decompress(input.length, 32, function(index) {
|
|
3099
|
+
return getBaseValue(keyStrBase64, input.charAt(index));
|
|
3100
|
+
});
|
|
3101
|
+
},
|
|
3102
|
+
compressToUTF16: function(input) {
|
|
3103
|
+
if (input == null) return "";
|
|
3104
|
+
return LZString._compress(input, 15, function(a) {
|
|
3105
|
+
return f(a + 32);
|
|
3106
|
+
}) + " ";
|
|
3107
|
+
},
|
|
3108
|
+
decompressFromUTF16: function(compressed) {
|
|
3109
|
+
if (compressed == null) return "";
|
|
3110
|
+
if (compressed == "") return null;
|
|
3111
|
+
return LZString._decompress(compressed.length, 16384, function(index) {
|
|
3112
|
+
return compressed.charCodeAt(index) - 32;
|
|
3113
|
+
});
|
|
3114
|
+
},
|
|
3115
|
+
compressToUint8Array: function(uncompressed) {
|
|
3116
|
+
var compressed = LZString.compress(uncompressed);
|
|
3117
|
+
var buf = new Uint8Array(compressed.length * 2);
|
|
3118
|
+
for (var i = 0, TotalLen = compressed.length; i < TotalLen; i++) {
|
|
3119
|
+
var current_value = compressed.charCodeAt(i);
|
|
3120
|
+
buf[i * 2] = current_value >>> 8;
|
|
3121
|
+
buf[i * 2 + 1] = current_value % 256;
|
|
3122
|
+
}
|
|
3123
|
+
return buf;
|
|
3124
|
+
},
|
|
3125
|
+
decompressFromUint8Array: function(compressed) {
|
|
3126
|
+
if (compressed === null || compressed === void 0) return LZString.decompress(compressed);
|
|
3127
|
+
else {
|
|
3128
|
+
var buf = new Array(compressed.length / 2);
|
|
3129
|
+
for (var i = 0, TotalLen = buf.length; i < TotalLen; i++) buf[i] = compressed[i * 2] * 256 + compressed[i * 2 + 1];
|
|
3130
|
+
var result = [];
|
|
3131
|
+
buf.forEach(function(c) {
|
|
3132
|
+
result.push(f(c));
|
|
3133
|
+
});
|
|
3134
|
+
return LZString.decompress(result.join(""));
|
|
3135
|
+
}
|
|
3136
|
+
},
|
|
3137
|
+
compressToEncodedURIComponent: function(input) {
|
|
3138
|
+
if (input == null) return "";
|
|
3139
|
+
return LZString._compress(input, 6, function(a) {
|
|
3140
|
+
return keyStrUriSafe.charAt(a);
|
|
3141
|
+
});
|
|
3142
|
+
},
|
|
3143
|
+
decompressFromEncodedURIComponent: function(input) {
|
|
3144
|
+
if (input == null) return "";
|
|
3145
|
+
if (input == "") return null;
|
|
3146
|
+
input = input.replace(/ /g, "+");
|
|
3147
|
+
return LZString._decompress(input.length, 32, function(index) {
|
|
3148
|
+
return getBaseValue(keyStrUriSafe, input.charAt(index));
|
|
3149
|
+
});
|
|
3150
|
+
},
|
|
3151
|
+
compress: function(uncompressed) {
|
|
3152
|
+
return LZString._compress(uncompressed, 16, function(a) {
|
|
3153
|
+
return f(a);
|
|
3154
|
+
});
|
|
3155
|
+
},
|
|
3156
|
+
_compress: function(uncompressed, bitsPerChar, getCharFromInt) {
|
|
3157
|
+
if (uncompressed == null) return "";
|
|
3158
|
+
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;
|
|
3159
|
+
for (ii = 0; ii < uncompressed.length; ii += 1) {
|
|
3160
|
+
context_c = uncompressed.charAt(ii);
|
|
3161
|
+
if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
|
|
3162
|
+
context_dictionary[context_c] = context_dictSize++;
|
|
3163
|
+
context_dictionaryToCreate[context_c] = true;
|
|
3164
|
+
}
|
|
3165
|
+
context_wc = context_w + context_c;
|
|
3166
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) context_w = context_wc;
|
|
3167
|
+
else {
|
|
3168
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
3169
|
+
if (context_w.charCodeAt(0) < 256) {
|
|
3170
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3171
|
+
context_data_val = context_data_val << 1;
|
|
3172
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3173
|
+
context_data_position = 0;
|
|
3174
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3175
|
+
context_data_val = 0;
|
|
3176
|
+
} else context_data_position++;
|
|
3177
|
+
}
|
|
3178
|
+
value = context_w.charCodeAt(0);
|
|
3179
|
+
for (i = 0; i < 8; i++) {
|
|
3180
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3181
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3182
|
+
context_data_position = 0;
|
|
3183
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3184
|
+
context_data_val = 0;
|
|
3185
|
+
} else context_data_position++;
|
|
3186
|
+
value = value >> 1;
|
|
3187
|
+
}
|
|
3188
|
+
} else {
|
|
3189
|
+
value = 1;
|
|
3190
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3191
|
+
context_data_val = context_data_val << 1 | value;
|
|
3192
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3193
|
+
context_data_position = 0;
|
|
3194
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3195
|
+
context_data_val = 0;
|
|
3196
|
+
} else context_data_position++;
|
|
3197
|
+
value = 0;
|
|
3198
|
+
}
|
|
3199
|
+
value = context_w.charCodeAt(0);
|
|
3200
|
+
for (i = 0; i < 16; i++) {
|
|
3201
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3202
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3203
|
+
context_data_position = 0;
|
|
3204
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3205
|
+
context_data_val = 0;
|
|
3206
|
+
} else context_data_position++;
|
|
3207
|
+
value = value >> 1;
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
context_enlargeIn--;
|
|
3211
|
+
if (context_enlargeIn == 0) {
|
|
3212
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
3213
|
+
context_numBits++;
|
|
3214
|
+
}
|
|
3215
|
+
delete context_dictionaryToCreate[context_w];
|
|
3216
|
+
} else {
|
|
3217
|
+
value = context_dictionary[context_w];
|
|
3218
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3219
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3220
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3221
|
+
context_data_position = 0;
|
|
3222
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3223
|
+
context_data_val = 0;
|
|
3224
|
+
} else context_data_position++;
|
|
3225
|
+
value = value >> 1;
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
context_enlargeIn--;
|
|
3229
|
+
if (context_enlargeIn == 0) {
|
|
3230
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
3231
|
+
context_numBits++;
|
|
3232
|
+
}
|
|
3233
|
+
context_dictionary[context_wc] = context_dictSize++;
|
|
3234
|
+
context_w = String(context_c);
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
if (context_w !== "") {
|
|
3238
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
3239
|
+
if (context_w.charCodeAt(0) < 256) {
|
|
3240
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3241
|
+
context_data_val = context_data_val << 1;
|
|
3242
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3243
|
+
context_data_position = 0;
|
|
3244
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3245
|
+
context_data_val = 0;
|
|
3246
|
+
} else context_data_position++;
|
|
3247
|
+
}
|
|
3248
|
+
value = context_w.charCodeAt(0);
|
|
3249
|
+
for (i = 0; i < 8; i++) {
|
|
3250
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3251
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3252
|
+
context_data_position = 0;
|
|
3253
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3254
|
+
context_data_val = 0;
|
|
3255
|
+
} else context_data_position++;
|
|
3256
|
+
value = value >> 1;
|
|
3257
|
+
}
|
|
3258
|
+
} else {
|
|
3259
|
+
value = 1;
|
|
3260
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3261
|
+
context_data_val = context_data_val << 1 | value;
|
|
3262
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3263
|
+
context_data_position = 0;
|
|
3264
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3265
|
+
context_data_val = 0;
|
|
3266
|
+
} else context_data_position++;
|
|
3267
|
+
value = 0;
|
|
3268
|
+
}
|
|
3269
|
+
value = context_w.charCodeAt(0);
|
|
3270
|
+
for (i = 0; i < 16; i++) {
|
|
3271
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3272
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3273
|
+
context_data_position = 0;
|
|
3274
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3275
|
+
context_data_val = 0;
|
|
3276
|
+
} else context_data_position++;
|
|
3277
|
+
value = value >> 1;
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
context_enlargeIn--;
|
|
3281
|
+
if (context_enlargeIn == 0) {
|
|
3282
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
3283
|
+
context_numBits++;
|
|
3284
|
+
}
|
|
3285
|
+
delete context_dictionaryToCreate[context_w];
|
|
3286
|
+
} else {
|
|
3287
|
+
value = context_dictionary[context_w];
|
|
3288
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3289
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3290
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3291
|
+
context_data_position = 0;
|
|
3292
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3293
|
+
context_data_val = 0;
|
|
3294
|
+
} else context_data_position++;
|
|
3295
|
+
value = value >> 1;
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
context_enlargeIn--;
|
|
3299
|
+
if (context_enlargeIn == 0) {
|
|
3300
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
3301
|
+
context_numBits++;
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
value = 2;
|
|
3305
|
+
for (i = 0; i < context_numBits; i++) {
|
|
3306
|
+
context_data_val = context_data_val << 1 | value & 1;
|
|
3307
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3308
|
+
context_data_position = 0;
|
|
3309
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3310
|
+
context_data_val = 0;
|
|
3311
|
+
} else context_data_position++;
|
|
3312
|
+
value = value >> 1;
|
|
3313
|
+
}
|
|
3314
|
+
while (true) {
|
|
3315
|
+
context_data_val = context_data_val << 1;
|
|
3316
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
3317
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
3318
|
+
break;
|
|
3319
|
+
} else context_data_position++;
|
|
3320
|
+
}
|
|
3321
|
+
return context_data.join("");
|
|
3322
|
+
},
|
|
3323
|
+
decompress: function(compressed) {
|
|
3324
|
+
if (compressed == null) return "";
|
|
3325
|
+
if (compressed == "") return null;
|
|
3326
|
+
return LZString._decompress(compressed.length, 32768, function(index) {
|
|
3327
|
+
return compressed.charCodeAt(index);
|
|
3328
|
+
});
|
|
3329
|
+
},
|
|
3330
|
+
_decompress: function(length, resetValue, getNextValue) {
|
|
3331
|
+
var dictionary = [], enlargeIn = 4, dictSize = 4, numBits = 3, entry = "", result = [], i, w, bits, resb, maxpower, power, c, data = {
|
|
3332
|
+
val: getNextValue(0),
|
|
3333
|
+
position: resetValue,
|
|
3334
|
+
index: 1
|
|
3335
|
+
};
|
|
3336
|
+
for (i = 0; i < 3; i += 1) dictionary[i] = i;
|
|
3337
|
+
bits = 0;
|
|
3338
|
+
maxpower = Math.pow(2, 2);
|
|
3339
|
+
power = 1;
|
|
3340
|
+
while (power != maxpower) {
|
|
3341
|
+
resb = data.val & data.position;
|
|
3342
|
+
data.position >>= 1;
|
|
3343
|
+
if (data.position == 0) {
|
|
3344
|
+
data.position = resetValue;
|
|
3345
|
+
data.val = getNextValue(data.index++);
|
|
3346
|
+
}
|
|
3347
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3348
|
+
power <<= 1;
|
|
3349
|
+
}
|
|
3350
|
+
switch (bits) {
|
|
3351
|
+
case 0:
|
|
3352
|
+
bits = 0;
|
|
3353
|
+
maxpower = Math.pow(2, 8);
|
|
3354
|
+
power = 1;
|
|
3355
|
+
while (power != maxpower) {
|
|
3356
|
+
resb = data.val & data.position;
|
|
3357
|
+
data.position >>= 1;
|
|
3358
|
+
if (data.position == 0) {
|
|
3359
|
+
data.position = resetValue;
|
|
3360
|
+
data.val = getNextValue(data.index++);
|
|
3361
|
+
}
|
|
3362
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3363
|
+
power <<= 1;
|
|
3364
|
+
}
|
|
3365
|
+
c = f(bits);
|
|
3366
|
+
break;
|
|
3367
|
+
case 1:
|
|
3368
|
+
bits = 0;
|
|
3369
|
+
maxpower = Math.pow(2, 16);
|
|
3370
|
+
power = 1;
|
|
3371
|
+
while (power != maxpower) {
|
|
3372
|
+
resb = data.val & data.position;
|
|
3373
|
+
data.position >>= 1;
|
|
3374
|
+
if (data.position == 0) {
|
|
3375
|
+
data.position = resetValue;
|
|
3376
|
+
data.val = getNextValue(data.index++);
|
|
3377
|
+
}
|
|
3378
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3379
|
+
power <<= 1;
|
|
3380
|
+
}
|
|
3381
|
+
c = f(bits);
|
|
3382
|
+
break;
|
|
3383
|
+
case 2: return "";
|
|
3384
|
+
}
|
|
3385
|
+
dictionary[3] = c;
|
|
3386
|
+
w = c;
|
|
3387
|
+
result.push(c);
|
|
3388
|
+
while (true) {
|
|
3389
|
+
if (data.index > length) return "";
|
|
3390
|
+
bits = 0;
|
|
3391
|
+
maxpower = Math.pow(2, numBits);
|
|
3392
|
+
power = 1;
|
|
3393
|
+
while (power != maxpower) {
|
|
3394
|
+
resb = data.val & data.position;
|
|
3395
|
+
data.position >>= 1;
|
|
3396
|
+
if (data.position == 0) {
|
|
3397
|
+
data.position = resetValue;
|
|
3398
|
+
data.val = getNextValue(data.index++);
|
|
3399
|
+
}
|
|
3400
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3401
|
+
power <<= 1;
|
|
3402
|
+
}
|
|
3403
|
+
switch (c = bits) {
|
|
3404
|
+
case 0:
|
|
3405
|
+
bits = 0;
|
|
3406
|
+
maxpower = Math.pow(2, 8);
|
|
3407
|
+
power = 1;
|
|
3408
|
+
while (power != maxpower) {
|
|
3409
|
+
resb = data.val & data.position;
|
|
3410
|
+
data.position >>= 1;
|
|
3411
|
+
if (data.position == 0) {
|
|
3412
|
+
data.position = resetValue;
|
|
3413
|
+
data.val = getNextValue(data.index++);
|
|
3414
|
+
}
|
|
3415
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3416
|
+
power <<= 1;
|
|
3417
|
+
}
|
|
3418
|
+
dictionary[dictSize++] = f(bits);
|
|
3419
|
+
c = dictSize - 1;
|
|
3420
|
+
enlargeIn--;
|
|
3421
|
+
break;
|
|
3422
|
+
case 1:
|
|
3423
|
+
bits = 0;
|
|
3424
|
+
maxpower = Math.pow(2, 16);
|
|
3425
|
+
power = 1;
|
|
3426
|
+
while (power != maxpower) {
|
|
3427
|
+
resb = data.val & data.position;
|
|
3428
|
+
data.position >>= 1;
|
|
3429
|
+
if (data.position == 0) {
|
|
3430
|
+
data.position = resetValue;
|
|
3431
|
+
data.val = getNextValue(data.index++);
|
|
3432
|
+
}
|
|
3433
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
3434
|
+
power <<= 1;
|
|
3435
|
+
}
|
|
3436
|
+
dictionary[dictSize++] = f(bits);
|
|
3437
|
+
c = dictSize - 1;
|
|
3438
|
+
enlargeIn--;
|
|
3439
|
+
break;
|
|
3440
|
+
case 2: return result.join("");
|
|
3441
|
+
}
|
|
3442
|
+
if (enlargeIn == 0) {
|
|
3443
|
+
enlargeIn = Math.pow(2, numBits);
|
|
3444
|
+
numBits++;
|
|
3445
|
+
}
|
|
3446
|
+
if (dictionary[c]) entry = dictionary[c];
|
|
3447
|
+
else if (c === dictSize) entry = w + w.charAt(0);
|
|
3448
|
+
else return null;
|
|
3449
|
+
result.push(entry);
|
|
3450
|
+
dictionary[dictSize++] = w + entry.charAt(0);
|
|
3451
|
+
enlargeIn--;
|
|
3452
|
+
w = entry;
|
|
3453
|
+
if (enlargeIn == 0) {
|
|
3454
|
+
enlargeIn = Math.pow(2, numBits);
|
|
3455
|
+
numBits++;
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3123
3458
|
}
|
|
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
|
|
3459
|
+
};
|
|
3460
|
+
return LZString;
|
|
3461
|
+
})();
|
|
3462
|
+
if (typeof define === "function" && define.amd) define(function() {
|
|
3463
|
+
return LZString;
|
|
3138
3464
|
});
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3465
|
+
else if (typeof module !== "undefined" && module != null) module.exports = LZString;
|
|
3466
|
+
else if (typeof angular !== "undefined" && angular != null) angular.module("LZString", []).factory("LZString", function() {
|
|
3467
|
+
return LZString;
|
|
3142
3468
|
});
|
|
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
|
-
}
|
|
3469
|
+
})))(), 1);
|
|
3470
|
+
/** Document types that represent a "drive": a container of nodes. */
|
|
3471
|
+
const DRIVE_DOCUMENT_TYPES = ["powerhouse/document-drive", "powerhouse/reactor-drive"];
|
|
3333
3472
|
function useAllowedDocumentModelModules() {
|
|
3334
3473
|
const documentModelModules = useDocumentModelModules();
|
|
3335
3474
|
const allowedDocumentTypes = useAllowedDocumentTypes();
|
|
@@ -3514,7 +3653,7 @@ function useNodeActions() {
|
|
|
3514
3653
|
}
|
|
3515
3654
|
async function onAddFolder(name, parent) {
|
|
3516
3655
|
if (!selectedDriveId) return;
|
|
3517
|
-
return addFolder(selectedDriveId, name, resolveNode(selectedDriveId, parent)?.id);
|
|
3656
|
+
return addFolder$1(selectedDriveId, name, resolveNode(selectedDriveId, parent)?.id);
|
|
3518
3657
|
}
|
|
3519
3658
|
async function onRenameNode(newName, node) {
|
|
3520
3659
|
if (!selectedDriveId) return;
|
|
@@ -3601,6 +3740,9 @@ function useSelectedNodePath() {
|
|
|
3601
3740
|
function useNodeParentFolderById(id) {
|
|
3602
3741
|
return useFolderById(useNodeById(id)?.parentFolder);
|
|
3603
3742
|
}
|
|
3743
|
+
function useParentFolderForSelectedNode() {
|
|
3744
|
+
return useNodeParentFolderById(useSelectedNode()?.id);
|
|
3745
|
+
}
|
|
3604
3746
|
/** Returns the selected document id */
|
|
3605
3747
|
function useSelectedDocumentId() {
|
|
3606
3748
|
const selectedNode = useSelectedNode();
|
|
@@ -3829,6 +3971,6 @@ function createDebouncedRefreshReactorDataClient(debounceDelayMs = DEFAULT_DEBOU
|
|
|
3829
3971
|
createDebouncedRefreshReactorData();
|
|
3830
3972
|
createDebouncedRefreshReactorDataClient();
|
|
3831
3973
|
//#endregion
|
|
3832
|
-
export {
|
|
3974
|
+
export { useDragNode as A, isFileNodeKind as C, showDeleteNodeModal as D, setSelectedNode as E, e$1 as F, e$4 as I, t$2 as L, usePHToast as M, useSelectedDriveId as N, showRevisionHistory as O, useSelectedDriveSafe as P, t$5 as R, addFolder$1 as S, setSelectedDrive as T, useSetPHAppConfig as _, useEditorModules as a, useUserPermissions as b, useNodeActions as c, useNodesInSelectedDriveOrFolder as d, useParentFolderForSelectedNode as f, useSelectedNodePath as g, useSelectedFolder as h, useDownloadDocument as i, useDropNode as j, useDisabledEditors as k, useNodeById as l, useSelectedDocumentSafe as m, preloadEditorModule as n, useEditorModulesForDocumentType as o, useSelectedDocumentOfType as p, useAllowedDocumentModelModules as r, useGetSwitchboardLink as s, getSyncStatusSync as t, useNodeParentFolderById as u, useSetPHDocumentEditorConfig as v, isFolderNodeKind as w, addDocument as x, useTheme as y, useDocumentById as z };
|
|
3833
3975
|
|
|
3834
|
-
//# sourceMappingURL=dist-
|
|
3976
|
+
//# sourceMappingURL=dist-BatmWBzA.js.map
|