@powerhousedao/connect 6.0.0-dev.84 → 6.0.0-dev.89
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/src/components/app.d.ts.map +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/modal/modals/InspectorModal/InspectorModal.d.ts.map +1 -1
- package/dist/src/components/modal/modals/InspectorModal/useIntegrityInspector.d.ts +3 -0
- package/dist/src/components/modal/modals/InspectorModal/useIntegrityInspector.d.ts.map +1 -0
- package/dist/src/components/modal/modals/settings/package-manager.d.ts.map +1 -1
- package/dist/src/components/package-install-prompt.d.ts +3 -0
- package/dist/src/components/package-install-prompt.d.ts.map +1 -0
- package/dist/src/context/index.js +1416 -839
- package/dist/src/hooks/index.js +1414 -837
- package/dist/src/main.js +1968 -1164
- package/dist/src/pages/index.js +1966 -1162
- package/dist/src/store/index.js +1617 -949
- package/dist/src/store/reactor.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +1436 -819
- package/dist/src/utils/reactor.d.ts +2 -2
- package/dist/src/utils/reactor.d.ts.map +1 -1
- package/dist/src/utils/registry-url.d.ts +2 -0
- package/dist/src/utils/registry-url.d.ts.map +1 -0
- package/dist/style.css +30 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
package/dist/src/store/index.js
CHANGED
|
@@ -4499,7 +4499,7 @@ var init_package = __esm(() => {
|
|
|
4499
4499
|
package_default = {
|
|
4500
4500
|
name: "@powerhousedao/connect",
|
|
4501
4501
|
productName: "Powerhouse-Connect",
|
|
4502
|
-
version: "6.0.0-dev.
|
|
4502
|
+
version: "6.0.0-dev.88",
|
|
4503
4503
|
description: "Powerhouse Connect",
|
|
4504
4504
|
main: "dist/index.html",
|
|
4505
4505
|
type: "module",
|
|
@@ -4638,6 +4638,7 @@ import { isUndoRedo } from "document-model/core";
|
|
|
4638
4638
|
import { deriveOperationId as deriveOperationId2 } from "document-model/core";
|
|
4639
4639
|
import { ConsoleLogger } from "document-model/core";
|
|
4640
4640
|
import { AbortError } from "document-drive/utils/errors";
|
|
4641
|
+
import { hashDocumentStateForScope } from "document-model/core";
|
|
4641
4642
|
function createDocumentAction(input) {
|
|
4642
4643
|
return {
|
|
4643
4644
|
id: generateId(),
|
|
@@ -11192,6 +11193,11 @@ class CollectionMembershipCache {
|
|
|
11192
11193
|
constructor(operationIndex) {
|
|
11193
11194
|
this.operationIndex = operationIndex;
|
|
11194
11195
|
}
|
|
11196
|
+
withScopedIndex(operationIndex) {
|
|
11197
|
+
const scoped = new CollectionMembershipCache(operationIndex);
|
|
11198
|
+
scoped.cache = this.cache;
|
|
11199
|
+
return scoped;
|
|
11200
|
+
}
|
|
11195
11201
|
async getCollectionsForDocuments(documentIds) {
|
|
11196
11202
|
const result = {};
|
|
11197
11203
|
const missing = [];
|
|
@@ -11479,6 +11485,12 @@ class DocumentMetaCache {
|
|
|
11479
11485
|
this.cache = new Map;
|
|
11480
11486
|
this.lruTracker = new LRUTracker;
|
|
11481
11487
|
}
|
|
11488
|
+
withScopedStore(operationStore) {
|
|
11489
|
+
const scoped = new DocumentMetaCache(operationStore, this.config);
|
|
11490
|
+
scoped.cache = this.cache;
|
|
11491
|
+
scoped.lruTracker = this.lruTracker;
|
|
11492
|
+
return scoped;
|
|
11493
|
+
}
|
|
11482
11494
|
async startup() {
|
|
11483
11495
|
return Promise.resolve();
|
|
11484
11496
|
}
|
|
@@ -11628,9 +11640,18 @@ class KyselyOperationIndexTxn {
|
|
|
11628
11640
|
|
|
11629
11641
|
class KyselyOperationIndex {
|
|
11630
11642
|
db;
|
|
11643
|
+
trx;
|
|
11631
11644
|
constructor(db) {
|
|
11632
11645
|
this.db = db;
|
|
11633
11646
|
}
|
|
11647
|
+
get queryExecutor() {
|
|
11648
|
+
return this.trx ?? this.db;
|
|
11649
|
+
}
|
|
11650
|
+
withTransaction(trx) {
|
|
11651
|
+
const instance = new KyselyOperationIndex(this.db);
|
|
11652
|
+
instance.trx = trx;
|
|
11653
|
+
return instance;
|
|
11654
|
+
}
|
|
11634
11655
|
start() {
|
|
11635
11656
|
return new KyselyOperationIndexTxn;
|
|
11636
11657
|
}
|
|
@@ -11639,70 +11660,76 @@ class KyselyOperationIndex {
|
|
|
11639
11660
|
throw new Error("Operation aborted");
|
|
11640
11661
|
}
|
|
11641
11662
|
const kyselyTxn = txn;
|
|
11663
|
+
if (this.trx) {
|
|
11664
|
+
return this.executeCommit(this.trx, kyselyTxn);
|
|
11665
|
+
}
|
|
11666
|
+
let resultOrdinals = [];
|
|
11667
|
+
await this.db.transaction().execute(async (trx) => {
|
|
11668
|
+
resultOrdinals = await this.executeCommit(trx, kyselyTxn);
|
|
11669
|
+
});
|
|
11670
|
+
return resultOrdinals;
|
|
11671
|
+
}
|
|
11672
|
+
async executeCommit(trx, kyselyTxn) {
|
|
11642
11673
|
const collections = kyselyTxn.getCollections();
|
|
11643
11674
|
const memberships = kyselyTxn.getCollectionMembershipRecords();
|
|
11644
11675
|
const removals = kyselyTxn.getCollectionRemovals();
|
|
11645
11676
|
const operations = kyselyTxn.getOperations();
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11677
|
+
if (collections.length > 0) {
|
|
11678
|
+
const collectionRows = collections.map((collectionId) => ({
|
|
11679
|
+
documentId: collectionId,
|
|
11680
|
+
collectionId,
|
|
11681
|
+
joinedOrdinal: BigInt(0),
|
|
11682
|
+
leftOrdinal: null
|
|
11683
|
+
}));
|
|
11684
|
+
await trx.insertInto("document_collections").values(collectionRows).onConflict((oc) => oc.doNothing()).execute();
|
|
11685
|
+
}
|
|
11686
|
+
let operationOrdinals = [];
|
|
11687
|
+
if (operations.length > 0) {
|
|
11688
|
+
const operationRows = operations.map((op) => ({
|
|
11689
|
+
opId: op.id || "",
|
|
11690
|
+
documentId: op.documentId,
|
|
11691
|
+
documentType: op.documentType,
|
|
11692
|
+
scope: op.scope,
|
|
11693
|
+
branch: op.branch,
|
|
11694
|
+
timestampUtcMs: op.timestampUtcMs,
|
|
11695
|
+
index: op.index,
|
|
11696
|
+
skip: op.skip,
|
|
11697
|
+
hash: op.hash,
|
|
11698
|
+
action: op.action,
|
|
11699
|
+
sourceRemote: op.sourceRemote
|
|
11700
|
+
}));
|
|
11701
|
+
const insertedOps = await trx.insertInto("operation_index_operations").values(operationRows).returning("ordinal").execute();
|
|
11702
|
+
operationOrdinals = insertedOps.map((row) => row.ordinal);
|
|
11703
|
+
}
|
|
11704
|
+
if (memberships.length > 0) {
|
|
11705
|
+
for (const m of memberships) {
|
|
11706
|
+
const ordinal = operationOrdinals[m.operationIndex];
|
|
11707
|
+
await trx.insertInto("document_collections").values({
|
|
11708
|
+
documentId: m.documentId,
|
|
11709
|
+
collectionId: m.collectionId,
|
|
11710
|
+
joinedOrdinal: BigInt(ordinal),
|
|
11653
11711
|
leftOrdinal: null
|
|
11654
|
-
}))
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
if (operations.length > 0) {
|
|
11659
|
-
const operationRows = operations.map((op) => ({
|
|
11660
|
-
opId: op.id || "",
|
|
11661
|
-
documentId: op.documentId,
|
|
11662
|
-
documentType: op.documentType,
|
|
11663
|
-
scope: op.scope,
|
|
11664
|
-
branch: op.branch,
|
|
11665
|
-
timestampUtcMs: op.timestampUtcMs,
|
|
11666
|
-
index: op.index,
|
|
11667
|
-
skip: op.skip,
|
|
11668
|
-
hash: op.hash,
|
|
11669
|
-
action: op.action,
|
|
11670
|
-
sourceRemote: op.sourceRemote
|
|
11671
|
-
}));
|
|
11672
|
-
const insertedOps = await trx.insertInto("operation_index_operations").values(operationRows).returning("ordinal").execute();
|
|
11673
|
-
operationOrdinals = insertedOps.map((row) => row.ordinal);
|
|
11674
|
-
resultOrdinals = operationOrdinals;
|
|
11675
|
-
}
|
|
11676
|
-
if (memberships.length > 0) {
|
|
11677
|
-
for (const m of memberships) {
|
|
11678
|
-
const ordinal = operationOrdinals[m.operationIndex];
|
|
11679
|
-
await trx.insertInto("document_collections").values({
|
|
11680
|
-
documentId: m.documentId,
|
|
11681
|
-
collectionId: m.collectionId,
|
|
11682
|
-
joinedOrdinal: BigInt(ordinal),
|
|
11683
|
-
leftOrdinal: null
|
|
11684
|
-
}).onConflict((oc) => oc.columns(["documentId", "collectionId"]).doUpdateSet({
|
|
11685
|
-
joinedOrdinal: BigInt(ordinal),
|
|
11686
|
-
leftOrdinal: null
|
|
11687
|
-
})).execute();
|
|
11688
|
-
}
|
|
11712
|
+
}).onConflict((oc) => oc.columns(["documentId", "collectionId"]).doUpdateSet({
|
|
11713
|
+
joinedOrdinal: BigInt(ordinal),
|
|
11714
|
+
leftOrdinal: null
|
|
11715
|
+
})).execute();
|
|
11689
11716
|
}
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
}
|
|
11717
|
+
}
|
|
11718
|
+
if (removals.length > 0) {
|
|
11719
|
+
for (const r of removals) {
|
|
11720
|
+
const ordinal = operationOrdinals[r.operationIndex];
|
|
11721
|
+
await trx.updateTable("document_collections").set({
|
|
11722
|
+
leftOrdinal: BigInt(ordinal)
|
|
11723
|
+
}).where("collectionId", "=", r.collectionId).where("documentId", "=", r.documentId).where("leftOrdinal", "is", null).execute();
|
|
11697
11724
|
}
|
|
11698
|
-
}
|
|
11699
|
-
return
|
|
11725
|
+
}
|
|
11726
|
+
return operationOrdinals;
|
|
11700
11727
|
}
|
|
11701
11728
|
async find(collectionId, cursor, view, paging, signal) {
|
|
11702
11729
|
if (signal?.aborted) {
|
|
11703
11730
|
throw new Error("Operation aborted");
|
|
11704
11731
|
}
|
|
11705
|
-
let query = this.
|
|
11732
|
+
let query = this.queryExecutor.selectFrom("operation_index_operations as oi").innerJoin("document_collections as dc", "oi.documentId", "dc.documentId").selectAll("oi").select(["dc.documentId", "dc.collectionId"]).where("dc.collectionId", "=", collectionId).where(sql`(dc."leftOrdinal" IS NULL OR oi.ordinal < dc."leftOrdinal")`).orderBy("oi.ordinal", "asc");
|
|
11706
11733
|
if (cursor !== undefined) {
|
|
11707
11734
|
query = query.where("oi.ordinal", ">", cursor);
|
|
11708
11735
|
}
|
|
@@ -11744,7 +11771,7 @@ class KyselyOperationIndex {
|
|
|
11744
11771
|
if (signal?.aborted) {
|
|
11745
11772
|
throw new Error("Operation aborted");
|
|
11746
11773
|
}
|
|
11747
|
-
let query = this.
|
|
11774
|
+
let query = this.queryExecutor.selectFrom("operation_index_operations").selectAll().where("documentId", "=", documentId).orderBy("ordinal", "asc");
|
|
11748
11775
|
if (view?.branch) {
|
|
11749
11776
|
query = query.where("branch", "=", view.branch);
|
|
11750
11777
|
}
|
|
@@ -11780,7 +11807,7 @@ class KyselyOperationIndex {
|
|
|
11780
11807
|
if (signal?.aborted) {
|
|
11781
11808
|
throw new Error("Operation aborted");
|
|
11782
11809
|
}
|
|
11783
|
-
let query = this.
|
|
11810
|
+
let query = this.queryExecutor.selectFrom("operation_index_operations").selectAll().where("ordinal", ">", ordinal).orderBy("ordinal", "asc");
|
|
11784
11811
|
if (paging?.cursor) {
|
|
11785
11812
|
const cursorOrdinal = Number.parseInt(paging.cursor, 10);
|
|
11786
11813
|
query = query.where("ordinal", ">", cursorOrdinal);
|
|
@@ -11845,14 +11872,14 @@ class KyselyOperationIndex {
|
|
|
11845
11872
|
if (signal?.aborted) {
|
|
11846
11873
|
throw new Error("Operation aborted");
|
|
11847
11874
|
}
|
|
11848
|
-
const result = await this.
|
|
11875
|
+
const result = await this.queryExecutor.selectFrom("operation_index_operations as oi").innerJoin("document_collections as dc", "oi.documentId", "dc.documentId").select("oi.timestampUtcMs").where("dc.collectionId", "=", collectionId).where(sql`(dc."leftOrdinal" IS NULL OR oi.ordinal < dc."leftOrdinal")`).orderBy("oi.ordinal", "desc").limit(1).executeTakeFirst();
|
|
11849
11876
|
return result?.timestampUtcMs ?? null;
|
|
11850
11877
|
}
|
|
11851
11878
|
async getCollectionsForDocuments(documentIds) {
|
|
11852
11879
|
if (documentIds.length === 0) {
|
|
11853
11880
|
return {};
|
|
11854
11881
|
}
|
|
11855
|
-
const rows = await this.
|
|
11882
|
+
const rows = await this.queryExecutor.selectFrom("document_collections").select(["documentId", "collectionId"]).where("documentId", "in", documentIds).where("leftOrdinal", "is", null).execute();
|
|
11856
11883
|
const result = {};
|
|
11857
11884
|
for (const row of rows) {
|
|
11858
11885
|
if (!(row.documentId in result)) {
|
|
@@ -11906,6 +11933,10 @@ class RingBuffer {
|
|
|
11906
11933
|
return this.size;
|
|
11907
11934
|
}
|
|
11908
11935
|
}
|
|
11936
|
+
function extractModuleVersion(doc) {
|
|
11937
|
+
const v = doc.state.document.version;
|
|
11938
|
+
return v === 0 ? undefined : v;
|
|
11939
|
+
}
|
|
11909
11940
|
|
|
11910
11941
|
class KyselyWriteCache {
|
|
11911
11942
|
streams;
|
|
@@ -11926,6 +11957,12 @@ class KyselyWriteCache {
|
|
|
11926
11957
|
this.streams = new Map;
|
|
11927
11958
|
this.lruTracker = new LRUTracker;
|
|
11928
11959
|
}
|
|
11960
|
+
withScopedStores(operationStore, keyframeStore) {
|
|
11961
|
+
const scoped = new KyselyWriteCache(keyframeStore, operationStore, this.registry, this.config);
|
|
11962
|
+
scoped.streams = this.streams;
|
|
11963
|
+
scoped.lruTracker = this.lruTracker;
|
|
11964
|
+
return scoped;
|
|
11965
|
+
}
|
|
11929
11966
|
async startup() {
|
|
11930
11967
|
return Promise.resolve();
|
|
11931
11968
|
}
|
|
@@ -12064,7 +12101,7 @@ class KyselyWriteCache {
|
|
|
12064
12101
|
throw new Error(`Failed to rebuild document ${documentId}: CREATE_DOCUMENT action missing model in input`);
|
|
12065
12102
|
}
|
|
12066
12103
|
document2 = createDocumentFromAction(documentCreateAction);
|
|
12067
|
-
|
|
12104
|
+
let docModule = this.registry.getModule(documentType, extractModuleVersion(document2));
|
|
12068
12105
|
const docScopeOps = await this.operationStore.getSince(documentId, "document", branch, 0, undefined, undefined, signal);
|
|
12069
12106
|
for (const operation of docScopeOps.results) {
|
|
12070
12107
|
if (operation.index === 0) {
|
|
@@ -12073,6 +12110,7 @@ class KyselyWriteCache {
|
|
|
12073
12110
|
if (operation.action.type === "UPGRADE_DOCUMENT") {
|
|
12074
12111
|
const upgradeAction = operation.action;
|
|
12075
12112
|
document2 = applyUpgradeDocumentAction(document2, upgradeAction);
|
|
12113
|
+
docModule = this.registry.getModule(documentType, extractModuleVersion(document2));
|
|
12076
12114
|
} else if (operation.action.type === "DELETE_DOCUMENT") {
|
|
12077
12115
|
applyDeleteDocumentAction(document2, operation.action);
|
|
12078
12116
|
} else {
|
|
@@ -12084,7 +12122,7 @@ class KyselyWriteCache {
|
|
|
12084
12122
|
}
|
|
12085
12123
|
}
|
|
12086
12124
|
}
|
|
12087
|
-
const module = this.registry.getModule(documentType);
|
|
12125
|
+
const module = this.registry.getModule(documentType, extractModuleVersion(document2));
|
|
12088
12126
|
let cursor = undefined;
|
|
12089
12127
|
const pageSize = 100;
|
|
12090
12128
|
let hasMorePages;
|
|
@@ -12234,6 +12272,63 @@ class EventBus {
|
|
|
12234
12272
|
}
|
|
12235
12273
|
}
|
|
12236
12274
|
|
|
12275
|
+
class DefaultExecutionScope {
|
|
12276
|
+
operationStore;
|
|
12277
|
+
operationIndex;
|
|
12278
|
+
writeCache;
|
|
12279
|
+
documentMetaCache;
|
|
12280
|
+
collectionMembershipCache;
|
|
12281
|
+
constructor(operationStore, operationIndex, writeCache, documentMetaCache, collectionMembershipCache) {
|
|
12282
|
+
this.operationStore = operationStore;
|
|
12283
|
+
this.operationIndex = operationIndex;
|
|
12284
|
+
this.writeCache = writeCache;
|
|
12285
|
+
this.documentMetaCache = documentMetaCache;
|
|
12286
|
+
this.collectionMembershipCache = collectionMembershipCache;
|
|
12287
|
+
}
|
|
12288
|
+
async run(fn) {
|
|
12289
|
+
return fn({
|
|
12290
|
+
operationStore: this.operationStore,
|
|
12291
|
+
operationIndex: this.operationIndex,
|
|
12292
|
+
writeCache: this.writeCache,
|
|
12293
|
+
documentMetaCache: this.documentMetaCache,
|
|
12294
|
+
collectionMembershipCache: this.collectionMembershipCache
|
|
12295
|
+
});
|
|
12296
|
+
}
|
|
12297
|
+
}
|
|
12298
|
+
|
|
12299
|
+
class KyselyExecutionScope {
|
|
12300
|
+
db;
|
|
12301
|
+
operationStore;
|
|
12302
|
+
operationIndex;
|
|
12303
|
+
keyframeStore;
|
|
12304
|
+
writeCache;
|
|
12305
|
+
documentMetaCache;
|
|
12306
|
+
collectionMembershipCache;
|
|
12307
|
+
constructor(db, operationStore, operationIndex, keyframeStore, writeCache, documentMetaCache, collectionMembershipCache) {
|
|
12308
|
+
this.db = db;
|
|
12309
|
+
this.operationStore = operationStore;
|
|
12310
|
+
this.operationIndex = operationIndex;
|
|
12311
|
+
this.keyframeStore = keyframeStore;
|
|
12312
|
+
this.writeCache = writeCache;
|
|
12313
|
+
this.documentMetaCache = documentMetaCache;
|
|
12314
|
+
this.collectionMembershipCache = collectionMembershipCache;
|
|
12315
|
+
}
|
|
12316
|
+
async run(fn) {
|
|
12317
|
+
return this.db.transaction().execute(async (trx) => {
|
|
12318
|
+
const scopedOperationStore = this.operationStore.withTransaction(trx);
|
|
12319
|
+
const scopedOperationIndex = this.operationIndex.withTransaction(trx);
|
|
12320
|
+
const scopedKeyframeStore = this.keyframeStore.withTransaction(trx);
|
|
12321
|
+
return fn({
|
|
12322
|
+
operationStore: scopedOperationStore,
|
|
12323
|
+
operationIndex: scopedOperationIndex,
|
|
12324
|
+
writeCache: this.writeCache.withScopedStores(scopedOperationStore, scopedKeyframeStore),
|
|
12325
|
+
documentMetaCache: this.documentMetaCache.withScopedStore(scopedOperationStore),
|
|
12326
|
+
collectionMembershipCache: this.collectionMembershipCache.withScopedIndex(scopedOperationIndex)
|
|
12327
|
+
});
|
|
12328
|
+
});
|
|
12329
|
+
}
|
|
12330
|
+
}
|
|
12331
|
+
|
|
12237
12332
|
class DocumentModelRegistry {
|
|
12238
12333
|
modules = [];
|
|
12239
12334
|
manifests = [];
|
|
@@ -12693,37 +12788,29 @@ function driveCollectionId(branch, driveId) {
|
|
|
12693
12788
|
}
|
|
12694
12789
|
|
|
12695
12790
|
class DocumentActionHandler {
|
|
12696
|
-
writeCache;
|
|
12697
|
-
operationStore;
|
|
12698
|
-
documentMetaCache;
|
|
12699
|
-
collectionMembershipCache;
|
|
12700
12791
|
registry;
|
|
12701
12792
|
logger;
|
|
12702
|
-
constructor(
|
|
12703
|
-
this.writeCache = writeCache;
|
|
12704
|
-
this.operationStore = operationStore;
|
|
12705
|
-
this.documentMetaCache = documentMetaCache;
|
|
12706
|
-
this.collectionMembershipCache = collectionMembershipCache;
|
|
12793
|
+
constructor(registry, logger2) {
|
|
12707
12794
|
this.registry = registry;
|
|
12708
12795
|
this.logger = logger2;
|
|
12709
12796
|
}
|
|
12710
|
-
async execute(job, action, startTime, indexTxn, skip = 0, sourceRemote = "") {
|
|
12797
|
+
async execute(job, action, startTime, indexTxn, stores, skip = 0, sourceRemote = "") {
|
|
12711
12798
|
switch (action.type) {
|
|
12712
12799
|
case "CREATE_DOCUMENT":
|
|
12713
|
-
return this.executeCreate(job, action, startTime, indexTxn, skip, sourceRemote);
|
|
12800
|
+
return this.executeCreate(job, action, startTime, indexTxn, stores, skip, sourceRemote);
|
|
12714
12801
|
case "DELETE_DOCUMENT":
|
|
12715
|
-
return this.executeDelete(job, action, startTime, indexTxn, sourceRemote);
|
|
12802
|
+
return this.executeDelete(job, action, startTime, indexTxn, stores, sourceRemote);
|
|
12716
12803
|
case "UPGRADE_DOCUMENT":
|
|
12717
|
-
return this.executeUpgrade(job, action, startTime, indexTxn, skip, sourceRemote);
|
|
12804
|
+
return this.executeUpgrade(job, action, startTime, indexTxn, stores, skip, sourceRemote);
|
|
12718
12805
|
case "ADD_RELATIONSHIP":
|
|
12719
|
-
return this.executeAddRelationship(job, action, startTime, indexTxn, sourceRemote);
|
|
12806
|
+
return this.executeAddRelationship(job, action, startTime, indexTxn, stores, sourceRemote);
|
|
12720
12807
|
case "REMOVE_RELATIONSHIP":
|
|
12721
|
-
return this.executeRemoveRelationship(job, action, startTime, indexTxn, sourceRemote);
|
|
12808
|
+
return this.executeRemoveRelationship(job, action, startTime, indexTxn, stores, sourceRemote);
|
|
12722
12809
|
default:
|
|
12723
12810
|
return buildErrorResult(job, new Error(`Unknown document action type: ${action.type}`), startTime);
|
|
12724
12811
|
}
|
|
12725
12812
|
}
|
|
12726
|
-
async executeCreate(job, action, startTime, indexTxn, skip = 0, sourceRemote = "") {
|
|
12813
|
+
async executeCreate(job, action, startTime, indexTxn, stores, skip = 0, sourceRemote = "") {
|
|
12727
12814
|
if (job.scope !== "document") {
|
|
12728
12815
|
return {
|
|
12729
12816
|
job,
|
|
@@ -12743,12 +12830,12 @@ class DocumentActionHandler {
|
|
|
12743
12830
|
...document2.state
|
|
12744
12831
|
};
|
|
12745
12832
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12746
|
-
const writeError = await this.writeOperationToStore(document2.header.id, document2.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
12833
|
+
const writeError = await this.writeOperationToStore(document2.header.id, document2.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12747
12834
|
if (writeError !== null) {
|
|
12748
12835
|
return writeError;
|
|
12749
12836
|
}
|
|
12750
12837
|
updateDocumentRevision(document2, job.scope, operation.index);
|
|
12751
|
-
|
|
12838
|
+
stores.writeCache.putState(document2.header.id, job.scope, job.branch, operation.index, document2);
|
|
12752
12839
|
indexTxn.write([
|
|
12753
12840
|
{
|
|
12754
12841
|
...operation,
|
|
@@ -12764,14 +12851,14 @@ class DocumentActionHandler {
|
|
|
12764
12851
|
indexTxn.createCollection(collectionId);
|
|
12765
12852
|
indexTxn.addToCollection(collectionId, document2.header.id);
|
|
12766
12853
|
}
|
|
12767
|
-
|
|
12854
|
+
stores.documentMetaCache.putDocumentMeta(document2.header.id, job.branch, {
|
|
12768
12855
|
state: document2.state.document,
|
|
12769
12856
|
documentType: document2.header.documentType,
|
|
12770
12857
|
documentScopeRevision: 1
|
|
12771
12858
|
});
|
|
12772
12859
|
return buildSuccessResult(job, operation, document2.header.id, document2.header.documentType, resultingState, startTime);
|
|
12773
12860
|
}
|
|
12774
|
-
async executeDelete(job, action, startTime, indexTxn, sourceRemote = "") {
|
|
12861
|
+
async executeDelete(job, action, startTime, indexTxn, stores, sourceRemote = "") {
|
|
12775
12862
|
const input = action.input;
|
|
12776
12863
|
if (!input.documentId) {
|
|
12777
12864
|
return buildErrorResult(job, new Error("DELETE_DOCUMENT action requires a documentId in input"), startTime);
|
|
@@ -12779,7 +12866,7 @@ class DocumentActionHandler {
|
|
|
12779
12866
|
const documentId = input.documentId;
|
|
12780
12867
|
let document2;
|
|
12781
12868
|
try {
|
|
12782
|
-
document2 = await
|
|
12869
|
+
document2 = await stores.writeCache.getState(documentId, job.scope, job.branch);
|
|
12783
12870
|
} catch (error) {
|
|
12784
12871
|
return buildErrorResult(job, new Error(`Failed to fetch document before deletion: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
12785
12872
|
}
|
|
@@ -12799,12 +12886,12 @@ class DocumentActionHandler {
|
|
|
12799
12886
|
document: document2.state.document
|
|
12800
12887
|
};
|
|
12801
12888
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12802
|
-
const writeError = await this.writeOperationToStore(documentId, document2.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
12889
|
+
const writeError = await this.writeOperationToStore(documentId, document2.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12803
12890
|
if (writeError !== null) {
|
|
12804
12891
|
return writeError;
|
|
12805
12892
|
}
|
|
12806
12893
|
updateDocumentRevision(document2, job.scope, operation.index);
|
|
12807
|
-
|
|
12894
|
+
stores.writeCache.putState(documentId, job.scope, job.branch, operation.index, document2);
|
|
12808
12895
|
indexTxn.write([
|
|
12809
12896
|
{
|
|
12810
12897
|
...operation,
|
|
@@ -12815,14 +12902,14 @@ class DocumentActionHandler {
|
|
|
12815
12902
|
sourceRemote
|
|
12816
12903
|
}
|
|
12817
12904
|
]);
|
|
12818
|
-
|
|
12905
|
+
stores.documentMetaCache.putDocumentMeta(documentId, job.branch, {
|
|
12819
12906
|
state: document2.state.document,
|
|
12820
12907
|
documentType: document2.header.documentType,
|
|
12821
12908
|
documentScopeRevision: operation.index + 1
|
|
12822
12909
|
});
|
|
12823
12910
|
return buildSuccessResult(job, operation, documentId, document2.header.documentType, resultingState, startTime);
|
|
12824
12911
|
}
|
|
12825
|
-
async executeUpgrade(job, action, startTime, indexTxn, skip = 0, sourceRemote = "") {
|
|
12912
|
+
async executeUpgrade(job, action, startTime, indexTxn, stores, skip = 0, sourceRemote = "") {
|
|
12826
12913
|
const input = action.input;
|
|
12827
12914
|
if (!input.documentId) {
|
|
12828
12915
|
return buildErrorResult(job, new Error("UPGRADE_DOCUMENT action requires a documentId in input"), startTime);
|
|
@@ -12832,7 +12919,7 @@ class DocumentActionHandler {
|
|
|
12832
12919
|
const toVersion = input.toVersion;
|
|
12833
12920
|
let document2;
|
|
12834
12921
|
try {
|
|
12835
|
-
document2 = await
|
|
12922
|
+
document2 = await stores.writeCache.getState(documentId, job.scope, job.branch);
|
|
12836
12923
|
} catch (error) {
|
|
12837
12924
|
return buildErrorResult(job, new Error(`Failed to fetch document for upgrade: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
12838
12925
|
}
|
|
@@ -12873,12 +12960,12 @@ class DocumentActionHandler {
|
|
|
12873
12960
|
...document2.state
|
|
12874
12961
|
};
|
|
12875
12962
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12876
|
-
const writeError = await this.writeOperationToStore(documentId, document2.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
12963
|
+
const writeError = await this.writeOperationToStore(documentId, document2.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12877
12964
|
if (writeError !== null) {
|
|
12878
12965
|
return writeError;
|
|
12879
12966
|
}
|
|
12880
12967
|
updateDocumentRevision(document2, job.scope, operation.index);
|
|
12881
|
-
|
|
12968
|
+
stores.writeCache.putState(documentId, job.scope, job.branch, operation.index, document2);
|
|
12882
12969
|
indexTxn.write([
|
|
12883
12970
|
{
|
|
12884
12971
|
...operation,
|
|
@@ -12889,14 +12976,14 @@ class DocumentActionHandler {
|
|
|
12889
12976
|
sourceRemote
|
|
12890
12977
|
}
|
|
12891
12978
|
]);
|
|
12892
|
-
|
|
12979
|
+
stores.documentMetaCache.putDocumentMeta(documentId, job.branch, {
|
|
12893
12980
|
state: document2.state.document,
|
|
12894
12981
|
documentType: document2.header.documentType,
|
|
12895
12982
|
documentScopeRevision: operation.index + 1
|
|
12896
12983
|
});
|
|
12897
12984
|
return buildSuccessResult(job, operation, documentId, document2.header.documentType, resultingState, startTime);
|
|
12898
12985
|
}
|
|
12899
|
-
async executeAddRelationship(job, action, startTime, indexTxn, sourceRemote = "") {
|
|
12986
|
+
async executeAddRelationship(job, action, startTime, indexTxn, stores, sourceRemote = "") {
|
|
12900
12987
|
if (job.scope !== "document") {
|
|
12901
12988
|
return buildErrorResult(job, new Error(`ADD_RELATIONSHIP must be in "document" scope, got "${job.scope}"`), startTime);
|
|
12902
12989
|
}
|
|
@@ -12909,7 +12996,7 @@ class DocumentActionHandler {
|
|
|
12909
12996
|
}
|
|
12910
12997
|
let sourceDoc;
|
|
12911
12998
|
try {
|
|
12912
|
-
sourceDoc = await
|
|
12999
|
+
sourceDoc = await stores.writeCache.getState(input.sourceId, "document", job.branch);
|
|
12913
13000
|
} catch (error) {
|
|
12914
13001
|
return buildErrorResult(job, new Error(`ADD_RELATIONSHIP: source document ${input.sourceId} not found: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
12915
13002
|
}
|
|
@@ -12919,7 +13006,7 @@ class DocumentActionHandler {
|
|
|
12919
13006
|
scope: job.scope,
|
|
12920
13007
|
branch: job.branch
|
|
12921
13008
|
});
|
|
12922
|
-
const writeError = await this.writeOperationToStore(input.sourceId, sourceDoc.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
13009
|
+
const writeError = await this.writeOperationToStore(input.sourceId, sourceDoc.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12923
13010
|
if (writeError !== null) {
|
|
12924
13011
|
return writeError;
|
|
12925
13012
|
}
|
|
@@ -12935,7 +13022,7 @@ class DocumentActionHandler {
|
|
|
12935
13022
|
[job.scope]: scopeState === undefined ? {} : structuredClone(scopeState)
|
|
12936
13023
|
};
|
|
12937
13024
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12938
|
-
|
|
13025
|
+
stores.writeCache.putState(input.sourceId, job.scope, job.branch, operation.index, sourceDoc);
|
|
12939
13026
|
indexTxn.write([
|
|
12940
13027
|
{
|
|
12941
13028
|
...operation,
|
|
@@ -12949,16 +13036,16 @@ class DocumentActionHandler {
|
|
|
12949
13036
|
if (sourceDoc.header.documentType === "powerhouse/document-drive") {
|
|
12950
13037
|
const collectionId = driveCollectionId(job.branch, input.sourceId);
|
|
12951
13038
|
indexTxn.addToCollection(collectionId, input.targetId);
|
|
12952
|
-
|
|
13039
|
+
stores.collectionMembershipCache.invalidate(input.targetId);
|
|
12953
13040
|
}
|
|
12954
|
-
|
|
13041
|
+
stores.documentMetaCache.putDocumentMeta(input.sourceId, job.branch, {
|
|
12955
13042
|
state: sourceDoc.state.document,
|
|
12956
13043
|
documentType: sourceDoc.header.documentType,
|
|
12957
13044
|
documentScopeRevision: operation.index + 1
|
|
12958
13045
|
});
|
|
12959
13046
|
return buildSuccessResult(job, operation, input.sourceId, sourceDoc.header.documentType, resultingState, startTime);
|
|
12960
13047
|
}
|
|
12961
|
-
async executeRemoveRelationship(job, action, startTime, indexTxn, sourceRemote = "") {
|
|
13048
|
+
async executeRemoveRelationship(job, action, startTime, indexTxn, stores, sourceRemote = "") {
|
|
12962
13049
|
if (job.scope !== "document") {
|
|
12963
13050
|
return buildErrorResult(job, new Error(`REMOVE_RELATIONSHIP must be in "document" scope, got "${job.scope}"`), startTime);
|
|
12964
13051
|
}
|
|
@@ -12968,7 +13055,7 @@ class DocumentActionHandler {
|
|
|
12968
13055
|
}
|
|
12969
13056
|
let sourceDoc;
|
|
12970
13057
|
try {
|
|
12971
|
-
sourceDoc = await
|
|
13058
|
+
sourceDoc = await stores.writeCache.getState(input.sourceId, "document", job.branch);
|
|
12972
13059
|
} catch (error) {
|
|
12973
13060
|
return buildErrorResult(job, new Error(`REMOVE_RELATIONSHIP: source document ${input.sourceId} not found: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
12974
13061
|
}
|
|
@@ -12978,7 +13065,7 @@ class DocumentActionHandler {
|
|
|
12978
13065
|
scope: job.scope,
|
|
12979
13066
|
branch: job.branch
|
|
12980
13067
|
});
|
|
12981
|
-
const writeError = await this.writeOperationToStore(input.sourceId, sourceDoc.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
13068
|
+
const writeError = await this.writeOperationToStore(input.sourceId, sourceDoc.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12982
13069
|
if (writeError !== null) {
|
|
12983
13070
|
return writeError;
|
|
12984
13071
|
}
|
|
@@ -12994,7 +13081,7 @@ class DocumentActionHandler {
|
|
|
12994
13081
|
[job.scope]: scopeState === undefined ? {} : structuredClone(scopeState)
|
|
12995
13082
|
};
|
|
12996
13083
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12997
|
-
|
|
13084
|
+
stores.writeCache.putState(input.sourceId, job.scope, job.branch, operation.index, sourceDoc);
|
|
12998
13085
|
indexTxn.write([
|
|
12999
13086
|
{
|
|
13000
13087
|
...operation,
|
|
@@ -13008,24 +13095,24 @@ class DocumentActionHandler {
|
|
|
13008
13095
|
if (sourceDoc.header.documentType === "powerhouse/document-drive") {
|
|
13009
13096
|
const collectionId = driveCollectionId(job.branch, input.sourceId);
|
|
13010
13097
|
indexTxn.removeFromCollection(collectionId, input.targetId);
|
|
13011
|
-
|
|
13098
|
+
stores.collectionMembershipCache.invalidate(input.targetId);
|
|
13012
13099
|
}
|
|
13013
|
-
|
|
13100
|
+
stores.documentMetaCache.putDocumentMeta(input.sourceId, job.branch, {
|
|
13014
13101
|
state: sourceDoc.state.document,
|
|
13015
13102
|
documentType: sourceDoc.header.documentType,
|
|
13016
13103
|
documentScopeRevision: operation.index + 1
|
|
13017
13104
|
});
|
|
13018
13105
|
return buildSuccessResult(job, operation, input.sourceId, sourceDoc.header.documentType, resultingState, startTime);
|
|
13019
13106
|
}
|
|
13020
|
-
async writeOperationToStore(documentId, documentType, scope, branch, operation, job, startTime) {
|
|
13107
|
+
async writeOperationToStore(documentId, documentType, scope, branch, operation, job, startTime, stores) {
|
|
13021
13108
|
try {
|
|
13022
|
-
await
|
|
13109
|
+
await stores.operationStore.apply(documentId, documentType, scope, branch, operation.index, (txn) => {
|
|
13023
13110
|
txn.addOperations(operation);
|
|
13024
13111
|
});
|
|
13025
13112
|
return null;
|
|
13026
13113
|
} catch (error) {
|
|
13027
13114
|
this.logger.error("Error writing @Operation to IOperationStore: @Error", operation, error);
|
|
13028
|
-
|
|
13115
|
+
stores.writeCache.invalidate(documentId, scope, branch);
|
|
13029
13116
|
return {
|
|
13030
13117
|
job,
|
|
13031
13118
|
success: false,
|
|
@@ -13114,7 +13201,8 @@ class SimpleJobExecutor {
|
|
|
13114
13201
|
config;
|
|
13115
13202
|
signatureVerifierModule;
|
|
13116
13203
|
documentActionHandler;
|
|
13117
|
-
|
|
13204
|
+
executionScope;
|
|
13205
|
+
constructor(logger2, registry, operationStore, eventBus, writeCache, operationIndex, documentMetaCache, collectionMembershipCache, config, signatureVerifier, executionScope) {
|
|
13118
13206
|
this.logger = logger2;
|
|
13119
13207
|
this.registry = registry;
|
|
13120
13208
|
this.operationStore = operationStore;
|
|
@@ -13131,71 +13219,101 @@ class SimpleJobExecutor {
|
|
|
13131
13219
|
retryMaxDelayMs: config.retryMaxDelayMs ?? 5000
|
|
13132
13220
|
};
|
|
13133
13221
|
this.signatureVerifierModule = new SignatureVerifier(signatureVerifier);
|
|
13134
|
-
this.documentActionHandler = new DocumentActionHandler(
|
|
13222
|
+
this.documentActionHandler = new DocumentActionHandler(registry, logger2);
|
|
13223
|
+
this.executionScope = executionScope ?? new DefaultExecutionScope(operationStore, operationIndex, writeCache, documentMetaCache, collectionMembershipCache);
|
|
13135
13224
|
}
|
|
13136
13225
|
async executeJob(job) {
|
|
13137
13226
|
const startTime = Date.now();
|
|
13138
|
-
const
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13227
|
+
const touchedCacheEntries = [];
|
|
13228
|
+
let pendingEvent;
|
|
13229
|
+
let result;
|
|
13230
|
+
try {
|
|
13231
|
+
result = await this.executionScope.run(async (stores) => {
|
|
13232
|
+
const indexTxn = stores.operationIndex.start();
|
|
13233
|
+
if (job.kind === "load") {
|
|
13234
|
+
const loadResult = await this.executeLoadJob(job, startTime, indexTxn, stores);
|
|
13235
|
+
if (loadResult.success && loadResult.operationsWithContext) {
|
|
13236
|
+
for (const owc of loadResult.operationsWithContext) {
|
|
13237
|
+
touchedCacheEntries.push({
|
|
13238
|
+
documentId: owc.context.documentId,
|
|
13239
|
+
scope: owc.context.scope,
|
|
13240
|
+
branch: owc.context.branch
|
|
13241
|
+
});
|
|
13242
|
+
}
|
|
13243
|
+
const ordinals2 = await stores.operationIndex.commit(indexTxn);
|
|
13244
|
+
for (let i = 0;i < loadResult.operationsWithContext.length; i++) {
|
|
13245
|
+
loadResult.operationsWithContext[i].context.ordinal = ordinals2[i];
|
|
13246
|
+
}
|
|
13247
|
+
const collectionMemberships = loadResult.operationsWithContext.length > 0 ? await this.getCollectionMembershipsForOperations(loadResult.operationsWithContext, stores) : {};
|
|
13248
|
+
pendingEvent = {
|
|
13249
|
+
jobId: job.id,
|
|
13250
|
+
operations: loadResult.operationsWithContext,
|
|
13251
|
+
jobMeta: job.meta,
|
|
13252
|
+
collectionMemberships
|
|
13253
|
+
};
|
|
13254
|
+
}
|
|
13255
|
+
return loadResult;
|
|
13256
|
+
}
|
|
13257
|
+
const actionResult = await this.processActions(job, job.actions, startTime, indexTxn, stores);
|
|
13258
|
+
if (!actionResult.success) {
|
|
13259
|
+
return {
|
|
13260
|
+
job,
|
|
13261
|
+
success: false,
|
|
13262
|
+
error: actionResult.error,
|
|
13263
|
+
duration: Date.now() - startTime
|
|
13264
|
+
};
|
|
13265
|
+
}
|
|
13266
|
+
if (actionResult.operationsWithContext.length > 0) {
|
|
13267
|
+
for (const owc of actionResult.operationsWithContext) {
|
|
13268
|
+
touchedCacheEntries.push({
|
|
13269
|
+
documentId: owc.context.documentId,
|
|
13270
|
+
scope: owc.context.scope,
|
|
13271
|
+
branch: owc.context.branch
|
|
13272
|
+
});
|
|
13273
|
+
}
|
|
13274
|
+
}
|
|
13275
|
+
const ordinals = await stores.operationIndex.commit(indexTxn);
|
|
13276
|
+
if (actionResult.operationsWithContext.length > 0) {
|
|
13277
|
+
for (let i = 0;i < actionResult.operationsWithContext.length; i++) {
|
|
13278
|
+
actionResult.operationsWithContext[i].context.ordinal = ordinals[i];
|
|
13279
|
+
}
|
|
13280
|
+
const collectionMemberships = await this.getCollectionMembershipsForOperations(actionResult.operationsWithContext, stores);
|
|
13281
|
+
pendingEvent = {
|
|
13282
|
+
jobId: job.id,
|
|
13283
|
+
operations: actionResult.operationsWithContext,
|
|
13284
|
+
jobMeta: job.meta,
|
|
13285
|
+
collectionMemberships
|
|
13286
|
+
};
|
|
13287
|
+
}
|
|
13288
|
+
return {
|
|
13289
|
+
job,
|
|
13290
|
+
success: true,
|
|
13291
|
+
operations: actionResult.generatedOperations,
|
|
13292
|
+
operationsWithContext: actionResult.operationsWithContext,
|
|
13293
|
+
duration: Date.now() - startTime
|
|
13152
13294
|
};
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13295
|
+
});
|
|
13296
|
+
} catch (error) {
|
|
13297
|
+
for (const entry of touchedCacheEntries) {
|
|
13298
|
+
this.writeCache.invalidate(entry.documentId, entry.scope, entry.branch);
|
|
13299
|
+
this.documentMetaCache.invalidate(entry.documentId, entry.branch);
|
|
13156
13300
|
}
|
|
13157
|
-
|
|
13158
|
-
}
|
|
13159
|
-
const result = await this.processActions(job, job.actions, startTime, indexTxn);
|
|
13160
|
-
if (!result.success) {
|
|
13161
|
-
return {
|
|
13162
|
-
job,
|
|
13163
|
-
success: false,
|
|
13164
|
-
error: result.error,
|
|
13165
|
-
duration: Date.now() - startTime
|
|
13166
|
-
};
|
|
13301
|
+
throw error;
|
|
13167
13302
|
}
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
result.operationsWithContext[i].context.ordinal = ordinals[i];
|
|
13172
|
-
}
|
|
13173
|
-
const collectionMemberships = await this.getCollectionMembershipsForOperations(result.operationsWithContext);
|
|
13174
|
-
const event = {
|
|
13175
|
-
jobId: job.id,
|
|
13176
|
-
operations: result.operationsWithContext,
|
|
13177
|
-
jobMeta: job.meta,
|
|
13178
|
-
collectionMemberships
|
|
13179
|
-
};
|
|
13180
|
-
this.eventBus.emit(ReactorEventTypes.JOB_WRITE_READY, event).catch((error) => {
|
|
13181
|
-
this.logger.error("Failed to emit JOB_WRITE_READY event: @Event : @Error", event, error);
|
|
13303
|
+
if (pendingEvent) {
|
|
13304
|
+
this.eventBus.emit(ReactorEventTypes.JOB_WRITE_READY, pendingEvent).catch((error) => {
|
|
13305
|
+
this.logger.error("Failed to emit JOB_WRITE_READY event: @Event : @Error", pendingEvent, error);
|
|
13182
13306
|
});
|
|
13183
13307
|
}
|
|
13184
|
-
return
|
|
13185
|
-
job,
|
|
13186
|
-
success: true,
|
|
13187
|
-
operations: result.generatedOperations,
|
|
13188
|
-
operationsWithContext: result.operationsWithContext,
|
|
13189
|
-
duration: Date.now() - startTime
|
|
13190
|
-
};
|
|
13308
|
+
return result;
|
|
13191
13309
|
}
|
|
13192
|
-
async getCollectionMembershipsForOperations(operations) {
|
|
13310
|
+
async getCollectionMembershipsForOperations(operations, stores) {
|
|
13193
13311
|
const documentIds = [
|
|
13194
13312
|
...new Set(operations.map((op) => op.context.documentId))
|
|
13195
13313
|
];
|
|
13196
|
-
return
|
|
13314
|
+
return stores.collectionMembershipCache.getCollectionsForDocuments(documentIds);
|
|
13197
13315
|
}
|
|
13198
|
-
async processActions(job, actions2, startTime, indexTxn, skipValues, sourceOperations, sourceRemote = "") {
|
|
13316
|
+
async processActions(job, actions2, startTime, indexTxn, stores, skipValues, sourceOperations, sourceRemote = "") {
|
|
13199
13317
|
const generatedOperations = [];
|
|
13200
13318
|
const operationsWithContext = [];
|
|
13201
13319
|
try {
|
|
@@ -13213,7 +13331,7 @@ class SimpleJobExecutor {
|
|
|
13213
13331
|
const skip = skipValues?.[actionIndex] ?? 0;
|
|
13214
13332
|
const sourceOperation = sourceOperations?.[actionIndex];
|
|
13215
13333
|
const isDocumentAction = documentScopeActions.includes(action.type);
|
|
13216
|
-
const result = isDocumentAction ? await this.documentActionHandler.execute(job, action, startTime, indexTxn, skip, sourceRemote) : await this.executeRegularAction(job, action, startTime, indexTxn, skip, sourceOperation, sourceRemote);
|
|
13334
|
+
const result = isDocumentAction ? await this.documentActionHandler.execute(job, action, startTime, indexTxn, stores, skip, sourceRemote) : await this.executeRegularAction(job, action, startTime, indexTxn, stores, skip, sourceOperation, sourceRemote);
|
|
13217
13335
|
const error = this.accumulateResultOrReturnError(result, generatedOperations, operationsWithContext);
|
|
13218
13336
|
if (error !== null) {
|
|
13219
13337
|
return {
|
|
@@ -13230,10 +13348,10 @@ class SimpleJobExecutor {
|
|
|
13230
13348
|
operationsWithContext
|
|
13231
13349
|
};
|
|
13232
13350
|
}
|
|
13233
|
-
async executeRegularAction(job, action, startTime, indexTxn, skip = 0, sourceOperation, sourceRemote = "") {
|
|
13351
|
+
async executeRegularAction(job, action, startTime, indexTxn, stores, skip = 0, sourceOperation, sourceRemote = "") {
|
|
13234
13352
|
let docMeta;
|
|
13235
13353
|
try {
|
|
13236
|
-
docMeta = await
|
|
13354
|
+
docMeta = await stores.documentMetaCache.getDocumentMeta(job.documentId, job.branch);
|
|
13237
13355
|
} catch (error) {
|
|
13238
13356
|
return buildErrorResult(job, error instanceof Error ? error : new Error(String(error)), startTime);
|
|
13239
13357
|
}
|
|
@@ -13241,11 +13359,11 @@ class SimpleJobExecutor {
|
|
|
13241
13359
|
return buildErrorResult(job, new DocumentDeletedError(job.documentId, docMeta.state.deletedAtUtcIso), startTime);
|
|
13242
13360
|
}
|
|
13243
13361
|
if (isUndoRedo(action) || action.type === "PRUNE" || action.type === "NOOP" && skip > 0) {
|
|
13244
|
-
|
|
13362
|
+
stores.writeCache.invalidate(job.documentId, job.scope, job.branch);
|
|
13245
13363
|
}
|
|
13246
13364
|
let document2;
|
|
13247
13365
|
try {
|
|
13248
|
-
document2 = await
|
|
13366
|
+
document2 = await stores.writeCache.getState(job.documentId, job.scope, job.branch);
|
|
13249
13367
|
} catch (error) {
|
|
13250
13368
|
return buildErrorResult(job, error instanceof Error ? error : new Error(String(error)), startTime);
|
|
13251
13369
|
}
|
|
@@ -13296,12 +13414,12 @@ ${error.stack}`;
|
|
|
13296
13414
|
header: updatedDocument.header
|
|
13297
13415
|
});
|
|
13298
13416
|
try {
|
|
13299
|
-
await
|
|
13417
|
+
await stores.operationStore.apply(job.documentId, document2.header.documentType, scope, job.branch, newOperation.index, (txn) => {
|
|
13300
13418
|
txn.addOperations(newOperation);
|
|
13301
13419
|
});
|
|
13302
13420
|
} catch (error) {
|
|
13303
13421
|
this.logger.error("Error writing @Operation to IOperationStore: @Error", newOperation, error);
|
|
13304
|
-
|
|
13422
|
+
stores.writeCache.invalidate(job.documentId, scope, job.branch);
|
|
13305
13423
|
return {
|
|
13306
13424
|
job,
|
|
13307
13425
|
success: false,
|
|
@@ -13313,7 +13431,7 @@ ${error.stack}`;
|
|
|
13313
13431
|
...updatedDocument.header.revision,
|
|
13314
13432
|
[scope]: newOperation.index + 1
|
|
13315
13433
|
};
|
|
13316
|
-
|
|
13434
|
+
stores.writeCache.putState(job.documentId, scope, job.branch, newOperation.index, updatedDocument);
|
|
13317
13435
|
indexTxn.write([
|
|
13318
13436
|
{
|
|
13319
13437
|
...newOperation,
|
|
@@ -13344,13 +13462,13 @@ ${error.stack}`;
|
|
|
13344
13462
|
duration: Date.now() - startTime
|
|
13345
13463
|
};
|
|
13346
13464
|
}
|
|
13347
|
-
async executeLoadJob(job, startTime, indexTxn) {
|
|
13465
|
+
async executeLoadJob(job, startTime, indexTxn, stores) {
|
|
13348
13466
|
if (job.operations.length === 0) {
|
|
13349
13467
|
return buildErrorResult(job, new Error("Load job must include at least one operation"), startTime);
|
|
13350
13468
|
}
|
|
13351
13469
|
let docMeta;
|
|
13352
13470
|
try {
|
|
13353
|
-
docMeta = await
|
|
13471
|
+
docMeta = await stores.documentMetaCache.getDocumentMeta(job.documentId, job.branch);
|
|
13354
13472
|
} catch {}
|
|
13355
13473
|
if (docMeta?.state.isDeleted) {
|
|
13356
13474
|
return buildErrorResult(job, new DocumentDeletedError(job.documentId, docMeta.state.deletedAtUtcIso), startTime);
|
|
@@ -13358,7 +13476,7 @@ ${error.stack}`;
|
|
|
13358
13476
|
const scope = job.scope;
|
|
13359
13477
|
let latestRevision = 0;
|
|
13360
13478
|
try {
|
|
13361
|
-
const revisions = await
|
|
13479
|
+
const revisions = await stores.operationStore.getRevisions(job.documentId, job.branch);
|
|
13362
13480
|
latestRevision = revisions.revision[scope] ?? 0;
|
|
13363
13481
|
} catch {
|
|
13364
13482
|
latestRevision = 0;
|
|
@@ -13374,7 +13492,7 @@ ${error.stack}`;
|
|
|
13374
13492
|
}
|
|
13375
13493
|
let conflictingOps = [];
|
|
13376
13494
|
try {
|
|
13377
|
-
const conflictingResult = await
|
|
13495
|
+
const conflictingResult = await stores.operationStore.getConflicting(job.documentId, scope, job.branch, minIncomingTimestamp);
|
|
13378
13496
|
conflictingOps = conflictingResult.results;
|
|
13379
13497
|
} catch {
|
|
13380
13498
|
conflictingOps = [];
|
|
@@ -13383,7 +13501,7 @@ ${error.stack}`;
|
|
|
13383
13501
|
if (conflictingOps.length > 0) {
|
|
13384
13502
|
const minConflictingIndex = Math.min(...conflictingOps.map((op) => op.index));
|
|
13385
13503
|
try {
|
|
13386
|
-
const allOpsResult = await
|
|
13504
|
+
const allOpsResult = await stores.operationStore.getSince(job.documentId, scope, job.branch, minConflictingIndex - 1);
|
|
13387
13505
|
allOpsFromMinConflictingIndex = allOpsResult.results;
|
|
13388
13506
|
} catch {
|
|
13389
13507
|
allOpsFromMinConflictingIndex = conflictingOps;
|
|
@@ -13444,7 +13562,7 @@ ${error.stack}`;
|
|
|
13444
13562
|
const actions2 = reshuffledOperations.map((operation) => operation.action);
|
|
13445
13563
|
const skipValues = reshuffledOperations.map((operation) => operation.skip);
|
|
13446
13564
|
const effectiveSourceRemote = skipCount > 0 ? "" : job.meta.sourceRemote || "";
|
|
13447
|
-
const result = await this.processActions(job, actions2, startTime, indexTxn, skipValues, reshuffledOperations, effectiveSourceRemote);
|
|
13565
|
+
const result = await this.processActions(job, actions2, startTime, indexTxn, stores, skipValues, reshuffledOperations, effectiveSourceRemote);
|
|
13448
13566
|
if (!result.success) {
|
|
13449
13567
|
return {
|
|
13450
13568
|
job,
|
|
@@ -13453,9 +13571,9 @@ ${error.stack}`;
|
|
|
13453
13571
|
duration: Date.now() - startTime
|
|
13454
13572
|
};
|
|
13455
13573
|
}
|
|
13456
|
-
|
|
13574
|
+
stores.writeCache.invalidate(job.documentId, scope, job.branch);
|
|
13457
13575
|
if (scope === "document") {
|
|
13458
|
-
|
|
13576
|
+
stores.documentMetaCache.invalidate(job.documentId, job.branch);
|
|
13459
13577
|
}
|
|
13460
13578
|
return {
|
|
13461
13579
|
job,
|
|
@@ -14404,14 +14522,23 @@ async function collectAllPages(firstPage, signal) {
|
|
|
14404
14522
|
|
|
14405
14523
|
class KyselyKeyframeStore {
|
|
14406
14524
|
db;
|
|
14525
|
+
trx;
|
|
14407
14526
|
constructor(db) {
|
|
14408
14527
|
this.db = db;
|
|
14409
14528
|
}
|
|
14529
|
+
get queryExecutor() {
|
|
14530
|
+
return this.trx ?? this.db;
|
|
14531
|
+
}
|
|
14532
|
+
withTransaction(trx) {
|
|
14533
|
+
const instance = new KyselyKeyframeStore(this.db);
|
|
14534
|
+
instance.trx = trx;
|
|
14535
|
+
return instance;
|
|
14536
|
+
}
|
|
14410
14537
|
async putKeyframe(documentId, scope, branch, revision, document2, signal) {
|
|
14411
14538
|
if (signal?.aborted) {
|
|
14412
14539
|
throw new Error("Operation aborted");
|
|
14413
14540
|
}
|
|
14414
|
-
await this.
|
|
14541
|
+
await this.queryExecutor.insertInto("Keyframe").values({
|
|
14415
14542
|
documentId,
|
|
14416
14543
|
documentType: document2.header.documentType,
|
|
14417
14544
|
scope,
|
|
@@ -14424,7 +14551,7 @@ class KyselyKeyframeStore {
|
|
|
14424
14551
|
if (signal?.aborted) {
|
|
14425
14552
|
throw new Error("Operation aborted");
|
|
14426
14553
|
}
|
|
14427
|
-
const row = await this.
|
|
14554
|
+
const row = await this.queryExecutor.selectFrom("Keyframe").selectAll().where("documentId", "=", documentId).where("scope", "=", scope).where("branch", "=", branch).where("revision", "<=", targetRevision).orderBy("revision", "desc").limit(1).executeTakeFirst();
|
|
14428
14555
|
if (!row) {
|
|
14429
14556
|
return;
|
|
14430
14557
|
}
|
|
@@ -14433,11 +14560,30 @@ class KyselyKeyframeStore {
|
|
|
14433
14560
|
document: row.document
|
|
14434
14561
|
};
|
|
14435
14562
|
}
|
|
14563
|
+
async listKeyframes(documentId, scope, branch, signal) {
|
|
14564
|
+
if (signal?.aborted) {
|
|
14565
|
+
throw new Error("Operation aborted");
|
|
14566
|
+
}
|
|
14567
|
+
let query = this.queryExecutor.selectFrom("Keyframe").selectAll().where("documentId", "=", documentId).orderBy("revision", "asc");
|
|
14568
|
+
if (scope !== undefined) {
|
|
14569
|
+
query = query.where("scope", "=", scope);
|
|
14570
|
+
}
|
|
14571
|
+
if (branch !== undefined) {
|
|
14572
|
+
query = query.where("branch", "=", branch);
|
|
14573
|
+
}
|
|
14574
|
+
const rows = await query.execute();
|
|
14575
|
+
return rows.map((row) => ({
|
|
14576
|
+
scope: row.scope,
|
|
14577
|
+
branch: row.branch,
|
|
14578
|
+
revision: row.revision,
|
|
14579
|
+
document: row.document
|
|
14580
|
+
}));
|
|
14581
|
+
}
|
|
14436
14582
|
async deleteKeyframes(documentId, scope, branch, signal) {
|
|
14437
14583
|
if (signal?.aborted) {
|
|
14438
14584
|
throw new Error("Operation aborted");
|
|
14439
14585
|
}
|
|
14440
|
-
let query = this.
|
|
14586
|
+
let query = this.queryExecutor.deleteFrom("Keyframe").where("documentId", "=", documentId);
|
|
14441
14587
|
if (scope !== undefined && branch !== undefined) {
|
|
14442
14588
|
query = query.where("scope", "=", scope).where("branch", "=", branch);
|
|
14443
14589
|
} else if (scope !== undefined) {
|
|
@@ -14488,48 +14634,64 @@ class AtomicTransaction {
|
|
|
14488
14634
|
|
|
14489
14635
|
class KyselyOperationStore {
|
|
14490
14636
|
db;
|
|
14637
|
+
trx;
|
|
14491
14638
|
constructor(db) {
|
|
14492
14639
|
this.db = db;
|
|
14493
14640
|
}
|
|
14641
|
+
get queryExecutor() {
|
|
14642
|
+
return this.trx ?? this.db;
|
|
14643
|
+
}
|
|
14644
|
+
withTransaction(trx) {
|
|
14645
|
+
const instance = new KyselyOperationStore(this.db);
|
|
14646
|
+
instance.trx = trx;
|
|
14647
|
+
return instance;
|
|
14648
|
+
}
|
|
14494
14649
|
async apply(documentId, documentType, scope, branch, revision, fn, signal) {
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14650
|
+
if (this.trx) {
|
|
14651
|
+
await this.executeApply(this.trx, documentId, documentType, scope, branch, revision, fn, signal);
|
|
14652
|
+
} else {
|
|
14653
|
+
await this.db.transaction().execute(async (trx) => {
|
|
14654
|
+
await this.executeApply(trx, documentId, documentType, scope, branch, revision, fn, signal);
|
|
14655
|
+
});
|
|
14656
|
+
}
|
|
14657
|
+
}
|
|
14658
|
+
async executeApply(trx, documentId, documentType, scope, branch, revision, fn, signal) {
|
|
14659
|
+
if (signal?.aborted) {
|
|
14660
|
+
throw new Error("Operation aborted");
|
|
14661
|
+
}
|
|
14662
|
+
const latestOp = await trx.selectFrom("Operation").selectAll().where("documentId", "=", documentId).where("scope", "=", scope).where("branch", "=", branch).orderBy("index", "desc").limit(1).executeTakeFirst();
|
|
14663
|
+
const currentRevision = latestOp ? latestOp.index : -1;
|
|
14664
|
+
if (currentRevision !== revision - 1) {
|
|
14665
|
+
throw new RevisionMismatchError(currentRevision + 1, revision);
|
|
14666
|
+
}
|
|
14667
|
+
const atomicTxn = new AtomicTransaction(documentId, documentType, scope, branch, revision);
|
|
14668
|
+
await fn(atomicTxn);
|
|
14669
|
+
const operations = atomicTxn.getOperations();
|
|
14670
|
+
if (operations.length > 0) {
|
|
14671
|
+
let prevOpId = latestOp?.opId || "";
|
|
14672
|
+
for (const op of operations) {
|
|
14673
|
+
op.prevOpId = prevOpId;
|
|
14674
|
+
prevOpId = op.opId;
|
|
14503
14675
|
}
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
prevOpId = op.opId;
|
|
14512
|
-
}
|
|
14513
|
-
try {
|
|
14514
|
-
await trx.insertInto("Operation").values(operations).execute();
|
|
14515
|
-
} catch (error) {
|
|
14516
|
-
if (error instanceof Error) {
|
|
14517
|
-
if (error.message.includes("unique constraint")) {
|
|
14518
|
-
const op = operations[0];
|
|
14519
|
-
throw new DuplicateOperationError(`${op.opId} at index ${op.index} with skip ${op.skip}`);
|
|
14520
|
-
}
|
|
14521
|
-
throw error;
|
|
14676
|
+
try {
|
|
14677
|
+
await trx.insertInto("Operation").values(operations).execute();
|
|
14678
|
+
} catch (error) {
|
|
14679
|
+
if (error instanceof Error) {
|
|
14680
|
+
if (error.message.includes("unique constraint")) {
|
|
14681
|
+
const op = operations[0];
|
|
14682
|
+
throw new DuplicateOperationError(`${op.opId} at index ${op.index} with skip ${op.skip}`);
|
|
14522
14683
|
}
|
|
14523
14684
|
throw error;
|
|
14524
14685
|
}
|
|
14686
|
+
throw error;
|
|
14525
14687
|
}
|
|
14526
|
-
}
|
|
14688
|
+
}
|
|
14527
14689
|
}
|
|
14528
14690
|
async getSince(documentId, scope, branch, revision, filter, paging, signal) {
|
|
14529
14691
|
if (signal?.aborted) {
|
|
14530
14692
|
throw new Error("Operation aborted");
|
|
14531
14693
|
}
|
|
14532
|
-
let query = this.
|
|
14694
|
+
let query = this.queryExecutor.selectFrom("Operation").selectAll().where("documentId", "=", documentId).where("scope", "=", scope).where("branch", "=", branch).where("index", ">", revision).orderBy("index", "asc");
|
|
14533
14695
|
if (filter) {
|
|
14534
14696
|
if (filter.actionTypes && filter.actionTypes.length > 0) {
|
|
14535
14697
|
const actionTypesArray = filter.actionTypes.map((t) => `'${t.replace(/'/g, "''")}'`).join(",");
|
|
@@ -14576,7 +14738,7 @@ class KyselyOperationStore {
|
|
|
14576
14738
|
if (signal?.aborted) {
|
|
14577
14739
|
throw new Error("Operation aborted");
|
|
14578
14740
|
}
|
|
14579
|
-
let query = this.
|
|
14741
|
+
let query = this.queryExecutor.selectFrom("Operation").selectAll().where("id", ">", id).orderBy("id", "asc");
|
|
14580
14742
|
if (paging) {
|
|
14581
14743
|
const cursorValue = Number.parseInt(paging.cursor, 10);
|
|
14582
14744
|
if (cursorValue > 0) {
|
|
@@ -14608,7 +14770,7 @@ class KyselyOperationStore {
|
|
|
14608
14770
|
if (signal?.aborted) {
|
|
14609
14771
|
throw new Error("Operation aborted");
|
|
14610
14772
|
}
|
|
14611
|
-
let query = this.
|
|
14773
|
+
let query = this.queryExecutor.selectFrom("Operation").selectAll().where("documentId", "=", documentId).where("scope", "=", scope).where("branch", "=", branch).where("timestampUtcMs", ">=", new Date(minTimestamp)).orderBy("index", "asc");
|
|
14612
14774
|
if (paging) {
|
|
14613
14775
|
const cursorValue = Number.parseInt(paging.cursor, 10);
|
|
14614
14776
|
if (cursorValue > 0) {
|
|
@@ -14640,7 +14802,7 @@ class KyselyOperationStore {
|
|
|
14640
14802
|
if (signal?.aborted) {
|
|
14641
14803
|
throw new Error("Operation aborted");
|
|
14642
14804
|
}
|
|
14643
|
-
const scopeRevisions = await this.
|
|
14805
|
+
const scopeRevisions = await this.queryExecutor.selectFrom("Operation as o1").select(["o1.scope", "o1.index", "o1.timestampUtcMs"]).where("o1.documentId", "=", documentId).where("o1.branch", "=", branch).where((eb) => eb("o1.index", "=", eb.selectFrom("Operation as o2").select((eb2) => eb2.fn.max("o2.index").as("maxIndex")).where("o2.documentId", "=", eb.ref("o1.documentId")).where("o2.branch", "=", eb.ref("o1.branch")).where("o2.scope", "=", eb.ref("o1.scope")))).execute();
|
|
14644
14806
|
const revision = {};
|
|
14645
14807
|
let latestTimestamp = new Date(0).toISOString();
|
|
14646
14808
|
for (const row of scopeRevisions) {
|
|
@@ -18434,9 +18596,10 @@ class ReactorBuilder {
|
|
|
18434
18596
|
});
|
|
18435
18597
|
await documentMetaCache.startup();
|
|
18436
18598
|
const collectionMembershipCache = new CollectionMembershipCache(operationIndex);
|
|
18599
|
+
const executionScope = new KyselyExecutionScope(database, operationStore, operationIndex, keyframeStore, writeCache, documentMetaCache, collectionMembershipCache);
|
|
18437
18600
|
let executorManager = this.executorManager;
|
|
18438
18601
|
if (!executorManager) {
|
|
18439
|
-
executorManager = new SimpleJobExecutorManager(() => new SimpleJobExecutor(this.logger, documentModelRegistry, operationStore, eventBus, writeCache, operationIndex, documentMetaCache, collectionMembershipCache, this.executorConfig, this.signatureVerifier), eventBus, queue, jobTracker, this.logger, resolver);
|
|
18602
|
+
executorManager = new SimpleJobExecutorManager(() => new SimpleJobExecutor(this.logger, documentModelRegistry, operationStore, eventBus, writeCache, operationIndex, documentMetaCache, collectionMembershipCache, this.executorConfig, this.signatureVerifier, executionScope), eventBus, queue, jobTracker, this.logger, resolver);
|
|
18440
18603
|
}
|
|
18441
18604
|
await executorManager.start(this.executorConfig.maxConcurrency ?? 1);
|
|
18442
18605
|
const readModelInstances = Array.from(new Set([...this.readModels]));
|
|
@@ -18567,6 +18730,7 @@ class ReactorClientBuilder {
|
|
|
18567
18730
|
signatureVerifier;
|
|
18568
18731
|
subscriptionManager;
|
|
18569
18732
|
jobAwaiter;
|
|
18733
|
+
documentModelLoader;
|
|
18570
18734
|
withLogger(logger2) {
|
|
18571
18735
|
this.logger = logger2;
|
|
18572
18736
|
return this;
|
|
@@ -18605,6 +18769,10 @@ class ReactorClientBuilder {
|
|
|
18605
18769
|
this.jobAwaiter = jobAwaiter;
|
|
18606
18770
|
return this;
|
|
18607
18771
|
}
|
|
18772
|
+
withDocumentModelLoader(loader) {
|
|
18773
|
+
this.documentModelLoader = loader;
|
|
18774
|
+
return this;
|
|
18775
|
+
}
|
|
18608
18776
|
async build() {
|
|
18609
18777
|
const module = await this.buildModule();
|
|
18610
18778
|
return module.client;
|
|
@@ -18622,6 +18790,9 @@ class ReactorClientBuilder {
|
|
|
18622
18790
|
if (this.signatureVerifier) {
|
|
18623
18791
|
this.reactorBuilder.withSignatureVerifier(this.signatureVerifier);
|
|
18624
18792
|
}
|
|
18793
|
+
if (this.documentModelLoader) {
|
|
18794
|
+
this.reactorBuilder.withDocumentModelLoader(this.documentModelLoader);
|
|
18795
|
+
}
|
|
18625
18796
|
reactorModule = await this.reactorBuilder.buildModule();
|
|
18626
18797
|
reactor = reactorModule.reactor;
|
|
18627
18798
|
eventBus = reactorModule.eventBus;
|
|
@@ -18671,6 +18842,118 @@ function relationalDbToQueryBuilder(query) {
|
|
|
18671
18842
|
withSchema: (schema) => relationalDbToQueryBuilder(query.withSchema(schema))
|
|
18672
18843
|
};
|
|
18673
18844
|
}
|
|
18845
|
+
|
|
18846
|
+
class DocumentIntegrityService {
|
|
18847
|
+
keyframeStore;
|
|
18848
|
+
operationStore;
|
|
18849
|
+
writeCache;
|
|
18850
|
+
documentView;
|
|
18851
|
+
documentModelRegistry;
|
|
18852
|
+
constructor(keyframeStore, operationStore, writeCache, documentView, documentModelRegistry) {
|
|
18853
|
+
this.keyframeStore = keyframeStore;
|
|
18854
|
+
this.operationStore = operationStore;
|
|
18855
|
+
this.writeCache = writeCache;
|
|
18856
|
+
this.documentView = documentView;
|
|
18857
|
+
this.documentModelRegistry = documentModelRegistry;
|
|
18858
|
+
}
|
|
18859
|
+
async validateDocument(documentId, branch = "main", signal) {
|
|
18860
|
+
const keyframeIssues = [];
|
|
18861
|
+
const snapshotIssues = [];
|
|
18862
|
+
const replayCache = new KyselyWriteCache(nullKeyframeStore, this.operationStore, this.documentModelRegistry, {
|
|
18863
|
+
maxDocuments: 1,
|
|
18864
|
+
ringBufferSize: 1,
|
|
18865
|
+
keyframeInterval: Number.MAX_SAFE_INTEGER
|
|
18866
|
+
});
|
|
18867
|
+
const keyframes = await this.keyframeStore.listKeyframes(documentId, undefined, branch, signal);
|
|
18868
|
+
for (const keyframe of keyframes) {
|
|
18869
|
+
if (signal?.aborted) {
|
|
18870
|
+
throw new Error("Operation aborted");
|
|
18871
|
+
}
|
|
18872
|
+
replayCache.invalidate(documentId, keyframe.scope, branch);
|
|
18873
|
+
const replayedDoc = await replayCache.getState(documentId, keyframe.scope, branch, keyframe.revision, signal);
|
|
18874
|
+
const kfHash = hashDocumentStateForScope(keyframe.document, keyframe.scope);
|
|
18875
|
+
const replayHash = hashDocumentStateForScope(replayedDoc, keyframe.scope);
|
|
18876
|
+
if (kfHash !== replayHash) {
|
|
18877
|
+
keyframeIssues.push({
|
|
18878
|
+
scope: keyframe.scope,
|
|
18879
|
+
branch,
|
|
18880
|
+
revision: keyframe.revision,
|
|
18881
|
+
keyframeHash: kfHash,
|
|
18882
|
+
replayedHash: replayHash
|
|
18883
|
+
});
|
|
18884
|
+
}
|
|
18885
|
+
}
|
|
18886
|
+
let currentDoc;
|
|
18887
|
+
try {
|
|
18888
|
+
currentDoc = await this.documentView.get(documentId);
|
|
18889
|
+
} catch {
|
|
18890
|
+
return {
|
|
18891
|
+
documentId,
|
|
18892
|
+
isConsistent: keyframeIssues.length === 0,
|
|
18893
|
+
keyframeIssues,
|
|
18894
|
+
snapshotIssues
|
|
18895
|
+
};
|
|
18896
|
+
}
|
|
18897
|
+
const revisions = await this.operationStore.getRevisions(documentId, branch, signal);
|
|
18898
|
+
const allScopes = Object.keys(revisions.revision);
|
|
18899
|
+
for (const scope of allScopes) {
|
|
18900
|
+
if (scope === "document")
|
|
18901
|
+
continue;
|
|
18902
|
+
replayCache.invalidate(documentId, scope, branch);
|
|
18903
|
+
let replayedDoc;
|
|
18904
|
+
try {
|
|
18905
|
+
replayedDoc = await replayCache.getState(documentId, scope, branch, undefined, signal);
|
|
18906
|
+
} catch {
|
|
18907
|
+
if (signal?.aborted) {
|
|
18908
|
+
throw new Error("Operation aborted");
|
|
18909
|
+
}
|
|
18910
|
+
continue;
|
|
18911
|
+
}
|
|
18912
|
+
const snapshotHash = hashDocumentStateForScope(currentDoc, scope);
|
|
18913
|
+
const replayHash = hashDocumentStateForScope(replayedDoc, scope);
|
|
18914
|
+
if (snapshotHash !== replayHash) {
|
|
18915
|
+
snapshotIssues.push({
|
|
18916
|
+
scope,
|
|
18917
|
+
branch,
|
|
18918
|
+
snapshotHash,
|
|
18919
|
+
replayedHash: replayHash
|
|
18920
|
+
});
|
|
18921
|
+
}
|
|
18922
|
+
}
|
|
18923
|
+
return {
|
|
18924
|
+
documentId,
|
|
18925
|
+
isConsistent: keyframeIssues.length === 0 && snapshotIssues.length === 0,
|
|
18926
|
+
keyframeIssues,
|
|
18927
|
+
snapshotIssues
|
|
18928
|
+
};
|
|
18929
|
+
}
|
|
18930
|
+
async rebuildKeyframes(documentId, branch = "main", signal) {
|
|
18931
|
+
const deleted = await this.keyframeStore.deleteKeyframes(documentId, undefined, branch, signal);
|
|
18932
|
+
return {
|
|
18933
|
+
documentId,
|
|
18934
|
+
keyframesDeleted: deleted,
|
|
18935
|
+
scopesInvalidated: 0
|
|
18936
|
+
};
|
|
18937
|
+
}
|
|
18938
|
+
async rebuildSnapshots(documentId, branch = "main", signal) {
|
|
18939
|
+
const scopes = await this.discoverScopes(documentId, branch, signal);
|
|
18940
|
+
for (const scope of scopes) {
|
|
18941
|
+
if (signal?.aborted) {
|
|
18942
|
+
throw new Error("Operation aborted");
|
|
18943
|
+
}
|
|
18944
|
+
this.writeCache.invalidate(documentId, scope, branch);
|
|
18945
|
+
}
|
|
18946
|
+
return {
|
|
18947
|
+
documentId,
|
|
18948
|
+
keyframesDeleted: 0,
|
|
18949
|
+
scopesInvalidated: scopes.length
|
|
18950
|
+
};
|
|
18951
|
+
}
|
|
18952
|
+
async discoverScopes(documentId, branch, signal) {
|
|
18953
|
+
const revisions = await this.operationStore.getRevisions(documentId, branch, signal);
|
|
18954
|
+
return Object.keys(revisions.revision);
|
|
18955
|
+
}
|
|
18956
|
+
}
|
|
18674
18957
|
var __defProp2, __export2 = (target, all) => {
|
|
18675
18958
|
for (var name in all)
|
|
18676
18959
|
__defProp2(target, name, {
|
|
@@ -18813,7 +19096,7 @@ var __defProp2, __export2 = (target, all) => {
|
|
|
18813
19096
|
}
|
|
18814
19097
|
}
|
|
18815
19098
|
return maxOrdinal;
|
|
18816
|
-
}, SyncStatus, cachedEncoder, LOG2_26, IS_RELATIONAL_DB_PROCESSOR, RelationalDbProcessor;
|
|
19099
|
+
}, SyncStatus, cachedEncoder, LOG2_26, IS_RELATIONAL_DB_PROCESSOR, RelationalDbProcessor, nullKeyframeStore;
|
|
18817
19100
|
var init_src = __esm(() => {
|
|
18818
19101
|
__defProp2 = Object.defineProperty;
|
|
18819
19102
|
byteToHex = [];
|
|
@@ -24073,6 +24356,12 @@ var init_src = __esm(() => {
|
|
|
24073
24356
|
return relationalDbToQueryBuilder(this.relationalDb);
|
|
24074
24357
|
}
|
|
24075
24358
|
};
|
|
24359
|
+
nullKeyframeStore = {
|
|
24360
|
+
putKeyframe: () => Promise.resolve(),
|
|
24361
|
+
findNearestKeyframe: () => Promise.resolve(undefined),
|
|
24362
|
+
listKeyframes: () => Promise.resolve([]),
|
|
24363
|
+
deleteKeyframes: () => Promise.resolve(0)
|
|
24364
|
+
};
|
|
24076
24365
|
});
|
|
24077
24366
|
|
|
24078
24367
|
// ../../packages/reactor-browser/dist/src/index.js
|
|
@@ -24082,6 +24371,7 @@ __export(exports_src, {
|
|
|
24082
24371
|
useVetraPackages: () => useVetraPackages,
|
|
24083
24372
|
useVetraPackageManager: () => useVetraPackageManager,
|
|
24084
24373
|
useUserPermissions: () => useUserPermissions,
|
|
24374
|
+
useUser: () => useUser,
|
|
24085
24375
|
useSupportedDocumentTypesInReactor: () => useSupportedDocumentTypesInReactor,
|
|
24086
24376
|
useSubgraphModules: () => useSubgraphModules,
|
|
24087
24377
|
useSetPHDriveEditorConfig: () => useSetPHDriveEditorConfig,
|
|
@@ -24100,8 +24390,12 @@ __export(exports_src, {
|
|
|
24100
24390
|
useSelectedDocumentId: () => useSelectedDocumentId,
|
|
24101
24391
|
useSelectedDocument: () => useSelectedDocument,
|
|
24102
24392
|
useRevisionHistoryVisible: () => useRevisionHistoryVisible,
|
|
24393
|
+
useRenownInit: () => useRenownInit,
|
|
24394
|
+
useRenownAuth: () => useRenownAuth,
|
|
24395
|
+
useRenown: () => useRenown,
|
|
24103
24396
|
useRelationalQuery: () => useRelationalQuery,
|
|
24104
24397
|
useRelationalDb: () => useRelationalDb,
|
|
24398
|
+
usePendingInstallations: () => usePendingInstallations,
|
|
24105
24399
|
useParentFolderForSelectedNode: () => useParentFolderForSelectedNode,
|
|
24106
24400
|
usePHToast: () => usePHToast,
|
|
24107
24401
|
usePHModal: () => usePHModal,
|
|
@@ -24117,6 +24411,8 @@ __export(exports_src, {
|
|
|
24117
24411
|
useNodeParentFolderById: () => useNodeParentFolderById,
|
|
24118
24412
|
useNodeById: () => useNodeById,
|
|
24119
24413
|
useNodeActions: () => useNodeActions,
|
|
24414
|
+
useLoginStatus: () => useLoginStatus,
|
|
24415
|
+
useLoading: () => useLoading,
|
|
24120
24416
|
useIsExternalControlsEnabled: () => useIsExternalControlsEnabled,
|
|
24121
24417
|
useIsDragAndDropEnabled: () => useIsDragAndDropEnabled,
|
|
24122
24418
|
useInspectorEnabled: () => useInspectorEnabled,
|
|
@@ -24152,6 +24448,8 @@ __export(exports_src, {
|
|
|
24152
24448
|
useDocumentCache: () => useDocumentCache,
|
|
24153
24449
|
useDocumentById: () => useDocumentById,
|
|
24154
24450
|
useDocument: () => useDocument,
|
|
24451
|
+
useDismissedPackages: () => useDismissedPackages,
|
|
24452
|
+
useDid: () => useDid,
|
|
24155
24453
|
useDefaultDriveEditorModule: () => useDefaultDriveEditorModule,
|
|
24156
24454
|
useConnectionStates: () => useConnectionStates,
|
|
24157
24455
|
useConnectionState: () => useConnectionState,
|
|
@@ -24176,6 +24474,7 @@ __export(exports_src, {
|
|
|
24176
24474
|
setPHDriveEditorConfig: () => setPHDriveEditorConfig,
|
|
24177
24475
|
setPHDocumentEditorConfigByKey: () => setPHDocumentEditorConfigByKey,
|
|
24178
24476
|
setPHDocumentEditorConfig: () => setPHDocumentEditorConfig,
|
|
24477
|
+
setLoading: () => setLoading,
|
|
24179
24478
|
setGlobal: () => setGlobal,
|
|
24180
24479
|
setFeatures: () => setFeatures,
|
|
24181
24480
|
setDriveSharingType: () => setDriveSharingType,
|
|
@@ -24195,6 +24494,7 @@ __export(exports_src, {
|
|
|
24195
24494
|
makeDriveUrlComponent: () => makeDriveUrlComponent,
|
|
24196
24495
|
logout: () => logout,
|
|
24197
24496
|
login: () => login,
|
|
24497
|
+
loading: () => loading,
|
|
24198
24498
|
isInspectorEnabledSync: () => isInspectorEnabledSync,
|
|
24199
24499
|
isFolderNodeKind: () => isFolderNodeKind,
|
|
24200
24500
|
isFileNodeKind: () => isFileNodeKind,
|
|
@@ -24243,6 +24543,7 @@ __export(exports_src, {
|
|
|
24243
24543
|
baseDocumentModelsMap: () => baseDocumentModelsMap,
|
|
24244
24544
|
baseDocumentModels: () => baseDocumentModels,
|
|
24245
24545
|
addTrigger: () => addTrigger,
|
|
24546
|
+
addRenownEventHandler: () => addRenownEventHandler,
|
|
24246
24547
|
addRemoteDrive: () => addRemoteDrive,
|
|
24247
24548
|
addPromiseState: () => addPromiseState,
|
|
24248
24549
|
addFolder: () => addFolder,
|
|
@@ -24254,10 +24555,10 @@ __export(exports_src, {
|
|
|
24254
24555
|
SyncOperationStatus: () => SyncOperationStatus,
|
|
24255
24556
|
SpinnerIcon: () => SpinnerIcon,
|
|
24256
24557
|
RenownUserButton: () => RenownUserButton,
|
|
24257
|
-
RenownProvider: () => RenownProvider,
|
|
24258
24558
|
RenownLogo: () => RenownLogo,
|
|
24259
24559
|
RenownLoginButton: () => RenownLoginButton,
|
|
24260
24560
|
RenownAuthButton: () => RenownAuthButton,
|
|
24561
|
+
Renown: () => Renown2,
|
|
24261
24562
|
RemoteDocumentController: () => RemoteDocumentController,
|
|
24262
24563
|
RemoteClient: () => RemoteClient,
|
|
24263
24564
|
RelationalDbProcessor: () => RelationalDbProcessor,
|
|
@@ -24275,7 +24576,7 @@ __export(exports_src, {
|
|
|
24275
24576
|
InMemoryQueue: () => InMemoryQueue,
|
|
24276
24577
|
ISSUER_TYPE: () => ISSUER_TYPE,
|
|
24277
24578
|
GqlRequestChannel: () => GqlRequestChannel,
|
|
24278
|
-
|
|
24579
|
+
DocumentIntegrityService: () => DocumentIntegrityService,
|
|
24279
24580
|
DocumentChangeType: () => DocumentChangeType,
|
|
24280
24581
|
DocumentCache: () => DocumentCache,
|
|
24281
24582
|
DisconnectIcon: () => DisconnectIcon,
|
|
@@ -24284,6 +24585,7 @@ __export(exports_src, {
|
|
|
24284
24585
|
CopyIcon: () => CopyIcon,
|
|
24285
24586
|
ConsoleLogger: () => ConsoleLogger,
|
|
24286
24587
|
ConflictError: () => ConflictError,
|
|
24588
|
+
ChevronDownIcon: () => ChevronDownIcon,
|
|
24287
24589
|
ChannelScheme: () => ChannelScheme,
|
|
24288
24590
|
CREDENTIAL_TYPES: () => CREDENTIAL_TYPES,
|
|
24289
24591
|
CREDENTIAL_SUBJECT_TYPE: () => CREDENTIAL_SUBJECT_TYPE,
|
|
@@ -24323,17 +24625,20 @@ import {
|
|
|
24323
24625
|
setSharingType
|
|
24324
24626
|
} from "document-drive";
|
|
24325
24627
|
import { documentModelDocumentModelModule } from "document-model";
|
|
24628
|
+
import { useCallback } from "react";
|
|
24629
|
+
import { useEffect, useState, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
24326
24630
|
import { useSyncExternalStore } from "react";
|
|
24327
|
-
import { useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
24328
|
-
import { useEffect, useRef, useState } from "react";
|
|
24329
24631
|
import { logger as logger5 } from "document-drive";
|
|
24330
|
-
import {
|
|
24632
|
+
import { useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
24633
|
+
import { logger as logger6 } from "document-drive";
|
|
24634
|
+
import { use, useCallback as useCallback2, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
24331
24635
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
24636
|
+
import { useEffect as useEffect3, useRef, useState as useState3 } from "react";
|
|
24332
24637
|
import {
|
|
24333
24638
|
DocumentModelNotFoundError,
|
|
24334
24639
|
DocumentNotFoundError as DocumentNotFoundError2
|
|
24335
24640
|
} from "document-drive";
|
|
24336
|
-
import { useCallback as
|
|
24641
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
|
|
24337
24642
|
import { isFileNode as isFileNode2 } from "document-drive";
|
|
24338
24643
|
import { useMemo } from "react";
|
|
24339
24644
|
import {
|
|
@@ -24343,20 +24648,24 @@ import {
|
|
|
24343
24648
|
} from "document-model";
|
|
24344
24649
|
import { createState } from "document-model";
|
|
24345
24650
|
import { defaultBaseState as defaultBaseState2, generateId as generateId22 } from "document-model/core";
|
|
24346
|
-
import { logger as logger6 } from "document-drive";
|
|
24347
|
-
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
24348
24651
|
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
24349
24652
|
import { createRelationalDbLegacy } from "document-drive";
|
|
24350
24653
|
import { useMemo as useMemo2 } from "react";
|
|
24351
24654
|
import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
24352
|
-
import { useCallback as
|
|
24353
|
-
import { useCallback as
|
|
24655
|
+
import { useCallback as useCallback5, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
24656
|
+
import { useCallback as useCallback6, useState as useState7 } from "react";
|
|
24354
24657
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
24658
|
+
import {
|
|
24659
|
+
Children,
|
|
24660
|
+
cloneElement,
|
|
24661
|
+
forwardRef,
|
|
24662
|
+
isValidElement
|
|
24663
|
+
} from "react";
|
|
24355
24664
|
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
24356
|
-
import { useCallback as
|
|
24665
|
+
import { useCallback as useCallback7, useEffect as useEffect7, useRef as useRef5, useState as useState8 } from "react";
|
|
24357
24666
|
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
24358
|
-
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
24359
|
-
import {
|
|
24667
|
+
import { jsxDEV as jsxDEV4, Fragment } from "react/jsx-dev-runtime";
|
|
24668
|
+
import { useRef as useRef6 } from "react";
|
|
24360
24669
|
function asUint8Array(buf) {
|
|
24361
24670
|
if (globalThis.Buffer != null) {
|
|
24362
24671
|
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
@@ -27707,38 +28016,61 @@ function makePHEventFunctions(key) {
|
|
|
27707
28016
|
const setEventName = `ph:set${capitalCase(key)}`;
|
|
27708
28017
|
const updateEventName = `ph:${key}Updated`;
|
|
27709
28018
|
function setValue(value) {
|
|
28019
|
+
if (isServer) {
|
|
28020
|
+
return;
|
|
28021
|
+
}
|
|
27710
28022
|
const event = new CustomEvent(setEventName, {
|
|
27711
28023
|
detail: { [key]: value }
|
|
27712
28024
|
});
|
|
27713
28025
|
window.dispatchEvent(event);
|
|
27714
28026
|
}
|
|
27715
28027
|
function dispatchUpdatedEvent() {
|
|
28028
|
+
if (isServer) {
|
|
28029
|
+
return;
|
|
28030
|
+
}
|
|
27716
28031
|
const event = new CustomEvent(updateEventName);
|
|
27717
28032
|
window.dispatchEvent(event);
|
|
27718
28033
|
}
|
|
27719
28034
|
function handleSetValueEvent(event) {
|
|
28035
|
+
if (isServer) {
|
|
28036
|
+
return;
|
|
28037
|
+
}
|
|
27720
28038
|
const value = event.detail[key];
|
|
27721
|
-
if (!window.ph)
|
|
27722
|
-
|
|
28039
|
+
if (!window.ph) {
|
|
28040
|
+
window.ph = {};
|
|
28041
|
+
}
|
|
27723
28042
|
window.ph[key] = value;
|
|
27724
28043
|
dispatchUpdatedEvent();
|
|
27725
28044
|
}
|
|
27726
28045
|
function addEventHandler() {
|
|
28046
|
+
if (isServer) {
|
|
28047
|
+
return;
|
|
28048
|
+
}
|
|
27727
28049
|
window.addEventListener(setEventName, handleSetValueEvent);
|
|
27728
28050
|
}
|
|
27729
28051
|
function subscribeToValue(onStoreChange) {
|
|
28052
|
+
if (isServer)
|
|
28053
|
+
return () => {};
|
|
27730
28054
|
window.addEventListener(updateEventName, onStoreChange);
|
|
27731
28055
|
return () => {
|
|
27732
28056
|
window.removeEventListener(updateEventName, onStoreChange);
|
|
27733
28057
|
};
|
|
27734
28058
|
}
|
|
27735
28059
|
function getSnapshot() {
|
|
27736
|
-
if (
|
|
27737
|
-
|
|
28060
|
+
if (isServer) {
|
|
28061
|
+
return;
|
|
28062
|
+
}
|
|
28063
|
+
if (!window.ph) {
|
|
28064
|
+
console.warn(`ph global store is not initialized. Did you call set${capitalCase(key)}?`);
|
|
28065
|
+
return;
|
|
28066
|
+
}
|
|
27738
28067
|
return window.ph[key];
|
|
27739
28068
|
}
|
|
28069
|
+
function getServerSnapshot() {
|
|
28070
|
+
return;
|
|
28071
|
+
}
|
|
27740
28072
|
function useValue() {
|
|
27741
|
-
return useSyncExternalStore(subscribeToValue, getSnapshot);
|
|
28073
|
+
return useSyncExternalStore(subscribeToValue, getSnapshot, getServerSnapshot);
|
|
27742
28074
|
}
|
|
27743
28075
|
return {
|
|
27744
28076
|
useValue,
|
|
@@ -27746,6 +28078,138 @@ function makePHEventFunctions(key) {
|
|
|
27746
28078
|
addEventHandler
|
|
27747
28079
|
};
|
|
27748
28080
|
}
|
|
28081
|
+
function useDid() {
|
|
28082
|
+
const renown = useRenown();
|
|
28083
|
+
return renown?.did;
|
|
28084
|
+
}
|
|
28085
|
+
function useUser() {
|
|
28086
|
+
const renown = useRenown();
|
|
28087
|
+
const [user, setUser] = useState(renown?.user);
|
|
28088
|
+
useEffect(() => {
|
|
28089
|
+
setUser(renown?.user);
|
|
28090
|
+
if (!renown)
|
|
28091
|
+
return;
|
|
28092
|
+
return renown.on("user", setUser);
|
|
28093
|
+
}, [renown]);
|
|
28094
|
+
return user;
|
|
28095
|
+
}
|
|
28096
|
+
function useLoginStatus() {
|
|
28097
|
+
const renown = useRenown();
|
|
28098
|
+
return useSyncExternalStore2((cb) => {
|
|
28099
|
+
if (!renown) {
|
|
28100
|
+
return () => {};
|
|
28101
|
+
}
|
|
28102
|
+
return renown.on("status", cb);
|
|
28103
|
+
}, () => renown === loading ? "loading" : renown?.status, () => {
|
|
28104
|
+
return;
|
|
28105
|
+
});
|
|
28106
|
+
}
|
|
28107
|
+
function openRenown(documentId) {
|
|
28108
|
+
const renown = window.ph?.renown;
|
|
28109
|
+
let renownUrl = renown?.baseUrl;
|
|
28110
|
+
if (!renownUrl) {
|
|
28111
|
+
logger5.warn("Renown instance not found, falling back to: ", RENOWN_URL);
|
|
28112
|
+
renownUrl = RENOWN_URL;
|
|
28113
|
+
}
|
|
28114
|
+
if (documentId) {
|
|
28115
|
+
window.open(`${renownUrl}/profile/${documentId}`, "_blank")?.focus();
|
|
28116
|
+
return;
|
|
28117
|
+
}
|
|
28118
|
+
const url = new URL(renownUrl);
|
|
28119
|
+
url.searchParams.set("app", renown?.did ?? "");
|
|
28120
|
+
url.searchParams.set("connect", renown?.did ?? "");
|
|
28121
|
+
url.searchParams.set("network", RENOWN_NETWORK_ID);
|
|
28122
|
+
url.searchParams.set("chain", RENOWN_CHAIN_ID);
|
|
28123
|
+
const returnUrl = new URL(window.location.pathname, window.location.origin);
|
|
28124
|
+
url.searchParams.set("returnUrl", returnUrl.toJSON());
|
|
28125
|
+
window.open(url, "_self")?.focus();
|
|
28126
|
+
}
|
|
28127
|
+
function consumeDidFromUrl() {
|
|
28128
|
+
if (typeof window === "undefined")
|
|
28129
|
+
return;
|
|
28130
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
28131
|
+
const userParam = urlParams.get("user");
|
|
28132
|
+
if (!userParam)
|
|
28133
|
+
return;
|
|
28134
|
+
const userDid = decodeURIComponent(userParam);
|
|
28135
|
+
const cleanUrl = new URL(window.location.href);
|
|
28136
|
+
cleanUrl.searchParams.delete("user");
|
|
28137
|
+
window.history.replaceState({}, "", cleanUrl.toString());
|
|
28138
|
+
return userDid;
|
|
28139
|
+
}
|
|
28140
|
+
async function login(userDid, renown) {
|
|
28141
|
+
if (!renown) {
|
|
28142
|
+
return;
|
|
28143
|
+
}
|
|
28144
|
+
const did = userDid ?? consumeDidFromUrl();
|
|
28145
|
+
try {
|
|
28146
|
+
const user = renown.user;
|
|
28147
|
+
if (user?.did && (user.did === did || !did)) {
|
|
28148
|
+
return user;
|
|
28149
|
+
}
|
|
28150
|
+
if (!did) {
|
|
28151
|
+
return;
|
|
28152
|
+
}
|
|
28153
|
+
return await renown.login(did);
|
|
28154
|
+
} catch (error) {
|
|
28155
|
+
logger5.error(error instanceof Error ? error.message : JSON.stringify(error));
|
|
28156
|
+
}
|
|
28157
|
+
}
|
|
28158
|
+
async function logout() {
|
|
28159
|
+
const renown = window.ph?.renown;
|
|
28160
|
+
await renown?.logout();
|
|
28161
|
+
const url = new URL(window.location.href);
|
|
28162
|
+
if (url.searchParams.has("user")) {
|
|
28163
|
+
url.searchParams.delete("user");
|
|
28164
|
+
window.history.replaceState(null, "", url.toString());
|
|
28165
|
+
}
|
|
28166
|
+
}
|
|
28167
|
+
function truncateAddress(address) {
|
|
28168
|
+
if (address.length <= 13)
|
|
28169
|
+
return address;
|
|
28170
|
+
return `${address.slice(0, 7)}...${address.slice(-5)}`;
|
|
28171
|
+
}
|
|
28172
|
+
function toRenownAuthStatus(loginStatus, user) {
|
|
28173
|
+
if (loginStatus === "authorized") {
|
|
28174
|
+
return user ? "authorized" : "checking";
|
|
28175
|
+
}
|
|
28176
|
+
return loginStatus;
|
|
28177
|
+
}
|
|
28178
|
+
function useRenownAuth() {
|
|
28179
|
+
const user = useUser();
|
|
28180
|
+
const loginStatus = useLoginStatus();
|
|
28181
|
+
const status = toRenownAuthStatus(loginStatus, user);
|
|
28182
|
+
const address = user?.address;
|
|
28183
|
+
const ensName = user?.ens?.name;
|
|
28184
|
+
const avatarUrl = user?.profile?.userImage ?? user?.ens?.avatarUrl;
|
|
28185
|
+
const profileId = user?.profile?.documentId;
|
|
28186
|
+
const displayName = ensName ?? user?.profile?.username ?? undefined;
|
|
28187
|
+
const displayAddress = address ? truncateAddress(address) : undefined;
|
|
28188
|
+
const login2 = useCallback(() => {
|
|
28189
|
+
openRenown();
|
|
28190
|
+
}, []);
|
|
28191
|
+
const logout2 = useCallback(async () => {
|
|
28192
|
+
await logout();
|
|
28193
|
+
}, []);
|
|
28194
|
+
const openProfile = useCallback(() => {
|
|
28195
|
+
if (profileId) {
|
|
28196
|
+
openRenown(profileId);
|
|
28197
|
+
}
|
|
28198
|
+
}, [profileId]);
|
|
28199
|
+
return {
|
|
28200
|
+
status,
|
|
28201
|
+
user,
|
|
28202
|
+
address,
|
|
28203
|
+
ensName,
|
|
28204
|
+
avatarUrl,
|
|
28205
|
+
profileId,
|
|
28206
|
+
displayName,
|
|
28207
|
+
displayAddress,
|
|
28208
|
+
login: login2,
|
|
28209
|
+
logout: logout2,
|
|
28210
|
+
openProfile
|
|
28211
|
+
};
|
|
28212
|
+
}
|
|
27749
28213
|
function useAllowedDocumentTypes() {
|
|
27750
28214
|
const definedAllowedDocumentTypes = allowedDocumentTypesEventFunctions.useValue();
|
|
27751
28215
|
return definedAllowedDocumentTypes;
|
|
@@ -27757,6 +28221,14 @@ function setVetraPackageManager(packageManager) {
|
|
|
27757
28221
|
updateReactorClientDocumentModels(packages);
|
|
27758
28222
|
});
|
|
27759
28223
|
}
|
|
28224
|
+
function usePendingInstallations() {
|
|
28225
|
+
const pm = useVetraPackageManager();
|
|
28226
|
+
return useSyncExternalStore3((cb) => pm ? pm.subscribePendingChanges(cb) : NOOP_UNSUBSCRIBE, () => pm?.getPendingInstallations() ?? EMPTY_PENDING);
|
|
28227
|
+
}
|
|
28228
|
+
function useDismissedPackages() {
|
|
28229
|
+
const pm = useVetraPackageManager();
|
|
28230
|
+
return useSyncExternalStore3((cb) => pm ? pm.subscribePendingChanges(cb) : NOOP_UNSUBSCRIBE, () => pm?.getDismissedPackages() ?? EMPTY_DISMISSED);
|
|
28231
|
+
}
|
|
27760
28232
|
function updateReactorClientDocumentModels(packages) {
|
|
27761
28233
|
const documentModelModules = packages.flatMap((pkg) => pkg.modules.documentModelModules).filter((module) => module !== undefined);
|
|
27762
28234
|
const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
|
|
@@ -27788,52 +28260,6 @@ function useAllowedDocumentModelModules() {
|
|
|
27788
28260
|
return documentModelModules;
|
|
27789
28261
|
return documentModelModules?.filter((module) => allowedDocumentTypes.includes(module.documentModel.global.id));
|
|
27790
28262
|
}
|
|
27791
|
-
function useConnectionStates() {
|
|
27792
|
-
const syncManager = useSync();
|
|
27793
|
-
const [states, setStates] = useState(() => buildSnapshot(syncManager));
|
|
27794
|
-
const unsubscribesRef = useRef([]);
|
|
27795
|
-
useEffect(() => {
|
|
27796
|
-
if (!syncManager)
|
|
27797
|
-
return;
|
|
27798
|
-
function subscribe() {
|
|
27799
|
-
for (const unsub of unsubscribesRef.current) {
|
|
27800
|
-
unsub();
|
|
27801
|
-
}
|
|
27802
|
-
unsubscribesRef.current = [];
|
|
27803
|
-
const remotes = syncManager.list();
|
|
27804
|
-
for (const remote of remotes) {
|
|
27805
|
-
const unsub = remote.channel.onConnectionStateChange(() => {
|
|
27806
|
-
setStates(buildSnapshot(syncManager));
|
|
27807
|
-
});
|
|
27808
|
-
unsubscribesRef.current.push(unsub);
|
|
27809
|
-
}
|
|
27810
|
-
setStates(buildSnapshot(syncManager));
|
|
27811
|
-
}
|
|
27812
|
-
subscribe();
|
|
27813
|
-
const interval = setInterval(subscribe, 5000);
|
|
27814
|
-
return () => {
|
|
27815
|
-
clearInterval(interval);
|
|
27816
|
-
for (const unsub of unsubscribesRef.current) {
|
|
27817
|
-
unsub();
|
|
27818
|
-
}
|
|
27819
|
-
unsubscribesRef.current = [];
|
|
27820
|
-
};
|
|
27821
|
-
}, [syncManager]);
|
|
27822
|
-
return states;
|
|
27823
|
-
}
|
|
27824
|
-
function useConnectionState(remoteName) {
|
|
27825
|
-
const states = useConnectionStates();
|
|
27826
|
-
return states.get(remoteName);
|
|
27827
|
-
}
|
|
27828
|
-
function buildSnapshot(syncManager) {
|
|
27829
|
-
const map = new Map;
|
|
27830
|
-
if (!syncManager)
|
|
27831
|
-
return map;
|
|
27832
|
-
for (const remote of syncManager.list()) {
|
|
27833
|
-
map.set(remote.name, remote.channel.getConnectionState());
|
|
27834
|
-
}
|
|
27835
|
-
return map;
|
|
27836
|
-
}
|
|
27837
28263
|
function sortNodesByName(nodes) {
|
|
27838
28264
|
return nodes.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
27839
28265
|
}
|
|
@@ -27849,7 +28275,7 @@ function isFolderNodeKind(node) {
|
|
|
27849
28275
|
}
|
|
27850
28276
|
function useDispatch(document2) {
|
|
27851
28277
|
function dispatch(actionOrActions, onErrors, onSuccess) {
|
|
27852
|
-
dispatchActions(actionOrActions, document2, onErrors, onSuccess).catch(
|
|
28278
|
+
dispatchActions(actionOrActions, document2, onErrors, onSuccess).catch(logger6.error);
|
|
27853
28279
|
}
|
|
27854
28280
|
return [document2, dispatch];
|
|
27855
28281
|
}
|
|
@@ -27881,12 +28307,12 @@ function getDocumentQueryState(promise) {
|
|
|
27881
28307
|
}
|
|
27882
28308
|
function useDocument(id) {
|
|
27883
28309
|
const documentCache = useDocumentCache();
|
|
27884
|
-
const document2 =
|
|
28310
|
+
const document2 = useSyncExternalStore4((cb) => id && documentCache ? documentCache.subscribe(id, cb) : () => {}, () => id ? documentCache?.get(id) : undefined);
|
|
27885
28311
|
return document2 ? use(document2) : undefined;
|
|
27886
28312
|
}
|
|
27887
28313
|
function useDocuments(ids) {
|
|
27888
28314
|
const documentCache = useDocumentCache();
|
|
27889
|
-
const documents =
|
|
28315
|
+
const documents = useSyncExternalStore4((cb) => ids?.length && documentCache ? documentCache.subscribe(ids, cb) : () => {}, () => ids?.length && documentCache ? documentCache.getBatch(ids) : undefined);
|
|
27890
28316
|
return documents ? use(documents) : [];
|
|
27891
28317
|
}
|
|
27892
28318
|
function useGetDocument() {
|
|
@@ -28227,6 +28653,52 @@ function usePHDocumentEditorConfigByKey(key) {
|
|
|
28227
28653
|
const useValueHook = phDocumentEditorConfigHooks[key];
|
|
28228
28654
|
return useValueHook();
|
|
28229
28655
|
}
|
|
28656
|
+
function useConnectionStates() {
|
|
28657
|
+
const syncManager = useSync();
|
|
28658
|
+
const [states, setStates] = useState3(() => buildSnapshot(syncManager));
|
|
28659
|
+
const unsubscribesRef = useRef([]);
|
|
28660
|
+
useEffect3(() => {
|
|
28661
|
+
if (!syncManager)
|
|
28662
|
+
return;
|
|
28663
|
+
function subscribe() {
|
|
28664
|
+
for (const unsub of unsubscribesRef.current) {
|
|
28665
|
+
unsub();
|
|
28666
|
+
}
|
|
28667
|
+
unsubscribesRef.current = [];
|
|
28668
|
+
const remotes = syncManager.list();
|
|
28669
|
+
for (const remote of remotes) {
|
|
28670
|
+
const unsub = remote.channel.onConnectionStateChange(() => {
|
|
28671
|
+
setStates(buildSnapshot(syncManager));
|
|
28672
|
+
});
|
|
28673
|
+
unsubscribesRef.current.push(unsub);
|
|
28674
|
+
}
|
|
28675
|
+
setStates(buildSnapshot(syncManager));
|
|
28676
|
+
}
|
|
28677
|
+
subscribe();
|
|
28678
|
+
const interval = setInterval(subscribe, 5000);
|
|
28679
|
+
return () => {
|
|
28680
|
+
clearInterval(interval);
|
|
28681
|
+
for (const unsub of unsubscribesRef.current) {
|
|
28682
|
+
unsub();
|
|
28683
|
+
}
|
|
28684
|
+
unsubscribesRef.current = [];
|
|
28685
|
+
};
|
|
28686
|
+
}, [syncManager]);
|
|
28687
|
+
return states;
|
|
28688
|
+
}
|
|
28689
|
+
function useConnectionState(remoteName) {
|
|
28690
|
+
const states = useConnectionStates();
|
|
28691
|
+
return states.get(remoteName);
|
|
28692
|
+
}
|
|
28693
|
+
function buildSnapshot(syncManager) {
|
|
28694
|
+
const map = new Map;
|
|
28695
|
+
if (!syncManager)
|
|
28696
|
+
return map;
|
|
28697
|
+
for (const remote of syncManager.list()) {
|
|
28698
|
+
map.set(remote.name, remote.channel.getConnectionState());
|
|
28699
|
+
}
|
|
28700
|
+
return map;
|
|
28701
|
+
}
|
|
28230
28702
|
function useDocumentOfType(documentId, documentType) {
|
|
28231
28703
|
const [document2, dispatch] = useDocumentById(documentId);
|
|
28232
28704
|
const documentModelModule = useDocumentModelModuleById(documentType);
|
|
@@ -28246,13 +28718,13 @@ function useDocumentOfType(documentId, documentType) {
|
|
|
28246
28718
|
function useDocumentOperations(documentId) {
|
|
28247
28719
|
const reactorClient = useReactorClient();
|
|
28248
28720
|
const hasFetchedRef = useRef2(false);
|
|
28249
|
-
const [state, setState] =
|
|
28721
|
+
const [state, setState] = useState4(() => ({
|
|
28250
28722
|
globalOperations: [],
|
|
28251
28723
|
localOperations: [],
|
|
28252
28724
|
isLoading: !!documentId,
|
|
28253
28725
|
error: undefined
|
|
28254
28726
|
}));
|
|
28255
|
-
const fetchOperations =
|
|
28727
|
+
const fetchOperations = useCallback4(async (retryCount = 0) => {
|
|
28256
28728
|
const MAX_RETRIES = 5;
|
|
28257
28729
|
const RETRY_DELAY_MS = 500;
|
|
28258
28730
|
if (!documentId || !reactorClient) {
|
|
@@ -28298,7 +28770,7 @@ function useDocumentOperations(documentId) {
|
|
|
28298
28770
|
});
|
|
28299
28771
|
hasFetchedRef.current = true;
|
|
28300
28772
|
}, [documentId, reactorClient]);
|
|
28301
|
-
|
|
28773
|
+
useEffect4(() => {
|
|
28302
28774
|
if (documentId && reactorClient) {
|
|
28303
28775
|
fetchOperations();
|
|
28304
28776
|
} else if (!documentId) {
|
|
@@ -28311,7 +28783,7 @@ function useDocumentOperations(documentId) {
|
|
|
28311
28783
|
hasFetchedRef.current = false;
|
|
28312
28784
|
}
|
|
28313
28785
|
}, [documentId, reactorClient, fetchOperations]);
|
|
28314
|
-
const refetch =
|
|
28786
|
+
const refetch = useCallback4(() => {
|
|
28315
28787
|
fetchOperations(0);
|
|
28316
28788
|
}, [fetchOperations]);
|
|
28317
28789
|
return { ...state, refetch };
|
|
@@ -28758,81 +29230,6 @@ function makeVetraPackageManifestModulesEntry(modules) {
|
|
|
28758
29230
|
return acc;
|
|
28759
29231
|
}, {});
|
|
28760
29232
|
}
|
|
28761
|
-
function openRenown(documentId) {
|
|
28762
|
-
if (documentId) {
|
|
28763
|
-
window.open(`${RENOWN_URL}/profile/${documentId}`, "_blank")?.focus();
|
|
28764
|
-
return;
|
|
28765
|
-
}
|
|
28766
|
-
const url = new URL(RENOWN_URL);
|
|
28767
|
-
url.searchParams.set("connect", window.ph?.renown?.did ?? "");
|
|
28768
|
-
url.searchParams.set("network", RENOWN_NETWORK_ID);
|
|
28769
|
-
url.searchParams.set("chain", RENOWN_CHAIN_ID);
|
|
28770
|
-
const returnUrl = new URL(window.location.pathname, window.location.origin);
|
|
28771
|
-
url.searchParams.set("returnUrl", returnUrl.toJSON());
|
|
28772
|
-
window.open(url, "_self")?.focus();
|
|
28773
|
-
}
|
|
28774
|
-
function consumeDidFromUrl() {
|
|
28775
|
-
if (typeof window === "undefined")
|
|
28776
|
-
return;
|
|
28777
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
28778
|
-
const userParam = urlParams.get("user");
|
|
28779
|
-
if (!userParam)
|
|
28780
|
-
return;
|
|
28781
|
-
const userDid = decodeURIComponent(userParam);
|
|
28782
|
-
const cleanUrl = new URL(window.location.href);
|
|
28783
|
-
cleanUrl.searchParams.delete("user");
|
|
28784
|
-
window.history.replaceState({}, "", cleanUrl.toString());
|
|
28785
|
-
return userDid;
|
|
28786
|
-
}
|
|
28787
|
-
async function login(userDid, renown) {
|
|
28788
|
-
if (!renown) {
|
|
28789
|
-
return;
|
|
28790
|
-
}
|
|
28791
|
-
const did = userDid ?? consumeDidFromUrl();
|
|
28792
|
-
try {
|
|
28793
|
-
const user = renown.user;
|
|
28794
|
-
if (user?.did && (user.did === did || !did)) {
|
|
28795
|
-
return user;
|
|
28796
|
-
}
|
|
28797
|
-
if (!did) {
|
|
28798
|
-
return;
|
|
28799
|
-
}
|
|
28800
|
-
return await renown.login(did);
|
|
28801
|
-
} catch (error) {
|
|
28802
|
-
logger6.error("@error", error);
|
|
28803
|
-
}
|
|
28804
|
-
}
|
|
28805
|
-
async function logout() {
|
|
28806
|
-
const renown = window.ph?.renown;
|
|
28807
|
-
await renown?.logout();
|
|
28808
|
-
const url = new URL(window.location.href);
|
|
28809
|
-
if (url.searchParams.has("user")) {
|
|
28810
|
-
url.searchParams.delete("user");
|
|
28811
|
-
window.history.replaceState(null, "", url.toString());
|
|
28812
|
-
}
|
|
28813
|
-
}
|
|
28814
|
-
function useUser() {
|
|
28815
|
-
const renown = useRenown();
|
|
28816
|
-
const [user, setUser] = useState4(() => renown?.user);
|
|
28817
|
-
useEffect4(() => {
|
|
28818
|
-
setUser(renown?.user);
|
|
28819
|
-
if (!renown)
|
|
28820
|
-
return;
|
|
28821
|
-
return renown.on("user", setUser);
|
|
28822
|
-
}, [renown]);
|
|
28823
|
-
return user;
|
|
28824
|
-
}
|
|
28825
|
-
function useLoginStatus() {
|
|
28826
|
-
const renown = useRenown();
|
|
28827
|
-
const [status, setStatus] = useState4(() => renown ? renown.status : "initializing");
|
|
28828
|
-
useEffect4(() => {
|
|
28829
|
-
setStatus(renown ? renown.status : "initializing");
|
|
28830
|
-
if (!renown)
|
|
28831
|
-
return;
|
|
28832
|
-
return renown.on("status", setStatus);
|
|
28833
|
-
}, [renown]);
|
|
28834
|
-
return status;
|
|
28835
|
-
}
|
|
28836
29233
|
function useGetSwitchboardLink(document2) {
|
|
28837
29234
|
const [drive] = useSelectedDrive();
|
|
28838
29235
|
const remotes = useSyncList();
|
|
@@ -28875,6 +29272,47 @@ function useUserPermissions() {
|
|
|
28875
29272
|
isAllowedToEditDocuments: allowList.includes(user?.address ?? "")
|
|
28876
29273
|
};
|
|
28877
29274
|
}
|
|
29275
|
+
function cdnUrlToApiUrl(cdnUrl) {
|
|
29276
|
+
return cdnUrl.replace(/\/-\/cdn\/?$/, "");
|
|
29277
|
+
}
|
|
29278
|
+
function mapPackageInfo(pkg) {
|
|
29279
|
+
return {
|
|
29280
|
+
name: pkg.name,
|
|
29281
|
+
description: pkg.manifest?.description,
|
|
29282
|
+
version: pkg.manifest?.version,
|
|
29283
|
+
category: pkg.manifest?.category,
|
|
29284
|
+
publisher: pkg.manifest?.publisher?.name,
|
|
29285
|
+
publisherUrl: pkg.manifest?.publisher?.url
|
|
29286
|
+
};
|
|
29287
|
+
}
|
|
29288
|
+
|
|
29289
|
+
class RegistryClient {
|
|
29290
|
+
apiUrl;
|
|
29291
|
+
constructor(cdnUrl) {
|
|
29292
|
+
this.apiUrl = cdnUrlToApiUrl(cdnUrl);
|
|
29293
|
+
}
|
|
29294
|
+
async getPackages() {
|
|
29295
|
+
const res = await fetch(`${this.apiUrl}/packages`);
|
|
29296
|
+
if (!res.ok)
|
|
29297
|
+
throw new Error(`Registry error: HTTP ${res.status}`);
|
|
29298
|
+
const data = await res.json();
|
|
29299
|
+
return data.map(mapPackageInfo);
|
|
29300
|
+
}
|
|
29301
|
+
async getPackagesByDocumentType(documentType) {
|
|
29302
|
+
const encodedType = encodeURIComponent(documentType);
|
|
29303
|
+
const res = await fetch(`${this.apiUrl}/packages/by-document-type?type=${encodedType}`);
|
|
29304
|
+
if (!res.ok)
|
|
29305
|
+
throw new Error(`Registry error: HTTP ${res.status}`);
|
|
29306
|
+
return await res.json();
|
|
29307
|
+
}
|
|
29308
|
+
async searchPackages(query) {
|
|
29309
|
+
const packages = await this.getPackages();
|
|
29310
|
+
if (!query)
|
|
29311
|
+
return packages;
|
|
29312
|
+
const lowerQuery = query.toLowerCase();
|
|
29313
|
+
return packages.filter((pkg) => pkg.name.toLowerCase().includes(lowerQuery) || pkg.description?.toLowerCase().includes(lowerQuery));
|
|
29314
|
+
}
|
|
29315
|
+
}
|
|
28878
29316
|
|
|
28879
29317
|
class BaseStorage {
|
|
28880
29318
|
#store;
|
|
@@ -28896,6 +29334,19 @@ class BaseStorage {
|
|
|
28896
29334
|
return this.#store.delete(this.#buildKey(key));
|
|
28897
29335
|
}
|
|
28898
29336
|
}
|
|
29337
|
+
function loadDismissedPackages() {
|
|
29338
|
+
try {
|
|
29339
|
+
const raw = localStorage.getItem(DISMISSED_STORAGE_KEY);
|
|
29340
|
+
if (raw)
|
|
29341
|
+
return JSON.parse(raw);
|
|
29342
|
+
} catch {}
|
|
29343
|
+
return [];
|
|
29344
|
+
}
|
|
29345
|
+
function persistDismissedPackages(dismissed) {
|
|
29346
|
+
try {
|
|
29347
|
+
localStorage.setItem(DISMISSED_STORAGE_KEY, JSON.stringify(dismissed));
|
|
29348
|
+
} catch {}
|
|
29349
|
+
}
|
|
28899
29350
|
function loadCSS(pkg, registryUrl) {
|
|
28900
29351
|
const head = document.getElementsByTagName("head")[0];
|
|
28901
29352
|
const existingStyle = head.querySelector(`link[data-package='${pkg}']`);
|
|
@@ -28916,10 +29367,13 @@ function removeCSS(pkg) {
|
|
|
28916
29367
|
style.remove();
|
|
28917
29368
|
}
|
|
28918
29369
|
}
|
|
29370
|
+
async function runtimeImport(url) {
|
|
29371
|
+
return new Function("u", "return import(u)")(url);
|
|
29372
|
+
}
|
|
28919
29373
|
async function loadExternalPackage(name4, registryUrl) {
|
|
28920
29374
|
registryUrl = registryUrl.endsWith("/") ? registryUrl : `${registryUrl}/`;
|
|
28921
29375
|
const url = `${registryUrl}${name4}/index.js`;
|
|
28922
|
-
const module = await
|
|
29376
|
+
const module = await runtimeImport(url);
|
|
28923
29377
|
loadCSS(name4, registryUrl);
|
|
28924
29378
|
return convertLegacyLibToVetraPackage(module);
|
|
28925
29379
|
}
|
|
@@ -28930,12 +29384,23 @@ class BrowserPackageManager {
|
|
|
28930
29384
|
#localPackageIds = new Set;
|
|
28931
29385
|
#subscribers = new Set;
|
|
28932
29386
|
#packagesMemo = [];
|
|
28933
|
-
|
|
29387
|
+
#registryCdnUrl;
|
|
29388
|
+
#registryClient;
|
|
29389
|
+
#documentModelRegistry;
|
|
29390
|
+
#pending = [];
|
|
29391
|
+
#dismissed = loadDismissedPackages();
|
|
29392
|
+
#deferredActions = new Map;
|
|
29393
|
+
#pendingListeners = new Set;
|
|
29394
|
+
constructor(namespace, registryCdnUrl) {
|
|
28934
29395
|
this.#storage = new BrowserLocalStorage(namespace + ":PH_PACKAGES");
|
|
28935
29396
|
const packages = this.#storage.get("packages");
|
|
28936
29397
|
if (!packages) {
|
|
28937
29398
|
this.#storage.set("packages", []);
|
|
28938
29399
|
}
|
|
29400
|
+
if (registryCdnUrl) {
|
|
29401
|
+
this.#registryCdnUrl = registryCdnUrl;
|
|
29402
|
+
this.#registryClient = new RegistryClient(registryCdnUrl);
|
|
29403
|
+
}
|
|
28939
29404
|
}
|
|
28940
29405
|
async init() {
|
|
28941
29406
|
const packages = this.#storage.get("packages");
|
|
@@ -28991,6 +29456,99 @@ class BrowserPackageManager {
|
|
|
28991
29456
|
handler({ packages });
|
|
28992
29457
|
});
|
|
28993
29458
|
}
|
|
29459
|
+
setDocumentModelRegistry(registry) {
|
|
29460
|
+
this.#documentModelRegistry = registry;
|
|
29461
|
+
}
|
|
29462
|
+
async load(documentType) {
|
|
29463
|
+
if (!this.#registryClient || !this.#registryCdnUrl) {
|
|
29464
|
+
throw new Error("Registry CDN URL not configured — cannot discover packages");
|
|
29465
|
+
}
|
|
29466
|
+
const packageNames = await this.#registryClient.getPackagesByDocumentType(documentType);
|
|
29467
|
+
if (packageNames.length === 0) {
|
|
29468
|
+
throw new Error(`No package found containing document type: ${documentType}`);
|
|
29469
|
+
}
|
|
29470
|
+
const packageName = packageNames.sort((a, b) => a.localeCompare(b))[0];
|
|
29471
|
+
this.#pending = [...this.#pending, { documentType, packageName }];
|
|
29472
|
+
this.#notifyPendingListeners();
|
|
29473
|
+
return new Promise((resolve, reject) => {
|
|
29474
|
+
this.#deferredActions.set(packageName, { resolve, reject });
|
|
29475
|
+
});
|
|
29476
|
+
}
|
|
29477
|
+
async approveInstallation(packageName) {
|
|
29478
|
+
const deferred = this.#deferredActions.get(packageName);
|
|
29479
|
+
if (!deferred)
|
|
29480
|
+
return;
|
|
29481
|
+
try {
|
|
29482
|
+
await this.addPackage(packageName, this.#registryCdnUrl);
|
|
29483
|
+
} catch (error) {
|
|
29484
|
+
this.#removePending(packageName);
|
|
29485
|
+
this.#deferredActions.delete(packageName);
|
|
29486
|
+
deferred.reject(error instanceof Error ? error : new Error(`Failed to install package: ${packageName}`));
|
|
29487
|
+
return;
|
|
29488
|
+
}
|
|
29489
|
+
const pendingEntries = this.#pending.filter((p) => p.packageName === packageName);
|
|
29490
|
+
this.#removePending(packageName);
|
|
29491
|
+
this.#deferredActions.delete(packageName);
|
|
29492
|
+
if (!this.#documentModelRegistry) {
|
|
29493
|
+
deferred.reject(new Error("Document model registry not available"));
|
|
29494
|
+
return;
|
|
29495
|
+
}
|
|
29496
|
+
for (const entry of pendingEntries) {
|
|
29497
|
+
try {
|
|
29498
|
+
const module = this.#documentModelRegistry.getModule(entry.documentType);
|
|
29499
|
+
deferred.resolve(module);
|
|
29500
|
+
return;
|
|
29501
|
+
} catch {}
|
|
29502
|
+
}
|
|
29503
|
+
deferred.reject(new Error(`Module not found after installing package: ${packageName}`));
|
|
29504
|
+
}
|
|
29505
|
+
rejectInstallation(packageName) {
|
|
29506
|
+
const deferred = this.#deferredActions.get(packageName);
|
|
29507
|
+
if (!deferred)
|
|
29508
|
+
return;
|
|
29509
|
+
const rejectedEntries = this.#pending.filter((p) => p.packageName === packageName);
|
|
29510
|
+
const documentTypes = rejectedEntries.map((e) => e.documentType);
|
|
29511
|
+
this.#addDismissed(packageName, documentTypes);
|
|
29512
|
+
this.#removePending(packageName);
|
|
29513
|
+
this.#deferredActions.delete(packageName);
|
|
29514
|
+
deferred.reject(new Error(`Installation rejected for package: ${packageName}`));
|
|
29515
|
+
}
|
|
29516
|
+
subscribePendingChanges(listener) {
|
|
29517
|
+
this.#pendingListeners.add(listener);
|
|
29518
|
+
return () => {
|
|
29519
|
+
this.#pendingListeners.delete(listener);
|
|
29520
|
+
};
|
|
29521
|
+
}
|
|
29522
|
+
getPendingInstallations() {
|
|
29523
|
+
return this.#pending;
|
|
29524
|
+
}
|
|
29525
|
+
getDismissedPackages() {
|
|
29526
|
+
return this.#dismissed;
|
|
29527
|
+
}
|
|
29528
|
+
removeDismissed(packageName) {
|
|
29529
|
+
this.#dismissed = this.#dismissed.filter((d) => d.packageName !== packageName);
|
|
29530
|
+
persistDismissedPackages(this.#dismissed);
|
|
29531
|
+
this.#notifyPendingListeners();
|
|
29532
|
+
}
|
|
29533
|
+
#addDismissed(packageName, documentTypes) {
|
|
29534
|
+
const existing = this.#dismissed.find((d) => d.packageName === packageName);
|
|
29535
|
+
if (existing) {
|
|
29536
|
+
const merged = new Set([...existing.documentTypes, ...documentTypes]);
|
|
29537
|
+
existing.documentTypes = [...merged];
|
|
29538
|
+
} else {
|
|
29539
|
+
this.#dismissed = [...this.#dismissed, { packageName, documentTypes }];
|
|
29540
|
+
}
|
|
29541
|
+
persistDismissedPackages(this.#dismissed);
|
|
29542
|
+
}
|
|
29543
|
+
#removePending(packageName) {
|
|
29544
|
+
this.#pending = this.#pending.filter((p) => p.packageName !== packageName);
|
|
29545
|
+
this.#notifyPendingListeners();
|
|
29546
|
+
}
|
|
29547
|
+
#notifyPendingListeners() {
|
|
29548
|
+
for (const listener of this.#pendingListeners) {
|
|
29549
|
+
listener();
|
|
29550
|
+
}
|
|
29551
|
+
}
|
|
28994
29552
|
}
|
|
28995
29553
|
async function dropTablesInSchema(pg, schema) {
|
|
28996
29554
|
await pg.exec(`
|
|
@@ -29016,40 +29574,6 @@ async function dropAllReactorStorage(pg) {
|
|
|
29016
29574
|
await dropTablesInSchema(pg, REACTOR_SCHEMA);
|
|
29017
29575
|
await dropTablesInSchema(pg, "public");
|
|
29018
29576
|
}
|
|
29019
|
-
function cdnUrlToApiUrl(cdnUrl) {
|
|
29020
|
-
return cdnUrl.replace(/\/-\/cdn\/?$/, "");
|
|
29021
|
-
}
|
|
29022
|
-
function mapPackageInfo(pkg) {
|
|
29023
|
-
return {
|
|
29024
|
-
name: pkg.name,
|
|
29025
|
-
description: pkg.manifest?.description,
|
|
29026
|
-
version: pkg.manifest?.version,
|
|
29027
|
-
category: pkg.manifest?.category,
|
|
29028
|
-
publisher: pkg.manifest?.publisher?.name,
|
|
29029
|
-
publisherUrl: pkg.manifest?.publisher?.url
|
|
29030
|
-
};
|
|
29031
|
-
}
|
|
29032
|
-
|
|
29033
|
-
class RegistryClient {
|
|
29034
|
-
apiUrl;
|
|
29035
|
-
constructor(cdnUrl) {
|
|
29036
|
-
this.apiUrl = cdnUrlToApiUrl(cdnUrl);
|
|
29037
|
-
}
|
|
29038
|
-
async getPackages() {
|
|
29039
|
-
const res = await fetch(`${this.apiUrl}/packages`);
|
|
29040
|
-
if (!res.ok)
|
|
29041
|
-
throw new Error(`Registry error: HTTP ${res.status}`);
|
|
29042
|
-
const data = await res.json();
|
|
29043
|
-
return data.map(mapPackageInfo);
|
|
29044
|
-
}
|
|
29045
|
-
async searchPackages(query) {
|
|
29046
|
-
const packages = await this.getPackages();
|
|
29047
|
-
if (!query)
|
|
29048
|
-
return packages;
|
|
29049
|
-
const lowerQuery = query.toLowerCase();
|
|
29050
|
-
return packages.filter((pkg) => pkg.name.toLowerCase().includes(lowerQuery) || pkg.description?.toLowerCase().includes(lowerQuery));
|
|
29051
|
-
}
|
|
29052
|
-
}
|
|
29053
29577
|
|
|
29054
29578
|
class ReactorClientDocumentCache {
|
|
29055
29579
|
client;
|
|
@@ -29355,7 +29879,7 @@ function split2(lst, le = false) {
|
|
|
29355
29879
|
}
|
|
29356
29880
|
function add(Ah, Al, Bh, Bl) {
|
|
29357
29881
|
const l = (Al >>> 0) + (Bl >>> 0);
|
|
29358
|
-
return { h: Ah + Bh + (l /
|
|
29882
|
+
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
29359
29883
|
}
|
|
29360
29884
|
function _abool2(value, title = "") {
|
|
29361
29885
|
if (typeof value !== "boolean") {
|
|
@@ -30166,7 +30690,7 @@ function edwards(params, extraOpts = {}) {
|
|
|
30166
30690
|
_abool2(zip215, "zip215");
|
|
30167
30691
|
const normed = copyBytes(bytes);
|
|
30168
30692
|
const lastByte = bytes[len - 1];
|
|
30169
|
-
normed[len - 1] = lastByte &
|
|
30693
|
+
normed[len - 1] = lastByte & ~128;
|
|
30170
30694
|
const y = bytesToNumberLE(normed);
|
|
30171
30695
|
const max = zip215 ? MASK : Fp.ORDER;
|
|
30172
30696
|
aInRange("point.y", y, _0n4, max);
|
|
@@ -31552,7 +32076,7 @@ function ripemd_f(group, x, y, z) {
|
|
|
31552
32076
|
return x ^ (y | ~z);
|
|
31553
32077
|
}
|
|
31554
32078
|
function keccakP(s, rounds = 24) {
|
|
31555
|
-
const B = new Uint32Array(
|
|
32079
|
+
const B = new Uint32Array(5 * 2);
|
|
31556
32080
|
for (let round = 24 - rounds;round < 24; round++) {
|
|
31557
32081
|
for (let x = 0;x < 10; x++)
|
|
31558
32082
|
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
@@ -31941,7 +32465,7 @@ function convertRadix2(data, from3, to, padding2) {
|
|
|
31941
32465
|
}
|
|
31942
32466
|
function radix(num) {
|
|
31943
32467
|
anumber2(num);
|
|
31944
|
-
const _256 =
|
|
32468
|
+
const _256 = 2 ** 8;
|
|
31945
32469
|
return {
|
|
31946
32470
|
encode: (bytes) => {
|
|
31947
32471
|
if (!isBytes2(bytes))
|
|
@@ -40558,7 +41082,7 @@ function useStableParams(params) {
|
|
|
40558
41082
|
function createProcessorQuery(ProcessorClass) {
|
|
40559
41083
|
function useQuery(driveId, queryCallback, parameters, options) {
|
|
40560
41084
|
const stableParams = useStableParams(parameters);
|
|
40561
|
-
const memoizedCallback =
|
|
41085
|
+
const memoizedCallback = useCallback5(queryCallback, [stableParams]);
|
|
40562
41086
|
return useRelationalQuery(ProcessorClass, driveId, memoizedCallback, stableParams, options);
|
|
40563
41087
|
}
|
|
40564
41088
|
return useQuery;
|
|
@@ -41092,41 +41616,6 @@ function CopyIcon({ size = 14, color = "#9EA0A1" }) {
|
|
|
41092
41616
|
]
|
|
41093
41617
|
}, undefined, true, undefined, this);
|
|
41094
41618
|
}
|
|
41095
|
-
function ExternalLinkIcon({
|
|
41096
|
-
size = 14,
|
|
41097
|
-
color = "currentColor"
|
|
41098
|
-
}) {
|
|
41099
|
-
return /* @__PURE__ */ jsxDEV("svg", {
|
|
41100
|
-
width: size,
|
|
41101
|
-
height: size,
|
|
41102
|
-
viewBox: "0 0 16 16",
|
|
41103
|
-
fill: "none",
|
|
41104
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
41105
|
-
children: [
|
|
41106
|
-
/* @__PURE__ */ jsxDEV("path", {
|
|
41107
|
-
d: "M12 8.66667V12.6667C12 13.0203 11.8595 13.3594 11.6095 13.6095C11.3594 13.8595 11.0203 14 10.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V5.33333C2 4.97971 2.14048 4.64057 2.39052 4.39052C2.64057 4.14048 2.97971 4 3.33333 4H7.33333",
|
|
41108
|
-
stroke: color,
|
|
41109
|
-
strokeWidth: "1.5",
|
|
41110
|
-
strokeLinecap: "round",
|
|
41111
|
-
strokeLinejoin: "round"
|
|
41112
|
-
}, undefined, false, undefined, this),
|
|
41113
|
-
/* @__PURE__ */ jsxDEV("path", {
|
|
41114
|
-
d: "M10 2H14V6",
|
|
41115
|
-
stroke: color,
|
|
41116
|
-
strokeWidth: "1.5",
|
|
41117
|
-
strokeLinecap: "round",
|
|
41118
|
-
strokeLinejoin: "round"
|
|
41119
|
-
}, undefined, false, undefined, this),
|
|
41120
|
-
/* @__PURE__ */ jsxDEV("path", {
|
|
41121
|
-
d: "M6.66669 9.33333L14 2",
|
|
41122
|
-
stroke: color,
|
|
41123
|
-
strokeWidth: "1.5",
|
|
41124
|
-
strokeLinecap: "round",
|
|
41125
|
-
strokeLinejoin: "round"
|
|
41126
|
-
}, undefined, false, undefined, this)
|
|
41127
|
-
]
|
|
41128
|
-
}, undefined, true, undefined, this);
|
|
41129
|
-
}
|
|
41130
41619
|
function DisconnectIcon({ size = 14, color = "#EA4335" }) {
|
|
41131
41620
|
return /* @__PURE__ */ jsxDEV("svg", {
|
|
41132
41621
|
width: size,
|
|
@@ -41229,6 +41718,27 @@ function SpinnerIcon({ size = 14, color = "currentColor" }) {
|
|
|
41229
41718
|
]
|
|
41230
41719
|
}, undefined, true, undefined, this);
|
|
41231
41720
|
}
|
|
41721
|
+
function ChevronDownIcon({
|
|
41722
|
+
size = 14,
|
|
41723
|
+
color = "currentColor",
|
|
41724
|
+
style
|
|
41725
|
+
}) {
|
|
41726
|
+
return /* @__PURE__ */ jsxDEV("svg", {
|
|
41727
|
+
width: size,
|
|
41728
|
+
height: size,
|
|
41729
|
+
viewBox: "0 0 16 16",
|
|
41730
|
+
fill: "none",
|
|
41731
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41732
|
+
style,
|
|
41733
|
+
children: /* @__PURE__ */ jsxDEV("path", {
|
|
41734
|
+
d: "M4 6L8 10L12 6",
|
|
41735
|
+
stroke: color,
|
|
41736
|
+
strokeWidth: "1.5",
|
|
41737
|
+
strokeLinecap: "round",
|
|
41738
|
+
strokeLinejoin: "round"
|
|
41739
|
+
}, undefined, false, undefined, this)
|
|
41740
|
+
}, undefined, false, undefined, this);
|
|
41741
|
+
}
|
|
41232
41742
|
function UserIcon({ size = 24, color = "#6366f1" }) {
|
|
41233
41743
|
return /* @__PURE__ */ jsxDEV("svg", {
|
|
41234
41744
|
width: size,
|
|
@@ -41253,134 +41763,80 @@ function UserIcon({ size = 24, color = "#6366f1" }) {
|
|
|
41253
41763
|
]
|
|
41254
41764
|
}, undefined, true, undefined, this);
|
|
41255
41765
|
}
|
|
41766
|
+
function mergeProps(parentProps, childProps) {
|
|
41767
|
+
const merged = { ...parentProps };
|
|
41768
|
+
for (const key of Object.keys(childProps)) {
|
|
41769
|
+
const parentValue = parentProps[key];
|
|
41770
|
+
const childValue = childProps[key];
|
|
41771
|
+
if (key === "style") {
|
|
41772
|
+
merged[key] = { ...parentValue, ...childValue };
|
|
41773
|
+
} else if (key === "className") {
|
|
41774
|
+
merged[key] = [parentValue, childValue].filter(Boolean).join(" ");
|
|
41775
|
+
} else if (typeof parentValue === "function" && typeof childValue === "function") {
|
|
41776
|
+
merged[key] = (...args) => {
|
|
41777
|
+
childValue(...args);
|
|
41778
|
+
parentValue(...args);
|
|
41779
|
+
};
|
|
41780
|
+
} else if (childValue !== undefined) {
|
|
41781
|
+
merged[key] = childValue;
|
|
41782
|
+
}
|
|
41783
|
+
}
|
|
41784
|
+
return merged;
|
|
41785
|
+
}
|
|
41256
41786
|
function RenownLoginButton({
|
|
41257
41787
|
onLogin: onLoginProp,
|
|
41258
41788
|
darkMode = false,
|
|
41259
41789
|
style,
|
|
41260
41790
|
className,
|
|
41261
|
-
|
|
41262
|
-
|
|
41791
|
+
asChild = false,
|
|
41792
|
+
children
|
|
41263
41793
|
}) {
|
|
41264
41794
|
const onLogin = onLoginProp ?? (() => openRenown());
|
|
41265
|
-
const [isOpen, setIsOpen] = useState7(false);
|
|
41266
41795
|
const [isLoading, setIsLoading] = useState7(false);
|
|
41267
41796
|
const [isHovered, setIsHovered] = useState7(false);
|
|
41268
|
-
const
|
|
41269
|
-
const
|
|
41270
|
-
const
|
|
41271
|
-
|
|
41272
|
-
if (!wrapperRef.current)
|
|
41273
|
-
return;
|
|
41274
|
-
const rect = wrapperRef.current.getBoundingClientRect();
|
|
41275
|
-
const spaceAbove = rect.top;
|
|
41276
|
-
setShowAbove(spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP);
|
|
41277
|
-
}, []);
|
|
41278
|
-
const handleMouseEnter = useCallback5(() => {
|
|
41279
|
-
setIsHovered(true);
|
|
41280
|
-
if (!showPopover)
|
|
41281
|
-
return;
|
|
41282
|
-
if (closeTimeoutRef.current) {
|
|
41283
|
-
clearTimeout(closeTimeoutRef.current);
|
|
41284
|
-
closeTimeoutRef.current = null;
|
|
41285
|
-
}
|
|
41286
|
-
calculatePosition();
|
|
41287
|
-
setIsOpen(true);
|
|
41288
|
-
}, [calculatePosition, showPopover]);
|
|
41289
|
-
const handleMouseLeave = useCallback5(() => {
|
|
41290
|
-
closeTimeoutRef.current = setTimeout(() => {
|
|
41291
|
-
setIsOpen(false);
|
|
41292
|
-
setIsHovered(false);
|
|
41293
|
-
}, 150);
|
|
41294
|
-
}, []);
|
|
41295
|
-
useEffect7(() => {
|
|
41296
|
-
return () => {
|
|
41297
|
-
if (closeTimeoutRef.current) {
|
|
41298
|
-
clearTimeout(closeTimeoutRef.current);
|
|
41299
|
-
}
|
|
41300
|
-
};
|
|
41301
|
-
}, []);
|
|
41302
|
-
const handleConnect = () => {
|
|
41303
|
-
setIsLoading(true);
|
|
41304
|
-
onLogin();
|
|
41305
|
-
};
|
|
41306
|
-
const handleDirectClick = () => {
|
|
41307
|
-
if (!showPopover && !isLoading) {
|
|
41797
|
+
const handleMouseEnter = useCallback6(() => setIsHovered(true), []);
|
|
41798
|
+
const handleMouseLeave = useCallback6(() => setIsHovered(false), []);
|
|
41799
|
+
const handleClick = () => {
|
|
41800
|
+
if (!isLoading) {
|
|
41308
41801
|
setIsLoading(true);
|
|
41309
41802
|
onLogin();
|
|
41310
41803
|
}
|
|
41311
41804
|
};
|
|
41805
|
+
const themeStyles = darkMode ? darkStyles : lightStyles;
|
|
41312
41806
|
const triggerStyle = {
|
|
41313
41807
|
...styles.trigger,
|
|
41314
|
-
|
|
41808
|
+
...themeStyles.trigger,
|
|
41809
|
+
...isHovered && !isLoading ? themeStyles.triggerHover : {},
|
|
41810
|
+
cursor: isLoading ? "wait" : "pointer",
|
|
41315
41811
|
...style
|
|
41316
41812
|
};
|
|
41317
|
-
const
|
|
41318
|
-
|
|
41319
|
-
|
|
41320
|
-
...
|
|
41321
|
-
|
|
41322
|
-
}
|
|
41323
|
-
|
|
41324
|
-
|
|
41325
|
-
|
|
41326
|
-
|
|
41327
|
-
|
|
41328
|
-
|
|
41329
|
-
|
|
41813
|
+
const triggerElement = asChild ? /* @__PURE__ */ jsxDEV2(Slot, {
|
|
41814
|
+
onClick: handleClick,
|
|
41815
|
+
"data-renown-state": "login",
|
|
41816
|
+
...isLoading ? { "data-loading": "" } : {},
|
|
41817
|
+
children
|
|
41818
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("button", {
|
|
41819
|
+
type: "button",
|
|
41820
|
+
style: triggerStyle,
|
|
41821
|
+
"aria-label": "Log in with Renown",
|
|
41822
|
+
onClick: handleClick,
|
|
41823
|
+
"data-renown-state": "login",
|
|
41824
|
+
...isLoading ? { "data-loading": "" } : {},
|
|
41825
|
+
children: isLoading ? /* @__PURE__ */ jsxDEV2(SpinnerIcon, {
|
|
41826
|
+
size: 16
|
|
41827
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("span", {
|
|
41828
|
+
children: "Log in"
|
|
41829
|
+
}, undefined, false, undefined, this)
|
|
41830
|
+
}, undefined, false, undefined, this);
|
|
41330
41831
|
return /* @__PURE__ */ jsxDEV2("div", {
|
|
41331
|
-
ref: wrapperRef,
|
|
41332
41832
|
style: styles.wrapper,
|
|
41333
41833
|
className,
|
|
41334
41834
|
onMouseEnter: handleMouseEnter,
|
|
41335
41835
|
onMouseLeave: handleMouseLeave,
|
|
41336
|
-
children:
|
|
41337
|
-
|
|
41338
|
-
onMouseEnter: handleMouseEnter,
|
|
41339
|
-
onMouseLeave: handleMouseLeave,
|
|
41340
|
-
isLoading
|
|
41341
|
-
}) : /* @__PURE__ */ jsxDEV2("button", {
|
|
41342
|
-
type: "button",
|
|
41343
|
-
style: triggerStyle,
|
|
41344
|
-
"aria-label": showPopover ? "Open Renown Login" : "Login with Renown",
|
|
41345
|
-
onClick: showPopover ? undefined : handleDirectClick,
|
|
41346
|
-
children: isLoading ? /* @__PURE__ */ jsxDEV2(SpinnerIcon, {
|
|
41347
|
-
size: 42
|
|
41348
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("img", {
|
|
41349
|
-
width: 42,
|
|
41350
|
-
height: 42,
|
|
41351
|
-
src: isHovered ? renownShortHoverDataUrl : renownShortDataUrl,
|
|
41352
|
-
alt: "Renown Login",
|
|
41353
|
-
style: triggerImageStyle
|
|
41354
|
-
}, undefined, false, undefined, this)
|
|
41355
|
-
}, undefined, false, undefined, this),
|
|
41356
|
-
isOpen && showPopover && /* @__PURE__ */ jsxDEV2("div", {
|
|
41357
|
-
style: popoverStyle,
|
|
41358
|
-
children: /* @__PURE__ */ jsxDEV2("div", {
|
|
41359
|
-
style: styles.popoverContent,
|
|
41360
|
-
children: [
|
|
41361
|
-
/* @__PURE__ */ jsxDEV2("div", {
|
|
41362
|
-
style: styles.logoContainer,
|
|
41363
|
-
children: /* @__PURE__ */ jsxDEV2(RenownLogo, {
|
|
41364
|
-
width: 83,
|
|
41365
|
-
height: 22,
|
|
41366
|
-
color: logoColor
|
|
41367
|
-
}, undefined, false, undefined, this)
|
|
41368
|
-
}, undefined, false, undefined, this),
|
|
41369
|
-
/* @__PURE__ */ jsxDEV2("button", {
|
|
41370
|
-
type: "button",
|
|
41371
|
-
onClick: allowLogin ? handleConnect : undefined,
|
|
41372
|
-
style: connectButtonStyle,
|
|
41373
|
-
children: isLoading ? /* @__PURE__ */ jsxDEV2(SpinnerIcon, {
|
|
41374
|
-
size: 14
|
|
41375
|
-
}, undefined, false, undefined, this) : "Connect"
|
|
41376
|
-
}, undefined, false, undefined, this)
|
|
41377
|
-
]
|
|
41378
|
-
}, undefined, true, undefined, this)
|
|
41379
|
-
}, undefined, false, undefined, this)
|
|
41380
|
-
]
|
|
41381
|
-
}, undefined, true, undefined, this);
|
|
41836
|
+
children: triggerElement
|
|
41837
|
+
}, undefined, false, undefined, this);
|
|
41382
41838
|
}
|
|
41383
|
-
function
|
|
41839
|
+
function truncateAddress2(address) {
|
|
41384
41840
|
if (address.length <= 13)
|
|
41385
41841
|
return address;
|
|
41386
41842
|
return `${address.slice(0, 7)}...${address.slice(-5)}`;
|
|
@@ -41393,27 +41849,34 @@ function RenownUserButton({
|
|
|
41393
41849
|
onDisconnect: onDisconnectProp,
|
|
41394
41850
|
style,
|
|
41395
41851
|
className,
|
|
41396
|
-
|
|
41852
|
+
asChild = false,
|
|
41853
|
+
children,
|
|
41854
|
+
menuItems
|
|
41397
41855
|
}) {
|
|
41398
41856
|
const user = useUser();
|
|
41399
41857
|
const address = addressProp ?? user?.address ?? "";
|
|
41400
|
-
const username = usernameProp ?? user?.ens?.name;
|
|
41401
|
-
const avatarUrl = avatarUrlProp ?? user?.ens?.avatarUrl;
|
|
41858
|
+
const username = usernameProp ?? user?.profile?.username ?? user?.ens?.name;
|
|
41859
|
+
const avatarUrl = avatarUrlProp ?? user?.profile?.userImage ?? user?.ens?.avatarUrl;
|
|
41402
41860
|
const userId = userIdProp ?? user?.profile?.documentId;
|
|
41403
41861
|
const onDisconnect = onDisconnectProp ?? (() => void logout());
|
|
41862
|
+
const displayName = username ?? (address ? truncateAddress2(address) : "Account");
|
|
41863
|
+
const profileId = userId ?? address;
|
|
41404
41864
|
const [isOpen, setIsOpen] = useState8(false);
|
|
41865
|
+
const [isHovered, setIsHovered] = useState8(false);
|
|
41405
41866
|
const [isCopied, setIsCopied] = useState8(false);
|
|
41406
41867
|
const [showAbove, setShowAbove] = useState8(true);
|
|
41407
|
-
const
|
|
41408
|
-
const
|
|
41409
|
-
const
|
|
41868
|
+
const [hoveredItem, setHoveredItem] = useState8(null);
|
|
41869
|
+
const wrapperRef = useRef5(null);
|
|
41870
|
+
const closeTimeoutRef = useRef5(null);
|
|
41871
|
+
const calculatePosition = useCallback7(() => {
|
|
41410
41872
|
if (!wrapperRef.current)
|
|
41411
41873
|
return;
|
|
41412
41874
|
const rect = wrapperRef.current.getBoundingClientRect();
|
|
41413
41875
|
const spaceAbove = rect.top;
|
|
41414
|
-
setShowAbove(spaceAbove >=
|
|
41876
|
+
setShowAbove(spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP);
|
|
41415
41877
|
}, []);
|
|
41416
|
-
const handleMouseEnter =
|
|
41878
|
+
const handleMouseEnter = useCallback7(() => {
|
|
41879
|
+
setIsHovered(true);
|
|
41417
41880
|
if (closeTimeoutRef.current) {
|
|
41418
41881
|
clearTimeout(closeTimeoutRef.current);
|
|
41419
41882
|
closeTimeoutRef.current = null;
|
|
@@ -41421,19 +41884,21 @@ function RenownUserButton({
|
|
|
41421
41884
|
calculatePosition();
|
|
41422
41885
|
setIsOpen(true);
|
|
41423
41886
|
}, [calculatePosition]);
|
|
41424
|
-
const handleMouseLeave =
|
|
41887
|
+
const handleMouseLeave = useCallback7(() => {
|
|
41425
41888
|
closeTimeoutRef.current = setTimeout(() => {
|
|
41426
41889
|
setIsOpen(false);
|
|
41890
|
+
setIsHovered(false);
|
|
41891
|
+
setHoveredItem(null);
|
|
41427
41892
|
}, 150);
|
|
41428
41893
|
}, []);
|
|
41429
|
-
|
|
41894
|
+
useEffect7(() => {
|
|
41430
41895
|
return () => {
|
|
41431
41896
|
if (closeTimeoutRef.current) {
|
|
41432
41897
|
clearTimeout(closeTimeoutRef.current);
|
|
41433
41898
|
}
|
|
41434
41899
|
};
|
|
41435
41900
|
}, []);
|
|
41436
|
-
const copyToClipboard =
|
|
41901
|
+
const copyToClipboard = useCallback7(async () => {
|
|
41437
41902
|
try {
|
|
41438
41903
|
await navigator.clipboard.writeText(address);
|
|
41439
41904
|
setIsCopied(true);
|
|
@@ -41442,6 +41907,43 @@ function RenownUserButton({
|
|
|
41442
41907
|
console.error("Failed to copy address:", err);
|
|
41443
41908
|
}
|
|
41444
41909
|
}, [address]);
|
|
41910
|
+
const triggerElement = asChild ? /* @__PURE__ */ jsxDEV3(Slot, {
|
|
41911
|
+
"data-renown-state": "authenticated",
|
|
41912
|
+
children
|
|
41913
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("button", {
|
|
41914
|
+
type: "button",
|
|
41915
|
+
style: {
|
|
41916
|
+
...styles2.trigger,
|
|
41917
|
+
...isHovered ? styles2.triggerHover : {},
|
|
41918
|
+
...style
|
|
41919
|
+
},
|
|
41920
|
+
"aria-label": "Open account menu",
|
|
41921
|
+
"data-renown-state": "authenticated",
|
|
41922
|
+
children: [
|
|
41923
|
+
avatarUrl ? /* @__PURE__ */ jsxDEV3("img", {
|
|
41924
|
+
src: avatarUrl,
|
|
41925
|
+
alt: "Avatar",
|
|
41926
|
+
style: styles2.avatar
|
|
41927
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("div", {
|
|
41928
|
+
style: styles2.avatarPlaceholder,
|
|
41929
|
+
children: /* @__PURE__ */ jsxDEV3("span", {
|
|
41930
|
+
style: styles2.avatarInitial,
|
|
41931
|
+
children: (displayName || "U")[0].toUpperCase()
|
|
41932
|
+
}, undefined, false, undefined, this)
|
|
41933
|
+
}, undefined, false, undefined, this),
|
|
41934
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
41935
|
+
style: styles2.displayName,
|
|
41936
|
+
children: displayName
|
|
41937
|
+
}, undefined, false, undefined, this),
|
|
41938
|
+
/* @__PURE__ */ jsxDEV3(ChevronDownIcon, {
|
|
41939
|
+
size: 14,
|
|
41940
|
+
style: {
|
|
41941
|
+
...styles2.chevron,
|
|
41942
|
+
...isOpen ? styles2.chevronOpen : {}
|
|
41943
|
+
}
|
|
41944
|
+
}, undefined, false, undefined, this)
|
|
41945
|
+
]
|
|
41946
|
+
}, undefined, true, undefined, this);
|
|
41445
41947
|
return /* @__PURE__ */ jsxDEV3("div", {
|
|
41446
41948
|
ref: wrapperRef,
|
|
41447
41949
|
style: styles2.wrapper,
|
|
@@ -41449,46 +41951,25 @@ function RenownUserButton({
|
|
|
41449
41951
|
onMouseEnter: handleMouseEnter,
|
|
41450
41952
|
onMouseLeave: handleMouseLeave,
|
|
41451
41953
|
children: [
|
|
41452
|
-
|
|
41453
|
-
onMouseEnter: handleMouseEnter,
|
|
41454
|
-
onMouseLeave: handleMouseLeave,
|
|
41455
|
-
address,
|
|
41456
|
-
username,
|
|
41457
|
-
avatarUrl
|
|
41458
|
-
}) : /* @__PURE__ */ jsxDEV3("button", {
|
|
41459
|
-
type: "button",
|
|
41460
|
-
style: { ...styles2.trigger, ...style },
|
|
41461
|
-
"aria-label": "Open account menu",
|
|
41462
|
-
children: avatarUrl ? /* @__PURE__ */ jsxDEV3("img", {
|
|
41463
|
-
src: avatarUrl,
|
|
41464
|
-
alt: "Avatar",
|
|
41465
|
-
style: styles2.avatar
|
|
41466
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("div", {
|
|
41467
|
-
style: styles2.avatarPlaceholder,
|
|
41468
|
-
children: /* @__PURE__ */ jsxDEV3(UserIcon, {
|
|
41469
|
-
size: 24,
|
|
41470
|
-
color: "#9ca3af"
|
|
41471
|
-
}, undefined, false, undefined, this)
|
|
41472
|
-
}, undefined, false, undefined, this)
|
|
41473
|
-
}, undefined, false, undefined, this),
|
|
41954
|
+
triggerElement,
|
|
41474
41955
|
isOpen && /* @__PURE__ */ jsxDEV3("div", {
|
|
41475
41956
|
style: {
|
|
41476
41957
|
...styles2.popoverBase,
|
|
41477
|
-
...showAbove ? { bottom: `calc(100% + ${
|
|
41958
|
+
...showAbove ? { bottom: `calc(100% + ${POPOVER_GAP}px)` } : { top: `calc(100% + ${POPOVER_GAP}px)` }
|
|
41478
41959
|
},
|
|
41479
41960
|
children: [
|
|
41480
41961
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
41481
|
-
style: styles2.
|
|
41962
|
+
style: styles2.header,
|
|
41482
41963
|
children: [
|
|
41483
41964
|
username && /* @__PURE__ */ jsxDEV3("div", {
|
|
41484
|
-
style: styles2.
|
|
41965
|
+
style: styles2.headerUsername,
|
|
41485
41966
|
children: username
|
|
41486
41967
|
}, undefined, false, undefined, this),
|
|
41487
|
-
/* @__PURE__ */ jsxDEV3("div", {
|
|
41968
|
+
address && /* @__PURE__ */ jsxDEV3("div", {
|
|
41488
41969
|
style: styles2.addressRow,
|
|
41489
41970
|
children: /* @__PURE__ */ jsxDEV3("button", {
|
|
41490
41971
|
type: "button",
|
|
41491
|
-
onClick: copyToClipboard,
|
|
41972
|
+
onClick: () => void copyToClipboard(),
|
|
41492
41973
|
style: styles2.addressButton,
|
|
41493
41974
|
children: /* @__PURE__ */ jsxDEV3("div", {
|
|
41494
41975
|
style: {
|
|
@@ -41500,20 +41981,26 @@ function RenownUserButton({
|
|
|
41500
41981
|
},
|
|
41501
41982
|
children: [
|
|
41502
41983
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
41503
|
-
style: {
|
|
41984
|
+
style: {
|
|
41985
|
+
...styles2.addressText,
|
|
41986
|
+
opacity: isCopied ? 0 : 1
|
|
41987
|
+
},
|
|
41504
41988
|
children: [
|
|
41505
41989
|
/* @__PURE__ */ jsxDEV3("span", {
|
|
41506
|
-
children:
|
|
41990
|
+
children: truncateAddress2(address)
|
|
41507
41991
|
}, undefined, false, undefined, this),
|
|
41508
41992
|
/* @__PURE__ */ jsxDEV3(CopyIcon, {
|
|
41509
|
-
size:
|
|
41510
|
-
color: "#
|
|
41993
|
+
size: 12,
|
|
41994
|
+
color: "#9ca3af"
|
|
41511
41995
|
}, undefined, false, undefined, this)
|
|
41512
41996
|
]
|
|
41513
41997
|
}, undefined, true, undefined, this),
|
|
41514
41998
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
41515
|
-
style: {
|
|
41516
|
-
|
|
41999
|
+
style: {
|
|
42000
|
+
...styles2.copiedText,
|
|
42001
|
+
opacity: isCopied ? 1 : 0
|
|
42002
|
+
},
|
|
42003
|
+
children: "Copied!"
|
|
41517
42004
|
}, undefined, false, undefined, this)
|
|
41518
42005
|
]
|
|
41519
42006
|
}, undefined, true, undefined, this)
|
|
@@ -41521,35 +42008,64 @@ function RenownUserButton({
|
|
|
41521
42008
|
}, undefined, false, undefined, this)
|
|
41522
42009
|
]
|
|
41523
42010
|
}, undefined, true, undefined, this),
|
|
41524
|
-
|
|
41525
|
-
style: styles2.
|
|
41526
|
-
children:
|
|
41527
|
-
|
|
41528
|
-
|
|
41529
|
-
|
|
41530
|
-
|
|
41531
|
-
|
|
41532
|
-
|
|
41533
|
-
|
|
41534
|
-
|
|
41535
|
-
|
|
41536
|
-
|
|
42011
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
42012
|
+
style: styles2.menuSection,
|
|
42013
|
+
children: [
|
|
42014
|
+
profileId && /* @__PURE__ */ jsxDEV3("button", {
|
|
42015
|
+
type: "button",
|
|
42016
|
+
onClick: () => openRenown(profileId),
|
|
42017
|
+
onMouseEnter: () => setHoveredItem("profile"),
|
|
42018
|
+
onMouseLeave: () => setHoveredItem(null),
|
|
42019
|
+
style: {
|
|
42020
|
+
...styles2.menuItem,
|
|
42021
|
+
...hoveredItem === "profile" ? styles2.menuItemHover : {}
|
|
42022
|
+
},
|
|
42023
|
+
children: [
|
|
42024
|
+
/* @__PURE__ */ jsxDEV3(UserIcon, {
|
|
42025
|
+
size: 14,
|
|
42026
|
+
color: "#6b7280"
|
|
42027
|
+
}, undefined, false, undefined, this),
|
|
42028
|
+
"View Profile"
|
|
42029
|
+
]
|
|
42030
|
+
}, undefined, true, undefined, this),
|
|
42031
|
+
menuItems?.map((item) => /* @__PURE__ */ jsxDEV3("button", {
|
|
42032
|
+
type: "button",
|
|
42033
|
+
onClick: item.onClick,
|
|
42034
|
+
onMouseEnter: () => setHoveredItem(item.label),
|
|
42035
|
+
onMouseLeave: () => setHoveredItem(null),
|
|
42036
|
+
style: {
|
|
42037
|
+
...styles2.menuItem,
|
|
42038
|
+
...hoveredItem === item.label ? styles2.menuItemHover : {},
|
|
42039
|
+
...item.style
|
|
42040
|
+
},
|
|
42041
|
+
children: [
|
|
42042
|
+
item.icon,
|
|
42043
|
+
item.label
|
|
42044
|
+
]
|
|
42045
|
+
}, item.label, true, undefined, this))
|
|
42046
|
+
]
|
|
42047
|
+
}, undefined, true, undefined, this),
|
|
42048
|
+
/* @__PURE__ */ jsxDEV3("hr", {
|
|
42049
|
+
style: styles2.separator
|
|
41537
42050
|
}, undefined, false, undefined, this),
|
|
41538
42051
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
41539
|
-
style: styles2.
|
|
42052
|
+
style: styles2.menuSection,
|
|
41540
42053
|
children: /* @__PURE__ */ jsxDEV3("button", {
|
|
41541
42054
|
type: "button",
|
|
41542
42055
|
onClick: onDisconnect,
|
|
42056
|
+
onMouseEnter: () => setHoveredItem("disconnect"),
|
|
42057
|
+
onMouseLeave: () => setHoveredItem(null),
|
|
41543
42058
|
style: {
|
|
41544
42059
|
...styles2.menuItem,
|
|
41545
|
-
...styles2.disconnectItem
|
|
42060
|
+
...styles2.disconnectItem,
|
|
42061
|
+
...hoveredItem === "disconnect" ? styles2.menuItemHover : {}
|
|
41546
42062
|
},
|
|
41547
42063
|
children: [
|
|
41548
42064
|
/* @__PURE__ */ jsxDEV3(DisconnectIcon, {
|
|
41549
42065
|
size: 14,
|
|
41550
|
-
color: "#
|
|
42066
|
+
color: "#dc2626"
|
|
41551
42067
|
}, undefined, false, undefined, this),
|
|
41552
|
-
"
|
|
42068
|
+
"Log out"
|
|
41553
42069
|
]
|
|
41554
42070
|
}, undefined, true, undefined, this)
|
|
41555
42071
|
}, undefined, false, undefined, this)
|
|
@@ -41560,23 +42076,23 @@ function RenownUserButton({
|
|
|
41560
42076
|
}
|
|
41561
42077
|
function RenownAuthButton({
|
|
41562
42078
|
className = "",
|
|
41563
|
-
|
|
41564
|
-
|
|
41565
|
-
|
|
42079
|
+
darkMode,
|
|
42080
|
+
loginContent,
|
|
42081
|
+
userContent,
|
|
42082
|
+
loadingContent,
|
|
42083
|
+
children
|
|
41566
42084
|
}) {
|
|
41567
|
-
const
|
|
41568
|
-
|
|
41569
|
-
|
|
41570
|
-
|
|
41571
|
-
|
|
41572
|
-
|
|
41573
|
-
|
|
41574
|
-
|
|
41575
|
-
if (isLoading) {
|
|
41576
|
-
if (renderLoading) {
|
|
42085
|
+
const auth = useRenownAuth();
|
|
42086
|
+
if (children) {
|
|
42087
|
+
return /* @__PURE__ */ jsxDEV4(Fragment, {
|
|
42088
|
+
children: children(auth)
|
|
42089
|
+
}, undefined, false, undefined, this);
|
|
42090
|
+
}
|
|
42091
|
+
if (auth.status === "loading" || auth.status === "checking") {
|
|
42092
|
+
if (loadingContent) {
|
|
41577
42093
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
41578
42094
|
className,
|
|
41579
|
-
children:
|
|
42095
|
+
children: loadingContent
|
|
41580
42096
|
}, undefined, false, undefined, this);
|
|
41581
42097
|
}
|
|
41582
42098
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
@@ -41584,24 +42100,44 @@ function RenownAuthButton({
|
|
|
41584
42100
|
children: [
|
|
41585
42101
|
/* @__PURE__ */ jsxDEV4("div", {
|
|
41586
42102
|
style: {
|
|
41587
|
-
|
|
41588
|
-
|
|
41589
|
-
|
|
41590
|
-
|
|
42103
|
+
display: "flex",
|
|
42104
|
+
alignItems: "center",
|
|
42105
|
+
gap: "8px",
|
|
42106
|
+
padding: "6px 12px",
|
|
42107
|
+
borderRadius: "8px",
|
|
42108
|
+
border: "1px solid #e5e7eb",
|
|
41591
42109
|
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
41592
|
-
}
|
|
41593
|
-
|
|
42110
|
+
},
|
|
42111
|
+
children: [
|
|
42112
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
42113
|
+
style: {
|
|
42114
|
+
width: "28px",
|
|
42115
|
+
height: "28px",
|
|
42116
|
+
borderRadius: "50%",
|
|
42117
|
+
backgroundColor: "#e5e7eb"
|
|
42118
|
+
}
|
|
42119
|
+
}, undefined, false, undefined, this),
|
|
42120
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
42121
|
+
style: {
|
|
42122
|
+
width: "80px",
|
|
42123
|
+
height: "14px",
|
|
42124
|
+
borderRadius: "4px",
|
|
42125
|
+
backgroundColor: "#e5e7eb"
|
|
42126
|
+
}
|
|
42127
|
+
}, undefined, false, undefined, this)
|
|
42128
|
+
]
|
|
42129
|
+
}, undefined, true, undefined, this),
|
|
41594
42130
|
/* @__PURE__ */ jsxDEV4("style", {
|
|
41595
42131
|
children: `@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }`
|
|
41596
42132
|
}, undefined, false, undefined, this)
|
|
41597
42133
|
]
|
|
41598
42134
|
}, undefined, true, undefined, this);
|
|
41599
42135
|
}
|
|
41600
|
-
if (
|
|
41601
|
-
if (
|
|
42136
|
+
if (auth.status === "authorized") {
|
|
42137
|
+
if (userContent) {
|
|
41602
42138
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
41603
42139
|
className,
|
|
41604
|
-
children:
|
|
42140
|
+
children: userContent
|
|
41605
42141
|
}, undefined, false, undefined, this);
|
|
41606
42142
|
}
|
|
41607
42143
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
@@ -41609,54 +42145,52 @@ function RenownAuthButton({
|
|
|
41609
42145
|
children: /* @__PURE__ */ jsxDEV4(RenownUserButton, {}, undefined, false, undefined, this)
|
|
41610
42146
|
}, undefined, false, undefined, this);
|
|
41611
42147
|
}
|
|
41612
|
-
if (
|
|
42148
|
+
if (loginContent) {
|
|
41613
42149
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
41614
42150
|
className,
|
|
41615
|
-
children:
|
|
42151
|
+
children: loginContent
|
|
41616
42152
|
}, undefined, false, undefined, this);
|
|
41617
42153
|
}
|
|
41618
42154
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
41619
42155
|
className,
|
|
41620
|
-
children: /* @__PURE__ */ jsxDEV4(RenownLoginButton, {
|
|
42156
|
+
children: /* @__PURE__ */ jsxDEV4(RenownLoginButton, {
|
|
42157
|
+
darkMode
|
|
42158
|
+
}, undefined, false, undefined, this)
|
|
41621
42159
|
}, undefined, false, undefined, this);
|
|
41622
42160
|
}
|
|
41623
|
-
function
|
|
42161
|
+
async function initRenown(appName, namespace, url) {
|
|
42162
|
+
addRenownEventHandler();
|
|
42163
|
+
setRenown(loading);
|
|
42164
|
+
const builder = new RenownBuilder(appName, {
|
|
42165
|
+
basename: namespace,
|
|
42166
|
+
baseUrl: url
|
|
42167
|
+
});
|
|
42168
|
+
const renown = await builder.build();
|
|
42169
|
+
setRenown(renown);
|
|
42170
|
+
await login(undefined, renown);
|
|
42171
|
+
return renown;
|
|
42172
|
+
}
|
|
42173
|
+
function useRenownInit({
|
|
41624
42174
|
appName,
|
|
41625
|
-
|
|
41626
|
-
|
|
41627
|
-
children
|
|
42175
|
+
namespace,
|
|
42176
|
+
url
|
|
41628
42177
|
}) {
|
|
41629
|
-
const
|
|
41630
|
-
const
|
|
42178
|
+
const promiseRef = useRef6(Promise.withResolvers());
|
|
42179
|
+
const initRef = useRef6(false);
|
|
42180
|
+
if (typeof window === "undefined") {
|
|
42181
|
+
promiseRef.current.reject(new Error("window is undefined"));
|
|
42182
|
+
return promiseRef.current.promise;
|
|
42183
|
+
}
|
|
41631
42184
|
if (initRef.current) {
|
|
41632
|
-
|
|
41633
|
-
if (appName !== initial.appName) {
|
|
41634
|
-
console.warn("RenownProvider: 'appName' changed after mount. This prop is only read once during initialization.");
|
|
41635
|
-
}
|
|
41636
|
-
if (basename !== initial.basename) {
|
|
41637
|
-
console.warn("RenownProvider: 'basename' changed after mount. This prop is only read once during initialization.");
|
|
41638
|
-
}
|
|
41639
|
-
if (baseUrl !== initial.baseUrl) {
|
|
41640
|
-
console.warn("RenownProvider: 'baseUrl' changed after mount. This prop is only read once during initialization.");
|
|
41641
|
-
}
|
|
42185
|
+
return promiseRef.current.promise;
|
|
41642
42186
|
}
|
|
41643
|
-
|
|
41644
|
-
|
|
41645
|
-
|
|
41646
|
-
|
|
41647
|
-
|
|
41648
|
-
|
|
41649
|
-
|
|
41650
|
-
addRenownEventHandler();
|
|
41651
|
-
const init = async () => {
|
|
41652
|
-
const builder = new RenownBuilder(appName, { basename, baseUrl });
|
|
41653
|
-
const instance = await builder.build();
|
|
41654
|
-
setRenown(instance);
|
|
41655
|
-
await login(undefined, instance);
|
|
41656
|
-
};
|
|
41657
|
-
init().catch(console.error);
|
|
41658
|
-
}, []);
|
|
41659
|
-
return children;
|
|
42187
|
+
initRef.current = true;
|
|
42188
|
+
initRenown(appName, namespace, url).then(promiseRef.current.resolve).catch(promiseRef.current.reject);
|
|
42189
|
+
return promiseRef.current.promise;
|
|
42190
|
+
}
|
|
42191
|
+
function Renown2({ onError, ...initOptions }) {
|
|
42192
|
+
useRenownInit(initOptions).catch(onError ?? console.error);
|
|
42193
|
+
return null;
|
|
41660
42194
|
}
|
|
41661
42195
|
var __create2, __getProtoOf2, __defProp3, __getOwnPropNames2, __getOwnPropDesc2, __hasOwnProp2, __toESM2 = (mod, isNodeMode, target) => {
|
|
41662
42196
|
target = mod != null ? __create2(__getProtoOf2(mod)) : {};
|
|
@@ -42222,13 +42756,13 @@ ${String(result)}`);
|
|
|
42222
42756
|
return t;
|
|
42223
42757
|
};
|
|
42224
42758
|
return __assign.apply(this, arguments);
|
|
42225
|
-
}, docCache, fragmentSourceMap, printFragmentWarnings = true, experimentalFragmentVariables = false, extras, PropagationMode2, PhDocumentFieldsFragmentDoc, GetDocumentModelsDocument, GetDocumentDocument, GetDocumentChildrenDocument, GetDocumentParentsDocument, FindDocumentsDocument, GetDocumentOperationsDocument, GetJobStatusDocument, CreateDocumentDocument, CreateEmptyDocumentDocument, MutateDocumentDocument, MutateDocumentAsyncDocument, RenameDocumentDocument, AddChildrenDocument, RemoveChildrenDocument, MoveChildrenDocument, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangesDocument, JobChangesDocument, PollSyncEnvelopesDocument, TouchChannelDocument, PushSyncEnvelopesDocument, defaultWrapper = (action, _operationName, _operationType, _variables) => action(), SPLIT_LOWER_UPPER_RE, SPLIT_UPPER_UPPER_RE, SPLIT_SEPARATE_NUMBER_RE, DEFAULT_STRIP_REGEXP, SPLIT_REPLACE_VALUE = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS = "", isExternalControlsEnabledEventFunctions, setIsExternalControlsEnabled, useIsExternalControlsEnabled, addIsExternalControlsEnabledEventHandler, isDragAndDropEnabledEventFunctions, setIsDragAndDropEnabled, useIsDragAndDropEnabled, addIsDragAndDropEnabledEventHandler, allowedDocumentTypesEventFunctions, setAllowedDocumentTypes, addAllowedDocumentTypesEventHandler, phDriveEditorConfigSetters, phDocumentEditorConfigSetters, phDriveEditorConfigHooks, phDocumentEditorConfigHooks, vetraPackageManagerFunctions, useVetraPackageManager, useVetraPackages = () => {
|
|
42759
|
+
}, docCache, fragmentSourceMap, printFragmentWarnings = true, experimentalFragmentVariables = false, extras, PropagationMode2, PhDocumentFieldsFragmentDoc, GetDocumentModelsDocument, GetDocumentDocument, GetDocumentChildrenDocument, GetDocumentParentsDocument, FindDocumentsDocument, GetDocumentOperationsDocument, GetJobStatusDocument, CreateDocumentDocument, CreateEmptyDocumentDocument, MutateDocumentDocument, MutateDocumentAsyncDocument, RenameDocumentDocument, AddChildrenDocument, RemoveChildrenDocument, MoveChildrenDocument, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangesDocument, JobChangesDocument, PollSyncEnvelopesDocument, TouchChannelDocument, PushSyncEnvelopesDocument, defaultWrapper = (action, _operationName, _operationType, _variables) => action(), SPLIT_LOWER_UPPER_RE, SPLIT_UPPER_UPPER_RE, SPLIT_SEPARATE_NUMBER_RE, DEFAULT_STRIP_REGEXP, SPLIT_REPLACE_VALUE = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS = "", isServer, useLoading, setLoading, addLoadingEventHandler, loading = null, renownEventFunctions, addRenownEventHandler, useRenown, setRenown, RENOWN_URL = "https://www.renown.id", RENOWN_NETWORK_ID = "eip155", RENOWN_CHAIN_ID = "1", DOMAIN_TYPE, VERIFIABLE_CREDENTIAL_EIP712_TYPE, CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, ISSUER_TYPE, CREDENTIAL_TYPES, isExternalControlsEnabledEventFunctions, setIsExternalControlsEnabled, useIsExternalControlsEnabled, addIsExternalControlsEnabledEventHandler, isDragAndDropEnabledEventFunctions, setIsDragAndDropEnabled, useIsDragAndDropEnabled, addIsDragAndDropEnabledEventHandler, allowedDocumentTypesEventFunctions, setAllowedDocumentTypes, addAllowedDocumentTypesEventHandler, phDriveEditorConfigSetters, phDocumentEditorConfigSetters, phDriveEditorConfigHooks, phDocumentEditorConfigHooks, vetraPackageManagerFunctions, useVetraPackageManager, useVetraPackages = () => {
|
|
42226
42760
|
const packageManager = useVetraPackageManager();
|
|
42227
|
-
return
|
|
42228
|
-
}, addVetraPackageManagerEventHandler, reactorClientModuleEventFunctions, reactorClientEventFunctions, useReactorClientModule, setReactorClientModule, addReactorClientModuleEventHandler, useReactorClient, setReactorClient, addReactorClientEventHandler, useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager, useSyncList = () => {
|
|
42761
|
+
return useSyncExternalStore3((cb) => packageManager ? packageManager.subscribe(cb) : () => {}, () => packageManager?.packages ?? []);
|
|
42762
|
+
}, addVetraPackageManagerEventHandler, EMPTY_PENDING, EMPTY_DISMISSED, NOOP_UNSUBSCRIBE = () => {}, documentEventFunctions, useDocumentCache, setDocumentCache, addDocumentCacheEventHandler, base64, locales, defaultLocale, initialMulticharmap, initialCharmap, slug_default, drivesEventFunctions, useDrives, setDrives, addDrivesEventHandler, selectedDriveIdEventFunctions, useSelectedDriveId, setSelectedDriveId, addSelectedDriveIdEventHandler, selectedNodeIdEventFunctions, useSelectedNodeId, setSelectedNodeId, addSelectedNodeIdEventHandler, useRouterBasename, setRouterBasename, addRouterBasenameEventHandler, useVersion, setVersion, addVersionEventHandler, useRequiresHardRefresh, setRequiresHardRefresh, addRequiresHardRefreshEventHandler, useWarnOutdatedApp, setWarnOutdatedApp, addWarnOutdatedAppEventHandler, useStudioMode, setStudioMode, addStudioModeEventHandler, useBasePath, setBasePath, addBasePathEventHandler, useVersionCheckInterval, setVersionCheckInterval, addVersionCheckIntervalEventHandler, useCliVersion, setCliVersion, addCliVersionEventHandler, useFileUploadOperationsChunkSize, setFileUploadOperationsChunkSize, addFileUploadOperationsChunkSizeEventHandler, useIsDocumentModelSelectionSettingsEnabled, setIsDocumentModelSelectionSettingsEnabled, addIsDocumentModelSelectionSettingsEnabledEventHandler, useGaTrackingId, setGaTrackingId, addGaTrackingIdEventHandler, useDefaultDrivesUrl, setDefaultDrivesUrl, addDefaultDrivesUrlEventHandler, useDrivesPreserveStrategy, setDrivesPreserveStrategy, addDrivesPreserveStrategyEventHandler, useIsLocalDrivesEnabled, setIsLocalDrivesEnabled, addIsLocalDrivesEnabledEventHandler, useIsAddDriveEnabled, setIsAddDriveEnabled, addIsAddDriveEnabledEventHandler, useIsPublicDrivesEnabled, setIsPublicDrivesEnabled, addIsPublicDrivesEnabledEventHandler, useIsAddPublicDrivesEnabled, setIsAddPublicDrivesEnabled, addIsAddPublicDrivesEnabledEventHandler, useIsDeletePublicDrivesEnabled, setIsDeletePublicDrivesEnabled, addIsDeletePublicDrivesEnabledEventHandler, useIsCloudDrivesEnabled, setIsCloudDrivesEnabled, addIsCloudDrivesEnabledEventHandler, useIsAddCloudDrivesEnabled, setIsAddCloudDrivesEnabled, addIsAddCloudDrivesEnabledEventHandler, useIsDeleteCloudDrivesEnabled, setIsDeleteCloudDrivesEnabled, addIsDeleteCloudDrivesEnabledEventHandler, useLocalDrivesEnabled, setLocalDrivesEnabled, addLocalDrivesEnabledEventHandler, useIsAddLocalDrivesEnabled, setIsAddLocalDrivesEnabled, addIsAddLocalDrivesEnabledEventHandler, useIsDeleteLocalDrivesEnabled, setIsDeleteLocalDrivesEnabled, addIsDeleteLocalDrivesEnabledEventHandler, useIsEditorDebugModeEnabled, setIsEditorDebugModeEnabled, addIsEditorDebugModeEnabledEventHandler, useIsEditorReadModeEnabled, setIsEditorReadModeEnabled, addIsEditorReadModeEnabledEventHandler, useIsAnalyticsDatabaseWorkerEnabled, setIsAnalyticsDatabaseWorkerEnabled, addIsAnalyticsDatabaseWorkerEnabledEventHandler, useIsDiffAnalyticsEnabled, setIsDiffAnalyticsEnabled, addIsDiffAnalyticsEnabledEventHandler, useIsDriveAnalyticsEnabled, setIsDriveAnalyticsEnabled, addIsDriveAnalyticsEnabledEventHandler, useRenownUrl, setRenownUrl, addRenownUrlEventHandler, useRenownNetworkId, setRenownNetworkId, addRenownNetworkIdEventHandler, useRenownChainId, setRenownChainId, addRenownChainIdEventHandler, useSentryRelease, setSentryRelease, addSentryReleaseEventHandler, useSentryDsn, setSentryDsn, addSentryDsnEventHandler, useSentryEnv, setSentryEnv, addSentryEnvEventHandler, useIsSentryTracingEnabled, setIsSentryTracingEnabled, addIsSentryTracingEnabledEventHandler, useIsExternalProcessorsEnabled, setIsExternalProcessorsEnabled, addIsExternalProcessorsEnabledEventHandler, useIsExternalPackagesEnabled, setIsExternalPackagesEnabled, addIsExternalPackagesEnabledEventHandler, enabledEditorsEventFunctions, setEnabledEditors, useEnabledEditors, addEnabledEditorsEventHandler, disabledEditorsEventFunctions, setDisabledEditors, useDisabledEditors, addDisabledEditorsEventHandler, isRelationalProcessorsEnabled, setIsRelationalProcessorsEnabled, useIsRelationalProcessorsEnabled, addIsRelationalProcessorsEnabledEventHandler, isExternalRelationalProcessorsEnabled, setIsExternalRelationalProcessorsEnabled, useIsExternalRelationalProcessorsEnabled, addIsExternalRelationalProcessorsEnabledEventHandler, isAnalyticsEnabledEventFunctions, setIsAnalyticsEnabled, useIsAnalyticsEnabled, addIsAnalyticsEnabledEventHandler, isAnalyticsExternalProcessorsEnabled, setIsAnalyticsExternalProcessorsEnabled, useIsAnalyticsExternalProcessorsEnabled, addIsAnalyticsExternalProcessorsEnabledEventHandler, analyticsDatabaseNameEventFunctions, setAnalyticsDatabaseName, useAnalyticsDatabaseName, addAnalyticsDatabaseNameEventHandler, logLevelEventFunctions, setLogLevel2, useLogLevel, addLogLevelEventHandler, allowListEventFunctions, setAllowList, useAllowList, addAllowListEventHandler, nonUserConfigSetters, phGlobalConfigSetters, nonUserConfigHooks, phGlobalConfigHooks, reactorClientModuleEventFunctions, reactorClientEventFunctions, useReactorClientModule, setReactorClientModule, addReactorClientModuleEventHandler, useReactorClient, setReactorClient, addReactorClientEventHandler, useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager, useSyncList = () => {
|
|
42229
42763
|
const sync = useSync();
|
|
42230
42764
|
return sync?.list() ?? [];
|
|
42231
|
-
},
|
|
42765
|
+
}, featuresEventFunctions, useFeatures, setFeatures, addFeaturesEventHandler, modalEventFunctions, usePHModal, setPHModal, addModalEventHandler, revisionHistoryEventFunctions, useRevisionHistoryVisible, setRevisionHistoryVisible, addRevisionHistoryVisibleEventHandler, selectedTimelineItemEventFunctions, useSelectedTimelineItem, setSelectedTimelineItem, addSelectedTimelineItemEventHandler, selectedTimelineRevisionEventFunctions, useSelectedTimelineRevision, setSelectedTimelineRevision, addSelectedTimelineRevisionEventHandler, toastEventFunctions, usePHToast, setPHToast, addToastEventHandler, FEATURE_INSPECTOR_ENABLED = "FEATURE_INSPECTOR_ENABLED", FEATURE_INSPECTOR_ENABLED_DEFAULT = false, syncStatusToUI, validateDocument = (document2) => {
|
|
42232
42766
|
const errors2 = [];
|
|
42233
42767
|
if (document2.header.documentType !== "powerhouse/document-model") {
|
|
42234
42768
|
return errors2;
|
|
@@ -42280,7 +42814,7 @@ ${String(result)}`);
|
|
|
42280
42814
|
return operationDate >= startDate && operationDate <= endDate;
|
|
42281
42815
|
});
|
|
42282
42816
|
return operation ? operation.index : 0;
|
|
42283
|
-
}, lzString,
|
|
42817
|
+
}, lzString, useOnDropFile = (documentTypesOverride) => {
|
|
42284
42818
|
const selectedDriveId = useSelectedDriveId();
|
|
42285
42819
|
const selectedFolder = useSelectedFolder();
|
|
42286
42820
|
const documentTypes = useDocumentTypes();
|
|
@@ -42294,7 +42828,7 @@ ${String(result)}`);
|
|
|
42294
42828
|
return await addFileWithProgress(file, selectedDriveId, fileName, targetNodeId, onProgress, documentTypesOverride ?? documentTypes, resolveConflict);
|
|
42295
42829
|
};
|
|
42296
42830
|
return onDropFile;
|
|
42297
|
-
}, store, BrowserLocalStorage, PGLITE_UPDATE_EVENT = "ph:pglite-update", defaultPGliteState, usePGliteDB = () => {
|
|
42831
|
+
}, store, BrowserLocalStorage, DISMISSED_STORAGE_KEY = "ph-connect-dismissed-packages", PGLITE_UPDATE_EVENT = "ph:pglite-update", defaultPGliteState, usePGliteDB = () => {
|
|
42298
42832
|
const [state, setState] = useState5(() => window.powerhouse?.pglite ?? defaultPGliteState);
|
|
42299
42833
|
useEffect5(() => {
|
|
42300
42834
|
const handlePgliteUpdate = () => setState(window.powerhouse?.pglite ?? defaultPGliteState);
|
|
@@ -42320,7 +42854,7 @@ ${String(result)}`);
|
|
|
42320
42854
|
const pglite = usePGliteDB();
|
|
42321
42855
|
const setPGlite = useSetPGliteDB();
|
|
42322
42856
|
return [pglite, setPGlite];
|
|
42323
|
-
}, DEFAULT_RENOWN_URL = "https://www.renown.id", crypto2, isLE, swap32IfBE, hasHexBuiltin, hexes, asciis, HashMD, SHA256_IV, SHA384_IV, SHA512_IV, U32_MASK64, _32n, shrSH = (h, _l, s) => h >>> s, shrSL = (h, l, s) => h << 32 - s | l >>> s, rotrSH = (h, l, s) => h >>> s | l << 32 - s, rotrSL = (h, l, s) => h << 32 - s | l >>> s, rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32, rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s, add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0), add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low /
|
|
42857
|
+
}, DEFAULT_RENOWN_URL = "https://www.renown.id", crypto2, isLE, swap32IfBE, hasHexBuiltin, hexes, asciis, HashMD, SHA256_IV, SHA384_IV, SHA512_IV, U32_MASK64, _32n, shrSH = (h, _l, s) => h >>> s, shrSL = (h, l, s) => h << 32 - s | l >>> s, rotrSH = (h, l, s) => h >>> s | l << 32 - s, rotrSL = (h, l, s) => h << 32 - s | l >>> s, rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32, rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s, add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0), add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0, add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0), add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0, add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0), add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0, SHA256_K, SHA256_W, SHA256, K512, SHA512_Kh, SHA512_Kl, SHA512_W_H, SHA512_W_L, SHA512, SHA384, sha2562, sha5122, sha384, _0n, _1n, isPosBig = (n) => typeof n === "bigint" && _0n <= n, bitMask = (n) => (_1n << BigInt(n)) - _1n, notImplemented = () => {
|
|
42324
42858
|
throw new Error("not implemented");
|
|
42325
42859
|
}, _0n2, _1n2, _2n, _3n, _4n, _5n, _7n, _8n, _9n, _16n, isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n2) === _1n2, FIELD_FIELDS, _0n3, _1n3, pointPrecomputes, pointWindowSizes, _0n4, _1n4, _2n2, _8n2, _0n5, _1n5, _2n3, _3n2, _5n2, _8n3, ed25519_CURVE_p, ed25519_CURVE, ED25519_SQRT_M1, Fp, Fn, ed25519Defaults, ed25519, SQRT_M1, SQRT_AD_MINUS_ONE, INVSQRT_A_MINUS_D, ONE_MINUS_D_SQ, D_MINUS_ONE_SQ, invertSqrt = (number) => uvRatio(_1n5, number), MAX_255B, bytes255ToNumberLE = (bytes) => ed25519.Point.Fp.create(bytesToNumberLE(bytes) & MAX_255B), _RistrettoPoint, import_multibase, HMAC, hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(), divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n4) / den, DERErr, DER, _0n6, _1n6, _2n4, _3n3, _4n2, secp256k1_CURVE, secp256k1_ENDO, _2n5, Fpk1, secp256k1, p256_CURVE, p384_CURVE, p521_CURVE, Fp256, Fp384, Fp521, p256, p384, p521, p2562, sha2563, Rho160, Id160, Pi160, idxLR, idxL, idxR, shifts160, shiftsL160, shiftsR160, Kl160, Kr160, BUF_160, RIPEMD160, ripemd160, ripemd1602, _0n7, _1n7, _2n6, _7n2, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s), rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s), Keccak, gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen)), keccak_256, import_canonicalize, PCT_ENCODED = "(?:%[0-9a-fA-F]{2})", ID_CHAR, METHOD = "([a-z0-9]+)", METHOD_ID, PARAM_CHAR = "[a-zA-Z0-9_.:%-]", PARAM, PARAMS, PATH = `(/[^#?]*)?`, QUERY = `([?][^#]*)?`, FRAGMENT = `(#.*)?`, DID_MATCHER, EMPTY_RESULT, gcd = (a, b) => b === 0 ? a : gcd(b, a % b), radix2carry = (from3, to) => from3 + (to - gcd(from3, to)), powers, base162, base322, base32nopad, base32hex2, base32hexnopad, base32crockford, hasBase64Builtin, decodeBase64Builtin = (s, isUrl) => {
|
|
42326
42860
|
astr("base64", s);
|
|
@@ -43095,7 +43629,7 @@ ${String(result)}`);
|
|
|
43095
43629
|
}, MAX_RETRIES = 5, RETRY_DELAY = 200, isRelationNotExistError = (error) => {
|
|
43096
43630
|
const errorMessage = error instanceof Error ? error.message : typeof error === "string" ? error : String(error);
|
|
43097
43631
|
return errorMessage.toLowerCase().includes("relation") && errorMessage.toLowerCase().includes("does not exist");
|
|
43098
|
-
}, import_lodash, ConflictError,
|
|
43632
|
+
}, import_lodash, ConflictError, Slot, lightStyles, darkStyles, styles, POPOVER_GAP = 4, POPOVER_HEIGHT = 150, styles2;
|
|
43099
43633
|
var init_src2 = __esm(() => {
|
|
43100
43634
|
init_src();
|
|
43101
43635
|
init_src();
|
|
@@ -47452,6 +47986,52 @@ spurious results.`);
|
|
|
47452
47986
|
SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
47453
47987
|
SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
47454
47988
|
DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
47989
|
+
isServer = typeof window === "undefined";
|
|
47990
|
+
({
|
|
47991
|
+
useValue: useLoading,
|
|
47992
|
+
setValue: setLoading,
|
|
47993
|
+
addEventHandler: addLoadingEventHandler
|
|
47994
|
+
} = makePHEventFunctions("loading"));
|
|
47995
|
+
renownEventFunctions = makePHEventFunctions("renown");
|
|
47996
|
+
addRenownEventHandler = renownEventFunctions.addEventHandler;
|
|
47997
|
+
useRenown = renownEventFunctions.useValue;
|
|
47998
|
+
setRenown = renownEventFunctions.setValue;
|
|
47999
|
+
DOMAIN_TYPE = [
|
|
48000
|
+
{ name: "name", type: "string" },
|
|
48001
|
+
{ name: "version", type: "string" },
|
|
48002
|
+
{ name: "chainId", type: "uint256" },
|
|
48003
|
+
{ name: "verifyingContract", type: "address" }
|
|
48004
|
+
];
|
|
48005
|
+
VERIFIABLE_CREDENTIAL_EIP712_TYPE = [
|
|
48006
|
+
{ name: "@context", type: "string[]" },
|
|
48007
|
+
{ name: "type", type: "string[]" },
|
|
48008
|
+
{ name: "id", type: "string" },
|
|
48009
|
+
{ name: "issuer", type: "Issuer" },
|
|
48010
|
+
{ name: "credentialSubject", type: "CredentialSubject" },
|
|
48011
|
+
{ name: "credentialSchema", type: "CredentialSchema" },
|
|
48012
|
+
{ name: "issuanceDate", type: "string" },
|
|
48013
|
+
{ name: "expirationDate", type: "string" }
|
|
48014
|
+
];
|
|
48015
|
+
CREDENTIAL_SCHEMA_EIP712_TYPE = [
|
|
48016
|
+
{ name: "id", type: "string" },
|
|
48017
|
+
{ name: "type", type: "string" }
|
|
48018
|
+
];
|
|
48019
|
+
CREDENTIAL_SUBJECT_TYPE = [
|
|
48020
|
+
{ name: "app", type: "string" },
|
|
48021
|
+
{ name: "id", type: "string" },
|
|
48022
|
+
{ name: "name", type: "string" }
|
|
48023
|
+
];
|
|
48024
|
+
ISSUER_TYPE = [
|
|
48025
|
+
{ name: "id", type: "string" },
|
|
48026
|
+
{ name: "ethereumAddress", type: "string" }
|
|
48027
|
+
];
|
|
48028
|
+
CREDENTIAL_TYPES = {
|
|
48029
|
+
EIP712Domain: DOMAIN_TYPE,
|
|
48030
|
+
VerifiableCredential: VERIFIABLE_CREDENTIAL_EIP712_TYPE,
|
|
48031
|
+
CredentialSchema: CREDENTIAL_SCHEMA_EIP712_TYPE,
|
|
48032
|
+
CredentialSubject: CREDENTIAL_SUBJECT_TYPE,
|
|
48033
|
+
Issuer: ISSUER_TYPE
|
|
48034
|
+
};
|
|
47455
48035
|
isExternalControlsEnabledEventFunctions = makePHEventFunctions("isExternalControlsEnabled");
|
|
47456
48036
|
setIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.setValue;
|
|
47457
48037
|
useIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.useValue;
|
|
@@ -47480,14 +48060,8 @@ spurious results.`);
|
|
|
47480
48060
|
vetraPackageManagerFunctions = makePHEventFunctions("vetraPackageManager");
|
|
47481
48061
|
useVetraPackageManager = vetraPackageManagerFunctions.useValue;
|
|
47482
48062
|
addVetraPackageManagerEventHandler = vetraPackageManagerFunctions.addEventHandler;
|
|
47483
|
-
|
|
47484
|
-
|
|
47485
|
-
useReactorClientModule = reactorClientModuleEventFunctions.useValue;
|
|
47486
|
-
setReactorClientModule = reactorClientModuleEventFunctions.setValue;
|
|
47487
|
-
addReactorClientModuleEventHandler = reactorClientModuleEventFunctions.addEventHandler;
|
|
47488
|
-
useReactorClient = reactorClientEventFunctions.useValue;
|
|
47489
|
-
setReactorClient = reactorClientEventFunctions.setValue;
|
|
47490
|
-
addReactorClientEventHandler = reactorClientEventFunctions.addEventHandler;
|
|
48063
|
+
EMPTY_PENDING = [];
|
|
48064
|
+
EMPTY_DISMISSED = [];
|
|
47491
48065
|
documentEventFunctions = makePHEventFunctions("documentCache");
|
|
47492
48066
|
useDocumentCache = documentEventFunctions.useValue;
|
|
47493
48067
|
setDocumentCache = documentEventFunctions.setValue;
|
|
@@ -48535,6 +49109,14 @@ spurious results.`);
|
|
|
48535
49109
|
...phDocumentEditorConfigHooks,
|
|
48536
49110
|
...nonUserConfigHooks
|
|
48537
49111
|
};
|
|
49112
|
+
reactorClientModuleEventFunctions = makePHEventFunctions("reactorClientModule");
|
|
49113
|
+
reactorClientEventFunctions = makePHEventFunctions("reactorClient");
|
|
49114
|
+
useReactorClientModule = reactorClientModuleEventFunctions.useValue;
|
|
49115
|
+
setReactorClientModule = reactorClientModuleEventFunctions.setValue;
|
|
49116
|
+
addReactorClientModuleEventHandler = reactorClientModuleEventFunctions.addEventHandler;
|
|
49117
|
+
useReactorClient = reactorClientEventFunctions.useValue;
|
|
49118
|
+
setReactorClient = reactorClientEventFunctions.setValue;
|
|
49119
|
+
addReactorClientEventHandler = reactorClientEventFunctions.addEventHandler;
|
|
48538
49120
|
featuresEventFunctions = makePHEventFunctions("features");
|
|
48539
49121
|
useFeatures = featuresEventFunctions.useValue;
|
|
48540
49122
|
setFeatures = featuresEventFunctions.setValue;
|
|
@@ -48567,51 +49149,6 @@ spurious results.`);
|
|
|
48567
49149
|
[SyncStatus.Error]: "ERROR"
|
|
48568
49150
|
};
|
|
48569
49151
|
lzString = __toESM2(require_lz_string(), 1);
|
|
48570
|
-
DOMAIN_TYPE = [
|
|
48571
|
-
{ name: "name", type: "string" },
|
|
48572
|
-
{ name: "version", type: "string" },
|
|
48573
|
-
{ name: "chainId", type: "uint256" },
|
|
48574
|
-
{ name: "verifyingContract", type: "address" }
|
|
48575
|
-
];
|
|
48576
|
-
VERIFIABLE_CREDENTIAL_EIP712_TYPE = [
|
|
48577
|
-
{ name: "@context", type: "string[]" },
|
|
48578
|
-
{ name: "type", type: "string[]" },
|
|
48579
|
-
{ name: "id", type: "string" },
|
|
48580
|
-
{ name: "issuer", type: "Issuer" },
|
|
48581
|
-
{ name: "credentialSubject", type: "CredentialSubject" },
|
|
48582
|
-
{ name: "credentialSchema", type: "CredentialSchema" },
|
|
48583
|
-
{ name: "issuanceDate", type: "string" },
|
|
48584
|
-
{ name: "expirationDate", type: "string" }
|
|
48585
|
-
];
|
|
48586
|
-
CREDENTIAL_SCHEMA_EIP712_TYPE = [
|
|
48587
|
-
{ name: "id", type: "string" },
|
|
48588
|
-
{ name: "type", type: "string" }
|
|
48589
|
-
];
|
|
48590
|
-
CREDENTIAL_SUBJECT_TYPE = [
|
|
48591
|
-
{ name: "app", type: "string" },
|
|
48592
|
-
{ name: "id", type: "string" },
|
|
48593
|
-
{ name: "name", type: "string" }
|
|
48594
|
-
];
|
|
48595
|
-
ISSUER_TYPE = [
|
|
48596
|
-
{ name: "id", type: "string" },
|
|
48597
|
-
{ name: "ethereumAddress", type: "string" }
|
|
48598
|
-
];
|
|
48599
|
-
CREDENTIAL_TYPES = {
|
|
48600
|
-
EIP712Domain: DOMAIN_TYPE,
|
|
48601
|
-
VerifiableCredential: VERIFIABLE_CREDENTIAL_EIP712_TYPE,
|
|
48602
|
-
CredentialSchema: CREDENTIAL_SCHEMA_EIP712_TYPE,
|
|
48603
|
-
CredentialSubject: CREDENTIAL_SUBJECT_TYPE,
|
|
48604
|
-
Issuer: ISSUER_TYPE
|
|
48605
|
-
};
|
|
48606
|
-
({
|
|
48607
|
-
useValue: useLoading,
|
|
48608
|
-
setValue: setLoading,
|
|
48609
|
-
addEventHandler: addLoadingEventHandler
|
|
48610
|
-
} = makePHEventFunctions("loading"));
|
|
48611
|
-
renownEventFunctions = makePHEventFunctions("renown");
|
|
48612
|
-
useRenown = renownEventFunctions.useValue;
|
|
48613
|
-
setRenown = renownEventFunctions.setValue;
|
|
48614
|
-
addRenownEventHandler = renownEventFunctions.addEventHandler;
|
|
48615
49152
|
store = {
|
|
48616
49153
|
get: function(key) {
|
|
48617
49154
|
const value = localStorage.getItem(key);
|
|
@@ -48784,7 +49321,7 @@ spurious results.`);
|
|
|
48784
49321
|
1541459225,
|
|
48785
49322
|
327033209
|
|
48786
49323
|
]);
|
|
48787
|
-
U32_MASK64 = /* @__PURE__ */ BigInt(
|
|
49324
|
+
U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
48788
49325
|
_32n = /* @__PURE__ */ BigInt(32);
|
|
48789
49326
|
SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
48790
49327
|
1116352408,
|
|
@@ -49334,7 +49871,7 @@ spurious results.`);
|
|
|
49334
49871
|
this.iHash.update(pad);
|
|
49335
49872
|
this.oHash = hash.create();
|
|
49336
49873
|
for (let i = 0;i < pad.length; i++)
|
|
49337
|
-
pad[i] ^=
|
|
49874
|
+
pad[i] ^= 54 ^ 92;
|
|
49338
49875
|
this.oHash.update(pad);
|
|
49339
49876
|
clean(pad);
|
|
49340
49877
|
}
|
|
@@ -49599,11 +50136,11 @@ spurious results.`);
|
|
|
49599
50136
|
RIPEMD160 = class RIPEMD160 extends HashMD {
|
|
49600
50137
|
constructor() {
|
|
49601
50138
|
super(64, 20, 8, true);
|
|
49602
|
-
this.h0 = 1732584193;
|
|
49603
|
-
this.h1 =
|
|
49604
|
-
this.h2 =
|
|
49605
|
-
this.h3 = 271733878;
|
|
49606
|
-
this.h4 =
|
|
50139
|
+
this.h0 = 1732584193 | 0;
|
|
50140
|
+
this.h1 = 4023233417 | 0;
|
|
50141
|
+
this.h2 = 2562383102 | 0;
|
|
50142
|
+
this.h3 = 271733878 | 0;
|
|
50143
|
+
this.h4 = 3285377520 | 0;
|
|
49607
50144
|
}
|
|
49608
50145
|
get() {
|
|
49609
50146
|
const { h0, h1, h2, h3, h4 } = this;
|
|
@@ -49781,7 +50318,7 @@ spurious results.`);
|
|
|
49781
50318
|
return to;
|
|
49782
50319
|
}
|
|
49783
50320
|
};
|
|
49784
|
-
keccak_256 = /* @__PURE__ */ (() => gen(1, 136,
|
|
50321
|
+
keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
|
|
49785
50322
|
import_canonicalize = __toESM2(require_canonicalize(), 1);
|
|
49786
50323
|
ID_CHAR = `(?:[a-zA-Z0-9._-]|${PCT_ENCODED})`;
|
|
49787
50324
|
METHOD_ID = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`;
|
|
@@ -54632,72 +55169,63 @@ spurious results.`);
|
|
|
54632
55169
|
this.name = "ConflictError";
|
|
54633
55170
|
}
|
|
54634
55171
|
};
|
|
54635
|
-
|
|
55172
|
+
Slot = forwardRef(({ children, ...props }, ref) => {
|
|
55173
|
+
const child = Children.only(children);
|
|
55174
|
+
if (!isValidElement(child)) {
|
|
55175
|
+
return null;
|
|
55176
|
+
}
|
|
55177
|
+
const childElement = child;
|
|
55178
|
+
const mergedProps = mergeProps(props, childElement.props);
|
|
55179
|
+
if (ref) {
|
|
55180
|
+
mergedProps.ref = ref;
|
|
55181
|
+
}
|
|
55182
|
+
return cloneElement(childElement, mergedProps);
|
|
55183
|
+
});
|
|
55184
|
+
Slot.displayName = "Slot";
|
|
55185
|
+
lightStyles = {
|
|
54636
55186
|
trigger: {
|
|
54637
|
-
|
|
54638
|
-
|
|
54639
|
-
|
|
54640
|
-
|
|
54641
|
-
|
|
54642
|
-
background: "transparent",
|
|
54643
|
-
cursor: "pointer"
|
|
54644
|
-
},
|
|
54645
|
-
popoverBase: {
|
|
54646
|
-
position: "absolute",
|
|
54647
|
-
left: 0,
|
|
54648
|
-
borderRadius: "8px",
|
|
54649
|
-
width: "208px",
|
|
54650
|
-
zIndex: 1000
|
|
54651
|
-
},
|
|
54652
|
-
popoverLight: {
|
|
54653
|
-
backgroundColor: "white",
|
|
54654
|
-
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"
|
|
55187
|
+
backgroundColor: "#ffffff",
|
|
55188
|
+
borderWidth: "1px",
|
|
55189
|
+
borderStyle: "solid",
|
|
55190
|
+
borderColor: "#d1d5db",
|
|
55191
|
+
color: "#111827"
|
|
54655
55192
|
},
|
|
54656
|
-
|
|
55193
|
+
triggerHover: {
|
|
55194
|
+
backgroundColor: "#ecf3f8",
|
|
55195
|
+
borderColor: "#9ca3af"
|
|
55196
|
+
}
|
|
55197
|
+
};
|
|
55198
|
+
darkStyles = {
|
|
55199
|
+
trigger: {
|
|
54657
55200
|
backgroundColor: "#1f2937",
|
|
54658
|
-
|
|
54659
|
-
|
|
54660
|
-
|
|
54661
|
-
|
|
55201
|
+
borderWidth: "1px",
|
|
55202
|
+
borderStyle: "solid",
|
|
55203
|
+
borderColor: "#4b5563",
|
|
55204
|
+
color: "#ecf3f8"
|
|
54662
55205
|
},
|
|
54663
|
-
|
|
54664
|
-
|
|
54665
|
-
|
|
54666
|
-
|
|
54667
|
-
|
|
54668
|
-
|
|
54669
|
-
|
|
55206
|
+
triggerHover: {
|
|
55207
|
+
backgroundColor: "#374151",
|
|
55208
|
+
borderColor: "#6b7280"
|
|
55209
|
+
}
|
|
55210
|
+
};
|
|
55211
|
+
styles = {
|
|
55212
|
+
wrapper: {
|
|
55213
|
+
position: "relative",
|
|
55214
|
+
display: "inline-block"
|
|
54670
55215
|
},
|
|
54671
|
-
|
|
55216
|
+
trigger: {
|
|
54672
55217
|
display: "flex",
|
|
54673
55218
|
alignItems: "center",
|
|
54674
55219
|
justifyContent: "center",
|
|
54675
|
-
|
|
54676
|
-
|
|
55220
|
+
gap: "8px",
|
|
55221
|
+
padding: "8px 32px",
|
|
54677
55222
|
borderRadius: "8px",
|
|
54678
|
-
backgroundColor: "transparent",
|
|
54679
|
-
fontSize: "14px",
|
|
54680
55223
|
cursor: "pointer",
|
|
54681
|
-
|
|
54682
|
-
|
|
54683
|
-
|
|
54684
|
-
|
|
54685
|
-
|
|
54686
|
-
},
|
|
54687
|
-
connectButtonDark: {
|
|
54688
|
-
border: "1px solid #4b5563",
|
|
54689
|
-
color: "#f9fafb"
|
|
54690
|
-
},
|
|
54691
|
-
wrapper: {
|
|
54692
|
-
position: "relative",
|
|
54693
|
-
display: "inline-block"
|
|
54694
|
-
},
|
|
54695
|
-
triggerImageLight: {
|
|
54696
|
-
display: "block"
|
|
54697
|
-
},
|
|
54698
|
-
triggerImageDark: {
|
|
54699
|
-
display: "block",
|
|
54700
|
-
filter: "invert(1)"
|
|
55224
|
+
fontSize: "14px",
|
|
55225
|
+
fontWeight: 500,
|
|
55226
|
+
fontFamily: "inherit",
|
|
55227
|
+
lineHeight: "20px",
|
|
55228
|
+
transition: "background-color 150ms, border-color 150ms"
|
|
54701
55229
|
}
|
|
54702
55230
|
};
|
|
54703
55231
|
styles2 = {
|
|
@@ -54708,56 +55236,89 @@ spurious results.`);
|
|
|
54708
55236
|
trigger: {
|
|
54709
55237
|
display: "flex",
|
|
54710
55238
|
alignItems: "center",
|
|
54711
|
-
|
|
54712
|
-
padding:
|
|
54713
|
-
|
|
54714
|
-
|
|
55239
|
+
gap: "8px",
|
|
55240
|
+
padding: "6px 12px",
|
|
55241
|
+
borderWidth: "1px",
|
|
55242
|
+
borderStyle: "solid",
|
|
55243
|
+
borderColor: "#e5e7eb",
|
|
55244
|
+
backgroundColor: "#ffffff",
|
|
54715
55245
|
cursor: "pointer",
|
|
54716
|
-
borderRadius: "
|
|
54717
|
-
|
|
55246
|
+
borderRadius: "8px",
|
|
55247
|
+
fontSize: "12px",
|
|
55248
|
+
fontWeight: 500,
|
|
55249
|
+
fontFamily: "inherit",
|
|
55250
|
+
color: "#111827",
|
|
55251
|
+
transition: "background-color 150ms, border-color 150ms"
|
|
55252
|
+
},
|
|
55253
|
+
triggerHover: {
|
|
55254
|
+
backgroundColor: "#f9fafb",
|
|
55255
|
+
borderColor: "#9ca3af"
|
|
54718
55256
|
},
|
|
54719
55257
|
avatar: {
|
|
54720
|
-
width: "
|
|
54721
|
-
height: "
|
|
55258
|
+
width: "28px",
|
|
55259
|
+
height: "28px",
|
|
54722
55260
|
borderRadius: "50%",
|
|
54723
|
-
objectFit: "cover"
|
|
55261
|
+
objectFit: "cover",
|
|
55262
|
+
flexShrink: 0
|
|
54724
55263
|
},
|
|
54725
55264
|
avatarPlaceholder: {
|
|
54726
|
-
width: "
|
|
54727
|
-
height: "
|
|
55265
|
+
width: "28px",
|
|
55266
|
+
height: "28px",
|
|
54728
55267
|
borderRadius: "50%",
|
|
54729
|
-
|
|
55268
|
+
background: "linear-gradient(135deg, #8b5cf6, #3b82f6)",
|
|
54730
55269
|
display: "flex",
|
|
54731
55270
|
alignItems: "center",
|
|
54732
|
-
justifyContent: "center"
|
|
55271
|
+
justifyContent: "center",
|
|
55272
|
+
flexShrink: 0
|
|
55273
|
+
},
|
|
55274
|
+
avatarInitial: {
|
|
55275
|
+
fontSize: "12px",
|
|
55276
|
+
fontWeight: 700,
|
|
55277
|
+
color: "#ffffff",
|
|
55278
|
+
lineHeight: 1
|
|
55279
|
+
},
|
|
55280
|
+
displayName: {
|
|
55281
|
+
maxWidth: "120px",
|
|
55282
|
+
overflow: "hidden",
|
|
55283
|
+
textOverflow: "ellipsis",
|
|
55284
|
+
whiteSpace: "nowrap"
|
|
55285
|
+
},
|
|
55286
|
+
chevron: {
|
|
55287
|
+
flexShrink: 0,
|
|
55288
|
+
transition: "transform 150ms",
|
|
55289
|
+
color: "#6b7280"
|
|
55290
|
+
},
|
|
55291
|
+
chevronOpen: {
|
|
55292
|
+
transform: "rotate(180deg)"
|
|
54733
55293
|
},
|
|
54734
55294
|
popoverBase: {
|
|
54735
55295
|
position: "absolute",
|
|
54736
|
-
|
|
54737
|
-
backgroundColor: "
|
|
55296
|
+
right: 0,
|
|
55297
|
+
backgroundColor: "#ffffff",
|
|
54738
55298
|
borderRadius: "8px",
|
|
54739
|
-
boxShadow: "0 4px
|
|
54740
|
-
width: "
|
|
55299
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)",
|
|
55300
|
+
width: "100%",
|
|
54741
55301
|
zIndex: 1000,
|
|
54742
|
-
color: "#111827"
|
|
55302
|
+
color: "#111827",
|
|
55303
|
+
borderWidth: "1px",
|
|
55304
|
+
borderStyle: "solid",
|
|
55305
|
+
borderColor: "#e5e7eb",
|
|
55306
|
+
overflow: "hidden"
|
|
54743
55307
|
},
|
|
54744
|
-
|
|
54745
|
-
padding: "
|
|
55308
|
+
header: {
|
|
55309
|
+
padding: "12px 16px",
|
|
54746
55310
|
borderBottom: "1px solid #e5e7eb"
|
|
54747
55311
|
},
|
|
54748
|
-
|
|
54749
|
-
padding: "8px 12px",
|
|
54750
|
-
borderBottom: "none"
|
|
54751
|
-
},
|
|
54752
|
-
username: {
|
|
55312
|
+
headerUsername: {
|
|
54753
55313
|
fontSize: "14px",
|
|
54754
|
-
fontWeight:
|
|
54755
|
-
color: "#111827"
|
|
55314
|
+
fontWeight: 600,
|
|
55315
|
+
color: "#111827",
|
|
55316
|
+
margin: 0
|
|
54756
55317
|
},
|
|
54757
55318
|
addressRow: {
|
|
54758
55319
|
display: "flex",
|
|
54759
55320
|
alignItems: "center",
|
|
54760
|
-
gap: "
|
|
55321
|
+
gap: "4px",
|
|
54761
55322
|
marginTop: "4px"
|
|
54762
55323
|
},
|
|
54763
55324
|
addressButton: {
|
|
@@ -54766,19 +55327,21 @@ spurious results.`);
|
|
|
54766
55327
|
gap: "4px",
|
|
54767
55328
|
padding: 0,
|
|
54768
55329
|
border: "none",
|
|
54769
|
-
|
|
55330
|
+
backgroundColor: "transparent",
|
|
54770
55331
|
cursor: "pointer",
|
|
54771
55332
|
fontSize: "12px",
|
|
54772
|
-
color: "#
|
|
55333
|
+
color: "#6b7280",
|
|
55334
|
+
fontFamily: "inherit",
|
|
54773
55335
|
position: "relative",
|
|
54774
55336
|
width: "100%"
|
|
54775
55337
|
},
|
|
54776
55338
|
copiedText: {
|
|
54777
55339
|
fontSize: "12px",
|
|
54778
|
-
color: "#
|
|
55340
|
+
color: "#059669",
|
|
54779
55341
|
position: "absolute",
|
|
54780
55342
|
left: 0,
|
|
54781
|
-
transition: "opacity 150ms"
|
|
55343
|
+
transition: "opacity 150ms",
|
|
55344
|
+
fontWeight: 500
|
|
54782
55345
|
},
|
|
54783
55346
|
addressText: {
|
|
54784
55347
|
display: "flex",
|
|
@@ -54786,21 +55349,35 @@ spurious results.`);
|
|
|
54786
55349
|
gap: "4px",
|
|
54787
55350
|
transition: "opacity 150ms"
|
|
54788
55351
|
},
|
|
55352
|
+
menuSection: {
|
|
55353
|
+
padding: "4px 0"
|
|
55354
|
+
},
|
|
54789
55355
|
menuItem: {
|
|
54790
55356
|
display: "flex",
|
|
54791
55357
|
alignItems: "center",
|
|
54792
55358
|
gap: "8px",
|
|
54793
55359
|
width: "100%",
|
|
54794
|
-
padding:
|
|
55360
|
+
padding: "8px 16px",
|
|
54795
55361
|
border: "none",
|
|
54796
|
-
|
|
55362
|
+
backgroundColor: "transparent",
|
|
54797
55363
|
cursor: "pointer",
|
|
54798
55364
|
fontSize: "14px",
|
|
54799
|
-
color: "#
|
|
54800
|
-
textDecoration: "none"
|
|
55365
|
+
color: "#374151",
|
|
55366
|
+
textDecoration: "none",
|
|
55367
|
+
fontFamily: "inherit",
|
|
55368
|
+
transition: "background-color 150ms"
|
|
55369
|
+
},
|
|
55370
|
+
menuItemHover: {
|
|
55371
|
+
backgroundColor: "#f3f4f6"
|
|
54801
55372
|
},
|
|
54802
55373
|
disconnectItem: {
|
|
54803
|
-
color: "#
|
|
55374
|
+
color: "#dc2626"
|
|
55375
|
+
},
|
|
55376
|
+
separator: {
|
|
55377
|
+
height: "1px",
|
|
55378
|
+
backgroundColor: "#e5e7eb",
|
|
55379
|
+
margin: 0,
|
|
55380
|
+
border: "none"
|
|
54804
55381
|
}
|
|
54805
55382
|
};
|
|
54806
55383
|
});
|
|
@@ -65726,7 +66303,7 @@ var init_common2 = __esm(() => {
|
|
|
65726
66303
|
});
|
|
65727
66304
|
|
|
65728
66305
|
// ../../packages/renown/dist/src/common.js
|
|
65729
|
-
class
|
|
66306
|
+
class Renown3 {
|
|
65730
66307
|
#baseUrl;
|
|
65731
66308
|
#store;
|
|
65732
66309
|
#eventEmitter;
|
|
@@ -65976,7 +66553,7 @@ class BaseRenownBuilder2 {
|
|
|
65976
66553
|
const storage = this.#storage ?? new RenownMemoryStorage2;
|
|
65977
66554
|
const eventEmitter = this.#eventEmitter ?? new MemoryEventEmitter2;
|
|
65978
66555
|
const baseUrl = this.#baseUrl ?? DEFAULT_RENOWN_URL2;
|
|
65979
|
-
const renown = new
|
|
66556
|
+
const renown = new Renown3(storage, eventEmitter, crypto4, this.#appName, baseUrl, this.#profileFetcher ?? fetchRenownProfile2);
|
|
65980
66557
|
if (renown.user) {
|
|
65981
66558
|
try {
|
|
65982
66559
|
await renown.login(renown.user.did);
|
|
@@ -79602,7 +80179,7 @@ var init_dist2 = __esm(() => {
|
|
|
79602
80179
|
|
|
79603
80180
|
// src/utils/reactor.ts
|
|
79604
80181
|
import { PGlite as PGlite2 } from "@electric-sql/pglite";
|
|
79605
|
-
async function createBrowserReactor(documentModelModules, upgradeManifests, renown) {
|
|
80182
|
+
async function createBrowserReactor(documentModelModules, upgradeManifests, renown, documentModelLoader) {
|
|
79606
80183
|
const signerConfig = {
|
|
79607
80184
|
signer: renown.signer,
|
|
79608
80185
|
verifier: createSignatureVerifier()
|
|
@@ -79620,6 +80197,9 @@ async function createBrowserReactor(documentModelModules, upgradeManifests, reno
|
|
|
79620
80197
|
const builder = new ReactorClientBuilder().withLogger(logger7).withSigner(signerConfig).withReactorBuilder(new ReactorBuilder().withDocumentModels(documentModelModules).withUpgradeManifests(upgradeManifests).withChannelScheme(ChannelScheme.CONNECT).withJwtHandler(jwtHandler).withKysely(new Kysely3({
|
|
79621
80198
|
dialect: new PGliteDialect3(pg)
|
|
79622
80199
|
})));
|
|
80200
|
+
if (documentModelLoader) {
|
|
80201
|
+
builder.withDocumentModelLoader(documentModelLoader);
|
|
80202
|
+
}
|
|
79623
80203
|
const module = await builder.buildModule();
|
|
79624
80204
|
return {
|
|
79625
80205
|
...module,
|
|
@@ -79649,6 +80229,41 @@ var init_reactor = __esm(() => {
|
|
|
79649
80229
|
init_dist2();
|
|
79650
80230
|
});
|
|
79651
80231
|
|
|
80232
|
+
// src/utils/registry-url.ts
|
|
80233
|
+
function loadPersistedState() {
|
|
80234
|
+
try {
|
|
80235
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
80236
|
+
if (raw)
|
|
80237
|
+
return JSON.parse(raw);
|
|
80238
|
+
} catch {}
|
|
80239
|
+
return null;
|
|
80240
|
+
}
|
|
80241
|
+
function getConfiguredRegistryUrls() {
|
|
80242
|
+
const registry = connectConfig.packagesRegistry;
|
|
80243
|
+
if (!registry)
|
|
80244
|
+
return [];
|
|
80245
|
+
return registry.split(",").map((u) => u.trim()).filter(Boolean);
|
|
80246
|
+
}
|
|
80247
|
+
function getDefaultRegistryCdnUrl() {
|
|
80248
|
+
const persisted = loadPersistedState();
|
|
80249
|
+
const urls = getConfiguredRegistryUrls();
|
|
80250
|
+
if (persisted) {
|
|
80251
|
+
if (persisted.selectedRegistryId === "custom") {
|
|
80252
|
+
if (persisted.customRegistryUrl)
|
|
80253
|
+
return persisted.customRegistryUrl;
|
|
80254
|
+
} else {
|
|
80255
|
+
const index = parseInt(persisted.selectedRegistryId.replace("registry-", ""), 10);
|
|
80256
|
+
if (!isNaN(index) && urls[index])
|
|
80257
|
+
return urls[index];
|
|
80258
|
+
}
|
|
80259
|
+
}
|
|
80260
|
+
return urls[0];
|
|
80261
|
+
}
|
|
80262
|
+
var STORAGE_KEY = "ph-connect-registry-selection";
|
|
80263
|
+
var init_registry_url = __esm(() => {
|
|
80264
|
+
init_connect_config();
|
|
80265
|
+
});
|
|
80266
|
+
|
|
79652
80267
|
// src/utils/registerServiceWorker.ts
|
|
79653
80268
|
class ServiceWorkerManager {
|
|
79654
80269
|
ready = false;
|
|
@@ -79751,6 +80366,7 @@ var init_utils6 = __esm(() => {
|
|
|
79751
80366
|
init_openUrl();
|
|
79752
80367
|
init_package_json();
|
|
79753
80368
|
init_reactor();
|
|
80369
|
+
init_registry_url();
|
|
79754
80370
|
init_registerServiceWorker();
|
|
79755
80371
|
});
|
|
79756
80372
|
|
|
@@ -108584,7 +109200,7 @@ function createV6CompatibleWrapCreateMemoryRouter(createRouterFunction, version5
|
|
|
108584
109200
|
function createReactRouterV6CompatibleTracingIntegration(options, version5) {
|
|
108585
109201
|
const integration = browserTracingIntegration({ ...options, instrumentPageLoad: false, instrumentNavigation: false });
|
|
108586
109202
|
const {
|
|
108587
|
-
useEffect:
|
|
109203
|
+
useEffect: useEffect9,
|
|
108588
109204
|
useLocation,
|
|
108589
109205
|
useNavigationType,
|
|
108590
109206
|
createRoutesFromChildren,
|
|
@@ -108615,7 +109231,7 @@ function createReactRouterV6CompatibleTracingIntegration(options, version5) {
|
|
|
108615
109231
|
} else {
|
|
108616
109232
|
_lazyRouteTimeout = configuredMaxWait;
|
|
108617
109233
|
}
|
|
108618
|
-
_useEffect =
|
|
109234
|
+
_useEffect = useEffect9;
|
|
108619
109235
|
_useLocation = useLocation;
|
|
108620
109236
|
_useNavigationType = useNavigationType;
|
|
108621
109237
|
_matchRoutes2 = matchRoutes2;
|
|
@@ -136258,7 +136874,7 @@ ${typeDefsDoc}`;
|
|
|
136258
136874
|
|
|
136259
136875
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/context/schema-context.js
|
|
136260
136876
|
import { jsx as _jsx2 } from "react/jsx-runtime";
|
|
136261
|
-
import { createContext, useContext, useEffect as
|
|
136877
|
+
import { createContext, useContext, useEffect as useEffect10, useState as useState11 } from "react";
|
|
136262
136878
|
function makeSharedSchemaSdl(existingSchemaSdl, globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl) {
|
|
136263
136879
|
const existingSchema = buildSchema(existingSchemaSdl);
|
|
136264
136880
|
const sdls = [
|
|
@@ -136332,7 +136948,7 @@ function parseSharedSchemaSdl(initialSchema2, globalStateSchemaSdl, localStateSc
|
|
|
136332
136948
|
function SchemaContextProvider(props) {
|
|
136333
136949
|
const { children, globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl } = props;
|
|
136334
136950
|
const [sharedSchemaSdl, setSharedSchemaSdl] = useState11(() => parseSharedSchemaSdl(printSchema(initialSchema), globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl));
|
|
136335
|
-
|
|
136951
|
+
useEffect10(() => {
|
|
136336
136952
|
setSharedSchemaSdl((prev) => parseSharedSchemaSdl(prev.sharedSchema, globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl));
|
|
136337
136953
|
}, [globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl]);
|
|
136338
136954
|
return _jsx2(SchemaContext.Provider, { value: sharedSchemaSdl, children });
|
|
@@ -145545,7 +146161,7 @@ var init_dist4 = () => {};
|
|
|
145545
146161
|
|
|
145546
146162
|
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.14_react@19.2.4/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
145547
146163
|
import * as React7 from "react";
|
|
145548
|
-
import { Fragment as
|
|
146164
|
+
import { Fragment as Fragment22, jsx } from "react/jsx-runtime";
|
|
145549
146165
|
function isPromiseLike(value) {
|
|
145550
146166
|
return typeof value === "object" && value !== null && "then" in value;
|
|
145551
146167
|
}
|
|
@@ -145587,7 +146203,7 @@ function createSlotClone(ownerName) {
|
|
|
145587
146203
|
}
|
|
145588
146204
|
if (React7.isValidElement(children)) {
|
|
145589
146205
|
const childrenRef = getElementRef(children);
|
|
145590
|
-
const props2 =
|
|
146206
|
+
const props2 = mergeProps2(slotProps, children.props);
|
|
145591
146207
|
if (children.type !== React7.Fragment) {
|
|
145592
146208
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
145593
146209
|
}
|
|
@@ -145601,7 +146217,7 @@ function createSlotClone(ownerName) {
|
|
|
145601
146217
|
function isSlottable(child) {
|
|
145602
146218
|
return React7.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
145603
146219
|
}
|
|
145604
|
-
function
|
|
146220
|
+
function mergeProps2(slotProps, childProps) {
|
|
145605
146221
|
const overrideProps = { ...childProps };
|
|
145606
146222
|
for (const propName in childProps) {
|
|
145607
146223
|
const slotPropValue = slotProps[propName];
|
|
@@ -145638,12 +146254,12 @@ function getElementRef(element) {
|
|
|
145638
146254
|
}
|
|
145639
146255
|
return element.props.ref || element.ref;
|
|
145640
146256
|
}
|
|
145641
|
-
var REACT_LAZY_TYPE, use2,
|
|
146257
|
+
var REACT_LAZY_TYPE, use2, Slot2, SLOTTABLE_IDENTIFIER;
|
|
145642
146258
|
var init_dist5 = __esm(() => {
|
|
145643
146259
|
init_dist4();
|
|
145644
146260
|
REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
145645
146261
|
use2 = React7[" use ".trim().toString()];
|
|
145646
|
-
|
|
146262
|
+
Slot2 = /* @__PURE__ */ createSlot("Slot");
|
|
145647
146263
|
SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
145648
146264
|
});
|
|
145649
146265
|
|
|
@@ -145738,10 +146354,10 @@ var init_dist6 = __esm(() => {
|
|
|
145738
146354
|
"ul"
|
|
145739
146355
|
];
|
|
145740
146356
|
Primitive = NODES.reduce((primitive, node) => {
|
|
145741
|
-
const
|
|
146357
|
+
const Slot3 = createSlot(`Primitive.${node}`);
|
|
145742
146358
|
const Node2 = React10.forwardRef((props, forwardedRef) => {
|
|
145743
146359
|
const { asChild, ...primitiveProps } = props;
|
|
145744
|
-
const Comp = asChild ?
|
|
146360
|
+
const Comp = asChild ? Slot3 : node;
|
|
145745
146361
|
if (typeof window !== "undefined") {
|
|
145746
146362
|
window[Symbol.for("radix-ui")] = true;
|
|
145747
146363
|
}
|
|
@@ -145885,7 +146501,7 @@ var init_form = __esm(() => {
|
|
|
145885
146501
|
FormLabel.displayName = "FormLabel";
|
|
145886
146502
|
FormControl = React13.forwardRef(({ ...props }, ref) => {
|
|
145887
146503
|
const { error: error50, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
145888
|
-
return _jsx4(
|
|
146504
|
+
return _jsx4(Slot2, { ref, id: formItemId, "aria-describedby": !error50 ? formDescriptionId : `${formDescriptionId} ${formMessageId}`, "aria-invalid": !!error50, ...props });
|
|
145889
146505
|
});
|
|
145890
146506
|
FormControl.displayName = "FormControl";
|
|
145891
146507
|
FormDescription = React13.forwardRef(({ className, ...props }, ref) => {
|
|
@@ -145907,18 +146523,18 @@ var init_form = __esm(() => {
|
|
|
145907
146523
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/text-area.js
|
|
145908
146524
|
import { jsx as _jsx5 } from "react/jsx-runtime";
|
|
145909
146525
|
import * as React14 from "react";
|
|
145910
|
-
import { forwardRef as
|
|
146526
|
+
import { forwardRef as forwardRef7, useImperativeHandle, useRef as useRef9, useCallback as useCallback8 } from "react";
|
|
145911
146527
|
var Textarea;
|
|
145912
146528
|
var init_text_area = __esm(() => {
|
|
145913
146529
|
init_style();
|
|
145914
|
-
Textarea =
|
|
145915
|
-
const textareaRef =
|
|
145916
|
-
const adjustHeight =
|
|
146530
|
+
Textarea = forwardRef7(({ className, ...props }, ref) => {
|
|
146531
|
+
const textareaRef = useRef9(null);
|
|
146532
|
+
const adjustHeight = useCallback8((textarea) => {
|
|
145917
146533
|
textarea.style.height = "auto";
|
|
145918
146534
|
const newHeight = Math.max(textarea.scrollHeight, textarea.offsetHeight);
|
|
145919
146535
|
textarea.style.height = `${newHeight}px`;
|
|
145920
146536
|
}, []);
|
|
145921
|
-
const handleInput =
|
|
146537
|
+
const handleInput = useCallback8((e3) => {
|
|
145922
146538
|
adjustHeight(e3.currentTarget);
|
|
145923
146539
|
}, [adjustHeight]);
|
|
145924
146540
|
React14.useEffect(() => {
|
|
@@ -145937,7 +146553,7 @@ var init_text_area = __esm(() => {
|
|
|
145937
146553
|
|
|
145938
146554
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/text-field.js
|
|
145939
146555
|
import { jsx as _jsx6, jsxs as _jsxs } from "react/jsx-runtime";
|
|
145940
|
-
import { forwardRef as
|
|
146556
|
+
import { forwardRef as forwardRef8, useCallback as useCallback10, useEffect as useEffect12, useId as useId2, useImperativeHandle as useImperativeHandle2, useRef as useRef10 } from "react";
|
|
145941
146557
|
var TextField;
|
|
145942
146558
|
var init_text_field = __esm(() => {
|
|
145943
146559
|
init_zod2();
|
|
@@ -145947,10 +146563,10 @@ var init_text_field = __esm(() => {
|
|
|
145947
146563
|
init_helpers3();
|
|
145948
146564
|
init_form();
|
|
145949
146565
|
init_text_area();
|
|
145950
|
-
TextField =
|
|
145951
|
-
const textareaRef =
|
|
146566
|
+
TextField = forwardRef8(({ name: name6, value, onSubmit, label, placeholder, unique, className = "", rows = 1, focusOnMount = false, required: required2 = false, allowEmpty = false, shouldReset = false, onChange }, ref) => {
|
|
146567
|
+
const textareaRef = useRef10(null);
|
|
145952
146568
|
const id = useId2();
|
|
145953
|
-
|
|
146569
|
+
useEffect12(() => {
|
|
145954
146570
|
if (focusOnMount && textareaRef.current) {
|
|
145955
146571
|
textareaRef.current.focus();
|
|
145956
146572
|
}
|
|
@@ -145964,7 +146580,7 @@ var init_text_field = __esm(() => {
|
|
|
145964
146580
|
[name6]: value ?? ""
|
|
145965
146581
|
}
|
|
145966
146582
|
});
|
|
145967
|
-
const handleSubmit =
|
|
146583
|
+
const handleSubmit = useCallback10((values) => {
|
|
145968
146584
|
const newValue = values[name6];
|
|
145969
146585
|
if (newValue === undefined || value === newValue)
|
|
145970
146586
|
return;
|
|
@@ -145972,7 +146588,7 @@ var init_text_field = __esm(() => {
|
|
|
145972
146588
|
if (shouldReset)
|
|
145973
146589
|
form.reset({ [name6]: "" });
|
|
145974
146590
|
}, [name6, value, onSubmit, form, shouldReset]);
|
|
145975
|
-
const handleBlur =
|
|
146591
|
+
const handleBlur = useCallback10(async () => {
|
|
145976
146592
|
const currentValue = form.getValues()[name6] ?? "";
|
|
145977
146593
|
if (value === null || value === undefined) {
|
|
145978
146594
|
if (!currentValue || currentValue.trim() === "")
|
|
@@ -145987,20 +146603,20 @@ var init_text_field = __esm(() => {
|
|
|
145987
146603
|
}
|
|
145988
146604
|
} catch (e3) {}
|
|
145989
146605
|
}, [form, handleSubmit, name6, value]);
|
|
145990
|
-
const onEnterKeyDown =
|
|
146606
|
+
const onEnterKeyDown = useCallback10((e3) => {
|
|
145991
146607
|
if (e3.key === "Enter") {
|
|
145992
146608
|
e3.preventDefault();
|
|
145993
146609
|
e3.target.blur();
|
|
145994
146610
|
}
|
|
145995
146611
|
}, []);
|
|
145996
|
-
const handleChange =
|
|
146612
|
+
const handleChange = useCallback10((e3) => {
|
|
145997
146613
|
const newValue = e3.target.value;
|
|
145998
146614
|
onChange?.(newValue);
|
|
145999
146615
|
}, [onChange]);
|
|
146000
146616
|
useImperativeHandle2(ref, () => ({
|
|
146001
146617
|
focus: () => textareaRef.current?.focus()
|
|
146002
146618
|
}));
|
|
146003
|
-
|
|
146619
|
+
useEffect12(() => {
|
|
146004
146620
|
form.reset({ [name6]: value ?? "" });
|
|
146005
146621
|
}, [form, name6, value]);
|
|
146006
146622
|
return _jsx6(Form2, { ...form, children: _jsx6(FormField, { control: form.control, name: name6, render: ({ field }) => _jsxs(FormItem, { className: "grid h-full grid-rows-[auto,1fr] gap-2 overflow-visible", children: [!!label && _jsx6(FormLabel, { htmlFor: name6, className: "text-sm font-medium text-gray-700", children: label }), _jsx6(FormControl, { children: _jsx6(Textarea, { ...field, id, name: name6, ref: (node) => {
|
|
@@ -146018,13 +146634,13 @@ var init_text_field = __esm(() => {
|
|
|
146018
146634
|
|
|
146019
146635
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/model-metadata-form.js
|
|
146020
146636
|
import { jsx as _jsx7, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
146021
|
-
import { useCallback as
|
|
146637
|
+
import { useCallback as useCallback11 } from "react";
|
|
146022
146638
|
function ModelMetadata(props) {
|
|
146023
146639
|
return _jsxs2("div", { children: [_jsx7(ModelNameForm, { ...props }), _jsx7("div", { className: "flex h-full flex-col gap-4", children: _jsxs2("div", { className: "grid flex-1 grid-cols-3 items-start gap-4", children: [_jsxs2("div", { className: "col-span-2 flex h-full flex-col gap-4", children: [_jsx7("div", { className: "shrink-0", children: _jsx7(DocumentTypeForm, { ...props }) }), _jsx7("div", { className: "min-h-0 flex-1", children: _jsx7(DescriptionForm, { ...props }) })] }), _jsxs2("div", { className: "col-span-1 flex flex-col gap-4", children: [_jsx7(AuthorNameForm, { ...props }), _jsx7(AuthorWebsiteForm, { ...props }), _jsx7(ModelExtensionForm, { ...props })] })] }) })] });
|
|
146024
146640
|
}
|
|
146025
146641
|
function ModelNameForm(props) {
|
|
146026
146642
|
const { name: name6, globalStateSchema, localStateSchema, setModelName, setStateSchema } = props;
|
|
146027
|
-
const onSubmit =
|
|
146643
|
+
const onSubmit = useCallback11((newName) => {
|
|
146028
146644
|
if (name6 === newName) {
|
|
146029
146645
|
return;
|
|
146030
146646
|
}
|
|
@@ -146116,10 +146732,10 @@ var init_module_form = __esm(() => {
|
|
|
146116
146732
|
|
|
146117
146733
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation-form.js
|
|
146118
146734
|
import { jsx as _jsx9 } from "react/jsx-runtime";
|
|
146119
|
-
import { useCallback as
|
|
146735
|
+
import { useCallback as useCallback12 } from "react";
|
|
146120
146736
|
function OperationForm({ operation, module, focusOnMount, allOperationNames, onAddOperationAndInitialSchema, updateOperationName, deleteOperation }) {
|
|
146121
146737
|
const isEdit = !!operation;
|
|
146122
|
-
const handleSubmit =
|
|
146738
|
+
const handleSubmit = useCallback12(async (name6) => {
|
|
146123
146739
|
if (isEdit && name6 === "") {
|
|
146124
146740
|
deleteOperation(operation.id);
|
|
146125
146741
|
return;
|
|
@@ -146141,7 +146757,7 @@ function OperationForm({ operation, module, focusOnMount, allOperationNames, onA
|
|
|
146141
146757
|
updateOperationName,
|
|
146142
146758
|
onAddOperationAndInitialSchema
|
|
146143
146759
|
]);
|
|
146144
|
-
const handleChange =
|
|
146760
|
+
const handleChange = useCallback12((value) => {
|
|
146145
146761
|
if (isEdit && value === "") {
|
|
146146
146762
|
deleteOperation(operation.id);
|
|
146147
146763
|
}
|
|
@@ -146207,10 +146823,10 @@ var init_linting = __esm(() => {
|
|
|
146207
146823
|
|
|
146208
146824
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation-description-form.js
|
|
146209
146825
|
import { jsx as _jsx10 } from "react/jsx-runtime";
|
|
146210
|
-
import { useEffect as
|
|
146826
|
+
import { useEffect as useEffect13, useRef as useRef11 } from "react";
|
|
146211
146827
|
function OperationDescriptionForm({ operation, focusOnMount, setOperationDescription }) {
|
|
146212
|
-
const textFieldRef =
|
|
146213
|
-
|
|
146828
|
+
const textFieldRef = useRef11(null);
|
|
146829
|
+
useEffect13(() => {
|
|
146214
146830
|
if (focusOnMount && textFieldRef.current) {
|
|
146215
146831
|
textFieldRef.current.focus();
|
|
146216
146832
|
}
|
|
@@ -146223,12 +146839,12 @@ var init_operation_description_form = __esm(() => {
|
|
|
146223
146839
|
|
|
146224
146840
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation-error-form.js
|
|
146225
146841
|
import { jsx as _jsx11 } from "react/jsx-runtime";
|
|
146226
|
-
import { useCallback as
|
|
146842
|
+
import { useCallback as useCallback13, useRef as useRef12 } from "react";
|
|
146227
146843
|
function OperationErrorForm({ operation, error: error50, focusOnMount, onSubmit, onAddOperationError, deleteOperationError, setOperationErrorName }) {
|
|
146228
|
-
const textFieldRef =
|
|
146844
|
+
const textFieldRef = useRef12(null);
|
|
146229
146845
|
const isEdit = !!error50;
|
|
146230
146846
|
const allOperationErrorNames = operation.errors.map((o3) => o3.name).filter((n5) => n5 !== null);
|
|
146231
|
-
const handleSubmit =
|
|
146847
|
+
const handleSubmit = useCallback13((name6) => {
|
|
146232
146848
|
if (isEdit && name6 === "") {
|
|
146233
146849
|
deleteOperationError(error50.id);
|
|
146234
146850
|
return;
|
|
@@ -146249,7 +146865,7 @@ function OperationErrorForm({ operation, error: error50, focusOnMount, onSubmit,
|
|
|
146249
146865
|
onAddOperationError,
|
|
146250
146866
|
onSubmit
|
|
146251
146867
|
]);
|
|
146252
|
-
const handleChange =
|
|
146868
|
+
const handleChange = useCallback13((value) => {
|
|
146253
146869
|
if (isEdit && value === "") {
|
|
146254
146870
|
deleteOperationError(error50.id);
|
|
146255
146871
|
}
|
|
@@ -146263,18 +146879,18 @@ var init_operation_error_form = __esm(() => {
|
|
|
146263
146879
|
|
|
146264
146880
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation-errors.js
|
|
146265
146881
|
import { jsx as _jsx12, jsxs as _jsxs3 } from "react/jsx-runtime";
|
|
146266
|
-
import { useCallback as
|
|
146882
|
+
import { useCallback as useCallback14, useId as useId3, useState as useState12 } from "react";
|
|
146267
146883
|
function OperationErrors({ operation, addOperationError, deleteOperationError, setOperationErrorName }) {
|
|
146268
146884
|
const addErrorFormId = useId3();
|
|
146269
146885
|
const [shouldFocusAddForm, setShouldFocusAddForm] = useState12(false);
|
|
146270
|
-
const onAddOperationError =
|
|
146886
|
+
const onAddOperationError = useCallback14(async (operationId, error50) => {
|
|
146271
146887
|
const errorId = await addOperationError(operationId, error50);
|
|
146272
146888
|
if (errorId) {
|
|
146273
146889
|
setShouldFocusAddForm(true);
|
|
146274
146890
|
}
|
|
146275
146891
|
return errorId;
|
|
146276
146892
|
}, [addOperationError, setShouldFocusAddForm]);
|
|
146277
|
-
const onAddOperationErrorSubmit =
|
|
146893
|
+
const onAddOperationErrorSubmit = useCallback14(() => setShouldFocusAddForm(false), [setShouldFocusAddForm]);
|
|
146278
146894
|
return _jsxs3("ul", { className: "ml-4 list-disc", children: [operation.errors.map((error50) => _jsx12("li", { children: _jsx12(OperationErrorForm, { error: error50, operation, onAddOperationError, deleteOperationError, setOperationErrorName }) }, error50.id)), _jsx12("li", { children: _jsx12(OperationErrorForm, { operation, onAddOperationError, deleteOperationError, setOperationErrorName, focusOnMount: shouldFocusAddForm, onSubmit: onAddOperationErrorSubmit }, `${addErrorFormId}-${shouldFocusAddForm}`) })] });
|
|
146279
146895
|
}
|
|
146280
146896
|
var init_operation_errors = __esm(() => {
|
|
@@ -171905,14 +172521,14 @@ var init_factories = __esm(() => {
|
|
|
171905
172521
|
});
|
|
171906
172522
|
|
|
171907
172523
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/code-editors/hooks.js
|
|
171908
|
-
import { useEffect as
|
|
172524
|
+
import { useEffect as useEffect14, useRef as useRef13 } from "react";
|
|
171909
172525
|
function useEditorRefs() {
|
|
171910
|
-
const editorRef =
|
|
171911
|
-
const viewRef =
|
|
171912
|
-
const updateListenerCompartment =
|
|
171913
|
-
const focusHandlerCompartment =
|
|
171914
|
-
const pasteHandlerCompartment =
|
|
171915
|
-
const timeoutRef =
|
|
172526
|
+
const editorRef = useRef13(null);
|
|
172527
|
+
const viewRef = useRef13(null);
|
|
172528
|
+
const updateListenerCompartment = useRef13(new Compartment);
|
|
172529
|
+
const focusHandlerCompartment = useRef13(new Compartment);
|
|
172530
|
+
const pasteHandlerCompartment = useRef13(new Compartment);
|
|
172531
|
+
const timeoutRef = useRef13(null);
|
|
171916
172532
|
return {
|
|
171917
172533
|
editorRef,
|
|
171918
172534
|
viewRef,
|
|
@@ -171923,7 +172539,7 @@ function useEditorRefs() {
|
|
|
171923
172539
|
};
|
|
171924
172540
|
}
|
|
171925
172541
|
function useEditorCleanup(viewRef) {
|
|
171926
|
-
|
|
172542
|
+
useEffect14(() => {
|
|
171927
172543
|
return () => {
|
|
171928
172544
|
if (viewRef.current) {
|
|
171929
172545
|
viewRef.current.destroy();
|
|
@@ -171933,7 +172549,7 @@ function useEditorCleanup(viewRef) {
|
|
|
171933
172549
|
}, []);
|
|
171934
172550
|
}
|
|
171935
172551
|
function useHandlerReconfiguration(view, readonly4, timeoutRef, updateDocumentInModel, compartments) {
|
|
171936
|
-
|
|
172552
|
+
useEffect14(() => {
|
|
171937
172553
|
if (!view)
|
|
171938
172554
|
return;
|
|
171939
172555
|
view.dispatch({
|
|
@@ -171947,7 +172563,7 @@ function useHandlerReconfiguration(view, readonly4, timeoutRef, updateDocumentIn
|
|
|
171947
172563
|
}, [readonly4, updateDocumentInModel]);
|
|
171948
172564
|
}
|
|
171949
172565
|
function useDocumentSync(view, doc3) {
|
|
171950
|
-
|
|
172566
|
+
useEffect14(() => {
|
|
171951
172567
|
if (!view)
|
|
171952
172568
|
return;
|
|
171953
172569
|
const currentDoc = view.state.doc.toString();
|
|
@@ -179263,7 +179879,7 @@ __export(exports_graphql_editor, {
|
|
|
179263
179879
|
default: () => graphql_editor_default
|
|
179264
179880
|
});
|
|
179265
179881
|
import { jsx as _jsx13 } from "react/jsx-runtime";
|
|
179266
|
-
import { memo as memo2, useEffect as
|
|
179882
|
+
import { memo as memo2, useEffect as useEffect15, useRef as useRef14 } from "react";
|
|
179267
179883
|
var GraphqlEditor, graphql_editor_default;
|
|
179268
179884
|
var init_graphql_editor = __esm(() => {
|
|
179269
179885
|
init_dist11();
|
|
@@ -179280,10 +179896,10 @@ var init_graphql_editor = __esm(() => {
|
|
|
179280
179896
|
GraphqlEditor = memo2(function GraphqlEditor2(props) {
|
|
179281
179897
|
const { doc: doc3, readonly: readonly4 = false, updateDocumentInModel, customLinter } = props;
|
|
179282
179898
|
const { editorRef, viewRef, updateListenerCompartment, focusHandlerCompartment, pasteHandlerCompartment, timeoutRef } = useEditorRefs();
|
|
179283
|
-
const graphqlCompartment =
|
|
179284
|
-
const linterCompartment =
|
|
179899
|
+
const graphqlCompartment = useRef14(new Compartment);
|
|
179900
|
+
const linterCompartment = useRef14(new Compartment);
|
|
179285
179901
|
const { sharedSchema } = useSchemaContext();
|
|
179286
|
-
|
|
179902
|
+
useEffect15(() => {
|
|
179287
179903
|
if (!viewRef.current) {
|
|
179288
179904
|
const schema18 = buildSchema(sharedSchema);
|
|
179289
179905
|
viewRef.current = new EditorView({
|
|
@@ -179307,7 +179923,7 @@ var init_graphql_editor = __esm(() => {
|
|
|
179307
179923
|
}
|
|
179308
179924
|
}, []);
|
|
179309
179925
|
useEditorCleanup(viewRef);
|
|
179310
|
-
|
|
179926
|
+
useEffect15(() => {
|
|
179311
179927
|
const view = viewRef.current;
|
|
179312
179928
|
if (!view)
|
|
179313
179929
|
return;
|
|
@@ -179337,13 +179953,13 @@ var init_graphql_editor = __esm(() => {
|
|
|
179337
179953
|
|
|
179338
179954
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation.js
|
|
179339
179955
|
import { jsx as _jsx14, jsxs as _jsxs4 } from "react/jsx-runtime";
|
|
179340
|
-
import { lazy as lazy2, Suspense, useCallback as
|
|
179956
|
+
import { lazy as lazy2, Suspense, useCallback as useCallback15 } from "react";
|
|
179341
179957
|
function Operation(props) {
|
|
179342
179958
|
const { operation, module, allOperationNames, lastCreatedOperationId, onAddOperationAndInitialSchema, updateOperationName, deleteOperation, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired } = props;
|
|
179343
179959
|
const noInputRequired = isEmptyOperationSchema(operation.schema);
|
|
179344
|
-
const handleToggleNoInput =
|
|
179345
|
-
const handleUpdateDocument =
|
|
179346
|
-
const customLinter =
|
|
179960
|
+
const handleToggleNoInput = useCallback15((checked) => toggleNoInputRequired(operation.id, checked), [operation.id, toggleNoInputRequired]);
|
|
179961
|
+
const handleUpdateDocument = useCallback15((newDoc) => updateOperationSchema(operation.id, newDoc), [operation.id, updateOperationSchema]);
|
|
179962
|
+
const customLinter = useCallback15((doc3) => operation.name ? ensureValidOperationSchemaInputName(doc3, operation.name) : [], [operation.name]);
|
|
179347
179963
|
return _jsxs4("div", { className: "mt-4 grid grid-cols-2 gap-x-12", style: {
|
|
179348
179964
|
gridTemplateAreas: `
|
|
179349
179965
|
"left editor"
|
|
@@ -179364,12 +179980,12 @@ var init_operation = __esm(() => {
|
|
|
179364
179980
|
|
|
179365
179981
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operations.js
|
|
179366
179982
|
import { jsx as _jsx15, jsxs as _jsxs5 } from "react/jsx-runtime";
|
|
179367
|
-
import { useCallback as
|
|
179983
|
+
import { useCallback as useCallback16, useId as useId4, useState as useState13 } from "react";
|
|
179368
179984
|
function Operations({ module, allOperations, shouldFocusNewOperation, updateOperationName, deleteOperation, addOperationAndInitialSchema, addOperationError, deleteOperationError, setOperationErrorName, updateOperationSchema, setOperationDescription, toggleNoInputRequired }) {
|
|
179369
179985
|
const [lastCreatedOperationId, setLastCreatedOperationId] = useState13(null);
|
|
179370
179986
|
const addOperationFormId = useId4();
|
|
179371
179987
|
const allOperationNames = allOperations.map((o3) => o3.name).filter((n5) => n5 !== null);
|
|
179372
|
-
const onAddOperationAndInitialSchema =
|
|
179988
|
+
const onAddOperationAndInitialSchema = useCallback16(async (moduleId, name6) => {
|
|
179373
179989
|
const operationId = await addOperationAndInitialSchema(moduleId, name6);
|
|
179374
179990
|
if (operationId) {
|
|
179375
179991
|
setLastCreatedOperationId(operationId);
|
|
@@ -179398,11 +180014,11 @@ var init_module = __esm(() => {
|
|
|
179398
180014
|
|
|
179399
180015
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/modules.js
|
|
179400
180016
|
import { jsx as _jsx17, jsxs as _jsxs7 } from "react/jsx-runtime";
|
|
179401
|
-
import { useCallback as
|
|
180017
|
+
import { useCallback as useCallback17, useRef as useRef15, useState as useState14 } from "react";
|
|
179402
180018
|
function Modules({ modules, allOperations, addModule, updateModuleName, deleteModule, updateOperationName, deleteOperation, addOperationAndInitialSchema, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired }) {
|
|
179403
180019
|
const [lastCreatedModuleId, setLastCreatedModuleId] = useState14(null);
|
|
179404
|
-
const focusTrapRef =
|
|
179405
|
-
const onAddModule =
|
|
180020
|
+
const focusTrapRef = useRef15(null);
|
|
180021
|
+
const onAddModule = useCallback17(async (name6) => {
|
|
179406
180022
|
const moduleId = await addModule(name6);
|
|
179407
180023
|
if (moduleId) {
|
|
179408
180024
|
setLastCreatedModuleId(moduleId);
|
|
@@ -179434,11 +180050,11 @@ var init_useDocumentModelDocument = __esm(() => {
|
|
|
179434
180050
|
|
|
179435
180051
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/button.js
|
|
179436
180052
|
import { jsx as _jsx18 } from "react/jsx-runtime";
|
|
179437
|
-
import { forwardRef as
|
|
180053
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
179438
180054
|
var Button;
|
|
179439
180055
|
var init_button = __esm(() => {
|
|
179440
180056
|
init_style();
|
|
179441
|
-
Button =
|
|
180057
|
+
Button = forwardRef9((props, ref) => {
|
|
179442
180058
|
const { className, ...rest } = props;
|
|
179443
180059
|
return _jsx18("button", { ref, ...rest, className: cn2("h-10 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", className) });
|
|
179444
180060
|
});
|
|
@@ -179545,10 +180161,10 @@ var init_dist22 = () => {};
|
|
|
179545
180161
|
|
|
179546
180162
|
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@19.2.14_react@19.2.4/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
179547
180163
|
import * as React16 from "react";
|
|
179548
|
-
import { Fragment as
|
|
180164
|
+
import { Fragment as Fragment23, jsx as jsx5 } from "react/jsx-runtime";
|
|
179549
180165
|
function createSlot2(ownerName) {
|
|
179550
180166
|
const SlotClone = /* @__PURE__ */ createSlotClone2(ownerName);
|
|
179551
|
-
const
|
|
180167
|
+
const Slot22 = React16.forwardRef((props, forwardedRef) => {
|
|
179552
180168
|
const { children, ...slotProps } = props;
|
|
179553
180169
|
const childrenArray = React16.Children.toArray(children);
|
|
179554
180170
|
const slottable = childrenArray.find(isSlottable2);
|
|
@@ -179567,15 +180183,15 @@ function createSlot2(ownerName) {
|
|
|
179567
180183
|
}
|
|
179568
180184
|
return /* @__PURE__ */ jsx5(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
179569
180185
|
});
|
|
179570
|
-
|
|
179571
|
-
return
|
|
180186
|
+
Slot22.displayName = `${ownerName}.Slot`;
|
|
180187
|
+
return Slot22;
|
|
179572
180188
|
}
|
|
179573
180189
|
function createSlotClone2(ownerName) {
|
|
179574
180190
|
const SlotClone = React16.forwardRef((props, forwardedRef) => {
|
|
179575
180191
|
const { children, ...slotProps } = props;
|
|
179576
180192
|
if (React16.isValidElement(children)) {
|
|
179577
180193
|
const childrenRef = getElementRef2(children);
|
|
179578
|
-
const props2 =
|
|
180194
|
+
const props2 = mergeProps3(slotProps, children.props);
|
|
179579
180195
|
if (children.type !== React16.Fragment) {
|
|
179580
180196
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
179581
180197
|
}
|
|
@@ -179589,7 +180205,7 @@ function createSlotClone2(ownerName) {
|
|
|
179589
180205
|
function isSlottable2(child) {
|
|
179590
180206
|
return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER2;
|
|
179591
180207
|
}
|
|
179592
|
-
function
|
|
180208
|
+
function mergeProps3(slotProps, childProps) {
|
|
179593
180209
|
const overrideProps = { ...childProps };
|
|
179594
180210
|
for (const propName in childProps) {
|
|
179595
180211
|
const slotPropValue = slotProps[propName];
|
|
@@ -180052,10 +180668,10 @@ var init_dist27 = __esm(() => {
|
|
|
180052
180668
|
"ul"
|
|
180053
180669
|
];
|
|
180054
180670
|
Primitive2 = NODES2.reduce((primitive, node) => {
|
|
180055
|
-
const
|
|
180671
|
+
const Slot3 = createSlot2(`Primitive.${node}`);
|
|
180056
180672
|
const Node2 = React20.forwardRef((props, forwardedRef) => {
|
|
180057
180673
|
const { asChild, ...primitiveProps } = props;
|
|
180058
|
-
const Comp = asChild ?
|
|
180674
|
+
const Comp = asChild ? Slot3 : node;
|
|
180059
180675
|
if (typeof window !== "undefined") {
|
|
180060
180676
|
window[Symbol.for("radix-ui")] = true;
|
|
180061
180677
|
}
|
|
@@ -180760,7 +181376,7 @@ __export(exports_json_editor, {
|
|
|
180760
181376
|
default: () => json_editor_default
|
|
180761
181377
|
});
|
|
180762
181378
|
import { jsx as _jsx21 } from "react/jsx-runtime";
|
|
180763
|
-
import { memo as memo3, useEffect as
|
|
181379
|
+
import { memo as memo3, useEffect as useEffect22 } from "react";
|
|
180764
181380
|
var JSONEditor, json_editor_default;
|
|
180765
181381
|
var init_json_editor = __esm(() => {
|
|
180766
181382
|
init_dist35();
|
|
@@ -180774,7 +181390,7 @@ var init_json_editor = __esm(() => {
|
|
|
180774
181390
|
JSONEditor = memo3(function JSONEditor2(props) {
|
|
180775
181391
|
const { doc: doc3, readonly: readonly4 = false, updateDocumentInModel } = props;
|
|
180776
181392
|
const { editorRef, viewRef, updateListenerCompartment, focusHandlerCompartment, pasteHandlerCompartment, timeoutRef } = useEditorRefs();
|
|
180777
|
-
|
|
181393
|
+
useEffect22(() => {
|
|
180778
181394
|
if (!viewRef.current) {
|
|
180779
181395
|
viewRef.current = new EditorView({
|
|
180780
181396
|
state: EditorState.create({
|
|
@@ -180817,12 +181433,12 @@ __export(exports_state_schemas, {
|
|
|
180817
181433
|
import { jsxs as _jsxs9, jsx as _jsx22 } from "react/jsx-runtime";
|
|
180818
181434
|
import { cn as cn3 } from "@powerhousedao/design-system";
|
|
180819
181435
|
import { Checkbox } from "@powerhousedao/design-system/ui/components/checkbox/checkbox.js";
|
|
180820
|
-
import { lazy as lazy3, Suspense as Suspense2, useCallback as
|
|
181436
|
+
import { lazy as lazy3, Suspense as Suspense2, useCallback as useCallback21, useEffect as useEffect23, useMemo as useMemo8, useRef as useRef22, useState as useState19 } from "react";
|
|
180821
181437
|
function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, setInitialState, scope }) {
|
|
180822
181438
|
const { sharedSchema: sharedSchemaSdl, error: sharedSchemaError } = useSchemaContext();
|
|
180823
181439
|
const [showStandardLib, setShowStandardLib] = useState19(false);
|
|
180824
181440
|
const [syncWithSchema, setSyncWithSchema] = useState19(true);
|
|
180825
|
-
const customLinter =
|
|
181441
|
+
const customLinter = useCallback21((doc3) => ensureValidStateSchemaName(doc3, modelName, scope), [modelName, scope]);
|
|
180826
181442
|
const schemaErrors = useMemo8(() => {
|
|
180827
181443
|
const errors5 = ensureValidStateSchemaName(stateSchema, modelName, scope);
|
|
180828
181444
|
if (sharedSchemaError) {
|
|
@@ -180830,12 +181446,12 @@ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, set
|
|
|
180830
181446
|
}
|
|
180831
181447
|
return errors5;
|
|
180832
181448
|
}, [stateSchema, modelName, scope, sharedSchemaError]);
|
|
180833
|
-
const handleToggleStandardLib =
|
|
181449
|
+
const handleToggleStandardLib = useCallback21(() => {
|
|
180834
181450
|
setShowStandardLib((prev) => !prev);
|
|
180835
181451
|
}, []);
|
|
180836
|
-
const handleSchemaUpdate =
|
|
180837
|
-
const handleInitialStateUpdate =
|
|
180838
|
-
const hasSyncedRef =
|
|
181452
|
+
const handleSchemaUpdate = useCallback21((newDoc) => setStateSchema(newDoc, scope), [setStateSchema, scope]);
|
|
181453
|
+
const handleInitialStateUpdate = useCallback21((newDoc) => setInitialState(newDoc, scope), [setInitialState, scope]);
|
|
181454
|
+
const hasSyncedRef = useRef22(false);
|
|
180839
181455
|
const { initialValueErrors, fixedState } = useMemo8(() => {
|
|
180840
181456
|
const existingValue = initialValue || "{}";
|
|
180841
181457
|
const sharedSchemaDocumentNode = safeParseSdl(sharedSchemaSdl);
|
|
@@ -180860,7 +181476,7 @@ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, set
|
|
|
180860
181476
|
}
|
|
180861
181477
|
return { initialValueErrors: errors5, fixedState: null };
|
|
180862
181478
|
}, [sharedSchemaSdl, initialValue, syncWithSchema, scope, modelName]);
|
|
180863
|
-
|
|
181479
|
+
useEffect23(() => {
|
|
180864
181480
|
if (fixedState && !hasSyncedRef.current) {
|
|
180865
181481
|
hasSyncedRef.current = true;
|
|
180866
181482
|
setInitialState(fixedState, scope);
|
|
@@ -180871,7 +181487,7 @@ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, set
|
|
|
180871
181487
|
return _jsxs9("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs9("div", { children: [_jsxs9("h3", { className: "mb-2 text-lg capitalize", children: [scope, " state schema *"] }), _jsxs9(Button, { onClick: handleToggleStandardLib, className: "mb-2 flex w-fit items-center gap-2", children: [showStandardLib ? "Hide" : "Show", " standard library", _jsx22("svg", { className: cn3("inline-block transition-transform", showStandardLib ? "rotate-180" : "rotate-0"), xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: _jsx22("path", { d: "M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z", fill: "black" }) })] }), _jsxs9(Suspense2, { children: [showStandardLib && _jsx22(GraphqlEditor4, { doc: typeDefsDoc, readonly: true }), _jsx22(GraphqlEditor4, { doc: stateSchema, updateDocumentInModel: handleSchemaUpdate, customLinter }), schemaErrors.length > 0 && _jsx22("p", { className: "mt-2 text-sm text-red-600", children: schemaErrors[0].message })] })] }), _jsxs9("div", { children: [_jsxs9("div", { className: "flex flex-col items-end", children: [_jsxs9("h3", { className: "mb-2 text-right text-lg capitalize", children: [scope, " state initial value *"] }), _jsx22(Checkbox, { value: syncWithSchema, onChange: setSyncWithSchema, className: "mb-2 w-fit whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 pl-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2", label: _jsxs9("div", { className: "flex items-center gap-2 py-2 pr-2", children: ["Sync with schema", " ", _jsx22("svg", { className: "inline-block", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: _jsx22("path", { d: "M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z", fill: "#343839" }) })] }) })] }), _jsxs9(Suspense2, { children: [_jsx22(JSONEditor3, { doc: initialValue, updateDocumentInModel: handleInitialStateUpdate }), initialValueErrors.map((error50, index) => _jsx22("p", { className: "mt-2 text-sm text-red-600", children: error50 instanceof StateValidationError ? _jsx22(StateValidationErrorMessage, { error: error50 }) : error50.message }, index))] })] })] });
|
|
180872
181488
|
}
|
|
180873
181489
|
function StateSchemas({ modelName, globalStateSchema, localStateSchema, globalStateInitialValue, localStateInitialValue, setStateSchema, setInitialState, currentScope, onScopeChange }) {
|
|
180874
|
-
const handleAddLocalState =
|
|
181490
|
+
const handleAddLocalState = useCallback21(() => {
|
|
180875
181491
|
const initialDoc = makeInitialSchemaDoc(modelName, "local");
|
|
180876
181492
|
setStateSchema(initialDoc, "local");
|
|
180877
181493
|
setInitialState("", "local");
|
|
@@ -180901,7 +181517,7 @@ import { jsx as _jsx23, jsxs as _jsxs10 } from "react/jsx-runtime";
|
|
|
180901
181517
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
180902
181518
|
import { addModule, addOperation, addOperationError, deleteModule, deleteOperation, deleteOperationError, setAuthorName, setAuthorWebsite, setInitialState, setModelDescription, setModelExtension, setModelId, setModelName, setModuleName, setOperationDescription, setOperationErrorName, setOperationName, setOperationSchema, setStateSchema } from "document-model";
|
|
180903
181519
|
import { generateId as generateId3 } from "document-model/core";
|
|
180904
|
-
import { lazy as lazy4, Suspense as Suspense3, useEffect as
|
|
181520
|
+
import { lazy as lazy4, Suspense as Suspense3, useEffect as useEffect24, useRef as useRef23, useState as useState20 } from "react";
|
|
180905
181521
|
function Editor() {
|
|
180906
181522
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
180907
181523
|
const toast3 = usePHToast();
|
|
@@ -180911,8 +181527,8 @@ function Editor() {
|
|
|
180911
181527
|
const { name: modelName, id: documentType, extension, description, author: { name: authorName, website: authorWebsite } } = document2.state.global;
|
|
180912
181528
|
const { state: { global: { schema: globalStateSchema, initialValue: globalStateInitialValue }, local: { schema: localStateSchema, initialValue: localStateInitialValue } }, modules } = document2.state.global.specifications[0];
|
|
180913
181529
|
const operations = modules.flatMap((module) => module.operations);
|
|
180914
|
-
const shouldSetInitialName =
|
|
180915
|
-
|
|
181530
|
+
const shouldSetInitialName = useRef23(!modelName && !!documentNodeName && operations.length === 0);
|
|
181531
|
+
useEffect24(() => {
|
|
180916
181532
|
if (!shouldSetInitialName.current || !documentNodeName)
|
|
180917
181533
|
return;
|
|
180918
181534
|
const initialSchemaDoc2 = initializeModelSchema(documentNodeName);
|
|
@@ -182009,9 +182625,9 @@ var init_esm12 = __esm(() => {
|
|
|
182009
182625
|
import { jsx as _jsx25 } from "react/jsx-runtime";
|
|
182010
182626
|
import { useWindowSize } from "@powerhousedao/design-system";
|
|
182011
182627
|
import { FileItem } from "@powerhousedao/design-system/connect";
|
|
182012
|
-
import React33, { useRef as
|
|
182628
|
+
import React33, { useRef as useRef24 } from "react";
|
|
182013
182629
|
function FileContentView() {
|
|
182014
|
-
const parentRef =
|
|
182630
|
+
const parentRef = useRef24(null);
|
|
182015
182631
|
const windowSize = useWindowSize();
|
|
182016
182632
|
const availableWidth = windowSize.innerWidth - USED_SPACE;
|
|
182017
182633
|
const nodes = useNodesInSelectedDriveOrFolder();
|
|
@@ -182183,17 +182799,17 @@ var init_editors = __esm(() => {
|
|
|
182183
182799
|
|
|
182184
182800
|
// ../../packages/reactor-browser/dist/src/connect.js
|
|
182185
182801
|
import { logger as logger9 } from "document-drive";
|
|
182186
|
-
import { useSyncExternalStore as
|
|
182187
|
-
import { use as use3, useCallback as
|
|
182188
|
-
import { useEffect as
|
|
182802
|
+
import { useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
182803
|
+
import { use as use3, useCallback as useCallback22, useSyncExternalStore as useSyncExternalStore22 } from "react";
|
|
182804
|
+
import { useEffect as useEffect26, useState as useState22, useSyncExternalStore as useSyncExternalStore32 } from "react";
|
|
182189
182805
|
import { logger as logger52 } from "document-drive";
|
|
182190
182806
|
import { logger as logger42 } from "document-drive";
|
|
182191
182807
|
import { logger as logger23 } from "document-drive";
|
|
182192
182808
|
import { logger as logger32 } from "document-drive";
|
|
182193
182809
|
import { buildSignedAction as buildSignedAction2 } from "document-model/core";
|
|
182194
|
-
import { useSyncExternalStore as
|
|
182195
|
-
import { useEffect as
|
|
182196
|
-
import { useEffect as useEffect32, useRef as
|
|
182810
|
+
import { useSyncExternalStore as useSyncExternalStore42 } from "react";
|
|
182811
|
+
import { useEffect as useEffect27, useState as useState23 } from "react";
|
|
182812
|
+
import { useEffect as useEffect32, useRef as useRef25, useState as useState32 } from "react";
|
|
182197
182813
|
function consumeDidFromUrl2() {
|
|
182198
182814
|
if (typeof window === "undefined")
|
|
182199
182815
|
return;
|
|
@@ -182222,7 +182838,7 @@ async function login2(userDid, renown) {
|
|
|
182222
182838
|
}
|
|
182223
182839
|
return await renown.login(did);
|
|
182224
182840
|
} catch (error50) {
|
|
182225
|
-
logger9.error(
|
|
182841
|
+
logger9.error(error50 instanceof Error ? error50.message : JSON.stringify(error50));
|
|
182226
182842
|
}
|
|
182227
182843
|
}
|
|
182228
182844
|
function split6(value) {
|
|
@@ -182295,38 +182911,61 @@ function makePHEventFunctions2(key) {
|
|
|
182295
182911
|
const setEventName = `ph:set${capitalCase2(key)}`;
|
|
182296
182912
|
const updateEventName = `ph:${key}Updated`;
|
|
182297
182913
|
function setValue(value) {
|
|
182914
|
+
if (isServer2) {
|
|
182915
|
+
return;
|
|
182916
|
+
}
|
|
182298
182917
|
const event = new CustomEvent(setEventName, {
|
|
182299
182918
|
detail: { [key]: value }
|
|
182300
182919
|
});
|
|
182301
182920
|
window.dispatchEvent(event);
|
|
182302
182921
|
}
|
|
182303
182922
|
function dispatchUpdatedEvent() {
|
|
182923
|
+
if (isServer2) {
|
|
182924
|
+
return;
|
|
182925
|
+
}
|
|
182304
182926
|
const event = new CustomEvent(updateEventName);
|
|
182305
182927
|
window.dispatchEvent(event);
|
|
182306
182928
|
}
|
|
182307
182929
|
function handleSetValueEvent(event) {
|
|
182930
|
+
if (isServer2) {
|
|
182931
|
+
return;
|
|
182932
|
+
}
|
|
182308
182933
|
const value = event.detail[key];
|
|
182309
|
-
if (!window.ph)
|
|
182310
|
-
|
|
182934
|
+
if (!window.ph) {
|
|
182935
|
+
window.ph = {};
|
|
182936
|
+
}
|
|
182311
182937
|
window.ph[key] = value;
|
|
182312
182938
|
dispatchUpdatedEvent();
|
|
182313
182939
|
}
|
|
182314
182940
|
function addEventHandler() {
|
|
182941
|
+
if (isServer2) {
|
|
182942
|
+
return;
|
|
182943
|
+
}
|
|
182315
182944
|
window.addEventListener(setEventName, handleSetValueEvent);
|
|
182316
182945
|
}
|
|
182317
182946
|
function subscribeToValue(onStoreChange) {
|
|
182947
|
+
if (isServer2)
|
|
182948
|
+
return () => {};
|
|
182318
182949
|
window.addEventListener(updateEventName, onStoreChange);
|
|
182319
182950
|
return () => {
|
|
182320
182951
|
window.removeEventListener(updateEventName, onStoreChange);
|
|
182321
182952
|
};
|
|
182322
182953
|
}
|
|
182323
182954
|
function getSnapshot() {
|
|
182324
|
-
if (
|
|
182325
|
-
|
|
182955
|
+
if (isServer2) {
|
|
182956
|
+
return;
|
|
182957
|
+
}
|
|
182958
|
+
if (!window.ph) {
|
|
182959
|
+
console.warn(`ph global store is not initialized. Did you call set${capitalCase2(key)}?`);
|
|
182960
|
+
return;
|
|
182961
|
+
}
|
|
182326
182962
|
return window.ph[key];
|
|
182327
182963
|
}
|
|
182964
|
+
function getServerSnapshot() {
|
|
182965
|
+
return;
|
|
182966
|
+
}
|
|
182328
182967
|
function useValue() {
|
|
182329
|
-
return
|
|
182968
|
+
return useSyncExternalStore5(subscribeToValue, getSnapshot, getServerSnapshot);
|
|
182330
182969
|
}
|
|
182331
182970
|
return {
|
|
182332
182971
|
useValue,
|
|
@@ -182467,8 +183106,8 @@ class DocumentCache2 {
|
|
|
182467
183106
|
}
|
|
182468
183107
|
function useUser2() {
|
|
182469
183108
|
const renown = useRenown2();
|
|
182470
|
-
const [user, setUser2] = useState22(
|
|
182471
|
-
|
|
183109
|
+
const [user, setUser2] = useState22(renown?.user);
|
|
183110
|
+
useEffect26(() => {
|
|
182472
183111
|
setUser2(renown?.user);
|
|
182473
183112
|
if (!renown)
|
|
182474
183113
|
return;
|
|
@@ -182688,7 +183327,7 @@ function setDefaultPHGlobalConfig(config20) {
|
|
|
182688
183327
|
function useConnectionStates2() {
|
|
182689
183328
|
const syncManager = useSync2();
|
|
182690
183329
|
const [states, setStates] = useState32(() => buildSnapshot2(syncManager));
|
|
182691
|
-
const unsubscribesRef =
|
|
183330
|
+
const unsubscribesRef = useRef25([]);
|
|
182692
183331
|
useEffect32(() => {
|
|
182693
183332
|
if (!syncManager)
|
|
182694
183333
|
return;
|
|
@@ -182727,16 +183366,17 @@ function buildSnapshot2(syncManager) {
|
|
|
182727
183366
|
}
|
|
182728
183367
|
return map2;
|
|
182729
183368
|
}
|
|
182730
|
-
var SPLIT_LOWER_UPPER_RE3, SPLIT_UPPER_UPPER_RE3, SPLIT_SEPARATE_NUMBER_RE3, DEFAULT_STRIP_REGEXP3, SPLIT_REPLACE_VALUE3 = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS3 = "", isExternalControlsEnabledEventFunctions2, setIsExternalControlsEnabled2, useIsExternalControlsEnabled2, addIsExternalControlsEnabledEventHandler2, isDragAndDropEnabledEventFunctions2, setIsDragAndDropEnabled2, useIsDragAndDropEnabled2, addIsDragAndDropEnabledEventHandler2, allowedDocumentTypesEventFunctions2, setAllowedDocumentTypes2, addAllowedDocumentTypesEventHandler2, phDriveEditorConfigSetters2, phDocumentEditorConfigSetters2, phDriveEditorConfigHooks2, phDocumentEditorConfigHooks2, useRouterBasename2, setRouterBasename2, addRouterBasenameEventHandler2, useVersion2, setVersion2, addVersionEventHandler2, useRequiresHardRefresh2, setRequiresHardRefresh2, addRequiresHardRefreshEventHandler2, useWarnOutdatedApp2, setWarnOutdatedApp2, addWarnOutdatedAppEventHandler2, useStudioMode2, setStudioMode2, addStudioModeEventHandler2, useBasePath2, setBasePath2, addBasePathEventHandler2, useVersionCheckInterval2, setVersionCheckInterval2, addVersionCheckIntervalEventHandler2, useCliVersion2, setCliVersion2, addCliVersionEventHandler2, useFileUploadOperationsChunkSize2, setFileUploadOperationsChunkSize2, addFileUploadOperationsChunkSizeEventHandler2, useIsDocumentModelSelectionSettingsEnabled2, setIsDocumentModelSelectionSettingsEnabled2, addIsDocumentModelSelectionSettingsEnabledEventHandler2, useGaTrackingId2, setGaTrackingId2, addGaTrackingIdEventHandler2, useDefaultDrivesUrl2, setDefaultDrivesUrl2, addDefaultDrivesUrlEventHandler2, useDrivesPreserveStrategy2, setDrivesPreserveStrategy2, addDrivesPreserveStrategyEventHandler2, useIsLocalDrivesEnabled2, setIsLocalDrivesEnabled2, addIsLocalDrivesEnabledEventHandler2, useIsAddDriveEnabled2, setIsAddDriveEnabled2, addIsAddDriveEnabledEventHandler2, useIsPublicDrivesEnabled2, setIsPublicDrivesEnabled2, addIsPublicDrivesEnabledEventHandler2, useIsAddPublicDrivesEnabled2, setIsAddPublicDrivesEnabled2, addIsAddPublicDrivesEnabledEventHandler2, useIsDeletePublicDrivesEnabled2, setIsDeletePublicDrivesEnabled2, addIsDeletePublicDrivesEnabledEventHandler2, useIsCloudDrivesEnabled2, setIsCloudDrivesEnabled2, addIsCloudDrivesEnabledEventHandler2, useIsAddCloudDrivesEnabled2, setIsAddCloudDrivesEnabled2, addIsAddCloudDrivesEnabledEventHandler2, useIsDeleteCloudDrivesEnabled2, setIsDeleteCloudDrivesEnabled2, addIsDeleteCloudDrivesEnabledEventHandler2, useLocalDrivesEnabled2, setLocalDrivesEnabled2, addLocalDrivesEnabledEventHandler2, useIsAddLocalDrivesEnabled2, setIsAddLocalDrivesEnabled2, addIsAddLocalDrivesEnabledEventHandler2, useIsDeleteLocalDrivesEnabled2, setIsDeleteLocalDrivesEnabled2, addIsDeleteLocalDrivesEnabledEventHandler2, useIsEditorDebugModeEnabled2, setIsEditorDebugModeEnabled2, addIsEditorDebugModeEnabledEventHandler2, useIsEditorReadModeEnabled2, setIsEditorReadModeEnabled2, addIsEditorReadModeEnabledEventHandler2, useIsAnalyticsDatabaseWorkerEnabled2, setIsAnalyticsDatabaseWorkerEnabled2, addIsAnalyticsDatabaseWorkerEnabledEventHandler2, useIsDiffAnalyticsEnabled2, setIsDiffAnalyticsEnabled2, addIsDiffAnalyticsEnabledEventHandler2, useIsDriveAnalyticsEnabled2, setIsDriveAnalyticsEnabled2, addIsDriveAnalyticsEnabledEventHandler2, useRenownUrl2, setRenownUrl2, addRenownUrlEventHandler2, useRenownNetworkId2, setRenownNetworkId2, addRenownNetworkIdEventHandler2, useRenownChainId2, setRenownChainId2, addRenownChainIdEventHandler2, useSentryRelease2, setSentryRelease2, addSentryReleaseEventHandler2, useSentryDsn2, setSentryDsn2, addSentryDsnEventHandler2, useSentryEnv2, setSentryEnv2, addSentryEnvEventHandler2, useIsSentryTracingEnabled2, setIsSentryTracingEnabled2, addIsSentryTracingEnabledEventHandler2, useIsExternalProcessorsEnabled2, setIsExternalProcessorsEnabled2, addIsExternalProcessorsEnabledEventHandler2, useIsExternalPackagesEnabled2, setIsExternalPackagesEnabled2, addIsExternalPackagesEnabledEventHandler2, enabledEditorsEventFunctions2, setEnabledEditors2, useEnabledEditors2, addEnabledEditorsEventHandler2, disabledEditorsEventFunctions2, setDisabledEditors2, useDisabledEditors2, addDisabledEditorsEventHandler2, isRelationalProcessorsEnabled2, setIsRelationalProcessorsEnabled2, useIsRelationalProcessorsEnabled2, addIsRelationalProcessorsEnabledEventHandler2, isExternalRelationalProcessorsEnabled2, setIsExternalRelationalProcessorsEnabled2, useIsExternalRelationalProcessorsEnabled2, addIsExternalRelationalProcessorsEnabledEventHandler2, isAnalyticsEnabledEventFunctions2, setIsAnalyticsEnabled2, useIsAnalyticsEnabled2, addIsAnalyticsEnabledEventHandler2, isAnalyticsExternalProcessorsEnabled2, setIsAnalyticsExternalProcessorsEnabled2, useIsAnalyticsExternalProcessorsEnabled2, addIsAnalyticsExternalProcessorsEnabledEventHandler2, analyticsDatabaseNameEventFunctions2, setAnalyticsDatabaseName2, useAnalyticsDatabaseName2, addAnalyticsDatabaseNameEventHandler2, logLevelEventFunctions2, setLogLevel3, useLogLevel2, addLogLevelEventHandler2, allowListEventFunctions2, setAllowList2, useAllowList2, addAllowListEventHandler2, nonUserConfigSetters2, phGlobalConfigSetters2, nonUserConfigHooks2, phGlobalConfigHooks2, featuresEventFunctions2, useFeatures2, setFeatures2, addFeaturesEventHandler2, documentEventFunctions2, useDocumentCache2, setDocumentCache2, addDocumentCacheEventHandler2, drivesEventFunctions2, useDrives2, setDrives2, addDrivesEventHandler2, useLoading2, setLoading2, addLoadingEventHandler2, modalEventFunctions2, usePHModal2, setPHModal2, addModalEventHandler2, reactorClientModuleEventFunctions2, reactorClientEventFunctions2, useReactorClientModule2, setReactorClientModule2, addReactorClientModuleEventHandler2, useReactorClient2, setReactorClient2, addReactorClientEventHandler2, useSync2 = () => useReactorClientModule2()?.reactorModule?.syncModule?.syncManager, useSyncList2 = () => {
|
|
183369
|
+
var SPLIT_LOWER_UPPER_RE3, SPLIT_UPPER_UPPER_RE3, SPLIT_SEPARATE_NUMBER_RE3, DEFAULT_STRIP_REGEXP3, SPLIT_REPLACE_VALUE3 = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS3 = "", isServer2, isExternalControlsEnabledEventFunctions2, setIsExternalControlsEnabled2, useIsExternalControlsEnabled2, addIsExternalControlsEnabledEventHandler2, isDragAndDropEnabledEventFunctions2, setIsDragAndDropEnabled2, useIsDragAndDropEnabled2, addIsDragAndDropEnabledEventHandler2, allowedDocumentTypesEventFunctions2, setAllowedDocumentTypes2, addAllowedDocumentTypesEventHandler2, phDriveEditorConfigSetters2, phDocumentEditorConfigSetters2, phDriveEditorConfigHooks2, phDocumentEditorConfigHooks2, useRouterBasename2, setRouterBasename2, addRouterBasenameEventHandler2, useVersion2, setVersion2, addVersionEventHandler2, useRequiresHardRefresh2, setRequiresHardRefresh2, addRequiresHardRefreshEventHandler2, useWarnOutdatedApp2, setWarnOutdatedApp2, addWarnOutdatedAppEventHandler2, useStudioMode2, setStudioMode2, addStudioModeEventHandler2, useBasePath2, setBasePath2, addBasePathEventHandler2, useVersionCheckInterval2, setVersionCheckInterval2, addVersionCheckIntervalEventHandler2, useCliVersion2, setCliVersion2, addCliVersionEventHandler2, useFileUploadOperationsChunkSize2, setFileUploadOperationsChunkSize2, addFileUploadOperationsChunkSizeEventHandler2, useIsDocumentModelSelectionSettingsEnabled2, setIsDocumentModelSelectionSettingsEnabled2, addIsDocumentModelSelectionSettingsEnabledEventHandler2, useGaTrackingId2, setGaTrackingId2, addGaTrackingIdEventHandler2, useDefaultDrivesUrl2, setDefaultDrivesUrl2, addDefaultDrivesUrlEventHandler2, useDrivesPreserveStrategy2, setDrivesPreserveStrategy2, addDrivesPreserveStrategyEventHandler2, useIsLocalDrivesEnabled2, setIsLocalDrivesEnabled2, addIsLocalDrivesEnabledEventHandler2, useIsAddDriveEnabled2, setIsAddDriveEnabled2, addIsAddDriveEnabledEventHandler2, useIsPublicDrivesEnabled2, setIsPublicDrivesEnabled2, addIsPublicDrivesEnabledEventHandler2, useIsAddPublicDrivesEnabled2, setIsAddPublicDrivesEnabled2, addIsAddPublicDrivesEnabledEventHandler2, useIsDeletePublicDrivesEnabled2, setIsDeletePublicDrivesEnabled2, addIsDeletePublicDrivesEnabledEventHandler2, useIsCloudDrivesEnabled2, setIsCloudDrivesEnabled2, addIsCloudDrivesEnabledEventHandler2, useIsAddCloudDrivesEnabled2, setIsAddCloudDrivesEnabled2, addIsAddCloudDrivesEnabledEventHandler2, useIsDeleteCloudDrivesEnabled2, setIsDeleteCloudDrivesEnabled2, addIsDeleteCloudDrivesEnabledEventHandler2, useLocalDrivesEnabled2, setLocalDrivesEnabled2, addLocalDrivesEnabledEventHandler2, useIsAddLocalDrivesEnabled2, setIsAddLocalDrivesEnabled2, addIsAddLocalDrivesEnabledEventHandler2, useIsDeleteLocalDrivesEnabled2, setIsDeleteLocalDrivesEnabled2, addIsDeleteLocalDrivesEnabledEventHandler2, useIsEditorDebugModeEnabled2, setIsEditorDebugModeEnabled2, addIsEditorDebugModeEnabledEventHandler2, useIsEditorReadModeEnabled2, setIsEditorReadModeEnabled2, addIsEditorReadModeEnabledEventHandler2, useIsAnalyticsDatabaseWorkerEnabled2, setIsAnalyticsDatabaseWorkerEnabled2, addIsAnalyticsDatabaseWorkerEnabledEventHandler2, useIsDiffAnalyticsEnabled2, setIsDiffAnalyticsEnabled2, addIsDiffAnalyticsEnabledEventHandler2, useIsDriveAnalyticsEnabled2, setIsDriveAnalyticsEnabled2, addIsDriveAnalyticsEnabledEventHandler2, useRenownUrl2, setRenownUrl2, addRenownUrlEventHandler2, useRenownNetworkId2, setRenownNetworkId2, addRenownNetworkIdEventHandler2, useRenownChainId2, setRenownChainId2, addRenownChainIdEventHandler2, useSentryRelease2, setSentryRelease2, addSentryReleaseEventHandler2, useSentryDsn2, setSentryDsn2, addSentryDsnEventHandler2, useSentryEnv2, setSentryEnv2, addSentryEnvEventHandler2, useIsSentryTracingEnabled2, setIsSentryTracingEnabled2, addIsSentryTracingEnabledEventHandler2, useIsExternalProcessorsEnabled2, setIsExternalProcessorsEnabled2, addIsExternalProcessorsEnabledEventHandler2, useIsExternalPackagesEnabled2, setIsExternalPackagesEnabled2, addIsExternalPackagesEnabledEventHandler2, enabledEditorsEventFunctions2, setEnabledEditors2, useEnabledEditors2, addEnabledEditorsEventHandler2, disabledEditorsEventFunctions2, setDisabledEditors2, useDisabledEditors2, addDisabledEditorsEventHandler2, isRelationalProcessorsEnabled2, setIsRelationalProcessorsEnabled2, useIsRelationalProcessorsEnabled2, addIsRelationalProcessorsEnabledEventHandler2, isExternalRelationalProcessorsEnabled2, setIsExternalRelationalProcessorsEnabled2, useIsExternalRelationalProcessorsEnabled2, addIsExternalRelationalProcessorsEnabledEventHandler2, isAnalyticsEnabledEventFunctions2, setIsAnalyticsEnabled2, useIsAnalyticsEnabled2, addIsAnalyticsEnabledEventHandler2, isAnalyticsExternalProcessorsEnabled2, setIsAnalyticsExternalProcessorsEnabled2, useIsAnalyticsExternalProcessorsEnabled2, addIsAnalyticsExternalProcessorsEnabledEventHandler2, analyticsDatabaseNameEventFunctions2, setAnalyticsDatabaseName2, useAnalyticsDatabaseName2, addAnalyticsDatabaseNameEventHandler2, logLevelEventFunctions2, setLogLevel3, useLogLevel2, addLogLevelEventHandler2, allowListEventFunctions2, setAllowList2, useAllowList2, addAllowListEventHandler2, nonUserConfigSetters2, phGlobalConfigSetters2, nonUserConfigHooks2, phGlobalConfigHooks2, featuresEventFunctions2, useFeatures2, setFeatures2, addFeaturesEventHandler2, documentEventFunctions2, useDocumentCache2, setDocumentCache2, addDocumentCacheEventHandler2, drivesEventFunctions2, useDrives2, setDrives2, addDrivesEventHandler2, useLoading2, setLoading2, addLoadingEventHandler2, modalEventFunctions2, usePHModal2, setPHModal2, addModalEventHandler2, reactorClientModuleEventFunctions2, reactorClientEventFunctions2, useReactorClientModule2, setReactorClientModule2, addReactorClientModuleEventHandler2, useReactorClient2, setReactorClient2, addReactorClientEventHandler2, useSync2 = () => useReactorClientModule2()?.reactorModule?.syncModule?.syncManager, useSyncList2 = () => {
|
|
182731
183370
|
const sync = useSync2();
|
|
182732
183371
|
return sync?.list() ?? [];
|
|
182733
|
-
}, useDatabase = () => useReactorClientModule2()?.reactorModule?.database, usePGlite = () => useReactorClientModule2()?.pg, renownEventFunctions2, useRenown2, setRenown2,
|
|
183372
|
+
}, useDatabase = () => useReactorClientModule2()?.reactorModule?.database, usePGlite = () => useReactorClientModule2()?.pg, renownEventFunctions2, addRenownEventHandler2, useRenown2, setRenown2, revisionHistoryEventFunctions2, useRevisionHistoryVisible2, setRevisionHistoryVisible2, addRevisionHistoryVisibleEventHandler2, base6411, locales2, defaultLocale2, initialMulticharmap2, initialCharmap2, slug_default2, selectedDriveIdEventFunctions2, useSelectedDriveId2, setSelectedDriveId2, addSelectedDriveIdEventHandler2, selectedNodeIdEventFunctions2, useSelectedNodeId2, setSelectedNodeId2, addSelectedNodeIdEventHandler2, selectedTimelineItemEventFunctions2, useSelectedTimelineItem2, setSelectedTimelineItem2, addSelectedTimelineItemEventHandler2, selectedTimelineRevisionEventFunctions2, useSelectedTimelineRevision2, setSelectedTimelineRevision2, addSelectedTimelineRevisionEventHandler2, toastEventFunctions2, usePHToast2, setPHToast2, addToastEventHandler2, vetraPackageManagerFunctions2, useVetraPackageManager2, addVetraPackageManagerEventHandler2, phGlobalEventHandlerRegisterFunctions;
|
|
182734
183373
|
var init_connect2 = __esm(() => {
|
|
182735
183374
|
init_src();
|
|
182736
183375
|
SPLIT_LOWER_UPPER_RE3 = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
182737
183376
|
SPLIT_UPPER_UPPER_RE3 = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
182738
183377
|
SPLIT_SEPARATE_NUMBER_RE3 = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
182739
183378
|
DEFAULT_STRIP_REGEXP3 = /[^\p{L}\d]+/giu;
|
|
183379
|
+
isServer2 = typeof window === "undefined";
|
|
182740
183380
|
isExternalControlsEnabledEventFunctions2 = makePHEventFunctions2("isExternalControlsEnabled");
|
|
182741
183381
|
setIsExternalControlsEnabled2 = isExternalControlsEnabledEventFunctions2.setValue;
|
|
182742
183382
|
useIsExternalControlsEnabled2 = isExternalControlsEnabledEventFunctions2.useValue;
|
|
@@ -183124,9 +183764,9 @@ var init_connect2 = __esm(() => {
|
|
|
183124
183764
|
setReactorClient2 = reactorClientEventFunctions2.setValue;
|
|
183125
183765
|
addReactorClientEventHandler2 = reactorClientEventFunctions2.addEventHandler;
|
|
183126
183766
|
renownEventFunctions2 = makePHEventFunctions2("renown");
|
|
183767
|
+
addRenownEventHandler2 = renownEventFunctions2.addEventHandler;
|
|
183127
183768
|
useRenown2 = renownEventFunctions2.useValue;
|
|
183128
183769
|
setRenown2 = renownEventFunctions2.setValue;
|
|
183129
|
-
addRenownEventHandler2 = renownEventFunctions2.addEventHandler;
|
|
183130
183770
|
revisionHistoryEventFunctions2 = makePHEventFunctions2("revisionHistoryVisible");
|
|
183131
183771
|
useRevisionHistoryVisible2 = revisionHistoryEventFunctions2.useValue;
|
|
183132
183772
|
setRevisionHistoryVisible2 = revisionHistoryEventFunctions2.setValue;
|
|
@@ -185628,7 +186268,7 @@ import { logger as logger43 } from "document-drive";
|
|
|
185628
186268
|
import { logger as logger24 } from "document-drive";
|
|
185629
186269
|
import { logger as logger33 } from "document-drive";
|
|
185630
186270
|
import { buildSignedAction as buildSignedAction3 } from "document-model/core";
|
|
185631
|
-
import { use as use4, useCallback as useCallback32, useSyncExternalStore as
|
|
186271
|
+
import { use as use4, useCallback as useCallback32, useSyncExternalStore as useSyncExternalStore43 } from "react";
|
|
185632
186272
|
import { useSyncExternalStore as useSyncExternalStore33 } from "react";
|
|
185633
186273
|
|
|
185634
186274
|
class AnalyticsProfiler {
|
|
@@ -198102,7 +198742,7 @@ function createRetryer(config20) {
|
|
|
198102
198742
|
if (isResolved()) {
|
|
198103
198743
|
return;
|
|
198104
198744
|
}
|
|
198105
|
-
const retry = config20.retry ?? (
|
|
198745
|
+
const retry = config20.retry ?? (isServer3 ? 0 : 3);
|
|
198106
198746
|
const retryDelay = config20.retryDelay ?? defaultRetryDelay;
|
|
198107
198747
|
const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error50) : retryDelay;
|
|
198108
198748
|
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error50);
|
|
@@ -198370,7 +199010,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
198370
199010
|
throw result.error;
|
|
198371
199011
|
}
|
|
198372
199012
|
client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions, result);
|
|
198373
|
-
if (defaultedOptions.experimental_prefetchInRender && !
|
|
199013
|
+
if (defaultedOptions.experimental_prefetchInRender && !isServer3 && willFetch(result, isRestoring)) {
|
|
198374
199014
|
const promise2 = isNewCacheEntry ? fetchOptimistic(defaultedOptions, observer, errorResetBoundary) : query?.promise;
|
|
198375
199015
|
promise2?.catch(noop4).finally(() => {
|
|
198376
199016
|
observer.updateResult();
|
|
@@ -199029,38 +199669,61 @@ function makePHEventFunctions3(key) {
|
|
|
199029
199669
|
const setEventName = `ph:set${capitalCase3(key)}`;
|
|
199030
199670
|
const updateEventName = `ph:${key}Updated`;
|
|
199031
199671
|
function setValue(value) {
|
|
199672
|
+
if (isServer22) {
|
|
199673
|
+
return;
|
|
199674
|
+
}
|
|
199032
199675
|
const event = new CustomEvent(setEventName, {
|
|
199033
199676
|
detail: { [key]: value }
|
|
199034
199677
|
});
|
|
199035
199678
|
window.dispatchEvent(event);
|
|
199036
199679
|
}
|
|
199037
199680
|
function dispatchUpdatedEvent() {
|
|
199681
|
+
if (isServer22) {
|
|
199682
|
+
return;
|
|
199683
|
+
}
|
|
199038
199684
|
const event = new CustomEvent(updateEventName);
|
|
199039
199685
|
window.dispatchEvent(event);
|
|
199040
199686
|
}
|
|
199041
199687
|
function handleSetValueEvent(event) {
|
|
199688
|
+
if (isServer22) {
|
|
199689
|
+
return;
|
|
199690
|
+
}
|
|
199042
199691
|
const value = event.detail[key];
|
|
199043
|
-
if (!window.ph)
|
|
199044
|
-
|
|
199692
|
+
if (!window.ph) {
|
|
199693
|
+
window.ph = {};
|
|
199694
|
+
}
|
|
199045
199695
|
window.ph[key] = value;
|
|
199046
199696
|
dispatchUpdatedEvent();
|
|
199047
199697
|
}
|
|
199048
199698
|
function addEventHandler() {
|
|
199699
|
+
if (isServer22) {
|
|
199700
|
+
return;
|
|
199701
|
+
}
|
|
199049
199702
|
window.addEventListener(setEventName, handleSetValueEvent);
|
|
199050
199703
|
}
|
|
199051
199704
|
function subscribeToValue(onStoreChange) {
|
|
199705
|
+
if (isServer22)
|
|
199706
|
+
return () => {};
|
|
199052
199707
|
window.addEventListener(updateEventName, onStoreChange);
|
|
199053
199708
|
return () => {
|
|
199054
199709
|
window.removeEventListener(updateEventName, onStoreChange);
|
|
199055
199710
|
};
|
|
199056
199711
|
}
|
|
199057
199712
|
function getSnapshot() {
|
|
199058
|
-
if (
|
|
199059
|
-
|
|
199713
|
+
if (isServer22) {
|
|
199714
|
+
return;
|
|
199715
|
+
}
|
|
199716
|
+
if (!window.ph) {
|
|
199717
|
+
console.warn(`ph global store is not initialized. Did you call set${capitalCase3(key)}?`);
|
|
199718
|
+
return;
|
|
199719
|
+
}
|
|
199060
199720
|
return window.ph[key];
|
|
199061
199721
|
}
|
|
199722
|
+
function getServerSnapshot() {
|
|
199723
|
+
return;
|
|
199724
|
+
}
|
|
199062
199725
|
function useValue() {
|
|
199063
|
-
return useSyncExternalStore33(subscribeToValue, getSnapshot);
|
|
199726
|
+
return useSyncExternalStore33(subscribeToValue, getSnapshot, getServerSnapshot);
|
|
199064
199727
|
}
|
|
199065
199728
|
return {
|
|
199066
199729
|
useValue,
|
|
@@ -199070,7 +199733,7 @@ function makePHEventFunctions3(key) {
|
|
|
199070
199733
|
}
|
|
199071
199734
|
function useDocument2(id) {
|
|
199072
199735
|
const documentCache = useDocumentCache3();
|
|
199073
|
-
const document2 =
|
|
199736
|
+
const document2 = useSyncExternalStore43((cb) => id && documentCache ? documentCache.subscribe(id, cb) : () => {}, () => id ? documentCache?.get(id) : undefined);
|
|
199074
199737
|
return document2 ? use4(document2) : undefined;
|
|
199075
199738
|
}
|
|
199076
199739
|
function useDocumentById2(id) {
|
|
@@ -201877,7 +202540,7 @@ var __defProp6, __export4 = (target, all) => {
|
|
|
201877
202540
|
clearInterval(intervalId) {
|
|
201878
202541
|
this.#provider.clearInterval(intervalId);
|
|
201879
202542
|
}
|
|
201880
|
-
}, timeoutManager,
|
|
202543
|
+
}, timeoutManager, isServer3, hasOwn, skipToken, FocusManager, focusManager, defaultScheduler, notifyManager, OnlineManager, onlineManager, CancelledError, Removable = class {
|
|
201881
202544
|
#gcTimeout;
|
|
201882
202545
|
destroy() {
|
|
201883
202546
|
this.clearGcTimeout();
|
|
@@ -201891,7 +202554,7 @@ var __defProp6, __export4 = (target, all) => {
|
|
|
201891
202554
|
}
|
|
201892
202555
|
}
|
|
201893
202556
|
updateGcTime(newGcTime) {
|
|
201894
|
-
this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (
|
|
202557
|
+
this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (isServer3 ? Infinity : 5 * 60 * 1000));
|
|
201895
202558
|
}
|
|
201896
202559
|
clearGcTimeout() {
|
|
201897
202560
|
if (this.#gcTimeout) {
|
|
@@ -202208,7 +202871,7 @@ var __defProp6, __export4 = (target, all) => {
|
|
|
202208
202871
|
}
|
|
202209
202872
|
}, willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring, shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending, fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
|
|
202210
202873
|
errorResetBoundary.clearReset();
|
|
202211
|
-
}), logger11, defaultQueryClient, analyticsOptionsKey, analyticsStoreKey, analyticsEngineKey, DEBOUNCE_INTERVAL = 200, SPLIT_LOWER_UPPER_RE4, SPLIT_UPPER_UPPER_RE4, SPLIT_SEPARATE_NUMBER_RE4, DEFAULT_STRIP_REGEXP4, SPLIT_REPLACE_VALUE4 = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS4 = "", documentEventFunctions3, useDocumentCache3, setDocumentCache3, addDocumentCacheEventHandler3, LuxonError5, InvalidDateTimeError5, InvalidIntervalError5, InvalidDurationError5, ConflictingSpecificationError5, InvalidUnitError5, InvalidArgumentError5, ZoneIsAbstractError5, n52 = "numeric", s5 = "short", l5 = "long", DATE_SHORT5, DATE_MED5, DATE_MED_WITH_WEEKDAY5, DATE_FULL5, DATE_HUGE5, TIME_SIMPLE5, TIME_WITH_SECONDS5, TIME_WITH_SHORT_OFFSET5, TIME_WITH_LONG_OFFSET5, TIME_24_SIMPLE5, TIME_24_WITH_SECONDS5, TIME_24_WITH_SHORT_OFFSET5, TIME_24_WITH_LONG_OFFSET5, DATETIME_SHORT5, DATETIME_SHORT_WITH_SECONDS5, DATETIME_MED5, DATETIME_MED_WITH_SECONDS5, DATETIME_MED_WITH_WEEKDAY5, DATETIME_FULL5, DATETIME_FULL_WITH_SECONDS5, DATETIME_HUGE5, DATETIME_HUGE_WITH_SECONDS5, singleton$15 = null, SystemZone5, dtfCache5, typeToPos5, ianaZoneCache5, IANAZone5, intlLFCache5, intlDTCache5, intlNumCache5, intlRelCache5, sysLocaleCache5 = null, intlResolvedOptionsCache5, weekInfoCache5, fallbackWeekSettings5, singleton5 = null, FixedOffsetZone5, InvalidZone5, numberingSystems5, numberingSystemsUTF165, hanidecChars5, digitRegexCache5, now5 = () => Date.now(), defaultZone5 = "system", defaultLocale5 = null, defaultNumberingSystem5 = null, defaultOutputCalendar5 = null, twoDigitCutoffYear5 = 60, throwOnInvalid5, defaultWeekSettings5 = null, nonLeapLadder5, leapLadder5, monthsLong5, monthsShort5, monthsNarrow5, weekdaysLong5, weekdaysShort5, weekdaysNarrow5, meridiems5, erasLong5, erasShort5, erasNarrow5, macroTokenToFormatOpts5, ianaRegex5, offsetRegex5, isoExtendedZone5, isoTimeBaseRegex5, isoTimeRegex5, isoTimeExtensionRegex5, isoYmdRegex5, isoWeekRegex5, isoOrdinalRegex5, extractISOWeekData5, extractISOOrdinalData5, sqlYmdRegex5, sqlTimeRegex5, sqlTimeExtensionRegex5, isoTimeOnly5, isoDuration5, obsOffsets5, rfc28225, rfc11235, rfc8505, ascii52, isoYmdWithTimeExtensionRegex5, isoWeekWithTimeExtensionRegex5, isoOrdinalWithTimeExtensionRegex5, isoTimeCombinedRegex5, extractISOYmdTimeAndOffset5, extractISOWeekTimeAndOffset5, extractISOOrdinalDateAndTime5, extractISOTimeAndOffset5, extractISOTimeOnly5, sqlYmdWithTimeExtensionRegex5, sqlTimeCombinedRegex5, extractISOTimeOffsetAndIANAZone5, INVALID$25 = "Invalid Duration", lowOrderMatrix5, casualMatrix5, daysInYearAccurate5, daysInMonthAccurate5, accurateMatrix5, orderedUnits$15, reverseUnits5, Duration5, INVALID$15 = "Invalid Interval", Interval5, MISSING_FTP5 = "missing Intl.DateTimeFormat.formatToParts support", NBSP5, spaceOrNBSP5, spaceOrNBSPRegExp5, partTypeStyleToTokenVal5, dummyDateTimeCache5 = null, INVALID5 = "Invalid DateTime", MAX_DATE5 = 8640000000000000, defaultUnitValues5, defaultWeekUnitValues5, defaultOrdinalUnitValues5, orderedUnits5, orderedWeekUnits5, orderedOrdinalUnits5, zoneOffsetTs5, zoneOffsetGuessCache5, DateTime5, getBarSize = (value) => {
|
|
202874
|
+
}), logger11, defaultQueryClient, analyticsOptionsKey, analyticsStoreKey, analyticsEngineKey, DEBOUNCE_INTERVAL = 200, SPLIT_LOWER_UPPER_RE4, SPLIT_UPPER_UPPER_RE4, SPLIT_SEPARATE_NUMBER_RE4, DEFAULT_STRIP_REGEXP4, SPLIT_REPLACE_VALUE4 = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS4 = "", isServer22, documentEventFunctions3, useDocumentCache3, setDocumentCache3, addDocumentCacheEventHandler3, LuxonError5, InvalidDateTimeError5, InvalidIntervalError5, InvalidDurationError5, ConflictingSpecificationError5, InvalidUnitError5, InvalidArgumentError5, ZoneIsAbstractError5, n52 = "numeric", s5 = "short", l5 = "long", DATE_SHORT5, DATE_MED5, DATE_MED_WITH_WEEKDAY5, DATE_FULL5, DATE_HUGE5, TIME_SIMPLE5, TIME_WITH_SECONDS5, TIME_WITH_SHORT_OFFSET5, TIME_WITH_LONG_OFFSET5, TIME_24_SIMPLE5, TIME_24_WITH_SECONDS5, TIME_24_WITH_SHORT_OFFSET5, TIME_24_WITH_LONG_OFFSET5, DATETIME_SHORT5, DATETIME_SHORT_WITH_SECONDS5, DATETIME_MED5, DATETIME_MED_WITH_SECONDS5, DATETIME_MED_WITH_WEEKDAY5, DATETIME_FULL5, DATETIME_FULL_WITH_SECONDS5, DATETIME_HUGE5, DATETIME_HUGE_WITH_SECONDS5, singleton$15 = null, SystemZone5, dtfCache5, typeToPos5, ianaZoneCache5, IANAZone5, intlLFCache5, intlDTCache5, intlNumCache5, intlRelCache5, sysLocaleCache5 = null, intlResolvedOptionsCache5, weekInfoCache5, fallbackWeekSettings5, singleton5 = null, FixedOffsetZone5, InvalidZone5, numberingSystems5, numberingSystemsUTF165, hanidecChars5, digitRegexCache5, now5 = () => Date.now(), defaultZone5 = "system", defaultLocale5 = null, defaultNumberingSystem5 = null, defaultOutputCalendar5 = null, twoDigitCutoffYear5 = 60, throwOnInvalid5, defaultWeekSettings5 = null, nonLeapLadder5, leapLadder5, monthsLong5, monthsShort5, monthsNarrow5, weekdaysLong5, weekdaysShort5, weekdaysNarrow5, meridiems5, erasLong5, erasShort5, erasNarrow5, macroTokenToFormatOpts5, ianaRegex5, offsetRegex5, isoExtendedZone5, isoTimeBaseRegex5, isoTimeRegex5, isoTimeExtensionRegex5, isoYmdRegex5, isoWeekRegex5, isoOrdinalRegex5, extractISOWeekData5, extractISOOrdinalData5, sqlYmdRegex5, sqlTimeRegex5, sqlTimeExtensionRegex5, isoTimeOnly5, isoDuration5, obsOffsets5, rfc28225, rfc11235, rfc8505, ascii52, isoYmdWithTimeExtensionRegex5, isoWeekWithTimeExtensionRegex5, isoOrdinalWithTimeExtensionRegex5, isoTimeCombinedRegex5, extractISOYmdTimeAndOffset5, extractISOWeekTimeAndOffset5, extractISOOrdinalDateAndTime5, extractISOTimeAndOffset5, extractISOTimeOnly5, sqlYmdWithTimeExtensionRegex5, sqlTimeCombinedRegex5, extractISOTimeOffsetAndIANAZone5, INVALID$25 = "Invalid Duration", lowOrderMatrix5, casualMatrix5, daysInYearAccurate5, daysInMonthAccurate5, accurateMatrix5, orderedUnits$15, reverseUnits5, Duration5, INVALID$15 = "Invalid Interval", Interval5, MISSING_FTP5 = "missing Intl.DateTimeFormat.formatToParts support", NBSP5, spaceOrNBSP5, spaceOrNBSPRegExp5, partTypeStyleToTokenVal5, dummyDateTimeCache5 = null, INVALID5 = "Invalid DateTime", MAX_DATE5 = 8640000000000000, defaultUnitValues5, defaultWeekUnitValues5, defaultOrdinalUnitValues5, orderedUnits5, orderedWeekUnits5, orderedOrdinalUnits5, zoneOffsetTs5, zoneOffsetGuessCache5, DateTime5, getBarSize = (value) => {
|
|
202212
202875
|
if (value <= 0)
|
|
202213
202876
|
return 0;
|
|
202214
202877
|
if (value > 0 && value <= 50)
|
|
@@ -248886,7 +249549,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
248886
249549
|
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
248887
249550
|
};
|
|
248888
249551
|
timeoutManager = new TimeoutManager;
|
|
248889
|
-
|
|
249552
|
+
isServer3 = typeof window === "undefined" || "Deno" in globalThis;
|
|
248890
249553
|
hasOwn = Object.prototype.hasOwnProperty;
|
|
248891
249554
|
skipToken = /* @__PURE__ */ Symbol();
|
|
248892
249555
|
FocusManager = class extends Subscribable {
|
|
@@ -248896,7 +249559,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
248896
249559
|
constructor() {
|
|
248897
249560
|
super();
|
|
248898
249561
|
this.#setup = (onFocus) => {
|
|
248899
|
-
if (!
|
|
249562
|
+
if (!isServer3 && window.addEventListener) {
|
|
248900
249563
|
const listener = () => onFocus();
|
|
248901
249564
|
window.addEventListener("visibilitychange", listener, false);
|
|
248902
249565
|
return () => {
|
|
@@ -248958,7 +249621,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
248958
249621
|
constructor() {
|
|
248959
249622
|
super();
|
|
248960
249623
|
this.#setup = (onOnline) => {
|
|
248961
|
-
if (!
|
|
249624
|
+
if (!isServer3 && window.addEventListener) {
|
|
248962
249625
|
const onlineListener = () => onOnline(true);
|
|
248963
249626
|
const offlineListener = () => onOnline(false);
|
|
248964
249627
|
window.addEventListener("online", onlineListener, false);
|
|
@@ -249502,7 +250165,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
249502
250165
|
#updateStaleTimeout() {
|
|
249503
250166
|
this.#clearStaleTimeout();
|
|
249504
250167
|
const staleTime = resolveStaleTime(this.options.staleTime, this.#currentQuery);
|
|
249505
|
-
if (
|
|
250168
|
+
if (isServer3 || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
|
|
249506
250169
|
return;
|
|
249507
250170
|
}
|
|
249508
250171
|
const time3 = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
|
|
@@ -249519,7 +250182,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
249519
250182
|
#updateRefetchInterval(nextInterval) {
|
|
249520
250183
|
this.#clearRefetchInterval();
|
|
249521
250184
|
this.#currentRefetchInterval = nextInterval;
|
|
249522
|
-
if (
|
|
250185
|
+
if (isServer3 || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
|
|
249523
250186
|
return;
|
|
249524
250187
|
}
|
|
249525
250188
|
this.#refetchIntervalId = timeoutManager.setInterval(() => {
|
|
@@ -250259,6 +250922,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
250259
250922
|
SPLIT_UPPER_UPPER_RE4 = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
250260
250923
|
SPLIT_SEPARATE_NUMBER_RE4 = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
250261
250924
|
DEFAULT_STRIP_REGEXP4 = /[^\p{L}\d]+/giu;
|
|
250925
|
+
isServer22 = typeof window === "undefined";
|
|
250262
250926
|
documentEventFunctions3 = makePHEventFunctions3("documentCache");
|
|
250263
250927
|
useDocumentCache3 = documentEventFunctions3.useValue;
|
|
250264
250928
|
setDocumentCache3 = documentEventFunctions3.setValue;
|
|
@@ -252454,7 +253118,8 @@ async function createReactor() {
|
|
|
252454
253118
|
basename: phGlobalConfigFromEnv.routerBasename,
|
|
252455
253119
|
baseUrl: phGlobalConfigFromEnv.renownUrl
|
|
252456
253120
|
}).withCrypto(renownCrypto).build();
|
|
252457
|
-
const
|
|
253121
|
+
const registryCdnUrl = getDefaultRegistryCdnUrl();
|
|
253122
|
+
const packageManager = new BrowserPackageManager(phGlobalConfigFromEnv.routerBasename ?? "", registryCdnUrl);
|
|
252458
253123
|
const commonPackage = await loadCommonPackage();
|
|
252459
253124
|
await packageManager.addLocalPackage("common", commonPackage);
|
|
252460
253125
|
try {
|
|
@@ -252473,7 +253138,10 @@ async function createReactor() {
|
|
|
252473
253138
|
setVetraPackageManager(packageManager);
|
|
252474
253139
|
const documentModelModules = packageManager.packages.flatMap((pkg) => pkg.modules.documentModelModules).filter((module, index, modules) => module !== undefined && modules.findIndex((m2) => m2?.documentType === module.documentType && m2.version === module.version) === index);
|
|
252475
253140
|
const upgradeManifests = packageManager.packages.flatMap((pkg) => pkg.upgradeManifests);
|
|
252476
|
-
const reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown);
|
|
253141
|
+
const reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown, registryCdnUrl ? packageManager : undefined);
|
|
253142
|
+
if (reactorClientModule.reactorModule) {
|
|
253143
|
+
packageManager.setDocumentModelRegistry(reactorClientModule.reactorModule.documentModelRegistry);
|
|
253144
|
+
}
|
|
252477
253145
|
const drives = await getDrives(reactorClientModule.client);
|
|
252478
253146
|
const path2 = window.location.pathname;
|
|
252479
253147
|
const driveSlug = extractDriveSlugFromPath(path2);
|
|
@@ -252563,10 +253231,10 @@ var init_reactor2 = __esm(() => {
|
|
|
252563
253231
|
});
|
|
252564
253232
|
|
|
252565
253233
|
// src/store/user.ts
|
|
252566
|
-
import { useEffect as
|
|
253234
|
+
import { useEffect as useEffect35 } from "react";
|
|
252567
253235
|
function useSetSentryUser() {
|
|
252568
253236
|
const user = useUser2();
|
|
252569
|
-
|
|
253237
|
+
useEffect35(() => {
|
|
252570
253238
|
let sentryUser = null;
|
|
252571
253239
|
if (user) {
|
|
252572
253240
|
const { credential, ...rest } = user;
|