@powerhousedao/powerhouse-vetra-packages 6.0.0-dev.235 → 6.0.0-dev.236

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 (31) hide show
  1. package/dist/browser/{connect-BSkeWkEI-qzWu76a7.js → connect-DdkKD5KC.js} +795 -315
  2. package/dist/browser/connect-DdkKD5KC.js.map +1 -0
  3. package/dist/browser/{editor-Db2JhLhm.js → editor-BMSn7eTH.js} +2 -2
  4. package/dist/browser/{editor-Db2JhLhm.js.map → editor-BMSn7eTH.js.map} +1 -1
  5. package/dist/browser/{editor-C0H0hEHd.js → editor-DDS1tdyE.js} +4 -9
  6. package/dist/browser/editor-DDS1tdyE.js.map +1 -0
  7. package/dist/browser/editors/document-model-editor/module.js +1 -1
  8. package/dist/browser/editors/generic-drive-explorer/index.js +2 -2
  9. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  10. package/dist/browser/{folder-view-tBkk9YMU.js → folder-view-vQSJYT93.js} +4 -8
  11. package/dist/browser/{folder-view-tBkk9YMU.js.map → folder-view-vQSJYT93.js.map} +1 -1
  12. package/dist/editors/generic-drive-explorer/components/folder-view.d.ts.map +1 -1
  13. package/dist/editors/generic-drive-explorer/editor.d.ts.map +1 -1
  14. package/dist/node/{connect-BSkeWkEI-BVfBaxJL.mjs → connect-DJlHZtFf.mjs} +795 -315
  15. package/dist/node/connect-DJlHZtFf.mjs.map +1 -0
  16. package/dist/node/{editor-BhMpYYnU.mjs → editor-BOSkpYLE.mjs} +2 -2
  17. package/dist/node/{editor-BhMpYYnU.mjs.map → editor-BOSkpYLE.mjs.map} +1 -1
  18. package/dist/node/{editor-CGGM05Th.mjs → editor-D0QF1-ny.mjs} +4 -9
  19. package/dist/node/editor-D0QF1-ny.mjs.map +1 -0
  20. package/dist/node/editors/document-model-editor/module.mjs +1 -1
  21. package/dist/node/editors/generic-drive-explorer/index.mjs +2 -2
  22. package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
  23. package/dist/node/{folder-view-BNH5TB1S.mjs → folder-view-Cw3lY6Hv.mjs} +4 -8
  24. package/dist/node/{folder-view-BNH5TB1S.mjs.map → folder-view-Cw3lY6Hv.mjs.map} +1 -1
  25. package/dist/style.css +0 -11
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +5 -5
  28. package/dist/browser/connect-BSkeWkEI-qzWu76a7.js.map +0 -1
  29. package/dist/browser/editor-C0H0hEHd.js.map +0 -1
  30. package/dist/node/connect-BSkeWkEI-BVfBaxJL.mjs.map +0 -1
  31. package/dist/node/editor-CGGM05Th.mjs.map +0 -1
@@ -4,7 +4,7 @@ import { t as capitalCase } from "./dist-CTgmb7N2.js";
4
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-0RiHuA5w.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, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
7
+ import React, { Children, Fragment, Suspense, cloneElement, createContext, forwardRef, isValidElement, lazy, 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
@@ -910,6 +910,210 @@ const Slot = forwardRef(({ children, ...props }, ref) => {
910
910
  });
911
911
  Slot.displayName = "Slot";
912
912
  //#endregion
913
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
914
+ function e$9(e, t, n) {
915
+ let r = (n) => e(n, ...t);
916
+ return n === void 0 ? r : Object.assign(r, {
917
+ lazy: n,
918
+ lazyArgs: t
919
+ });
920
+ }
921
+ //#endregion
922
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/purry.js
923
+ function t$10(t, n, r) {
924
+ let i = t.length - n.length;
925
+ if (i === 0) return t(...n);
926
+ if (i === 1) return e$9(t, n, r);
927
+ throw Error(`Wrong number of arguments`);
928
+ }
929
+ //#endregion
930
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/addProp.js
931
+ function t$9(...t) {
932
+ return t$10(n$8, t);
933
+ }
934
+ const n$8 = (e, t, n) => ({
935
+ ...e,
936
+ [t]: n
937
+ });
938
+ //#endregion
939
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/allPass.js
940
+ function t$8(...t) {
941
+ return t$10(n$7, t);
942
+ }
943
+ const n$7 = (e, t) => t.every((t) => t(e));
944
+ //#endregion
945
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/conditional-CTEJD5TX.js
946
+ function e$8(e, t, n) {
947
+ return e(n[0]) ? (e) => t(e, ...n) : t(...n);
948
+ }
949
+ function t$7(...t) {
950
+ return e$8(r$3, n$6, t);
951
+ }
952
+ function n$6(e, ...t) {
953
+ for (let n of t) {
954
+ if (typeof n == `function`) return n(e);
955
+ let [t, r] = n;
956
+ if (t(e)) return r(e);
957
+ }
958
+ throw Error(`conditional: data failed for all cases`);
959
+ }
960
+ function r$3(e) {
961
+ if (!Array.isArray(e)) return !1;
962
+ let [t, n, ...r] = e;
963
+ return typeof t == `function` && t.length <= 1 && typeof n == `function` && n.length <= 1 && r.length === 0;
964
+ }
965
+ //#endregion
966
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/constant.js
967
+ function e$7(e) {
968
+ return () => e;
969
+ }
970
+ //#endregion
971
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/utilityEvaluators-Cb8x6-JZ.js
972
+ const t$6 = {
973
+ done: !1,
974
+ hasNext: !1
975
+ };
976
+ //#endregion
977
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/pipe.js
978
+ function t$5(e, ...t) {
979
+ let a = e, o = t.map((e) => `lazy` in e ? r$1(e) : void 0), s = 0;
980
+ for (; s < t.length;) {
981
+ if (o[s] === void 0 || !i(a)) {
982
+ let e = t[s];
983
+ a = e(a), s += 1;
984
+ continue;
985
+ }
986
+ let e = [];
987
+ for (let n = s; n < t.length; n++) {
988
+ let t = o[n];
989
+ if (t === void 0 || (e.push(t), t.isSingle)) break;
990
+ }
991
+ let r = [];
992
+ for (let t of a) if (n$4(t, r, e)) break;
993
+ let { isSingle: c } = e.at(-1);
994
+ a = c ? r[0] : r, s += e.length;
995
+ }
996
+ return a;
997
+ }
998
+ function n$4(t, r, i) {
999
+ if (i.length === 0) return r.push(t), !1;
1000
+ let a = t, o = t$6, s = !1;
1001
+ for (let [e, t] of i.entries()) {
1002
+ let { index: c, items: l } = t;
1003
+ if (l.push(a), o = t(a, c, l), t.index += 1, o.hasNext) {
1004
+ if (o.hasMany ?? !1) {
1005
+ for (let t of o.next) if (n$4(t, r, i.slice(e + 1))) return !0;
1006
+ return s;
1007
+ }
1008
+ a = o.next;
1009
+ }
1010
+ if (!o.hasNext) break;
1011
+ o.done && (s = !0);
1012
+ }
1013
+ return o.hasNext && r.push(a), s;
1014
+ }
1015
+ function r$1(e) {
1016
+ let { lazy: t, lazyArgs: n } = e, r = t(...n);
1017
+ return Object.assign(r, {
1018
+ isSingle: t.single ?? !1,
1019
+ index: 0,
1020
+ items: []
1021
+ });
1022
+ }
1023
+ function i(e) {
1024
+ return typeof e == `string` || typeof e == `object` && !!e && Symbol.iterator in e;
1025
+ }
1026
+ //#endregion
1027
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/hasAtLeast.js
1028
+ function t$4(...t) {
1029
+ return t$10(n$3, t);
1030
+ }
1031
+ const n$3 = (e, t) => e.length >= t;
1032
+ //#endregion
1033
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/entries.js
1034
+ function t$3(...t) {
1035
+ return t$10(Object.entries, t);
1036
+ }
1037
+ //#endregion
1038
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/funnel.js
1039
+ const e$5 = Symbol(`funnel/voidReducer`), t$2 = () => e$5;
1040
+ function n$2(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs: a, minGapMs: o, reducer: s = t$2 }) {
1041
+ let c, l, u, d, f = () => {
1042
+ let t = u;
1043
+ t !== void 0 && (u = void 0, t === e$5 ? n() : n(t), o !== void 0 && (l = setTimeout(p, o)));
1044
+ }, p = () => {
1045
+ clearTimeout(l), l = void 0, c === void 0 && f();
1046
+ }, m = () => {
1047
+ clearTimeout(c), c = void 0, d = void 0, l === void 0 && f();
1048
+ };
1049
+ return {
1050
+ call: (...e) => {
1051
+ let t = c === void 0 && l === void 0;
1052
+ if ((r !== `start` || t) && (u = s(u, ...e)), !(c === void 0 && !t)) {
1053
+ if (i !== void 0 || a !== void 0 || o === void 0) {
1054
+ clearTimeout(c);
1055
+ let e = Date.now();
1056
+ d ??= e;
1057
+ let t = a === void 0 ? i ?? 0 : Math.min(i ?? a, Math.max(0, a - (e - d)));
1058
+ c = setTimeout(m, t);
1059
+ }
1060
+ r !== `end` && t && f();
1061
+ }
1062
+ },
1063
+ cancel: () => {
1064
+ clearTimeout(c), c = void 0, d = void 0, clearTimeout(l), l = void 0, u = void 0;
1065
+ },
1066
+ flush: () => {
1067
+ m(), p();
1068
+ },
1069
+ get isIdle() {
1070
+ return c === void 0 && l === void 0;
1071
+ }
1072
+ };
1073
+ }
1074
+ //#endregion
1075
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isDefined.js
1076
+ function e$4(e) {
1077
+ return e !== void 0;
1078
+ }
1079
+ //#endregion
1080
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isNot.js
1081
+ function e$3(e) {
1082
+ return (t) => !e(t);
1083
+ }
1084
+ //#endregion
1085
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isStrictEqual.js
1086
+ function t$1(...t) {
1087
+ return t$10(n$1, t);
1088
+ }
1089
+ const n$1 = (e, t) => e === t || Object.is(e, t);
1090
+ //#endregion
1091
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isString.js
1092
+ function e$2(e) {
1093
+ return typeof e == `string`;
1094
+ }
1095
+ //#endregion
1096
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isTruthy.js
1097
+ function e$1(e) {
1098
+ return !!e;
1099
+ }
1100
+ //#endregion
1101
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/map.js
1102
+ function t(...t) {
1103
+ return t$10(n, t, r);
1104
+ }
1105
+ const n = (e, t) => e.map(t), r = (e) => (t, n, r) => ({
1106
+ done: !1,
1107
+ hasNext: !0,
1108
+ next: e(t, n, r)
1109
+ });
1110
+ //#endregion
1111
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/once.js
1112
+ function e(e) {
1113
+ let t = !1, n;
1114
+ return () => (t ||= (n = e(), !0), n);
1115
+ }
1116
+ //#endregion
913
1117
  //#region ../../node_modules/.pnpm/slug@11.0.1/node_modules/slug/slug.js
