@ynput/ayon-frontend-shared 0.7.5 → 0.8.0

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 (74) hide show
  1. package/dist/DetailsPanel.es.js +471 -469
  2. package/dist/Feed.es.js +1 -1
  3. package/dist/ListTable.es.js +20 -20
  4. package/dist/NewEntity.es.js +7 -7
  5. package/dist/ProjectTreeTable.es.js +2523 -2502
  6. package/dist/ProjectsTable.es.js +5 -5
  7. package/dist/Slicer.es.js +28 -25
  8. package/dist/Views.es.js +150 -151
  9. package/dist/api.es.js +166 -165
  10. package/dist/chunks/Actions.es.js +9 -10
  11. package/dist/chunks/ColumnDropIndicator.es.js +4 -4
  12. package/dist/chunks/ColumnHeaderMenuUI.es.js +4 -5
  13. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +2 -2
  14. package/dist/chunks/DetailsDialog.es.js +3 -3
  15. package/dist/chunks/EmptyPlaceholder.es.js +7 -7
  16. package/dist/chunks/EntityPath.es.js +38 -39
  17. package/dist/chunks/EntityPickerDialog.es.js +482 -462
  18. package/dist/chunks/EntityTooltip.es.js +18 -19
  19. package/dist/chunks/Feed.es.js +1382 -1355
  20. package/dist/chunks/FilmstripEntityCard.es.js +5201 -0
  21. package/dist/chunks/FilterErrorActions.es.js +3 -4
  22. package/dist/chunks/GroupSettingsFallback.es.js +4 -4
  23. package/dist/chunks/Menu.es.js +242 -240
  24. package/dist/chunks/MetaWidget.es.js +1948 -1875
  25. package/dist/chunks/ProjectFoldersContext.es.js +237 -0
  26. package/dist/chunks/RepresentationsList.es.js +1 -1
  27. package/dist/chunks/ReviewablesSelector.es.js +1260 -1190
  28. package/dist/chunks/SimpleTable.es.js +303 -297
  29. package/dist/chunks/Slicer.es.js +420 -413
  30. package/dist/chunks/TableExportContextInstance.es.js +622 -378
  31. package/dist/chunks/TableSettingsFallback.es.js +3 -4
  32. package/dist/chunks/ThumbnailSimple.es.js +114 -99
  33. package/dist/chunks/ThumbnailUploaderContext.es.js +48 -0
  34. package/dist/chunks/VideoPlayer.es.js +8 -9
  35. package/dist/chunks/Watchers.es.js +929 -872
  36. package/dist/chunks/{ColumnDropIndicator.styled.es.js → addonColumnTags.es.js} +60 -47
  37. package/dist/chunks/expandRelativeDates.es.js +1 -1
  38. package/dist/chunks/getThumbnailUrl.es.js +33 -21
  39. package/dist/chunks/getUris.es.js +1580 -1610
  40. package/dist/chunks/queryFilterToClientFilter.es.js +1 -1
  41. package/dist/chunks/realtimeUpdatesUtils.es.js +15 -15
  42. package/dist/chunks/searchTerms.es.js +773 -696
  43. package/dist/chunks/useAttributeEnums.es.js +22 -22
  44. package/dist/chunks/useDateRangeFilter.es.js +1 -1
  45. package/dist/chunks/useHierarchySelection.es.js +3 -4
  46. package/dist/chunks/useLoadModule.es.js +3 -4
  47. package/dist/components.es.js +1391 -1253
  48. package/dist/context.es.js +645 -668
  49. package/dist/hooks.es.js +193 -171
  50. package/dist/index.es.js +4 -4
  51. package/dist/types/Actions.d.ts +10 -8
  52. package/dist/types/DetailsPanel.d.ts +54 -76
  53. package/dist/types/EntityPickerDialog.d.ts +51 -2
  54. package/dist/types/Feed.d.ts +24 -24
  55. package/dist/types/ListTable.d.ts +33 -27
  56. package/dist/types/NewEntity.d.ts +26 -39
  57. package/dist/types/ProjectTreeTable.d.ts +318 -212
  58. package/dist/types/ProjectsTable.d.ts +6 -6
  59. package/dist/types/RepresentationsList.d.ts +4 -0
  60. package/dist/types/Slicer.d.ts +63 -246
  61. package/dist/types/Views.d.ts +71 -298
  62. package/dist/types/api.d.ts +3164 -2363
  63. package/dist/types/components.d.ts +537 -497
  64. package/dist/types/context.d.ts +293 -572
  65. package/dist/types/hooks.d.ts +76 -47
  66. package/dist/types/index.d.ts +6 -0
  67. package/dist/types/util.d.ts +141 -120
  68. package/dist/util.es.js +71 -68
  69. package/package.json +6 -6
  70. package/dist/chunks/EntityUpdatesContext.es.js +0 -61
  71. package/dist/chunks/PlayableIcon.es.js +0 -5020
  72. package/dist/chunks/ProjectContext.es.js +0 -158
  73. package/dist/chunks/useQueryArgumentChangeLoading.es.js +0 -11
  74. package/dist/chunks/viewUpdateHelper.es.js +0 -153
@@ -1,134 +1,214 @@
1
- import { jsxs as ie, jsx as T } from "react/jsx-runtime";
2
- import { useState as C, useEffect as U, useMemo as A, useRef as le, useCallback as L } from "react";
3
- import { registerRemotes as ve, loadRemote as ye } from "@module-federation/enhanced/runtime";
4
- import { setManifestsLoading as ce, MANIFEST_MODULE as se, registerManifest as Pe } from "@ynput/ayon-addon/host";
5
- import { toast as M } from "react-toastify";
6
- import { d as de, z as be, A as we, B as Se, R as Ce, G as Ie, H as Ee, b as Z, o as ke, I as Le, J as xe, K as De, L as Te, N as Ae, O as Fe, Q as Oe, U as je, V as Me, W as Re, X as Ue, Y as Ne, Z as $e, _ as _e, a as Be, $ as Ge, a0 as Ve } from "./chunks/TableExportContextInstance.es.js";
7
- import { E as to, M as oo, a1 as no, P as so, a2 as ro, a3 as ao, T as io, a4 as lo, a5 as co, g as uo, a6 as po, a7 as fo, m as mo, c as go, a8 as ho, t as vo, a9 as yo, aa as Po, ab as bo, ac as wo, ad as So, v as Co, u as Io, n as Eo, ae as ko, x as Lo, y as xo, af as Do, ag as To, ah as Ao, ai as Fo, aj as Oo, ak as jo, al as Mo } from "./chunks/TableExportContextInstance.es.js";
8
- import { aH as We, bt as Qe } from "./chunks/searchTerms.es.js";
9
- import { cZ as qe, ca as He, co as ze, bu as Ye, c$ as Ke, cK as Xe, bO as Ze, d5 as Je, dw as et, cR as tt } from "./chunks/getUris.es.js";
1
+ import { jsxs as pe, jsx as A } from "react/jsx-runtime";
2
+ import { useMemo as B, useState as y, useEffect as F, useCallback as D, useRef as Se } from "react";
3
+ import { registerRemotes as Ce, loadRemote as Ee } from "@module-federation/enhanced/runtime";
4
+ import { setManifestsLoading as fe, MANIFEST_MODULE as ae, registerManifest as ke } from "@ynput/ayon-addon/host";
5
+ import { toast as U } from "react-toastify";
6
+ import { c as me, v as xe, x as Le, y as De, R as Ie, A as je, z as Te, b as te, l as Ae, B as Oe, E as Re, G as Fe, H as Me, I as Ue, J as $e, K as Ne, L as Be, N as _e, O as Ge, Q as qe, U as Ve, V as Qe, a as We, W as He, X as Ye } from "./chunks/TableExportContextInstance.es.js";
7
+ import { Y as rn, Z as an, _ as ln, M as dn, $ as cn, P as un, j as pn, a0 as fn, a1 as mn, T as gn, a2 as vn, a3 as hn, a4 as yn, a5 as Pn, a6 as bn, a7 as wn, a8 as Sn, a9 as Cn, aa as En, ab as kn, ac as xn, ad as Ln, ae as Dn, af as In, m as jn, u as Tn, k as An, t as On, ag as Rn, q as Fn, s as Mn, ah as Un, ai as $n, aj as Nn, ak as Bn, al as _n, am as Gn, an as qn } from "./chunks/TableExportContextInstance.es.js";
8
+ import { aH as ze, bs as Ke } from "./chunks/searchTerms.es.js";
9
+ import { c_ as Xe, cY as Ze, cZ as Je, cb as et, cp as tt, bv as nt, d0 as ot, cL as st, d6 as rt, dx as at, cS as it } from "./chunks/getUris.es.js";
10
10
  import "primereact/confirmdialog";
11
11
  import "lodash";
