@powerhousedao/powerhouse-vetra-packages 6.0.0-dev.245 → 6.0.0-dev.247

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.
Files changed (79) hide show
  1. package/dist/browser/{connect-CjUKHHSu.js → connect-BBmOHcv9.js} +559 -253
  2. package/dist/browser/connect-BBmOHcv9.js.map +1 -0
  3. package/dist/browser/{dist-OuHji4IC.js → dist-D6RK9blQ.js} +185 -52
  4. package/dist/browser/dist-D6RK9blQ.js.map +1 -0
  5. package/dist/browser/{document-drive-BvzpH_WW.js → document-drive-DEBfpfNH.js} +2 -2
  6. package/dist/browser/{document-drive-BvzpH_WW.js.map → document-drive-DEBfpfNH.js.map} +1 -1
  7. package/dist/browser/document-models/index.js +1 -1
  8. package/dist/browser/{editor-BjgxfbFQ.js → editor-CAfdIxjq.js} +5 -5
  9. package/dist/browser/{editor-BjgxfbFQ.js.map → editor-CAfdIxjq.js.map} +1 -1
  10. package/dist/browser/{editor-ZyaCpF76.js → editor-DWQZuQFs.js} +8 -8
  11. package/dist/browser/{editor-ZyaCpF76.js.map → editor-DWQZuQFs.js.map} +1 -1
  12. package/dist/browser/editors/document-model-editor/module.js +1 -1
  13. package/dist/browser/editors/generic-drive-explorer/index.js +4 -4
  14. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  15. package/dist/browser/{folder-view--KiWW1Rl.js → folder-view-_D5EfVX-.js} +3 -3
  16. package/dist/browser/{folder-view--KiWW1Rl.js.map → folder-view-_D5EfVX-.js.map} +1 -1
  17. package/dist/browser/{graphql-editor-DHW3IM4Q.js → graphql-editor-DGonMtdY.js} +3 -3
  18. package/dist/browser/{graphql-editor-DHW3IM4Q.js.map → graphql-editor-DGonMtdY.js.map} +1 -1
  19. package/dist/browser/{hooks-DoEQ3wS2.js → hooks-BhAKGucv.js} +1 -1
  20. package/dist/browser/{hooks-DoEQ3wS2.js.map → hooks-BhAKGucv.js.map} +1 -1
  21. package/dist/browser/index.js +1 -1
  22. package/dist/browser/{json-editor-C_qVI2VR.js → json-editor-Bg0Y1CcR.js} +2 -2
  23. package/dist/browser/{json-editor-C_qVI2VR.js.map → json-editor-Bg0Y1CcR.js.map} +1 -1
  24. package/dist/browser/{jszip.min-DnuABTaX.js → jszip.min-BrpaM270.js} +1 -1
  25. package/dist/browser/{jszip.min-DnuABTaX.js.map → jszip.min-BrpaM270.js.map} +1 -1
  26. package/dist/browser/{schema-context-Cif2-trz.js → schema-context-CvXvtE6d.js} +1 -1
  27. package/dist/browser/{schema-context-Cif2-trz.js.map → schema-context-CvXvtE6d.js.map} +1 -1
  28. package/dist/browser/{state-schemas-BMIVUBp7.js → state-schemas-j0_hOhb7.js} +6 -7
  29. package/dist/browser/{state-schemas-BMIVUBp7.js.map → state-schemas-j0_hOhb7.js.map} +1 -1
  30. package/dist/browser/{style-X7kuUXNl.js → style-vUczxl_1.js} +3 -3
  31. package/dist/browser/{style-X7kuUXNl.js.map → style-vUczxl_1.js.map} +1 -1
  32. package/dist/node/{connect-lHzmga1Q.mjs → connect-DtuqP_fM.mjs} +559 -253
  33. package/dist/node/connect-DtuqP_fM.mjs.map +1 -0
  34. package/dist/node/{dist-DnalgmqP.mjs → dist-CnaLK76g.mjs} +185 -52
  35. package/dist/node/dist-CnaLK76g.mjs.map +1 -0
  36. package/dist/node/{document-drive-Crv2Nulm.mjs → document-drive-OX6sXnh6.mjs} +2 -2
  37. package/dist/node/{document-drive-Crv2Nulm.mjs.map → document-drive-OX6sXnh6.mjs.map} +1 -1
  38. package/dist/node/document-models/index.mjs +1 -1
  39. package/dist/node/{documents-DqbIqAWu.mjs → documents-q4x0P0SJ.mjs} +1 -1
  40. package/dist/node/{documents-DqbIqAWu.mjs.map → documents-q4x0P0SJ.mjs.map} +1 -1
  41. package/dist/node/{editor-C9qabl9M.mjs → editor-ptePIIDC.mjs} +5 -5
  42. package/dist/node/{editor-C9qabl9M.mjs.map → editor-ptePIIDC.mjs.map} +1 -1
  43. package/dist/node/{editor-BLxU61yV.mjs → editor-yx2yHVlT.mjs} +8 -8
  44. package/dist/node/{editor-BLxU61yV.mjs.map → editor-yx2yHVlT.mjs.map} +1 -1
  45. package/dist/node/editors/document-model-editor/module.mjs +1 -1
  46. package/dist/node/editors/generic-drive-explorer/index.mjs +4 -4
  47. package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
  48. package/dist/node/{folder-view-D2phxBaq.mjs → folder-view-D6tCBecR.mjs} +3 -3
  49. package/dist/node/{folder-view-D2phxBaq.mjs.map → folder-view-D6tCBecR.mjs.map} +1 -1
  50. package/dist/node/{graphql-editor-SqVKbYGB.mjs → graphql-editor-DAw-Phjj.mjs} +3 -3
  51. package/dist/node/{graphql-editor-SqVKbYGB.mjs.map → graphql-editor-DAw-Phjj.mjs.map} +1 -1
  52. package/dist/node/{hooks-DWvMS6v8.mjs → hooks-iojWIldi.mjs} +2 -2
  53. package/dist/node/{hooks-DWvMS6v8.mjs.map → hooks-iojWIldi.mjs.map} +1 -1
  54. package/dist/node/index.mjs +1 -1
  55. package/dist/node/{json-editor-FEIiQIZ2.mjs → json-editor-pLets2i4.mjs} +2 -2
  56. package/dist/node/{json-editor-FEIiQIZ2.mjs.map → json-editor-pLets2i4.mjs.map} +1 -1
  57. package/dist/node/{lib-oT9d3J_F.mjs → lib-DVt4VMpE.mjs} +1 -1
  58. package/dist/node/{lib-oT9d3J_F.mjs.map → lib-DVt4VMpE.mjs.map} +1 -1
  59. package/dist/node/{schema-context-bgyHwiqj.mjs → schema-context-CEVh0YPx.mjs} +2 -2
  60. package/dist/node/{schema-context-bgyHwiqj.mjs.map → schema-context-CEVh0YPx.mjs.map} +1 -1
  61. package/dist/node/{state-schemas-BEZasnwL.mjs → state-schemas-CkL_GDgy.mjs} +7 -8
  62. package/dist/node/{state-schemas-BEZasnwL.mjs.map → state-schemas-CkL_GDgy.mjs.map} +1 -1
  63. package/dist/node/{style-D3-CDNqD.mjs → style-CJMEZUZM.mjs} +4 -4
  64. package/dist/node/{style-D3-CDNqD.mjs.map → style-CJMEZUZM.mjs.map} +1 -1
  65. package/dist/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +5 -5
  67. package/dist/browser/connect-CjUKHHSu.js.map +0 -1
  68. package/dist/browser/dist-Cglb3DjH.js +0 -139
  69. package/dist/browser/dist-Cglb3DjH.js.map +0 -1
  70. package/dist/browser/dist-OuHji4IC.js.map +0 -1
  71. package/dist/browser/document-timeline-BTTeXWMa-DQCUJzMB.js +0 -3174
  72. package/dist/browser/document-timeline-BTTeXWMa-DQCUJzMB.js.map +0 -1
  73. package/dist/node/connect-lHzmga1Q.mjs.map +0 -1
  74. package/dist/node/dist-BiK14IsY.mjs +0 -139
  75. package/dist/node/dist-BiK14IsY.mjs.map +0 -1
  76. package/dist/node/dist-DnalgmqP.mjs.map +0 -1
  77. package/dist/node/document-timeline-BTTeXWMa-AuNfC83V.mjs +0 -3
  78. package/dist/node/document-timeline-BTTeXWMa-F-UYxPgj.mjs +0 -3167
  79. package/dist/node/document-timeline-BTTeXWMa-F-UYxPgj.mjs.map +0 -1