914
1118
  let base64;
915
1119
  if (typeof window !== "undefined") if (window.btoa) base64 = function(input) {
@@ -1696,6 +1900,291 @@ slug.setLocale = function(locale) {
1696
1900
  defaultLocale = locales[locale] || {};
1697
1901
  };
1698
1902
  //#endregion
1903
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/descriptors.js
1904
+ const normalizeDescriptors = (error) => {
1905
+ CORE_ERROR_PROPS.forEach((propName) => {
1906
+ normalizeDescriptor(error, propName);
1907
+ });
1908
+ };
1909
+ const CORE_ERROR_PROPS = [
1910
+ "name",
1911
+ "message",
1912
+ "stack",
1913
+ "cause",
1914
+ "errors"
1915
+ ];
1916
+ const normalizeDescriptor = (error, propName) => {
1917
+ const descriptor = getDescriptor(error, propName);
1918
+ if (descriptor === void 0) return;
1919
+ if (isReadonlyGetter(descriptor)) {
1920
+ setErrorProperty(error, propName, error[propName]);
1921
+ return;
1922
+ }
1923
+ if (isInvalidDescriptor(descriptor)) setErrorDescriptor(error, propName, descriptor);
1924
+ };
1925
+ const getDescriptor = (value, propName) => {
1926
+ const descriptor = Object.getOwnPropertyDescriptor(value, propName);
1927
+ if (descriptor !== void 0) return descriptor;
1928
+ const prototype = Object.getPrototypeOf(value);
1929
+ return prototype === null ? void 0 : getDescriptor(prototype, propName);
1930
+ };
1931
+ const isReadonlyGetter = ({ get, set }) => get !== void 0 && set === void 0;
1932
+ const isInvalidDescriptor = ({ enumerable, writable }) => enumerable || !writable;
1933
+ const setErrorProperty = (error, propName, value) => {
1934
+ setErrorDescriptor(error, propName, { value });
1935
+ };
1936
+ const setErrorDescriptor = (error, propName, descriptor) => {
1937
+ Object.defineProperty(error, propName, {
1938
+ ...descriptor,
1939
+ ..."get" in descriptor || "set" in descriptor ? {} : { writable: true },
1940
+ enumerable: false,
1941
+ configurable: true
1942
+ });
1943
+ };
1944
+ //#endregion
1945
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/aggregate.js
1946
+ const normalizeAggregate = (error, recurse) => {
1947
+ if (Array.isArray(error.errors)) setErrorProperty(error, "errors", error.errors.filter(isDefined).map(recurse).filter(Boolean));
1948
+ else if (isAggregateError(error)) setErrorProperty(error, "errors", []);
1949
+ else if (error.errors !== void 0) deleteAggregateErrors(error);
1950
+ };
1951
+ const isDefined = (error) => error !== void 0;
1952
+ const isAggregateError = (error) => "AggregateError" in globalThis && (error.name === "AggregateError" || error instanceof AggregateError);
1953
+ const deleteAggregateErrors = (error) => {
1954
+ delete error.errors;
1955
+ if (error.errors !== void 0) setErrorProperty(error, "errors", []);
1956
+ };
1957
+ //#endregion
1958
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/cause.js
1959
+ const normalizeCause = (error, recurse) => {
1960
+ if (!("cause" in error)) return;
1961
+ const cause = error.cause === void 0 ? error.cause : recurse(error.cause);
1962
+ if (cause === void 0) delete error.cause;
1963
+ else setErrorProperty(error, "cause", cause);
1964
+ };
1965
+ //#endregion
1966
+ //#region ../../node_modules/.pnpm/is-error-instance@3.0.1/node_modules/is-error-instance/build/src/main.js
1967
+ const isErrorInstance = (value) => isInstanceOfError(value) || hasErrorTag(value);
1968
+ const isInstanceOfError = (value) => {
1969
+ try {
1970
+ return value instanceof Error;
1971
+ } catch {
1972
+ return false;
1973
+ }
1974
+ };
1975
+ const hasErrorTag = (value) => {
1976
+ try {
1977
+ return ERROR_TAGS.has(Object.prototype.toString.call(value));
1978
+ } catch {
1979
+ return false;
1980
+ }
1981
+ };
1982
+ const ERROR_TAGS = new Set([
1983
+ "[object Error]",
1984
+ "[object DOMException]",
1985
+ "[object DOMError]",
1986
+ "[object Exception]"
1987
+ ]);
1988
+ //#endregion
1989
+ //#region ../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js
1990
+ function isPlainObject$1(value) {
1991
+ if (typeof value !== "object" || value === null) return false;
1992
+ const prototype = Object.getPrototypeOf(value);
1993
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
1994
+ }
1995
+ //#endregion
1996
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/modifiable.js
1997
+ const isNonModifiableError = (error) => !Object.isExtensible(error) || CORE_ERROR_PROPS.some((propName) => isNonConfigurableProp(error, propName) || isThrowingProp(error, propName));
1998
+ const isNonConfigurableProp = (error, propName) => {
1999
+ const descriptor = Object.getOwnPropertyDescriptor(error, propName);
2000
+ return descriptor !== void 0 && !descriptor.configurable;
2001
+ };
2002
+ const isThrowingProp = (error, propName) => {
2003
+ try {
2004
+ error[propName];
2005
+ return false;
2006
+ } catch {
2007
+ return true;
2008
+ }
2009
+ };
2010
+ //#endregion
2011
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/stack.js
2012
+ const setStack = (error) => {
2013
+ setErrorProperty(error, "stack", getStack(error.message, error.name));
2014
+ };
2015
+ const getStack = (message = "", name = "Error") => {
2016
+ const { stack } = new (getErrorClass(name))(message);
2017
+ return typeof stack === "string" && stack !== "" ? stack : `${name}: ${message}`;
2018
+ };
2019
+ const getErrorClass = (name) => {
2020
+ const descriptor = {
2021
+ value: name,
2022
+ enumerable: false,
2023
+ writable: true,
2024
+ configurable: true
2025
+ };
2026
+ const StackError = Object.defineProperty(class extends Error {}, "name", descriptor);
2027
+ Object.defineProperty(StackError.prototype, "name", descriptor);
2028
+ return StackError;
2029
+ };
2030
+ //#endregion
2031
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/copy.js
2032
+ const copyObject = (object) => {
2033
+ const objectCopy = {};
2034
+ for (const propName of getPropsToCopy(object)) try {
2035
+ const value = object[propName];
2036
+ const { enumerable, configurable, writable = true } = getDescriptor(object, propName);
2037
+ Object.defineProperty(objectCopy, propName, {
2038
+ value,
2039
+ enumerable,
2040
+ configurable,
2041
+ writable
2042
+ });
2043
+ } catch {}
2044
+ return objectCopy;
2045
+ };
2046
+ const getPropsToCopy = (object) => {
2047
+ const propNames = getOwnKeys(object);
2048
+ for (const propName of CORE_ERROR_PROPS) if (isInheritedProp(object, propName)) propNames.push(propName);
2049
+ return propNames;
2050
+ };
2051
+ const getOwnKeys = (object) => {
2052
+ try {
2053
+ return Reflect.ownKeys(object);
2054
+ } catch {
2055
+ return [];
2056
+ }
2057
+ };
2058
+ const isInheritedProp = (object, propName) => {
2059
+ try {
2060
+ return propName in object && !Object.hasOwn(object, propName);
2061
+ } catch {
2062
+ return false;
2063
+ }
2064
+ };
2065
+ //#endregion
2066
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/object.js
2067
+ const objectifyError = (object) => {
2068
+ const { name, message, stack, cause, errors, ...objectA } = copyObject(object);
2069
+ const messageA = getMessage(message, objectA);
2070
+ const error = newError(name, messageA);
2071
+ if (message === messageA) assignObjectProps(error, objectA);
2072
+ Object.entries({
2073
+ name,
2074
+ stack,
2075
+ cause,
2076
+ errors
2077
+ }).forEach(([propName, propValue]) => {
2078
+ setNewErrorProperty(error, propName, propValue);
2079
+ });
2080
+ if (stack === void 0) setStack(error);
2081
+ return error;
2082
+ };
2083
+ const getMessage = (message, object) => typeof message === "string" && message !== "" ? message : truncateMessage(safeJsonStringify(object));
2084
+ const safeJsonStringify = (object) => {
2085
+ try {
2086
+ return JSON.stringify(object);
2087
+ } catch {
2088
+ return safeStringify(object);
2089
+ }
2090
+ };
2091
+ const safeStringify = (object) => {
2092
+ try {
2093
+ return String(object);
2094
+ } catch {
2095
+ return "Invalid error";
2096
+ }
2097
+ };
2098
+ const truncateMessage = (message) => message.length < MESSAGE_MAX_SIZE ? message : `${message.slice(0, MESSAGE_MAX_SIZE)}...`;
2099
+ const MESSAGE_MAX_SIZE = 1e3;
2100
+ const newError = (name, message) => {
2101
+ if (name === "AggregateError" && "AggregateError" in globalThis) return new AggregateError([], message);
2102
+ if (name in NATIVE_ERRORS) return new NATIVE_ERRORS[name](message);
2103
+ return new Error(message);
2104
+ };
2105
+ const NATIVE_ERRORS = {
2106
+ Error,
2107
+ ReferenceError,
2108
+ TypeError,
2109
+ SyntaxError,
2110
+ RangeError,
2111
+ URIError,
2112
+ EvalError
2113
+ };
2114
+ const assignObjectProps = (error, object) => {
2115
+ for (const propName in object) if (!(propName in error)) error[propName] = object[propName];
2116
+ };
2117
+ const setNewErrorProperty = (error, propName, propValue) => {
2118
+ if (propValue !== void 0) setErrorProperty(error, propName, propValue);
2119
+ };
2120
+ //#endregion
2121
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/string.js
2122
+ const stringifyError = (value) => {
2123
+ try {
2124
+ const error = new Error(String(value));
2125
+ setStack(error);
2126
+ return error;
2127
+ } catch (error_) {
2128
+ return error_;
2129
+ }
2130
+ };
2131
+ //#endregion
2132
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/main.js
2133
+ const { toString: objectToString } = Object.prototype;
2134
+ const createError = (value) => {
2135
+ if (isErrorPlainObj(value)) return objectifyError(value);
2136
+ if (!isErrorInstance(value)) return stringifyError(value);
2137
+ if (isInvalidError(value)) return objectifyError(value);
2138
+ return value;
2139
+ };
2140
+ const isErrorPlainObj = (value) => {
2141
+ try {
2142
+ return isPlainObject$1(value);
2143
+ } catch {
2144
+ return false;
2145
+ }
2146
+ };
2147
+ const isInvalidError = (value) => isProxy(value) || isNonModifiableError(value) || hasInvalidConstructor(value);
2148
+ const isProxy = (value) => {
2149
+ try {
2150
+ return objectToString.call(value) === "[object Object]";
2151
+ } catch {
2152
+ return true;
2153
+ }
2154
+ };
2155
+ const hasInvalidConstructor = (error) => typeof error.constructor !== "function" || typeof error.constructor.name !== "string" || error.constructor.name === "" || error.constructor.prototype !== Object.getPrototypeOf(error);
2156
+ //#endregion
2157
+ //#region ../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/main.js
2158
+ const normalizeException = (error, { shallow = false } = {}) => recurseException(error, [], shallow);
2159
+ const recurseException = (error, parents, shallow) => {
2160
+ if (parents.includes(error)) return;
2161
+ const recurse = shallow ? identity : (innerError) => recurseException(innerError, [...parents, error], shallow);
2162
+ const errorA = createError(error);
2163
+ normalizeProps(errorA, recurse);
2164
+ return errorA;
2165
+ };
2166
+ const identity = (error) => error;
2167
+ const normalizeProps = (error, recurse) => {
2168
+ normalizeName(error);
2169
+ normalizeMessage(error);
2170
+ normalizeStack(error);
2171
+ normalizeCause(error, recurse);
2172
+ normalizeAggregate(error, recurse);
2173
+ normalizeDescriptors(error);
2174
+ };
2175
+ const normalizeName = (error) => {
2176
+ if (isDefinedString(error.name)) return;
2177
+ const prototypeName = Object.getPrototypeOf(error).name;
2178
+ setErrorProperty(error, "name", isDefinedString(prototypeName) ? prototypeName : error.constructor.name);
2179
+ };
2180
+ const normalizeMessage = (error) => {
2181
+ if (!isDefinedString(error.message)) setErrorProperty(error, "message", "");
2182
+ };
2183
+ const normalizeStack = (error) => {
2184
+ if (!isDefinedString(error.stack)) setStack(error);
2185
+ };
2186
+ const isDefinedString = (value) => typeof value === "string" && value !== "";
2187
+ //#endregion
1699
2188
  //#region ../reactor-browser/dist/index.js
1700
2189
  var import_lz_string = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
1701
2190
  var LZString = (function() {
@@ -2319,6 +2808,20 @@ async function renameDriveNode(driveId, nodeId, name) {
2319
2808
  })]);
