@noya-app/noya-api-client-react 0.1.36 → 0.1.37

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/index.mjs CHANGED
@@ -42,10 +42,10 @@ var require_access = __commonJS({
42
42
  const accessed = _getPath(node, indexPath, options);
43
43
  return accessed[accessed.length - 1];
44
44
  }
45
- let path = indexPath.slice();
46
- while (path.length > 0) {
47
- let index = path.shift();
48
- const children = options.getChildren(node, path);
45
+ let path2 = indexPath.slice();
46
+ while (path2.length > 0) {
47
+ let index = path2.shift();
48
+ const children = options.getChildren(node, path2);
49
49
  const child = children[index];
50
50
  if (!child) {
51
51
  return void 0;
@@ -58,12 +58,12 @@ var require_access = __commonJS({
58
58
  return _getPath(node, indexPath, options).slice(0, -1);
59
59
  }
60
60
  function _getPath(node, indexPath, options) {
61
- let path = indexPath.slice();
61
+ let path2 = indexPath.slice();
62
62
  let result = [node];
63
- while (path.length > 0) {
64
- let index = path.shift();
63
+ while (path2.length > 0) {
64
+ let index = path2.shift();
65
65
  const context = options.includeTraversalContext ? makeTraversalContext(result) : void 0;
66
- const children = options.getChildren(node, path, context);
66
+ const children = options.getChildren(node, path2, context);
67
67
  const child = children[index];
68
68
  if (!child) {
69
69
  return result;
@@ -78,20 +78,20 @@ var require_access = __commonJS({
78
78
  const accessed = accessPath(node, indexPath, options);
79
79
  return accessed[accessed.length - 1];
80
80
  }
81
- let path = indexPath.slice();
82
- while (path.length > 0) {
83
- let index = path.shift();
84
- node = options.getChildren(node, path)[index];
81
+ let path2 = indexPath.slice();
82
+ while (path2.length > 0) {
83
+ let index = path2.shift();
84
+ node = options.getChildren(node, path2)[index];
85
85
  }
86
86
  return node;
87
87
  }
88
88
  function accessPath(node, indexPath, options) {
89
- let path = indexPath.slice();
89
+ let path2 = indexPath.slice();
90
90
  let result = [node];
91
- while (path.length > 0) {
92
- let index = path.shift();
91
+ while (path2.length > 0) {
92
+ let index = path2.shift();
93
93
  const context = options.includeTraversalContext ? makeTraversalContext(result) : void 0;
94
- node = options.getChildren(node, path, context)[index];
94
+ node = options.getChildren(node, path2, context)[index];
95
95
  result.push(node);
96
96
  }
97
97
  return result;
@@ -605,40 +605,40 @@ var require_transformPath = __commonJS({
605
605
  Object.defineProperty(exports, "__esModule", { value: true });
606
606
  exports.transformPath = transformPath;
607
607
  var sort_1 = require_sort();
608
- function commonAncestor(path, otherPath) {
609
- const length = Math.min(path.length, otherPath.length);
608
+ function commonAncestor(path2, otherPath) {
609
+ const length = Math.min(path2.length, otherPath.length);
610
610
  for (let i = 0; i < length; i++) {
611
- if (path[i] !== otherPath[i]) {
612
- return path.slice(0, i);
611
+ if (path2[i] !== otherPath[i]) {
612
+ return path2.slice(0, i);
613
613
  }
614
614
  }
615
- return path.slice(0, length);
615
+ return path2.slice(0, length);
616
616
  }
617
- function transformPath(path, operation, otherPath, count = 1) {
618
- if (otherPath.length > path.length || (0, sort_1.comparePathsByComponent)(otherPath, path) > 0) {
619
- return path;
617
+ function transformPath(path2, operation, otherPath, count = 1) {
618
+ if (otherPath.length > path2.length || (0, sort_1.comparePathsByComponent)(otherPath, path2) > 0) {
619
+ return path2;
620
620
  }
621
621
  if (otherPath.length === 0 && operation === "remove") {
622
622
  return void 0;
623
623
  }
624
- const common = commonAncestor(path, otherPath);
625
- const adjustmentIndex = common.length === path.length || common.length === otherPath.length ? common.length - 1 : common.length;
626
- const pathValue = path[adjustmentIndex];
624
+ const common = commonAncestor(path2, otherPath);
625
+ const adjustmentIndex = common.length === path2.length || common.length === otherPath.length ? common.length - 1 : common.length;
626
+ const pathValue = path2[adjustmentIndex];
627
627
  const otherPathValue = otherPath[adjustmentIndex];
628
628
  if (operation === "insert" && otherPathValue <= pathValue) {
629
- const newPath = [...path];
629
+ const newPath = [...path2];
630
630
  newPath[adjustmentIndex] += count;
631
631
  return newPath;
632
632
  } else if (operation === "remove") {
633
633
  if (otherPathValue === pathValue) {
634
634
  return void 0;
635
635
  } else if (otherPathValue < pathValue) {
636
- const newPath = [...path];
636
+ const newPath = [...path2];
637
637
  newPath[adjustmentIndex] -= count;
638
638
  return newPath;
639
639
  }
640
640
  }
641
- return path;
641
+ return path2;
642
642
  }
643
643
  }
644
644
  });
@@ -804,15 +804,15 @@ var require_operation = __commonJS({
804
804
  switch (operation.type) {
805
805
  case "insert": {
806
806
  const otherPath = parentPath.concat(operation.index);
807
- return transformedPaths.map((path) => path ? (0, transformPath_1.transformPath)(path, "insert", otherPath, operation.nodes.length) : void 0);
807
+ return transformedPaths.map((path2) => path2 ? (0, transformPath_1.transformPath)(path2, "insert", otherPath, operation.nodes.length) : void 0);
808
808
  }
809
809
  case "remove": {
810
810
  const otherPaths = [...operation.indexes].reverse().map((index) => parentPath.concat(index));
811
- return transformedPaths.map((path) => {
811
+ return transformedPaths.map((path2) => {
812
812
  for (const otherPath of otherPaths) {
813
- path = path ? (0, transformPath_1.transformPath)(path, "remove", otherPath) : void 0;
813
+ path2 = path2 ? (0, transformPath_1.transformPath)(path2, "remove", otherPath) : void 0;
814
814
  }
815
- return path;
815
+ return path2;
816
816
  });
817
817
  }
818
818
  case "removeThenInsert": {
@@ -949,22 +949,22 @@ var require_splice = __commonJS({
949
949
  return _spliceWithPathTracking(node, options);
950
950
  }
951
951
  function _spliceWithPathTracking(node, options) {
952
- const { path, deleteCount = 0, nodes, track } = options;
953
- if (path.length === 0) {
952
+ const { path: path2, deleteCount = 0, nodes, track } = options;
953
+ if (path2.length === 0) {
954
954
  throw new Error(`Can't splice at the root`);
955
955
  }
956
- const pathsToRemove = getPathsToRemove(path, deleteCount);
957
- const operations = (0, operation_1.getInsertionOperations)(path, nodes, (0, operation_1.getRemovalOperations)(pathsToRemove));
956
+ const pathsToRemove = getPathsToRemove(path2, deleteCount);
957
+ const operations = (0, operation_1.getInsertionOperations)(path2, nodes, (0, operation_1.getRemovalOperations)(pathsToRemove));
958
958
  const transformedPaths = track ? (0, operation_1.transformPathsByOperations)(track, operations) : [];
959
959
  return {
960
960
  node: (0, operation_1.applyOperations)(node, operations, options),
961
961
  paths: transformedPaths
962
962
  };
963
963
  }
964
- function getPathsToRemove(path, deleteCount) {
964
+ function getPathsToRemove(path2, deleteCount) {
965
965
  let pathsToRemove = [];
966
- let parentPath = path.slice(0, -1);
967
- let index = path[path.length - 1];
966
+ let parentPath = path2.slice(0, -1);
967
+ let index = path2[path2.length - 1];
968
968
  for (let i = 0; i < deleteCount; i++) {
969
969
  pathsToRemove.push(parentPath.concat(index + i));
970
970
  }
@@ -978,7 +978,7 @@ var require_defineTree = __commonJS({
978
978
  "../../node_modules/tree-visit/lib/defineTree.js"(exports) {
979
979
  "use strict";
980
980
  Object.defineProperty(exports, "__esModule", { value: true });
981
- exports.defineTree = defineTree3;
981
+ exports.defineTree = defineTree4;
982
982
  var access_1 = require_access();
983
983
  var diagram_1 = require_diagram();
984
984
  var entries_1 = require_entries();
@@ -1027,7 +1027,7 @@ var require_defineTree = __commonJS({
1027
1027
  this._getChildren = this.baseOptions.getChildren;
1028
1028
  }
1029
1029
  };
1030
- function defineTree3(getChildren) {
1030
+ function defineTree4(getChildren) {
1031
1031
  return new Tree(getChildren, {});
1032
1032
  }
1033
1033
  }
@@ -1104,6 +1104,391 @@ var require_lib = __commonJS({
1104
1104
  }
1105
1105
  });
1106
1106
 
1107
+ // ../../node_modules/imfs/lib/types.js
1108
+ var require_types = __commonJS({
1109
+ "../../node_modules/imfs/lib/types.js"(exports) {
1110
+ "use strict";
1111
+ Object.defineProperty(exports, "__esModule", { value: true });
1112
+ }
1113
+ });
1114
+
1115
+ // ../../node_modules/imfs/lib/node.js
1116
+ var require_node = __commonJS({
1117
+ "../../node_modules/imfs/lib/node.js"(exports) {
1118
+ "use strict";
1119
+ Object.defineProperty(exports, "__esModule", { value: true });
1120
+ exports.Nodes = void 0;
1121
+ function createFile(data, metadata) {
1122
+ return { type: "file", data, metadata };
1123
+ }
1124
+ function createDirectory(children = {}, metadata) {
1125
+ return { type: "directory", children, metadata };
1126
+ }
1127
+ function isFile(node) {
1128
+ return node.type === "file";
1129
+ }
1130
+ function isDirectory(node) {
1131
+ return node.type === "directory";
1132
+ }
1133
+ function getMetadata(node) {
1134
+ return node.metadata;
1135
+ }
1136
+ function readDirectory(directory) {
1137
+ return Object.keys(directory.children);
1138
+ }
1139
+ function getChild(directory, name) {
1140
+ return directory.children[name];
1141
+ }
1142
+ function hasChild(directory, name) {
1143
+ return name in directory.children;
1144
+ }
1145
+ exports.Nodes = {
1146
+ createDirectory,
1147
+ createFile,
1148
+ getChild,
1149
+ getMetadata,
1150
+ hasChild,
1151
+ isDirectory,
1152
+ isFile,
1153
+ readDirectory
1154
+ };
1155
+ }
1156
+ });
1157
+
1158
+ // ../../node_modules/imfs/lib/path.js
1159
+ var require_path = __commonJS({
1160
+ "../../node_modules/imfs/lib/path.js"(exports) {
1161
+ "use strict";
1162
+ Object.defineProperty(exports, "__esModule", { value: true });
1163
+ exports.dirname = exports.basename = exports.extname = exports.join = exports.normalize = exports.sep = void 0;
1164
+ exports.sep = "/";
1165
+ function preserveLeadingAndTrailingSlash(original, updated) {
1166
+ if (original.startsWith("/")) {
1167
+ updated = "/" + updated;
1168
+ }
1169
+ if (updated[updated.length - 1] !== "/" && original.endsWith("/")) {
1170
+ updated = updated + "/";
1171
+ }
1172
+ return updated;
1173
+ }
1174
+ function normalize(filename) {
1175
+ const components = filename.split(exports.sep).filter((component) => !!component);
1176
+ let i = 0;
1177
+ let length = components.length - 1;
1178
+ while (i < length) {
1179
+ if (components[i] === ".") {
1180
+ components.splice(i, 1);
1181
+ length--;
1182
+ } else if (components[i] === ".." && i !== 0) {
1183
+ components.splice(i - 1, 2);
1184
+ length -= 2;
1185
+ i -= 1;
1186
+ } else if (components[i] === "" && components[i + 1] === "") {
1187
+ components.splice(i, 1);
1188
+ length--;
1189
+ } else {
1190
+ i++;
1191
+ }
1192
+ }
1193
+ return preserveLeadingAndTrailingSlash(filename, components.join(exports.sep));
1194
+ }
1195
+ exports.normalize = normalize;
1196
+ function join(...components) {
1197
+ let result = normalize(components.join(exports.sep));
1198
+ if (result === "") {
1199
+ result = ".";
1200
+ }
1201
+ return result;
1202
+ }
1203
+ exports.join = join;
1204
+ function extname(filename) {
1205
+ const index = filename.lastIndexOf(".");
1206
+ return index !== -1 ? filename.slice(index) : filename;
1207
+ }
1208
+ exports.extname = extname;
1209
+ function basename(filename, extname2) {
1210
+ if (extname2 && filename.endsWith(extname2)) {
1211
+ filename = filename.slice(0, -extname2.length);
1212
+ }
1213
+ let sepIndex = filename.lastIndexOf(exports.sep);
1214
+ if (sepIndex === filename.length - 1) {
1215
+ filename = filename.slice(0, -1);
1216
+ return filename.length > 1 ? basename(filename) : filename;
1217
+ }
1218
+ return filename.slice(sepIndex + 1);
1219
+ }
1220
+ exports.basename = basename;
1221
+ function dirname(filename) {
1222
+ let base2 = basename(filename);
1223
+ let result = filename.slice(0, -(base2.length + 1));
1224
+ if (result === "") {
1225
+ if (filename.startsWith(exports.sep)) {
1226
+ result = exports.sep;
1227
+ } else {
1228
+ result = ".";
1229
+ }
1230
+ }
1231
+ return result;
1232
+ }
1233
+ exports.dirname = dirname;
1234
+ }
1235
+ });
1236
+
1237
+ // ../../node_modules/imfs/lib/entries.js
1238
+ var require_entries2 = __commonJS({
1239
+ "../../node_modules/imfs/lib/entries.js"(exports) {
1240
+ "use strict";
1241
+ Object.defineProperty(exports, "__esModule", { value: true });
1242
+ exports.Entries = void 0;
1243
+ var node_1 = require_node();
1244
+ var path_1 = require_path();
1245
+ function getEntries(entry) {
1246
+ const [pathname, node] = entry;
1247
+ return node_1.Nodes.isDirectory(node) ? Object.entries(node.children).map(([key, value]) => [
1248
+ (0, path_1.join)(pathname, key),
1249
+ value
1250
+ ]) : [];
1251
+ }
1252
+ function createEntry(pathname, node) {
1253
+ return [pathname, node];
1254
+ }
1255
+ exports.Entries = {
1256
+ createEntry,
1257
+ getEntries
1258
+ };
1259
+ }
1260
+ });
1261
+
1262
+ // ../../node_modules/imfs/lib/volume/paths.js
1263
+ var require_paths = __commonJS({
1264
+ "../../node_modules/imfs/lib/volume/paths.js"(exports) {
1265
+ "use strict";
1266
+ Object.defineProperty(exports, "__esModule", { value: true });
1267
+ exports.getNewAndParentName = exports.normalizePathLikeInternal = exports.getPathComponents = void 0;
1268
+ var path_1 = require_path();
1269
+ function getPathComponents(filepath) {
1270
+ return getPathComponentsNormalized((0, path_1.normalize)(filepath));
1271
+ function getPathComponentsNormalized(filepath2) {
1272
+ if (filepath2.startsWith("..")) {
1273
+ throw new Error(`Invalid path ${filepath2}, can't go up past root.`);
1274
+ }
1275
+ if (filepath2.startsWith(".") || filepath2.startsWith("/")) {
1276
+ return getPathComponentsNormalized(filepath2.slice(1));
1277
+ }
1278
+ if (filepath2 === "")
1279
+ return [];
1280
+ return filepath2.split(path_1.sep).filter((component) => !!component);
1281
+ }
1282
+ }
1283
+ exports.getPathComponents = getPathComponents;
1284
+ function normalizePathLikeInternal(pathlike) {
1285
+ return typeof pathlike === "string" ? getPathComponents(pathlike) : pathlike;
1286
+ }
1287
+ exports.normalizePathLikeInternal = normalizePathLikeInternal;
1288
+ function getNewAndParentName(pathlike) {
1289
+ const parentName = typeof pathlike === "string" ? (0, path_1.dirname)(pathlike) : pathlike.slice(0, -1);
1290
+ const newName = typeof pathlike === "string" ? (0, path_1.basename)(pathlike) : pathlike[pathlike.length - 1];
1291
+ return { parentName, newName };
1292
+ }
1293
+ exports.getNewAndParentName = getNewAndParentName;
1294
+ }
1295
+ });
1296
+
1297
+ // ../../node_modules/imfs/lib/volume/read.js
1298
+ var require_read = __commonJS({
1299
+ "../../node_modules/imfs/lib/volume/read.js"(exports) {
1300
+ "use strict";
1301
+ Object.defineProperty(exports, "__esModule", { value: true });
1302
+ exports.getMetadata = exports.readDirectory = exports.readFile = exports.getNode = exports.getNodeInternal = void 0;
1303
+ var node_1 = require_node();
1304
+ var path_1 = require_path();
1305
+ var paths_1 = require_paths();
1306
+ function getNodeInternal(root, pathlike, options) {
1307
+ const components = (0, paths_1.normalizePathLikeInternal)(pathlike);
1308
+ let i = 0;
1309
+ let current2 = root;
1310
+ while (i < components.length) {
1311
+ let component = components[i];
1312
+ if (current2.type !== "directory") {
1313
+ throw new Error(`File ${(0, path_1.join)(...components.slice(0, i))} is not a directory`);
1314
+ }
1315
+ let node = node_1.Nodes.getChild(current2, component);
1316
+ if (!node) {
1317
+ if (options.makeIntermediateDirectoryMetadata) {
1318
+ const child = node_1.Nodes.createDirectory({}, options.makeIntermediateDirectoryMetadata((0, path_1.join)(...components.slice(0, i + 1))));
1319
+ current2.children[component] = child;
1320
+ node = child;
1321
+ } else if (options.makeIntermediateDirectories) {
1322
+ const child = node_1.Nodes.createDirectory();
1323
+ current2.children[component] = child;
1324
+ node = child;
1325
+ } else {
1326
+ throw new Error(`File ${(0, path_1.join)(...components.slice(0, i + 1))} not found`);
1327
+ }
1328
+ }
1329
+ current2 = node;
1330
+ i++;
1331
+ }
1332
+ return current2;
1333
+ }
1334
+ exports.getNodeInternal = getNodeInternal;
1335
+ function getNode(root, pathlike) {
1336
+ return getNodeInternal(root, pathlike, {});
1337
+ }
1338
+ exports.getNode = getNode;
1339
+ function readFile(root, pathlike) {
1340
+ const components = (0, paths_1.normalizePathLikeInternal)(pathlike);
1341
+ const node = getNode(root, components);
1342
+ if (!node_1.Nodes.isFile(node)) {
1343
+ throw new Error(`Can't read, ${(0, path_1.join)(...components)} not a file`);
1344
+ }
1345
+ return node.data;
1346
+ }
1347
+ exports.readFile = readFile;
1348
+ function readDirectory(root, pathlike) {
1349
+ const components = (0, paths_1.normalizePathLikeInternal)(pathlike);
1350
+ const node = getNode(root, components);
1351
+ if (!node_1.Nodes.isDirectory(node)) {
1352
+ throw new Error(`Can't read, ${(0, path_1.join)(...components)} not a directory`);
1353
+ }
1354
+ return node_1.Nodes.readDirectory(node);
1355
+ }
1356
+ exports.readDirectory = readDirectory;
1357
+ function getMetadata(root, pathlike) {
1358
+ const components = (0, paths_1.normalizePathLikeInternal)(pathlike);
1359
+ const node = getNode(root, components);
1360
+ return node.metadata;
1361
+ }
1362
+ exports.getMetadata = getMetadata;
1363
+ }
1364
+ });
1365
+
1366
+ // ../../node_modules/imfs/lib/volume/write.js
1367
+ var require_write = __commonJS({
1368
+ "../../node_modules/imfs/lib/volume/write.js"(exports) {
1369
+ "use strict";
1370
+ Object.defineProperty(exports, "__esModule", { value: true });
1371
+ exports.create = exports.setMetadata = exports.removeFile = exports.makeDirectory = exports.writeFile = exports.setNode = void 0;
1372
+ var node_1 = require_node();
1373
+ var paths_1 = require_paths();
1374
+ var read_1 = require_read();
1375
+ function setNode(root, pathlike, node, options) {
1376
+ const { parentName, newName } = (0, paths_1.getNewAndParentName)(pathlike);
1377
+ const parent = (0, read_1.getNodeInternal)(root, parentName, options !== null && options !== void 0 ? options : {});
1378
+ if (!node_1.Nodes.isDirectory(parent)) {
1379
+ throw new Error(`Can't create ${newName}, ${parentName} not a directory`);
1380
+ }
1381
+ parent.children[newName] = node;
1382
+ }
1383
+ exports.setNode = setNode;
1384
+ function writeFile(root, pathlike, data, options) {
1385
+ var _a;
1386
+ setNode(root, pathlike, node_1.Nodes.createFile(data, (_a = options) === null || _a === void 0 ? void 0 : _a.metadata), options);
1387
+ }
1388
+ exports.writeFile = writeFile;
1389
+ function makeDirectory(root, pathlike, options) {
1390
+ var _a;
1391
+ const { parentName, newName } = (0, paths_1.getNewAndParentName)(pathlike);
1392
+ const parent = (0, read_1.getNodeInternal)(root, parentName, options !== null && options !== void 0 ? options : {});
1393
+ if (!node_1.Nodes.isDirectory(parent)) {
1394
+ throw new Error(`Can't create ${newName}, ${parentName} not a directory`);
1395
+ }
1396
+ const existing = node_1.Nodes.getChild(parent, newName);
1397
+ if (existing && node_1.Nodes.isDirectory(parent.children[newName])) {
1398
+ return;
1399
+ }
1400
+ parent.children[newName] = node_1.Nodes.createDirectory({}, (_a = options) === null || _a === void 0 ? void 0 : _a.metadata);
1401
+ }
1402
+ exports.makeDirectory = makeDirectory;
1403
+ function removeFile(root, pathlike) {
1404
+ const { parentName, newName } = (0, paths_1.getNewAndParentName)(pathlike);
1405
+ const parent = (0, read_1.getNode)(root, parentName);
1406
+ if (!node_1.Nodes.isDirectory(parent)) {
1407
+ throw new Error(`Can't remove file ${newName}, ${parentName} not a directory`);
1408
+ }
1409
+ delete parent.children[newName];
1410
+ }
1411
+ exports.removeFile = removeFile;
1412
+ function setMetadata(root, pathlike, metadata) {
1413
+ const node = (0, read_1.getNode)(root, pathlike);
1414
+ node.metadata = metadata;
1415
+ }
1416
+ exports.setMetadata = setMetadata;
1417
+ function create2(options) {
1418
+ return node_1.Nodes.createDirectory({}, options && "metadata" in options ? options.metadata : void 0);
1419
+ }
1420
+ exports.create = create2;
1421
+ }
1422
+ });
1423
+
1424
+ // ../../node_modules/imfs/lib/volume.js
1425
+ var require_volume = __commonJS({
1426
+ "../../node_modules/imfs/lib/volume.js"(exports) {
1427
+ "use strict";
1428
+ Object.defineProperty(exports, "__esModule", { value: true });
1429
+ exports.Volume = void 0;
1430
+ var paths_1 = require_paths();
1431
+ var read_1 = require_read();
1432
+ var write_1 = require_write();
1433
+ exports.Volume = {
1434
+ // paths
1435
+ getPathComponents: paths_1.getPathComponents,
1436
+ // read
1437
+ getMetadata: read_1.getMetadata,
1438
+ getNode: read_1.getNode,
1439
+ readDirectory: read_1.readDirectory,
1440
+ readFile: read_1.readFile,
1441
+ // write
1442
+ create: write_1.create,
1443
+ makeDirectory: write_1.makeDirectory,
1444
+ removeFile: write_1.removeFile,
1445
+ setMetadata: write_1.setMetadata,
1446
+ setNode: write_1.setNode,
1447
+ writeFile: write_1.writeFile
1448
+ };
1449
+ }
1450
+ });
1451
+
1452
+ // ../../node_modules/imfs/lib/index.js
1453
+ var require_lib2 = __commonJS({
1454
+ "../../node_modules/imfs/lib/index.js"(exports) {
1455
+ "use strict";
1456
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1457
+ if (k2 === void 0) k2 = k;
1458
+ Object.defineProperty(o, k2, { enumerable: true, get: function() {
1459
+ return m[k];
1460
+ } });
1461
+ } : function(o, m, k, k2) {
1462
+ if (k2 === void 0) k2 = k;
1463
+ o[k2] = m[k];
1464
+ });
1465
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
1466
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1467
+ } : function(o, v) {
1468
+ o["default"] = v;
1469
+ });
1470
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
1471
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
1472
+ };
1473
+ var __importStar = exports && exports.__importStar || function(mod) {
1474
+ if (mod && mod.__esModule) return mod;
1475
+ var result = {};
1476
+ if (mod != null) {
1477
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1478
+ }
1479
+ __setModuleDefault(result, mod);
1480
+ return result;
1481
+ };
1482
+ Object.defineProperty(exports, "__esModule", { value: true });
1483
+ exports.path = void 0;
1484
+ __exportStar(require_types(), exports);
1485
+ __exportStar(require_node(), exports);
1486
+ __exportStar(require_entries2(), exports);
1487
+ __exportStar(require_volume(), exports);
1488
+ exports.path = __importStar(require_path());
1489
+ }
1490
+ });
1491
+
1107
1492
  // ../../node_modules/fast-diff/diff.js
1108
1493
  var require_diff = __commonJS({
1109
1494
  "../../node_modules/fast-diff/diff.js"(exports, module) {
@@ -1971,6 +2356,12 @@ function useNoyaAssets(fileId) {
1971
2356
  );
1972
2357
  return assets ?? empty;
1973
2358
  }
2359
+ function useNoyaAssetsByFileVersionId(fileVersionId) {
2360
+ const client = useNoyaClientOrFallback();
2361
+ const empty = useMemo2(() => ({ assets: [], loading: true }), []);
2362
+ const assets = useSelector(client.assetsByFileVersionId$[fileVersionId]);
2363
+ return assets ?? empty;
2364
+ }
1974
2365
  function useNoyaSecrets(fileId) {
1975
2366
  const client = useNoyaClientOrFallback();
1976
2367
  const empty = useMemo2(() => ({ secrets: [], loading: true }), []);
@@ -2177,8 +2568,8 @@ var emptyObservedFileVersions = {
2177
2568
  };
2178
2569
  function useNoyaOwnedFileVersions(fileId) {
2179
2570
  const client = useNoyaClientOrFallback();
2180
- const path = useMemo2(() => [fileId], [fileId]);
2181
- const fileVersions = useObservable(client.ownedFileVersions$, path);
2571
+ const path2 = useMemo2(() => [fileId], [fileId]);
2572
+ const fileVersions = useObservable(client.ownedFileVersions$, path2);
2182
2573
  useEffect(() => {
2183
2574
  if (!fileVersions || fileVersions.loading === "idle") {
2184
2575
  client.fileVersions.refetch({ fileId, type: "owned" });
@@ -2209,9 +2600,6 @@ function useNoyaTemplates() {
2209
2600
  };
2210
2601
  }
2211
2602
 
2212
- // src/react/tableHooks.ts
2213
- import { RefetchableObservable } from "@noya-app/noya-api";
2214
-
2215
2603
  // ../../node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
2216
2604
  var value_exports = {};
2217
2605
  __export(value_exports, {
@@ -4637,15 +5025,6 @@ __export(type_exports3, {
4637
5025
  var Type = type_exports3;
4638
5026
 
4639
5027
  // ../../node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
4640
- function IsStandardObject(value) {
4641
- return IsObject4(value) && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
4642
- }
4643
- function IsDate4(value) {
4644
- return value instanceof Date && Number.isFinite(value.getTime());
4645
- }
4646
- function IsUint8Array4(value) {
4647
- return value instanceof globalThis.Uint8Array;
4648
- }
4649
5028
  function IsObject4(value) {
4650
5029
  return value !== null && typeof value === "object";
4651
5030
  }
@@ -4655,24 +5034,9 @@ function IsArray4(value) {
4655
5034
  function IsUndefined4(value) {
4656
5035
  return value === void 0;
4657
5036
  }
4658
- function IsNull4(value) {
4659
- return value === null;
4660
- }
4661
- function IsBoolean4(value) {
4662
- return typeof value === "boolean";
4663
- }
4664
5037
  function IsNumber4(value) {
4665
5038
  return typeof value === "number";
4666
5039
  }
4667
- function IsBigInt4(value) {
4668
- return typeof value === "bigint";
4669
- }
4670
- function IsString4(value) {
4671
- return typeof value === "string";
4672
- }
4673
- function IsSymbol4(value) {
4674
- return typeof value === "symbol";
4675
- }
4676
5040
 
4677
5041
  // ../../node_modules/@sinclair/typebox/build/esm/system/policy.mjs
4678
5042
  var TypeSystemPolicy;
@@ -4735,13 +5099,6 @@ var TypeSystem;
4735
5099
  })(TypeSystem || (TypeSystem = {}));
4736
5100
 
4737
5101
  // ../../node_modules/@sinclair/typebox/build/esm/value/hash/hash.mjs
4738
- var ValueHashError = class extends TypeBoxError {
4739
- value;
4740
- constructor(value) {
4741
- super(`Unable to hash value`);
4742
- this.value = value;
4743
- }
4744
- };
4745
5102
  var ByteMarker;
4746
5103
  (function(ByteMarker2) {
4747
5104
  ByteMarker2[ByteMarker2["Undefined"] = 0] = "Undefined";
@@ -4762,105 +5119,6 @@ var Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
4762
5119
  var F64 = new Float64Array(1);
4763
5120
  var F64In = new DataView(F64.buffer);
4764
5121
  var F64Out = new Uint8Array(F64.buffer);
4765
- function* NumberToBytes(value) {
4766
- const byteCount = value === 0 ? 1 : Math.ceil(Math.floor(Math.log2(value) + 1) / 8);
4767
- for (let i = 0; i < byteCount; i++) {
4768
- yield value >> 8 * (byteCount - 1 - i) & 255;
4769
- }
4770
- }
4771
- function ArrayType2(value) {
4772
- FNV1A64(ByteMarker.Array);
4773
- for (const item of value) {
4774
- Visit4(item);
4775
- }
4776
- }
4777
- function BooleanType(value) {
4778
- FNV1A64(ByteMarker.Boolean);
4779
- FNV1A64(value ? 1 : 0);
4780
- }
4781
- function BigIntType(value) {
4782
- FNV1A64(ByteMarker.BigInt);
4783
- F64In.setBigInt64(0, value);
4784
- for (const byte of F64Out) {
4785
- FNV1A64(byte);
4786
- }
4787
- }
4788
- function DateType2(value) {
4789
- FNV1A64(ByteMarker.Date);
4790
- Visit4(value.getTime());
4791
- }
4792
- function NullType(value) {
4793
- FNV1A64(ByteMarker.Null);
4794
- }
4795
- function NumberType(value) {
4796
- FNV1A64(ByteMarker.Number);
4797
- F64In.setFloat64(0, value);
4798
- for (const byte of F64Out) {
4799
- FNV1A64(byte);
4800
- }
4801
- }
4802
- function ObjectType2(value) {
4803
- FNV1A64(ByteMarker.Object);
4804
- for (const key of globalThis.Object.getOwnPropertyNames(value).sort()) {
4805
- Visit4(key);
4806
- Visit4(value[key]);
4807
- }
4808
- }
4809
- function StringType(value) {
4810
- FNV1A64(ByteMarker.String);
4811
- for (let i = 0; i < value.length; i++) {
4812
- for (const byte of NumberToBytes(value.charCodeAt(i))) {
4813
- FNV1A64(byte);
4814
- }
4815
- }
4816
- }
4817
- function SymbolType(value) {
4818
- FNV1A64(ByteMarker.Symbol);
4819
- Visit4(value.description);
4820
- }
4821
- function Uint8ArrayType2(value) {
4822
- FNV1A64(ByteMarker.Uint8Array);
4823
- for (let i = 0; i < value.length; i++) {
4824
- FNV1A64(value[i]);
4825
- }
4826
- }
4827
- function UndefinedType(value) {
4828
- return FNV1A64(ByteMarker.Undefined);
4829
- }
4830
- function Visit4(value) {
4831
- if (IsArray4(value))
4832
- return ArrayType2(value);
4833
- if (IsBoolean4(value))
4834
- return BooleanType(value);
4835
- if (IsBigInt4(value))
4836
- return BigIntType(value);
4837
- if (IsDate4(value))
4838
- return DateType2(value);
4839
- if (IsNull4(value))
4840
- return NullType(value);
4841
- if (IsNumber4(value))
4842
- return NumberType(value);
4843
- if (IsStandardObject(value))
4844
- return ObjectType2(value);
4845
- if (IsString4(value))
4846
- return StringType(value);
4847
- if (IsSymbol4(value))
4848
- return SymbolType(value);
4849
- if (IsUint8Array4(value))
4850
- return Uint8ArrayType2(value);
4851
- if (IsUndefined4(value))
4852
- return UndefinedType(value);
4853
- throw new ValueHashError(value);
4854
- }
4855
- function FNV1A64(byte) {
4856
- Accumulator = Accumulator ^ Bytes[byte];
4857
- Accumulator = Accumulator * Prime % Size;
4858
- }
4859
- function Hash(value) {
4860
- Accumulator = BigInt("14695981039346656037");
4861
- Visit4(value);
4862
- return Accumulator;
4863
- }
4864
5122
 
4865
5123
  // ../../node_modules/@sinclair/typebox/build/esm/errors/errors.mjs
4866
5124
  var ValueErrorType;
@@ -4948,6 +5206,9 @@ var Delete3 = Object2({
4948
5206
  });
4949
5207
  var Edit = Union([Insert, Update, Delete3]);
4950
5208
 
5209
+ // ../state-manager/src/ActivityEventsManager.ts
5210
+ import { Observable } from "@noya-app/observable";
5211
+
4951
5212
  // ../emitter/src/index.ts
4952
5213
  var Emitter = class {
4953
5214
  constructor(options = {}) {
@@ -4991,11 +5252,71 @@ var Emitter = class {
4991
5252
 
4992
5253
  // ../state-manager/src/AIManager.ts
4993
5254
  import { isDeepEqual } from "@noya-app/noya-utils";
4994
- import { Observable } from "@noya-app/observable";
5255
+ import { Observable as Observable2 } from "@noya-app/observable";
4995
5256
 
4996
5257
  // ../state-manager/src/AssetManager.ts
4997
5258
  import { Base64, uuid } from "@noya-app/noya-utils";
4998
- import { Observable as Observable2 } from "@noya-app/observable";
5259
+ import { Observable as Observable3 } from "@noya-app/observable";
5260
+
5261
+ // ../noya-schemas/src/nullable.ts
5262
+ var Nullable = (schema) => Type.Union([Type.Null(), schema]);
5263
+
5264
+ // ../noya-schemas/src/activityEventSchema.ts
5265
+ var userSelectSchema = Type.Object({
5266
+ id: Type.String(),
5267
+ name: Nullable(Type.String()),
5268
+ email: Nullable(Type.String()),
5269
+ image: Nullable(Type.String())
5270
+ });
5271
+ var workspaceSelectSchema = Type.Object({
5272
+ id: Type.String(),
5273
+ name: Type.String()
5274
+ });
5275
+ var fileSelectSchema = Type.Object({
5276
+ id: Type.String(),
5277
+ name: Nullable(Type.String())
5278
+ });
5279
+ var resourceSelectSchema = Type.Object({
5280
+ id: Type.String(),
5281
+ path: Type.String(),
5282
+ type: Type.Union([
5283
+ Type.Literal("asset"),
5284
+ Type.Literal("file"),
5285
+ Type.Literal("fileVersion"),
5286
+ Type.Literal("directory"),
5287
+ Type.Literal("resource")
5288
+ ])
5289
+ });
5290
+ var siteSelectSchema = Type.Object({
5291
+ id: Type.String(),
5292
+ subdomain: Nullable(Type.String())
5293
+ });
5294
+ var activityEventSchema = Type.Object({
5295
+ id: Type.String(),
5296
+ createdAt: Type.String(),
5297
+ actorId: Nullable(Type.String()),
5298
+ actor: Type.Optional(userSelectSchema),
5299
+ type: Type.Union([
5300
+ Type.Literal("file"),
5301
+ Type.Literal("resource"),
5302
+ Type.Literal("site"),
5303
+ Type.Literal("snapshot"),
5304
+ Type.Literal("restore")
5305
+ ]),
5306
+ workspaceId: Nullable(Type.String()),
5307
+ workspace: Type.Optional(workspaceSelectSchema),
5308
+ fileId: Nullable(Type.String()),
5309
+ file: Type.Optional(fileSelectSchema),
5310
+ fileVersionId: Nullable(Type.String()),
5311
+ resourceId: Nullable(Type.String()),
5312
+ resource: Type.Optional(resourceSelectSchema),
5313
+ siteId: Nullable(Type.String()),
5314
+ site: Type.Optional(siteSelectSchema),
5315
+ previousData: Nullable(Type.Any()),
5316
+ currentData: Nullable(Type.Any()),
5317
+ metadata: Nullable(Type.Any()),
5318
+ userAgent: Nullable(Type.String())
5319
+ });
4999
5320
 
5000
5321
  // ../noya-schemas/src/asset.ts
5001
5322
  var assetSchema = Type.Object({
@@ -5003,7 +5324,10 @@ var assetSchema = Type.Object({
5003
5324
  url: Type.String(),
5004
5325
  createdAt: Type.String(),
5005
5326
  size: Type.Number(),
5006
- contentType: Type.Optional(Type.String())
5327
+ contentType: Type.Optional(Type.String()),
5328
+ width: Type.Union([Type.Null(), Type.Number()]),
5329
+ height: Type.Union([Type.Null(), Type.Number()]),
5330
+ userId: Type.Union([Type.Null(), Type.String()])
5007
5331
  });
5008
5332
 
5009
5333
  // ../noya-schemas/src/encode.ts
@@ -5157,25 +5481,25 @@ var jsonSchema = Type.Recursive(
5157
5481
  );
5158
5482
 
5159
5483
  // ../noya-schemas/src/input.ts
5160
- function Nullable(type) {
5484
+ function Nullable2(type) {
5161
5485
  return Type.Union([type, Type.Null()], { default: null });
5162
5486
  }
5163
5487
  var inputSchemaBase = {
5164
5488
  id: Type.String({ format: "uuid", default: "" }),
5165
5489
  stableId: Type.String({ format: "uuid", default: "" }),
5166
5490
  name: Type.String(),
5167
- description: Nullable(Type.String()),
5491
+ description: Nullable2(Type.String()),
5168
5492
  required: Type.Boolean({ default: false })
5169
5493
  };
5170
5494
  var fileInputSchema = Type.Object({
5171
5495
  ...inputSchemaBase,
5172
5496
  kind: Type.Literal("file"),
5173
- toolId: Nullable(Type.String())
5497
+ toolId: Nullable2(Type.String())
5174
5498
  });
5175
5499
  var dataInputSchema = Type.Object({
5176
5500
  ...inputSchemaBase,
5177
5501
  kind: Type.Literal("data"),
5178
- schema: Nullable(jsonSchema)
5502
+ schema: Nullable2(jsonSchema)
5179
5503
  });
5180
5504
  var secretInputSchema = Type.Object({
5181
5505
  ...inputSchemaBase,
@@ -5185,7 +5509,7 @@ var secretInputSchema = Type.Object({
5185
5509
  default: null
5186
5510
  })
5187
5511
  ),
5188
- authScope: Type.Optional(Nullable(Type.String()))
5512
+ authScope: Type.Optional(Nullable2(Type.String()))
5189
5513
  });
5190
5514
  var inputSchema = Type.Union(
5191
5515
  [fileInputSchema, dataInputSchema, secretInputSchema],
@@ -5231,6 +5555,94 @@ var SchemaTree = (0, import_tree_visit.defineTree)((schema) => {
5231
5555
  }
5232
5556
  });
5233
5557
 
5558
+ // ../noya-schemas/src/resourceSchema.ts
5559
+ var baseSchemaProperties = {
5560
+ id: Type.String(),
5561
+ stableId: Type.String(),
5562
+ path: Type.String(),
5563
+ createdAt: Type.String(),
5564
+ updatedAt: Type.String(),
5565
+ accessibleByFileId: Nullable(Type.String()),
5566
+ accessibleByFile: Type.Optional(
5567
+ Type.Object({
5568
+ id: Type.String(),
5569
+ name: Type.String(),
5570
+ toolId: Type.String()
5571
+ })
5572
+ ),
5573
+ accessibleByFileVersionId: Nullable(Type.String()),
5574
+ url: Type.Optional(Type.String())
5575
+ };
5576
+ var uploadableAssetSchema = Type.Object({
5577
+ content: Type.String(),
5578
+ contentType: Type.String(),
5579
+ encoding: Type.Union([Type.Literal("utf-8"), Type.Literal("base64")])
5580
+ });
5581
+ var assetResourceSchema = Type.Object({
5582
+ ...baseSchemaProperties,
5583
+ type: Type.Literal("asset"),
5584
+ assetId: Type.String()
5585
+ });
5586
+ var assetResourceCreateSchema = Type.Object({
5587
+ ...baseSchemaProperties,
5588
+ type: Type.Literal("asset"),
5589
+ assetId: Type.Optional(Type.String()),
5590
+ asset: Type.Optional(uploadableAssetSchema)
5591
+ });
5592
+ var fileResourceSchema = Type.Object({
5593
+ ...baseSchemaProperties,
5594
+ type: Type.Literal("file"),
5595
+ fileId: Type.String()
5596
+ });
5597
+ var directoryResourceSchema = Type.Object({
5598
+ ...baseSchemaProperties,
5599
+ type: Type.Literal("directory")
5600
+ });
5601
+ var nestedResourceSchema = Type.Object({
5602
+ ...baseSchemaProperties,
5603
+ type: Type.Literal("resource"),
5604
+ fileId: Type.String(),
5605
+ resourceId: Type.String()
5606
+ });
5607
+ var resourceSchema = Type.Union(
5608
+ [
5609
+ assetResourceSchema,
5610
+ fileResourceSchema,
5611
+ directoryResourceSchema,
5612
+ nestedResourceSchema
5613
+ ],
5614
+ {
5615
+ discriminator: "type"
5616
+ }
5617
+ );
5618
+ var resourceCreateSchema = Type.Union(
5619
+ [
5620
+ assetResourceCreateSchema,
5621
+ fileResourceSchema,
5622
+ directoryResourceSchema,
5623
+ nestedResourceSchema
5624
+ ],
5625
+ {
5626
+ discriminator: "type"
5627
+ }
5628
+ );
5629
+ var flatResourceSchema = Type.Object({
5630
+ ...baseSchemaProperties,
5631
+ type: Type.Union([
5632
+ Type.Literal("asset"),
5633
+ Type.Literal("file"),
5634
+ Type.Literal("directory"),
5635
+ Type.Literal("resource")
5636
+ ]),
5637
+ assetId: Nullable(Type.String()),
5638
+ fileId: Nullable(Type.String()),
5639
+ resourceId: Nullable(Type.String())
5640
+ });
5641
+
5642
+ // ../noya-schemas/src/resourceTree.ts
5643
+ var import_imfs = __toESM(require_lib2());
5644
+ var import_tree_visit2 = __toESM(require_lib());
5645
+
5234
5646
  // ../noya-schemas/src/index.ts
5235
5647
  function validateUUID(value) {
5236
5648
  return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
@@ -5241,10 +5653,10 @@ format_exports.Set("color", () => true);
5241
5653
  format_exports.Set("uuid", validateUUID);
5242
5654
 
5243
5655
  // ../state-manager/src/ConnectedUsersManager.ts
5244
- import { Observable as Observable3 } from "@noya-app/observable";
5656
+ import { Observable as Observable4 } from "@noya-app/observable";
5245
5657
 
5246
5658
  // ../state-manager/src/ConnectionEventManager.ts
5247
- import { Observable as Observable4 } from "@noya-app/observable";
5659
+ import { Observable as Observable5 } from "@noya-app/observable";
5248
5660
 
5249
5661
  // ../../node_modules/mutative/dist/mutative.esm.mjs
5250
5662
  var PROXY_DRAFT = Symbol.for("__MUTATIVE_PROXY_DRAFT__");
@@ -5298,7 +5710,7 @@ function isDraftable(value, options) {
5298
5710
  let markResult;
5299
5711
  return Object.getPrototypeOf(value) === Object.prototype || Array.isArray(value) || value instanceof Map || value instanceof Set || !!(options === null || options === void 0 ? void 0 : options.mark) && ((markResult = options.mark(value, dataTypes)) === dataTypes.immutable || typeof markResult === "function");
5300
5712
  }
5301
- function getPath(target, path = []) {
5713
+ function getPath(target, path2 = []) {
5302
5714
  if (Object.hasOwnProperty.call(target, "key")) {
5303
5715
  const parentCopy = target.parent.copy;
5304
5716
  const proxyDraft = getProxyDraft(get(parentCopy, target.key));
@@ -5309,18 +5721,18 @@ function getPath(target, path = []) {
5309
5721
  const key = isSet ? Array.from(target.parent.setMap.keys()).indexOf(target.key) : target.key;
5310
5722
  if (!(isSet && parentCopy.size > key || has(parentCopy, key)))
5311
5723
  return null;
5312
- path.push(key);
5724
+ path2.push(key);
5313
5725
  }
5314
5726
  if (target.parent) {
5315
- return getPath(target.parent, path);
5727
+ return getPath(target.parent, path2);
5316
5728
  }
5317
- path.reverse();
5729
+ path2.reverse();
5318
5730
  try {
5319
- resolvePath(target.copy, path);
5731
+ resolvePath(target.copy, path2);
5320
5732
  } catch (e) {
5321
5733
  return null;
5322
5734
  }
5323
- return path;
5735
+ return path2;
5324
5736
  }
5325
5737
  function getType(target) {
5326
5738
  if (Array.isArray(target))
@@ -5362,25 +5774,25 @@ function revokeProxy(proxyDraft) {
5362
5774
  revoke();
5363
5775
  }
5364
5776
  }
5365
- function escapePath(path, pathAsArray) {
5366
- return pathAsArray ? path : [""].concat(path).map((_item) => {
5777
+ function escapePath(path2, pathAsArray) {
5778
+ return pathAsArray ? path2 : [""].concat(path2).map((_item) => {
5367
5779
  const item = `${_item}`;
5368
5780
  if (item.indexOf("/") === -1 && item.indexOf("~") === -1)
5369
5781
  return item;
5370
5782
  return item.replace(/~/g, "~0").replace(/\//g, "~1");
5371
5783
  }).join("/");
5372
5784
  }
5373
- function unescapePath(path) {
5374
- if (Array.isArray(path))
5375
- return path;
5376
- return path.split("/").map((_item) => _item.replace(/~1/g, "/").replace(/~0/g, "~")).slice(1);
5785
+ function unescapePath(path2) {
5786
+ if (Array.isArray(path2))
5787
+ return path2;
5788
+ return path2.split("/").map((_item) => _item.replace(/~1/g, "/").replace(/~0/g, "~")).slice(1);
5377
5789
  }
5378
- function resolvePath(base2, path) {
5379
- for (let index = 0; index < path.length - 1; index += 1) {
5380
- const key = path[index];
5790
+ function resolvePath(base2, path2) {
5791
+ for (let index = 0; index < path2.length - 1; index += 1) {
5792
+ const key = path2[index];
5381
5793
  base2 = get(getType(base2) === 3 ? Array.from(base2) : base2, key);
5382
5794
  if (typeof base2 !== "object") {
5383
- throw new Error(`Cannot resolve patch at '${path.join("/")}'.`);
5795
+ throw new Error(`Cannot resolve patch at '${path2.join("/")}'.`);
5384
5796
  }
5385
5797
  }
5386
5798
  return base2;
@@ -5764,8 +6176,8 @@ function generateArrayPatches(proxyState, basePath, patches, inversePatches, pat
5764
6176
  cloneIfNeeded,
5765
6177
  concatPath: (segment) => {
5766
6178
  const _path = basePath.concat([segment]);
5767
- const path = escapePath(_path, pathAsArray);
5768
- return path;
6179
+ const path2 = escapePath(_path, pathAsArray);
6180
+ return path2;
5769
6181
  },
5770
6182
  basePath,
5771
6183
  original,
@@ -5785,26 +6197,26 @@ function generateArrayPatches(proxyState, basePath, patches, inversePatches, pat
5785
6197
  }
5786
6198
  for (let index = 0; index < original.length; index += 1) {
5787
6199
  if (assignedMap.get(index.toString()) && copy[index] !== original[index]) {
5788
- const path = params.concatPath(index);
6200
+ const path2 = params.concatPath(index);
5789
6201
  patches.push({
5790
6202
  op: Operation.Replace,
5791
- path,
6203
+ path: path2,
5792
6204
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
5793
6205
  value: params.cloneIfNeeded(copy[index])
5794
6206
  });
5795
6207
  inversePatches.push({
5796
6208
  op: Operation.Replace,
5797
- path,
6209
+ path: path2,
5798
6210
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
5799
6211
  value: params.cloneIfNeeded(original[index])
5800
6212
  });
5801
6213
  }
5802
6214
  }
5803
6215
  for (let index = original.length; index < copy.length; index += 1) {
5804
- const path = params.concatPath(index);
6216
+ const path2 = params.concatPath(index);
5805
6217
  patches.push({
5806
6218
  op: Operation.Add,
5807
- path,
6219
+ path: path2,
5808
6220
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
5809
6221
  value: params.cloneIfNeeded(copy[index])
5810
6222
  });
@@ -5812,18 +6224,18 @@ function generateArrayPatches(proxyState, basePath, patches, inversePatches, pat
5812
6224
  if (original.length < copy.length) {
5813
6225
  const { arrayLengthAssignment = true } = options.enablePatches;
5814
6226
  if (arrayLengthAssignment) {
5815
- const path = params.concatPath("length");
6227
+ const path2 = params.concatPath("length");
5816
6228
  inversePatches.push({
5817
6229
  op: Operation.Replace,
5818
- path,
6230
+ path: path2,
5819
6231
  value: original.length
5820
6232
  });
5821
6233
  } else {
5822
6234
  for (let index = copy.length; original.length < index; index -= 1) {
5823
- const path = params.concatPath(index - 1);
6235
+ const path2 = params.concatPath(index - 1);
5824
6236
  inversePatches.push({
5825
6237
  op: Operation.Remove,
5826
- path
6238
+ path: path2
5827
6239
  });
5828
6240
  }
5829
6241
  }
@@ -5837,9 +6249,9 @@ function generatePatchesFromAssigned({ original, copy, assignedMap }, basePath,
5837
6249
  if (isEqual(originalValue, value) && op === Operation.Replace)
5838
6250
  return;
5839
6251
  const _path = basePath.concat(key);
5840
- const path = escapePath(_path, pathAsArray);
5841
- patches.push(op === Operation.Remove ? { op, path } : { op, path, value });
5842
- inversePatches.push(op === Operation.Add ? { op: Operation.Remove, path } : op === Operation.Remove ? { op: Operation.Add, path, value: originalValue } : { op: Operation.Replace, path, value: originalValue });
6252
+ const path2 = escapePath(_path, pathAsArray);
6253
+ patches.push(op === Operation.Remove ? { op, path: path2 } : { op, path: path2, value });
6254
+ inversePatches.push(op === Operation.Add ? { op: Operation.Remove, path: path2 } : op === Operation.Remove ? { op: Operation.Add, path: path2, value: originalValue } : { op: Operation.Replace, path: path2, value: originalValue });
5843
6255
  });
5844
6256
  }
5845
6257
  function generateSetPatches({ original, copy }, basePath, patches, inversePatches, pathAsArray) {
@@ -5847,15 +6259,15 @@ function generateSetPatches({ original, copy }, basePath, patches, inversePatche
5847
6259
  original.forEach((value) => {
5848
6260
  if (!copy.has(value)) {
5849
6261
  const _path = basePath.concat([index]);
5850
- const path = escapePath(_path, pathAsArray);
6262
+ const path2 = escapePath(_path, pathAsArray);
5851
6263
  patches.push({
5852
6264
  op: Operation.Remove,
5853
- path,
6265
+ path: path2,
5854
6266
  value
5855
6267
  });
5856
6268
  inversePatches.unshift({
5857
6269
  op: Operation.Add,
5858
- path,
6270
+ path: path2,
5859
6271
  value
5860
6272
  });
5861
6273
  }
@@ -5865,15 +6277,15 @@ function generateSetPatches({ original, copy }, basePath, patches, inversePatche
5865
6277
  copy.forEach((value) => {
5866
6278
  if (!original.has(value)) {
5867
6279
  const _path = basePath.concat([index]);
5868
- const path = escapePath(_path, pathAsArray);
6280
+ const path2 = escapePath(_path, pathAsArray);
5869
6281
  patches.push({
5870
6282
  op: Operation.Add,
5871
- path,
6283
+ path: path2,
5872
6284
  value
5873
6285
  });
5874
6286
  inversePatches.unshift({
5875
6287
  op: Operation.Remove,
5876
- path,
6288
+ path: path2,
5877
6289
  value
5878
6290
  });
5879
6291
  }
@@ -6554,11 +6966,11 @@ function applyPatchToString(str, patch) {
6554
6966
  return str;
6555
6967
  }
6556
6968
  }
6557
- function evaluatePointer(draft, path) {
6969
+ function evaluatePointer(draft, path2) {
6558
6970
  let base2 = draft;
6559
- for (let index = 0; index < path.length - 1; index += 1) {
6971
+ for (let index = 0; index < path2.length - 1; index += 1) {
6560
6972
  const parentType = getType(base2);
6561
- let key = path[index];
6973
+ let key = path2[index];
6562
6974
  if (typeof key !== "string" && typeof key !== "number") {
6563
6975
  key = String(key);
6564
6976
  }
@@ -6567,7 +6979,7 @@ function evaluatePointer(draft, path) {
6567
6979
  }
6568
6980
  base2 = get(parentType === 3 ? Array.from(base2) : base2, key);
6569
6981
  if (typeof base2 !== "object" && typeof base2 !== "string") {
6570
- throw new Error(`Cannot apply patch at '${path.join("/")}'.`);
6982
+ throw new Error(`Cannot apply patch at '${path2.join("/")}'.`);
6571
6983
  }
6572
6984
  }
6573
6985
  return base2;
@@ -6575,12 +6987,12 @@ function evaluatePointer(draft, path) {
6575
6987
  function apply(state, patches, applyOptions) {
6576
6988
  let i;
6577
6989
  for (i = patches.length - 1; i >= 0; i -= 1) {
6578
- const { value, op, path, from } = patches[i];
6579
- if (!path.length && op === Operation.Replace || path === "" && op === Operation.Add) {
6990
+ const { value, op, path: path2, from } = patches[i];
6991
+ if (!path2.length && op === Operation.Replace || path2 === "" && op === Operation.Add) {
6580
6992
  state = value;
6581
6993
  break;
6582
6994
  }
6583
- if (!path.length && op === Operation.Move) {
6995
+ if (!path2.length && op === Operation.Move) {
6584
6996
  const fromPath = unescapePath(from);
6585
6997
  const fromBase = evaluatePointer(state, fromPath);
6586
6998
  const fromKey = fromPath[fromPath.length - 1];
@@ -6595,12 +7007,12 @@ function apply(state, patches, applyOptions) {
6595
7007
  const mutate2 = (draft) => {
6596
7008
  patches.forEach((patch) => {
6597
7009
  const { path: _path, from: _fromPath, op } = patch;
6598
- const path = unescapePath(_path);
6599
- let base2 = evaluatePointer(draft, path);
7010
+ const path2 = unescapePath(_path);
7011
+ let base2 = evaluatePointer(draft, path2);
6600
7012
  if (typeof base2 === "string") {
6601
- const parentPath = path.slice(0, -1);
7013
+ const parentPath = path2.slice(0, -1);
6602
7014
  const parent = evaluatePointer(draft, parentPath);
6603
- const key2 = path[path.length - 2];
7015
+ const key2 = path2[path2.length - 2];
6604
7016
  if (key2 === void 0) {
6605
7017
  return;
6606
7018
  }
@@ -6609,7 +7021,7 @@ function apply(state, patches, applyOptions) {
6609
7021
  }
6610
7022
  const type = getType(base2);
6611
7023
  const value = deepClone(patch.value);
6612
- const key = path[path.length - 1];
7024
+ const key = path2[path2.length - 1];
6613
7025
  switch (op) {
6614
7026
  case Operation.Move: {
6615
7027
  const fromPath = unescapePath(_fromPath);
@@ -6620,7 +7032,7 @@ function apply(state, patches, applyOptions) {
6620
7032
  return;
6621
7033
  }
6622
7034
  const fromValue = deepClone(fromBase[fromKey]);
6623
- if (path.length === 0) {
7035
+ if (path2.length === 0) {
6624
7036
  return;
6625
7037
  }
6626
7038
  if (fromBase === base2 && fromType === 1 && type === 1) {
@@ -6910,19 +7322,19 @@ var HistoryEntries;
6910
7322
  if (a.length !== b.length) {
6911
7323
  return false;
6912
7324
  }
6913
- return a.every((path, index) => {
7325
+ return a.every((path2, index) => {
6914
7326
  const other = b[index];
6915
- if (typeof path === "object" && "id" in path && typeof other === "object" && "id" in other) {
6916
- return path.id === other.id;
7327
+ if (typeof path2 === "object" && "id" in path2 && typeof other === "object" && "id" in other) {
7328
+ return path2.id === other.id;
6917
7329
  }
6918
- return path === other;
7330
+ return path2 === other;
6919
7331
  });
6920
7332
  }
6921
7333
  HistoryEntries2.pathsEqual = pathsEqual;
6922
7334
  })(HistoryEntries || (HistoryEntries = {}));
6923
7335
 
6924
7336
  // ../state-manager/src/IOManager.ts
6925
- import { Observable as Observable5 } from "@noya-app/observable";
7337
+ import { Observable as Observable6 } from "@noya-app/observable";
6926
7338
 
6927
7339
  // ../state-manager/src/jwt.ts
6928
7340
  function base64UrlEncode(str) {
@@ -7024,12 +7436,12 @@ var jwt;
7024
7436
  })(jwt || (jwt = {}));
7025
7437
 
7026
7438
  // ../state-manager/src/MenuManager.ts
7027
- import { Observable as Observable6 } from "@noya-app/observable";
7439
+ import { Observable as Observable7 } from "@noya-app/observable";
7028
7440
 
7029
7441
  // ../state-manager/src/multiplayer.ts
7030
- import { uuid as uuid3 } from "@noya-app/noya-utils";
7442
+ import { Cache, hash, uuid as uuid3 } from "@noya-app/noya-utils";
7031
7443
  import {
7032
- Observable as Observable7,
7444
+ Observable as Observable8,
7033
7445
  get as get2,
7034
7446
  mutate
7035
7447
  } from "@noya-app/observable";
@@ -7038,11 +7450,11 @@ import {
7038
7450
  import { get as getPath2 } from "@noya-app/observable";
7039
7451
 
7040
7452
  // ../state-manager/src/multiplayer.ts
7041
- var createHash = Hash;
7453
+ var createHash = hash;
7042
7454
 
7043
7455
  // ../state-manager/src/NoyaManager.ts
7044
- import { uuid as uuid6 } from "@noya-app/noya-utils";
7045
- import { Observable as Observable13, set as set2 } from "@noya-app/observable";
7456
+ import { uuid as uuid7 } from "@noya-app/noya-utils";
7457
+ import { Observable as Observable15, set as set2 } from "@noya-app/observable";
7046
7458
 
7047
7459
  // ../noya-pipeline/src/graphToTasks.ts
7048
7460
  import { get as get3 } from "@noya-app/observable";
@@ -7147,20 +7559,24 @@ var pipelineSchema = Type.Object(
7147
7559
  );
7148
7560
 
7149
7561
  // ../state-manager/src/PipelineManager.ts
7150
- import { Observable as Observable8 } from "@noya-app/observable";
7562
+ import { Observable as Observable9 } from "@noya-app/observable";
7151
7563
 
7152
7564
  // ../state-manager/src/PublishingManager.ts
7153
- import { Observable as Observable9 } from "@noya-app/observable";
7565
+ import { Observable as Observable10 } from "@noya-app/observable";
7566
+
7567
+ // ../state-manager/src/ResourceManager.ts
7568
+ import { isDeepEqual as isDeepEqual2, uuid as uuid5 } from "@noya-app/noya-utils";
7569
+ import { Observable as Observable11 } from "@noya-app/observable";
7154
7570
 
7155
7571
  // ../state-manager/src/rpcManager.ts
7156
- import { uuid as uuid5 } from "@noya-app/noya-utils";
7157
- import { Observable as Observable10 } from "@noya-app/observable";
7572
+ import { uuid as uuid6 } from "@noya-app/noya-utils";
7573
+ import { Observable as Observable12 } from "@noya-app/observable";
7158
7574
 
7159
7575
  // ../state-manager/src/SecretManager.ts
7160
- import { Observable as Observable11 } from "@noya-app/observable";
7576
+ import { Observable as Observable13 } from "@noya-app/observable";
7161
7577
 
7162
7578
  // ../state-manager/src/TaskManager.ts
7163
- import { Observable as Observable12 } from "@noya-app/observable";
7579
+ import { Observable as Observable14 } from "@noya-app/observable";
7164
7580
 
7165
7581
  // ../state-manager/src/NoyaManager.ts
7166
7582
  var createMutatorParametersSchema = Type.Object({
@@ -7277,8 +7693,8 @@ for (code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code];
7277
7693
  var code;
7278
7694
 
7279
7695
  // ../state-manager/src/menuTree.ts
7280
- var import_tree_visit2 = __toESM(require_lib());
7281
- var MenuItemTree = (0, import_tree_visit2.defineTree)((node) => {
7696
+ var import_tree_visit3 = __toESM(require_lib());
7697
+ var MenuItemTree = (0, import_tree_visit3.defineTree)((node) => {
7282
7698
  return node.type === "submenu" ? node.items : [];
7283
7699
  });
7284
7700
 
@@ -7287,7 +7703,7 @@ import { useEffect as useEffect16 } from "react";
7287
7703
 
7288
7704
  // ../noya-multiplayer-react/src/NoyaStateContext.tsx
7289
7705
  import {
7290
- Observable as Observable14
7706
+ Observable as Observable16
7291
7707
  } from "@noya-app/observable";
7292
7708
 
7293
7709
  // ../noya-react-utils/src/components/AutoSizer.tsx
@@ -7470,12 +7886,23 @@ var FileDropTarget = memoGeneric(function FileDropTarget2({ children, onDropFile
7470
7886
  import { useCallback as useCallback4, useState as useState3 } from "react";
7471
7887
 
7472
7888
  // ../noya-react-utils/src/hooks/useDeepArray.ts
7473
- import { isDeepEqual as isDeepEqual2 } from "@noya-app/noya-utils";
7474
- import { useState as useState4 } from "react";
7889
+ import { isDeepEqual as isDeepEqual3 } from "@noya-app/noya-utils";
7890
+ import { useMemo as useMemo3, useState as useState4 } from "react";
7891
+ function useJsonMemo(value) {
7892
+ const stringified = useMemo3(
7893
+ () => value === void 0 ? void 0 : JSON.stringify(value),
7894
+ [value]
7895
+ );
7896
+ const parsed = useMemo3(
7897
+ () => stringified === void 0 ? void 0 : JSON.parse(stringified),
7898
+ [stringified]
7899
+ );
7900
+ return parsed;
7901
+ }
7475
7902
 
7476
7903
  // ../noya-react-utils/src/hooks/useDeepState.ts
7477
- import { isDeepEqual as isDeepEqual3 } from "@noya-app/noya-utils";
7478
- import { useCallback as useCallback5, useMemo as useMemo3, useState as useState5 } from "react";
7904
+ import { isDeepEqual as isDeepEqual4 } from "@noya-app/noya-utils";
7905
+ import { useCallback as useCallback5, useMemo as useMemo4, useState as useState5 } from "react";
7479
7906
 
7480
7907
  // ../noya-react-utils/src/hooks/useFetch.ts
7481
7908
  import { useEffect as useEffect4, useState as useState6 } from "react";
@@ -7496,13 +7923,13 @@ import { useRef as useRef7 } from "react";
7496
7923
  import { useCallback as useCallback7 } from "react";
7497
7924
 
7498
7925
  // ../noya-react-utils/src/hooks/useMutableState.ts
7499
- import { useCallback as useCallback8, useMemo as useMemo4, useState as useState7 } from "react";
7926
+ import { useCallback as useCallback8, useMemo as useMemo5, useState as useState7 } from "react";
7500
7927
 
7501
7928
  // ../noya-react-utils/src/hooks/usePersistentState.ts
7502
7929
  import {
7503
7930
  useCallback as useCallback9,
7504
7931
  useEffect as useEffect7,
7505
- useMemo as useMemo5,
7932
+ useMemo as useMemo6,
7506
7933
  useState as useState8
7507
7934
  } from "react";
7508
7935
 
@@ -7583,25 +8010,26 @@ function downloadBlob(...params) {
7583
8010
  }
7584
8011
 
7585
8012
  // ../noya-multiplayer-react/src/NoyaStateContext.tsx
7586
- import React30, {
8013
+ import React33, {
7587
8014
  createContext as createContext3,
7588
8015
  useCallback as useCallback14,
7589
8016
  useContext as useContext4,
7590
8017
  useEffect as useEffect15,
7591
- useMemo as useMemo10
8018
+ useMemo as useMemo11,
8019
+ useState as useState17
7592
8020
  } from "react";
7593
8021
 
7594
8022
  // ../noya-multiplayer-react/src/noyaApp.ts
7595
- import { useMemo as useMemo9, useState as useState15 } from "react";
8023
+ import { useMemo as useMemo10, useState as useState16 } from "react";
7596
8024
 
7597
8025
  // ../noya-multiplayer-react/src/hooks.ts
7598
8026
  import {
7599
8027
  createElement as createElement3,
7600
8028
  useCallback as useCallback13,
7601
8029
  useEffect as useEffect14,
7602
- useMemo as useMemo8,
8030
+ useMemo as useMemo9,
7603
8031
  useRef as useRef11,
7604
- useState as useState14,
8032
+ useState as useState15,
7605
8033
  useSyncExternalStore as useSyncExternalStore2
7606
8034
  } from "react";
7607
8035
  import { createRoot as createRoot2 } from "react-dom/client";
@@ -7681,11 +8109,12 @@ var ErrorOverlay = React6.memo(function ErrorOverlay2({
7681
8109
  });
7682
8110
 
7683
8111
  // ../noya-multiplayer-react/src/inspector/useStateInspector.tsx
7684
- import React29 from "react";
8112
+ import React31 from "react";
7685
8113
  import { createRoot } from "react-dom/client";
7686
8114
 
7687
8115
  // ../noya-multiplayer-react/src/inspector/StateInspector.tsx
7688
- import React28, {
8116
+ import { Base64 as Base642, uuid as uuid8 } from "@noya-app/noya-utils";
8117
+ import React30, {
7689
8118
  useCallback as useCallback12,
7690
8119
  useEffect as useEffect13,
7691
8120
  useLayoutEffect as useLayoutEffect4
@@ -7696,7 +8125,7 @@ import React9 from "react";
7696
8125
  import React32, { useContext as useContext2, useCallback as useCallback11, useLayoutEffect as useLayoutEffect3, useState as useState13, memo as memo22 } from "react";
7697
8126
  import { createContext as createContext2 } from "react";
7698
8127
  import React22, { Children, memo as memo4 } from "react";
7699
- import React7, { createContext as createContext22, useContext as useContext3, useMemo as useMemo6 } from "react";
8128
+ import React7, { createContext as createContext22, useContext as useContext3, useMemo as useMemo7 } from "react";
7700
8129
  import React72 from "react";
7701
8130
  import React42 from "react";
7702
8131
  import React62 from "react";
@@ -8120,7 +8549,7 @@ var useStyles = (baseStylesKey) => {
8120
8549
  };
8121
8550
  var themeAcceptor = (WrappedComponent) => {
8122
8551
  const ThemeAcceptor = ({ theme: theme3 = DEFAULT_THEME_NAME, ...restProps }) => {
8123
- const themeStyles = useMemo6(() => {
8552
+ const themeStyles = useMemo7(() => {
8124
8553
  switch (Object.prototype.toString.call(theme3)) {
8125
8554
  case "[object String]":
8126
8555
  return createTheme(themes_exports[theme3]);
@@ -8186,7 +8615,7 @@ var wildcardPathsFromLevel = (level) => {
8186
8615
  return Array.from({ length: level }, (_, i) => [DEFAULT_ROOT_PATH].concat(Array.from({ length: i }, () => "*")).join("."));
8187
8616
  };
8188
8617
  var getExpandedPaths = (data, dataIterator, expandPaths, expandLevel, prevExpandedPaths) => {
8189
- const wildcardPaths = [].concat(wildcardPathsFromLevel(expandLevel)).concat(expandPaths).filter((path) => typeof path === "string");
8618
+ const wildcardPaths = [].concat(wildcardPathsFromLevel(expandLevel)).concat(expandPaths).filter((path2) => typeof path2 === "string");
8190
8619
  const expandedPaths = [];
8191
8620
  wildcardPaths.forEach((wildcardPath) => {
8192
8621
  const keyPaths = wildcardPath.split(".");
@@ -8217,20 +8646,20 @@ var getExpandedPaths = (data, dataIterator, expandPaths, expandLevel, prevExpand
8217
8646
  };
8218
8647
  populatePaths(data, "", 0);
8219
8648
  });
8220
- return expandedPaths.reduce((obj, path) => {
8221
- obj[path] = true;
8649
+ return expandedPaths.reduce((obj, path2) => {
8650
+ obj[path2] = true;
8222
8651
  return obj;
8223
8652
  }, { ...prevExpandedPaths });
8224
8653
  };
8225
8654
  var ConnectedTreeNode = memo22((props) => {
8226
- const { data, dataIterator, path, depth, nodeRenderer } = props;
8655
+ const { data, dataIterator, path: path2, depth, nodeRenderer } = props;
8227
8656
  const [expandedPaths, setExpandedPaths] = useContext2(ExpandedPathsContext);
8228
8657
  const nodeHasChildNodes = hasChildNodes(data, dataIterator);
8229
- const expanded = !!expandedPaths[path];
8658
+ const expanded = !!expandedPaths[path2];
8230
8659
  const handleClick = useCallback11(() => nodeHasChildNodes && setExpandedPaths((prevExpandedPaths) => ({
8231
8660
  ...prevExpandedPaths,
8232
- [path]: !expanded
8233
- })), [nodeHasChildNodes, setExpandedPaths, path, expanded]);
8661
+ [path2]: !expanded
8662
+ })), [nodeHasChildNodes, setExpandedPaths, path2, expanded]);
8234
8663
  return /* @__PURE__ */ React32.createElement(TreeNode, {
8235
8664
  expanded,
8236
8665
  onClick: handleClick,
@@ -8243,7 +8672,7 @@ var ConnectedTreeNode = memo22((props) => {
8243
8672
  name,
8244
8673
  data: data2,
8245
8674
  depth: depth + 1,
8246
- path: `${path}.${name}`,
8675
+ path: `${path2}.${name}`,
8247
8676
  key: name,
8248
8677
  dataIterator,
8249
8678
  nodeRenderer,
@@ -8880,9 +9309,9 @@ var themedDOMInspector = themeAcceptor(DOMInspector);
8880
9309
  var import_is_dom = __toESM2(require_is_dom());
8881
9310
 
8882
9311
  // ../noya-multiplayer-react/src/useObservable.ts
8883
- import { useMemo as useMemo7, useSyncExternalStore } from "react";
9312
+ import { useMemo as useMemo8, useSyncExternalStore } from "react";
8884
9313
  function useObservable2(observable, pathOrSelector, options) {
8885
- const { get: get4, listen } = useMemo7(() => {
9314
+ const { get: get4, listen } = useMemo8(() => {
8886
9315
  if (!observable) {
8887
9316
  return {
8888
9317
  get: () => void 0,
@@ -8942,39 +9371,47 @@ var getStateInspectorBorderColor = (colorScheme) => {
8942
9371
  return colorScheme === "light" ? "rgb(223 223 223)" : "rgb(29 29 29)";
8943
9372
  };
8944
9373
 
8945
- // ../noya-multiplayer-react/src/inspector/sections/EventsSection.tsx
8946
- import React23 from "react";
9374
+ // ../noya-multiplayer-react/src/inspector/sections/ActivityEventsSection.tsx
9375
+ import React23, { useState as useState14 } from "react";
8947
9376
 
8948
- // ../noya-multiplayer-react/src/inspector/ObjectRootLabel.tsx
9377
+ // ../noya-multiplayer-react/src/inspector/StateInspectorButton.tsx
8949
9378
  import React18 from "react";
8950
- var ObjectRootLabel2 = ({ name, data, direction }) => {
8951
- if (typeof name === "string") {
8952
- return /* @__PURE__ */ React18.createElement("span", null, /* @__PURE__ */ React18.createElement(ObjectName, { name }), /* @__PURE__ */ React18.createElement("span", null, ": "), /* @__PURE__ */ React18.createElement(ObjectPreview, { data }));
8953
- }
8954
- if (direction === "up" || direction === "down") {
8955
- const arrow = direction === "up" ? "\u2191" : "\u2193";
8956
- return /* @__PURE__ */ React18.createElement("span", null, /* @__PURE__ */ React18.createElement(
8957
- "span",
8958
- {
8959
- style: {
8960
- background: direction === "up" ? "rgba(0,255,0,0.2)" : "rgba(255,0,0,0.2)",
8961
- // color: "white",
8962
- width: 12,
8963
- height: 12,
8964
- borderRadius: 2,
8965
- display: "inline-flex",
8966
- justifyContent: "center",
8967
- alignItems: "center",
8968
- marginRight: 4,
8969
- lineHeight: "12px"
8970
- }
9379
+ function StateInspectorButton({
9380
+ children,
9381
+ onClick,
9382
+ style: style2,
9383
+ theme: theme3,
9384
+ disabled
9385
+ }) {
9386
+ return /* @__PURE__ */ React18.createElement(
9387
+ "button",
9388
+ {
9389
+ type: "button",
9390
+ disabled,
9391
+ onClick: (event) => {
9392
+ event.stopPropagation();
9393
+ onClick();
8971
9394
  },
8972
- arrow
8973
- ), /* @__PURE__ */ React18.createElement(ObjectPreview, { data }));
8974
- } else {
8975
- return /* @__PURE__ */ React18.createElement(ObjectPreview, { data });
8976
- }
8977
- };
9395
+ style: {
9396
+ flex: "0",
9397
+ appearance: "none",
9398
+ background: "none",
9399
+ color: theme3.BASE_COLOR,
9400
+ opacity: disabled ? 0.25 : 1,
9401
+ border: "none",
9402
+ fontSize: "12px",
9403
+ whiteSpace: "nowrap",
9404
+ display: "inline-flex",
9405
+ alignItems: "center",
9406
+ justifyContent: "center",
9407
+ padding: "0",
9408
+ cursor: "pointer",
9409
+ ...style2
9410
+ }
9411
+ },
9412
+ children
9413
+ );
9414
+ }
8978
9415
 
8979
9416
  // ../noya-multiplayer-react/src/inspector/StateInspectorDisclosureSection.tsx
8980
9417
  import React20, {
@@ -9122,6 +9559,137 @@ function StateInspectorRow({
9122
9559
  );
9123
9560
  }
9124
9561
 
9562
+ // ../noya-multiplayer-react/src/inspector/sections/ActivityEventsSection.tsx
9563
+ function isResourceStreamFilter(streamFilter) {
9564
+ return typeof streamFilter === "object" && "resourceId" in streamFilter;
9565
+ }
9566
+ function isResourceActivityEvent(activityEvent) {
9567
+ return typeof activityEvent === "object" && activityEvent !== null && "type" in activityEvent && activityEvent.type === "resource" && "resourceId" in activityEvent && typeof activityEvent.resourceId === "string";
9568
+ }
9569
+ function ActivityEventsSection({
9570
+ showEvents,
9571
+ setShowEvents,
9572
+ colorScheme,
9573
+ activityEventsContainerRef,
9574
+ activityEventsManager
9575
+ }) {
9576
+ const [streamFilter, setStreamFilter] = useState14("all");
9577
+ const streamFilterType = isResourceStreamFilter(streamFilter) ? "resource" : "all";
9578
+ const theme3 = getStateInspectorTheme(colorScheme);
9579
+ const activityEvents = useActivityEventsForManager(
9580
+ showEvents ? streamFilter : void 0,
9581
+ activityEventsManager
9582
+ );
9583
+ return /* @__PURE__ */ React23.createElement(
9584
+ StateInspectorDisclosureSection,
9585
+ {
9586
+ open: showEvents,
9587
+ setOpen: setShowEvents,
9588
+ title: `Activity Events`,
9589
+ colorScheme
9590
+ },
9591
+ /* @__PURE__ */ React23.createElement(StateInspectorDisclosureRowInner, { ref: activityEventsContainerRef }, /* @__PURE__ */ React23.createElement("div", { style: { padding: "4px 12px", display: "flex", gap: "4px" } }, /* @__PURE__ */ React23.createElement(
9592
+ "select",
9593
+ {
9594
+ name: "streamFilterType",
9595
+ value: streamFilterType,
9596
+ style: { flex: "0 0 auto", height: "19px" },
9597
+ onChange: (e) => {
9598
+ const value = e.target.value;
9599
+ if (value === "all") {
9600
+ setStreamFilter("all");
9601
+ } else {
9602
+ setStreamFilter({ resourceId: "" });
9603
+ }
9604
+ }
9605
+ },
9606
+ /* @__PURE__ */ React23.createElement("option", { value: "all" }, "All"),
9607
+ /* @__PURE__ */ React23.createElement("option", { value: "resource" }, "Resource")
9608
+ ), isResourceStreamFilter(streamFilter) && /* @__PURE__ */ React23.createElement(
9609
+ "input",
9610
+ {
9611
+ name: "resourceId",
9612
+ type: "text",
9613
+ placeholder: "Resource ID",
9614
+ value: streamFilter.resourceId,
9615
+ style: {
9616
+ flex: "1 1 auto",
9617
+ height: "19px",
9618
+ padding: "0px 4px",
9619
+ boxSizing: "border-box"
9620
+ },
9621
+ onChange: (e) => setStreamFilter({ ...streamFilter, resourceId: e.target.value })
9622
+ }
9623
+ )), activityEvents?.map((activityEvent, index) => /* @__PURE__ */ React23.createElement(
9624
+ StateInspectorRow,
9625
+ {
9626
+ key: index,
9627
+ colorScheme,
9628
+ style: {
9629
+ padding: "0px 12px 1px"
9630
+ }
9631
+ },
9632
+ /* @__PURE__ */ React23.createElement(themedObjectInspector, { data: activityEvent, theme: theme3 }),
9633
+ streamFilterType === "all" && isResourceActivityEvent(activityEvent) && /* @__PURE__ */ React23.createElement(
9634
+ StateInspectorButton,
9635
+ {
9636
+ theme: theme3,
9637
+ onClick: () => {
9638
+ setStreamFilter({ resourceId: activityEvent.resourceId });
9639
+ }
9640
+ },
9641
+ "Watch this resource"
9642
+ )
9643
+ )), !activityEvents && /* @__PURE__ */ React23.createElement(
9644
+ "div",
9645
+ {
9646
+ style: {
9647
+ padding: "12px",
9648
+ fontSize: "12px",
9649
+ display: "flex",
9650
+ flexDirection: "column",
9651
+ gap: "4px"
9652
+ }
9653
+ },
9654
+ /* @__PURE__ */ React23.createElement("span", null, "No activity events")
9655
+ ))
9656
+ );
9657
+ }
9658
+
9659
+ // ../noya-multiplayer-react/src/inspector/sections/EventsSection.tsx
9660
+ import React25 from "react";
9661
+
9662
+ // ../noya-multiplayer-react/src/inspector/ObjectRootLabel.tsx
9663
+ import React24 from "react";
9664
+ var ObjectRootLabel2 = ({ name, data, direction }) => {
9665
+ if (typeof name === "string") {
9666
+ return /* @__PURE__ */ React24.createElement("span", null, /* @__PURE__ */ React24.createElement(ObjectName, { name }), /* @__PURE__ */ React24.createElement("span", null, ": "), /* @__PURE__ */ React24.createElement(ObjectPreview, { data }));
9667
+ }
9668
+ if (direction === "up" || direction === "down") {
9669
+ const arrow = direction === "up" ? "\u2191" : "\u2193";
9670
+ return /* @__PURE__ */ React24.createElement("span", null, /* @__PURE__ */ React24.createElement(
9671
+ "span",
9672
+ {
9673
+ style: {
9674
+ background: direction === "up" ? "rgba(0,255,0,0.2)" : "rgba(255,0,0,0.2)",
9675
+ // color: "white",
9676
+ width: 12,
9677
+ height: 12,
9678
+ borderRadius: 2,
9679
+ display: "inline-flex",
9680
+ justifyContent: "center",
9681
+ alignItems: "center",
9682
+ marginRight: 4,
9683
+ lineHeight: "12px"
9684
+ }
9685
+ },
9686
+ arrow
9687
+ ), /* @__PURE__ */ React24.createElement(ObjectPreview, { data }));
9688
+ } else {
9689
+ return /* @__PURE__ */ React24.createElement(ObjectPreview, { data });
9690
+ }
9691
+ };
9692
+
9125
9693
  // ../noya-multiplayer-react/src/inspector/sections/EventsSection.tsx
9126
9694
  function EventsSection({
9127
9695
  showEvents,
@@ -9131,7 +9699,7 @@ function EventsSection({
9131
9699
  connectionEvents
9132
9700
  }) {
9133
9701
  const theme3 = getStateInspectorTheme(colorScheme);
9134
- return /* @__PURE__ */ React23.createElement(
9702
+ return /* @__PURE__ */ React25.createElement(
9135
9703
  StateInspectorDisclosureSection,
9136
9704
  {
9137
9705
  open: showEvents,
@@ -9139,8 +9707,8 @@ function EventsSection({
9139
9707
  title: "Events",
9140
9708
  colorScheme
9141
9709
  },
9142
- /* @__PURE__ */ React23.createElement(StateInspectorDisclosureRowInner, { ref: eventsContainerRef }, connectionEvents?.map(
9143
- (event, index) => event.type === "stateChange" ? /* @__PURE__ */ React23.createElement(StateInspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ React23.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ React23.createElement(
9710
+ /* @__PURE__ */ React25.createElement(StateInspectorDisclosureRowInner, { ref: eventsContainerRef }, connectionEvents?.map(
9711
+ (event, index) => event.type === "stateChange" ? /* @__PURE__ */ React25.createElement(StateInspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ React25.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ React25.createElement(
9144
9712
  StateInspectorRow,
9145
9713
  {
9146
9714
  key: index,
@@ -9150,14 +9718,14 @@ function EventsSection({
9150
9718
  padding: "0px 12px 1px"
9151
9719
  }
9152
9720
  },
9153
- /* @__PURE__ */ React23.createElement(
9721
+ /* @__PURE__ */ React25.createElement(
9154
9722
  themedObjectInspector,
9155
9723
  {
9156
9724
  data: event.type === "error" ? event.error : event.message,
9157
9725
  theme: theme3,
9158
9726
  nodeRenderer: ({ depth, name, data, isNonenumerable }) => {
9159
9727
  const direction = event.type === "send" ? "up" : "down";
9160
- return depth === 0 ? /* @__PURE__ */ React23.createElement(ObjectRootLabel2, { direction, data }) : /* @__PURE__ */ React23.createElement(
9728
+ return depth === 0 ? /* @__PURE__ */ React25.createElement(ObjectRootLabel2, { direction, data }) : /* @__PURE__ */ React25.createElement(
9161
9729
  ObjectLabel,
9162
9730
  {
9163
9731
  direction,
@@ -9170,7 +9738,7 @@ function EventsSection({
9170
9738
  }
9171
9739
  )
9172
9740
  )
9173
- ), !connectionEvents && /* @__PURE__ */ React23.createElement(
9741
+ ), !connectionEvents && /* @__PURE__ */ React25.createElement(
9174
9742
  "div",
9175
9743
  {
9176
9744
  style: {
@@ -9181,52 +9749,13 @@ function EventsSection({
9181
9749
  gap: "4px"
9182
9750
  }
9183
9751
  },
9184
- /* @__PURE__ */ React23.createElement("span", null, "No recorded events")
9752
+ /* @__PURE__ */ React25.createElement("span", null, "No recorded events")
9185
9753
  ))
9186
9754
  );
9187
9755
  }
9188
9756
 
9189
9757
  // ../noya-multiplayer-react/src/inspector/sections/HistorySection.tsx
9190
- import React25, { useEffect as useEffect12, useRef as useRef10 } from "react";
9191
-
9192
- // ../noya-multiplayer-react/src/inspector/StateInspectorButton.tsx
9193
- import React24 from "react";
9194
- function StateInspectorButton({
9195
- children,
9196
- onClick,
9197
- style: style2,
9198
- theme: theme3,
9199
- disabled
9200
- }) {
9201
- return /* @__PURE__ */ React24.createElement(
9202
- "button",
9203
- {
9204
- type: "button",
9205
- disabled,
9206
- onClick: (event) => {
9207
- event.stopPropagation();
9208
- onClick();
9209
- },
9210
- style: {
9211
- flex: "0",
9212
- appearance: "none",
9213
- background: "none",
9214
- color: theme3.BASE_COLOR,
9215
- opacity: disabled ? 0.25 : 1,
9216
- border: "none",
9217
- fontSize: "12px",
9218
- whiteSpace: "nowrap",
9219
- display: "inline-flex",
9220
- alignItems: "center",
9221
- justifyContent: "center",
9222
- padding: "0",
9223
- cursor: "pointer",
9224
- ...style2
9225
- }
9226
- },
9227
- children
9228
- );
9229
- }
9758
+ import React26, { useEffect as useEffect12, useRef as useRef10 } from "react";
9230
9759
 
9231
9760
  // ../noya-multiplayer-react/src/inspector/utils.ts
9232
9761
  function pathToString(extendedPath) {
@@ -9259,7 +9788,7 @@ function uploadFile() {
9259
9788
  const reader = new FileReader();
9260
9789
  reader.onload = () => {
9261
9790
  const buffer = reader.result;
9262
- const blob = new Blob([buffer]);
9791
+ const blob = new File([buffer], file.name, { type: file.type });
9263
9792
  resolve(blob);
9264
9793
  };
9265
9794
  reader.onerror = () => {
@@ -9301,14 +9830,14 @@ function HistorySection({
9301
9830
  });
9302
9831
  }
9303
9832
  }, [historySnapshot.historyIndex]);
9304
- return /* @__PURE__ */ React25.createElement(
9833
+ return /* @__PURE__ */ React26.createElement(
9305
9834
  StateInspectorDisclosureSection,
9306
9835
  {
9307
9836
  open: showHistory,
9308
9837
  setOpen: setShowHistory,
9309
9838
  title: "History",
9310
9839
  colorScheme,
9311
- right: /* @__PURE__ */ React25.createElement(
9840
+ right: /* @__PURE__ */ React26.createElement(
9312
9841
  "span",
9313
9842
  {
9314
9843
  style: {
@@ -9316,7 +9845,7 @@ function HistorySection({
9316
9845
  gap: "4px"
9317
9846
  }
9318
9847
  },
9319
- /* @__PURE__ */ React25.createElement(
9848
+ /* @__PURE__ */ React26.createElement(
9320
9849
  StateInspectorButton,
9321
9850
  {
9322
9851
  disabled: !historySnapshot.canUndo,
@@ -9325,7 +9854,7 @@ function HistorySection({
9325
9854
  multiplayerStateManager.undo();
9326
9855
  }
9327
9856
  },
9328
- /* @__PURE__ */ React25.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React25.createElement(
9857
+ /* @__PURE__ */ React26.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React26.createElement(
9329
9858
  "svg",
9330
9859
  {
9331
9860
  xmlns: "http://www.w3.org/2000/svg",
@@ -9333,7 +9862,7 @@ function HistorySection({
9333
9862
  height: "1em",
9334
9863
  viewBox: "0 0 20 20"
9335
9864
  },
9336
- /* @__PURE__ */ React25.createElement(
9865
+ /* @__PURE__ */ React26.createElement(
9337
9866
  "path",
9338
9867
  {
9339
9868
  fill: "currentColor",
@@ -9342,7 +9871,7 @@ function HistorySection({
9342
9871
  )
9343
9872
  ))
9344
9873
  ),
9345
- /* @__PURE__ */ React25.createElement(
9874
+ /* @__PURE__ */ React26.createElement(
9346
9875
  StateInspectorButton,
9347
9876
  {
9348
9877
  disabled: !historySnapshot.canRedo,
@@ -9351,7 +9880,7 @@ function HistorySection({
9351
9880
  multiplayerStateManager.redo();
9352
9881
  }
9353
9882
  },
9354
- /* @__PURE__ */ React25.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React25.createElement(
9883
+ /* @__PURE__ */ React26.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React26.createElement(
9355
9884
  "svg",
9356
9885
  {
9357
9886
  xmlns: "http://www.w3.org/2000/svg",
@@ -9359,7 +9888,7 @@ function HistorySection({
9359
9888
  height: "1em",
9360
9889
  viewBox: "0 0 20 20"
9361
9890
  },
9362
- /* @__PURE__ */ React25.createElement(
9891
+ /* @__PURE__ */ React26.createElement(
9363
9892
  "path",
9364
9893
  {
9365
9894
  fill: "currentColor",
@@ -9370,7 +9899,7 @@ function HistorySection({
9370
9899
  )
9371
9900
  )
9372
9901
  },
9373
- /* @__PURE__ */ React25.createElement(StateInspectorDisclosureRowInner, { ref }, /* @__PURE__ */ React25.createElement(
9902
+ /* @__PURE__ */ React26.createElement(StateInspectorDisclosureRowInner, { ref }, /* @__PURE__ */ React26.createElement(
9374
9903
  "div",
9375
9904
  {
9376
9905
  id: `${HISTORY_ELEMENT_PREFIX}0`,
@@ -9384,7 +9913,7 @@ function HistorySection({
9384
9913
  background: historySnapshot.historyIndex === 0 ? "rgb(59 130 246 / 15%)" : void 0
9385
9914
  }
9386
9915
  },
9387
- /* @__PURE__ */ React25.createElement(
9916
+ /* @__PURE__ */ React26.createElement(
9388
9917
  "span",
9389
9918
  {
9390
9919
  style: {
@@ -9399,7 +9928,7 @@ function HistorySection({
9399
9928
  ), historySnapshot.history.map((entry, index) => {
9400
9929
  const metadata = entry.metadata;
9401
9930
  const { id, name, timestamp, ...rest } = metadata;
9402
- return /* @__PURE__ */ React25.createElement(
9931
+ return /* @__PURE__ */ React26.createElement(
9403
9932
  "div",
9404
9933
  {
9405
9934
  id: `${HISTORY_ELEMENT_PREFIX}${index + 1}`,
@@ -9410,7 +9939,7 @@ function HistorySection({
9410
9939
  background: index + 1 === historySnapshot.historyIndex ? "rgb(59 130 246 / 15%)" : void 0
9411
9940
  }
9412
9941
  },
9413
- typeof name === "string" && /* @__PURE__ */ React25.createElement(
9942
+ typeof name === "string" && /* @__PURE__ */ React26.createElement(
9414
9943
  "pre",
9415
9944
  {
9416
9945
  style: {
@@ -9421,9 +9950,9 @@ function HistorySection({
9421
9950
  }
9422
9951
  },
9423
9952
  entry.metadata.name,
9424
- Object.keys(rest).length > 0 && /* @__PURE__ */ React25.createElement(themedObjectInspector, { data: rest, theme: theme3 })
9953
+ Object.keys(rest).length > 0 && /* @__PURE__ */ React26.createElement(themedObjectInspector, { data: rest, theme: theme3 })
9425
9954
  ),
9426
- entry.redoPatches?.map((patch, j) => /* @__PURE__ */ React25.createElement(
9955
+ entry.redoPatches?.map((patch, j) => /* @__PURE__ */ React26.createElement(
9427
9956
  "pre",
9428
9957
  {
9429
9958
  key: j,
@@ -9434,10 +9963,10 @@ function HistorySection({
9434
9963
  margin: 0
9435
9964
  }
9436
9965
  },
9437
- patch.op === "add" && /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React25.createElement(themedObjectInspector, { data: patch.value, theme: theme3 })),
9438
- patch.op === "replace" && /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React25.createElement(themedObjectInspector, { data: patch.value, theme: theme3 })),
9439
- patch.op === "remove" && /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement("span", { style: { color: theme3.OBJECT_VALUE_STRING_COLOR } }, "delete", " "), /* @__PURE__ */ React25.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path))),
9440
- patch.op === "move" && /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.from)), " -> ", /* @__PURE__ */ React25.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)))
9966
+ patch.op === "add" && /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React26.createElement(themedObjectInspector, { data: patch.value, theme: theme3 })),
9967
+ patch.op === "replace" && /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React26.createElement(themedObjectInspector, { data: patch.value, theme: theme3 })),
9968
+ patch.op === "remove" && /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement("span", { style: { color: theme3.OBJECT_VALUE_STRING_COLOR } }, "delete", " "), /* @__PURE__ */ React26.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path))),
9969
+ patch.op === "move" && /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.from)), " -> ", /* @__PURE__ */ React26.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)))
9441
9970
  ))
9442
9971
  );
9443
9972
  }))
@@ -9990,8 +10519,16 @@ function replaceDeep(obj, replacementMap) {
9990
10519
  }
9991
10520
  }
9992
10521
 
10522
+ // ../noya-multiplayer-react/src/inspector/StateInspectorTitleLabel.tsx
10523
+ import React27 from "react";
10524
+ function StateInspectorTitleLabel({
10525
+ children
10526
+ }) {
10527
+ return /* @__PURE__ */ React27.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
10528
+ }
10529
+
9993
10530
  // ../noya-multiplayer-react/src/inspector/StateInspectorToggleButton.tsx
9994
- import React26 from "react";
10531
+ import React28 from "react";
9995
10532
  function StateInspectorToggleButton({
9996
10533
  showInspector,
9997
10534
  setShowInspector,
@@ -9999,7 +10536,7 @@ function StateInspectorToggleButton({
9999
10536
  anchor
10000
10537
  }) {
10001
10538
  const isRightAnchor = anchor === "right";
10002
- const rightIcon = /* @__PURE__ */ React26.createElement(
10539
+ const rightIcon = /* @__PURE__ */ React28.createElement(
10003
10540
  "svg",
10004
10541
  {
10005
10542
  xmlns: "http://www.w3.org/2000/svg",
@@ -10009,7 +10546,7 @@ function StateInspectorToggleButton({
10009
10546
  stroke: "currentColor",
10010
10547
  className: "size-6"
10011
10548
  },
10012
- /* @__PURE__ */ React26.createElement(
10549
+ /* @__PURE__ */ React28.createElement(
10013
10550
  "path",
10014
10551
  {
10015
10552
  strokeLinecap: "round",
@@ -10018,7 +10555,7 @@ function StateInspectorToggleButton({
10018
10555
  }
10019
10556
  )
10020
10557
  );
10021
- const leftIcon = /* @__PURE__ */ React26.createElement(
10558
+ const leftIcon = /* @__PURE__ */ React28.createElement(
10022
10559
  "svg",
10023
10560
  {
10024
10561
  xmlns: "http://www.w3.org/2000/svg",
@@ -10028,7 +10565,7 @@ function StateInspectorToggleButton({
10028
10565
  stroke: "currentColor",
10029
10566
  className: "size-6"
10030
10567
  },
10031
- /* @__PURE__ */ React26.createElement(
10568
+ /* @__PURE__ */ React28.createElement(
10032
10569
  "path",
10033
10570
  {
10034
10571
  strokeLinecap: "round",
@@ -10037,7 +10574,7 @@ function StateInspectorToggleButton({
10037
10574
  }
10038
10575
  )
10039
10576
  );
10040
- return /* @__PURE__ */ React26.createElement(
10577
+ return /* @__PURE__ */ React28.createElement(
10041
10578
  "span",
10042
10579
  {
10043
10580
  role: "button",
@@ -10058,15 +10595,15 @@ function StateInspectorToggleButton({
10058
10595
  setShowInspector(!showInspector);
10059
10596
  }
10060
10597
  },
10061
- showInspector ? "Hide Inspector" : /* @__PURE__ */ React26.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
10598
+ showInspector ? "Hide Inspector" : /* @__PURE__ */ React28.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
10062
10599
  );
10063
10600
  }
10064
10601
 
10065
10602
  // ../noya-multiplayer-react/src/inspector/useLocalStorageState.tsx
10066
- import React27 from "react";
10603
+ import React29 from "react";
10067
10604
  var localStorage2 = typeof window !== "undefined" ? window.localStorage : null;
10068
10605
  function useLocalStorageState(key, defaultValue) {
10069
- const [state, setState] = React27.useState(() => {
10606
+ const [state, setState] = React29.useState(() => {
10070
10607
  const value = localStorage2?.getItem(key);
10071
10608
  let result = defaultValue;
10072
10609
  if (value) {
@@ -10101,16 +10638,19 @@ var StateInspector = memoGeneric(function StateInspector2({
10101
10638
  ephemeralUserDataManager,
10102
10639
  connectionEventManager,
10103
10640
  taskManager,
10104
- ioManager
10641
+ ioManager,
10642
+ resourceManager,
10643
+ activityEventsManager
10105
10644
  } = noyaManager;
10106
- const [didMount, setDidMount] = React28.useState(false);
10645
+ const [didMount, setDidMount] = React30.useState(false);
10107
10646
  const tasks = useObservable2(taskManager.tasks$);
10108
10647
  const inputs = useObservable2(ioManager.inputs$);
10109
10648
  const outputTransforms = useObservable2(ioManager.outputTransforms$);
10110
10649
  useLayoutEffect4(() => {
10111
10650
  setDidMount(true);
10112
10651
  }, []);
10113
- const eventsContainerRef = React28.useRef(null);
10652
+ const eventsContainerRef = React30.useRef(null);
10653
+ const activityEventsContainerRef = React30.useRef(null);
10114
10654
  const [showInspector, setShowInspector] = useLocalStorageState(
10115
10655
  "noya-multiplayer-react-show-inspector",
10116
10656
  true
@@ -10143,6 +10683,10 @@ var StateInspector = memoGeneric(function StateInspector2({
10143
10683
  "noya-multiplayer-react-show-assets",
10144
10684
  false
10145
10685
  );
10686
+ const [showResources, setShowResources] = useLocalStorageState(
10687
+ "noya-multiplayer-react-show-resources",
10688
+ false
10689
+ );
10146
10690
  const [showSecrets, setShowSecrets] = useLocalStorageState(
10147
10691
  "noya-multiplayer-react-show-secrets",
10148
10692
  false
@@ -10155,6 +10699,10 @@ var StateInspector = memoGeneric(function StateInspector2({
10155
10699
  "noya-multiplayer-react-show-output-transforms",
10156
10700
  false
10157
10701
  );
10702
+ const [showActivityEvents, setShowActivityEvents] = useLocalStorageState(
10703
+ "noya-multiplayer-react-show-activity-events",
10704
+ false
10705
+ );
10158
10706
  const connectionEvents = useObservable2(connectionEventManager.events$);
10159
10707
  useEffect13(() => {
10160
10708
  if (eventsContainerRef.current) {
@@ -10167,6 +10715,8 @@ var StateInspector = memoGeneric(function StateInspector2({
10167
10715
  const ephemeral = useObservable2(ephemeralUserDataManager.data$);
10168
10716
  const historySnapshot = useManagedHistory(multiplayerStateManager.sm);
10169
10717
  const assets = useObservable2(assetManager.assets$);
10718
+ const resources = useObservable2(resourceManager.resources$);
10719
+ const resourcesInitialized = useObservable2(resourceManager.isInitialized$);
10170
10720
  const assetsInitialized = useObservable2(assetManager.isInitialized$);
10171
10721
  const secrets = useObservable2(secretManager.secrets$);
10172
10722
  const secretsInitialized = useObservable2(secretManager.isInitialized$);
@@ -10215,7 +10765,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10215
10765
  }, [noyaManager]);
10216
10766
  if (!didMount) return null;
10217
10767
  if (!showInspector) {
10218
- return /* @__PURE__ */ React28.createElement(
10768
+ return /* @__PURE__ */ React30.createElement(
10219
10769
  "div",
10220
10770
  {
10221
10771
  ...props,
@@ -10227,7 +10777,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10227
10777
  },
10228
10778
  onClick: () => setShowInspector(true)
10229
10779
  },
10230
- /* @__PURE__ */ React28.createElement(
10780
+ /* @__PURE__ */ React30.createElement(
10231
10781
  StateInspectorToggleButton,
10232
10782
  {
10233
10783
  showInspector,
@@ -10238,7 +10788,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10238
10788
  )
10239
10789
  );
10240
10790
  }
10241
- return /* @__PURE__ */ React28.createElement(
10791
+ return /* @__PURE__ */ React30.createElement(
10242
10792
  "div",
10243
10793
  {
10244
10794
  ...props,
@@ -10247,7 +10797,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10247
10797
  ...props.style
10248
10798
  }
10249
10799
  },
10250
- /* @__PURE__ */ React28.createElement(
10800
+ /* @__PURE__ */ React30.createElement(
10251
10801
  StateInspectorDisclosureSection,
10252
10802
  {
10253
10803
  isFirst: true,
@@ -10259,7 +10809,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10259
10809
  flex: "0 0 auto",
10260
10810
  maxHeight: "200px"
10261
10811
  },
10262
- right: /* @__PURE__ */ React28.createElement(
10812
+ right: /* @__PURE__ */ React30.createElement(
10263
10813
  StateInspectorToggleButton,
10264
10814
  {
10265
10815
  showInspector,
@@ -10269,14 +10819,14 @@ var StateInspector = memoGeneric(function StateInspector2({
10269
10819
  }
10270
10820
  )
10271
10821
  },
10272
- /* @__PURE__ */ React28.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.map((user) => /* @__PURE__ */ React28.createElement(
10822
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.map((user) => /* @__PURE__ */ React30.createElement(
10273
10823
  StateInspectorRow,
10274
10824
  {
10275
10825
  key: user.id,
10276
10826
  colorScheme,
10277
10827
  variant: user.id === userId ? "up" : void 0
10278
10828
  },
10279
- user.image && /* @__PURE__ */ React28.createElement(
10829
+ user.image && /* @__PURE__ */ React30.createElement(
10280
10830
  "img",
10281
10831
  {
10282
10832
  src: user.image,
@@ -10297,7 +10847,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10297
10847
  " (",
10298
10848
  ellipsis(user.id.toString(), 8, "middle"),
10299
10849
  ")"
10300
- )), !connectedUsers && /* @__PURE__ */ React28.createElement(
10850
+ )), !connectedUsers && /* @__PURE__ */ React30.createElement(
10301
10851
  "div",
10302
10852
  {
10303
10853
  style: {
@@ -10308,13 +10858,13 @@ var StateInspector = memoGeneric(function StateInspector2({
10308
10858
  gap: "4px"
10309
10859
  }
10310
10860
  },
10311
- /* @__PURE__ */ React28.createElement("span", null, "No connected users")
10861
+ /* @__PURE__ */ React30.createElement("span", null, "No connected users")
10312
10862
  ))
10313
10863
  ),
10314
- /* @__PURE__ */ React28.createElement(
10864
+ /* @__PURE__ */ React30.createElement(
10315
10865
  StateInspectorDisclosureSection,
10316
10866
  {
10317
- title: /* @__PURE__ */ React28.createElement(TitleLabel, null, "Data", /* @__PURE__ */ React28.createElement(
10867
+ title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Data", /* @__PURE__ */ React30.createElement(
10318
10868
  ColoredDot,
10319
10869
  {
10320
10870
  type: multipeerStateInitialized ? "success" : "error"
@@ -10323,7 +10873,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10323
10873
  colorScheme,
10324
10874
  setOpen: setShowData,
10325
10875
  open: showData,
10326
- right: /* @__PURE__ */ React28.createElement(
10876
+ right: /* @__PURE__ */ React30.createElement(
10327
10877
  "span",
10328
10878
  {
10329
10879
  style: {
@@ -10331,9 +10881,9 @@ var StateInspector = memoGeneric(function StateInspector2({
10331
10881
  gap: "12px"
10332
10882
  }
10333
10883
  },
10334
- /* @__PURE__ */ React28.createElement(StateInspectorButton, { theme: theme3, onClick: handleImportAll }, "Import"),
10335
- /* @__PURE__ */ React28.createElement(StateInspectorButton, { theme: theme3, onClick: handleExportAll }, "Export"),
10336
- /* @__PURE__ */ React28.createElement(
10884
+ /* @__PURE__ */ React30.createElement(StateInspectorButton, { theme: theme3, onClick: handleImportAll }, "Import"),
10885
+ /* @__PURE__ */ React30.createElement(StateInspectorButton, { theme: theme3, onClick: handleExportAll }, "Export"),
10886
+ /* @__PURE__ */ React30.createElement(
10337
10887
  StateInspectorButton,
10338
10888
  {
10339
10889
  theme: theme3,
@@ -10345,14 +10895,14 @@ var StateInspector = memoGeneric(function StateInspector2({
10345
10895
  )
10346
10896
  )
10347
10897
  },
10348
- /* @__PURE__ */ React28.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React28.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React28.createElement(
10898
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React30.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React30.createElement(
10349
10899
  themedObjectInspector,
10350
10900
  {
10351
10901
  name: multiplayerStateManager.schema ? "state" : void 0,
10352
10902
  data: state,
10353
10903
  theme: theme3
10354
10904
  }
10355
- )), multiplayerStateManager.schema && /* @__PURE__ */ React28.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React28.createElement(
10905
+ )), multiplayerStateManager.schema && /* @__PURE__ */ React30.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React30.createElement(
10356
10906
  themedObjectInspector,
10357
10907
  {
10358
10908
  name: "schema",
@@ -10361,7 +10911,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10361
10911
  }
10362
10912
  )))
10363
10913
  ),
10364
- /* @__PURE__ */ React28.createElement(
10914
+ /* @__PURE__ */ React30.createElement(
10365
10915
  HistorySection,
10366
10916
  {
10367
10917
  showHistory,
@@ -10371,14 +10921,29 @@ var StateInspector = memoGeneric(function StateInspector2({
10371
10921
  multiplayerStateManager
10372
10922
  }
10373
10923
  ),
10374
- /* @__PURE__ */ React28.createElement(
10924
+ /* @__PURE__ */ React30.createElement(
10375
10925
  StateInspectorDisclosureSection,
10376
10926
  {
10377
10927
  open: showAssets,
10378
10928
  setOpen: setShowAssets,
10379
- title: /* @__PURE__ */ React28.createElement(TitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ React28.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
10929
+ title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ React30.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
10380
10930
  colorScheme,
10381
- right: /* @__PURE__ */ React28.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React28.createElement(
10931
+ right: /* @__PURE__ */ React30.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React30.createElement(
10932
+ StateInspectorButton,
10933
+ {
10934
+ theme: theme3,
10935
+ onClick: async () => {
10936
+ const ok = confirm(
10937
+ "Are you sure you want to delete all assets?"
10938
+ );
10939
+ if (!ok) return;
10940
+ await Promise.all(
10941
+ assets.map((asset) => assetManager.delete(asset.id))
10942
+ );
10943
+ }
10944
+ },
10945
+ "Delete all"
10946
+ ), /* @__PURE__ */ React30.createElement(
10382
10947
  StateInspectorButton,
10383
10948
  {
10384
10949
  theme: theme3,
@@ -10391,7 +10956,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10391
10956
  }
10392
10957
  },
10393
10958
  "Reload"
10394
- ), /* @__PURE__ */ React28.createElement(
10959
+ ), /* @__PURE__ */ React30.createElement(
10395
10960
  StateInspectorButton,
10396
10961
  {
10397
10962
  theme: theme3,
@@ -10415,7 +10980,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10415
10980
  "Upload"
10416
10981
  ))
10417
10982
  },
10418
- /* @__PURE__ */ React28.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React28.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React28.createElement(themedObjectInspector, { name: asset.id, data: asset, theme: theme3 }), /* @__PURE__ */ React28.createElement(
10983
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React30.createElement(themedObjectInspector, { name: asset.id, data: asset, theme: theme3 }), /* @__PURE__ */ React30.createElement(
10419
10984
  StateInspectorButton,
10420
10985
  {
10421
10986
  theme: theme3,
@@ -10424,14 +10989,98 @@ var StateInspector = memoGeneric(function StateInspector2({
10424
10989
  "Delete"
10425
10990
  ))))
10426
10991
  ),
10427
- /* @__PURE__ */ React28.createElement(
10992
+ /* @__PURE__ */ React30.createElement(
10428
10993
  StateInspectorDisclosureSection,
10429
10994
  {
10430
- title: /* @__PURE__ */ React28.createElement(TitleLabel, null, "Secrets", /* @__PURE__ */ React28.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
10995
+ title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Resources (", resources.length, ")", /* @__PURE__ */ React30.createElement(ColoredDot, { type: resourcesInitialized ? "success" : "error" })),
10996
+ colorScheme,
10997
+ open: showResources,
10998
+ setOpen: setShowResources,
10999
+ right: /* @__PURE__ */ React30.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React30.createElement(
11000
+ StateInspectorButton,
11001
+ {
11002
+ theme: theme3,
11003
+ onClick: async () => {
11004
+ const ok = confirm(
11005
+ "Are you sure you want to delete all resources?"
11006
+ );
11007
+ if (!ok) return;
11008
+ await Promise.all(
11009
+ resources.map(
11010
+ (resource) => resourceManager.deleteResource({ id: resource.id })
11011
+ )
11012
+ );
11013
+ }
11014
+ },
11015
+ "Delete all"
11016
+ ), /* @__PURE__ */ React30.createElement(
11017
+ StateInspectorButton,
11018
+ {
11019
+ theme: theme3,
11020
+ onClick: async () => {
11021
+ const path2 = prompt("Enter directory path") || uuid8();
11022
+ await resourceManager.createResource({
11023
+ type: "directory",
11024
+ path: path2
11025
+ });
11026
+ }
11027
+ },
11028
+ "Create Directory"
11029
+ ), /* @__PURE__ */ React30.createElement(
11030
+ StateInspectorButton,
11031
+ {
11032
+ theme: theme3,
11033
+ onClick: async () => {
11034
+ const file = await uploadFile();
11035
+ resourceManager.createResource({
11036
+ type: "asset",
11037
+ path: file.name || uuid8(),
11038
+ asset: {
11039
+ content: Base642.encode(await file.arrayBuffer()),
11040
+ contentType: file.type,
11041
+ encoding: "base64"
11042
+ }
11043
+ });
11044
+ }
11045
+ },
11046
+ "Create Asset"
11047
+ ))
11048
+ },
11049
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, resources?.map((resource) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: resource.id, colorScheme }, /* @__PURE__ */ React30.createElement(
11050
+ themedObjectInspector,
11051
+ {
11052
+ name: resource.path,
11053
+ data: resource,
11054
+ theme: theme3
11055
+ }
11056
+ ), /* @__PURE__ */ React30.createElement("div", { style: { display: "flex", gap: "4px" } }, /* @__PURE__ */ React30.createElement(
11057
+ StateInspectorButton,
11058
+ {
11059
+ theme: theme3,
11060
+ onClick: () => resourceManager.deleteResource({ id: resource.id })
11061
+ },
11062
+ "Delete"
11063
+ ), /* @__PURE__ */ React30.createElement(
11064
+ StateInspectorButton,
11065
+ {
11066
+ theme: theme3,
11067
+ onClick: () => {
11068
+ const path2 = prompt("Enter new path", resource.path);
11069
+ if (!path2) return;
11070
+ resourceManager.updateResource({ id: resource.id, path: path2 });
11071
+ }
11072
+ },
11073
+ "Rename"
11074
+ )))))
11075
+ ),
11076
+ /* @__PURE__ */ React30.createElement(
11077
+ StateInspectorDisclosureSection,
11078
+ {
11079
+ title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Secrets", /* @__PURE__ */ React30.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
10431
11080
  colorScheme,
10432
11081
  open: showSecrets,
10433
11082
  setOpen: setShowSecrets,
10434
- right: /* @__PURE__ */ React28.createElement(
11083
+ right: /* @__PURE__ */ React30.createElement(
10435
11084
  StateInspectorButton,
10436
11085
  {
10437
11086
  theme: theme3,
@@ -10446,7 +11095,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10446
11095
  "Create"
10447
11096
  )
10448
11097
  },
10449
- /* @__PURE__ */ React28.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ React28.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ React28.createElement(themedObjectInspector, { data: secret, theme: theme3 }), /* @__PURE__ */ React28.createElement(
11098
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ React30.createElement(themedObjectInspector, { data: secret, theme: theme3 }), /* @__PURE__ */ React30.createElement(
10450
11099
  StateInspectorButton,
10451
11100
  {
10452
11101
  theme: theme3,
@@ -10456,15 +11105,15 @@ var StateInspector = memoGeneric(function StateInspector2({
10456
11105
  ))))
10457
11106
  ),
10458
11107
  " ",
10459
- /* @__PURE__ */ React28.createElement(
11108
+ /* @__PURE__ */ React30.createElement(
10460
11109
  StateInspectorDisclosureSection,
10461
11110
  {
10462
11111
  open: showInputs,
10463
11112
  setOpen: setShowInputs,
10464
- title: /* @__PURE__ */ React28.createElement(TitleLabel, null, "Inputs", /* @__PURE__ */ React28.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
11113
+ title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Inputs", /* @__PURE__ */ React30.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
10465
11114
  colorScheme
10466
11115
  },
10467
- /* @__PURE__ */ React28.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ React28.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React28.createElement(themedObjectInspector, { data: input, theme: theme3 }))), !inputs?.length && /* @__PURE__ */ React28.createElement(
11116
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React30.createElement(themedObjectInspector, { data: input, theme: theme3 }))), !inputs?.length && /* @__PURE__ */ React30.createElement(
10468
11117
  "div",
10469
11118
  {
10470
11119
  style: {
@@ -10475,15 +11124,15 @@ var StateInspector = memoGeneric(function StateInspector2({
10475
11124
  gap: "4px"
10476
11125
  }
10477
11126
  },
10478
- /* @__PURE__ */ React28.createElement("span", null, "No inputs")
11127
+ /* @__PURE__ */ React30.createElement("span", null, "No inputs")
10479
11128
  ))
10480
11129
  ),
10481
- /* @__PURE__ */ React28.createElement(
11130
+ /* @__PURE__ */ React30.createElement(
10482
11131
  StateInspectorDisclosureSection,
10483
11132
  {
10484
11133
  open: showOutputTransforms,
10485
11134
  setOpen: setShowOutputTransforms,
10486
- title: /* @__PURE__ */ React28.createElement(TitleLabel, null, "Output Transforms", /* @__PURE__ */ React28.createElement(
11135
+ title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Output Transforms", /* @__PURE__ */ React30.createElement(
10487
11136
  ColoredDot,
10488
11137
  {
10489
11138
  type: outputTransformsInitialized ? "success" : "error"
@@ -10491,7 +11140,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10491
11140
  )),
10492
11141
  colorScheme
10493
11142
  },
10494
- /* @__PURE__ */ React28.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ React28.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React28.createElement(themedObjectInspector, { data: transform, theme: theme3 }))), !outputTransforms?.length && /* @__PURE__ */ React28.createElement(
11143
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React30.createElement(themedObjectInspector, { data: transform, theme: theme3 }))), !outputTransforms?.length && /* @__PURE__ */ React30.createElement(
10495
11144
  "div",
10496
11145
  {
10497
11146
  style: {
@@ -10502,10 +11151,10 @@ var StateInspector = memoGeneric(function StateInspector2({
10502
11151
  gap: "4px"
10503
11152
  }
10504
11153
  },
10505
- /* @__PURE__ */ React28.createElement("span", null, "No output transforms")
11154
+ /* @__PURE__ */ React30.createElement("span", null, "No output transforms")
10506
11155
  ))
10507
11156
  ),
10508
- /* @__PURE__ */ React28.createElement(
11157
+ /* @__PURE__ */ React30.createElement(
10509
11158
  StateInspectorDisclosureSection,
10510
11159
  {
10511
11160
  title: "Tasks",
@@ -10513,7 +11162,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10513
11162
  open: showTasks,
10514
11163
  setOpen: setShowTasks
10515
11164
  },
10516
- /* @__PURE__ */ React28.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ React28.createElement(
11165
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ React30.createElement(
10517
11166
  StateInspectorRow,
10518
11167
  {
10519
11168
  key: task.id,
@@ -10522,7 +11171,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10522
11171
  backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
10523
11172
  }
10524
11173
  },
10525
- /* @__PURE__ */ React28.createElement(
11174
+ /* @__PURE__ */ React30.createElement(
10526
11175
  themedObjectInspector,
10527
11176
  {
10528
11177
  name: task.name,
@@ -10532,7 +11181,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10532
11181
  )
10533
11182
  )))
10534
11183
  ),
10535
- /* @__PURE__ */ React28.createElement(
11184
+ /* @__PURE__ */ React30.createElement(
10536
11185
  StateInspectorDisclosureSection,
10537
11186
  {
10538
11187
  open: showEphemeral,
@@ -10540,7 +11189,7 @@ var StateInspector = memoGeneric(function StateInspector2({
10540
11189
  title: "Ephemeral User Data",
10541
11190
  colorScheme
10542
11191
  },
10543
- /* @__PURE__ */ React28.createElement(StateInspectorDisclosureRowInner, null, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ React28.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ React28.createElement(
11192
+ /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ React30.createElement(
10544
11193
  themedObjectInspector,
10545
11194
  {
10546
11195
  name: key,
@@ -10550,7 +11199,17 @@ var StateInspector = memoGeneric(function StateInspector2({
10550
11199
  }
10551
11200
  ))))
10552
11201
  ),
10553
- /* @__PURE__ */ React28.createElement(
11202
+ /* @__PURE__ */ React30.createElement(
11203
+ ActivityEventsSection,
11204
+ {
11205
+ colorScheme,
11206
+ activityEventsContainerRef,
11207
+ showEvents: showActivityEvents,
11208
+ setShowEvents: setShowActivityEvents,
11209
+ activityEventsManager
11210
+ }
11211
+ ),
11212
+ /* @__PURE__ */ React30.createElement(
10554
11213
  EventsSection,
10555
11214
  {
10556
11215
  connectionEvents,
@@ -10562,9 +11221,6 @@ var StateInspector = memoGeneric(function StateInspector2({
10562
11221
  )
10563
11222
  );
10564
11223
  });
10565
- function TitleLabel({ children }) {
10566
- return /* @__PURE__ */ React28.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
10567
- }
10568
11224
 
10569
11225
  // ../noya-multiplayer-react/src/hooks.ts
10570
11226
  function useManagedHistory(stateManager) {
@@ -10579,10 +11235,26 @@ function useManagedHistory(stateManager) {
10579
11235
  var AnyNoyaStateContext = createContext3(void 0);
10580
11236
  var ConnectedUsersContext = createContext3(void 0);
10581
11237
  var AnyEphemeralUserDataManagerContext = createContext3(void 0);
11238
+ var emptyArray = [];
11239
+ function useActivityEventsForManager(streamFilter, activityEventsManager) {
11240
+ const [streamId, setStreamId] = useState17(void 0);
11241
+ const stableStreamFilter = useJsonMemo(streamFilter);
11242
+ useEffect15(() => {
11243
+ if (!stableStreamFilter) return;
11244
+ const streamId2 = activityEventsManager.subscribe(stableStreamFilter);
11245
+ setStreamId(streamId2);
11246
+ return () => {
11247
+ setStreamId(void 0);
11248
+ activityEventsManager.unsubscribe(streamId2);
11249
+ };
11250
+ }, [activityEventsManager, stableStreamFilter]);
11251
+ const observable = streamId ? activityEventsManager.getStream(streamId) : void 0;
11252
+ return useObservable2(observable) ?? emptyArray;
11253
+ }
10582
11254
 
10583
11255
  // ../noya-multiplayer-react/src/components/UserPointersOverlay.tsx
10584
- import { Observable as Observable15 } from "@noya-app/observable";
10585
- import React31, { useEffect as useEffect17, useMemo as useMemo11, useState as useState16 } from "react";
11256
+ import { Observable as Observable17 } from "@noya-app/observable";
11257
+ import React34, { useEffect as useEffect17, useMemo as useMemo12, useState as useState18 } from "react";
10586
11258
  function shouldShow(hideAfter, updatedAt) {
10587
11259
  return !!updatedAt && Date.now() - updatedAt < hideAfter;
10588
11260
  }
@@ -10592,15 +11264,15 @@ var UserPointerInternal = memoGeneric(function UserPointerInternal2({
10592
11264
  hideAfter = 5e3,
10593
11265
  renderUserPointer
10594
11266
  }) {
10595
- const observable = useMemo11(() => {
11267
+ const observable = useMemo12(() => {
10596
11268
  const metadata$ = ephemeralUserDataManager.metadata$.observePath([user.id]).throttle(50);
10597
11269
  const data$ = ephemeralUserDataManager.data$.observePath([user.id]).throttle(50);
10598
- return Observable15.combine([metadata$, data$], ([metadata2, data2]) => {
11270
+ return Observable17.combine([metadata$, data$], ([metadata2, data2]) => {
10599
11271
  return { metadata: metadata2, data: data2 };
10600
11272
  });
10601
11273
  }, [ephemeralUserDataManager, user.id]);
10602
11274
  const { metadata, data } = useObservable2(observable);
10603
- const [, setForceUpdate] = useState16(0);
11275
+ const [, setForceUpdate] = useState18(0);
10604
11276
  const updatedAt = metadata?.updatedAt ?? 0;
10605
11277
  const show = shouldShow(hideAfter, updatedAt);
10606
11278
  useEffect17(() => {
@@ -10625,9 +11297,9 @@ var UserPointersOverlay = memoGeneric(function UserPointers({
10625
11297
  }) {
10626
11298
  const currentUserId = useObservable2(ephemeralUserDataManager.currentUserId$);
10627
11299
  const connectedUsers = useObservable2(connectedUsersManager.connectedUsers$);
10628
- return /* @__PURE__ */ React31.createElement(React31.Fragment, null, connectedUsers.map((user) => {
11300
+ return /* @__PURE__ */ React34.createElement(React34.Fragment, null, connectedUsers.map((user) => {
10629
11301
  if (user.id === currentUserId) return null;
10630
- return /* @__PURE__ */ React31.createElement(
11302
+ return /* @__PURE__ */ React34.createElement(
10631
11303
  UserPointerInternal,
10632
11304
  {
10633
11305
  key: user.id,
@@ -10640,39 +11312,58 @@ var UserPointersOverlay = memoGeneric(function UserPointers({
10640
11312
  });
10641
11313
 
10642
11314
  // src/react/tableHooks.ts
10643
- import { useMemo as useMemo12 } from "react";
10644
- function useFileListTable({ where, select }, options) {
10645
- const client = useNoyaClientOrFallback();
10646
- const stableSelect = useMemo12(() => {
11315
+ import {
11316
+ RefetchableObservable
11317
+ } from "@noya-app/observable-store";
11318
+ import { useEffect as useEffect18, useMemo as useMemo13 } from "react";
11319
+ function useTable(table, {
11320
+ where,
11321
+ select
11322
+ }, options = {}) {
11323
+ const stableSelect = useMemo13(() => {
10647
11324
  return JSON.stringify(select);
10648
11325
  }, [select]);
10649
- const observable = useMemo12(() => {
10650
- if (where?.id === null) {
11326
+ const stableWhere = useMemo13(() => {
11327
+ let cloneWithNoUndefined = {};
11328
+ for (const [key, value] of Object.entries(where ?? {})) {
11329
+ if (value !== void 0) {
11330
+ cloneWithNoUndefined[key] = value;
11331
+ }
11332
+ }
11333
+ return JSON.stringify(cloneWithNoUndefined);
11334
+ }, [where]);
11335
+ const observable = useMemo13(() => {
11336
+ const parsedSelect = JSON.parse(stableSelect);
11337
+ const parsedWhere = JSON.parse(stableWhere);
11338
+ if (!table) {
11339
+ return new RefetchableObservable({
11340
+ status: "idle",
11341
+ data: []
11342
+ });
11343
+ }
11344
+ if (parsedWhere?.id === null) {
10651
11345
  return new RefetchableObservable({
10652
11346
  status: "success",
10653
11347
  data: []
10654
11348
  });
10655
11349
  }
10656
- const parsedSelect = JSON.parse(stableSelect);
10657
- return client.fileList$.query(
11350
+ return table.query(
10658
11351
  {
10659
- $where: { id: where?.id },
11352
+ $where: parsedWhere,
10660
11353
  $select: parsedSelect
10661
11354
  },
10662
11355
  {
10663
11356
  policy: options.policy,
10664
- debug: options.debug
11357
+ debug: options.debug,
11358
+ autoStart: false
10665
11359
  }
10666
11360
  );
10667
- }, [
10668
- client.fileList$,
10669
- options.policy,
10670
- stableSelect,
10671
- where?.id,
10672
- options.debug
10673
- ]);
11361
+ }, [stableSelect, stableWhere, table, options.policy, options.debug]);
11362
+ useEffect18(() => {
11363
+ observable.start?.();
11364
+ }, [observable]);
10674
11365
  const { status, data } = useObservable2(observable);
10675
- return useMemo12(() => {
11366
+ return useMemo13(() => {
10676
11367
  return {
10677
11368
  status,
10678
11369
  data,
@@ -10681,14 +11372,17 @@ function useFileListTable({ where, select }, options) {
10681
11372
  }, [status, data, observable]);
10682
11373
  }
10683
11374
  function useFileList(select, options = {}) {
10684
- return useFileListTable({ select }, options);
11375
+ const client = useNoyaClientOrFallback();
11376
+ return useTable(client.fileList$, { select }, options);
10685
11377
  }
10686
11378
  function useFileListItem(id, select, options = {}) {
10687
- const { status, data, refetch } = useFileListTable(
11379
+ const client = useNoyaClientOrFallback();
11380
+ const { status, data, refetch } = useTable(
11381
+ client.fileList$,
10688
11382
  { where: { id: id ?? null }, select },
10689
11383
  options
10690
11384
  );
10691
- return useMemo12(() => {
11385
+ return useMemo13(() => {
10692
11386
  return {
10693
11387
  data: data.at(0),
10694
11388
  status,
@@ -10696,8 +11390,40 @@ function useFileListItem(id, select, options = {}) {
10696
11390
  };
10697
11391
  }, [data, status, refetch]);
10698
11392
  }
11393
+ function useResourcesList(fileId, select, options = {}) {
11394
+ const client = useNoyaClientOrFallback();
11395
+ return useTable(
11396
+ client.resources$,
11397
+ { select, where: { accessibleByFileId: fileId } },
11398
+ options
11399
+ );
11400
+ }
11401
+ function useUser(id, select, options = {}) {
11402
+ const client = useNoyaClientOrFallback();
11403
+ const { status, data, refetch } = useTable(
11404
+ client.users$,
11405
+ { select, where: { id: id ?? null } },
11406
+ options
11407
+ );
11408
+ return useMemo13(() => {
11409
+ return {
11410
+ status,
11411
+ data: data.at(0),
11412
+ refetch
11413
+ };
11414
+ }, [status, data, refetch]);
11415
+ }
11416
+ function useActivityEventsList(fileId, select, options = {}) {
11417
+ const client = useNoyaClientOrFallback();
11418
+ return useTable(
11419
+ client.activityEvents$,
11420
+ { select, where: { fileId } },
11421
+ options
11422
+ );
11423
+ }
10699
11424
  export {
10700
11425
  NoyaAPIProvider,
11426
+ useActivityEventsList,
10701
11427
  useFileList,
10702
11428
  useFileListItem,
10703
11429
  useGeneratedComponentDescription,
@@ -10709,6 +11435,7 @@ export {
10709
11435
  useMetadata,
10710
11436
  useNetworkRequests,
10711
11437
  useNoyaAssets,
11438
+ useNoyaAssetsByFileVersionId,
10712
11439
  useNoyaBilling,
10713
11440
  useNoyaClient,
10714
11441
  useNoyaClientOrFallback,
@@ -10736,6 +11463,9 @@ export {
10736
11463
  useOptionalNoyaTools,
10737
11464
  useOptionalNoyaUserData,
10738
11465
  useRandomIcons,
10739
- useRandomImages
11466
+ useRandomImages,
11467
+ useResourcesList,
11468
+ useTable,
11469
+ useUser
10740
11470
  };
10741
11471
  //# sourceMappingURL=index.mjs.map