12
- import { v4 as X } from "uuid";
13
- import { g as ot, c as nt, p as st, b as rt } from "./chunks/getBundleMode.es.js";
14
- import { U as Uo } from "./chunks/getBundleMode.es.js";
12
+ import { v4 as ee } from "uuid";
13
+ import { g as ge, c as lt, p as dt, b as ct } from "./chunks/getBundleMode.es.js";
14
+ import { U as Qn } from "./chunks/getBundleMode.es.js";
15
15
  import "axios";
16
- import { u as ue } from "./chunks/useLoadModule.es.js";
17
- import { P as $o, T as _o } from "./chunks/ProjectContext.es.js";
16
+ import { u as ve } from "./chunks/useLoadModule.es.js";
17
+ import { T as Hn } from "./chunks/ThumbnailUploaderContext.es.js";
18
18
  import "react-dom";
19
- import { p as at, b as it, a as lt, c as ct, D as re } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
20
- import { d as Go } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
21
- import { M as Wo } from "./chunks/MenuContext.es.js";
22
- import { u as dt } from "./chunks/useQueryArgumentChangeLoading.es.js";
23
- import { E as qo, F as Ho } from "./chunks/EntityUpdatesContext.es.js";
24
- import { useSearchParams as ut } from "react-router-dom";
25
- const pt = async (d) => {
26
- await Promise.all(
27
- d.filter((n) => n.modules.includes(se)).map(async (n) => {
19
+ import { p as ut, b as pt, a as ft, c as mt, D as ie } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
20
+ import { d as zn } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
21
+ import { M as Xn } from "./chunks/MenuContext.es.js";
22
+ import { P as Jn, a as eo } from "./chunks/ProjectFoldersContext.es.js";
23
+ import { useSearchParams as gt } from "react-router-dom";
24
+ const vt = (r, t, n, e) => {
25
+ if (n === "developer") {
26
+ const i = t.find((u) => u.isDev && u.activeUser === e);
27
+ if (i) {
28
+ const u = {};
29
+ for (const [v, b] of Object.entries(i.addons ?? {}))
30
+ b && (u[v] = b);
31
+ return { variant: "developer", versions: u };
32
+ }
33
+ }
34
+ const s = n === "staging" ? "staging" : "production", o = {};
35
+ for (const i of r) {
36
+ const u = s === "staging" ? i.stagingVersion : i.productionVersion;
37
+ u && (o[i.name] = u);
38
+ }
39
+ return { variant: s, versions: o };
40
+ }, le = (r, t, n) => {
41
+ const e = r.find((o) => o.name === t), s = n ? e?.versions?.[n]?.frontendScopes : void 0;
42
+ return !!s && Object.keys(s).length > 0;
43
+ }, de = (r) => Object.fromEntries(r.map((t) => [t.addonName, t.addonVersion])), ce = (r, t, n) => [.../* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(t)])].filter((e) => r[e] !== t[e] && n(e)).map((e) => t[e] ? `${e} ${t[e]}` : `${e} removed`), ht = (r, t) => {
44
+ const n = ce(
45
+ de(r.modules),
46
+ de(t.modules),
47
+ () => !0
48
+ );
49
+ if (r.bundle && t.bundle) {
50
+ const e = r.bundle.versions, s = t.bundle.versions;
51
+ n.push(
52
+ ...ce(
53
+ e,
54
+ s,
55
+ (o) => le(t.addons, o, e[o]) || le(t.addons, o, s[o])
56
+ )
57
+ );
58
+ }
59
+ return [...new Set(n)];
60
+ }, yt = async (r) => {
61
+ const t = {};
62
+ return await Promise.all(
63
+ r.filter((n) => n.modules.includes(ae)).map(async (n) => {
28
64
  try {
29
- const s = await ye(
30
- `${n.remote}/${se}`,
65
+ const e = await Ee(
66
+ `${n.remote}/${ae}`,
31
67
  { from: "runtime" }
32
- );
33
- Pe({ name: n.addon, version: n.version, remote: n.remote }, s?.default);
34
- } catch (s) {
35
- console.error(`[addon ${n.addon}] its manifest failed to load`, s);
68
+ ), s = e?.default;
69
+ if (!Array.isArray(s?.contributes))
70
+ throw new Error('the manifest has no "contributes" list: export default defineAddon({ contributes })');
71
+ ke({ name: n.addon, version: n.version, remote: n.remote }, e?.default);
72
+ } catch (e) {
73
+ console.error(`[addon ${n.addon}] its manifest failed to load`, e), t[n.addon] = String(e);
36
74
  }
37
75
  })
38
- ), ce(!1);
39
- }, _t = ({ children: d, skip: n }) => {
76
+ ), fe(!1), t;
77
+ }, Qt = ({ children: r, skip: t }) => {
40
78
  const {
41
- data: s = [],
42
- isLoading: o,
43
- isFetching: i
44
- } = qe(void 0, {
45
- skip: n
46
- }), {
47
- siteInfo: u,
48
- user: m,
49
- isLoading: { siteInfo: w, user: S }
50
- } = de(), [y] = C(be), [a, c] = C(
51
- y ? { status: "loading", override: y } : { status: "off" }
79
+ siteInfo: n,
80
+ user: e,
81
+ isLoading: { siteInfo: s, user: o }
82
+ } = me(), i = ge(e), {
83
+ data: u = [],
84
+ isLoading: v,
85
+ isFetching: b
86
+ } = Xe(
87
+ { variant: i },
88
+ {
89
+ skip: t || o
90
+ }
91
+ ), { data: h, isFetching: c } = Ze(
92
+ {},
93
+ { skip: t || o }
94
+ ), { data: a, isFetching: p } = Je(
95
+ { archived: !1 },
96
+ { skip: t || o || i !== "developer" }
97
+ ), f = B(() => h?.addons ?? [], [h]), P = B(() => a?.bundles ?? [], [a]), m = B(
98
+ () => vt(f, P, i, e?.name),
99
+ [f, P, i, e?.name]
100
+ ), L = c || p, [C] = y(xe), k = C && "override" in C ? C.override : void 0, [l, x] = y(
101
+ C ? "override" in C ? { status: "loading", override: C.override } : { status: "rejected", ...C } : { status: "off" }
52
102
  );
53
- U(() => {
54
- if (!(!y || S)) {
55
- if (!we(m)) {
56
- console.warn("[addon dev] ignored: only users in developer mode can load addons from a dev server"), c({ status: "off" });
57
- return;
58
- }
59
- Se(y).then(
60
- (p) => c({ status: "active", override: y, info: p }),
61
- (p) => c({ status: "error", override: y, error: String(p) })
62
- );
103
+ F(() => {
104
+ if (!k || o) return;
105
+ const w = Le(e);
106
+ if (w) {
107
+ console.warn(`[addon dev] ignored: ${w}`), x({
108
+ status: "rejected",
109
+ request: `${k.addon}@${k.url}`,
110
+ reason: w
111
+ });
112
+ return;
63
113
  }
64
- }, [y, S, m]);
65
- const e = A(() => {
66
- if (a.status !== "active") return s;
67
- const { override: p, info: v } = a;
114
+ De(k).then(
115
+ (g) => x({ status: "active", override: k, info: g }),
116
+ (g) => x({ status: "error", override: k, error: g.message })
117
+ );
118
+ }, [k, o, e]);
119
+ const T = B(() => {
120
+ if (l.status !== "active") return u;
121
+ const { override: w, info: g } = l;
68
122
  return [
69
- ...s.filter((g) => g.addonName !== p.addon),
123
+ ...u.filter((S) => S.addonName !== w.addon),
70
124
  {
71
- addonName: p.addon,
72
- addonVersion: `${v.version}+dev`,
73
- modules: { [v.remote]: v.modules }
125
+ addonName: w.addon,
126
+ addonVersion: `${g.version}+dev`,
127
+ modules: { [g.remote]: g.modules }
74
128
  }
75
129
  ];
76
- }, [s, a]), [l, P] = C(!1), I = le({});
77
- return U(() => {
78
- if (!l || i) return;
79
- const p = e.filter(({ addonName: t, addonVersion: h }) => {
80
- const b = I.current[t];
81
- return b !== void 0 && b !== h;
82
- }), v = "addon-versions-changed";
83
- if (!p.length) {
84
- M.dismiss(v);
130
+ }, [u, l]), [M, _] = y(!1), [I, d] = y(), [E, R] = y();
131
+ return F(() => {
132
+ t || o || E || !I || L || R(m);
133
+ }, [t, o, E, I, L, m]), F(() => {
134
+ if (!M || !I || b || L) return;
135
+ const w = ht(
136
+ { modules: I.modules, bundle: E },
137
+ { modules: T, bundle: m, addons: f }
138
+ ), g = i !== I.variant, S = "addon-versions-changed";
139
+ if (!w.length && !g) {
140
+ U.dismiss(S);
85
141
  return;
86
142
  }
87
- const g = p.map((t) => `${t.addonName} ${t.addonVersion}`).join(", "), f = /* @__PURE__ */ T(Ee, { message: `Addons updated (${g}). Refresh to load them.` });
88
- M.isActive(v) ? M.update(v, { render: f }) : M.info(f, { toastId: v, autoClose: !1, closeOnClick: !1 });
89
- }, [e, i, l]), U(() => {
90
- if (o || w || l || a.status === "loading") return;
91
- if (!e.length) {
92
- P(!0), ce(!1);
143
+ const $ = g ? "Bundle changed. Refresh to load its addon modules." : `Addons updated (${w.join(", ")}). Refresh to load them.`, O = /* @__PURE__ */ A(Te, { message: $ });
144
+ U.isActive(S) ? U.update(S, { render: O }) : U.info(O, { toastId: S, autoClose: !1, closeOnClick: !1 });
145
+ }, [
146
+ T,
147
+ b,
148
+ L,
149
+ M,
150
+ i,
151
+ I,
152
+ E,
153
+ m,
154
+ f
155
+ ]), F(() => {
156
+ if (v || s || o || M || l.status === "loading")
157
+ return;
158
+ if (!T.length) {
159
+ d({ variant: i, modules: T }), _(!0), fe(!1);
93
160
  return;
94
161
  }
95
- const p = [];
96
- e.forEach((g) => {
97
- const { addonName: f, addonVersion: t, modules: h = {} } = g;
98
- Object.entries(h).forEach(([b, E]) => {
99
- p.push({
100
- remote: b,
101
- addon: f,
102
- version: t,
103
- modules: E
162
+ const w = [];
163
+ T.forEach((S) => {
164
+ const { addonName: $, addonVersion: O, modules: H = {} } = S;
165
+ Object.entries(H).forEach(([X, W]) => {
166
+ w.push({
167
+ remote: X,
168
+ addon: $,
169
+ version: O,
170
+ modules: W
104
171
  });
105
172
  });
106
- }), I.current = Object.fromEntries(p.map((g) => [g.addon, g.version]));
107
- const v = a.status === "active" ? a : void 0;
108
- ve(
109
- p.map((g) => ({
110
- name: g.remote,
111
- alias: g.remote,
112
- entry: v && g.addon === v.override.addon ? `${v.override.url}/remoteEntry.js?build=${v.info.buildId}` : `/addons/${g.addon || g.remote}/${g.version}/frontend/modules/${g.remote}/remoteEntry.js?server=${u?.releaseInfo?.version || u?.releaseInfo}-${u?.releaseInfo?.buildDate}-${(/* @__PURE__ */ new Date()).getTime()}`,
173
+ }), d({ variant: i, modules: T });
174
+ const g = l.status === "active" ? l : void 0;
175
+ Ce(
176
+ w.map((S) => ({
177
+ name: S.remote,
178
+ alias: S.remote,
179
+ entry: g && S.addon === g.override.addon ? `${g.override.url}/remoteEntry.js?build=${g.info.buildId}` : `/addons/${S.addon || S.remote}/${S.version}/frontend/modules/${S.remote}/remoteEntry.js?server=${n?.releaseInfo?.version || n?.releaseInfo}-${n?.releaseInfo?.buildDate}-${(/* @__PURE__ */ new Date()).getTime()}`,
113
180
  type: "module"
114
181
  }))
115
- ), P(!0), pt(p);
116
- }, [e, o, w, l, a]), /* @__PURE__ */ ie(
117
- Ce.Provider,
182
+ ), _(!0), yt(w).then((S) => {
183
+ const $ = g && S[g.override.addon];
184
+ $ && x({ ...g, error: `its manifest failed to load (${$})` });
185
+ });
186
+ }, [
187
+ T,
188
+ v,
189
+ s,
190
+ o,
191
+ M,
192
+ l,
193
+ i
194
+ ]), /* @__PURE__ */ pe(
195
+ Ie.Provider,
118
196
  {
119
197
  value: {
120
- isLoading: o,
121
- modules: e,
122
- remotesInitialized: l,
123
- addonDev: a
198
+ isLoading: v,
199
+ modules: I?.modules ?? T,
200
+ remotesInitialized: M,
201
+ variant: I?.variant,
202
+ bundle: E,
203
+ addonDev: l
124
204
  },
125
205
  children: [
126
- d,
127
- a.status !== "off" && /* @__PURE__ */ T(Ie, { state: a })
206
+ r,
207
+ l.status !== "off" && /* @__PURE__ */ A(je, { state: l })
128
208
  ]
129
209
  }
130
210
  );
131
- }, ft = {
211
+ }, Pt = {
132
212
  planner: {
133
213
  label: "Planner",
134
214
  icon: "calendar_month",
@@ -173,736 +253,633 @@ const pt = async (d) => {
173
253
  "dataPortability"
174
254
  ]
175
255
  }
176
- }, Bt = ({
177
- children: d,
178
- defaultTab: n = "feed",
179
- hasLicense: s,
180
- debug: o = {},
181
- ...i
256
+ }, Wt = ({
257
+ children: r,
258
+ defaultTab: t = "feed",
259
+ hasLicense: n,
260
+ debug: e = {},
261
+ ...s
182
262
  }) => {
183
- const u = i.user, m = ot(u), w = "isGuest" in o ? o.isGuest : u?.data?.isGuest, { powerLicense: S, setPowerpackDialog: y } = Z(), a = "hasLicense" in o ? o.hasLicense : !!S || s, [c, e] = C({}), [l, P] = C([]), [I, p] = C([]), v = L(
184
- (k) => c[k] ? c[k] : !1,
263
+ const o = s.user, i = ge(o), u = "isGuest" in e ? e.isGuest : o?.data?.isGuest, { powerLicense: v, setPowerpackDialog: b } = te(), h = "hasLicense" in e ? e.hasLicense : !!v || n, [c, a] = y({}), [p, f] = y([]), [P, m] = y([]), L = D(
264
+ (j) => c[j] ? c[j] : !1,
185
265
  [c]
186
- ), g = L(
187
- (k, _) => {
188
- const R = { ...c };
189
- R[k] = _, e(R);
266
+ ), C = D(
267
+ (j, N) => {
268
+ const Y = { ...c };
269
+ Y[j] = N, a(Y);
190
270
  },
191
271
  [c]
192
- ), [f, t] = ke(Le, {}), h = L(
193
- (k) => {
194
- const _ = f[k];
195
- return xe(_) ? _ : n;
272
+ ), [k, l] = Ae(Oe, {}), x = D(
273
+ (j) => {
274
+ const N = k[j];
275
+ return Re(N) ? N : t;
196
276
  },
197
- [f, n]
198
- ), [b, E] = C(null), O = L((k) => {
199
- E(k);
200
- }, []), F = L(() => {
201
- E(null), b && $([]);
277
+ [k, t]
278
+ ), [T, M] = y(null), _ = D((j) => {
279
+ M(j);
280
+ }, []), I = D(() => {
281
+ M(null), T && O([]);
202
282
  }, []);
203
- U(() => {
204
- F();
205
- }, [i.useLocation().pathname]);
206
- const [r, x] = C(null), D = L((k) => {
207
- x(k);
208
- }, []), j = L(() => {
209
- x(null);
210
- }, []), [N, B] = C(null), [z, $] = C([]), { uriType: Y, uri: fe, entity: G, getUriEntities: me } = De(), [V] = i.useSearchParams(), W = V.get("project"), Q = V.get("type"), q = V.get("id"), J = V.get("activity");
211
- U(() => {
212
- if (!(!W && !Q && !q)) {
213
- if (Y === "entity" && G && G.entityType !== "product") {
214
- me().then((k) => {
215
- if (k.length === 0) return;
216
- const _ = k.find((he) => he.uri === fe), R = _?.entities?.[0];
217
- if (!_ || !R) return;
218
- const oe = R?.projectName || G.projectName || "", ne = R.representationId || R.versionId || R.productId || R.taskId || R.folderId;
219
- if (!oe || !ne) return;
220
- const ge = {
221
- entityType: G.entityType,
222
- entities: [
223
- {
224
- id: ne,
225
- projectName: oe
226
- }
227
- ],
228
- source: "uri"
229
- };
230
- B(ge);
231
- }).catch((k) => {
232
- console.warn("Failed to get URI entities:", k);
233
- });
234
- return;
235
- }
236
- W && Q && q && (B({
237
- entityType: Q,
238
- entities: [
239
- {
240
- id: q,
241
- projectName: W
242
- }
243
- ],
244
- source: "url"
245
- }), J && ($([J]), t({
246
- ...f,
247
- overview: "feed"
248
- })));
283
+ F(() => {
284
+ I();
285
+ }, [s.useLocation().pathname]);
286
+ const [d, E] = y(null), R = D((j) => {
287
+ E(j);
288
+ }, []), w = D(() => {
289
+ E(null);
290
+ }, []), [g, S] = y(null), [$, O] = y([]), { uriType: H, uri: X, entity: W, getUriEntities: ye, setUri: Pe } = Fe(), [z] = s.useSearchParams(), q = z.get("project"), V = z.get("type"), G = z.get("id"), Z = z.get("activity");
291
+ F(() => {
292
+ if (!q && !V && !G) return;
293
+ const j = !!g && !!q && !!V && !!G && g.entities[0]?.id !== G;
294
+ if (j && Pe(""), !j && H === "entity" && W && W.entityType !== "product") {
295
+ ye().then((N) => {
296
+ if (N.length === 0) return;
297
+ const Y = N.find((we) => we.uri === X), Q = Y?.entities?.[0];
298
+ if (!Y || !Q) return;
299
+ const se = Q?.projectName || W.projectName || "", re = Q.representationId || Q.versionId || Q.productId || Q.taskId || Q.folderId;
300
+ if (!se || !re) return;
301
+ const be = {
302
+ entityType: W.entityType,
303
+ entities: [
304
+ {
305
+ id: re,
306
+ projectName: se
307
+ }
308
+ ],
309
+ source: "uri"
310
+ };
311
+ S(be);
312
+ }).catch((N) => {
313
+ console.warn("Failed to get URI entities:", N);
314
+ });
315
+ return;
249
316
  }
250
- }, [W, Q, q]);
251
- const H = {
317
+ q && V && G && S({
318
+ entityType: V,
319
+ entities: [
320
+ {
321
+ id: G,
322
+ projectName: q
323
+ }
324
+ ],
325
+ source: "url"
326
+ });
327
+ }, [q, V, G]), F(() => {
328
+ !q || !V || !G || !Z || (O([Z]), l({
329
+ ...k,
330
+ overview: "feed"
331
+ }));
332
+ }, [q, V, G, Z]);
333
+ const K = {
252
334
  // open state for the panel by scope
253
335
  panelOpenByScope: c,
254
- getOpenForScope: v,
255
- setPanelOpen: g,
256
- setPanelOpenByScope: e,
336
+ getOpenForScope: L,
337
+ setPanelOpen: C,
338
+ setPanelOpenByScope: a,
257
339
  // tab preferences
258
- tabsByScope: f,
259
- getTabForScope: h,
340
+ tabsByScope: k,
341
+ getTabForScope: x,
260
342
  // slide out state
261
- slideOut: b,
262
- openSlideOut: O,
263
- closeSlideOut: F,
343
+ slideOut: T,
344
+ openSlideOut: _,
345
+ closeSlideOut: I,
264
346
  // highlighted activities
265
- highlightedActivities: z,
266
- setHighlightedActivities: $,
347
+ highlightedActivities: $,
348
+ setHighlightedActivities: O,
267
349
  // PiP state
268
- pip: r,
269
- openPip: D,
270
- closePip: j,
350
+ pip: d,
351
+ openPip: R,
352
+ closePip: w,
271
353
  // entities state
272
- entities: N,
273
- setEntities: B,
274
- feedAnnotations: l,
275
- setFeedAnnotations: P,
276
- feedFrameLinks: I,
277
- setFeedFrameLinks: p,
278
- bundleMode: m,
279
- isGuest: w,
280
- hasLicense: a,
281
- onPowerFeature: y,
282
- ...i
283
- }, K = le(H), ee = K.current, te = Object.keys(H);
284
- return (te.length !== Object.keys(ee).length || te.some((k) => ee[k] !== H[k])) && (K.current = H), /* @__PURE__ */ T(Te.Provider, { value: K.current, children: d });
285
- }, mt = (d) => {
286
- const { setPowerpackDialog: n } = Z();
287
- return U(() => {
288
- n({ addon: "planner", feature: "subtasks" }), d?.onNotFound?.();
289
- }, [n, d.onNotFound]), null;
290
- }, Gt = ({ children: d }) => {
291
- const [n, { outdated: s, isLoading: o }] = ue({
354
+ entities: g,
355
+ setEntities: S,
356
+ feedAnnotations: p,
357
+ setFeedAnnotations: f,
358
+ feedFrameLinks: P,
359
+ setFeedFrameLinks: m,
360
+ bundleMode: i,
361
+ isGuest: u,
362
+ hasLicense: h,
363
+ onPowerFeature: b,
364
+ ...s
365
+ }, J = Se(K), ne = J.current, oe = Object.keys(K);
366
+ return (oe.length !== Object.keys(ne).length || oe.some((j) => ne[j] !== K[j])) && (J.current = K), /* @__PURE__ */ A(Me.Provider, { value: J.current, children: r });
367
+ }, bt = (r) => {
368
+ const { setPowerpackDialog: t } = te();
369
+ return F(() => {
370
+ t({ addon: "planner", feature: "subtasks" }), r?.onNotFound?.();
371
+ }, [t, r.onNotFound]), null;
372
+ }, Ht = ({ children: r }) => {
373
+ const [t, { outdated: n, isLoading: e }] = ve({
292
374
  addon: "planner",
293
375
  remote: "planner",
294
376
  module: "SubtasksManager",
295
- fallback: mt
377
+ fallback: bt
296
378
  });
297
- return /* @__PURE__ */ T(
298
- Ae.Provider,
379
+ return /* @__PURE__ */ A(
380
+ Ue.Provider,
299
381
  {
300
382
  value: {
301
- SubtasksManager: o ? void 0 : n,
302
- requiredVersion: s?.required,
303
- isLoading: o
383
+ SubtasksManager: e ? void 0 : t,
384
+ requiredVersion: n?.required,
385
+ isLoading: e
304
386
  },
305
- children: d
387
+ children: r
306
388
  }
307
389
  );
308
- }, Vt = ({ children: d }) => {
309
- const [n, s] = C(!1), [o, i] = C(null), [u, m] = C(null), w = () => {
310
- s(!0), i(null);
311
- }, S = () => {
312
- s(!1), i(null);
313
- }, y = (e, l = null) => {
314
- s((P) => !P), e && !n ? (i(e), m(l)) : (i(null), m(null));
315
- }, a = (e, l = null) => {
316
- i(e), m(l);
390
+ }, Yt = ({ children: r }) => {
391
+ const [t, n] = y(!1), [e, s] = y(null), [o, i] = y(null), u = () => {
392
+ n(!0), s(null);
393
+ }, v = () => {
394
+ n(!1), s(null);
395
+ }, b = (a, p = null) => {
396
+ n((f) => !f), a && !t ? (s(a), i(p)) : (s(null), i(null));
397
+ }, h = (a, p = null) => {
398
+ s(a), i(p);
317
399
  }, c = () => {
318
- i(null), m(null);
400
+ s(null), i(null);
319
401
  };
320
- return /* @__PURE__ */ T(
321
- Fe.Provider,
402
+ return /* @__PURE__ */ A(
403
+ $e.Provider,
322
404
  {
323
405
  value: {
324
- isPanelOpen: n,
325
- selectedSetting: o,
326
- highlightedSetting: u,
327
- setHighlightedSetting: m,
328
- openPanel: w,
329
- closePanel: S,
330
- togglePanel: y,
331
- selectSetting: a,
406
+ isPanelOpen: t,
407
+ selectedSetting: e,
408
+ highlightedSetting: o,
409
+ setHighlightedSetting: i,
410
+ openPanel: u,
411
+ closePanel: v,
412
+ togglePanel: b,
413
+ selectSetting: h,
332
414
  backToMainMenu: c
333
415
  },
334
- children: d
416
+ children: r
335
417
  }
336
418
  );
337
419
  };
338
- function Wt({ children: d }) {
339
- const n = window.location.protocol === "https:" || window.location.hostname === "localhost", s = "documentPictureInPicture" in window && n, [o, i] = C(null), [u, m] = C(null), w = L(() => {
340
- m(null), o != null && (o.close(), i(null));
341
- }, [o, u]), S = L(
342
- async (a, c) => {
343
- if (!s) {
344
- m(X());
420
+ function zt({ children: r }) {
421
+ const t = window.location.protocol === "https:" || window.location.hostname === "localhost", n = "documentPictureInPicture" in window && t, [e, s] = y(null), [o, i] = y(null), u = D(() => {
422
+ i(null), e != null && (e.close(), s(null));
423
+ }, [e, o]), v = D(
424
+ async (h, c) => {
425
+ if (!n) {
426
+ i(ee());
345
427
  return;
346
428
  }
347
- if (o != null) {
348
- console.log("pipWindow is already open"), m(X());
429
+ if (e != null) {
430
+ console.log("pipWindow is already open"), i(ee());
349
431
  return;
350
432
  }
351
- const e = await window.documentPictureInPicture.requestWindow({
352
- width: a,
433
+ const a = await window.documentPictureInPicture.requestWindow({
434
+ width: h,
353
435
  height: c
354
436
  });
355
- e.addEventListener("pagehide", () => {
356
- i(null), m(null);
357
- }), i(e), m(X());
437
+ a.addEventListener("pagehide", () => {
438
+ s(null), i(null);
439
+ }), s(a), i(ee());
358
440
  },
359
- [o, u]
441
+ [e, o]
360
442
  );
361
- U(() => {
362
- [...document.styleSheets].forEach((a) => {
443
+ F(() => {
444
+ [...document.styleSheets].forEach((h) => {
363
445
  try {
364
- const c = [...a.cssRules].map((P) => P.cssText).join(""), e = document.createElement("style");
365
- e.textContent = c, o?.document.head.appendChild(e);
366
- const l = document.createElement("style");
367
- l.textContent = `
446
+ const c = [...h.cssRules].map((f) => f.cssText).join(""), a = document.createElement("style");
447
+ a.textContent = c, e?.document.head.appendChild(a);
448
+ const p = document.createElement("style");
449
+ p.textContent = `
368
450
  html, body, .pipRoot {
369
451
  height: 100%;
370
452
  margin: 0;
371
453
  padding: 0;
372
454
  overflow: hidden;
373
- }`, o?.document.head.appendChild(l);
455
+ }`, e?.document.head.appendChild(p);
374
456
  } catch {
375
- const e = document.createElement("link");
376
- if (a.href == null)
457
+ const a = document.createElement("link");
458
+ if (h.href == null)
377
459
  return;
378
- e.rel = "stylesheet", e.type = a.type, e.media = a.media.toString(), e.href = a.href, o?.document.head.appendChild(e);
460
+ a.rel = "stylesheet", a.type = h.type, a.media = h.media.toString(), a.href = h.href, e?.document.head.appendChild(a);
379
461
  }
380
462
  });
381
- }, [o]);
382
- const y = A(() => ({
383
- isSupported: s,
384
- pipWindow: o,
385
- pipId: u,
386
- requestPipWindow: S,
387
- closePipWindow: w
388
- }), [w, s, o, S]);
389
- return /* @__PURE__ */ T(Oe.Provider, { value: y, children: d });
463
+ }, [e]);
464
+ const b = B(() => ({
465
+ isSupported: n,
466
+ pipWindow: e,
467
+ pipId: o,
468
+ requestPipWindow: v,
469
+ closePipWindow: u
470
+ }), [u, n, e, v]);
471
+ return /* @__PURE__ */ A(Ne.Provider, { value: b, children: r });
390
472
  }
391
- const Qt = ({
392
- children: d,
393
- projectName: n,
473
+ const Kt = ({
474
+ children: r,
475
+ projectName: t,
394
476
  // utils
395
- toast: s,
396
- ...o
477
+ toast: n,
478
+ ...e
397
479
  }) => {
398
- const { data: i } = He(
399
- { projectName: n },
400
- { skip: !n }
401
- ), { user: u } = de();
402
- return /* @__PURE__ */ T(
403
- je.Provider,
480
+ const { data: s } = et(
481
+ { projectName: t },
482
+ { skip: !t }
483
+ ), { user: o } = me();
484
+ return /* @__PURE__ */ A(
485
+ Be.Provider,
404
486
  {
405
487
  value: {
406
- ...o,
407
- projectName: n,
408
- project: i,
409
- user: u,
410
- toast: s
488
+ ...e,
489
+ projectName: t,
490
+ project: s,
491
+ user: o,
492
+ toast: n
411
493
  },
412
- children: d
494
+ children: r
413
495
  }
414
496
  );
415
- }, qt = ({ children: d, ...n }) => /* @__PURE__ */ T(Me.Provider, { value: { ...n }, children: d }), pe = "powerpack-license", gt = () => {
497
+ }, Xt = ({ children: r, ...t }) => /* @__PURE__ */ A(_e.Provider, { value: { ...t }, children: r }), he = "powerpack-license", wt = () => {
416
498
  try {
417
- const d = localStorage.getItem(pe);
418
- return d === null ? null : d === "true";
499
+ const r = localStorage.getItem(he);
500
+ return r === null ? null : r === "true";
419
501
  } catch {
420
502
  return null;
421
503
  }
422
- }, ht = (d) => {
504
+ }, St = (r) => {
423
505
  try {
424
- localStorage.setItem(pe, String(d));
506
+ localStorage.setItem(he, String(r));
425
507
  } catch {
426
508
  }
427
- }, Ht = ({
428
- children: d,
429
- debug: n
509
+ }, Zt = ({
510
+ children: r,
511
+ debug: t
430
512
  }) => {
431
- const [s, o] = C(null), [i, u] = C(null), m = (t) => t !== null && typeof t == "object" && "addon" in t, w = L((t) => {
432
- t === null ? (o(null), u(null)) : m(t) ? (o(null), u(t)) : (u(null), o(t));
433
- }, []), S = (t) => t ? at[t] : null, y = (t) => {
434
- if (!t) return null;
435
- const h = ft[t.addon];
436
- return h ? { ...h, selectedFeature: t.feature } : null;
437
- }, [a, c] = C(!1), [e] = C(gt), [l, P] = C(!0), I = async () => !1, [p, { isLoaded: v, isLoading: g }] = ue({
513
+ const [n, e] = y(null), [s, o] = y(null), i = (l) => l !== null && typeof l == "object" && "addon" in l, u = D((l) => {
514
+ l === null ? (e(null), o(null)) : i(l) ? (e(null), o(l)) : (o(null), e(l));
515
+ }, []), v = (l) => l ? ut[l] : null, b = (l) => {
516
+ if (!l) return null;
517
+ const x = Pt[l.addon];
518
+ return x ? { ...x, selectedFeature: l.feature } : null;
519
+ }, [h, c] = y(!1), [a] = y(wt), [p, f] = y(!0), P = async () => !1, [m, { isLoaded: L, isLoading: C }] = ve({
438
520
  addon: "powerpack",
439
521
  remote: "license",
440
522
  module: "checkPowerLicense",
441
- fallback: I
523
+ fallback: P
442
524
  });
443
- U(() => {
525
+ F(() => {
444
526
  (async () => {
445
- if (n?.powerLicense !== void 0)
446
- console.warn("Using debug power license:", n.powerLicense), c(n.powerLicense), P(!1);
447
- else if (v || !g) {
527
+ if (t?.powerLicense !== void 0)
528
+ console.warn("Using debug power license:", t.powerLicense), c(t.powerLicense), f(!1);
529
+ else if (L || !C) {
448
530
  try {
449
- const h = await p();
450
- c(h), ht(h);
451
- } catch (h) {
452
- console.error("Error checking power license:", h), c(!1);
531
+ const x = await m();
532
+ c(x), St(x);
533
+ } catch (x) {
534
+ console.error("Error checking power license:", x), c(!1);
453
535
  } finally {
454
- P(!1);
536
+ f(!1);
455
537
  }
456
- P(!1);
538
+ f(!1);
457
539
  }
458
540
  })();
459
- }, [n, v, g, p]);
460
- const f = A(
541
+ }, [t, L, C, m]);
542
+ const k = B(
461
543
  () => ({
462
- powerLicense: a,
463
- isLoading: l,
464
- storedLicense: e,
465
- selectedPowerPack: s,
466
- selectedAddon: i,
467
- setPowerpackDialog: w,
468
- powerpackDialog: S(s),
469
- addonDialog: y(i)
544
+ powerLicense: h,
545
+ isLoading: p,
546
+ storedLicense: a,
547
+ selectedPowerPack: n,
548
+ selectedAddon: s,
549
+ setPowerpackDialog: u,
550
+ powerpackDialog: v(n),
551
+ addonDialog: b(s)
470
552
  }),
471
- [a, s, i, w, l, e]
553
+ [h, n, s, u, p, a]
472
554
  );
473
- return /* @__PURE__ */ T(Re.Provider, { value: f, children: d });
474
- }, zt = ({ children: d, skip: n = !1 }) => {
555
+ return /* @__PURE__ */ A(Ge.Provider, { value: k, children: r });
556
+ }, Jt = ({ children: r, skip: t = !1 }) => {
475
557
  const {
476
- data: s = {},
477
- isLoading: o,
478
- error: i
479
- } = ze({ full: !0 }, { skip: n }), { data: u, isLoading: m, error: w } = Ye(), {
480
- data: S = [],
481
- isLoading: y,
482
- error: a
483
- } = Ke({}, { skip: n }), c = A(() => S.filter((I) => I.active), [S]), {
484
- data: e,
485
- isLoading: l,
486
- error: P
487
- } = Xe(void 0, { skip: !u?.name });
488
- return /* @__PURE__ */ T(
489
- Ue.Provider,
558
+ data: n = {},
559
+ isLoading: e,
560
+ error: s
561
+ } = tt({ full: !0 }, { skip: t }), { data: o, isLoading: i, error: u } = nt(), {
562
+ data: v = [],
563
+ isLoading: b,
564
+ error: h
565
+ } = ot({}, { skip: t }), c = B(() => v.filter((P) => P.active), [v]), {
566
+ data: a,
567
+ isLoading: p,
568
+ error: f
569
+ } = st(void 0, { skip: !o?.name });
570
+ return /* @__PURE__ */ A(
571
+ qe.Provider,
490
572
  {
491
573
  value: {
492
- siteInfo: s,
493
- attributes: s?.attributes || [],
494
- user: u,
495
- cloudInfo: e,
574
+ siteInfo: n,
575
+ attributes: n?.attributes || [],
576
+ user: o,
577
+ cloudInfo: a,
496
578
  projects: {
497
- all: S,
579
+ all: v,
498
580
  active: c
499
581
  },
500
582
  isLoading: {
501
- siteInfo: o,
502
- user: m,
503
- cloudInfo: l,
504
- projects: y
583
+ siteInfo: e,
584
+ user: i,
585
+ cloudInfo: p,
586
+ projects: b
505
587
  },
506
588
  error: {
507
- siteInfo: i,
508
- user: w,
509
- cloudInfo: P,
510
- projects: a
589
+ siteInfo: s,
590
+ user: u,
591
+ cloudInfo: f,
592
+ projects: h
511
593
  }
512
594
  },
513
- children: d
595
+ children: r
514
596
  }
515
597
  );
516
- }, Yt = ({
517
- projectName: d,
518
- children: n
519
- }) => {
520
- const {
521
- data: { folders: s = [] } = {},
522
- isLoading: o,
523
- isFetching: i,
524
- isSuccess: u,
525
- isUninitialized: m,
526
- error: w,
527
- refetch: S
528
- } = Ze({ projectName: d, attrib: !0 }), y = dt({ projectName: d }, i || o), a = A(() => {
529
- const f = /* @__PURE__ */ new Map();
530
- for (const t of s)
531
- f.set(t.id, t);
532
- return f;
533
- }, [s]), c = A(() => (f) => a.get(f), [a]), e = A(
534
- () => (f, t, h = {}) => {
535
- if (!t.length) return {};
536
- const b = {}, E = new Set(t), O = /* @__PURE__ */ new Set();
537
- let F = f;
538
- for (; E.size > 0 && F && !O.has(F); ) {
539
- O.add(F);
540
- const r = a.get(F);
541
- if (!r) break;
542
- const x = r.attrib || {};
543
- for (const D of Array.from(E))
544
- r.ownAttrib?.includes(D) && D in x && (b[D] = Object.entries(x).find(
545
- ([j]) => j === D
546
- )?.[1], E.delete(D));
547
- F = r.parentId;
548
- }
549
- for (const r of Array.from(E))
550
- r in h && (b[r] = h[r], E.delete(r));
551
- for (const r of E)
552
- b[r] = null;
553
- return b;
598
+ }, en = ({ children: r }) => {
599
+ const t = location.pathname, [n, e] = y(lt), s = ["projects", "settings", "manageProjects", "dashboard/tasks"];
600
+ F(() => {
601
+ s.some((p) => t.startsWith(`/${p}`)) || e("");
602
+ }, [t, e]);
603
+ const { type: o, entity: i, settings: u } = dt(n), v = D(
604
+ ({ projectName: a, folderPath: p, taskName: f, productName: P, versionName: m }) => {
605
+ const L = ct({ projectName: a, folderPath: p, taskName: f, productName: P, versionName: m });
606
+ e(L);
554
607
  },
555
- [a]
556
- ), l = A(
557
- () => (f) => {
558
- const t = [], h = /* @__PURE__ */ new Set();
559
- let b = f;
560
- for (; b && !h.has(b); ) {
561
- h.add(b);
562
- const E = a.get(b);
563
- if (!E?.parentId) break;
564
- t.push(E.parentId), b = E.parentId;
565
- }
566
- return t;
567
- },
568
- [a]
569
- ), P = A(
570
- () => (f) => {
571
- const t = new Set(f);
572
- return f.filter((h) => !l(h).some((b) => t.has(b)));
573
- },
574
- [l]
575
- ), I = A(() => {
576
- const f = /* @__PURE__ */ new Map();
577
- for (const t of s) {
578
- if (!t.parentId) continue;
579
- const h = f.get(t.parentId);
580
- h ? h.push(t.id) : f.set(t.parentId, [t.id]);
581
- }
582
- return f;
583
- }, [s]), p = A(
584
- () => (f, t = !1) => {
585
- const h = t ? [...f] : [], b = [...f];
586
- for (; b.length > 0; ) {
587
- const E = b.shift();
588
- for (const O of I.get(E) || [])
589
- h.push(O), b.push(O);
590
- }
591
- return h;
592
- },
593
- [I]
594
- ), v = () => S().unwrap(), g = A(
595
- () => ({
596
- folders: s,
597
- getFolderById: c,
598
- findNonInheritedValues: e,
599
- getParentFolderIds: l,
600
- getFolderIdsWithoutChildren: P,
601
- getChildFolderIds: p,
602
- isLoading: y,
603
- // first time and when args change
604
- isFetching: i,
605
- // any background fetching
606
- isSuccess: u,
607
- isUninitialized: m,
608
- error: w,
609
- refetch: v
610
- }),
611
- [
612
- s,
613
- c,
614
- e,
615
- l,
616
- P,
617
- p,
618
- y,
619
- i,
620
- u,
621
- m,
622
- w,
623
- v
624
- ]
625
- );
626
- return /* @__PURE__ */ T(Ne.Provider, { value: g, children: n });
627
- }, Kt = ({ children: d }) => {
628
- const n = location.pathname, [s, o] = C(nt), i = ["projects", "settings", "manageProjects", "dashboard/tasks"];
629
- U(() => {
630
- i.some((l) => n.startsWith(`/${l}`)) || o("");
631
- }, [n, o]);
632
- const { type: u, entity: m, settings: w } = st(s), S = L(
633
- ({ projectName: e, folderPath: l, taskName: P, productName: I, versionName: p }) => {
634
- const v = rt({ projectName: e, folderPath: l, taskName: P, productName: I, versionName: p });
635
- o(v);
636
- },
637
- [o]
638
- ), [y] = Je(), a = L(async () => {
639
- if (u !== "entity" || !s) return [];
608
+ [e]
609
+ ), [b] = rt(), h = D(async () => {
610
+ if (o !== "entity" || !n) return [];
640
611
  try {
641
- const e = await y({ resolveRequestModel: { uris: [s] } }).unwrap();
642
- return console.log("Resolved entity from URI:", e), e;
643
- } catch (e) {
644
- return console.warn("Failed to resolve URI:", e), [];
612
+ const a = await b({ resolveRequestModel: { uris: [n] } }).unwrap();
613
+ return console.log("Resolved entity from URI:", a), a;
614
+ } catch (a) {
615
+ return console.warn("Failed to resolve URI:", a), [];
645
616
  }
646
- }, [y, s, u]), c = {
647
- uri: s,
648
- uriType: u,
649
- entity: m,
650
- settings: w,
651
- setUri: o,
652
- setEntityUri: S,
653
- getUriEntities: a
617
+ }, [b, n, o]), c = {
618
+ uri: n,
619
+ uriType: o,
620
+ entity: i,
621
+ settings: u,
622
+ setUri: e,
623
+ setEntityUri: v,
624
+ getUriEntities: h
654
625
  };
655
- return /* @__PURE__ */ T($e.Provider, { value: c, children: d });
656
- }, ae = [
626
+ return /* @__PURE__ */ A(Ve.Provider, { value: c, children: r });
627
+ }, ue = [
657
628
  "representation",
658
629
  "version",
659
630
  "workfile",
660
631
  "product",
661
632
  "task",
662
633
  "folder"
663
- ], vt = "delete-folder-with-children", Xt = ({ children: d }) => {
664
- const [n] = et(), [s] = tt(), [o, i] = C(null), [u, m] = C(null), w = L(
665
- (c) => new Promise((e) => m({ payload: c, resolve: e })),
634
+ ], Ct = "delete-folder-with-children", tn = ({ children: r }) => {
635
+ const [t] = at(), [n] = it(), [e, s] = y(null), [o, i] = y(null), u = D(
636
+ (c) => new Promise((a) => i({ payload: c, resolve: a })),
666
637
  []
667
- ), S = L(
668
- async (c, e) => {
638
+ ), v = D(
639
+ async (c, a) => {
669
640
  if (!c || c.length === 0) {
670
- M.error("No entities selected");
641
+ U.error("No entities selected");
671
642
  return;
672
643
  }
673
- const l = /* @__PURE__ */ new Set(), P = c.filter((r) => !r?.id || l.has(r.id) ? !1 : (l.add(r.id), !0));
674
- if (P.length === 0) {
675
- M.error("No entities found");
644
+ const p = /* @__PURE__ */ new Set(), f = c.filter((d) => !d?.id || p.has(d.id) ? !1 : (p.add(d.id), !0));
645
+ if (f.length === 0) {
646
+ U.error("No entities found");
676
647
  return;
677
648
  }
678
- const I = new Set(P.map((r) => r.id)), p = P.filter((r) => r.entityType === "folder" && r.parentId ? !I.has(r.parentId) : (r.entityType === "task" || r.entityType === "product") && r.folderId ? !I.has(r.folderId) : !0), v = async (r, x) => {
679
- if (r.length === 0) return;
680
- const D = /* @__PURE__ */ new Map();
681
- for (const j of r) {
682
- const N = D.get(j.projectName) || [];
683
- N.push(j), D.set(j.projectName, N);
649
+ const P = new Set(f.map((d) => d.id)), m = f.filter((d) => d.entityType === "folder" && d.parentId ? !P.has(d.parentId) : (d.entityType === "task" || d.entityType === "product") && d.folderId ? !P.has(d.folderId) : !0), L = async (d, E) => {
650
+ if (d.length === 0) return;
651
+ const R = /* @__PURE__ */ new Map();
652
+ for (const w of d) {
653
+ const g = R.get(w.projectName) || [];
654
+ g.push(w), R.set(w.projectName, g);
684
655
  }
685
656
  await Promise.all(
686
- Array.from(D.entries()).map(([j, N]) => {
687
- const z = [...N].sort(
688
- ($, Y) => ae.indexOf($.entityType) - ae.indexOf(Y.entityType)
689
- ).map(($) => ({
657
+ Array.from(R.entries()).map(([w, g]) => {
658
+ const $ = [...g].sort(
659
+ (O, H) => ue.indexOf(O.entityType) - ue.indexOf(H.entityType)
660
+ ).map((O) => ({
690
661
  type: "delete",
691
- entityType: $.entityType,
692
- entityId: $.id,
693
- force: x
662
+ entityType: O.entityType,
663
+ entityId: O.id,
664
+ force: E
694
665
  }));
695
- return n({
696
- operationsRequestModel: { operations: z },
697
- projectName: j
666
+ return t({
667
+ operationsRequestModel: { operations: $ },
668
+ projectName: w
698
669
  }).unwrap();
699
670
  })
700
671
  );
701
- }, g = async () => {
672
+ }, C = async () => {
702
673
  try {
703
- await v(p, !1), e?.onSuccess?.();
704
- } catch (r) {
705
- throw { message: Qe(r) || "Failed to delete entities", ...r };
674
+ await L(m, !1), a?.onSuccess?.();
675
+ } catch (d) {
676
+ throw { message: Ke(d) || "Failed to delete entities", ...d };
706
677
  }
707
- }, f = () => v(
708
- p.filter((r) => r.entityType === "folder" || r.entityType === "task"),
678
+ }, k = () => L(
679
+ m.filter((d) => d.entityType === "folder" || d.entityType === "task"),
709
680
  !0
710
- ), t = p.filter((r) => r.entityType === "folder");
711
- let h = [];
712
- if (t.length > 0) {
713
- const r = /* @__PURE__ */ new Map();
714
- for (const x of t) {
715
- const D = r.get(x.projectName) || [];
716
- D.push(x), r.set(x.projectName, D);
681
+ ), l = m.filter((d) => d.entityType === "folder");
682
+ let x = [];
683
+ if (l.length > 0) {
684
+ const d = /* @__PURE__ */ new Map();
685
+ for (const E of l) {
686
+ const R = d.get(E.projectName) || [];
687
+ R.push(E), d.set(E.projectName, R);
717
688
  }
718
689
  try {
719
- h = (await Promise.all(
720
- Array.from(r.entries()).map(
721
- ([D, j]) => s({
722
- projectName: D,
723
- folderIds: j.map((N) => N.id)
690
+ x = (await Promise.all(
691
+ Array.from(d.entries()).map(
692
+ ([R, w]) => n({
693
+ projectName: R,
694
+ folderIds: w.map((g) => g.id)
724
695
  }).unwrap()
725
696
  )
726
697
  )).flat();
727
- } catch (x) {
728
- console.warn("Failed to fetch folder delete info, falling back to local data", x);
698
+ } catch (E) {
699
+ console.warn("Failed to fetch folder delete info, falling back to local data", E);
729
700
  }
730
701
  }
731
- const b = it(t, h), E = p.filter((r) => r.entityType === "product").length;
732
- E > 0 && b.push(
733
- E > 1 ? "Deleting these products also deletes all their versions" : "Deleting this product also deletes all its versions"
702
+ const T = pt(l, x), M = m.filter((d) => d.entityType === "product").length;
703
+ M > 0 && T.push(
704
+ M > 1 ? "Deleting these products also deletes all their versions" : "Deleting this product also deletes all its versions"
734
705
  );
735
- const O = lt(p), F = p.length === 1 ? p[0] : void 0;
736
- i({
706
+ const _ = ft(m), I = m.length === 1 ? m[0] : void 0;
707
+ s({
737
708
  payload: {
738
- entityLabel: O,
739
- childrenDetails: b,
740
- expectedCounts: ct(p, h),
741
- expectedName: F && (F.label || F.name || F.id)
709
+ entityLabel: _,
710
+ childrenDetails: T,
711
+ expectedCounts: mt(m, x),
712
+ expectedName: I && (I.label || I.name || I.id)
742
713
  },
743
- accept: g,
744
- recover: async (r) => We(r).includes(vt) ? await w({
745
- entityLabel: O,
746
- message: `Are you really sure you want to delete ${O} and all of its dependencies? This cannot be undone. (NOT RECOMMENDED)`,
714
+ accept: C,
715
+ recover: async (d) => ze(d).includes(Ct) ? await u({
716
+ entityLabel: _,
717
+ message: `Are you really sure you want to delete ${_} and all of its dependencies? This cannot be undone. (NOT RECOMMENDED)`,
747
718
  childrenDetails: [],
748
719
  expectedCounts: {},
749
720
  expectedName: "force delete",
750
721
  deleteLabel: "Force delete"
751
- }) ? (await f(), e?.onSuccess?.(), "recovered") : "cancelled" : "unhandled"
722
+ }) ? (await k(), a?.onSuccess?.(), "recovered") : "cancelled" : "unhandled"
752
723
  });
753
724
  },
754
- [n, s, w]
755
- ), y = L(async () => {
756
- if (!o) return;
757
- const { payload: c, accept: e, recover: l } = o;
758
- i(null);
759
- const P = c.entityLabel, I = M.loading(`Deleting ${P}...`, { autoClose: !1 }), p = () => M.update(I, {
760
- render: `${P} deleted`,
725
+ [t, n, u]
726
+ ), b = D(async () => {
727
+ if (!e) return;
728
+ const { payload: c, accept: a, recover: p } = e;
729
+ s(null);
730
+ const f = c.entityLabel, P = U.loading(`Deleting ${f}...`, { autoClose: !1 }), m = () => U.update(P, {
731
+ render: `${f} deleted`,
761
732
  type: "success",
762
733
  autoClose: 5e3,
763
734
  isLoading: !1
764
735
  });
765
736
  try {
766
- await e(), p();
767
- } catch (v) {
768
- let g = v;
737
+ await a(), m();
738
+ } catch (L) {
739
+ let C = L;
769
740
  try {
770
- const t = await l(v);
771
- if (t === "recovered") return p();
772
- if (t === "cancelled")
773
- return M.update(I, {
774
- render: `${P} was not deleted`,
741
+ const l = await p(L);
742
+ if (l === "recovered") return m();
743
+ if (l === "cancelled")
744
+ return U.update(P, {
745
+ render: `${f} was not deleted`,
775
746
  type: "info",
776
747
  autoClose: 5e3,
777
748
  isLoading: !1
778
749
  });
779
- } catch (t) {
780
- g = t;
750
+ } catch (l) {
751
+ C = l;
781
752
  }
782
- const f = typeof g == "string" ? g : g?.message || g?.error || `Error deleting ${P}`;
783
- M.update(I, {
784
- render: f,
753
+ const k = typeof C == "string" ? C : C?.message || C?.error || `Error deleting ${f}`;
754
+ U.update(P, {
755
+ render: k,
785
756
  type: "error",
786
757
  autoClose: 5e3,
787
758
  isLoading: !1
788
759
  });
789
760
  }
790
- }, [o]), a = A(() => ({ deleteEntities: S }), [S]);
791
- return /* @__PURE__ */ ie(_e.Provider, { value: a, children: [
792
- d,
793
- o && /* @__PURE__ */ T(
794
- re,
761
+ }, [e]), h = B(() => ({ deleteEntities: v }), [v]);
762
+ return /* @__PURE__ */ pe(Qe.Provider, { value: h, children: [
763
+ r,
764
+ e && /* @__PURE__ */ A(
765
+ ie,
795
766
  {
796
- payload: o.payload,
797
- onConfirm: y,
798
- onCancel: () => i(null)
767
+ payload: e.payload,
768
+ onConfirm: b,
769
+ onCancel: () => s(null)
799
770
  }
800
771
  ),
801
- u && /* @__PURE__ */ T(
802
- re,
772
+ o && /* @__PURE__ */ A(
773
+ ie,
803
774
  {
804
- payload: u.payload,
775
+ payload: o.payload,
805
776
  onConfirm: () => {
806
- m(null), u.resolve(!0);
777
+ i(null), o.resolve(!0);
807
778
  },
808
779
  onCancel: () => {
809
- m(null), u.resolve(!1);
780
+ i(null), o.resolve(!1);
810
781
  }
811
782
  }
812
783
  )
813
784
  ] });
814
- }, yt = "powerpack", Pt = "tableExport", bt = "TableExportApp", wt = "1.6.9", Zt = ({ children: d }) => {
815
- const [n, s] = C(null), [, o] = ut(), { powerLicense: i, setPowerpackDialog: u } = Z(), { modules: m } = Be(), w = m.some(
816
- (e) => e.addonName === yt && e.modules[Pt]?.includes(bt)
817
- ), S = !!i && w, y = L((e) => (s(e), () => s((l) => l === e ? null : l)), []), a = L(
818
- (e) => {
819
- if (!i) return u("tableExport");
820
- if (!w)
821
- return void M.error("Update to Power Pack " + wt + " to export tables");
822
- o((l) => (l.set(Ge, e), l));
785
+ }, Et = "powerpack", kt = "tableExport", xt = "TableExportApp", Lt = "1.6.9", nn = ({ children: r }) => {
786
+ const [t, n] = y(null), [, e] = gt(), { powerLicense: s, isLoading: o, setPowerpackDialog: i } = te(), { modules: u } = We(), [v, b] = y(null), h = u.some(
787
+ (P) => P.addonName === Et && P.modules[kt]?.includes(xt)
788
+ ), c = (!!s || o) && h, a = D((P) => (n(P), () => n((m) => m === P ? null : m)), []), p = D(
789
+ (P) => {
790
+ if (o) return b(P);
791
+ if (!s) return i("tableExport");
792
+ if (!h)
793
+ return void U.error("Update to Power Pack " + Lt + " to export tables");
794
+ e((m) => (m.set(He, P), m));
823
795
  },
824
- [i, w, u, o]
825
- ), c = A(
826
- () => ({ source: n, isAvailable: S, openExport: a, registerSource: y }),
827
- [n, S, a, y]
796
+ [o, s, h, i, e]
797
+ );
798
+ F(() => {
799
+ !v || o || (b(null), p(v));
800
+ }, [v, o, p]);
801
+ const f = B(
802
+ () => ({ source: t, isAvailable: c, openExport: p, registerSource: a }),
803
+ [t, c, p, a]
828
804
  );
829
- return /* @__PURE__ */ T(Ve.Provider, { value: c, children: d });
805
+ return /* @__PURE__ */ A(Ye.Provider, { value: f, children: r });
830
806
  };
831
807
  export {
832
- Me as AddonContext,
833
- je as AddonProjectContext,
834
- Qt as AddonProjectProvider,
835
- qt as AddonProvider,
836
- _e as DeleteEntitiesContext,
837
- Xt as DeleteEntitiesProvider,
838
- Te as DetailsPanelContext,
839
- Bt as DetailsPanelProvider,
840
- to as EntityUpdatesContext,
841
- qo as EntityUpdatesProvider,
842
- Ho as FORCE_AUTO_SYNC,
843
- Ue as GlobalContext,
844
- zt as GlobalProvider,
845
- oo as MenuContext,
846
- Wo as MenuProvider,
847
- Oe as PiPContext,
848
- Wt as PiPProvider,
849
- no as PiPWrapper,
850
- Re as PowerpackContext,
851
- Ht as PowerpackProvider,
852
- so as ProjectContext,
853
- $o as ProjectContextProvider,
854
- Ne as ProjectFoldersContext,
855
- Yt as ProjectFoldersContextProvider,
856
- Ce as RemoteModulesContext,
857
- _t as RemoteModulesProvider,
858
- Fe as SettingsPanelContext,
859
- Vt as SettingsPanelProvider,
860
- ro as SocketContext,
861
- ao as SocketProvider,
862
- Ae as SubtasksModulesContext,
863
- Gt as SubtasksModulesProvider,
864
- Ge as TABLE_EXPORT_SEARCH_PARAM,
865
- Le as TABS_BY_SCOPE_KEY,
866
- Ve as TableExportContext,
867
- Zt as TableExportProvider,
868
- io as ThumbnailUploadContext,
869
- _o as ThumbnailUploadProvider,
870
- $e as URIContext,
871
- Kt as URIProvider,
872
- Uo as URL_PARAM_ID,
873
- ft as addonConfigs,
874
- lo as getActivityFrameLink,
875
- co as getAutoSyncForTopic,
876
- uo as getUpdateType,
877
- po as isAddonDetailsPanelTab,
878
- fo as isDeletableEntityType,
879
- xe as isDetailsPanelTab,
880
- mo as matchesProject,
881
- go as matchesTopic,
882
- Go as powerpackFeatureOrder,
883
- at as powerpackFeatures,
884
- ho as setDetailsPanelTabForScope,
885
- vo as toggleSyncAll,
886
- yo as useAddonContext,
887
- Po as useAddonProjectContext,
888
- bo as useAutoSyncSettings,
889
- wo as useDeleteEntitiesContext,
890
- So as useDeleteEntitiesContextOptional,
891
- Co as useDetailsPanelContext,
892
- de as useGlobalContext,
893
- Io as useMenuContext,
894
- Eo as useOptionalProjectContext,
895
- ko as usePiPWindow,
896
- Z as usePowerpack,
897
- Lo as useProjectContext,
898
- xo as useProjectFoldersContext,
899
- Be as useRemoteModules,
900
- Do as useScopedDetailsPanel,
901
- To as useSettingsPanel,
902
- Ao as useSocketContext,
903
- Fo as useSubtasksModulesContext,
904
- Oo as useSyncUpdates,
905
- jo as useTableExportContext,
906
- Mo as useThumbnailUploadContext,
907
- De as useURIContext
808
+ _e as AddonContext,
809
+ Be as AddonProjectContext,
810
+ Kt as AddonProjectProvider,
811
+ Xt as AddonProvider,
812
+ Qe as DeleteEntitiesContext,
813
+ tn as DeleteEntitiesProvider,
814
+ Me as DetailsPanelContext,
815
+ Wt as DetailsPanelProvider,
816
+ rn as EntityUpdatesContext,
817
+ an as EntityUpdatesProvider,
818
+ ln as FORCE_AUTO_SYNC,
819
+ qe as GlobalContext,
820
+ Jt as GlobalProvider,
821
+ dn as MenuContext,
822
+ Xn as MenuProvider,
823
+ Ne as PiPContext,
824
+ zt as PiPProvider,
825
+ cn as PiPWrapper,
826
+ Ge as PowerpackContext,
827
+ Zt as PowerpackProvider,
828
+ un as ProjectContext,
829
+ Jn as ProjectContextProvider,
830
+ pn as ProjectFoldersContext,
831
+ eo as ProjectFoldersContextProvider,
832
+ Ie as RemoteModulesContext,
833
+ Qt as RemoteModulesProvider,
834
+ $e as SettingsPanelContext,
835
+ Yt as SettingsPanelProvider,
836
+ fn as SocketContext,
837
+ mn as SocketProvider,
838
+ Ue as SubtasksModulesContext,
839
+ Ht as SubtasksModulesProvider,
840
+ He as TABLE_EXPORT_SEARCH_PARAM,
841
+ Oe as TABS_BY_SCOPE_KEY,
842
+ Ye as TableExportContext,
843
+ nn as TableExportProvider,
844
+ gn as ThumbnailUploadContext,
845
+ Hn as ThumbnailUploadProvider,
846
+ Ve as URIContext,
847
+ en as URIProvider,
848
+ Qn as URL_PARAM_ID,
849
+ Pt as addonConfigs,
850
+ vn as getActivityFrameLink,
851
+ hn as getAutoSyncForTopic,
852
+ yn as getUpdateType,
853
+ Pn as isAddonDetailsPanelTab,
854
+ bn as isDeletableEntityType,
855
+ Re as isDetailsPanelTab,
856
+ wn as matchesProject,
857
+ Sn as matchesTopic,
858
+ zn as powerpackFeatureOrder,
859
+ ut as powerpackFeatures,
860
+ Cn as setDetailsPanelTabForScope,
861
+ En as toggleSyncAll,
862
+ kn as useAddonContext,
863
+ xn as useAddonProjectContext,
864
+ Ln as useAutoSyncSettings,
865
+ Dn as useDeleteEntitiesContext,
866
+ In as useDeleteEntitiesContextOptional,
867
+ jn as useDetailsPanelContext,
868
+ me as useGlobalContext,
869
+ Tn as useMenuContext,
870
+ An as useOptionalProjectContext,
871
+ On as useOptionalProjectFoldersContext,
872
+ Rn as usePiPWindow,
873
+ te as usePowerpack,
874
+ Fn as useProjectContext,
875
+ Mn as useProjectFoldersContext,
876
+ We as useRemoteModules,
877
+ Un as useScopedDetailsPanel,
878
+ $n as useSettingsPanel,
879
+ Nn as useSocketContext,
880
+ Bn as useSubtasksModulesContext,
881
+ _n as useSyncUpdates,
882
+ Gn as useTableExportContext,
883
+ qn as useThumbnailUploadContext,
884
+ Fe as useURIContext
908
885
  };