2320
2809
  return (await reactorClient.get(driveId)).state.global.nodes.find((n) => n.id === nodeId);
2321
2810
  }
2811
+ async function moveNodeById(args) {
2812
+ const { driveId, srcId, targetId } = args;
2813
+ if (!driveId || !srcId) return;
2814
+ const { isAllowedToCreateDocuments } = getUserPermissions();
2815
+ if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
2816
+ const reactorClient = window.ph?.reactorClient;
2817
+ if (!reactorClient) throw new Error("ReactorClient not initialized");
2818
+ const targetParentFolder = t$7(targetId, [e$3(e$4), e$7(void 0)], [t$1(driveId), e$7(void 0)], e$7(targetId));
2819
+ if (t$1(targetParentFolder, srcId)) return;
2820
+ return await reactorClient.execute(driveId, "main", [moveNode({
2821
+ srcFolder: srcId,
2822
+ targetParentFolder
2823
+ })]);
2824
+ }
2322
2825
  async function moveNode$1(driveId, src, target) {
2323
2826
  const { isAllowedToCreateDocuments } = getUserPermissions();
2324
2827
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
@@ -2608,65 +3111,6 @@ const featuresEventFunctions = makePHEventFunctions("features");
2608
3111
  featuresEventFunctions.useValue;
2609
3112
  featuresEventFunctions.setValue;
2610
3113
  featuresEventFunctions.addEventHandler;
2611
- const drivesEventFunctions = makePHEventFunctions("drives");
2612
- /** Returns all of the drives in the reactor */
2613
- const useDrives = drivesEventFunctions.useValue;
2614
- /** Sets the drives in the reactor */
2615
- const setDrives = drivesEventFunctions.setValue;
2616
- drivesEventFunctions.addEventHandler;
2617
- const graphQLReactorClientEventFunctions = makePHEventFunctions("reactorGraphQLClient");
2618
- graphQLReactorClientEventFunctions.useValue;
2619
- graphQLReactorClientEventFunctions.setValue;
2620
- graphQLReactorClientEventFunctions.addEventHandler;
2621
- const modalEventFunctions = makePHEventFunctions("modal");
2622
- modalEventFunctions.useValue;
2623
- /** Sets the current modal */
2624
- const setPHModal = modalEventFunctions.setValue;
2625
- modalEventFunctions.addEventHandler;
2626
- /** Shows a modal */
2627
- function showPHModal(modal) {
2628
- setPHModal(modal);
2629
- }
2630
- /** Shows the create document modal */
2631
- function showCreateDocumentModal(documentType) {
2632
- setPHModal({
2633
- type: "createDocument",
2634
- documentType
2635
- });
2636
- }
2637
- /** Shows the delete node modal */
2638
- function showDeleteNodeModal(nodeOrId) {
2639
- setPHModal({
2640
- type: "deleteItem",
2641
- id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
2642
- });
2643
- }
2644
- const packageDiscoveryFunctions = makePHEventFunctions("packageDiscoveryService");
2645
- packageDiscoveryFunctions.useValue;
2646
- packageDiscoveryFunctions.setValue;
2647
- packageDiscoveryFunctions.addEventHandler;
2648
- const reactorClientModuleEventFunctions = makePHEventFunctions("reactorClientModule");
2649
- const reactorClientEventFunctions = makePHEventFunctions("reactorClient");
2650
- /** Returns the reactor client module */
2651
- const useReactorClientModule = reactorClientModuleEventFunctions.useValue;
2652
- reactorClientModuleEventFunctions.setValue;
2653
- reactorClientModuleEventFunctions.addEventHandler;
2654
- reactorClientEventFunctions.useValue;
2655
- reactorClientEventFunctions.setValue;
2656
- reactorClientEventFunctions.addEventHandler;
2657
- const useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager;
2658
- const useSyncList = () => {
2659
- return useSync()?.list() ?? [];
2660
- };
2661
- const revisionHistoryEventFunctions = makePHEventFunctions("revisionHistoryVisible");
2662
- revisionHistoryEventFunctions.useValue;
2663
- /** Sets revision history visibility */
2664
- const setRevisionHistoryVisible = revisionHistoryEventFunctions.setValue;
2665
- revisionHistoryEventFunctions.addEventHandler;
2666
- /** Shows the revision history */
2667
- function showRevisionHistory() {
2668
- setRevisionHistoryVisible(true);
2669
- }
2670
3114
  function resolveUrlPathname(path) {
2671
3115
  return new URL(path.replace(/^\/+/, ""), window.location.origin + (window.ph?.basePath ?? "/")).pathname;
2672
3116
  }
@@ -2705,6 +3149,12 @@ function createUrlWithPreservedParams(pathname) {
2705
3149
  const search = window.location.search;
2706
3150
  return search ? `${pathname}${search}` : pathname;
2707
3151
  }
3152
+ const drivesEventFunctions = makePHEventFunctions("drives");
3153
+ /** Returns all of the drives in the reactor */
3154
+ const useDrives = drivesEventFunctions.useValue;
3155
+ /** Sets the drives in the reactor */
3156
+ const setDrives = drivesEventFunctions.setValue;
3157
+ drivesEventFunctions.addEventHandler;
2708
3158
  const selectedDriveIdEventFunctions = makePHEventFunctions("selectedDriveId");
2709
3159
  /** Returns the selected drive id */
2710
3160
  const useSelectedDriveId = selectedDriveIdEventFunctions.useValue;
@@ -2739,6 +3189,175 @@ function setSelectedDrive(driveOrDriveSlug) {
2739
3189
  if (pathname === window.location.pathname) return;
2740
3190
  window.history.pushState(null, "", createUrlWithPreservedParams(pathname));
2741
3191
  }
3192
+ function useDropTarget() {
3193
+ const [isDropTarget, setIsDropTarget] = useState(false);
3194
+ const isDragAndDropEnabled = useIsDragAndDropEnabled();
3195
+ const targetSetter = n$2(() => setIsDropTarget(true), {
3196
+ triggerAt: "start",
3197
+ minQuietPeriodMs: 100
3198
+ });
3199
+ const targetUnsetter = n$2(() => setIsDropTarget(false), {
3200
+ triggerAt: "start",
3201
+ minQuietPeriodMs: 100
3202
+ });
3203
+ function setTarget() {
3204
+ if (!isDragAndDropEnabled) return;
3205
+ targetUnsetter.cancel();
3206
+ targetSetter.call();
3207
+ }
3208
+ function unsetTarget() {
3209
+ if (!isDragAndDropEnabled) return;
3210
+ targetSetter.cancel();
3211
+ targetUnsetter.call();
3212
+ }
3213
+ return {
3214
+ isDropTarget,
3215
+ setTarget,
3216
+ unsetTarget
3217
+ };
3218
+ }
3219
+ const draggingNodeEventFunctions = makePHEventFunctions("draggingNode");
3220
+ const useDraggingNode = draggingNodeEventFunctions.useValue;
3221
+ const setDraggingNode = draggingNodeEventFunctions.setValue;
3222
+ draggingNodeEventFunctions.addEventHandler;
3223
+ const draggingNodeSetter = n$2((node) => setDraggingNode(node), {
3224
+ reducer: (_, newNode) => newNode,
3225
+ triggerAt: "start",
3226
+ minQuietPeriodMs: 100
3227
+ });
3228
+ const draggingNodeUnsetter = n$2(() => setDraggingNode(void 0), {
3229
+ triggerAt: "start",
3230
+ minQuietPeriodMs: 100
3231
+ });
3232
+ function setDragging(node) {
3233
+ draggingNodeUnsetter.cancel();
3234
+ draggingNodeSetter.call(node);
3235
+ }
3236
+ function unsetDragging() {
3237
+ draggingNodeSetter.cancel();
3238
+ draggingNodeUnsetter.call();
3239
+ }
3240
+ 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));
3241
+ function useDragNode(args) {
3242
+ const { srcId, parentId } = args;
3243
+ const driveId = useSelectedDriveId();
3244
+ const draggingNodeId = useDraggingNode()?.srcId;
3245
+ const params = {
3246
+ driveId,
3247
+ srcId,
3248
+ parentId
3249
+ };
3250
+ const draggable = isNodeDrag(params);
3251
+ const isDragging = t$8({
3252
+ srcId,
3253
+ draggingNodeId
3254
+ }, [
3255
+ () => draggable,
3256
+ ({ srcId }) => e$2(srcId),
3257
+ ({ draggingNodeId }) => e$2(draggingNodeId),
3258
+ ({ srcId, draggingNodeId }) => t$1(srcId, draggingNodeId)
3259
+ ]);
3260
+ const onDragStart = () => {
3261
+ if (!draggable) return;
3262
+ setDragging(params);
3263
+ };
3264
+ const onDragEnd = () => {
3265
+ if (!draggable) return;
3266
+ unsetDragging();
3267
+ };
3268
+ return {
3269
+ isDragging,
3270
+ draggable,
3271
+ onDragStart,
3272
+ onDragEnd
3273
+ };
3274
+ }
3275
+ 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));
3276
+ function useDropNode(targetId) {
3277
+ const driveId = useSelectedDriveId();
3278
+ const { srcId, parentId } = useDraggingNode() ?? {};
3279
+ const { isDropTarget, setTarget, unsetTarget } = useDropTarget();
3280
+ const params = {
3281
+ driveId,
3282
+ parentId,
3283
+ targetId,
3284
+ srcId
3285
+ };
3286
+ function handleNodeDrop(event, cb) {
3287
+ if (!isNodeDrop(params)) return;
3288
+ event.preventDefault();
3289
+ event.stopPropagation();
3290
+ cb?.();
3291
+ }
3292
+ const onDragEnter = (event) => handleNodeDrop(event);
3293
+ const onDragOver = (event) => handleNodeDrop(event, e(setTarget));
3294
+ const onDragLeave = (event) => handleNodeDrop(event, e(unsetTarget));
3295
+ const onDrop = (event) => handleNodeDrop(event, e(() => {
3296
+ unsetDragging();
3297
+ unsetTarget();
3298
+ moveNodeById(params).catch(console.error);
3299
+ }));
3300
+ return {
3301
+ isDropTarget,
3302
+ onDragEnter,
3303
+ onDragOver,
3304
+ onDragLeave,
3305
+ onDrop
3306
+ };
3307
+ }
3308
+ const graphQLReactorClientEventFunctions = makePHEventFunctions("reactorGraphQLClient");
3309
+ graphQLReactorClientEventFunctions.useValue;
3310
+ graphQLReactorClientEventFunctions.setValue;
3311
+ graphQLReactorClientEventFunctions.addEventHandler;
3312
+ const modalEventFunctions = makePHEventFunctions("modal");
3313
+ modalEventFunctions.useValue;
3314
+ /** Sets the current modal */
3315
+ const setPHModal = modalEventFunctions.setValue;
3316
+ modalEventFunctions.addEventHandler;
3317
+ /** Shows a modal */
3318
+ function showPHModal(modal) {
3319
+ setPHModal(modal);
3320
+ }
3321
+ /** Shows the create document modal */
3322
+ function showCreateDocumentModal(documentType) {
3323
+ setPHModal({
3324
+ type: "createDocument",
3325
+ documentType
3326
+ });
3327
+ }
3328
+ /** Shows the delete node modal */
3329
+ function showDeleteNodeModal(nodeOrId) {
3330
+ setPHModal({
3331
+ type: "deleteItem",
3332
+ id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
3333
+ });
3334
+ }
3335
+ const packageDiscoveryFunctions = makePHEventFunctions("packageDiscoveryService");
3336
+ packageDiscoveryFunctions.useValue;
3337
+ packageDiscoveryFunctions.setValue;
3338
+ packageDiscoveryFunctions.addEventHandler;
3339
+ const reactorClientModuleEventFunctions = makePHEventFunctions("reactorClientModule");
3340
+ const reactorClientEventFunctions = makePHEventFunctions("reactorClient");
3341
+ /** Returns the reactor client module */
3342
+ const useReactorClientModule = reactorClientModuleEventFunctions.useValue;
3343
+ reactorClientModuleEventFunctions.setValue;
3344
+ reactorClientModuleEventFunctions.addEventHandler;
3345
+ reactorClientEventFunctions.useValue;
3346
+ reactorClientEventFunctions.setValue;
3347
+ reactorClientEventFunctions.addEventHandler;
3348
+ const useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager;
3349
+ const useSyncList = () => {
3350
+ return useSync()?.list() ?? [];
3351
+ };
3352
+ const revisionHistoryEventFunctions = makePHEventFunctions("revisionHistoryVisible");
3353
+ revisionHistoryEventFunctions.useValue;
3354
+ /** Sets revision history visibility */
3355
+ const setRevisionHistoryVisible = revisionHistoryEventFunctions.setValue;
3356
+ revisionHistoryEventFunctions.addEventHandler;
3357
+ /** Shows the revision history */
3358
+ function showRevisionHistory() {
3359
+ setRevisionHistoryVisible(true);
3360
+ }
2742
3361
  /** Sorts nodes by name. */
