@floegence/floe-webapp-core 0.36.44 → 0.36.47

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.
@@ -1,35 +1,43 @@
1
- import { createSignal as tt, createMemo as u, onCleanup as we } from "solid-js";
2
- import { ArrowUp as ht, Copy as j, Trash as L, MessageSquare as xt, Region as bt, TextTool as me } from "../icons/index.js";
3
- import { WORKBENCH_STICKY_FILTER_ID as he } from "./types.js";
4
- import { WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as xe, WORKBENCH_DEFAULT_TEXT_COLOR as be, WORKBENCH_DEFAULT_TEXT_FONT as St, WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as Se, WORKBENCH_DEFAULT_REGION_FILL as We, WORKBENCH_STICKY_NOTE_COLORS as Oe, WORKBENCH_BACKGROUND_MATERIALS as Te } from "./workbenchOptions.js";
5
- import { createContextMenuPosition as Ce, createWorkbenchId as x, createWorkbenchViewportCenteredOnWidget as Wt, findNearestWidget as Ne, sanitizeFilters as Ae, WORKBENCH_CONTEXT_MENU_WIDTH_PX as Ie, estimateContextMenuHeight as De, clampScale as je, WORKBENCH_CANVAS_ZOOM_STEP as Ot, WORKBENCH_MIN_SCALE as Le, createWorkbenchViewportFitForWidget as ze } from "./workbenchHelpers.js";
6
- import { resolveWorkbenchWidgetDefinitions as Fe, getWidgetEntry as Tt } from "./widgets/widgetRegistry.js";
7
- function At(o, c) {
8
- const r = o.findIndex((l) => l === c);
9
- return o[(r + 1) % o.length] ?? o[0];
1
+ import { createSignal as et, createMemo as u, onCleanup as We } from "solid-js";
2
+ import { ArrowUp as xt, Copy as M, Trash as z, MessageSquare as bt, Region as St, TextTool as Oe } from "../icons/index.js";
3
+ import { WORKBENCH_STICKY_FILTER_ID as Ce } from "./types.js";
4
+ import { WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as Te, WORKBENCH_DEFAULT_TEXT_COLOR as Ne, WORKBENCH_DEFAULT_TEXT_FONT as Wt, WORKBENCH_BACKGROUND_MATERIALS as Lt, WORKBENCH_REGION_FILL_OPTIONS as Ae, WORKBENCH_STICKY_NOTE_COLORS as Ie, WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as Le, WORKBENCH_DEFAULT_REGION_FILL as De } from "./workbenchOptions.js";
5
+ import { resolveWorkbenchModeStrategy as Ot, createContextMenuPosition as je, createWorkbenchId as S, createWorkbenchViewportCenteredOnWidget as Ct, findNearestWidget as Me, sanitizeFilters as ze, WORKBENCH_CONTEXT_MENU_WIDTH_PX as Fe, estimateContextMenuHeight as Re, clampScale as Be, WORKBENCH_MAX_SCALE as pe, WORKBENCH_CANVAS_ZOOM_STEP as Tt, normalizeWorkbenchInteractionMode as Ee, createWorkbenchViewportAtScale as Xe, WORKBENCH_WORK_MIN_SCALE as Ye, createWorkbenchViewportFitForWidget as He } from "./workbenchHelpers.js";
6
+ import { resolveWorkbenchWidgetDefinitions as Ke, getWidgetEntry as Nt } from "./widgets/widgetRegistry.js";
7
+ function Dt(o, c) {
8
+ const s = o.findIndex((a) => a === c);
9
+ return o[(s + 1) % o.length] ?? o[0];
10
10
  }
11
- function Ct(o, c) {
11
+ function F(o, c) {
12
12
  return Number.isFinite(o) && o > 0 ? o : c;
13
13
  }
14
- function Me(o) {
15
- return At(Oe, o);
14
+ function At(o, c, s) {
15
+ const a = String(c ?? "").trim();
16
+ return o.includes(a) ? a : s;
16
17
  }
17
- function Re(o) {
18
- return At(Te, o);
18
+ function Ve(o, c) {
19
+ const s = Number(o);
20
+ return Number.isFinite(s) ? Math.max(0.08, Math.min(1, s)) : c;
19
21
  }
20
- function Nt(o) {
22
+ function Ue(o) {
23
+ return Dt(Ie, o);
24
+ }
25
+ function qe(o) {
26
+ return Dt(Lt, o);
27
+ }
28
+ function It(o) {
21
29
  return !("kind" in o);
22
30
  }
23
- function Be(o, c) {
31
+ function Pe(o, c) {
24
32
  return o.z_index !== c.z_index ? o.z_index - c.z_index : o.created_at_unix_ms !== c.created_at_unix_ms ? o.created_at_unix_ms - c.created_at_unix_ms : o.id.localeCompare(c.id);
25
33
  }
26
- function et(o) {
27
- return o.reduce((c, r) => Math.max(c, r.z_index), 1);
34
+ function nt(o) {
35
+ return o.reduce((c, s) => Math.max(c, s.z_index), 1);
28
36
  }
29
- function Xe(o, c) {
30
- return et([...o, ...c]);
37
+ function Ge(o, c) {
38
+ return nt([...o, ...c]);
31
39
  }
32
- function Ee(o) {
40
+ function $e(o) {
33
41
  return {
34
42
  id: o.id,
35
43
  type: "sticky_note",
@@ -42,47 +50,47 @@ function Ee(o) {
42
50
  created_at_unix_ms: o.created_at_unix_ms
43
51
  };
44
52
  }
45
- function Ye(o, c, r) {
46
- const l = Date.now();
53
+ function Ze(o, c, s) {
54
+ const a = Date.now();
47
55
  return {
48
- id: x(),
56
+ id: S(),
49
57
  kind: "sticky_note",
50
58
  body: "Capture the thought, decision, or next step here.",
51
- color: xe,
59
+ color: Te,
52
60
  x: o - 130,
53
61
  y: c - 92,
54
62
  width: 260,
55
63
  height: 184,
56
- z_index: r,
57
- created_at_unix_ms: l,
58
- updated_at_unix_ms: l
64
+ z_index: s,
65
+ created_at_unix_ms: a,
66
+ updated_at_unix_ms: a
59
67
  };
60
68
  }
61
- function pe(o, c, r, l) {
62
- const y = Date.now(), b = Ct(l?.width, 360), T = Ct(l?.height, 96);
69
+ function ve(o, c, s, a) {
70
+ const _ = Date.now(), y = F(a?.width, 360), w = F(a?.height, 96);
63
71
  return {
64
- id: x(),
72
+ id: S(),
65
73
  kind: "text",
66
74
  text: "Label this area",
67
- font_family: l?.font_family ?? St.fontFamily,
68
- font_size: l?.font_size ?? 30,
69
- font_weight: l?.font_weight ?? St.fontWeight,
70
- color: l?.color ?? be,
71
- align: l?.align ?? "left",
72
- x: o - b / 2,
73
- y: c - T / 2,
74
- width: b,
75
- height: T,
76
- z_index: r,
77
- created_at_unix_ms: y,
78
- updated_at_unix_ms: y
75
+ font_family: a?.font_family ?? Wt.fontFamily,
76
+ font_size: a?.font_size ?? 30,
77
+ font_weight: a?.font_weight ?? Wt.fontWeight,
78
+ color: a?.color ?? Ne,
79
+ align: a?.align ?? "left",
80
+ x: o - y / 2,
81
+ y: c - w / 2,
82
+ width: y,
83
+ height: w,
84
+ z_index: s,
85
+ created_at_unix_ms: _,
86
+ updated_at_unix_ms: _
79
87
  };
80
88
  }
81
- function He(o) {
89
+ function Je(o) {
82
90
  const c = Date.now();
83
91
  return {
84
92
  ...o,
85
- id: x(),
93
+ id: S(),
86
94
  x: o.x + 28,
87
95
  y: o.y + 28,
88
96
  z_index: o.z_index + 1,
@@ -90,28 +98,28 @@ function He(o) {
90
98
  updated_at_unix_ms: c
91
99
  };
92
100
  }
93
- function Ke(o, c, r) {
94
- const l = Date.now();
101
+ function Qe(o, c, s, a) {
102
+ const _ = Date.now(), y = F(a?.width, 560), w = F(a?.height, 360), f = String(a?.name ?? "").trim() || "Focus area";
95
103
  return {
96
- id: x(),
97
- name: "Focus area",
98
- fill: We,
99
- opacity: 0.72,
100
- material: Se,
101
- x: o - 280,
102
- y: c - 180,
103
- width: 560,
104
- height: 360,
105
- z_index: r,
106
- created_at_unix_ms: l,
107
- updated_at_unix_ms: l
104
+ id: S(),
105
+ name: f,
106
+ fill: At(Ae, a?.fill, De),
107
+ opacity: Ve(a?.opacity, 0.72),
108
+ material: At(Lt, a?.material, Le),
109
+ x: o - y / 2,
110
+ y: c - w / 2,
111
+ width: y,
112
+ height: w,
113
+ z_index: s,
114
+ created_at_unix_ms: _,
115
+ updated_at_unix_ms: _
108
116
  };
109
117
  }
110
- function Ve(o) {
118
+ function tn(o) {
111
119
  const c = Date.now();
112
120
  return {
113
121
  ...o,
114
- id: x(),
122
+ id: S(),
115
123
  name: o.name,
116
124
  x: o.x + 36,
117
125
  y: o.y + 36,
@@ -120,42 +128,42 @@ function Ve(o) {
120
128
  updated_at_unix_ms: c
121
129
  };
122
130
  }
123
- function dn(o) {
124
- const [c, r] = tt(null), [l, y] = tt(null), [b, T] = tt({ width: 0, height: 0 });
125
- let f = null, C = null;
126
- const a = o.state, w = u(() => a().widgets), z = u(() => a().stickyNotes ?? []), nt = u(() => a().annotations ?? []), it = u(() => a().backgroundLayers ?? []), m = u(() => a().viewport), It = u(() => a().locked), F = u(() => a().filters), Dt = u(() => a().selectedWidgetId), M = u(() => a().selectedObject ?? (a().selectedWidgetId ? { kind: "widget", id: a().selectedWidgetId } : null)), R = u(() => a().mode ?? "work"), ot = u(() => a().activeTool ?? "select"), jt = u(() => a().theme), S = u(() => Xe(w(), z())), Lt = u(() => `${Math.round(m().scale * 100)}%`), zt = () => typeof o.widgetDefinitions == "function" ? o.widgetDefinitions() : o.widgetDefinitions, Ft = () => typeof o.textAnnotationDefaults == "function" ? o.textAnnotationDefaults() : o.textAnnotationDefaults, W = u(
127
- () => Fe(zt())
128
- ), B = (e, t) => {
129
- const n = Number.isFinite(e) && e > 0 ? e : 0, i = Number.isFinite(t) && t > 0 ? t : 0, d = { width: n, height: i }, k = b();
130
- return k.width === n && k.height === i ? k : (T(d), d);
131
- }, dt = () => {
132
- C?.disconnect(), C = null;
133
- }, _ = () => f ? B(f.clientWidth, f.clientHeight) : B(0, 0), Mt = (e) => {
131
+ function _n(o) {
132
+ const [c, s] = et(null), [a, _] = et(null), [y, w] = et({ width: 0, height: 0 });
133
+ let f = null, T = null;
134
+ const r = o.state, x = u(() => r().widgets), R = u(() => r().stickyNotes ?? []), it = u(() => r().annotations ?? []), ot = u(() => r().backgroundLayers ?? []), h = u(() => r().viewport), jt = u(() => r().locked), B = u(() => r().filters), Mt = u(() => r().selectedWidgetId), p = u(() => r().selectedObject ?? (r().selectedWidgetId ? { kind: "widget", id: r().selectedWidgetId } : null)), N = u(() => r().mode ?? "work"), zt = u(() => Ot(N())), dt = u(() => r().activeTool ?? "select"), Ft = u(() => r().theme), W = u(() => Ge(x(), R())), Rt = u(() => `${Math.round(h().scale * 100)}%`), Bt = () => typeof o.widgetDefinitions == "function" ? o.widgetDefinitions() : o.widgetDefinitions, pt = () => typeof o.textAnnotationDefaults == "function" ? o.textAnnotationDefaults() : o.textAnnotationDefaults, Et = () => typeof o.backgroundLayerDefaults == "function" ? o.backgroundLayerDefaults() : o.backgroundLayerDefaults, O = u(
135
+ () => Ke(Bt())
136
+ ), E = (e, t) => {
137
+ const n = Number.isFinite(e) && e > 0 ? e : 0, i = Number.isFinite(t) && t > 0 ? t : 0, d = { width: n, height: i }, k = y();
138
+ return k.width === n && k.height === i ? k : (w(d), d);
139
+ }, ct = () => {
140
+ T?.disconnect(), T = null;
141
+ }, m = () => f ? E(f.clientWidth, f.clientHeight) : E(0, 0), Xt = (e) => {
134
142
  if (f === (e ?? null)) {
135
- _();
143
+ m();
136
144
  return;
137
145
  }
138
- dt(), f = e ?? null, _(), !(!f || typeof ResizeObserver > "u") && (C = new ResizeObserver((t) => {
146
+ ct(), f = e ?? null, m(), !(!f || typeof ResizeObserver > "u") && (T = new ResizeObserver((t) => {
139
147
  const n = t[0];
140
- B(
148
+ E(
141
149
  n?.contentRect.width ?? f?.clientWidth ?? 0,
142
150
  n?.contentRect.height ?? f?.clientHeight ?? 0
143
151
  );
144
- }), C.observe(f));
152
+ }), T.observe(f));
145
153
  };
146
- we(() => {
147
- dt(), f = null;
154
+ We(() => {
155
+ ct(), f = null;
148
156
  });
149
- const Rt = (e) => {
150
- r({
157
+ const Yt = (e) => {
158
+ s({
151
159
  clientX: e.clientX,
152
160
  clientY: e.clientY,
153
161
  worldX: e.worldX,
154
162
  worldY: e.worldY,
155
- target: { kind: "canvas", mode: R() }
163
+ target: { kind: "canvas", mode: N() }
156
164
  });
157
- }, Bt = (e, t) => {
158
- h(t.id), r({
165
+ }, Ht = (e, t) => {
166
+ b(t.id), s({
159
167
  clientX: e.clientX,
160
168
  clientY: e.clientY,
161
169
  worldX: t.x,
@@ -163,8 +171,8 @@ function dn(o) {
163
171
  target: { kind: "widget", id: t.id },
164
172
  widgetId: t.id
165
173
  });
166
- }, Xt = (e, t) => {
167
- A(t.id), r({
174
+ }, Kt = (e, t) => {
175
+ I(t.id), s({
168
176
  clientX: e.clientX,
169
177
  clientY: e.clientY,
170
178
  worldX: t.x,
@@ -172,24 +180,24 @@ function dn(o) {
172
180
  target: { kind: "sticky_note", id: t.id },
173
181
  widgetId: t.id
174
182
  });
175
- }, Et = (e, t) => {
176
- r({
183
+ }, Vt = (e, t) => {
184
+ s({
177
185
  clientX: e.clientX,
178
186
  clientY: e.clientY,
179
187
  worldX: t.x,
180
188
  worldY: t.y,
181
189
  target: { kind: "annotation", id: t.id }
182
190
  });
183
- }, Yt = (e, t) => {
184
- r({
191
+ }, Ut = (e, t) => {
192
+ s({
185
193
  clientX: e.clientX,
186
194
  clientY: e.clientY,
187
195
  worldX: t.x,
188
196
  worldY: t.y,
189
197
  target: { kind: "background_layer", id: t.id }
190
198
  });
191
- }, s = () => r(null), pt = (e) => a().widgets.find((t) => t.id === e) ?? null, N = (e) => a().widgets.find((t) => t.type === e) ?? null, X = (e) => a().stickyNotes?.find((t) => t.id === e) ?? null, ct = (e) => a().annotations?.find((t) => t.id === e) ?? null, at = (e) => a().backgroundLayers?.find((t) => t.id === e) ?? null, Ht = (e) => e.target ? e.target : e.widgetId ? X(e.widgetId) ? { kind: "sticky_note", id: e.widgetId } : { kind: "widget", id: e.widgetId } : { kind: "canvas", mode: R() }, Kt = (e, t) => {
192
- const n = e.singleton ? N(e.type) : null;
199
+ }, l = () => s(null), qt = (e) => r().widgets.find((t) => t.id === e) ?? null, A = (e) => r().widgets.find((t) => t.type === e) ?? null, X = (e) => r().stickyNotes?.find((t) => t.id === e) ?? null, at = (e) => r().annotations?.find((t) => t.id === e) ?? null, st = (e) => r().backgroundLayers?.find((t) => t.id === e) ?? null, Pt = (e) => e.target ? e.target : e.widgetId ? X(e.widgetId) ? { kind: "sticky_note", id: e.widgetId } : { kind: "widget", id: e.widgetId } : { kind: "canvas", mode: N() }, Gt = (e, t) => {
200
+ const n = e.singleton ? A(e.type) : null;
193
201
  return n ? {
194
202
  id: `goto-${e.type}`,
195
203
  kind: "action",
@@ -199,7 +207,7 @@ function dn(o) {
199
207
  icon: e.icon,
200
208
  existingWidgetId: n.id,
201
209
  onSelect: () => {
202
- O(n, { centerViewport: !0 }), s();
210
+ C(n, { centerViewport: !0 }), l();
203
211
  }
204
212
  } : {
205
213
  id: `add-${e.type}`,
@@ -209,39 +217,39 @@ function dn(o) {
209
217
  label: `Add ${e.label}`,
210
218
  icon: e.icon,
211
219
  onSelect: () => {
212
- Y(e.type, t.worldX, t.worldY), s();
220
+ H(e.type, t.worldX, t.worldY), l();
213
221
  }
214
222
  };
215
- }, st = u(() => {
223
+ }, rt = u(() => {
216
224
  const e = c();
217
225
  if (!e) return [];
218
- const t = Ht(e);
226
+ const t = Pt(e);
219
227
  if (t.kind === "widget") {
220
- const n = w().find((d) => d.id === t.id), i = [];
228
+ const n = x().find((d) => d.id === t.id), i = [];
221
229
  return n && (i.push({
222
230
  id: "bring-to-front",
223
231
  kind: "action",
224
232
  label: "Bring to Front",
225
- icon: ht,
233
+ icon: xt,
226
234
  onSelect: () => {
227
- h(n.id), s();
235
+ b(n.id), l();
228
236
  }
229
237
  }), i.push({
230
238
  id: "duplicate",
231
239
  kind: "action",
232
240
  label: "Duplicate",
233
- icon: j,
241
+ icon: M,
234
242
  onSelect: () => {
235
- rt(n.type, n.x + 32, n.y + 32), s();
243
+ lt(n.type, n.x + 32, n.y + 32), l();
236
244
  }
237
245
  })), i.push({ id: "separator-delete", kind: "separator" }), i.push({
238
246
  id: "delete",
239
247
  kind: "action",
240
248
  label: "Delete",
241
- icon: L,
249
+ icon: z,
242
250
  destructive: !0,
243
251
  onSelect: () => {
244
- p(t.id), s();
252
+ K(t.id), l();
245
253
  }
246
254
  }), i;
247
255
  }
@@ -251,84 +259,84 @@ function dn(o) {
251
259
  id: "bring-to-front",
252
260
  kind: "action",
253
261
  label: "Bring to Front",
254
- icon: ht,
262
+ icon: xt,
255
263
  onSelect: () => {
256
- A(n.id), s();
264
+ I(n.id), l();
257
265
  }
258
266
  }), i.push({
259
267
  id: "copy-content",
260
268
  kind: "action",
261
269
  label: "Copy Content",
262
- icon: j,
270
+ icon: M,
263
271
  onSelect: () => {
264
- typeof navigator < "u" && navigator.clipboard?.writeText(n.body), s();
272
+ typeof navigator < "u" && navigator.clipboard?.writeText(n.body), l();
265
273
  }
266
274
  }), i.push({
267
275
  id: "change-color",
268
276
  kind: "action",
269
277
  label: "Change Color",
270
- icon: xt,
278
+ icon: bt,
271
279
  onSelect: () => {
272
- gt(n.id, { color: Me(n.color) }), s();
280
+ kt(n.id, { color: Ue(n.color) }), l();
273
281
  }
274
282
  })), i.push({ id: "separator-delete", kind: "separator" }), i.push({
275
283
  id: "delete",
276
284
  kind: "action",
277
285
  label: "Delete",
278
- icon: L,
286
+ icon: z,
279
287
  destructive: !0,
280
288
  onSelect: () => {
281
- U(t.id), s();
289
+ P(t.id), l();
282
290
  }
283
291
  }), i;
284
292
  }
285
293
  if (t.kind === "annotation") {
286
- const n = ct(t.id), i = [];
294
+ const n = at(t.id), i = [];
287
295
  return n?.kind === "text" && i.push({
288
296
  id: "duplicate",
289
297
  kind: "action",
290
298
  label: "Duplicate Text",
291
- icon: j,
299
+ icon: M,
292
300
  onSelect: () => {
293
- lt(n), s();
301
+ ut(n), l();
294
302
  }
295
303
  }), i.push({ id: "separator-delete", kind: "separator" }), i.push({
296
304
  id: "delete",
297
305
  kind: "action",
298
306
  label: "Delete Text",
299
- icon: L,
307
+ icon: z,
300
308
  destructive: !0,
301
309
  onSelect: () => {
302
- q(t.id), s();
310
+ G(t.id), l();
303
311
  }
304
312
  }), i;
305
313
  }
306
314
  if (t.kind === "background_layer") {
307
- const n = at(t.id), i = [];
315
+ const n = st(t.id), i = [];
308
316
  return n && (i.push({
309
317
  id: "duplicate",
310
318
  kind: "action",
311
319
  label: "Duplicate Region",
312
- icon: j,
320
+ icon: M,
313
321
  onSelect: () => {
314
- ut(n), s();
322
+ gt(n), l();
315
323
  }
316
324
  }), i.push({
317
325
  id: "change-material",
318
326
  kind: "action",
319
327
  label: "Change Material",
320
- icon: bt,
328
+ icon: St,
321
329
  onSelect: () => {
322
- kt(n.id, { material: Re(n.material) }), s();
330
+ ft(n.id, { material: qe(n.material) }), l();
323
331
  }
324
332
  })), i.push({ id: "separator-delete", kind: "separator" }), i.push({
325
333
  id: "delete",
326
334
  kind: "action",
327
335
  label: "Delete Region",
328
- icon: L,
336
+ icon: z,
329
337
  destructive: !0,
330
338
  onSelect: () => {
331
- P(t.id), s();
339
+ $(t.id), l();
332
340
  }
333
341
  }), i;
334
342
  }
@@ -337,18 +345,18 @@ function dn(o) {
337
345
  id: "create-background-region",
338
346
  kind: "action",
339
347
  label: "Add Region",
340
- icon: bt,
348
+ icon: St,
341
349
  onSelect: () => {
342
- V(e.worldX, e.worldY), s();
350
+ q(e.worldX, e.worldY), l();
343
351
  }
344
352
  },
345
353
  {
346
354
  id: "create-text",
347
355
  kind: "action",
348
356
  label: "Add Text",
349
- icon: me,
357
+ icon: Oe,
350
358
  onSelect: () => {
351
- K(e.worldX, e.worldY), s();
359
+ U(e.worldX, e.worldY), l();
352
360
  }
353
361
  }
354
362
  ] : [
@@ -356,58 +364,58 @@ function dn(o) {
356
364
  id: "create-sticky-note",
357
365
  kind: "action",
358
366
  label: "Add Sticky",
359
- icon: xt,
367
+ icon: bt,
360
368
  onSelect: () => {
361
- H(e.worldX, e.worldY), s();
369
+ V(e.worldX, e.worldY), l();
362
370
  }
363
371
  },
364
- ...W().map((n) => Kt(n, e))
372
+ ...O().map((n) => Gt(n, e))
365
373
  ];
366
- }), Vt = u(() => {
374
+ }), $t = u(() => {
367
375
  const e = c();
368
376
  if (!e) return;
369
- const t = st(), n = t.filter((d) => d.kind === "action").length, i = t.filter((d) => d.kind === "separator").length;
370
- return Ce({
377
+ const t = rt(), n = t.filter((d) => d.kind === "action").length, i = t.filter((d) => d.kind === "separator").length;
378
+ return je({
371
379
  clientX: e.clientX,
372
380
  clientY: e.clientY,
373
- menuWidth: Ie,
374
- menuHeight: De(n, i)
381
+ menuWidth: Fe,
382
+ menuHeight: Re(n, i)
375
383
  });
376
- }), E = (e, t, n) => {
377
- const i = Tt(e, W()), d = i.singleton ? N(e) : null;
384
+ }), Y = (e, t, n) => {
385
+ const i = Nt(e, O()), d = i.singleton ? A(e) : null;
378
386
  if (d)
379
- return O(d, { centerViewport: !0 });
387
+ return C(d, { centerViewport: !0 });
380
388
  const k = i.defaultSize, g = {
381
- id: x(),
389
+ id: S(),
382
390
  type: e,
383
391
  title: i.defaultTitle,
384
392
  x: t,
385
393
  y: n,
386
394
  width: k.width,
387
395
  height: k.height,
388
- z_index: S() + 1,
396
+ z_index: W() + 1,
389
397
  created_at_unix_ms: Date.now()
390
398
  };
391
- return o.setState((D) => ({
392
- ...D,
393
- widgets: [...D.widgets, g],
399
+ return o.setState((j) => ({
400
+ ...j,
401
+ widgets: [...j.widgets, g],
394
402
  selectedWidgetId: g.id,
395
403
  selectedObject: { kind: "widget", id: g.id },
396
404
  mode: "work",
397
405
  activeTool: "select"
398
406
  })), g;
399
- }, Y = (e, t, n) => {
400
- const i = Tt(e, W()).defaultSize;
401
- return E(e, t - i.width / 2, n - i.height / 2);
402
- }, rt = (e, t, n) => E(e, t, n), p = (e) => {
407
+ }, H = (e, t, n) => {
408
+ const i = Nt(e, O()).defaultSize;
409
+ return Y(e, t - i.width / 2, n - i.height / 2);
410
+ }, lt = (e, t, n) => Y(e, t, n), K = (e) => {
403
411
  o.setState((t) => ({
404
412
  ...t,
405
413
  widgets: t.widgets.filter((n) => n.id !== e),
406
414
  selectedWidgetId: t.selectedWidgetId === e ? null : t.selectedWidgetId,
407
415
  selectedObject: t.selectedObject?.kind === "widget" && t.selectedObject.id === e ? null : t.selectedObject ?? null
408
416
  }));
409
- }, H = (e, t) => {
410
- const n = Ye(e, t, S() + 1);
417
+ }, V = (e, t) => {
418
+ const n = Ze(e, t, W() + 1);
411
419
  return o.setState((i) => ({
412
420
  ...i,
413
421
  stickyNotes: [...i.stickyNotes ?? [], n],
@@ -416,12 +424,12 @@ function dn(o) {
416
424
  mode: "work",
417
425
  activeTool: "select"
418
426
  })), n;
419
- }, K = (e, t) => {
420
- const n = pe(
427
+ }, U = (e, t) => {
428
+ const n = ve(
421
429
  e,
422
430
  t,
423
- et(nt()) + 1,
424
- Ft()
431
+ nt(it()) + 1,
432
+ pt()
425
433
  );
426
434
  return o.setState((i) => ({
427
435
  ...i,
@@ -431,8 +439,8 @@ function dn(o) {
431
439
  mode: "background",
432
440
  activeTool: "select"
433
441
  })), n;
434
- }, lt = (e) => {
435
- const t = He(e);
442
+ }, ut = (e) => {
443
+ const t = Je(e);
436
444
  return o.setState((n) => ({
437
445
  ...n,
438
446
  annotations: [...n.annotations ?? [], t],
@@ -441,8 +449,13 @@ function dn(o) {
441
449
  mode: "background",
442
450
  activeTool: "select"
443
451
  })), t;
444
- }, V = (e, t) => {
445
- const n = Ke(e, t, et(it()) + 1);
452
+ }, q = (e, t) => {
453
+ const n = Qe(
454
+ e,
455
+ t,
456
+ nt(ot()) + 1,
457
+ Et()
458
+ );
446
459
  return o.setState((i) => ({
447
460
  ...i,
448
461
  backgroundLayers: [...i.backgroundLayers ?? [], n],
@@ -451,8 +464,8 @@ function dn(o) {
451
464
  mode: "background",
452
465
  activeTool: "select"
453
466
  })), n;
454
- }, ut = (e) => {
455
- const t = Ve(e);
467
+ }, gt = (e) => {
468
+ const t = tn(e);
456
469
  return o.setState((n) => ({
457
470
  ...n,
458
471
  backgroundLayers: [...n.backgroundLayers ?? [], t],
@@ -461,55 +474,55 @@ function dn(o) {
461
474
  mode: "background",
462
475
  activeTool: "select"
463
476
  })), t;
464
- }, Ut = (e) => {
465
- y(e);
466
- }, h = (e) => {
467
- y(e);
468
- const t = S(), n = w().find((i) => i.id === e);
477
+ }, Zt = (e) => {
478
+ _(e);
479
+ }, b = (e) => {
480
+ _(e);
481
+ const t = W(), n = x().find((i) => i.id === e);
469
482
  n && n.z_index < t && o.setState((i) => ({
470
483
  ...i,
471
484
  widgets: i.widgets.map(
472
485
  (d) => d.id === e ? { ...d, z_index: t + 1 } : d
473
486
  )
474
487
  }));
475
- }, A = (e) => {
476
- y(e);
477
- const t = S();
488
+ }, I = (e) => {
489
+ _(e);
490
+ const t = W();
478
491
  o.setState((n) => ({
479
492
  ...n,
480
493
  stickyNotes: (n.stickyNotes ?? []).map(
481
494
  (i) => i.id === e && i.z_index < t ? { ...i, z_index: t + 1, updated_at_unix_ms: Date.now() } : i
482
495
  )
483
496
  }));
484
- }, qt = (e, t) => {
497
+ }, vt = (e, t) => {
485
498
  o.setState((n) => ({
486
499
  ...n,
487
500
  widgets: n.widgets.map(
488
501
  (i) => i.id === e ? { ...i, x: t.x, y: t.y } : i
489
502
  )
490
503
  }));
491
- }, Pt = (e, t) => {
504
+ }, Jt = (e, t) => {
492
505
  o.setState((n) => ({
493
506
  ...n,
494
507
  widgets: n.widgets.map(
495
508
  (i) => i.id === e ? { ...i, width: t.width, height: t.height } : i
496
509
  )
497
510
  }));
498
- }, $t = (e, t) => {
511
+ }, Qt = (e, t) => {
499
512
  o.setState((n) => ({
500
513
  ...n,
501
514
  stickyNotes: (n.stickyNotes ?? []).map(
502
515
  (i) => i.id === e ? { ...i, x: t.x, y: t.y, updated_at_unix_ms: Date.now() } : i
503
516
  )
504
517
  }));
505
- }, Gt = (e, t) => {
518
+ }, te = (e, t) => {
506
519
  o.setState((n) => ({
507
520
  ...n,
508
521
  stickyNotes: (n.stickyNotes ?? []).map(
509
522
  (i) => i.id === e ? { ...i, width: t.width, height: t.height, updated_at_unix_ms: Date.now() } : i
510
523
  )
511
524
  }));
512
- }, gt = (e, t) => {
525
+ }, kt = (e, t) => {
513
526
  o.setState((n) => ({
514
527
  ...n,
515
528
  stickyNotes: (n.stickyNotes ?? []).map(
@@ -521,27 +534,27 @@ function dn(o) {
521
534
  } : i
522
535
  )
523
536
  }));
524
- }, U = (e) => {
537
+ }, P = (e) => {
525
538
  o.setState((t) => ({
526
539
  ...t,
527
540
  stickyNotes: (t.stickyNotes ?? []).filter((n) => n.id !== e),
528
541
  selectedObject: t.selectedObject?.kind === "sticky_note" && t.selectedObject.id === e ? null : t.selectedObject ?? null
529
542
  }));
530
- }, Zt = (e, t) => {
543
+ }, ee = (e, t) => {
531
544
  o.setState((n) => ({
532
545
  ...n,
533
546
  annotations: (n.annotations ?? []).map(
534
547
  (i) => i.id === e ? { ...i, x: t.x, y: t.y, updated_at_unix_ms: Date.now() } : i
535
548
  )
536
549
  }));
537
- }, vt = (e, t) => {
550
+ }, ne = (e, t) => {
538
551
  o.setState((n) => ({
539
552
  ...n,
540
553
  annotations: (n.annotations ?? []).map(
541
554
  (i) => i.id === e ? { ...i, width: t.width, height: t.height, updated_at_unix_ms: Date.now() } : i
542
555
  )
543
556
  }));
544
- }, Jt = (e, t) => {
557
+ }, ie = (e, t) => {
545
558
  o.setState((n) => ({
546
559
  ...n,
547
560
  annotations: (n.annotations ?? []).map(
@@ -557,27 +570,27 @@ function dn(o) {
557
570
  } : i
558
571
  )
559
572
  }));
560
- }, q = (e) => {
573
+ }, G = (e) => {
561
574
  o.setState((t) => ({
562
575
  ...t,
563
576
  annotations: (t.annotations ?? []).filter((n) => n.id !== e),
564
577
  selectedObject: t.selectedObject?.kind === "annotation" && t.selectedObject.id === e ? null : t.selectedObject ?? null
565
578
  }));
566
- }, Qt = (e, t) => {
579
+ }, oe = (e, t) => {
567
580
  o.setState((n) => ({
568
581
  ...n,
569
582
  backgroundLayers: (n.backgroundLayers ?? []).map(
570
583
  (i) => i.id === e ? { ...i, x: t.x, y: t.y, updated_at_unix_ms: Date.now() } : i
571
584
  )
572
585
  }));
573
- }, te = (e, t) => {
586
+ }, de = (e, t) => {
574
587
  o.setState((n) => ({
575
588
  ...n,
576
589
  backgroundLayers: (n.backgroundLayers ?? []).map(
577
590
  (i) => i.id === e ? { ...i, width: t.width, height: t.height, updated_at_unix_ms: Date.now() } : i
578
591
  )
579
592
  }));
580
- }, kt = (e, t) => {
593
+ }, ft = (e, t) => {
581
594
  o.setState((n) => ({
582
595
  ...n,
583
596
  backgroundLayers: (n.backgroundLayers ?? []).map(
@@ -591,31 +604,59 @@ function dn(o) {
591
604
  } : i
592
605
  )
593
606
  }));
594
- }, P = (e) => {
607
+ }, $ = (e) => {
595
608
  o.setState((t) => ({
596
609
  ...t,
597
610
  backgroundLayers: (t.backgroundLayers ?? []).filter((n) => n.id !== e),
598
611
  selectedObject: t.selectedObject?.kind === "background_layer" && t.selectedObject.id === e ? null : t.selectedObject ?? null
599
612
  }));
600
- }, $ = (e) => {
613
+ };
614
+ let Z = 0;
615
+ const v = (e) => {
601
616
  o.setState((t) => ({ ...t, viewport: e }));
602
- }, ft = (e) => {
603
- const t = m(), n = _(), i = (n.width / 2 - t.x) / t.scale, d = (n.height / 2 - t.y) / t.scale, k = je(
604
- e === "in" ? t.scale * Ot : t.scale / Ot
617
+ }, ce = () => {
618
+ Z += 1;
619
+ }, L = (e) => {
620
+ const t = h(), n = t.x, i = t.y, d = t.scale, k = performance.now(), g = 360, j = ++Z, be = (Q) => 1 - Math.pow(1 - Q, 3), wt = (Q) => {
621
+ if (j !== Z) return;
622
+ const Se = Q - k, ht = Math.min(Math.max(Se / g, 0), 1), tt = be(ht);
623
+ v({
624
+ x: n + (e.x - n) * tt,
625
+ y: i + (e.y - i) * tt,
626
+ scale: d + (e.scale - d) * tt
627
+ }), ht < 1 && requestAnimationFrame(wt);
628
+ };
629
+ requestAnimationFrame(wt);
630
+ }, ae = (e) => {
631
+ const t = Ot(e), n = h();
632
+ if (n.scale >= t.minScale) return;
633
+ const i = m();
634
+ L(Xe({
635
+ viewport: n,
636
+ scale: t.minScale,
637
+ minScale: t.minScale,
638
+ frameWidth: i.width,
639
+ frameHeight: i.height
640
+ }));
641
+ }, _t = (e) => {
642
+ const t = h(), n = m(), i = (n.width / 2 - t.x) / t.scale, d = (n.height / 2 - t.y) / t.scale, k = Be(
643
+ e === "in" ? t.scale * Tt : t.scale / Tt,
644
+ zt().minScale,
645
+ pe
605
646
  ), g = {
606
647
  x: n.width / 2 - i * k,
607
648
  y: n.height / 2 - d * k,
608
649
  scale: k
609
650
  };
610
- $(g);
611
- }, ee = () => {
651
+ v(g);
652
+ }, se = () => {
612
653
  o.setState((e) => ({ ...e, locked: !e.locked }));
613
- }, ne = (e) => {
654
+ }, re = (e) => {
614
655
  o.setState((t) => ({
615
656
  ...t,
616
657
  filters: { ...t.filters, [e]: !t.filters[e] }
617
658
  }));
618
- }, ie = (e, t) => {
659
+ }, le = (e, t) => {
619
660
  o.setState((n) => {
620
661
  const i = { ...n.filters }, d = [...new Set(t.map((g) => String(g)).filter(Boolean))], k = d.length > 1 && d.every(
621
662
  (g) => i[g] !== !1 == (g === e)
@@ -624,13 +665,13 @@ function dn(o) {
624
665
  i[g] = k ? !0 : g === e;
625
666
  return { ...n, filters: i };
626
667
  });
627
- }, oe = () => {
628
- const e = W();
668
+ }, ue = () => {
669
+ const e = O();
629
670
  o.setState((t) => ({
630
671
  ...t,
631
- filters: Ae(void 0, e)
672
+ filters: ze(void 0, e)
632
673
  }));
633
- }, I = (e) => {
674
+ }, D = (e) => {
634
675
  o.setState((t) => ({
635
676
  ...t,
636
677
  selectedWidgetId: e,
@@ -638,26 +679,26 @@ function dn(o) {
638
679
  mode: t.mode === "background" ? "work" : t.mode,
639
680
  activeTool: "select"
640
681
  }));
641
- }, _t = () => {
682
+ }, yt = () => {
642
683
  o.setState(
643
684
  (e) => e.selectedWidgetId === null && !e.selectedObject ? e : { ...e, selectedWidgetId: null, selectedObject: null }
644
685
  );
645
- }, de = (e) => {
686
+ }, ge = (e) => {
646
687
  o.setState((t) => ({
647
688
  ...t,
648
689
  selectedObject: e,
649
690
  selectedWidgetId: e?.kind === "widget" ? e.id : null,
650
691
  activeTool: "select"
651
692
  }));
652
- }, yt = (e) => {
693
+ }, mt = (e) => {
653
694
  o.setState((t) => ({
654
695
  ...t,
655
696
  selectedWidgetId: null,
656
697
  selectedObject: { kind: "sticky_note", id: e },
657
698
  mode: "work",
658
699
  activeTool: "select"
659
- })), A(e);
660
- }, ce = (e) => {
700
+ })), I(e);
701
+ }, ke = (e) => {
661
702
  o.setState((t) => ({
662
703
  ...t,
663
704
  selectedWidgetId: null,
@@ -665,7 +706,7 @@ function dn(o) {
665
706
  mode: "background",
666
707
  activeTool: "select"
667
708
  }));
668
- }, ae = (e) => {
709
+ }, fe = (e) => {
669
710
  o.setState((t) => ({
670
711
  ...t,
671
712
  selectedWidgetId: null,
@@ -673,95 +714,80 @@ function dn(o) {
673
714
  mode: "background",
674
715
  activeTool: "select"
675
716
  }));
676
- }, se = (e) => {
677
- const t = e === "annotation" ? "background" : e;
717
+ }, _e = (e) => {
718
+ const t = Ee(e);
678
719
  o.setState((n) => ({
679
720
  ...n,
680
721
  mode: t,
681
722
  activeTool: "select",
682
723
  selectedWidgetId: t === "work" ? n.selectedObject?.kind === "widget" ? n.selectedObject.id : n.selectedWidgetId : null,
683
724
  selectedObject: t === "work" ? n.selectedObject?.kind === "widget" || n.selectedObject?.kind === "sticky_note" ? n.selectedObject : n.selectedWidgetId ? { kind: "widget", id: n.selectedWidgetId } : null : n.selectedObject?.kind === "background_layer" || n.selectedObject?.kind === "annotation" ? n.selectedObject : null
684
- }));
685
- }, re = (e) => {
725
+ })), ae(t);
726
+ }, ye = (e) => {
686
727
  o.setState((t) => ({
687
728
  ...t,
688
729
  activeTool: e,
689
730
  mode: e === "text" || e === "background-region" ? "background" : e === "sticky-note" ? "work" : t.mode ?? "work"
690
731
  }));
691
- }, le = (e, t) => {
692
- const n = ot();
693
- return n === "sticky-note" ? H(e, t) : n === "text" ? K(e, t) : n === "background-region" ? V(e, t) : null;
694
- }, ue = () => {
695
- const e = _(), t = m();
732
+ }, me = (e, t) => {
733
+ const n = dt();
734
+ return n === "sticky-note" ? V(e, t) : n === "text" ? U(e, t) : n === "background-region" ? q(e, t) : null;
735
+ }, we = () => {
736
+ const e = m(), t = h();
696
737
  return {
697
738
  worldX: e.width > 0 ? (e.width / 2 - t.x) / t.scale : 240,
698
739
  worldY: e.height > 0 ? (e.height / 2 - t.y) / t.scale : 180
699
740
  };
700
- };
701
- let G = 0;
702
- const ge = () => {
703
- G += 1;
704
- }, Z = (e) => {
705
- const t = m(), n = t.x, i = t.y, d = t.scale, k = performance.now(), g = 360, D = ++G, _e = (J) => 1 - Math.pow(1 - J, 3), wt = (J) => {
706
- if (D !== G) return;
707
- const ye = J - k, mt = Math.min(Math.max(ye / g, 0), 1), Q = _e(mt);
708
- $({
709
- x: n + (e.x - n) * Q,
710
- y: i + (e.y - i) * Q,
711
- scale: d + (e.scale - d) * Q
712
- }), mt < 1 && requestAnimationFrame(wt);
713
- };
714
- requestAnimationFrame(wt);
715
- }, v = (e) => {
716
- const t = _();
717
- t.width === 0 || t.height === 0 || Z(Wt({
741
+ }, J = (e) => {
742
+ const t = m();
743
+ t.width === 0 || t.height === 0 || L(Ct({
718
744
  widget: e,
719
- scale: m().scale,
745
+ scale: h().scale,
720
746
  frameWidth: t.width,
721
747
  frameHeight: t.height
722
748
  }));
723
- }, ke = (e) => {
724
- const t = _();
725
- t.width === 0 || t.height === 0 || Z(ze({
749
+ }, he = (e) => {
750
+ const t = m();
751
+ t.width === 0 || t.height === 0 || L(He({
726
752
  widget: e,
727
753
  frameWidth: t.width,
728
754
  frameHeight: t.height
729
755
  }));
730
- }, fe = (e) => {
731
- const t = _();
732
- t.width === 0 || t.height === 0 || Z(Wt({
756
+ }, xe = (e) => {
757
+ const t = m();
758
+ t.width === 0 || t.height === 0 || L(Ct({
733
759
  widget: e,
734
- scale: Le,
760
+ scale: Ye,
735
761
  frameWidth: t.width,
736
762
  frameHeight: t.height
737
763
  }));
738
- }, O = (e, t = {}) => (I(e.id), h(e.id), t.centerViewport !== !1 && v(e), e);
764
+ }, C = (e, t = {}) => (D(e.id), b(e.id), t.centerViewport !== !1 && J(e), e);
739
765
  return {
740
- widgets: w,
741
- stickyNotes: z,
742
- annotations: nt,
743
- backgroundLayers: it,
744
- viewport: m,
745
- canvasFrameSize: b,
746
- locked: It,
747
- filters: F,
748
- selectedWidgetId: Dt,
749
- selectedObject: M,
750
- mode: R,
751
- activeTool: ot,
752
- theme: jt,
753
- topZIndex: S,
754
- scaleLabel: Lt,
755
- optimisticFrontWidgetId: l,
756
- widgetDefinitions: W,
757
- setCanvasFrameRef: Mt,
766
+ widgets: x,
767
+ stickyNotes: R,
768
+ annotations: it,
769
+ backgroundLayers: ot,
770
+ viewport: h,
771
+ canvasFrameSize: y,
772
+ locked: jt,
773
+ filters: B,
774
+ selectedWidgetId: Mt,
775
+ selectedObject: p,
776
+ mode: N,
777
+ activeTool: dt,
778
+ theme: Ft,
779
+ topZIndex: W,
780
+ scaleLabel: Rt,
781
+ optimisticFrontWidgetId: a,
782
+ widgetDefinitions: O,
783
+ setCanvasFrameRef: Xt,
758
784
  contextMenu: {
759
785
  state: c,
760
- items: st,
761
- position: Vt,
762
- close: s,
786
+ items: rt,
787
+ position: $t,
788
+ close: l,
763
789
  retarget: (e) => {
764
- e.preventDefault(), e.stopPropagation(), r({
790
+ e.preventDefault(), e.stopPropagation(), s({
765
791
  clientX: e.clientX,
766
792
  clientY: e.clientY,
767
793
  worldX: 0,
@@ -770,121 +796,121 @@ function dn(o) {
770
796
  }
771
797
  },
772
798
  canvas: {
773
- openCanvasContextMenu: Rt,
774
- openWidgetContextMenu: Bt,
775
- openStickyNoteContextMenu: Xt,
776
- openAnnotationContextMenu: Et,
777
- openBackgroundLayerContextMenu: Yt,
778
- selectWidget: I,
779
- selectObject: de,
780
- selectStickyNote: yt,
781
- selectAnnotation: ce,
782
- selectBackgroundLayer: ae,
783
- clearSelection: _t,
784
- startOptimisticFront: Ut,
785
- commitFront: h,
786
- commitMove: qt,
787
- commitResize: Pt,
788
- commitStickyFront: A,
789
- commitStickyMove: $t,
790
- commitStickyResize: Gt,
791
- commitAnnotationMove: Zt,
792
- commitAnnotationResize: vt,
793
- commitBackgroundMove: Qt,
794
- commitBackgroundResize: te,
795
- commitViewport: $,
796
- cancelViewportNavigation: ge
799
+ openCanvasContextMenu: Yt,
800
+ openWidgetContextMenu: Ht,
801
+ openStickyNoteContextMenu: Kt,
802
+ openAnnotationContextMenu: Vt,
803
+ openBackgroundLayerContextMenu: Ut,
804
+ selectWidget: D,
805
+ selectObject: ge,
806
+ selectStickyNote: mt,
807
+ selectAnnotation: ke,
808
+ selectBackgroundLayer: fe,
809
+ clearSelection: yt,
810
+ startOptimisticFront: Zt,
811
+ commitFront: b,
812
+ commitMove: vt,
813
+ commitResize: Jt,
814
+ commitStickyFront: I,
815
+ commitStickyMove: Qt,
816
+ commitStickyResize: te,
817
+ commitAnnotationMove: ee,
818
+ commitAnnotationResize: ne,
819
+ commitBackgroundMove: oe,
820
+ commitBackgroundResize: de,
821
+ commitViewport: v,
822
+ cancelViewportNavigation: ce
797
823
  },
798
824
  hud: {
799
- zoomIn: () => ft("in"),
800
- zoomOut: () => ft("out")
825
+ zoomIn: () => _t("in"),
826
+ zoomOut: () => _t("out")
801
827
  },
802
828
  lock: {
803
- toggle: ee
829
+ toggle: se
804
830
  },
805
831
  filter: {
806
- toggle: ne,
807
- solo: ie,
808
- showAll: oe
832
+ toggle: re,
833
+ solo: le,
834
+ showAll: ue
809
835
  },
810
836
  navigation: {
811
837
  handleArrowNavigation: (e) => {
812
- const t = M(), n = [
813
- ...w(),
814
- ...z().map((d) => Ee(d))
815
- ].sort(Be), i = Ne(
838
+ const t = p(), n = [
839
+ ...x(),
840
+ ...R().map((d) => $e(d))
841
+ ].sort(Pe), i = Me(
816
842
  n,
817
843
  t?.kind === "widget" || t?.kind === "sticky_note" ? t.id : null,
818
844
  e,
819
845
  Object.fromEntries(
820
846
  n.map((d) => [
821
- Nt(d) ? d.type : "sticky_note",
822
- Nt(d) ? F()[d.type] !== !1 : F()[he] !== !1
847
+ It(d) ? d.type : "sticky_note",
848
+ It(d) ? B()[d.type] !== !1 : B()[Ce] !== !1
823
849
  ])
824
850
  )
825
851
  );
826
- i && (w().some((d) => d.id === i.id) ? O(i) : yt(i.id));
852
+ i && (x().some((d) => d.id === i.id) ? C(i) : mt(i.id));
827
853
  },
828
- centerOnWidget: v,
829
- focusWidget: O,
830
- fitWidget: (e) => (I(e.id), h(e.id), ke(e), e),
831
- overviewWidget: (e) => (I(e.id), h(e.id), fe(e), e)
854
+ centerOnWidget: J,
855
+ focusWidget: C,
856
+ fitWidget: (e) => (D(e.id), b(e.id), he(e), e),
857
+ overviewWidget: (e) => (D(e.id), b(e.id), xe(e), e)
832
858
  },
833
859
  selection: {
834
- clear: _t
860
+ clear: yt
835
861
  },
836
862
  widgetActions: {
837
863
  deleteSelected: () => {
838
- const e = M();
839
- e && (e.kind === "widget" && p(e.id), e.kind === "sticky_note" && U(e.id), e.kind === "annotation" && q(e.id), e.kind === "background_layer" && P(e.id));
864
+ const e = p();
865
+ e && (e.kind === "widget" && K(e.id), e.kind === "sticky_note" && P(e.id), e.kind === "annotation" && G(e.id), e.kind === "background_layer" && $(e.id));
840
866
  },
841
- deleteWidget: p,
842
- deleteStickyNote: U,
843
- deleteAnnotation: q,
844
- deleteBackgroundLayer: P,
845
- addWidget: E,
846
- addWidgetAtCursor: Y,
847
- addWidgetCentered: rt,
848
- addStickyNoteAtCursor: H,
849
- addTextAnnotationAtCursor: K,
850
- duplicateTextAnnotationFrom: lt,
851
- addBackgroundLayerAtCursor: V,
852
- duplicateBackgroundLayerFrom: ut,
853
- createActiveToolAt: le,
867
+ deleteWidget: K,
868
+ deleteStickyNote: P,
869
+ deleteAnnotation: G,
870
+ deleteBackgroundLayer: $,
871
+ addWidget: Y,
872
+ addWidgetAtCursor: H,
873
+ addWidgetCentered: lt,
874
+ addStickyNoteAtCursor: V,
875
+ addTextAnnotationAtCursor: U,
876
+ duplicateTextAnnotationFrom: ut,
877
+ addBackgroundLayerAtCursor: q,
878
+ duplicateBackgroundLayerFrom: gt,
879
+ createActiveToolAt: me,
854
880
  ensureWidget: (e, t) => {
855
- const n = N(e);
881
+ const n = A(e);
856
882
  if (n)
857
- return O(n, { centerViewport: t?.centerViewport ?? !0 });
858
- const i = ue(), d = Y(
883
+ return C(n, { centerViewport: t?.centerViewport ?? !0 });
884
+ const i = we(), d = H(
859
885
  e,
860
886
  t?.worldX ?? i.worldX,
861
887
  t?.worldY ?? i.worldY
862
888
  );
863
- return (t?.centerViewport ?? !0) && d && v(d), d;
889
+ return (t?.centerViewport ?? !0) && d && J(d), d;
864
890
  },
865
- updateStickyNote: gt,
866
- updateTextAnnotation: Jt,
867
- updateBackgroundLayer: kt
891
+ updateStickyNote: kt,
892
+ updateTextAnnotation: ie,
893
+ updateBackgroundLayer: ft
868
894
  },
869
895
  queries: {
870
- findWidgetByType: N,
871
- findWidgetById: pt,
896
+ findWidgetByType: A,
897
+ findWidgetById: qt,
872
898
  findStickyNoteById: X,
873
- findAnnotationById: ct,
874
- findBackgroundLayerById: at
899
+ findAnnotationById: at,
900
+ findBackgroundLayerById: st
875
901
  },
876
902
  appearance: {
877
903
  setTheme: (e) => {
878
- a().theme !== e && o.setState((t) => ({ ...t, theme: e }));
904
+ r().theme !== e && o.setState((t) => ({ ...t, theme: e }));
879
905
  }
880
906
  },
881
907
  modes: {
882
- setMode: se,
883
- setActiveTool: re
908
+ setMode: _e,
909
+ setActiveTool: ye
884
910
  },
885
911
  handleCloseRequest: () => {
886
912
  if (c()) {
887
- s();
913
+ l();
888
914
  return;
889
915
  }
890
916
  o.onClose();
@@ -892,5 +918,5 @@ function dn(o) {
892
918
  };
893
919
  }
894
920
  export {
895
- dn as useWorkbenchModel
921
+ _n as useWorkbenchModel
896
922
  };