@@ -1,10 +1,10 @@
1
1
  import { i as __toESM, t as __commonJSMin } from "./chunk-YKewjYmz.js";
2
- import { B as undo, H as validateModules, P as setName, T as replayDocument, U as validateStateSchemaName, V as validateInitialState, W as generateId, _ as buildSignedAction, a as handleTargetNameCollisions, c as moveNode, d as logger, g as baseSaveToFileHandle, h as baseLoadFromInput, i as generateNodesCopy, l as updateNode, n as copyNode, o as isFileNode, s as isFolderNode, t as addFolder$1, u as documentModelDocumentModelModule, v as createPresignedHeader, w as redo, y as createZip } from "./document-drive-BvzpH_WW.js";
2
+ import { B as undo, H as validateModules, P as setName, T as replayDocument, U as validateStateSchemaName, V as validateInitialState, W as generateId, _ as buildSignedAction, a as handleTargetNameCollisions, c as moveNode, d as logger, g as baseSaveToFileHandle, h as baseLoadFromInput, i as generateNodesCopy, l as updateNode, n as copyNode, o as isFileNode, s as isFolderNode, t as addFolder$1, u as documentModelDocumentModelModule, v as createPresignedHeader, w as redo, y as createZip } from "./document-drive-DEBfpfNH.js";
3
3
  import { t as capitalCase } from "./dist-CTgmb7N2.js";
4
- import { A as twMerge, c as DropdownMenuItem, f as cn, g as __assign, l as DropdownMenuTrigger, o as DropdownMenu, p as mergeClassNameProps, s as DropdownMenuContent, u as Icon } from "./dist-OuHji4IC.js";
4
+ import { _ as mergeClassNameProps, b as __assign, d as DropdownMenuContent, f as DropdownMenuItem, g as cn, k as twMerge, m as Icon, p as DropdownMenuTrigger, u as DropdownMenu } from "./dist-D6RK9blQ.js";
5
5
  import { t as parse } from "./parser-CO9mSyAT.js";
6
6
  import * as React$1 from "react";