2743
3362
  function sortNodesByName(nodes) {
2744
3363
  return nodes.toSorted((a, b) => a.name.localeCompare(b.name));
@@ -2884,6 +3503,64 @@ function useDocumentOfType(documentId, documentType) {
2884
3503
  if (document.header.documentType !== documentType) throw new DocumentTypeMismatchError(documentId, documentType, document.header.documentType);
2885
3504
  return [document, dispatch];
2886
3505
  }
3506
+ const validateDocument = (document) => {
3507
+ const errors = [];
3508
+ if (document.header.documentType !== "powerhouse/document-model") return errors;
3509
+ const doc = document;
3510
+ const specs = doc.state.global.specifications[0];
3511
+ const initialStateErrors = Object.keys(specs.state).reduce((acc, scopeKey) => {
3512
+ const scope = scopeKey;
3513
+ return [...acc, ...validateInitialState(specs.state[scope].initialValue, scope !== "global").map((err) => ({
3514
+ ...err,
3515
+ message: `${err.message}. Scope: ${scope}`,
3516
+ details: {
3517
+ ...err.details,
3518
+ scope
3519
+ }
3520
+ }))];
3521
+ }, []);
3522
+ const schemaStateErrors = Object.keys(specs.state).reduce((acc, scopeKey) => {
3523
+ const scope = scopeKey;
3524
+ const isGlobalScope = scope === "global";
3525
+ return [...acc, ...validateStateSchemaName(specs.state[scope].schema, doc.state.global?.name || doc.header.name || "", !isGlobalScope ? scope : "", !isGlobalScope).map((err) => ({
3526
+ ...err,
3527
+ message: `${err.message}. Scope: ${scope}`,
3528
+ details: {
3529
+ ...err.details,
3530
+ scope
3531
+ }
3532
+ }))];
3533
+ }, []);
3534
+ const modulesErrors = validateModules(specs.modules);
3535
+ return [
3536
+ ...initialStateErrors,
3537
+ ...schemaStateErrors,
3538
+ ...modulesErrors
3539
+ ];
3540
+ };
3541
+ function defaultHandleError(error) {
3542
+ console.error(`Failed to export document: ${error.message}`);
3543
+ }
3544
+ function handleDocumentValidation(document) {
3545
+ if (t$4(validateDocument(document), 1)) return false;
3546
+ return true;
3547
+ }
3548
+ function downloadDocument(document, handleError = defaultHandleError) {
3549
+ if (!document) return;
3550
+ if (!handleDocumentValidation(document)) {
3551
+ showPHModal({
3552
+ type: "downloadDocumentWithErrors",
3553
+ documentId: document.header.id
3554
+ });
3555
+ return;
3556
+ }
3557
+ exportFile(document).catch((error) => handleError(normalizeException(error)));
3558
+ }
3559
+ function useDownloadDocument(id) {
3560
+ const [document] = useDocumentById(id);
3561
+ const toast = usePHToast();
3562
+ return () => downloadDocument(document, (error) => toast?.(`Failed to export document: ${error.message}`));
3563
+ }
2887
3564
  function useFolderById(id) {
2888
3565
  return useFolderNodesInSelectedDrive()?.find((n) => n.id === id);
2889
3566
  }
@@ -3022,49 +3699,6 @@ function getSyncStatusSync(documentId, sharingType) {
3022
3699
  if (status === void 0) return;
3023
3700
  return syncStatusToUI[status];
3024
3701
  }
3025
- const validateDocument = (document) => {
3026
- const errors = [];
3027
- if (document.header.documentType !== "powerhouse/document-model") return errors;
3028
- const doc = document;
3029
- const specs = doc.state.global.specifications[0];
3030
- const initialStateErrors = Object.keys(specs.state).reduce((acc, scopeKey) => {
3031
- const scope = scopeKey;
3032
- return [...acc, ...validateInitialState(specs.state[scope].initialValue, scope !== "global").map((err) => ({
3033
- ...err,
3034
- message: `${err.message}. Scope: ${scope}`,
3035
- details: {
3036
- ...err.details,
3037
- scope
3038
- }
3039
- }))];
3040
- }, []);
3041
- const schemaStateErrors = Object.keys(specs.state).reduce((acc, scopeKey) => {
3042
- const scope = scopeKey;
3043
- const isGlobalScope = scope === "global";
3044
- return [...acc, ...validateStateSchemaName(specs.state[scope].schema, doc.state.global?.name || doc.header.name || "", !isGlobalScope ? scope : "", !isGlobalScope).map((err) => ({
3045
- ...err,
3046
- message: `${err.message}. Scope: ${scope}`,
3047
- details: {
3048
- ...err.details,
3049
- scope
3050
- }
3051
- }))];
3052
- }, []);
3053
- const modulesErrors = validateModules(specs.modules);
3054
- return [
3055
- ...initialStateErrors,
3056
- ...schemaStateErrors,
3057
- ...modulesErrors
3058
- ];
3059
- };
3060
- const exportDocument = (document) => {
3061
- if (!document) return;
3062
- if (validateDocument(document).length) showPHModal({
3063
- type: "exportDocumentWithErrors",
3064
- documentId: document.header.id
3065
- });
3066
- else return exportFile(document);
3067
- };
3068
3702
  function getDocumentGraphqlQuery() {
3069
3703
  const loc = GetDocumentWithOperationsDocument.loc;
3070
3704
  if (!loc) throw new Error("GetDocumentWithOperationsDocument is misconfigured, loc is missing.");
@@ -7905,7 +8539,7 @@ function useVirtualizer(options) {
7905
8539
  });
7906
8540
  }
7907
8541
  //#endregion
7908
- //#region ../design-system/dist/connect-BSkeWkEI.js
8542
+ //#region ../design-system/dist/connect/index.js
7909
8543
  function NodeInput(props) {
7910
8544
  const { onSubmit, onCancel, defaultValue, className, minLength = 1, ...inputProps } = props;
7911
8545
  const [value, setValue] = useState(defaultValue ?? "");
@@ -7977,12 +8611,16 @@ function Breadcrumbs() {
7977
8611
  })
7978
8612
  }),
7979
8613
  /* @__PURE__ */ jsx(Breadcrumb, {
8614
+ id: selectedDriveId,
8615
+ parentId: void 0,
7980
8616
  name: selectedDrive.state.global.name || selectedDrive.header.name,
7981
8617
  onClick: () => setSelectedDrive(selectedDrive)
7982
8618
  }),
7983
8619
  /* @__PURE__ */ jsx("span", { children: "/" })
7984
8620
  ] }),
7985
8621
  hasNodePath && selectedNodePath.map((node) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Breadcrumb, {
8622
+ id: node.id,
8623
+ parentId: node.parentFolder,
7986
8624
  name: node.name,
7987
8625
  onClick: () => setSelectedNode(node)
7988
8626
  }), /* @__PURE__ */ jsx("span", { children: "/" })] }, node.id)),