7
- import React, { Children, Fragment, Suspense, cloneElement, createContext, forwardRef, isValidElement, lazy, use, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
7
+ import React, { Children, Fragment, cloneElement, createContext, createElement, forwardRef, isValidElement, use, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { flushSync } from "react-dom";
10
10
  //#region ../reactor-browser/dist/make-ph-event-functions-Cr4GqOTT.js
@@ -927,7 +927,7 @@ const Slot = forwardRef(({ children, ...props }, ref) => {
927
927
  Slot.displayName = "Slot";
928
928
  //#endregion
929
929
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
930
- function e$9(e, t, n) {
930
+ function e$12(e, t, n) {
931
931
  let r = (n) => e(n, ...t);
932
932
  return n === void 0 ? r : Object.assign(r, {
933
933
  lazy: n,
@@ -936,36 +936,36 @@ function e$9(e, t, n) {
936
936
  }
937
937
  //#endregion
938
938
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/purry.js
939
- function t$10(t, n, r) {
939
+ function t$14(t, n, r) {
940
940
  let i = t.length - n.length;
941
941
  if (i === 0) return t(...n);
942
- if (i === 1) return e$9(t, n, r);
942
+ if (i === 1) return e$12(t, n, r);
943
943
  throw Error(`Wrong number of arguments`);
944
944
  }
945
945
  //#endregion
946
946
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/addProp.js
947
- function t$9(...t) {
948
- return t$10(n$8, t);
947
+ function t$13(...t) {
948
+ return t$14(n$10, t);
949
949
  }
950
- const n$8 = (e, t, n) => ({
950
+ const n$10 = (e, t, n) => ({
951
951
  ...e,
952
952
  [t]: n
953
953
  });
954
954
  //#endregion
955
955
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/allPass.js
956
- function t$8(...t) {
957
- return t$10(n$7, t);
956
+ function t$12(...t) {
957
+ return t$14(n$9, t);
958
958
  }
959
- const n$7 = (e, t) => t.every((t) => t(e));
959
+ const n$9 = (e, t) => t.every((t) => t(e));
960
960
  //#endregion
961
961
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/conditional-CTEJD5TX.js
962
- function e$8(e, t, n) {
962
+ function e$11(e, t, n) {
963
963
  return e(n[0]) ? (e) => t(e, ...n) : t(...n);
964
964
  }
965
- function t$7(...t) {
966
- return e$8(r$3, n$6, t);
965
+ function t$11(...t) {
966
+ return e$11(r$4, n$8, t);
967
967
  }
968
- function n$6(e, ...t) {
968
+ function n$8(e, ...t) {
969
969
  for (let n of t) {
970
970
  if (typeof n == `function`) return n(e);
971
971
  let [t, r] = n;
@@ -973,28 +973,31 @@ function n$6(e, ...t) {
973
973
  }
974
974
  throw Error(`conditional: data failed for all cases`);
975
975
  }
976
- function r$3(e) {
976
+ function r$4(e) {
977
977
  if (!Array.isArray(e)) return !1;
978
978
  let [t, n, ...r] = e;
979
979
  return typeof t == `function` && t.length <= 1 && typeof n == `function` && n.length <= 1 && r.length === 0;
980
980
  }
981
981
  //#endregion
982
982
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/constant.js
983
- function e$7(e) {
983
+ function e$10(e) {
984
984
  return () => e;
985
985
  }
986
986
  //#endregion
987
- //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/utilityEvaluators-Cb8x6-JZ.js
988
- const t$6 = {
987
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/defaultTo.js
988
+ function t$10(...t) {
989
+ return t$14(n$7, t);
990
+ }
991
+ const n$7 = (e, t) => e ?? t, t$9 = {
989
992
  done: !1,
990
993
  hasNext: !1
991
994
  };
992
995
  //#endregion
993
996
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/pipe.js
994
- function t$5(e, ...t) {
995
- let a = e, o = t.map((e) => `lazy` in e ? r$1(e) : void 0), s = 0;
997
+ function t$8(e, ...t) {
998
+ let a = e, o = t.map((e) => `lazy` in e ? r$2(e) : void 0), s = 0;
996
999
  for (; s < t.length;) {
997
- if (o[s] === void 0 || !i(a)) {
1000
+ if (o[s] === void 0 || !i$1(a)) {
998
1001
  let e = t[s];
999
1002
  a = e(a), s += 1;
1000
1003
  continue;
@@ -1005,20 +1008,20 @@ function t$5(e, ...t) {
1005
1008
  if (t === void 0 || (e.push(t), t.isSingle)) break;
1006
1009
  }
1007
1010
  let r = [];
1008
- for (let t of a) if (n$4(t, r, e)) break;
1011
+ for (let t of a) if (n$5(t, r, e)) break;
1009
1012
  let { isSingle: c } = e.at(-1);
1010
1013
  a = c ? r[0] : r, s += e.length;
1011
1014
  }
1012
1015
  return a;
1013
1016
  }
1014
- function n$4(t, r, i) {
1017
+ function n$5(t, r, i) {
1015
1018
  if (i.length === 0) return r.push(t), !1;
1016
- let a = t, o = t$6, s = !1;
1019
+ let a = t, o = t$9, s = !1;
1017
1020
  for (let [e, t] of i.entries()) {
1018
1021
  let { index: c, items: l } = t;
1019
1022
  if (l.push(a), o = t(a, c, l), t.index += 1, o.hasNext) {
1020
1023
  if (o.hasMany ?? !1) {
1021
- for (let t of o.next) if (n$4(t, r, i.slice(e + 1))) return !0;
1024
+ for (let t of o.next) if (n$5(t, r, i.slice(e + 1))) return !0;
1022
1025
  return s;
1023
1026
  }
1024
1027
  a = o.next;
@@ -1028,7 +1031,7 @@ function n$4(t, r, i) {
1028
1031
  }
1029
1032
  return o.hasNext && r.push(a), s;
1030
1033
  }
1031
- function r$1(e) {
1034
+ function r$2(e) {
1032
1035
  let { lazy: t, lazyArgs: n } = e, r = t(...n);
1033
1036
  return Object.assign(r, {
1034
1037
  isSingle: t.single ?? !1,
@@ -1036,27 +1039,37 @@ function r$1(e) {
1036
1039
  items: []
1037
1040
  });
1038
1041
  }
1039
- function i(e) {
1042
+ function i$1(e) {
1040
1043
  return typeof e == `string` || typeof e == `object` && !!e && Symbol.iterator in e;
1041
1044
  }
1042
1045
  //#endregion
1043
1046
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/hasAtLeast.js
1044
- function t$4(...t) {
1045
- return t$10(n$3, t);
1047
+ function t$7(...t) {
1048
+ return t$14(n$4, t);
1046
1049
  }
1047
- const n$3 = (e, t) => e.length >= t;
1050
+ const n$4 = (e, t) => e.length >= t;
1048
1051
  //#endregion
1049
1052
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/entries.js
1050
- function t$3(...t) {
1051
- return t$10(Object.entries, t);
1053
+ function t$6(...t) {
1054
+ return t$14(Object.entries, t);
1052
1055
  }
1053
1056
  //#endregion
1057
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/filter.js
1058
+ function n$3(...t) {
1059
+ return t$14(r$1, t, i);
1060
+ }
1061
+ const r$1 = (e, t) => e.filter(t), i = (e) => (n, r, i) => e(n, r, i) ? {
1062
+ done: !1,
1063
+ hasNext: !0,
1064
+ next: n
1065
+ } : t$9;
1066
+ //#endregion
1054
1067
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/funnel.js
1055
- const e$5 = Symbol(`funnel/voidReducer`), t$2 = () => e$5;
1056
- function n$2(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs: a, minGapMs: o, reducer: s = t$2 }) {
1068
+ const e$8 = Symbol(`funnel/voidReducer`), t$5 = () => e$8;
1069
+ function n$2(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs: a, minGapMs: o, reducer: s = t$5 }) {
1057
1070
  let c, l, u, d, f = () => {
1058
1071
  let t = u;
1059
- t !== void 0 && (u = void 0, t === e$5 ? n() : n(t), o !== void 0 && (l = setTimeout(p, o)));
1072
+ t !== void 0 && (u = void 0, t === e$8 ? n() : n(t), o !== void 0 && (l = setTimeout(p, o)));
1060
1073
  }, p = () => {
1061
1074
  clearTimeout(l), l = void 0, c === void 0 && f();
1062
1075
  }, m = () => {
@@ -1088,35 +1101,54 @@ function n$2(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs:
1088
1101
  };
1089
1102
  }
1090
1103
  //#endregion
1104
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isArray.js
1105
+ function e$7(e) {
1106
+ return Array.isArray(e);
1107
+ }
1108
+ //#endregion
1091
1109
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isDefined.js
1092
- function e$4(e) {
1110
+ function e$6(e) {
1093
1111
  return e !== void 0;
1094
1112
  }
1095
1113
  //#endregion
1114
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isIncludedIn.js
1115
+ function e$5(e, t) {
1116
+ if (t === void 0) {
1117
+ let t = new Set(e);
1118
+ return (e) => t.has(e);
1119
+ }
1120
+ return t.includes(e);
1121
+ }
1122
+ //#endregion
1096
1123
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isNot.js
1097
- function e$3(e) {
1124
+ function e$4(e) {
1098
1125
  return (t) => !e(t);
1099
1126
  }
1100
1127
  //#endregion
1101
1128
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isStrictEqual.js
1102
- function t$1(...t) {
1103
- return t$10(n$1, t);
1129
+ function t$4(...t) {
1130
+ return t$14(n$1, t);
1104
1131
  }
1105
1132
  const n$1 = (e, t) => e === t || Object.is(e, t);
1106
1133
  //#endregion
1107
1134
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isString.js
1108
- function e$2(e) {
1135
+ function e$3(e) {
1109
1136
  return typeof e == `string`;
1110
1137
  }
1111
1138
  //#endregion
1112
1139
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isTruthy.js
1113
- function e$1(e) {
1140
+ function e$2(e) {
1114
1141
  return !!e;
1115
1142
  }
1116
1143
  //#endregion
1144
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/keys.js
1145
+ function t$3(...t) {
1146
+ return t$14(Object.keys, t);
1147
+ }
1148
+ //#endregion
1117
1149
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/map.js
1118
- function t(...t) {
1119
- return t$10(n, t, r);
1150
+ function t$2(...t) {
1151
+ return t$14(n, t, r);
1120
1152
  }
1121
1153
  const n = (e, t) => e.map(t), r = (e) => (t, n, r) => ({
1122
1154
  done: !1,
@@ -1125,11 +1157,29 @@ const n = (e, t) => e.map(t), r = (e) => (t, n, r) => ({
1125
1157
  });
1126
1158
  //#endregion
1127
1159
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/once.js
1128
- function e(e) {
1160
+ function e$1(e) {
1129
1161
  let t = !1, n;
1130
1162
  return () => (t ||= (n = e(), !0), n);
1131
1163
  }
1132
1164
  //#endregion
1165
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/prop.js
1166
+ function e(e, ...n) {
1167
+ return typeof e == `string` || typeof e == `number` || typeof e == `symbol` ? (r) => t$1(r, e, ...n) : t$1(e, ...n);
1168
+ }
1169
+ function t$1(e, ...t) {
1170
+ let n = e;
1171
+ for (let e of t) {
1172
+ if (n == null) return;
1173
+ n = n[e];
1174
+ }
1175
+ return n;
1176
+ }
1177
+ //#endregion
1178
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/values.js
1179
+ function t(...t) {
1180
+ return t$14(Object.values, t);
1181
+ }
1182
+ //#endregion
1133
1183
  //#region ../../node_modules/.pnpm/slug@11.0.1/node_modules/slug/slug.js
1134
1184
  let base64;
1135
1185
  if (typeof window !== "undefined") if (window.btoa) base64 = function(input) {
@@ -2831,8 +2881,8 @@ async function moveNodeById(args) {
2831
2881
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
2832
2882
  const reactorClient = window.ph?.reactorClient;
2833
2883
  if (!reactorClient) throw new Error("ReactorClient not initialized");
2834
- const targetParentFolder = t$7(targetId, [e$3(e$4), e$7(void 0)], [t$1(driveId), e$7(void 0)], e$7(targetId));
2835
- if (t$1(targetParentFolder, srcId)) return;
2884
+ const targetParentFolder = t$11(targetId, [e$4(e$6), e$10(void 0)], [t$4(driveId), e$10(void 0)], e$10(targetId));
2885
+ if (t$4(targetParentFolder, srcId)) return;
2836
2886
  return await reactorClient.execute(driveId, "main", [moveNode({
2837
2887
  srcFolder: srcId,
2838
2888
  targetParentFolder
@@ -3177,12 +3227,6 @@ const useSelectedDriveId = selectedDriveIdEventFunctions.useValue;
3177
3227
  /** Sets the selected drive id */
3178
3228
  const setSelectedDriveId = selectedDriveIdEventFunctions.setValue;
3179
3229
  selectedDriveIdEventFunctions.addEventHandler;
3180
- /** Returns the selected drive */
3181
- function useSelectedDrive() {
3182
- const drive = useSelectedDriveSafe();
3183
- if (!drive[0]) throw new Error("There is no drive selected. Did you mean to call 'useSelectedDriveSafe'?");
3184
- return drive;
3185
- }
3186
3230
  /** Returns the selected drive, or undefined if no drive is selected */
3187
3231
  function useSelectedDriveSafe() {
3188
3232
  const selectedDriveId = useSelectedDriveId();
@@ -3253,7 +3297,7 @@ function unsetDragging() {
3253
3297
  draggingNodeSetter.cancel();
3254
3298
  draggingNodeUnsetter.call();
3255
3299
  }
3256
- const isNodeDrag = (params) => t$7(params, [({ srcId }) => e$3(e$1)(srcId), e$7(false)], [({ driveId }) => e$3(e$1)(driveId), e$7(false)], [({ driveId, srcId }) => t$1(driveId, srcId), e$7(false)], e$7(true));
3300
+ const isNodeDrag = (params) => t$11(params, [({ srcId }) => e$4(e$2)(srcId), e$10(false)], [({ driveId }) => e$4(e$2)(driveId), e$10(false)], [({ driveId, srcId }) => t$4(driveId, srcId), e$10(false)], e$10(true));
3257
3301
  function useDragNode(args) {
3258
3302
  const { srcId, parentId } = args;
3259
3303
  const driveId = useSelectedDriveId();
@@ -3264,14 +3308,14 @@ function useDragNode(args) {
3264
3308
  parentId
3265
3309
  };
3266
3310
  const draggable = isNodeDrag(params);
3267
- const isDragging = t$8({
3311
+ const isDragging = t$12({
3268
3312
  srcId,
3269
3313
  draggingNodeId
3270
3314
  }, [
3271
3315
  () => draggable,
3272
- ({ srcId }) => e$2(srcId),
3273
- ({ draggingNodeId }) => e$2(draggingNodeId),
3274
- ({ srcId, draggingNodeId }) => t$1(srcId, draggingNodeId)
3316
+ ({ srcId }) => e$3(srcId),
3317
+ ({ draggingNodeId }) => e$3(draggingNodeId),
3318
+ ({ srcId, draggingNodeId }) => t$4(srcId, draggingNodeId)
3275
3319
  ]);
3276
3320
  const onDragStart = () => {
3277
3321
  if (!draggable) return;
@@ -3288,7 +3332,7 @@ function useDragNode(args) {
3288
3332
  onDragEnd
3289
3333
  };
3290
3334
  }
3291
- const isNodeDrop = (params) => t$7(params, [({ srcId }) => e$3(e$1)(srcId), e$7(false)], [({ driveId }) => e$3(e$4)(driveId), e$7(false)], [({ srcId, targetId }) => t$1(srcId, targetId), e$7(false)], [({ driveId, parentId, targetId }) => e$3(e$1)(parentId) && t$1(targetId, driveId), e$7(false)], [({ targetId, parentId }) => t$1(targetId, parentId), e$7(false)], e$7(true));
3335
+ const isNodeDrop = (params) => t$11(params, [({ srcId }) => e$4(e$2)(srcId), e$10(false)], [({ driveId }) => e$4(e$6)(driveId), e$10(false)], [({ srcId, targetId }) => t$4(srcId, targetId), e$10(false)], [({ driveId, parentId, targetId }) => e$4(e$2)(parentId) && t$4(targetId, driveId), e$10(false)], [({ targetId, parentId }) => t$4(targetId, parentId), e$10(false)], e$10(true));
3292
3336
  function useDropNode(targetId) {
3293
3337
  const driveId = useSelectedDriveId();
3294
3338
  const { srcId, parentId } = useDraggingNode() ?? {};
@@ -3306,9 +3350,9 @@ function useDropNode(targetId) {
3306
3350
  cb?.();
3307
3351
  }
3308
3352
  const onDragEnter = (event) => handleNodeDrop(event);
3309
- const onDragOver = (event) => handleNodeDrop(event, e(setTarget));
3310
- const onDragLeave = (event) => handleNodeDrop(event, e(unsetTarget));
3311
- const onDrop = (event) => handleNodeDrop(event, e(() => {
3353
+ const onDragOver = (event) => handleNodeDrop(event, e$1(setTarget));
3354
+ const onDragLeave = (event) => handleNodeDrop(event, e$1(unsetTarget));
3355
+ const onDrop = (event) => handleNodeDrop(event, e$1(() => {
3312
3356
  unsetDragging();
3313
3357
  unsetTarget();
3314
3358
  moveNodeById(params).catch(console.error);
@@ -3424,8 +3468,7 @@ function setSelectedNode(nodeOrNodeSlug) {
3424
3468
  }
3425
3469
  const selectedTimelineItemEventFunctions = makePHEventFunctions("selectedTimelineItem");
3426
3470
  selectedTimelineItemEventFunctions.useValue;
3427
- /** Sets the selected timeline item */
3428
- const setSelectedTimelineItem = selectedTimelineItemEventFunctions.setValue;
3471
+ selectedTimelineItemEventFunctions.setValue;
3429
3472
  selectedTimelineItemEventFunctions.addEventHandler;
3430
3473
  const selectedTimelineRevisionEventFunctions = makePHEventFunctions("selectedTimelineRevision");
3431
3474
  selectedTimelineRevisionEventFunctions.useValue;
@@ -3558,7 +3601,7 @@ function defaultHandleError(error) {
3558
3601
  console.error(`Failed to export document: ${error.message}`);
3559
3602
  }
3560
3603
  function handleDocumentValidation(document) {
3561
- if (t$4(validateDocument(document), 1)) return false;
3604
+ if (t$7(validateDocument(document), 1)) return false;
3562
3605
  return true;
3563
3606
  }
3564
3607
  function downloadDocument(document, handleError = defaultHandleError) {
@@ -3746,12 +3789,14 @@ function buildDocumentSubgraphUrl(driveUrl, identifier, authToken) {
3746
3789
  * @returns An async function that returns the switchboard URL, or null if not applicable
3747
3790
  */
3748
3791
  function useGetSwitchboardLink(document) {
3749
- const [drive] = useSelectedDrive();
3792
+ const [drive] = useSelectedDriveSafe();
3750
3793
  const remotes = useSyncList();
3751
3794
  const isRemoteDrive = useMemo(() => {
3795
+ if (!e$6(drive)) return false;
3752
3796
  return remotes.some((remote) => remote.collectionId === driveCollectionId("main", drive.header.id));
3753
3797
  }, [remotes, drive]);
3754
3798
  const remoteUrl = useMemo(() => {
3799
+ if (!e$6(drive)) return null;
3755
3800
  try {
3756
3801
  const channelUrl = (remotes.find((remote) => remote.collectionId === driveCollectionId("main", drive.header.id))?.channel)?.config.url;
3757
3802
  if (typeof channelUrl === "string") return channelUrl;
@@ -8675,201 +8720,462 @@ function Breadcrumb(props) {
8675
8720
  children: name
8676
8721
  });
8677
8722
  }
8678
- function useDocumentUndoRedo(documentId) {
8723
+ /**
8724
+ * Default outer container for `DocumentToolbar`.
8725
+ *
8726
+ * This component provides the toolbar's base layout and visual styling while
8727
+ * still accepting standard `div` props. Pass a custom container to
8728
+ * `DocumentToolbar` when you need to replace this wrapper.
8729
+ */
8730
+ function ToolbarContainer(props) {
8731
+ const { children, className, ...rest } = props;
8732
+ return /* @__PURE__ */ jsx("div", {
8733
+ ...rest,
8734
+ className: twMerge("flex h-12 w-full items-center justify-between rounded-xl border border-gray-200 bg-slate-50 px-4", className),
8735
+ children
8736
+ });
8737
+ }
8738
+ /**
8739
+ * Default container for a group of toolbar controls.
8740
+ *
8741
+ * `DocumentToolbar` renders one controls container per toolbar slot. This
8742
+ * component provides the default horizontal layout for the controls in that
8743
+ * slot while still accepting standard `div` props.
8744
+ */
8745
+ function ToolbarControlsContainer(props) {
8746
+ const { children, className, ...rest } = props;
8747
+ return /* @__PURE__ */ jsx("div", {
8748
+ className: twMerge("flex items-center gap-x-2", className),
8749
+ ...rest,
8750
+ children
8751
+ });
8752
+ }
8753
+ /**
8754
+ * Checks whether a document has at least one non-zero revision count.
8755
+ *
8756
+ * Revision scopes are dynamic document-model keys, so this checks the values of
8757
+ * the document's revision object instead of relying on a fixed list of scope
8758
+ * names.
8759
+ */
8760
+ function hasRevisions(document) {
8761
+ return t$8(e(document, "header", "revision"), t$10({}), t(), n$3(e$2), t$7(1));
8762
+ }
8763
+ /**
8764
+ * Returns undo state and an undo dispatcher for a document.
8765
+ *
8766
+ * `canUndo` is true when the document has at least one non-zero revision count
8767
+ * across any revision scope.
8768
+ */
8769
+ function useUndo(documentId) {
8679
8770
  const [document, dispatch] = useDocumentById(documentId);
8680
- const globalRevisionNumber = document?.header.revision.global ?? 0;
8681
- const localRevisionNumber = document?.header.revision.local ?? 0;
8682
- const canUndo = globalRevisionNumber > 0 || localRevisionNumber > 0;
8683
- const canRedo = !!document?.clipboard.length;
8684
- const handleUndo = () => {
8685
- dispatch(undo());
8686
- };
8687
- const handleRedo = () => {
8688
- dispatch(redo());
8771
+ return {
8772
+ canUndo: hasRevisions(document),
8773
+ undo: () => dispatch(undo())
8689
8774
  };
8775
+ }
8776
+ /**
8777
+ * Returns redo state and a redo dispatcher for a document.
8778
+ *
8779
+ * `canRedo` is true when the document clipboard contains at least one operation
8780
+ * that can be reapplied.
8781
+ */
8782
+ function useRedo(documentId) {
8783
+ const [document, dispatch] = useDocumentById(documentId);
8690
8784
  return {
8691
- undo: handleUndo,
8692
- redo: handleRedo,
8693
- canUndo,
8694
- canRedo
8785
+ canRedo: t$7(document?.clipboard ?? [], 1),
8786
+ redo: () => dispatch(redo())
8695
8787
  };
8696
8788
  }
8697
- const DocumentTimeline$1 = /* @__PURE__ */ lazy(() => import("./document-timeline-BTTeXWMa-DQCUJzMB.js").then((n) => n.t).then((n) => n.n).then((m) => ({ default: m.DocumentTimeline })));
8698
- function useDocumentTimeline(documentId) {
8699
- return [];
8789
+ /**
8790
+ * Base button component used by the built-in toolbar controls.
8791
+ *
8792
+ * This component provides the default toolbar button styling and disabled-state
8793
+ * behavior while accepting standard `button` props.
8794
+ */
8795
+ function ToolbarButton(props) {
8796
+ const { className, children, disabled, ...rest } = props;
8797
+ return /* @__PURE__ */ jsx("button", {
8798
+ ...rest,
8799
+ disabled,
8800
+ className: twMerge("grid size-fit place-items-center rounded-lg border border-gray-200 bg-white p-1 text-gray-900", disabled ? "cursor-not-allowed text-gray-500" : "cursor-pointer active:opacity-70", className),
8801
+ children
8802
+ });
8700
8803
  }
8701
- const DocumentToolbar = (props) => {
8702
- const { onClose, children, onDownloadDocument, className, document: _document, onSwitchboardLinkClick, enabledControls = [
8703
- "undo",
8704
- "redo",
8705
- "export",
8706
- "history"
8707
- ], defaultTimelineVisible = true, disableRevisionHistory = false, initialTimelineVisible = false, ...containerProps } = props;
8708
- const [selectedDocument] = useSelectedDocumentSafe();
8709
- const document = _document ?? selectedDocument;
8710
- const { onRenameNode, onRenameDriveNodes } = useNodeActions();
8711
- const documentName = document?.header.name || void 0;
8712
- const [isEditingName, setIsEditingName] = useState(false);
8713
- const parentFolder = useNodeParentFolderById(document?.header.id);
8714
- const handleClose = onClose ?? (() => setSelectedNode(parentFolder));
8715
- const documentUndoRedo = useDocumentUndoRedo(document?.header.id);
8716
- const isUndoDisabled = !documentUndoRedo.canUndo;
8717
- const isRedoDisabled = !documentUndoRedo.canRedo;
8718
- const defaultDownloadDocument = useDownloadDocument(document?.header.id);
8719
- const timelineItemsData = useDocumentTimeline(document?.header.id);
8720
- const [showTimeline, setShowTimeline] = useState(initialTimelineVisible);
8804
+ /**
8805
+ * Toolbar control for undoing the latest document revision.
8806
+ *
8807
+ * The button is disabled when there are no revisions available to undo.
8808
+ * Provide `children` to replace the default icon, or `onClick` to override the
8809
+ * default undo behavior.
8810
+ */
8811
+ function ToolbarUndoButton(props) {
8812
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8813
+ name: "ArrowCouterclockwise",
8814
+ size: 16
8815
+ }) } = props;
8816
+ const { undo, canUndo } = useUndo(document?.header.id);
8817
+ const disabled = !canUndo;
8818
+ const onClick = makeOnClick(document, onClickOverride, undo);
8819
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8820
+ "data-testid": "toolbar-undo-button",
8821
+ "aria-label": "Undo",
8822
+ className,
8823
+ disabled,
8824
+ onClick,
8825
+ children
8826
+ });
8827
+ }
8828
+ /**
8829
+ * Toolbar control for redoing the latest undone document revision.
8830
+ *
8831
+ * The button is disabled when there are no revisions available to redo.
8832
+ * Provide `children` to replace the default icon, or `onClick` to override the
8833
+ * default redo behavior.
8834
+ */
8835
+ function ToolbarRedoButton(props) {
8836
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8837
+ name: "ArrowCouterclockwise",
8838
+ className: "-scale-x-100",
8839
+ size: 16
8840
+ }) } = props;
8841
+ const { redo, canRedo } = useRedo(document?.header.id);
8842
+ const onClick = makeOnClick(document, onClickOverride, redo);
8843
+ const disabled = !canRedo;
8844
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8845
+ "data-testid": "toolbar-redo-button",
8846
+ "aria-label": "Redo",
8847
+ className,
8848
+ disabled,
8849
+ onClick,
8850
+ children
8851
+ });
8852
+ }
8853
+ /**
8854
+ * Toolbar control for downloading the current document.
8855
+ *
8856
+ * Provide `children` to replace the default label, or `onClick` to override the
8857
+ * default download behavior.
8858
+ */
8859
+ function ToolbarDownloadButton(props) {
8860
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx("span", {
8861
+ className: "px-1 text-xs",
8862
+ children: "Download"
8863
+ }) } = props;
8864
+ const onClick = makeOnClick(document, onClickOverride, useDownloadDocument(document?.header.id));
8865
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8866
+ "data-testid": "toolbar-download-button",
8867
+ "aria-label": "Download",
8868
+ className,
8869
+ onClick,
8870
+ children
8871
+ });
8872
+ }
8873
+ /**
8874
+ * Toolbar control for opening the current document in Switchboard.
8875
+ *
8876
+ * Provide `children` to replace the default icon, or `onClick` to override the
8877
+ * default behavior.
8878
+ */
8879
+ function ToolbarSwitchboardButton(props) {
8880
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8881
+ name: "Drive",
8882
+ size: 16
8883
+ }) } = props;
8721
8884
  const getSwitchboardLink = useGetSwitchboardLink(document);
8722
- function handleDownloadDocument() {
8723
- if (!document) return;
8724
- (onDownloadDocument ?? defaultDownloadDocument)(document);
8725
- }
8726
- const handleDefaultSwitchboardClick = async () => {
8727
- if (getSwitchboardLink) try {
8728
- const url = await getSwitchboardLink();
8729
- window.open(url, "_blank");
8730
- } catch (error) {
8731
- console.error("Error opening switchboard link:", error);
8732
- }
8885
+ const onClick = makeOnClick(document, onClickOverride, () => {
8886
+ getSwitchboardLink?.().then((url) => window.open(url, "_blank")).catch((error) => console.error("Error opening switchboard link:", error));
8887
+ });
8888
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8889
+ "data-testid": "toolbar-switchboard-button",
8890
+ "aria-label": "Open link in Switchboard",
8891
+ className,
8892
+ onClick,
8893
+ children
8894
+ });
8895
+ }
8896
+ /**
8897
+ * Toolbar control for showing the current document's revision history.
8898
+ *
8899
+ * Provide `children` to replace the default icon, or `onClick` to override the
8900
+ * default revision-history behavior.
8901
+ */
8902
+ function ToolbarHistoryButton(props) {
8903
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8904
+ name: "History",
8905
+ size: 16
8906
+ }) } = props;
8907
+ const onClick = makeOnClick(document, onClickOverride, showRevisionHistory);
8908
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8909
+ "data-testid": "toolbar-history-button",
8910
+ "aria-label": "Open document revision history",
8911
+ className,
8912
+ onClick,
8913
+ children
8914
+ });
8915
+ }
8916
+ /**
8917
+ * Toolbar control for closing the current document view.
8918
+ *
8919
+ * By default, this selects the current document's parent folder. Provide
8920
+ * `children` to replace the default icon, or `onClick` to override the default
8921
+ * close behavior.
8922
+ */
8923
+ function ToolbarCloseButton(props) {
8924
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8925
+ name: "XmarkLight",
8926
+ size: 16
8927
+ }) } = props;
8928
+ const parentFolder = useNodeParentFolderById(document?.header.id);
8929
+ const onClick = makeOnClick(document, onClickOverride, () => setSelectedNode(parentFolder));
8930
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8931
+ "data-testid": "toolbar-close-button",
8932
+ "aria-label": "Close document",
8933
+ className,
8934
+ onClick,
8935
+ children
8936
+ });
8937
+ }
8938
+ /**
8939
+ * Creates a toolbar button click handler.
8940
+ *
8941
+ * If an override is provided, it is called with the current document. Otherwise,
8942
+ * the built-in handler is called with the current document.
8943
+ */
8944
+ function makeOnClick(document, onClickOverride, defaultOnClick) {
8945
+ if (e$6(onClickOverride)) return () => onClickOverride(document);
8946
+ return () => defaultOnClick(document);
8947
+ }
8948
+ /**
8949
+ * Text input styled for use inside a toolbar.
8950
+ *
8951
+ * This wraps `NodeInput` with toolbar-specific text styling. Use it for inline
8952
+ * toolbar editing flows where the user can submit a value or cancel editing.
8953
+ */
8954
+ function ToolbarInput(props) {
8955
+ const { defaultValue, className, onSubmit, onCancel, "aria-label": ariaLabel } = props;
8956
+ return /* @__PURE__ */ jsx(NodeInput, {
8957
+ defaultValue,
8958
+ className: twMerge("text-center text-sm font-medium text-gray-500", className),
8959
+ "aria-label": ariaLabel,
8960
+ onCancel,
8961
+ onSubmit
8962
+ });
8963
+ }
8964
+ /**
8965
+ * Toolbar control for displaying and renaming the current document.
8966
+ *
8967
+ * By default, the component renders the document name as a clickable heading.
8968
+ * When clicked, it switches to an inline input. Submitting the input renames
8969
+ * both the node and the corresponding drive node entry.
8970
+ */
8971
+ function ToolbarName(props) {
8972
+ const { document, inputClassName, titleClassName } = props;
8973
+ const [isEditing, setIsEditing] = useState(false);
8974
+ const node = useNodeById(document?.header.id);
8975
+ const { onRenameNode, onRenameDriveNodes } = useNodeActions();
8976
+ const documentName = document?.header.name;
8977
+ const documentId = document?.header.id;
8978
+ const activateEditing = () => setIsEditing(true);
8979
+ const cancelEditing = () => setIsEditing(false);
8980
+ const onSubmit = (newName) => {
8981
+ cancelEditing();
8982
+ if (!documentId || !node) return;
8983
+ Promise.all([onRenameNode(newName, node), onRenameDriveNodes(newName, documentId)]).catch(console.error);
8733
8984
  };
8734
- const resolvedSwitchboardHandler = onSwitchboardLinkClick ?? (getSwitchboardLink ? handleDefaultSwitchboardClick : void 0);
8735
- const isDownloadDisabled = !document;
8736
- const isSwitchboardLinkDisabled = !resolvedSwitchboardHandler;
8737
- const isTimelineDisabled = timelineItemsData.length === 0;
8738
- useEffect(() => {
8739
- if (typeof initialTimelineVisible === "boolean") setShowTimeline(initialTimelineVisible);
8740
- }, [initialTimelineVisible]);
8741
- const handleTimelineToggle = () => {
8742
- if (isTimelineDisabled) return;
8743
- setShowTimeline(!showTimeline);
8985
+ if (!documentName) return null;
8986
+ if (isEditing) return /* @__PURE__ */ jsx(ToolbarInput, {
8987
+ className: inputClassName,
8988
+ onSubmit,
8989
+ onCancel: cancelEditing,
8990
+ defaultValue: documentName,
8991
+ "aria-label": "Document name"
8992
+ });
8993
+ return /* @__PURE__ */ jsx("h1", {
8994
+ className: twMerge("cursor-pointer text-sm font-medium text-gray-500 hover:text-gray-700", titleClassName),
8995
+ onClick: activateEditing,
8996
+ title: "Click to edit",
8997
+ children: documentName
8998
+ });
8999
+ }
9000
+ /**
9001
+ * Default slot layout for the built-in document toolbar controls.
9002
+ *
9003
+ * The toolbar is divided into three control groups:
9004
+ *
9005
+ * - `first`: primary document actions.
9006
+ * - `second`: document identity/display controls.
9007
+ * - `third`: secondary document actions.
9008
+ */
9009
+ const defaultControlSlots = {
9010
+ first: [
9011
+ "undo",
9012
+ "redo",
9013
+ "download"
9014
+ ],
9015
+ second: ["name"],
9016
+ third: [
9017
+ "history",
9018
+ "switchboard",
9019
+ "close"
9020
+ ]
9021
+ };
9022
+ /**
9023
+ * Ordered list of toolbar slot names.
9024
+ */
9025
+ const controlSlots = t$3(defaultControlSlots);
9026
+ /**
9027
+ * Ordered list of all built-in document toolbar control names.
9028
+ *
9029
+ * The order is derived from `defaultControlSlots`.
9030
+ */
9031
+ const documentToolbarControls = [
9032
+ ...defaultControlSlots.first,
9033
+ ...defaultControlSlots.second,
9034
+ ...defaultControlSlots.third
9035
+ ];
9036
+ /**
9037
+ * Default component implementation for each built-in toolbar control.
9038
+ *
9039
+ * These components are used unless a matching entry is provided through
9040
+ * `componentOverrides`.
9041
+ */
9042
+ const defaultControlComponents = {
9043
+ undo: ToolbarUndoButton,
9044
+ redo: ToolbarRedoButton,
9045
+ download: ToolbarDownloadButton,
9046
+ name: ToolbarName,
9047
+ switchboard: ToolbarSwitchboardButton,
9048
+ history: ToolbarHistoryButton,
9049
+ close: ToolbarCloseButton
9050
+ };
9051
+ /**
9052
+ * Creates a predicate for checking whether a built-in toolbar control should render.
9053
+ *
9054
+ * A control renders when it is included in `enabledControls` and absent from
9055
+ * `disabledControls`. When `enabledControls` is omitted, all built-in controls
9056
+ * are considered enabled. When a control appears in both lists,
9057
+ * `disabledControls` takes precedence.
9058
+ */
9059
+ function makeIsEnabledChecker(args) {
9060
+ const { enabledControls = documentToolbarControls, disabledControls = [] } = args;
9061
+ return (control) => e$5(control, enabledControls) && !e$5(control, disabledControls);
9062
+ }
9063
+ /**
9064
+ * Creates a getter for rendering the built-in toolbar controls in a slot.
9065
+ *
9066
+ * The returned function resolves the controls assigned to a slot, filters them
9067
+ * through the enabled/disabled control lists, applies any component overrides,
9068
+ * and renders each control with the current document.
9069
+ */
9070
+ function makeToolbarControlsRenderer(args) {
9071
+ const { document, enabledControls, disabledControls, componentOverrides } = args;
9072
+ const checkIsEnabled = makeIsEnabledChecker({
9073
+ enabledControls,
9074
+ disabledControls
9075
+ });
9076
+ const renderComponent = (control) => t$8(e(componentOverrides, control), t$10(e(defaultControlComponents, control)), (Component) => /* @__PURE__ */ jsx(Component, { document }, control));
9077
+ return (slot) => t$8(e(defaultControlSlots, slot), n$3(checkIsEnabled), t$2(renderComponent));
9078
+ }
9079
+ /**
9080
+ * Checks whether a custom control should render in the requested position.
9081
+ *
9082
+ * Controls without an explicit position are treated as `"start"`.
9083
+ */
9084
+ function isControlInPosition(control, position) {
9085
+ return t$10(control.position, "start") === position;
9086
+ }
9087
+ /**
9088
+ * Creates a getter for rendering custom controls in a slot and position.
9089
+ *
9090
+ * The returned function resolves the custom control or controls assigned to a
9091
+ * slot, then renders only the controls that belong in the requested position.
9092
+ */
9093
+ function makeCustomControlsRenderer(args) {
9094
+ const { document, customControls = {} } = args;
9095
+ return (slot, pos) => {
9096
+ const controlOrControlList = e(customControls, slot);
9097
+ if (!e$6(controlOrControlList)) return null;
9098
+ if (e$7(controlOrControlList)) return renderCustomControlList(controlOrControlList, pos, document);
9099
+ return renderCustomControl(controlOrControlList, pos, document);
8744
9100
  };
8745
- return /* @__PURE__ */ jsxs("div", {
8746
- className: "flex w-full flex-col",
8747
- ...containerProps,
9101
+ }
9102
+ /**
9103
+ * Renders a single custom control when it belongs in the requested position.
9104
+ */
9105
+ function renderCustomControl(control, pos, document) {
9106
+ if (!isControlInPosition(control, pos)) return null;
9107
+ const Component = control.component;
9108
+ return /* @__PURE__ */ jsx(Component, { document });
9109
+ }
9110
+ /**
9111
+ * Renders a list of custom controls for the requested position.
9112
+ *
9113
+ * Returns `null` when no controls in the list belong in that position.
9114
+ */
9115
+ function renderCustomControlList(controls, pos, document) {
9116
+ const controlsInPosition = n$3(controls, (control) => isControlInPosition(control, pos));
9117
+ if (!t$7(controlsInPosition, 1)) return null;
9118
+ return /* @__PURE__ */ jsx(Fragment$1, { children: t$2(controlsInPosition, ({ component: Component, key }) => /* @__PURE__ */ jsx(Component, { document }, key)) });
9119
+ }
9120
+ /**
9121
+ * Renders a document toolbar.
9122
+ *
9123
+ * By default, the toolbar renders the built-in document controls grouped into
9124
+ * toolbar slots. The controls operate on the provided `document`, or on the
9125
+ * currently selected document when no document is provided.
9126
+ *
9127
+ * Use `enabledControls` and `disabledControls` to control which built-in
9128
+ * controls are shown. Use `componentOverrides` to replace individual built-in
9129
+ * controls while keeping the default toolbar layout. Use `customControls` to
9130
+ * insert additional controls before or after the built-in controls in a slot.
9131
+ *
9132
+ * To take over the toolbar contents completely, pass `children`.
9133
+ */
9134
+ function DocumentToolbar(props) {
9135
+ const [selectedDocument] = useSelectedDocumentSafe();
9136
+ const { toolbarClassName, document = selectedDocument, toolbarContainer: Container = ToolbarContainer } = props;
9137
+ if ("children" in props) return /* @__PURE__ */ jsx(Container, {
9138
+ className: toolbarClassName,
9139
+ children: props.children
9140
+ });
9141
+ return /* @__PURE__ */ jsx(Container, {
9142
+ className: toolbarClassName,
9143
+ children: t$2(controlSlots, (slot) => /* @__PURE__ */ createElement(ControlsContainerSlot, {
9144
+ ...props,
9145
+ document,
9146
+ slot,
9147
+ key: slot
9148
+ }))
9149
+ });
9150
+ }
9151
+ /**
9152
+ * Renders one toolbar controls slot.
9153
+ *
9154
+ * Custom controls with position `"start"` are rendered before the built-in
9155
+ * controls for the slot. Custom controls with position `"end"` are rendered
9156
+ * after them.
9157
+ */
9158
+ function ControlsContainerSlot(props) {
9159
+ const { slot, document, controlsContainerClassName, enabledControls, disabledControls, componentOverrides, customControls, controlsContainer: ControlsContainer = ToolbarControlsContainer } = props;
9160
+ const renderToolbarControls = makeToolbarControlsRenderer({
9161
+ document,
9162
+ enabledControls,
9163
+ disabledControls,
9164
+ componentOverrides
9165
+ });
9166
+ const renderCustomControls = makeCustomControlsRenderer({
9167
+ document,
9168
+ customControls
9169
+ });
9170
+ return /* @__PURE__ */ jsxs(ControlsContainer, {
9171
+ className: controlsContainerClassName,
8748
9172
  children: [
8749
- /* @__PURE__ */ jsxs("div", {
8750
- className: twMerge("flex h-12 w-full items-center justify-between rounded-xl border border-gray-200 bg-slate-50 px-4", className),
8751
- children: [
8752
- /* @__PURE__ */ jsxs("div", {
8753
- className: "flex items-center gap-x-2",
8754
- children: [
8755
- enabledControls.includes("undo") && /* @__PURE__ */ jsx("button", {
8756
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isUndoDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8757
- onClick: documentUndoRedo.undo,
8758
- disabled: isUndoDisabled,
8759
- children: /* @__PURE__ */ jsx(Icon, {
8760
- name: "ArrowCouterclockwise",
8761
- size: 16,
8762
- className: isUndoDisabled ? "text-gray-500" : "text-gray-900"
8763
- })
8764
- }),
8765
- enabledControls.includes("redo") && /* @__PURE__ */ jsx("button", {
8766
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isRedoDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8767
- onClick: documentUndoRedo.redo,
8768
- disabled: isRedoDisabled,
8769
- children: /* @__PURE__ */ jsx("div", {
8770
- className: "-scale-x-100",
8771
- children: /* @__PURE__ */ jsx(Icon, {
8772
- name: "ArrowCouterclockwise",
8773
- size: 16,
8774
- className: isRedoDisabled ? "text-gray-500" : "text-gray-900"
8775
- })
8776
- })
8777
- }),
8778
- enabledControls.includes("export") && /* @__PURE__ */ jsx("button", {
8779
- className: twMerge("flex h-8 items-center rounded-lg border border-gray-200 bg-white px-3 text-sm", isDownloadDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8780
- onClick: handleDownloadDocument,
8781
- disabled: isDownloadDisabled,
8782
- children: /* @__PURE__ */ jsx("span", {
8783
- className: isDownloadDisabled ? "text-gray-500" : "text-gray-900",
8784
- children: "Download"
8785
- })
8786
- })
8787
- ]
8788
- }),
8789
- /* @__PURE__ */ jsx("div", {
8790
- className: "flex items-center",
8791
- children: isEditingName && document ? /* @__PURE__ */ jsx(NodeInput, {
8792
- defaultValue: documentName,
8793
- className: "text-center text-sm font-medium text-gray-500",
8794
- "aria-label": "Document name",
8795
- onCancel: () => setIsEditingName(false),
8796
- onSubmit: (newName) => {
8797
- const node = { id: document.header.id };
8798
- Promise.all([onRenameNode(newName, node), onRenameDriveNodes(newName, document.header.id)]).then(() => setIsEditingName(false)).catch((error) => {
8799
- console.error("Failed to rename document:", error);
8800
- setIsEditingName(false);
8801
- });
8802
- }
8803
- }) : /* @__PURE__ */ jsx("h1", {
8804
- className: twMerge("text-sm font-medium text-gray-500", document && "cursor-pointer hover:text-gray-700"),
8805
- onDoubleClick: document ? () => setIsEditingName(true) : void 0,
8806
- title: document ? "Double-click to edit" : void 0,
8807
- children: documentName
8808
- })
8809
- }),
8810
- /* @__PURE__ */ jsxs("div", {
8811
- className: "flex items-center gap-x-2",
8812
- children: [
8813
- !isSwitchboardLinkDisabled && /* @__PURE__ */ jsx("button", {
8814
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", "cursor-pointer active:opacity-70"),
8815
- onClick: resolvedSwitchboardHandler,
8816
- disabled: isSwitchboardLinkDisabled,
8817
- children: /* @__PURE__ */ jsx(Icon, {
8818
- name: "Drive",
8819
- size: 16,
8820
- className: "text-gray-900"
8821
- })
8822
- }),
8823
- enabledControls.includes("history") && /* @__PURE__ */ jsx("button", {
8824
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", disableRevisionHistory ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8825
- onClick: showRevisionHistory,
8826
- disabled: disableRevisionHistory,
8827
- children: /* @__PURE__ */ jsx(Icon, {
8828
- name: "History",
8829
- size: 16,
8830
- className: disableRevisionHistory ? "text-gray-500" : "text-gray-900"
8831
- })
8832
- }),
8833
- enabledControls.includes("timeline") && defaultTimelineVisible && /* @__PURE__ */ jsx("button", {
8834
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isTimelineDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8835
- onClick: handleTimelineToggle,
8836
- disabled: isTimelineDisabled,
8837
- "aria-pressed": showTimeline,
8838
- children: /* @__PURE__ */ jsx(Icon, {
8839
- name: "Timeline",
8840
- size: 16,
8841
- className: twMerge("text-gray-900", isTimelineDisabled && "opacity-50", showTimeline && "text-blue-600")
8842
- })
8843
- }),
8844
- /* @__PURE__ */ jsx("button", {
8845
- id: "close-document-button",
8846
- "aria-label": "Close document",
8847
- className: "grid size-8 cursor-pointer place-items-center rounded-lg border border-gray-200 bg-white active:opacity-70",
8848
- onClick: handleClose,
8849
- children: /* @__PURE__ */ jsx(Icon, {
8850
- name: "XmarkLight",
8851
- size: 16,
8852
- className: "text-gray-900"
8853
- })
8854
- })
8855
- ]
8856
- })
8857
- ]
8858
- }),
8859
- showTimeline && /* @__PURE__ */ jsx("div", {
8860
- className: "mt-2 w-full",
8861
- children: /* @__PURE__ */ jsx(Suspense, {
8862
- fallback: null,
8863
- children: /* @__PURE__ */ jsx(DocumentTimeline$1, {
8864
- timeline: timelineItemsData,
8865
- onItemClick: setSelectedTimelineItem
8866
- })
8867
- })
8868
- }),
8869
- children
9173
+ renderCustomControls(slot, "start"),
9174
+ renderToolbarControls(slot),
9175
+ renderCustomControls(slot, "end")
8870
9176
  ]
8871
9177
  });
8872
- };
9178
+ }
8873
9179
  function ConnectDropdownMenu(props) {
8874
9180
  const { children, items, open, onItemClick, onOpenChange, menuClassName } = props;
8875
9181
  return /* @__PURE__ */ jsxs(DropdownMenu, {
@@ -9030,7 +9336,7 @@ function FileItem(props) {
9030
9336
  RENAME: () => setMode("WRITE"),
9031
9337
  DELETE: () => showDeleteNodeModal(fileNode)
9032
9338
  };
9033
- const dropdownMenuOptions = t$5(fileNodeDropdownOptions, t$3(), t(([id, option]) => t$9(option, "id", id)));
9339
+ const dropdownMenuOptions = t$8(fileNodeDropdownOptions, t$6(), t$2(([id, option]) => t$13(option, "id", id)));
9034
9340
  function onSubmit(name) {
9035
9341
  Promise.all([onRenameNode(name, fileNode), onRenameDriveNodes(name, fileNode.id)]).catch((error) => {
9036
9342
  console.error(error);
@@ -9148,7 +9454,7 @@ function FolderItem(props) {
9148
9454
  RENAME: () => setMode("WRITE"),
9149
9455
  DELETE: () => showDeleteNodeModal(folderNode)
9150
9456
  };
9151
- const dropdownMenuOptions = t$5(folderNodeDropdownOptions, t$3(), t(([id, option]) => t$9(option, "id", id)));
9457
+ const dropdownMenuOptions = t$8(folderNodeDropdownOptions, t$6(), t$2(([id, option]) => t$13(option, "id", id)));
9152
9458
  function onDropdownMenuOptionClick(itemId) {
9153
9459
  const handler = dropdownMenuHandlers[itemId];
9154
9460
  if (!handler) {
@@ -9269,4 +9575,4 @@ const ConnectSearchBar = (props) => {
9269
9575
  //#endregion
9270
9576
  export { useUserPermissions as C, useSetPHDocumentEditorConfig as S, useDocumentModelModules as _, FolderItem as a, useSelectedDocumentOfType as b, FormProvider as c, set as d, useForm as f, showCreateDocumentModal as g, isFolderNodeKind as h, FileItem as i, appendErrors as l, isFileNodeKind as m, ConnectSearchBar as n, useVirtualizer as o, useFormContext as p, DocumentToolbar as r, Controller as s, Breadcrumbs as t, get as u, useNodesInSelectedDriveOrFolder as v, useSetPHAppConfig as x, usePHToast as y };
9271
9577
 
9272
- //# sourceMappingURL=connect-CjUKHHSu.js.map
9578
+ //# sourceMappingURL=connect-BBmOHcv9.js.map