@@ -8005,9 +8643,17 @@ function Breadcrumbs() {
8005
8643
  });
8006
8644
  }
8007
8645
  function Breadcrumb(props) {
8008
- const { name, onClick } = props;
8646
+ const { name, id, parentId, onClick } = props;
8647
+ const { isDragging, ...dragProps } = useDragNode({
8648
+ srcId: id,
8649
+ parentId: parentId ?? void 0
8650
+ });
8651
+ const { isDropTarget, ...dropProps } = useDropNode(id);
8652
+ const containerStyles = twMerge("cursor-pointer transition-colors last-of-type:text-gray-800 hover:text-gray-800", isDragging ? "opacity-60" : isDropTarget ? "bg-blue-100" : "");
8009
8653
  return /* @__PURE__ */ jsx("div", {
8010
- className: "cursor-pointer transition-colors last-of-type:text-gray-800 hover:text-gray-800",
8654
+ ...dragProps,
8655
+ ...dropProps,
8656
+ className: containerStyles,
8011
8657
  onClick,
8012
8658
  role: "button",
8013
8659
  children: name
@@ -8032,12 +8678,12 @@ function useDocumentUndoRedo(documentId) {
8032
8678
  canRedo
8033
8679
  };
8034
8680
  }
8035
- const DocumentTimeline = /* @__PURE__ */ lazy(() => import("./document-timeline-BTTeXWMa-BdWkMI_g.js").then((n) => n.t).then((n) => n.n).then((m) => ({ default: m.DocumentTimeline })));
8681
+ const DocumentTimeline$1 = /* @__PURE__ */ lazy(() => import("./document-timeline-BTTeXWMa-BdWkMI_g.js").then((n) => n.t).then((n) => n.n).then((m) => ({ default: m.DocumentTimeline })));
8036
8682
  function useDocumentTimeline(documentId) {
8037
8683
  return [];
8038
8684
  }
8039
8685
  const DocumentToolbar = (props) => {
8040
- const { onClose, children, onExport, className, document: _document, onSwitchboardLinkClick, enabledControls = [
8686
+ const { onClose, children, onDownloadDocument, className, document: _document, onSwitchboardLinkClick, enabledControls = [
8041
8687
  "undo",
8042
8688
  "redo",
8043
8689
  "export",
@@ -8050,17 +8696,17 @@ const DocumentToolbar = (props) => {
8050
8696
  const [isEditingName, setIsEditingName] = useState(false);
8051
8697
  const parentFolder = useNodeParentFolderById(document?.header.id);
8052
8698
  const handleClose = onClose ?? (() => setSelectedNode(parentFolder));
8053
- const handleExport = async (doc) => {
8054
- if (!doc) return;
8055
- if (onExport) onExport(doc);
8056
- else await exportDocument(doc);
8057
- };
8058
8699
  const documentUndoRedo = useDocumentUndoRedo(document?.header.id);
8059
8700
  const isUndoDisabled = !documentUndoRedo.canUndo;
8060
8701
  const isRedoDisabled = !documentUndoRedo.canRedo;
8702
+ const defaultDownloadDocument = useDownloadDocument(document?.header.id);
8061
8703
  const timelineItemsData = useDocumentTimeline(document?.header.id);
8062
8704
  const [showTimeline, setShowTimeline] = useState(initialTimelineVisible);
8063
8705
  const getSwitchboardLink = useGetSwitchboardLink(document);
8706
+ function handleDownloadDocument() {
8707
+ if (!document) return;
8708
+ (onDownloadDocument ?? defaultDownloadDocument)(document);
8709
+ }
8064
8710
  const handleDefaultSwitchboardClick = async () => {
8065
8711
  if (getSwitchboardLink) try {
8066
8712
  const url = await getSwitchboardLink();
@@ -8070,7 +8716,7 @@ const DocumentToolbar = (props) => {
8070
8716
  }
8071
8717
  };
8072
8718
  const resolvedSwitchboardHandler = onSwitchboardLinkClick ?? (getSwitchboardLink ? handleDefaultSwitchboardClick : void 0);
8073
- const isExportDisabled = !document;
8719
+ const isDownloadDisabled = !document;
8074
8720
  const isSwitchboardLinkDisabled = !resolvedSwitchboardHandler;
8075
8721
  const isTimelineDisabled = timelineItemsData.length === 0;
8076
8722
  useEffect(() => {
@@ -8114,12 +8760,12 @@ const DocumentToolbar = (props) => {
8114
8760
  })
8115
8761
  }),
8116
8762
  enabledControls.includes("export") && /* @__PURE__ */ jsx("button", {
8117
- className: twMerge("flex h-8 items-center rounded-lg border border-gray-200 bg-white px-3 text-sm", isExportDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8118
- onClick: () => void handleExport(document),
8119
- disabled: isExportDisabled,
8763
+ 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"),
8764
+ onClick: handleDownloadDocument,
8765
+ disabled: isDownloadDisabled,
8120
8766
  children: /* @__PURE__ */ jsx("span", {
8121
- className: isExportDisabled ? "text-gray-500" : "text-gray-900",
8122
- children: "Export"
8767
+ className: isDownloadDisabled ? "text-gray-500" : "text-gray-900",
8768
+ children: "Download"
8123
8769
  })
8124
8770
  })
8125
8771
  ]
@@ -8198,7 +8844,7 @@ const DocumentToolbar = (props) => {
8198
8844
  className: "mt-2 w-full",
8199
8845
  children: /* @__PURE__ */ jsx(Suspense, {
8200
8846
  fallback: null,
8201
- children: /* @__PURE__ */ jsx(DocumentTimeline, {
8847
+ children: /* @__PURE__ */ jsx(DocumentTimeline$1, {
8202
8848
  timeline: timelineItemsData,
8203
8849
  onItemClick: setSelectedTimelineItem
8204
8850
  })
@@ -8208,119 +8854,6 @@ const DocumentToolbar = (props) => {
8208
8854
  ]
8209
8855
  });
8210
8856
  };
8211
- function useDrop(props) {
8212
- const { target, onAddFileOverride, trackNestedDrag = false, acceptedFileExtensions } = props ?? {};
8213
- const [isDropTarget, setIsDropTarget] = useState(false);
8214
- const dragDepthRef = useRef(0);
8215
- const { onMoveNode, onCopyNode, onAddFile: defaultOnAddFile } = useNodeActions();
8216
- const onAddFile = onAddFileOverride ?? defaultOnAddFile;
8217
- /**
8218
- * Check if the dragged content is valid based on accepted file extensions
8219
- */
8220
- const isValidDropContent = useCallback((dataTransfer) => {
8221
- if (!acceptedFileExtensions || acceptedFileExtensions.length === 0) return true;
8222
- if (dataTransfer.types.includes("UI_NODE")) return true;
8223
- if (dataTransfer.types.includes("Files")) {
8224
- const items = Array.from(dataTransfer.items);
8225
- if (items.length === 0) return true;
8226
- return items.some((item) => {
8227
- if (item.kind === "file") {
8228
- if (item.type === "application/zip" || item.type === "application/x-zip-compressed") return acceptedFileExtensions.includes(".zip");
8229
- if (item.type === "" || item.type === "application/octet-stream") return true;
8230
- }
8231
- return false;
8232
- });
8233
- }
8234
- return false;
8235
- }, [acceptedFileExtensions]);
8236
- const onDragOver = useCallback((event) => {
8237
- event.preventDefault();
8238
- event.stopPropagation();
8239
- if (isValidDropContent(event.dataTransfer)) setIsDropTarget(true);
8240
- else event.dataTransfer.dropEffect = "none";
8241
- }, [isValidDropContent]);
8242
- const onDragEnter = useCallback((event) => {
8243
- event.preventDefault();
8244
- event.stopPropagation();
8245
- if (isValidDropContent(event.dataTransfer)) {
8246
- dragDepthRef.current += 1;
8247
- setIsDropTarget(true);
8248
- }
8249
- }, [isValidDropContent]);
8250
- const onDragLeaveDepth = useCallback((event) => {
8251
- event.preventDefault();
8252
- event.stopPropagation();
8253
- dragDepthRef.current = Math.max(0, dragDepthRef.current - 1);
8254
- if (dragDepthRef.current === 0) setIsDropTarget(false);
8255
- }, []);
8256
- const onDragLeaveSimple = useCallback(() => {
8257
- setIsDropTarget(false);
8258
- }, []);
8259
- const onDrop = useCallback(async (event) => {
8260
- event.preventDefault();
8261
- const closestDropZone = event.target.closest("[data-drop-zone]");
8262
- const dropZoneId = target?.id || "root";
8263
- if ((closestDropZone?.getAttribute("data-drop-zone") || "root") !== dropZoneId) {
8264
- setIsDropTarget(false);
8265
- return;
8266
- }
8267
- try {
8268
- let droppedFiles = getDroppedFiles(event.dataTransfer.items).filter(Boolean);
8269
- if (acceptedFileExtensions && acceptedFileExtensions.length > 0) droppedFiles = droppedFiles.filter((file) => {
8270
- if (!file) return false;
8271
- const fileName = file.name.toLowerCase();
8272
- return acceptedFileExtensions.some((ext) => fileName.endsWith(ext.toLowerCase()));
8273
- });
8274
- if (droppedFiles.length) {
8275
- for (const file of droppedFiles) if (file) await onAddFile(file, target);
8276
- return;
8277
- }
8278
- const altOrOptionKeyPressed = event.getModifierState("Alt");
8279
- const data = event.dataTransfer.getData("UI_NODE");
8280
- const droppedNode = JSON.parse(data);
8281
- if (altOrOptionKeyPressed) await onCopyNode(droppedNode, target);
8282
- else await onMoveNode(droppedNode, target);
8283
- } catch (error) {
8284
- console.error(error);
8285
- } finally {
8286
- if (trackNestedDrag) dragDepthRef.current = 0;
8287
- setIsDropTarget(false);
8288
- }
8289
- }, [
8290
- onAddFile,
8291
- onCopyNode,
8292
- onMoveNode,
8293
- target,
8294
- trackNestedDrag
8295
- ]);
8296
- return useMemo(() => {
8297
- const baseProps = {
8298
- onDragOver,
8299
- onDrop,
8300
- "data-drop-zone": target?.id || "root"
8301
- };
8302
- if (trackNestedDrag) {
8303
- baseProps.onDragEnter = onDragEnter;
8304
- baseProps.onDragLeave = onDragLeaveDepth;
8305
- } else baseProps.onDragLeave = onDragLeaveSimple;
8306
- return {
8307
- isDropTarget,
8308
- dropProps: baseProps
8309
- };
8310
- }, [
8311
- isDropTarget,
8312
- target?.id,
8313
- onDragEnter,
8314
- onDragLeaveDepth,
8315
- onDragLeaveSimple,
8316
- onDragOver,
8317
- onDrop,
8318
- trackNestedDrag
8319
- ]);
8320
- }
8321
- function getDroppedFiles(items) {
8322
- return Array.from(items).map((item) => item.kind === "file" ? item.getAsFile() : null).filter(Boolean);
8323
- }
8324
8857
  function ConnectDropdownMenu(props) {
8325
8858
  const { children, items, open, onItemClick, onOpenChange, menuClassName } = props;
8326
8859
  return /* @__PURE__ */ jsxs(DropdownMenu, {
@@ -8345,11 +8878,6 @@ function ConnectDropdownMenu(props) {
8345
8878
  });
8346
8879
  }
8347
8880
  var template_default = "data:image/png;base64,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";
8348
- const defaultNodeOptions = [
8349
- "RENAME",
8350
- "DELETE",
8351
- "DUPLICATE"
8352
- ];
8353
8881
  const normalNodeOptions = [
8354
8882
  "DUPLICATE",
8355
8883
  "RENAME",
@@ -8362,33 +8890,7 @@ const debugNodeOptions = [
8362
8890
  "ADD_INVALID_TRIGGER"
8363
8891
  ];
8364
8892
  [...normalNodeOptions, ...debugNodeOptions];
8365
- const debugNodeOptionsMap = {
8366
- ["ADD_TRIGGER"]: {
8367
- label: "Add Trigger",
8368
- icon: /* @__PURE__ */ jsx(Icon, {
8369
- className: "text-orange-900",
8370
- name: "Plus",
8371
- size: 16
8372
- })
8373
- },
8374
- ["REMOVE_TRIGGER"]: {
8375
- label: "Remove Trigger",
8376
- icon: /* @__PURE__ */ jsx(Icon, {
8377
- className: "text-orange-900",
8378
- name: "Xmark",
8379
- size: 16
8380
- })
8381
- },
8382
- ["ADD_INVALID_TRIGGER"]: {
8383
- label: "Add Trigger",
8384
- icon: /* @__PURE__ */ jsx(Icon, {
8385
- className: "text-orange-900",
8386
- name: "Exclamation",
8387
- size: 16
8388
- })
8389
- }
8390
- };
8391
- const normalNodeOptionsMap = {
8893
+ const folderNodeDropdownOptions = {
8392
8894
  DUPLICATE: {
8393
8895
  label: "Duplicate",
8394
8896
  icon: /* @__PURE__ */ jsx(Icon, {
@@ -8410,43 +8912,18 @@ const normalNodeOptionsMap = {
8410
8912
  size: 16
8411
8913
  }),
8412
8914
  className: "text-red-900"
8413
- },
8414
- SETTINGS: {
8415
- label: "Settings",
8915
+ }
8916
+ };
8917
+ const fileNodeDropdownOptions = {
8918
+ DOWNLOAD: {
8919
+ label: "Download",
8416
8920
  icon: /* @__PURE__ */ jsx(Icon, {
8417
- name: "Gear",
8921
+ name: "DownloadFile",
8418
8922
  size: 16
8419
8923
  })
8420
- }
8924
+ },
8925
+ ...folderNodeDropdownOptions
8421
8926
  };
8422
- const nodeOptionsMap = {
8423
- ...debugNodeOptionsMap,
8424
- ...normalNodeOptionsMap
8425
- };
8426
- function useDrag(props) {
8427
- const { node } = props;
8428
- const [isDragging, setIsDragging] = useState(false);
8429
- const onDragStart = useCallback((event) => {
8430
- event.dataTransfer.setData("UI_NODE", JSON.stringify(node));
8431
- }, [node]);
8432
- const onDragEnd = useCallback(() => {
8433
- setIsDragging(false);
8434
- }, []);
8435
- return useMemo(() => {
8436
- return {
8437
- isDragging,
8438
- dragProps: {
8439
- draggable: true,
8440
- onDragStart,
8441
- onDragEnd
8442
- }
8443
- };
8444
- }, [
8445
- isDragging,
8446
- onDragEnd,
8447
- onDragStart
8448
- ]);
8449
- }
8450
8927
  const SYNCING = "SYNCING";
8451
8928
  const SUCCESS = "SUCCESS";
8452
8929
  const CONFLICT = "CONFLICT";
@@ -8522,20 +8999,22 @@ function FileItem(props) {
8522
8999
  const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
8523
9000
  const [selectedDrive] = useSelectedDriveSafe();
8524
9001
  const sharingType = selectedDrive ? getDriveSharingType$1(selectedDrive) : "LOCAL";
8525
- const { dragProps } = useDrag({ node: fileNode });
9002
+ const { isDragging, ...dragProps } = useDragNode({
9003
+ srcId: fileNode.id,
9004
+ parentId: fileNode.parentFolder ?? void 0
9005
+ });
8526
9006
  const { isAllowedToCreateDocuments } = useUserPermissions();
8527
9007
  const { onRenameNode, onRenameDriveNodes, onDuplicateNode } = useNodeActions();
9008
+ const downloadDocument = useDownloadDocument(fileNode.id);
8528
9009
  const isReadMode = mode === "READ";
8529
9010
  const syncStatus = getSyncStatusSync(fileNode.id, sharingType);
8530
9011
  const dropdownMenuHandlers = {
9012
+ DOWNLOAD: downloadDocument,
8531
9013
  DUPLICATE: () => onDuplicateNode(fileNode),
8532
9014
  RENAME: () => setMode("WRITE"),
8533
9015
  DELETE: () => showDeleteNodeModal(fileNode)
8534
9016
  };
8535
- const dropdownMenuOptions = Object.entries(nodeOptionsMap).map(([id, option]) => ({
8536
- ...option,
8537
- id
8538
- })).filter((option) => defaultNodeOptions.includes(option.id));
9017
+ const dropdownMenuOptions = t$5(fileNodeDropdownOptions, t$3(), t(([id, option]) => t$9(option, "id", id)));
8539
9018
  function onSubmit(name) {
8540
9019
  Promise.all([onRenameNode(name, fileNode), onRenameDriveNodes(name, fileNode.id)]).catch((error) => {
8541
9020
  console.error(error);
@@ -8562,7 +9041,8 @@ function FileItem(props) {
8562
9041
  className: "max-w-none",
8563
9042
  height: 34,
8564
9043
  src: customDocumentIconSrc || template_default,
8565
- width: 32
9044
+ width: 32,
9045
+ draggable: false
8566
9046
  }), isReadMode && syncStatus && /* @__PURE__ */ jsx("div", {
8567
9047
  className: "absolute bottom-[-2px] right-0 size-3 rounded-full bg-white",
8568
9048
  children: /* @__PURE__ */ jsx("div", {
@@ -8574,7 +9054,7 @@ function FileItem(props) {
8574
9054
  })
8575
9055
  })]
8576
9056
  });
8577
- const containerStyles = twMerge("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2 text-gray-600 hover:text-gray-800", className);
9057
+ const containerStyles = twMerge("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2 text-gray-600 hover:text-gray-800", isDragging ? "opacity-60" : "", className);
8578
9058
  const content = isReadMode ? /* @__PURE__ */ jsxs("div", {
8579
9059
  className: "flex w-52 items-center justify-between",
8580
9060
  children: [/* @__PURE__ */ jsxs("div", {
@@ -8612,8 +9092,8 @@ function FileItem(props) {
8612
9092
  return /* @__PURE__ */ jsx("div", {
8613
9093
  className: "relative w-64",
8614
9094
  onClick: isReadMode ? () => setSelectedNode(fileNode) : void 0,
9095
+ ...dragProps,
8615
9096
  children: /* @__PURE__ */ jsx("div", {
8616
- ...dragProps,
8617
9097
  className: containerStyles,
8618
9098
  children: /* @__PURE__ */ jsxs("div", {
8619
9099
  className: "flex items-center",
@@ -8630,9 +9110,12 @@ function FolderItem(props) {
8630
9110
  const { isAllowedToCreateDocuments } = useUserPermissions();
8631
9111
  const [mode, setMode] = useState("READ");
8632
9112
  const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
8633
- const { dragProps } = useDrag({ node: folderNode });
9113
+ const { isDragging, ...dragProps } = useDragNode({
9114
+ srcId: folderNode.id,
9115
+ parentId: folderNode.parentFolder
9116
+ });
9117
+ const { isDropTarget, ...dropProps } = useDropNode(folderNode.id);
8634
9118
  const { onRenameNode, onRenameDriveNodes, onDuplicateNode } = useNodeActions();
8635
- const { isDropTarget, dropProps } = useDrop({ target: folderNode });
8636
9119
  const isReadMode = mode === "READ";
8637
9120
  function onCancel() {
8638
9121
  setMode("READ");
@@ -8649,10 +9132,7 @@ function FolderItem(props) {
8649
9132
  RENAME: () => setMode("WRITE"),
8650
9133
  DELETE: () => showDeleteNodeModal(folderNode)
8651
9134
  };
8652
- const dropdownMenuOptions = Object.entries(nodeOptionsMap).map(([id, option]) => ({
8653
- ...option,
8654
- id
8655
- })).filter((option) => defaultNodeOptions.includes(option.id));
9135
+ const dropdownMenuOptions = t$5(folderNodeDropdownOptions, t$3(), t(([id, option]) => t$9(option, "id", id)));
8656
9136
  function onDropdownMenuOptionClick(itemId) {
8657
9137
  const handler = dropdownMenuHandlers[itemId];
8658
9138
  if (!handler) {
@@ -8671,7 +9151,7 @@ function FolderItem(props) {
8671
9151
  onCancel,
8672
9152
  onSubmit
8673
9153
  });
8674
- const containerStyles = twMerge("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2", className, isDropTarget && "bg-blue-100");
9154
+ const containerStyles = twMerge("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2", isDragging ? "opacity-60" : isDropTarget ? "bg-blue-100" : "", className);
8675
9155
  return /* @__PURE__ */ jsx("div", {
8676
9156
  className: "relative w-64",
8677
9157
  onClick: isReadMode ? () => setSelectedNode(folderNode) : void 0,
@@ -8771,6 +9251,6 @@ const ConnectSearchBar = (props) => {
8771
9251
  });
8772
9252
  };
8773
9253
  //#endregion
8774
- export { useSetPHAppConfig as C, useSelectedFolder as S, useUserPermissions as T, showCreateDocumentModal as _, FolderItem as a, usePHToast as b, Controller as c, get as d, set as f, isFolderNodeKind as g, isFileNodeKind as h, FileItem as i, FormProvider as l, useFormContext as m, ConnectSearchBar as n, useDrop as o, useForm as p, DocumentToolbar as r, useVirtualizer as s, Breadcrumbs as t, appendErrors as u, useDocumentModelModules as v, useSetPHDocumentEditorConfig as w, useSelectedDocumentOfType as x, useNodesInSelectedDriveOrFolder as y };
9254
+ 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 };
8775
9255
 
8776
- //# sourceMappingURL=connect-BSkeWkEI-qzWu76a7.js.map
9256
+ //# sourceMappingURL=connect-DdkKD5KC.js.map