xiaodao-painter 0.1.6 → 0.1.8

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,7 +1,6 @@
1
- import { Fragment as e, Teleport as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createStaticVNode as s, createVNode as c, defineComponent as l, inject as u, mergeProps as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onMounted as h, onUnmounted as g, openBlock as _, provide as v, ref as y, renderList as b, resolveDynamicComponent as x, toDisplayString as S, unref as C, vModelText as w, vShow as T, watch as E, withDirectives as D, withKeys as O, withModifiers as k } from "vue";
2
- import { defineStore as A } from "pinia";
1
+ import { Fragment as e, Teleport as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createStaticVNode as s, createVNode as c, defineComponent as l, inject as u, mergeProps as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onMounted as h, onUnmounted as g, openBlock as _, provide as v, reactive as y, ref as b, renderList as x, resolveDynamicComponent as S, toDisplayString as C, unref as w, vModelText as ee, vShow as T, watch as E, withDirectives as D, withKeys as te, withModifiers as O } from "vue";
3
2
  //#region src/components/painter/utils/i18n.ts
4
- var j = {
3
+ var ne = {
5
4
  "zh-CN": {
6
5
  "tool.select": "选择",
7
6
  "tool.pencil": "铅笔",
@@ -77,380 +76,388 @@ var j = {
77
76
  "textAlign.right": "Align Right"
78
77
  }
79
78
  };
80
- function M(e, t) {
81
- return j[e]?.[t] ?? t;
79
+ function re(e, t) {
80
+ return ne[e]?.[t] ?? t;
82
81
  }
83
82
  //#endregion
84
83
  //#region src/components/painter/composables/useI18n.ts
85
- var N = Symbol("wb-locale");
86
- function P(e) {
87
- v(N, e);
84
+ var k = Symbol("wb-locale");
85
+ function A(e) {
86
+ v(k, e);
88
87
  }
89
- function ee() {
90
- let e = u(N, "zh-CN");
88
+ function ie() {
89
+ let e = u(k, "zh-CN");
91
90
  return {
92
91
  locale: e,
93
- t: (t) => M(e, t)
92
+ t: (t) => re(e, t)
94
93
  };
95
94
  }
96
- var F = Symbol("wb-root-el");
97
- function I(e) {
98
- v(F, e);
95
+ var j = Symbol("wb-root-el");
96
+ function M(e) {
97
+ v(j, e);
99
98
  }
100
- function L() {
101
- return u(F, null);
99
+ function ae() {
100
+ return u(j, null);
102
101
  }
103
102
  //#endregion
104
103
  //#region src/components/painter/types/index.ts
105
- var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
106
- let e = y([]), t = y(/* @__PURE__ */ new Set()), r = y("#000000"), i = y("transparent"), a = y("foreground"), o = y(!1), s = y(3), c = y("transparent"), l = y("light"), u = y(0), d = y("#000000"), f = y(null), p = y(null), m = y(800), h = y(600), g = y(0), _ = y(0), v = y(1), b = y(!1), x = null, S = n(() => `0 0 ${m.value} ${h.value}`), C = n(() => `translate(${g.value}px, ${_.value}px) scale(${v.value})`);
107
- function w(e, t) {
108
- g.value = e, _.value = t;
109
- }
110
- function T(e, t) {
111
- m.value = e, h.value = t, u.value++;
112
- }
113
- let E = [
114
- .1,
115
- .25,
116
- .33,
117
- .5,
118
- .67,
119
- .75,
120
- 1,
121
- 1.25,
122
- 1.5,
123
- 2,
124
- 3,
125
- 4,
126
- 5,
127
- 6,
128
- 8,
129
- 10
130
- ];
131
- function D(e, t, n) {
132
- let r = v.value, i = n > 1, a = null;
133
- for (let e of E) if (i) {
134
- if (e > r + .001) {
135
- a = e;
136
- break;
137
- }
138
- } else e < r - .001 && (a = e);
139
- if (a === null) return;
140
- let o = (e - g.value) / r, s = (t - _.value) / r;
141
- g.value = e - o * a, _.value = t - s * a, v.value = a, b.value = !0, x && clearTimeout(x), x = setTimeout(() => {
142
- b.value = !1;
143
- }, 1500);
144
- }
145
- function O(e, t, n) {
146
- let r = E[0], i = E[E.length - 1];
147
- n = Math.max(r, Math.min(i, n));
148
- let a = v.value, o = (e - g.value) / a, s = (t - _.value) / a;
149
- g.value = e - o * n, _.value = t - s * n, v.value = n, b.value = !0, x && clearTimeout(x), x = setTimeout(() => {
150
- b.value = !1;
151
- }, 1500);
152
- }
153
- function k() {
154
- return Math.round(v.value * 100);
155
- }
156
- let A = y([]), j = y([]), M = y(!1), N = y(null);
157
- function P(e) {
158
- s.value = e;
159
- }
160
- function ee(e) {
161
- c.value = e, u.value++;
162
- }
163
- function F() {
164
- o.value = !o.value;
165
- }
166
- function I() {
167
- o.value = !1;
168
- }
169
- let L = n(() => e.value.filter((e) => t.value.has(e.id))), te = n(() => {
170
- let e = L.value.filter((e) => e.type !== "text");
171
- if (e.length === 0) return null;
172
- let t = e[0].strokeColor;
173
- return e.every((e) => e.strokeColor === t) ? t : null;
174
- }), R = n(() => {
175
- let e = L.value.filter((e) => e.type !== "line" && e.type !== "pencil" && e.type !== "text");
176
- if (e.length === 0) return null;
177
- let t = e[0].fillColor;
178
- return e.every((e) => e.fillColor === t) ? t : null;
179
- }), ne = n(() => {
180
- let e = L.value.filter((e) => e.type === "text");
181
- if (e.length === 0) return null;
182
- let t = e[0].textColor ?? r.value;
183
- return e.every((e) => (e.textColor ?? r.value) === t) ? t : null;
184
- }), z = n(() => {
185
- let e = L.value;
186
- return e.length === 1 ? e[0] : null;
187
- }), re = n(() => z.value?.id ?? null);
188
- function B(e) {
189
- return t.value.has(e);
190
- }
191
- function ie(e) {
192
- t.value = e ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set();
193
- }
194
- function V(e) {
195
- t.value = new Set(e);
196
- }
197
- function H() {
198
- t.value = /* @__PURE__ */ new Set();
199
- }
200
- function U(t) {
201
- q(), e.value.push(t);
202
- }
203
- function W(t, n) {
204
- let r = e.value.findIndex((e) => e.id === t);
205
- if (r === -1) return;
206
- let i = { ...n };
207
- i.x !== void 0 && (i.x = Math.round(i.x)), i.y !== void 0 && (i.y = Math.round(i.y)), i.width !== void 0 && (i.width = Math.round(i.width)), i.height !== void 0 && (i.height = Math.round(i.height)), i.points &&= i.points.map((e) => ({
208
- x: Math.round(e.x),
209
- y: Math.round(e.y)
210
- })), e.value[r] = {
211
- ...e.value[r],
212
- ...i
213
- };
214
- }
215
- function ae() {
216
- let n = t.value;
217
- n.size !== 0 && (q(), e.value = e.value.filter((e) => !n.has(e.id)), t.value = /* @__PURE__ */ new Set());
218
- }
219
- let oe = n(() => A.value.length > 0), se = n(() => j.value.length > 0), G = y([]);
220
- function ce() {
221
- t.value.size !== 0 && (G.value = L.value.map((e) => K(e)), ae());
222
- }
223
- function le() {
224
- t.value.size !== 0 && (G.value = L.value.map((e) => K(e)));
225
- }
226
- function ue() {
227
- if (G.value.length === 0) return;
228
- q(), H();
229
- let t = [];
230
- for (let n of G.value) {
231
- let r = {
232
- ...K(n),
233
- id: J(),
234
- x: n.x + 20,
235
- y: n.y + 20,
236
- points: n.points.map((e) => ({
237
- x: e.x + 20,
238
- y: e.y + 20
239
- }))
240
- };
241
- e.value.push(r), t.push(r.id);
242
- }
243
- V(t);
244
- }
245
- function K(e) {
246
- return {
247
- ...e,
248
- points: e.points.map((e) => ({ ...e }))
249
- };
250
- }
251
- function q() {
252
- A.value.push(e.value.map((e) => ({
253
- ...e,
254
- points: e.points.map((e) => ({ ...e }))
255
- }))), j.value = [];
256
- }
257
- function de() {
258
- A.value.length !== 0 && (j.value.push(e.value.map((e) => ({
259
- ...e,
260
- points: e.points.map((e) => ({ ...e }))
261
- }))), e.value = A.value.pop(), t.value = /* @__PURE__ */ new Set());
262
- }
263
- function fe() {
264
- j.value.length !== 0 && (A.value.push(e.value.map((e) => ({
265
- ...e,
266
- points: e.points.map((e) => ({ ...e }))
267
- }))), e.value = j.value.pop(), t.value = /* @__PURE__ */ new Set());
268
- }
269
- function pe() {
270
- let n = t.value;
271
- if (n.size === 0) return;
272
- q();
273
- let r = e.value.map((e, t) => n.has(e.id) ? t : -1).filter((e) => e >= 0).sort((e, t) => t - e);
274
- for (let t of r) t < e.value.length - 1 && ([e.value[t], e.value[t + 1]] = [e.value[t + 1], e.value[t]]);
275
- }
276
- function me() {
277
- let n = t.value;
278
- if (n.size === 0) return;
279
- q();
280
- let r = e.value.map((e, t) => n.has(e.id) ? t : -1).filter((e) => e >= 0).sort((e, t) => e - t);
281
- for (let t of r) t > 0 && ([e.value[t], e.value[t - 1]] = [e.value[t - 1], e.value[t]]);
282
- }
283
- let he = !1;
284
- function ge(n) {
285
- if (he) return;
286
- he = !0, e.value = Array.isArray(n) ? n.map((e) => ({
287
- ...e,
288
- points: e.points.map((e) => ({ ...e }))
289
- })) : [];
290
- let r = new Set(e.value.map((e) => e.id));
291
- t.value = new Set([...t.value].filter((e) => r.has(e))), setTimeout(() => {
292
- he = !1;
293
- }, 0);
294
- }
295
- function _e(e) {
296
- let { x: t, y: n, width: r, height: i, type: a } = e;
297
- return a === "line" || a === "triangle" || a === "star" ? {
298
- x: r >= 0 ? t : t + r,
299
- y: i >= 0 ? n : n + i,
300
- width: Math.abs(r),
301
- height: Math.abs(i)
302
- } : {
303
- x: t,
304
- y: n,
305
- width: r,
306
- height: i
307
- };
308
- }
309
- function ve(e) {
310
- a.value = e;
311
- }
312
- function ye(n) {
313
- if (t.value.size > 0) {
314
- q();
315
- for (let r of t.value) {
316
- let t = e.value.find((e) => e.id === r);
317
- if (a.value === "foreground") {
318
- if (n === "transparent" || t?.type === "text") continue;
319
- W(r, { strokeColor: n });
320
- } else if (a.value === "textColor") {
321
- if (n === "transparent") return;
322
- W(r, { textColor: n });
323
- } else {
324
- if (t?.type === "text") continue;
325
- W(r, { fillColor: n });
326
- }
327
- }
328
- u.value++;
329
- } else if (a.value === "foreground") {
330
- if (n === "transparent") return;
331
- r.value = n;
332
- } else if (a.value === "textColor") {
333
- if (n === "transparent") return;
334
- d.value = n;
335
- } else i.value = n;
336
- }
337
- function J() {
338
- return crypto.randomUUID();
339
- }
340
- function Y(e, t, n, a, o, c) {
341
- return {
342
- id: J(),
343
- type: e,
344
- x: Math.round(t),
345
- y: Math.round(n),
346
- width: Math.round(a),
347
- height: Math.round(o),
348
- points: c.map((e) => ({
349
- x: Math.round(e.x),
350
- y: Math.round(e.y)
351
- })),
352
- strokeColor: r.value,
353
- fillColor: e === "pencil" || e === "line" ? "none" : i.value,
354
- strokeWidth: s.value,
355
- ...e === "text" ? {
356
- text: "",
357
- fontSize: 16,
358
- textAlign: "left",
359
- textColor: r.value,
360
- textAutoWidth: !0,
361
- fillColor: "transparent",
362
- strokeColor: "transparent",
363
- width: 0,
364
- height: 0
365
- } : {}
104
+ var oe = 800, se = 600, ce = 3, le = 16, ue = 8, N = b([]), P = b(/* @__PURE__ */ new Set()), F = b("#000000"), I = b("transparent"), L = b("foreground"), R = b(!1), z = b(3), B = b("transparent"), V = b("light"), H = b(0), U = b("#000000"), W = b(null), G = b(null), K = b(800), q = b(600), J = b(0), Y = b(0), X = b(1), de = b(!1), Z = null, fe = n(() => `0 0 ${K.value} ${q.value}`), pe = n(() => `translate(${J.value}px, ${Y.value}px) scale(${X.value})`);
105
+ function me(e, t) {
106
+ J.value = e, Y.value = t;
107
+ }
108
+ function he(e, t) {
109
+ K.value = e, q.value = t, H.value++;
110
+ }
111
+ var ge = [
112
+ .1,
113
+ .25,
114
+ .33,
115
+ .5,
116
+ .67,
117
+ .75,
118
+ 1,
119
+ 1.25,
120
+ 1.5,
121
+ 2,
122
+ 3,
123
+ 4,
124
+ 5,
125
+ 6,
126
+ 8,
127
+ 10
128
+ ];
129
+ function _e(e, t, n) {
130
+ let r = X.value, i = n > 1, a = null;
131
+ for (let e of ge) if (i) {
132
+ if (e > r + .001) {
133
+ a = e;
134
+ break;
135
+ }
136
+ } else e < r - .001 && (a = e);
137
+ if (a === null) return;
138
+ let o = (e - J.value) / r, s = (t - Y.value) / r;
139
+ J.value = e - o * a, Y.value = t - s * a, X.value = a, de.value = !0, Z && clearTimeout(Z), Z = setTimeout(() => {
140
+ de.value = !1;
141
+ }, 1500);
142
+ }
143
+ function ve(e, t, n) {
144
+ let r = ge[0], i = ge[ge.length - 1];
145
+ n = Math.max(r, Math.min(i, n));
146
+ let a = X.value, o = (e - J.value) / a, s = (t - Y.value) / a;
147
+ J.value = e - o * n, Y.value = t - s * n, X.value = n, de.value = !0, Z && clearTimeout(Z), Z = setTimeout(() => {
148
+ de.value = !1;
149
+ }, 1500);
150
+ }
151
+ function ye() {
152
+ return Math.round(X.value * 100);
153
+ }
154
+ var be = b([]), xe = b([]), Se = b(!1), Ce = b(null);
155
+ function we(e) {
156
+ z.value = e;
157
+ }
158
+ function Te(e) {
159
+ B.value = e, H.value++;
160
+ }
161
+ function Ee() {
162
+ R.value = !R.value;
163
+ }
164
+ function De() {
165
+ R.value = !1;
166
+ }
167
+ var Oe = n(() => N.value.filter((e) => P.value.has(e.id))), ke = n(() => {
168
+ let e = Oe.value.filter((e) => e.type !== "text");
169
+ if (e.length === 0) return null;
170
+ let t = e[0].strokeColor;
171
+ return e.every((e) => e.strokeColor === t) ? t : null;
172
+ }), Ae = n(() => {
173
+ let e = Oe.value.filter((e) => e.type !== "line" && e.type !== "pencil" && e.type !== "text");
174
+ if (e.length === 0) return null;
175
+ let t = e[0].fillColor;
176
+ return e.every((e) => e.fillColor === t) ? t : null;
177
+ }), je = n(() => {
178
+ let e = Oe.value.filter((e) => e.type === "text");
179
+ if (e.length === 0) return null;
180
+ let t = e[0].textColor ?? F.value;
181
+ return e.every((e) => (e.textColor ?? F.value) === t) ? t : null;
182
+ }), Me = n(() => {
183
+ let e = Oe.value;
184
+ return e.length === 1 ? e[0] : null;
185
+ }), Ne = n(() => Me.value?.id ?? null);
186
+ function Pe(e) {
187
+ return P.value.has(e);
188
+ }
189
+ function Fe(e) {
190
+ P.value = e ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set();
191
+ }
192
+ function Ie(e) {
193
+ P.value = new Set(e);
194
+ }
195
+ function Le() {
196
+ P.value = /* @__PURE__ */ new Set();
197
+ }
198
+ function Re(e) {
199
+ Q(), N.value.push(e);
200
+ }
201
+ function ze(e, t) {
202
+ let n = N.value.findIndex((t) => t.id === e);
203
+ if (n === -1) return;
204
+ let r = { ...t };
205
+ r.x !== void 0 && (r.x = Math.round(r.x)), r.y !== void 0 && (r.y = Math.round(r.y)), r.width !== void 0 && (r.width = Math.round(r.width)), r.height !== void 0 && (r.height = Math.round(r.height)), r.points &&= r.points.map((e) => ({
206
+ x: Math.round(e.x),
207
+ y: Math.round(e.y)
208
+ })), N.value[n] = {
209
+ ...N.value[n],
210
+ ...r
211
+ };
212
+ }
213
+ function Be() {
214
+ let e = P.value;
215
+ e.size !== 0 && (Q(), N.value = N.value.filter((t) => !e.has(t.id)), P.value = /* @__PURE__ */ new Set());
216
+ }
217
+ var Ve = n(() => be.value.length > 0), He = n(() => xe.value.length > 0), Ue = b([]);
218
+ function We() {
219
+ P.value.size !== 0 && (Ue.value = Oe.value.map((e) => qe(e)), Be());
220
+ }
221
+ function Ge() {
222
+ P.value.size !== 0 && (Ue.value = Oe.value.map((e) => qe(e)));
223
+ }
224
+ function Ke() {
225
+ if (Ue.value.length === 0) return;
226
+ Q(), Le();
227
+ let e = [];
228
+ for (let t of Ue.value) {
229
+ let n = {
230
+ ...qe(t),
231
+ id: rt(),
232
+ x: t.x + 20,
233
+ y: t.y + 20,
234
+ points: t.points.map((e) => ({
235
+ x: e.x + 20,
236
+ y: e.y + 20
237
+ }))
366
238
  };
239
+ N.value.push(n), e.push(n.id);
367
240
  }
368
- function be() {
369
- e.value = [], t.value = /* @__PURE__ */ new Set(), r.value = "#000000", i.value = "transparent", a.value = "foreground", o.value = !1, s.value = 3, c.value = "transparent", l.value = "light", u.value = 0, d.value = "#000000", f.value = null, p.value = null, m.value = 800, h.value = 600, g.value = 0, _.value = 0, v.value = 1, b.value = !1, x &&= (clearTimeout(x), null), A.value = [], j.value = [], M.value = !1, N.value = null, G.value = [];
370
- }
241
+ Ie(e);
242
+ }
243
+ function qe(e) {
371
244
  return {
372
- strokes: e,
373
- selectedStrokeIds: t,
374
- selectedStrokeId: re,
375
- selectedStroke: z,
376
- selectedStrokes: L,
377
- selectedStrokeColor: te,
378
- selectedFillColor: R,
379
- selectedTextColor: ne,
380
- foregroundColor: r,
381
- backgroundColor: i,
382
- activeColorSlot: a,
383
- showColorPalette: o,
384
- isSelecting: M,
385
- selectionBox: N,
386
- toggleColorPalette: F,
387
- hideColorPalette: I,
388
- addStroke: U,
389
- updateStroke: W,
390
- selectStroke: ie,
391
- selectStrokes: V,
392
- clearSelection: H,
393
- isSelected: B,
394
- deleteSelectedStrokes: ae,
395
- setColorSlot: ve,
396
- setColor: ye,
397
- buildStroke: Y,
398
- strokeWidth: s,
399
- setStrokeWidth: P,
400
- canvasBackgroundColor: c,
401
- setCanvasBackgroundColor: ee,
402
- canUndo: oe,
403
- canRedo: se,
404
- undoStack: A,
405
- pushUndo: q,
406
- undo: de,
407
- redo: fe,
408
- moveSelectedUp: pe,
409
- moveSelectedDown: me,
410
- syncFromParent: ge,
411
- getStrokeDisplayBounds: _e,
412
- clipboard: G,
413
- cutSelectedStrokes: ce,
414
- copySelectedStrokes: le,
415
- pasteStrokes: ue,
416
- canvasWidth: m,
417
- canvasHeight: h,
418
- panX: g,
419
- panY: _,
420
- zoomLevel: v,
421
- showZoomIndicator: b,
422
- viewBox: S,
423
- canvasTransform: C,
424
- setPan: w,
425
- setCanvasSize: T,
426
- zoomAt: D,
427
- continuousZoomAt: O,
428
- getZoomPercent: k,
429
- dataVersion: u,
430
- theme: l,
431
- textColor: d,
432
- editingTextId: f,
433
- hoveredTextId: p,
434
- reset: be
245
+ ...e,
246
+ points: e.points.map((e) => ({ ...e }))
435
247
  };
436
- }), ie = A("tools", () => {
437
- let e = y("select");
438
- function t(t) {
439
- if (e.value === "select" && t !== "select") {
440
- let e = B();
441
- e.selectedStrokeIds.size > 0 && e.clearSelection();
442
- }
443
- e.value = t;
444
- }
445
- function n() {
446
- e.value = "select";
447
- }
248
+ }
249
+ function Q() {
250
+ be.value.push(N.value.map((e) => ({
251
+ ...e,
252
+ points: e.points.map((e) => ({ ...e }))
253
+ }))), xe.value = [];
254
+ }
255
+ function Je() {
256
+ be.value.length !== 0 && (xe.value.push(N.value.map((e) => ({
257
+ ...e,
258
+ points: e.points.map((e) => ({ ...e }))
259
+ }))), N.value = be.value.pop(), P.value = /* @__PURE__ */ new Set());
260
+ }
261
+ function Ye() {
262
+ xe.value.length !== 0 && (be.value.push(N.value.map((e) => ({
263
+ ...e,
264
+ points: e.points.map((e) => ({ ...e }))
265
+ }))), N.value = xe.value.pop(), P.value = /* @__PURE__ */ new Set());
266
+ }
267
+ function Xe() {
268
+ let e = P.value;
269
+ if (e.size === 0) return;
270
+ Q();
271
+ let t = N.value.map((t, n) => e.has(t.id) ? n : -1).filter((e) => e >= 0).sort((e, t) => t - e);
272
+ for (let e of t) e < N.value.length - 1 && ([N.value[e], N.value[e + 1]] = [N.value[e + 1], N.value[e]]);
273
+ }
274
+ function Ze() {
275
+ let e = P.value;
276
+ if (e.size === 0) return;
277
+ Q();
278
+ let t = N.value.map((t, n) => e.has(t.id) ? n : -1).filter((e) => e >= 0).sort((e, t) => e - t);
279
+ for (let e of t) e > 0 && ([N.value[e], N.value[e - 1]] = [N.value[e - 1], N.value[e]]);
280
+ }
281
+ var Qe = !1;
282
+ function $e(e) {
283
+ if (Qe) return;
284
+ Qe = !0, N.value = Array.isArray(e) ? e.map((e) => ({
285
+ ...e,
286
+ points: e.points.map((e) => ({ ...e }))
287
+ })) : [];
288
+ let t = new Set(N.value.map((e) => e.id));
289
+ P.value = new Set([...P.value].filter((e) => t.has(e))), setTimeout(() => {
290
+ Qe = !1;
291
+ }, 0);
292
+ }
293
+ function et(e) {
294
+ let { x: t, y: n, width: r, height: i, type: a } = e;
295
+ return a === "line" || a === "triangle" || a === "star" ? {
296
+ x: r >= 0 ? t : t + r,
297
+ y: i >= 0 ? n : n + i,
298
+ width: Math.abs(r),
299
+ height: Math.abs(i)
300
+ } : {
301
+ x: t,
302
+ y: n,
303
+ width: r,
304
+ height: i
305
+ };
306
+ }
307
+ function tt(e) {
308
+ L.value = e;
309
+ }
310
+ function nt(e) {
311
+ if (P.value.size > 0) {
312
+ Q();
313
+ for (let t of P.value) {
314
+ let n = N.value.find((e) => e.id === t);
315
+ if (L.value === "foreground") {
316
+ if (e === "transparent" || n?.type === "text") continue;
317
+ ze(t, { strokeColor: e });
318
+ } else if (L.value === "textColor") {
319
+ if (e === "transparent") return;
320
+ ze(t, { textColor: e });
321
+ } else {
322
+ if (n?.type === "text") continue;
323
+ ze(t, { fillColor: e });
324
+ }
325
+ }
326
+ H.value++;
327
+ } else if (L.value === "foreground") {
328
+ if (e === "transparent") return;
329
+ F.value = e;
330
+ } else if (L.value === "textColor") {
331
+ if (e === "transparent") return;
332
+ U.value = e;
333
+ } else I.value = e;
334
+ }
335
+ function rt() {
336
+ return crypto.randomUUID();
337
+ }
338
+ function it(e, t, n, r, i, a) {
448
339
  return {
449
- activeTool: e,
450
- setTool: t,
451
- reset: n
340
+ id: rt(),
341
+ type: e,
342
+ x: Math.round(t),
343
+ y: Math.round(n),
344
+ width: Math.round(r),
345
+ height: Math.round(i),
346
+ points: a.map((e) => ({
347
+ x: Math.round(e.x),
348
+ y: Math.round(e.y)
349
+ })),
350
+ strokeColor: F.value,
351
+ fillColor: e === "pencil" || e === "line" ? "none" : I.value,
352
+ strokeWidth: z.value,
353
+ ...e === "text" ? {
354
+ text: "",
355
+ fontSize: 16,
356
+ textAlign: "left",
357
+ textColor: F.value,
358
+ textAutoWidth: !0,
359
+ fillColor: "transparent",
360
+ strokeColor: "transparent",
361
+ width: 0,
362
+ height: 0
363
+ } : {}
452
364
  };
453
- }), V = { class: "toolbar" }, H = ["disabled"], U = { class: "tool-group" }, W = ["title", "onClick"], ae = {
365
+ }
366
+ function at() {
367
+ N.value = [], P.value = /* @__PURE__ */ new Set(), F.value = "#000000", I.value = "transparent", L.value = "foreground", R.value = !1, z.value = 3, B.value = "transparent", V.value = "light", H.value = 0, U.value = "#000000", W.value = null, G.value = null, K.value = 800, q.value = 600, J.value = 0, Y.value = 0, X.value = 1, de.value = !1, Z &&= (clearTimeout(Z), null), be.value = [], xe.value = [], Se.value = !1, Ce.value = null, Ue.value = [];
368
+ }
369
+ var ot = y({
370
+ strokes: N,
371
+ selectedStrokeIds: P,
372
+ selectedStrokeId: Ne,
373
+ selectedStroke: Me,
374
+ selectedStrokes: Oe,
375
+ selectedStrokeColor: ke,
376
+ selectedFillColor: Ae,
377
+ selectedTextColor: je,
378
+ foregroundColor: F,
379
+ backgroundColor: I,
380
+ activeColorSlot: L,
381
+ showColorPalette: R,
382
+ isSelecting: Se,
383
+ selectionBox: Ce,
384
+ toggleColorPalette: Ee,
385
+ hideColorPalette: De,
386
+ addStroke: Re,
387
+ updateStroke: ze,
388
+ selectStroke: Fe,
389
+ selectStrokes: Ie,
390
+ clearSelection: Le,
391
+ isSelected: Pe,
392
+ deleteSelectedStrokes: Be,
393
+ setColorSlot: tt,
394
+ setColor: nt,
395
+ buildStroke: it,
396
+ strokeWidth: z,
397
+ setStrokeWidth: we,
398
+ canvasBackgroundColor: B,
399
+ setCanvasBackgroundColor: Te,
400
+ canUndo: Ve,
401
+ canRedo: He,
402
+ undoStack: be,
403
+ pushUndo: Q,
404
+ undo: Je,
405
+ redo: Ye,
406
+ moveSelectedUp: Xe,
407
+ moveSelectedDown: Ze,
408
+ syncFromParent: $e,
409
+ getStrokeDisplayBounds: et,
410
+ clipboard: Ue,
411
+ cutSelectedStrokes: We,
412
+ copySelectedStrokes: Ge,
413
+ pasteStrokes: Ke,
414
+ canvasWidth: K,
415
+ canvasHeight: q,
416
+ panX: J,
417
+ panY: Y,
418
+ zoomLevel: X,
419
+ showZoomIndicator: de,
420
+ viewBox: fe,
421
+ canvasTransform: pe,
422
+ setPan: me,
423
+ setCanvasSize: he,
424
+ zoomAt: _e,
425
+ continuousZoomAt: ve,
426
+ getZoomPercent: ye,
427
+ dataVersion: H,
428
+ theme: V,
429
+ textColor: U,
430
+ editingTextId: W,
431
+ hoveredTextId: G,
432
+ reset: at
433
+ });
434
+ function st() {
435
+ return ot;
436
+ }
437
+ //#endregion
438
+ //#region src/components/painter/stores/tools.ts
439
+ var ct = b("select");
440
+ function lt(e) {
441
+ if (ct.value === "select" && e !== "select") {
442
+ let e = st();
443
+ e.selectedStrokeIds.size > 0 && e.clearSelection();
444
+ }
445
+ ct.value = e;
446
+ }
447
+ function ut() {
448
+ ct.value = "select";
449
+ }
450
+ var dt = y({
451
+ activeTool: ct,
452
+ setTool: lt,
453
+ reset: ut
454
+ });
455
+ function ft() {
456
+ return dt;
457
+ }
458
+ //#endregion
459
+ //#region src/components/painter/Toolbar.vue?vue&type=script&setup=true&lang.ts
460
+ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" }, gt = ["title", "onClick"], _t = {
454
461
  key: 0,
455
462
  class: "tool-icon",
456
463
  viewBox: "0 0 24 24",
@@ -459,7 +466,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
459
466
  "stroke-width": "1.6",
460
467
  "stroke-linecap": "round",
461
468
  "stroke-linejoin": "round"
462
- }, oe = {
469
+ }, vt = {
463
470
  key: 1,
464
471
  class: "tool-icon",
465
472
  viewBox: "0 0 24 24",
@@ -467,7 +474,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
467
474
  stroke: "currentColor",
468
475
  "stroke-width": "1.8",
469
476
  "stroke-linecap": "round"
470
- }, se = {
477
+ }, yt = {
471
478
  key: 2,
472
479
  class: "tool-icon",
473
480
  viewBox: "0 0 24 24",
@@ -476,7 +483,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
476
483
  "stroke-width": "1.8",
477
484
  "stroke-linecap": "round",
478
485
  "stroke-linejoin": "round"
479
- }, G = {
486
+ }, bt = {
480
487
  key: 3,
481
488
  class: "tool-icon",
482
489
  viewBox: "0 0 24 24",
@@ -484,14 +491,14 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
484
491
  stroke: "currentColor",
485
492
  "stroke-width": "1.8",
486
493
  "stroke-linecap": "round"
487
- }, ce = {
494
+ }, xt = {
488
495
  key: 4,
489
496
  class: "tool-icon",
490
497
  viewBox: "0 0 24 24",
491
498
  fill: "none",
492
499
  stroke: "currentColor",
493
500
  "stroke-width": "1.8"
494
- }, le = {
501
+ }, St = {
495
502
  key: 5,
496
503
  class: "tool-icon",
497
504
  viewBox: "0 0 24 24",
@@ -499,7 +506,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
499
506
  stroke: "currentColor",
500
507
  "stroke-width": "1.8",
501
508
  "stroke-linejoin": "round"
502
- }, ue = {
509
+ }, Ct = {
503
510
  key: 6,
504
511
  class: "tool-icon",
505
512
  viewBox: "0 0 24 24",
@@ -507,7 +514,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
507
514
  stroke: "currentColor",
508
515
  "stroke-width": "1.8",
509
516
  "stroke-linejoin": "round"
510
- }, K = {
517
+ }, wt = {
511
518
  key: 7,
512
519
  class: "tool-icon",
513
520
  viewBox: "0 0 24 24",
@@ -515,7 +522,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
515
522
  stroke: "currentColor",
516
523
  "stroke-width": "1.8",
517
524
  "stroke-linejoin": "round"
518
- }, q = {
525
+ }, Tt = {
519
526
  key: 8,
520
527
  class: "tool-icon",
521
528
  viewBox: "0 0 24 24",
@@ -524,7 +531,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
524
531
  "stroke-width": "1.8",
525
532
  "stroke-linecap": "round",
526
533
  "stroke-linejoin": "round"
527
- }, de = { class: "tool-group nav-group" }, fe = ["title"], pe = ["disabled"], me = { class: "canvas-size-wrapper" }, he = ["title"], ge = { class: "popover-title" }, _e = { class: "popover-field" }, ve = { class: "popover-label" }, ye = { class: "popover-field" }, J = { class: "popover-label" }, Y = { class: "popover-field" }, be = { class: "popover-label" }, xe = { class: "bg-color-row" }, Se = ["title"], Ce = ["value"], we = ["title"], Te = { class: "popover-actions" }, Ee = { class: "color-section" }, De = ["title"], Oe = { class: "color-swatch text-color-swatch" }, ke = {
534
+ }, Et = { class: "tool-group nav-group" }, Dt = ["title"], Ot = ["disabled"], kt = { class: "canvas-size-wrapper" }, At = ["title"], jt = { class: "popover-title" }, Mt = { class: "popover-field" }, Nt = { class: "popover-label" }, Pt = { class: "popover-field" }, Ft = { class: "popover-label" }, It = { class: "popover-field" }, Lt = { class: "popover-label" }, Rt = { class: "bg-color-row" }, zt = ["title"], Bt = ["value"], Vt = ["title"], Ht = { class: "popover-actions" }, Ut = { class: "color-section" }, Wt = ["title"], Gt = { class: "color-swatch text-color-swatch" }, Kt = {
528
535
  key: 0,
529
536
  class: "mixed-icon",
530
537
  viewBox: "0 0 24 24",
@@ -532,7 +539,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
532
539
  stroke: "currentColor",
533
540
  "stroke-width": "2",
534
541
  "stroke-linecap": "round"
535
- }, Ae = ["title"], je = {
542
+ }, qt = ["title"], Jt = {
536
543
  key: 0,
537
544
  class: "mixed-icon",
538
545
  viewBox: "0 0 24 24",
@@ -540,7 +547,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
540
547
  stroke: "currentColor",
541
548
  "stroke-width": "2",
542
549
  "stroke-linecap": "round"
543
- }, Me = ["title"], Ne = {
550
+ }, Yt = ["title"], Xt = {
544
551
  key: 0,
545
552
  class: "mixed-icon",
546
553
  viewBox: "0 0 24 24",
@@ -548,7 +555,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
548
555
  stroke: "currentColor",
549
556
  "stroke-width": "2",
550
557
  "stroke-linecap": "round"
551
- }, Pe = {
558
+ }, Zt = {
552
559
  key: 1,
553
560
  class: "mixed-icon",
554
561
  viewBox: "0 0 24 24",
@@ -556,35 +563,35 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
556
563
  stroke: "currentColor",
557
564
  "stroke-width": "2",
558
565
  "stroke-linecap": "round"
559
- }, Fe = 42, Ie = /*@__PURE__*/ l({
566
+ }, Qt = 42, $t = /*@__PURE__*/ l({
560
567
  __name: "Toolbar",
561
568
  setup(c) {
562
- let l = ie(), u = B(), { t: d } = ee(), f = L(), v = y(null), x = y(!1), T = y(!1);
563
- function E() {
569
+ let l = ft(), u = st(), { t: d } = ie(), f = ae(), v = b(null), y = b(!1), S = b(!1);
570
+ function T() {
564
571
  let e = v.value;
565
- e && (x.value = e.scrollTop > 0, T.value = e.scrollTop + e.clientHeight < e.scrollHeight - 1);
572
+ e && (y.value = e.scrollTop > 0, S.value = e.scrollTop + e.clientHeight < e.scrollHeight - 1);
566
573
  }
567
- function k() {
574
+ function E() {
568
575
  let e = v.value;
569
576
  e && e.scrollBy({
570
577
  top: -42,
571
578
  behavior: "smooth"
572
579
  });
573
580
  }
574
- function A() {
581
+ function O() {
575
582
  let e = v.value;
576
583
  e && e.scrollBy({
577
- top: Fe,
584
+ top: Qt,
578
585
  behavior: "smooth"
579
586
  });
580
587
  }
581
- let j = null;
588
+ let ne = null;
582
589
  h(() => {
583
- j = new ResizeObserver(() => E()), v.value && j.observe(v.value), E();
590
+ ne = new ResizeObserver(() => T()), v.value && ne.observe(v.value), T();
584
591
  }), g(() => {
585
- j?.disconnect();
592
+ ne?.disconnect();
586
593
  });
587
- let M = [
594
+ let re = [
588
595
  "select",
589
596
  "pan",
590
597
  "pencil",
@@ -594,35 +601,35 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
594
601
  "triangle",
595
602
  "star",
596
603
  "text"
597
- ], N = n(() => u.selectedStrokeIds.size > 0), P = y(!1), F = y({
604
+ ], k = n(() => u.selectedStrokeIds.size > 0), A = b(!1), j = b({
598
605
  width: u.canvasWidth,
599
606
  height: u.canvasHeight
600
- }), I = y(u.canvasBackgroundColor);
601
- function te() {
602
- F.value = {
607
+ }), M = b(u.canvasBackgroundColor);
608
+ function oe() {
609
+ j.value = {
603
610
  width: u.canvasWidth,
604
611
  height: u.canvasHeight
605
- }, I.value = u.canvasBackgroundColor, P.value = !0;
612
+ }, M.value = u.canvasBackgroundColor, A.value = !0;
606
613
  }
607
- let R = y(null);
608
- function ne() {
609
- R.value?.click();
614
+ let se = b(null);
615
+ function ce() {
616
+ se.value?.click();
610
617
  }
611
- function z(e) {
618
+ function le(e) {
612
619
  let t = e.target;
613
- I.value = t.value;
620
+ M.value = t.value;
614
621
  }
615
- function re() {
616
- I.value = "transparent";
622
+ function ue() {
623
+ M.value = "transparent";
617
624
  }
618
- function Ie() {
619
- let e = Math.max(1, Math.round(F.value.width)), t = Math.max(1, Math.round(F.value.height));
620
- u.setCanvasSize(e, t), u.setCanvasBackgroundColor(I.value), P.value = !1;
625
+ function N() {
626
+ let e = Math.max(1, Math.round(j.value.width)), t = Math.max(1, Math.round(j.value.height));
627
+ u.setCanvasSize(e, t), u.setCanvasBackgroundColor(M.value), A.value = !1;
621
628
  }
622
- function Le() {
623
- P.value = !1;
629
+ function P() {
630
+ A.value = !1;
624
631
  }
625
- let Re = n(() => {
632
+ let F = n(() => {
626
633
  if (!f?.value) return {};
627
634
  let e = f.value.getBoundingClientRect();
628
635
  return {
@@ -631,28 +638,28 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
631
638
  position: "fixed"
632
639
  };
633
640
  });
634
- function ze(e) {
635
- e.target.classList.contains("canvas-size-backdrop") && (P.value = !1);
641
+ function I(e) {
642
+ e.target.classList.contains("canvas-size-backdrop") && (A.value = !1);
636
643
  }
637
- function Be(e) {
638
- e.key === "Escape" && (P.value = !1);
644
+ function L(e) {
645
+ e.key === "Escape" && (A.value = !1);
639
646
  }
640
- let Ve = n(() => N.value && u.selectedStrokeColor !== null ? u.selectedStrokeColor : u.foregroundColor), X = n(() => !Ue.value && N.value && u.selectedStrokeColor === null), Z = n(() => N.value && u.selectedFillColor !== null ? u.selectedFillColor : u.backgroundColor), He = n(() => !Ue.value && N.value && u.selectedFillColor === null), Q = n(() => u.selectedStrokes.some((e) => e.type === "text")), Ue = n(() => N.value && u.selectedStrokes.every((e) => e.type === "text")), We = n(() => Ue.value), Ge = n(() => Ue.value), Ke = n(() => N.value && u.selectedTextColor !== null ? u.selectedTextColor : u.textColor), qe = n(() => Q.value && u.selectedTextColor === null);
641
- function Je() {
647
+ let R = n(() => k.value && u.selectedStrokeColor !== null ? u.selectedStrokeColor : u.foregroundColor), z = n(() => !U.value && k.value && u.selectedStrokeColor === null), B = n(() => k.value && u.selectedFillColor !== null ? u.selectedFillColor : u.backgroundColor), V = n(() => !U.value && k.value && u.selectedFillColor === null), H = n(() => u.selectedStrokes.some((e) => e.type === "text")), U = n(() => k.value && u.selectedStrokes.every((e) => e.type === "text")), W = n(() => U.value), G = n(() => U.value), K = n(() => k.value && u.selectedTextColor !== null ? u.selectedTextColor : u.textColor), q = n(() => H.value && u.selectedTextColor === null);
648
+ function J() {
642
649
  u.setColorSlot("textColor"), u.toggleColorPalette();
643
650
  }
644
- function Ye() {
645
- We.value || (u.setColorSlot("foreground"), u.toggleColorPalette());
651
+ function Y() {
652
+ W.value || (u.setColorSlot("foreground"), u.toggleColorPalette());
646
653
  }
647
- function Xe() {
648
- Ge.value || (u.setColorSlot("background"), u.toggleColorPalette());
654
+ function X() {
655
+ G.value || (u.setColorSlot("background"), u.toggleColorPalette());
649
656
  }
650
- return (n, c) => (_(), a("div", V, [
651
- x.value || T.value ? (_(), a("button", {
657
+ return (n, c) => (_(), a("div", pt, [
658
+ y.value || S.value ? (_(), a("button", {
652
659
  key: 0,
653
660
  class: "scroll-btn scroll-up",
654
- disabled: !x.value,
655
- onClick: k
661
+ disabled: !y.value,
662
+ onClick: E
656
663
  }, [...c[3] ||= [o("svg", {
657
664
  class: "scroll-icon",
658
665
  viewBox: "0 0 24 24",
@@ -661,33 +668,33 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
661
668
  "stroke-width": "2",
662
669
  "stroke-linecap": "round",
663
670
  "stroke-linejoin": "round"
664
- }, [o("polyline", { points: "18 15 12 9 6 15" })], -1)]], 8, H)) : i("", !0),
671
+ }, [o("polyline", { points: "18 15 12 9 6 15" })], -1)]], 8, mt)) : i("", !0),
665
672
  o("div", {
666
673
  ref_key: "toolsScrollRef",
667
674
  ref: v,
668
675
  class: "tools-scroll",
669
- onScroll: E
670
- }, [o("div", U, [(_(), a(e, null, b(M, (e) => o("button", {
676
+ onScroll: T
677
+ }, [o("div", ht, [(_(), a(e, null, x(re, (e) => o("button", {
671
678
  key: e,
672
- class: p(["tool-btn", { active: C(l).activeTool === e }]),
673
- title: C(d)(`tool.${e}`),
674
- onClick: (t) => C(l).setTool(e)
675
- }, [e === "select" ? (_(), a("svg", ae, [...c[4] ||= [o("path", { d: "M4.5 3.5l5.5 15 2.5-6 6-2.5z" }, null, -1)]])) : e === "pan" ? (_(), a("svg", oe, [...c[5] ||= [s("<line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"20\" data-v-9532ade7></line><line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\" data-v-9532ade7></line><polygon points=\"12,4 9,8 15,8\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"12,20 9,16 15,16\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"4,12 8,9 8,15\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"20,12 16,9 16,15\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon>", 6)]])) : e === "pencil" ? (_(), a("svg", se, [...c[6] ||= [o("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" }, null, -1), o("path", { d: "m15 5 4 4" }, null, -1)]])) : e === "line" ? (_(), a("svg", G, [...c[7] ||= [o("line", {
679
+ class: p(["tool-btn", { active: w(l).activeTool === e }]),
680
+ title: w(d)(`tool.${e}`),
681
+ onClick: (t) => w(l).setTool(e)
682
+ }, [e === "select" ? (_(), a("svg", _t, [...c[4] ||= [o("path", { d: "M4.5 3.5l5.5 15 2.5-6 6-2.5z" }, null, -1)]])) : e === "pan" ? (_(), a("svg", vt, [...c[5] ||= [s("<line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"20\" data-v-9532ade7></line><line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\" data-v-9532ade7></line><polygon points=\"12,4 9,8 15,8\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"12,20 9,16 15,16\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"4,12 8,9 8,15\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"20,12 16,9 16,15\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon>", 6)]])) : e === "pencil" ? (_(), a("svg", yt, [...c[6] ||= [o("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" }, null, -1), o("path", { d: "m15 5 4 4" }, null, -1)]])) : e === "line" ? (_(), a("svg", bt, [...c[7] ||= [o("line", {
676
683
  x1: "5",
677
684
  y1: "19",
678
685
  x2: "19",
679
686
  y2: "5"
680
- }, null, -1)]])) : e === "circle" ? (_(), a("svg", ce, [...c[8] ||= [o("circle", {
687
+ }, null, -1)]])) : e === "circle" ? (_(), a("svg", xt, [...c[8] ||= [o("circle", {
681
688
  cx: "12",
682
689
  cy: "12",
683
690
  r: "9"
684
- }, null, -1)]])) : e === "rect" ? (_(), a("svg", le, [...c[9] ||= [o("rect", {
691
+ }, null, -1)]])) : e === "rect" ? (_(), a("svg", St, [...c[9] ||= [o("rect", {
685
692
  x: "3",
686
693
  y: "3",
687
694
  width: "18",
688
695
  height: "18",
689
696
  rx: "2"
690
- }, null, -1)]])) : e === "triangle" ? (_(), a("svg", ue, [...c[10] ||= [o("polygon", { points: "12,3 22,21 2,21" }, null, -1)]])) : e === "star" ? (_(), a("svg", K, [...c[11] ||= [o("polygon", { points: "12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" }, null, -1)]])) : e === "text" ? (_(), a("svg", q, [...c[12] ||= [
697
+ }, null, -1)]])) : e === "triangle" ? (_(), a("svg", Ct, [...c[10] ||= [o("polygon", { points: "12,3 22,21 2,21" }, null, -1)]])) : e === "star" ? (_(), a("svg", wt, [...c[11] ||= [o("polygon", { points: "12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" }, null, -1)]])) : e === "text" ? (_(), a("svg", Tt, [...c[12] ||= [
691
698
  o("polyline", { points: "4 7 4 4 20 4 20 7" }, null, -1),
692
699
  o("line", {
693
700
  x1: "9",
@@ -701,16 +708,16 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
701
708
  x2: "12",
702
709
  y2: "20"
703
710
  }, null, -1)
704
- ]])) : i("", !0)], 10, W)), 64))]), o("div", de, [o("button", {
705
- class: p(["tool-btn", { active: C(l).activeTool === "zoom" }]),
706
- title: C(d)("tool.zoom"),
707
- onClick: c[0] ||= (e) => C(l).setTool("zoom")
708
- }, [...c[13] ||= [s("<svg class=\"tool-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9532ade7><circle cx=\"11\" cy=\"11\" r=\"8\" data-v-9532ade7></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\" data-v-9532ade7></line><line x1=\"11\" y1=\"8\" x2=\"11\" y2=\"14\" data-v-9532ade7></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\" data-v-9532ade7></line></svg>", 1)]], 10, fe)])], 544),
709
- x.value || T.value ? (_(), a("button", {
711
+ ]])) : i("", !0)], 10, gt)), 64))]), o("div", Et, [o("button", {
712
+ class: p(["tool-btn", { active: w(l).activeTool === "zoom" }]),
713
+ title: w(d)("tool.zoom"),
714
+ onClick: c[0] ||= (e) => w(l).setTool("zoom")
715
+ }, [...c[13] ||= [s("<svg class=\"tool-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9532ade7><circle cx=\"11\" cy=\"11\" r=\"8\" data-v-9532ade7></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\" data-v-9532ade7></line><line x1=\"11\" y1=\"8\" x2=\"11\" y2=\"14\" data-v-9532ade7></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\" data-v-9532ade7></line></svg>", 1)]], 10, Dt)])], 544),
716
+ y.value || S.value ? (_(), a("button", {
710
717
  key: 1,
711
718
  class: "scroll-btn scroll-down",
712
- disabled: !T.value,
713
- onClick: A
719
+ disabled: !S.value,
720
+ onClick: O
714
721
  }, [...c[14] ||= [o("svg", {
715
722
  class: "scroll-icon",
716
723
  viewBox: "0 0 24 24",
@@ -719,12 +726,12 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
719
726
  "stroke-width": "2",
720
727
  "stroke-linecap": "round",
721
728
  "stroke-linejoin": "round"
722
- }, [o("polyline", { points: "6 9 12 15 18 9" })], -1)]], 8, pe)) : i("", !0),
729
+ }, [o("polyline", { points: "6 9 12 15 18 9" })], -1)]], 8, Ot)) : i("", !0),
723
730
  c[24] ||= o("div", { class: "spacer" }, null, -1),
724
- o("div", me, [o("button", {
731
+ o("div", kt, [o("button", {
725
732
  class: "tool-btn",
726
- title: C(d)("canvasSize.title"),
727
- onClick: te
733
+ title: w(d)("canvasSize.title"),
734
+ onClick: oe
728
735
  }, [...c[15] ||= [o("svg", {
729
736
  class: "tool-icon",
730
737
  viewBox: "0 0 24 24",
@@ -753,71 +760,71 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
753
760
  x2: "19",
754
761
  y2: "22"
755
762
  })
756
- ], -1)]], 8, he), (_(), r(t, { to: "body" }, [P.value ? (_(), a("div", {
763
+ ], -1)]], 8, At), (_(), r(t, { to: "body" }, [A.value ? (_(), a("div", {
757
764
  key: 0,
758
765
  class: "canvas-size-backdrop",
759
- onMousedown: ze
766
+ onMousedown: I
760
767
  }, [o("div", {
761
768
  class: "canvas-size-popover",
762
- style: m(Re.value),
763
- onKeydown: Be
769
+ style: m(F.value),
770
+ onKeydown: L
764
771
  }, [
765
- o("div", ge, S(C(d)("canvasSize.title")), 1),
766
- o("div", _e, [
767
- o("label", ve, S(C(d)("canvasSize.width")), 1),
772
+ o("div", jt, C(w(d)("canvasSize.title")), 1),
773
+ o("div", Mt, [
774
+ o("label", Nt, C(w(d)("canvasSize.width")), 1),
768
775
  D(o("input", {
769
776
  ref: "widthInput",
770
- "onUpdate:modelValue": c[1] ||= (e) => F.value.width = e,
777
+ "onUpdate:modelValue": c[1] ||= (e) => j.value.width = e,
771
778
  type: "number",
772
779
  min: "1",
773
780
  class: "popover-input",
774
- onKeydown: O(Ie, ["enter"])
781
+ onKeydown: te(N, ["enter"])
775
782
  }, null, 544), [[
776
- w,
777
- F.value.width,
783
+ ee,
784
+ j.value.width,
778
785
  void 0,
779
786
  { number: !0 }
780
787
  ]]),
781
788
  c[16] ||= o("span", { class: "popover-unit" }, "px", -1)
782
789
  ]),
783
- o("div", ye, [
784
- o("label", J, S(C(d)("canvasSize.height")), 1),
790
+ o("div", Pt, [
791
+ o("label", Ft, C(w(d)("canvasSize.height")), 1),
785
792
  D(o("input", {
786
- "onUpdate:modelValue": c[2] ||= (e) => F.value.height = e,
793
+ "onUpdate:modelValue": c[2] ||= (e) => j.value.height = e,
787
794
  type: "number",
788
795
  min: "1",
789
796
  class: "popover-input",
790
- onKeydown: O(Ie, ["enter"])
797
+ onKeydown: te(N, ["enter"])
791
798
  }, null, 544), [[
792
- w,
793
- F.value.height,
799
+ ee,
800
+ j.value.height,
794
801
  void 0,
795
802
  { number: !0 }
796
803
  ]]),
797
804
  c[17] ||= o("span", { class: "popover-unit" }, "px", -1)
798
805
  ]),
799
- o("div", Y, [o("label", be, S(C(d)("canvasSize.background")), 1), o("div", xe, [o("button", {
800
- class: p(["bg-radio-btn", { active: I.value !== "transparent" }]),
801
- title: C(d)("canvasSize.solidColor"),
802
- onClick: ne
806
+ o("div", It, [o("label", Lt, C(w(d)("canvasSize.background")), 1), o("div", Rt, [o("button", {
807
+ class: p(["bg-radio-btn", { active: M.value !== "transparent" }]),
808
+ title: w(d)("canvasSize.solidColor"),
809
+ onClick: ce
803
810
  }, [o("span", {
804
811
  class: "bg-color-fill",
805
- style: m({ background: I.value === "transparent" ? "#ffffff" : I.value })
812
+ style: m({ background: M.value === "transparent" ? "#ffffff" : M.value })
806
813
  }, null, 4), o("input", {
807
814
  ref_key: "hiddenColorInput",
808
- ref: R,
815
+ ref: se,
809
816
  type: "color",
810
817
  class: "hidden-color-input",
811
- value: I.value === "transparent" ? "#ffffff" : I.value,
812
- onChange: z
813
- }, null, 40, Ce)], 10, Se), o("button", {
818
+ value: M.value === "transparent" ? "#ffffff" : M.value,
819
+ onChange: le
820
+ }, null, 40, Bt)], 10, zt), o("button", {
814
821
  class: p([
815
822
  "bg-radio-btn",
816
823
  "bg-radio-btn--transparent",
817
- { active: I.value === "transparent" }
824
+ { active: M.value === "transparent" }
818
825
  ]),
819
- title: C(d)("canvasSize.transparent"),
820
- onClick: re
826
+ title: w(d)("canvasSize.transparent"),
827
+ onClick: ue
821
828
  }, [...c[18] ||= [o("svg", {
822
829
  width: "14",
823
830
  height: "14",
@@ -831,24 +838,24 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
831
838
  y1: "5",
832
839
  x2: "19",
833
840
  y2: "19"
834
- })], -1)]], 10, we)])]),
835
- o("div", Te, [o("button", {
841
+ })], -1)]], 10, Vt)])]),
842
+ o("div", Ht, [o("button", {
836
843
  class: "popover-btn cancel",
837
- onClick: Le
838
- }, S(C(d)("canvasSize.cancel")), 1), o("button", {
844
+ onClick: P
845
+ }, C(w(d)("canvasSize.cancel")), 1), o("button", {
839
846
  class: "popover-btn confirm",
840
- onClick: Ie
841
- }, S(C(d)("canvasSize.confirm")), 1)])
847
+ onClick: N
848
+ }, C(w(d)("canvasSize.confirm")), 1)])
842
849
  ], 36)], 32)) : i("", !0)]))]),
843
- o("div", Ee, [
844
- Q.value ? (_(), a("div", {
850
+ o("div", Ut, [
851
+ H.value ? (_(), a("div", {
845
852
  key: 0,
846
- class: p(["color-indicator", { active: C(u).showColorPalette && C(u).activeColorSlot === "textColor" }]),
847
- title: C(d)("color.textColor"),
848
- onClick: Je
849
- }, [o("div", Oe, [(_(), a("svg", {
853
+ class: p(["color-indicator", { active: w(u).showColorPalette && w(u).activeColorSlot === "textColor" }]),
854
+ title: w(d)("color.textColor"),
855
+ onClick: J
856
+ }, [o("div", Gt, [(_(), a("svg", {
850
857
  class: "text-color-icon",
851
- style: m({ color: qe.value ? "var(--wb-text-secondary)" : Ke.value }),
858
+ style: m({ color: q.value ? "var(--wb-text-secondary)" : K.value }),
852
859
  viewBox: "0 0 24 24",
853
860
  fill: "none",
854
861
  stroke: "currentColor",
@@ -869,7 +876,7 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
869
876
  x2: "12",
870
877
  y2: "20"
871
878
  }, null, -1)
872
- ]], 4)), qe.value ? (_(), a("svg", ke, [...c[20] ||= [o("line", {
879
+ ]], 4)), q.value ? (_(), a("svg", Kt, [...c[20] ||= [o("line", {
873
880
  x1: "5",
874
881
  y1: "12",
875
882
  x2: "19",
@@ -879,18 +886,18 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
879
886
  y1: "5",
880
887
  x2: "12",
881
888
  y2: "19"
882
- }, null, -1)]])) : i("", !0)])], 10, De)) : i("", !0),
889
+ }, null, -1)]])) : i("", !0)])], 10, Wt)) : i("", !0),
883
890
  o("div", {
884
891
  class: p(["color-indicator", {
885
- active: C(u).showColorPalette && C(u).activeColorSlot === "foreground",
886
- disabled: We.value
892
+ active: w(u).showColorPalette && w(u).activeColorSlot === "foreground",
893
+ disabled: W.value
887
894
  }]),
888
- title: C(d)("color.foreground"),
889
- onClick: Ye
895
+ title: w(d)("color.foreground"),
896
+ onClick: Y
890
897
  }, [o("div", {
891
- class: p(["color-swatch fg", { mixed: X.value }]),
892
- style: m({ background: X.value ? "none" : Ve.value })
893
- }, [X.value ? (_(), a("svg", je, [...c[21] ||= [o("line", {
898
+ class: p(["color-swatch fg", { mixed: z.value }]),
899
+ style: m({ background: z.value ? "none" : R.value })
900
+ }, [z.value ? (_(), a("svg", Jt, [...c[21] ||= [o("line", {
894
901
  x1: "5",
895
902
  y1: "12",
896
903
  x2: "19",
@@ -900,21 +907,21 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
900
907
  y1: "5",
901
908
  x2: "12",
902
909
  y2: "19"
903
- }, null, -1)]])) : i("", !0)], 6)], 10, Ae),
910
+ }, null, -1)]])) : i("", !0)], 6)], 10, qt),
904
911
  o("div", {
905
912
  class: p(["color-indicator", {
906
- active: C(u).showColorPalette && C(u).activeColorSlot === "background",
907
- disabled: Ge.value
913
+ active: w(u).showColorPalette && w(u).activeColorSlot === "background",
914
+ disabled: G.value
908
915
  }]),
909
- title: C(d)("color.background"),
910
- onClick: Xe
916
+ title: w(d)("color.background"),
917
+ onClick: X
911
918
  }, [o("div", {
912
919
  class: p(["color-swatch bg", {
913
- mixed: He.value,
914
- transparent: !He.value && Z.value === "transparent"
920
+ mixed: V.value,
921
+ transparent: !V.value && B.value === "transparent"
915
922
  }]),
916
- style: m({ background: He.value || Z.value === "transparent" ? "none" : Z.value })
917
- }, [He.value ? (_(), a("svg", Ne, [...c[22] ||= [o("line", {
923
+ style: m({ background: V.value || B.value === "transparent" ? "none" : B.value })
924
+ }, [V.value ? (_(), a("svg", Xt, [...c[22] ||= [o("line", {
918
925
  x1: "5",
919
926
  y1: "12",
920
927
  x2: "19",
@@ -924,23 +931,23 @@ var te = 800, R = 600, ne = 3, z = 16, re = 8, B = A("canvas", () => {
924
931
  y1: "5",
925
932
  x2: "12",
926
933
  y2: "19"
927
- }, null, -1)]])) : Z.value === "transparent" ? (_(), a("svg", Pe, [...c[23] ||= [o("line", {
934
+ }, null, -1)]])) : B.value === "transparent" ? (_(), a("svg", Zt, [...c[23] ||= [o("line", {
928
935
  x1: "5",
929
936
  y1: "5",
930
937
  x2: "19",
931
938
  y2: "19"
932
- }, null, -1)]])) : i("", !0)], 6)], 10, Me)
939
+ }, null, -1)]])) : i("", !0)], 6)], 10, Yt)
933
940
  ])
934
941
  ]));
935
942
  }
936
- }), Le = (e, t) => {
943
+ }), en = (e, t) => {
937
944
  let n = e.__vccOpts || e;
938
945
  for (let [e, r] of t) n[e] = r;
939
946
  return n;
940
- }, Re = /*#__PURE__*/ Le(Ie, [["__scopeId", "data-v-9532ade7"]]);
947
+ }, tn = /*#__PURE__*/ en($t, [["__scopeId", "data-v-9532ade7"]]);
941
948
  //#endregion
942
949
  //#region src/components/painter/utils/geometry.ts
943
- function ze(e, t, n, r, i = !1, a = .382) {
950
+ function nn(e, t, n, r, i = !1, a = .382) {
944
951
  let o = i ? -1 : 1, s = [];
945
952
  for (let i = 0; i < 5; i++) {
946
953
  let c = Math.PI / 2 * -1 + Math.PI * 2 * i / 5, l = c + Math.PI / 5;
@@ -954,7 +961,7 @@ function ze(e, t, n, r, i = !1, a = .382) {
954
961
  }
955
962
  return s;
956
963
  }
957
- function Be(e, t, n, r) {
964
+ function rn(e, t, n, r) {
958
965
  let i = n >= 0 ? e : e + n, a = r >= 0 ? t : t + r, o = Math.abs(n), s = Math.abs(r);
959
966
  return r >= 0 ? [
960
967
  {
@@ -984,13 +991,13 @@ function Be(e, t, n, r) {
984
991
  }
985
992
  ];
986
993
  }
987
- function Ve(e, t, n) {
994
+ function an(e, t, n) {
988
995
  let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
989
996
  if (a === 0) return Math.hypot(e.x - t.x, e.y - t.y);
990
997
  let o = ((e.x - t.x) * r + (e.y - t.y) * i) / a;
991
998
  return o = Math.max(0, Math.min(1, o)), Math.hypot(e.x - (t.x + o * r), e.y - (t.y + o * i));
992
999
  }
993
- function X(e, t) {
1000
+ function on(e, t) {
994
1001
  let n = !1;
995
1002
  for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
996
1003
  let a = t[r].x, o = t[r].y, s = t[i].x, c = t[i].y;
@@ -998,12 +1005,12 @@ function X(e, t) {
998
1005
  }
999
1006
  return n;
1000
1007
  }
1001
- function Z(e, t, n, r, i) {
1008
+ function sn(e, t, n, r, i) {
1002
1009
  if (r <= 0 || i <= 0) return !1;
1003
1010
  let a = (e.x - t) / r, o = (e.y - n) / i;
1004
1011
  return a * a + o * o <= 1;
1005
1012
  }
1006
- function He(e) {
1013
+ function cn(e) {
1007
1014
  if (e.length === 0) return {
1008
1015
  x: 0,
1009
1016
  y: 0,
@@ -1019,14 +1026,14 @@ function He(e) {
1019
1026
  height: i - n
1020
1027
  };
1021
1028
  }
1022
- function Q(e, t) {
1029
+ function ln(e, t) {
1023
1030
  let { x: n, y: r, width: i, height: a, type: o, points: s, fillColor: c } = t, l = c !== "none" && c !== "transparent";
1024
1031
  switch (o) {
1025
1032
  case "pencil":
1026
1033
  if (s.length < 2) return !1;
1027
- for (let t = 0; t < s.length - 1; t++) if (Ve(e, s[t], s[t + 1]) < 8) return !0;
1034
+ for (let t = 0; t < s.length - 1; t++) if (an(e, s[t], s[t + 1]) < 8) return !0;
1028
1035
  return !1;
1029
- case "line": return Ve(e, {
1036
+ case "line": return an(e, {
1030
1037
  x: n,
1031
1038
  y: r
1032
1039
  }, {
@@ -1035,7 +1042,7 @@ function Q(e, t) {
1035
1042
  }) < 8;
1036
1043
  case "circle": {
1037
1044
  let t = n + i / 2, o = r + a / 2, s = Math.abs(i) / 2, c = Math.abs(a) / 2;
1038
- return l && Z(e, t, o, s, c) ? !0 : Z(e, t, o, s + 8, c + 8) && !Z(e, t, o, s - 8, c - 8);
1045
+ return l && sn(e, t, o, s, c) ? !0 : sn(e, t, o, s + 8, c + 8) && !sn(e, t, o, s - 8, c - 8);
1039
1046
  }
1040
1047
  case "rect": {
1041
1048
  if (l && e.x >= n && e.x <= n + i && e.y >= r && e.y <= r + a) return !0;
@@ -1043,12 +1050,12 @@ function Q(e, t) {
1043
1050
  return t && !o;
1044
1051
  }
1045
1052
  case "triangle": {
1046
- let t = Be(n, r, i, a);
1047
- return l && X(e, t) ? !0 : X(e, t);
1053
+ let t = rn(n, r, i, a);
1054
+ return l && on(e, t) ? !0 : on(e, t);
1048
1055
  }
1049
1056
  case "star": {
1050
- let t = ze(n + i / 2, r + a / 2, Math.abs(i) / 2, Math.abs(a) / 2, a >= 0);
1051
- return l && X(e, t) ? !0 : X(e, t);
1057
+ let t = nn(n + i / 2, r + a / 2, Math.abs(i) / 2, Math.abs(a) / 2, a >= 0);
1058
+ return l && on(e, t) ? !0 : on(e, t);
1052
1059
  }
1053
1060
  case "text": return e.x >= n - 8 && e.x <= n + Math.max(i, 32) + 8 && e.y >= r - 8 && e.y <= r + Math.max(a, 16) + 8;
1054
1061
  default: return !1;
@@ -1056,32 +1063,32 @@ function Q(e, t) {
1056
1063
  }
1057
1064
  //#endregion
1058
1065
  //#region src/components/painter/composables/useDrawing.ts
1059
- function Ue(e) {
1060
- let t = B(), r = ie(), i = y(!1), a = y({
1066
+ function un(e) {
1067
+ let t = st(), r = ft(), i = b(!1), a = b({
1061
1068
  x: 0,
1062
1069
  y: 0
1063
- }), o = y({
1070
+ }), o = b({
1064
1071
  x: 0,
1065
1072
  y: 0
1066
- }), s = y([]), c = y(!1), l = y(!1), u = y(!1), d = y(!1), f = y(/* @__PURE__ */ new Map()), p = y(!1), m = y(null), h = y(""), g = y(""), _ = y(null), v = y(!1), b = y(0), x = y(0), S = y(0), C = y(0), w = y(!1), T = null;
1067
- function E(e) {
1068
- T = e;
1073
+ }), s = b([]), c = b(!1), l = b(!1), u = b(!1), d = b(!1), f = b(/* @__PURE__ */ new Map()), p = b(!1), m = b(null), h = b(""), g = b(""), _ = b(null), v = b(!1), y = b(0), x = b(0), S = b(0), C = b(0), w = b(!1), ee = null;
1074
+ function T(e) {
1075
+ ee = e;
1069
1076
  }
1070
- function D() {
1077
+ function E() {
1071
1078
  let e = t.editingTextId;
1072
1079
  if (!e || !t.strokes.find((t) => t.id === e)) return;
1073
- let n = T?.() ?? null;
1080
+ let n = ee?.() ?? null;
1074
1081
  n !== null && (n.trim() ? t.updateStroke(e, { text: n }) : (t.strokes = t.strokes.filter((t) => t.id !== e), t.undoStack.length > 0 && t.undoStack.pop()), t.editingTextId = null);
1075
1082
  }
1076
- function O(e) {
1083
+ function D(e) {
1077
1084
  if (!v.value) return;
1078
- let n = e.clientX - b.value, r = e.clientY - x.value;
1085
+ let n = e.clientX - y.value, r = e.clientY - x.value;
1079
1086
  t.setPan(S.value + n, C.value + r);
1080
1087
  }
1081
- function k() {
1082
- v.value && (v.value = !1, window.removeEventListener("mousemove", O), window.removeEventListener("mouseup", k), window.removeEventListener("touchmove", ne), window.removeEventListener("touchend", z));
1088
+ function te() {
1089
+ v.value && (v.value = !1, window.removeEventListener("mousemove", D), window.removeEventListener("mouseup", te), window.removeEventListener("touchmove", ce), window.removeEventListener("touchend", le));
1083
1090
  }
1084
- function A(e, t, n, r, i) {
1091
+ function O(e, t, n, r, i) {
1085
1092
  let a = r - t, o = i - n, s = e === "circle" || e === "rect" || e === "triangle" || e === "star";
1086
1093
  if (e === "line" && u.value) {
1087
1094
  let e = Math.round(Math.atan2(o, a) / (Math.PI / 4)) * (Math.PI / 4), t = Math.hypot(a, o);
@@ -1093,7 +1100,7 @@ function Ue(e) {
1093
1100
  a = a >= 0 ? e : -e, o = o >= 0 ? e : -e;
1094
1101
  }
1095
1102
  if (l.value) {
1096
- let e = j(t, n, t + a, n + o), r = e.width, i = e.height;
1103
+ let e = ne(t, n, t + a, n + o), r = e.width, i = e.height;
1097
1104
  return {
1098
1105
  x: t - r,
1099
1106
  y: n - i,
@@ -1107,9 +1114,9 @@ function Ue(e) {
1107
1114
  y: n,
1108
1115
  width: a,
1109
1116
  height: o
1110
- } : j(t, n, t + a, n + o);
1117
+ } : ne(t, n, t + a, n + o);
1111
1118
  }
1112
- function j(e, t, n, r) {
1119
+ function ne(e, t, n, r) {
1113
1120
  return {
1114
1121
  x: Math.min(e, n),
1115
1122
  y: Math.min(t, r),
@@ -1117,7 +1124,7 @@ function Ue(e) {
1117
1124
  height: Math.abs(r - t)
1118
1125
  };
1119
1126
  }
1120
- let M = n(() => {
1127
+ let re = n(() => {
1121
1128
  if (!i.value) return null;
1122
1129
  let e = r.activeTool;
1123
1130
  if (e === "select" || e === "pan" || e === "zoom" || e === "text") return null;
@@ -1125,7 +1132,7 @@ function Ue(e) {
1125
1132
  return e === "pencil" ? {
1126
1133
  id: "__preview__",
1127
1134
  type: "pencil",
1128
- ...He(s.value),
1135
+ ...cn(s.value),
1129
1136
  points: [...s.value],
1130
1137
  strokeColor: t.foregroundColor,
1131
1138
  fillColor: "none",
@@ -1133,17 +1140,17 @@ function Ue(e) {
1133
1140
  } : {
1134
1141
  id: "__preview__",
1135
1142
  type: e,
1136
- ...A(e, n, c, l, u),
1143
+ ...O(e, n, c, l, u),
1137
1144
  points: [],
1138
1145
  strokeColor: t.foregroundColor,
1139
1146
  fillColor: e === "line" ? "none" : t.backgroundColor,
1140
1147
  strokeWidth: t.strokeWidth
1141
1148
  };
1142
1149
  });
1143
- function N(e) {
1144
- return P(e.clientX, e.clientY);
1150
+ function k(e) {
1151
+ return A(e.clientX, e.clientY);
1145
1152
  }
1146
- function P(n, r) {
1153
+ function A(n, r) {
1147
1154
  let i = e.value;
1148
1155
  if (!i) return {
1149
1156
  x: 0,
@@ -1155,19 +1162,19 @@ function Ue(e) {
1155
1162
  y: (r - a.top) / t.zoomLevel
1156
1163
  };
1157
1164
  }
1158
- function ee(e) {
1159
- I(e.clientX, e.clientY, e.type === "mousedown" ? e : void 0);
1165
+ function ie(e) {
1166
+ M(e.clientX, e.clientY, e.type === "mousedown" ? e : void 0);
1160
1167
  }
1161
- function F(e) {
1168
+ function j(e) {
1162
1169
  if (e.touches.length !== 1) return;
1163
1170
  e.preventDefault();
1164
1171
  let t = e.touches[0];
1165
- I(t.clientX, t.clientY);
1172
+ M(t.clientX, t.clientY);
1166
1173
  }
1167
- function I(n, c, l) {
1168
- let u = P(n, c);
1169
- if (t.editingTextId && r.activeTool !== "text" && D(), r.activeTool === "pan") {
1170
- v.value = !0, b.value = n, x.value = c, S.value = t.panX, C.value = t.panY, window.addEventListener("mousemove", O), window.addEventListener("mouseup", k), window.addEventListener("touchmove", ne, { passive: !1 }), window.addEventListener("touchend", z);
1174
+ function M(n, c, l) {
1175
+ let u = A(n, c);
1176
+ if (t.editingTextId && r.activeTool !== "text" && E(), r.activeTool === "pan") {
1177
+ v.value = !0, y.value = n, x.value = c, S.value = t.panX, C.value = t.panY, window.addEventListener("mousemove", D), window.addEventListener("mouseup", te), window.addEventListener("touchmove", ce, { passive: !1 }), window.addEventListener("touchend", le);
1171
1178
  return;
1172
1179
  }
1173
1180
  if (r.activeTool === "zoom" && l) {
@@ -1182,11 +1189,11 @@ function Ue(e) {
1182
1189
  let e = t.editingTextId;
1183
1190
  if (e) {
1184
1191
  let n = t.strokes.find((t) => t.id === e);
1185
- if (n && Q(u, n)) return;
1192
+ if (n && ln(u, n)) return;
1186
1193
  } else {
1187
- let e = [...t.strokes].reverse().find((e) => Q(u, e));
1194
+ let e = [...t.strokes].reverse().find((e) => ln(u, e));
1188
1195
  if (e && e.type === "text") {
1189
- t.hoveredTextId = null, D(), t.pushUndo(), t.editingTextId = e.id;
1196
+ t.hoveredTextId = null, E(), t.pushUndo(), t.editingTextId = e.id;
1190
1197
  return;
1191
1198
  }
1192
1199
  }
@@ -1194,7 +1201,7 @@ function Ue(e) {
1194
1201
  return;
1195
1202
  }
1196
1203
  if (a.value = u, o.value = u, i.value = !0, r.activeTool === "pencil" && (s.value = [u]), r.activeTool === "select") {
1197
- let e = [...t.strokes].reverse().find((e) => Q(u, e));
1204
+ let e = [...t.strokes].reverse().find((e) => ln(u, e));
1198
1205
  if (e && t.isSelected(e.id)) {
1199
1206
  t.pushUndo(), d.value = !0, f.value.clear();
1200
1207
  for (let e of t.selectedStrokes) f.value.set(e.id, {
@@ -1213,19 +1220,19 @@ function Ue(e) {
1213
1220
  };
1214
1221
  }
1215
1222
  }
1216
- function L(e) {
1217
- R(e.clientX, e.clientY);
1223
+ function ae(e) {
1224
+ se(e.clientX, e.clientY);
1218
1225
  }
1219
- function te(e) {
1226
+ function oe(e) {
1220
1227
  if (e.touches.length !== 1) return;
1221
1228
  e.preventDefault();
1222
1229
  let t = e.touches[0];
1223
- R(t.clientX, t.clientY);
1230
+ se(t.clientX, t.clientY);
1224
1231
  }
1225
- function R(e, n) {
1226
- let c = P(e, n);
1232
+ function se(e, n) {
1233
+ let c = A(e, n);
1227
1234
  if (r.activeTool === "text" && !i.value && !t.editingTextId) {
1228
- let e = [...t.strokes].reverse().find((e) => Q(c, e));
1235
+ let e = [...t.strokes].reverse().find((e) => ln(c, e));
1229
1236
  t.hoveredTextId = e && e.type === "text" ? e.id : null;
1230
1237
  } else i.value || (t.hoveredTextId = null);
1231
1238
  if (i.value && (o.value = c, r.activeTool === "pencil" && s.value.push(c), r.activeTool === "select")) if (d.value) {
@@ -1248,27 +1255,27 @@ function Ue(e) {
1248
1255
  height: Math.abs(c.y - a.value.y)
1249
1256
  };
1250
1257
  }
1251
- function ne(e) {
1258
+ function ce(e) {
1252
1259
  if (!v.value || e.touches.length !== 1) return;
1253
1260
  e.preventDefault();
1254
- let n = e.touches[0], r = n.clientX - b.value, i = n.clientY - x.value;
1261
+ let n = e.touches[0], r = n.clientX - y.value, i = n.clientY - x.value;
1255
1262
  t.setPan(S.value + r, C.value + i);
1256
1263
  }
1257
- function z() {
1258
- v.value && (v.value = !1, window.removeEventListener("mousemove", O), window.removeEventListener("mouseup", k), window.removeEventListener("touchmove", ne), window.removeEventListener("touchend", z));
1264
+ function le() {
1265
+ v.value && (v.value = !1, window.removeEventListener("mousemove", D), window.removeEventListener("mouseup", te), window.removeEventListener("touchmove", ce), window.removeEventListener("touchend", le));
1259
1266
  }
1260
- function re(e) {
1261
- H(e.clientX, e.clientY);
1267
+ function ue(e) {
1268
+ P(e.clientX, e.clientY);
1262
1269
  }
1263
- function V(e) {
1270
+ function N(e) {
1264
1271
  let t = e.changedTouches[0];
1265
- t && H(t.clientX, t.clientY);
1272
+ t && P(t.clientX, t.clientY);
1266
1273
  }
1267
- function H(e, n) {
1274
+ function P(e, n) {
1268
1275
  if (r.activeTool === "zoom") return;
1269
1276
  if (r.activeTool === "text") {
1270
1277
  if (w.value) {
1271
- w.value = !1, D();
1278
+ w.value = !1, E();
1272
1279
  let e = t.buildStroke("text", a.value.x, a.value.y, 0, 0, []);
1273
1280
  t.addStroke(e), t.editingTextId = e.id;
1274
1281
  }
@@ -1276,12 +1283,12 @@ function Ue(e) {
1276
1283
  }
1277
1284
  if (!i.value) return;
1278
1285
  i.value = !1;
1279
- let o = P(e, n), c = o.x - a.value.x, l = o.y - a.value.y, u = Math.hypot(c, l);
1286
+ let o = A(e, n), c = o.x - a.value.x, l = o.y - a.value.y, u = Math.hypot(c, l);
1280
1287
  if (r.activeTool === "select") {
1281
1288
  if (d.value) d.value = !1, f.value.clear(), t.dataVersion++;
1282
1289
  else {
1283
1290
  if (t.isSelecting = !1, u < 3) {
1284
- let e = [...t.strokes].reverse().find((e) => Q(o, e));
1291
+ let e = [...t.strokes].reverse().find((e) => ln(o, e));
1285
1292
  t.selectStroke(e?.id ?? null);
1286
1293
  } else {
1287
1294
  let e = t.selectionBox, n = [];
@@ -1308,7 +1315,7 @@ function Ue(e) {
1308
1315
  let e = s.value.map((e) => ({
1309
1316
  x: Math.round(e.x),
1310
1317
  y: Math.round(e.y)
1311
- })), n = He(e);
1318
+ })), n = cn(e);
1312
1319
  if (n.width < 3 && n.height < 3) {
1313
1320
  t.clearSelection();
1314
1321
  return;
@@ -1322,27 +1329,27 @@ function Ue(e) {
1322
1329
  t.clearSelection();
1323
1330
  return;
1324
1331
  }
1325
- let v = A(p, m, h, o.x, o.y), y = t.buildStroke(p, v.x, v.y, v.width, v.height, []);
1332
+ let v = O(p, m, h, o.x, o.y), y = t.buildStroke(p, v.x, v.y, v.width, v.height, []);
1326
1333
  t.addStroke(y), r.setTool("select");
1327
1334
  }
1328
- function U(e, n) {
1335
+ function F(e, n) {
1329
1336
  t.strokes.find((t) => t.id === e) && (n.trim() ? t.updateStroke(e, { text: n }) : (t.strokes = t.strokes.filter((t) => t.id !== e), t.undoStack.length > 0 && t.undoStack.pop()), t.editingTextId = null, r.activeTool === "text" && r.setTool("select"));
1330
1337
  }
1331
- function W(e) {
1338
+ function I(e) {
1332
1339
  let n = t.strokes.find((t) => t.id === e);
1333
1340
  n && ((!n.text || !n.text.trim()) && (t.strokes = t.strokes.filter((t) => t.id !== e), t.undoStack.length > 0 && t.undoStack.pop()), t.editingTextId = null, r.activeTool === "text" && r.setTool("select"));
1334
1341
  }
1335
- function ae(e) {
1342
+ function L(e) {
1336
1343
  t.pushUndo(), t.editingTextId = e;
1337
1344
  }
1338
- function oe(e) {
1345
+ function R(e) {
1339
1346
  let t = e.ctrlKey || e.metaKey;
1340
1347
  c.value = t, l.value = e.shiftKey, u.value = e.shiftKey;
1341
1348
  }
1342
- function se() {
1349
+ function z() {
1343
1350
  c.value = !1, l.value = !1, u.value = !1;
1344
1351
  }
1345
- function G(e, t) {
1352
+ function B(e, t) {
1346
1353
  let { x: n, y: r, w: i, h: a } = e;
1347
1354
  switch (t) {
1348
1355
  case "nw": return {
@@ -1391,14 +1398,14 @@ function Ue(e) {
1391
1398
  };
1392
1399
  }
1393
1400
  }
1394
- function ce(e) {
1401
+ function V(e) {
1395
1402
  return e === "n" || e === "s" || e === "e" || e === "w";
1396
1403
  }
1397
- function le(e, n, r, i) {
1404
+ function H(e, n, r, i) {
1398
1405
  let s = t.strokes.find((t) => t.id === e);
1399
1406
  if (!s) return;
1400
1407
  t.pushUndo();
1401
- let c = me(s);
1408
+ let c = Y(s);
1402
1409
  _.value = {
1403
1410
  x: c.x,
1404
1411
  y: c.y,
@@ -1411,24 +1418,24 @@ function Ue(e) {
1411
1418
  let e = i.touches[0] || i.changedTouches[0];
1412
1419
  l = e.clientX, u = e.clientY, i.preventDefault();
1413
1420
  } else l = i.clientX, u = i.clientY;
1414
- let d = P(l, u);
1415
- a.value = d, o.value = d, window.addEventListener("mousemove", ue), window.addEventListener("mouseup", de), window.addEventListener("touchmove", K, { passive: !1 }), window.addEventListener("touchend", fe);
1421
+ let d = A(l, u);
1422
+ a.value = d, o.value = d, window.addEventListener("mousemove", U), window.addEventListener("mouseup", K), window.addEventListener("touchmove", W, { passive: !1 }), window.addEventListener("touchend", q);
1416
1423
  }
1417
- function ue(e) {
1418
- q(e.clientX, e.clientY);
1424
+ function U(e) {
1425
+ G(e.clientX, e.clientY);
1419
1426
  }
1420
- function K(e) {
1427
+ function W(e) {
1421
1428
  if (e.touches.length !== 1) return;
1422
1429
  e.preventDefault();
1423
1430
  let t = e.touches[0];
1424
- q(t.clientX, t.clientY);
1431
+ G(t.clientX, t.clientY);
1425
1432
  }
1426
- function q(e, n) {
1433
+ function G(e, n) {
1427
1434
  if (!p.value || !_.value || !m.value) return;
1428
- let r = P(e, n);
1435
+ let r = A(e, n);
1429
1436
  o.value = r;
1430
1437
  let i = _.value, a = i.x + i.width / 2, s = i.y + i.height / 2, c;
1431
- if (l.value && ce(h.value)) {
1438
+ if (l.value && V(h.value)) {
1432
1439
  let { x: e, y: n, width: o, height: l } = i;
1433
1440
  switch (h.value) {
1434
1441
  case "n": {
@@ -1482,10 +1489,10 @@ function Ue(e) {
1482
1489
  return;
1483
1490
  }
1484
1491
  if (l.value) {
1485
- c = A(i.type, a, s, r.x, r.y), t.updateStroke(m.value, c);
1492
+ c = O(i.type, a, s, r.x, r.y), t.updateStroke(m.value, c);
1486
1493
  return;
1487
1494
  }
1488
- if (ce(h.value)) {
1495
+ if (V(h.value)) {
1489
1496
  let { x: e, y: t, width: n, height: a } = i;
1490
1497
  switch (h.value) {
1491
1498
  case "n": {
@@ -1532,13 +1539,13 @@ function Ue(e) {
1532
1539
  };
1533
1540
  }
1534
1541
  } else {
1535
- let e = G({
1542
+ let e = B({
1536
1543
  x: i.x,
1537
1544
  y: i.y,
1538
1545
  w: i.width,
1539
1546
  h: i.height
1540
1547
  }, h.value);
1541
- c = A(i.type, e.x, e.y, r.x, r.y);
1548
+ c = O(i.type, e.x, e.y, r.x, r.y);
1542
1549
  }
1543
1550
  if (_.value?.type === "text") {
1544
1551
  c.width < 1 && (c.width = 1), t.updateStroke(m.value, {
@@ -1550,16 +1557,16 @@ function Ue(e) {
1550
1557
  }
1551
1558
  t.updateStroke(m.value, c);
1552
1559
  }
1553
- function de() {
1554
- pe();
1560
+ function K() {
1561
+ J();
1555
1562
  }
1556
- function fe(e) {
1557
- e.touches.length === 0 && pe();
1563
+ function q(e) {
1564
+ e.touches.length === 0 && J();
1558
1565
  }
1559
- function pe() {
1560
- p.value = !1, m.value = null, h.value = "", g.value = "", _.value = null, t.dataVersion++, window.removeEventListener("mousemove", ue), window.removeEventListener("mouseup", de), window.removeEventListener("touchmove", K), window.removeEventListener("touchend", fe);
1566
+ function J() {
1567
+ p.value = !1, m.value = null, h.value = "", g.value = "", _.value = null, t.dataVersion++, window.removeEventListener("mousemove", U), window.removeEventListener("mouseup", K), window.removeEventListener("touchmove", W), window.removeEventListener("touchend", q);
1561
1568
  }
1562
- function me(e) {
1569
+ function Y(e) {
1563
1570
  let { type: t } = e;
1564
1571
  if (t === "line" || t === "triangle" || t === "star") {
1565
1572
  let { x: t, y: n, width: r, height: i } = e;
@@ -1579,29 +1586,29 @@ function Ue(e) {
1579
1586
  }
1580
1587
  return {
1581
1588
  isDrawing: i,
1582
- previewStroke: M,
1583
- onMouseDown: ee,
1584
- onMouseMove: L,
1585
- onMouseUp: re,
1586
- onTouchStart: F,
1587
- onTouchMove: te,
1588
- onTouchEnd: V,
1589
- getSVGPoint: N,
1590
- updateModifiers: oe,
1591
- clearModifiers: se,
1589
+ previewStroke: re,
1590
+ onMouseDown: ie,
1591
+ onMouseMove: ae,
1592
+ onMouseUp: ue,
1593
+ onTouchStart: j,
1594
+ onTouchMove: oe,
1595
+ onTouchEnd: N,
1596
+ getSVGPoint: k,
1597
+ updateModifiers: R,
1598
+ clearModifiers: z,
1592
1599
  isResizing: p,
1593
1600
  resizeCursor: g,
1594
- startResize: le,
1595
- commitTextEdit: U,
1596
- cancelTextEdit: W,
1597
- startEditText: ae,
1598
- saveCurrentTextEdit: D,
1599
- setTextContentGetter: E
1601
+ startResize: H,
1602
+ commitTextEdit: F,
1603
+ cancelTextEdit: I,
1604
+ startEditText: L,
1605
+ saveCurrentTextEdit: E,
1606
+ setTextContentGetter: T
1600
1607
  };
1601
1608
  }
1602
1609
  //#endregion
1603
1610
  //#region src/components/painter/utils/svg.ts
1604
- function We(e) {
1611
+ function dn(e) {
1605
1612
  if (e.length === 0) return "";
1606
1613
  if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
1607
1614
  if (e.length === 2) return `M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;
@@ -1612,7 +1619,7 @@ function We(e) {
1612
1619
  }
1613
1620
  return t += ` L ${e[e.length - 1].x} ${e[e.length - 1].y}`, t;
1614
1621
  }
1615
- function Ge(e) {
1622
+ function fn(e) {
1616
1623
  let { type: t, x: n, y: r, width: i, height: a, points: o, strokeColor: s, fillColor: c, strokeWidth: l } = e, u = {
1617
1624
  stroke: s,
1618
1625
  fill: c,
@@ -1626,7 +1633,7 @@ function Ge(e) {
1626
1633
  attrs: {
1627
1634
  ...u,
1628
1635
  fill: "none",
1629
- d: We(o)
1636
+ d: dn(o)
1630
1637
  }
1631
1638
  };
1632
1639
  case "line": return {
@@ -1664,7 +1671,7 @@ function Ge(e) {
1664
1671
  }
1665
1672
  };
1666
1673
  case "triangle": {
1667
- let e = Be(n, r, i, a).map((e) => `${e.x},${e.y}`).join(" ");
1674
+ let e = rn(n, r, i, a).map((e) => `${e.x},${e.y}`).join(" ");
1668
1675
  return {
1669
1676
  tag: "polygon",
1670
1677
  attrs: {
@@ -1674,7 +1681,7 @@ function Ge(e) {
1674
1681
  };
1675
1682
  }
1676
1683
  case "star": {
1677
- let e = ze(n + i / 2, r + a / 2, Math.abs(i) / 2, Math.abs(a) / 2, a >= 0).map((e) => `${e.x},${e.y}`).join(" ");
1684
+ let e = nn(n + i / 2, r + a / 2, Math.abs(i) / 2, Math.abs(a) / 2, a >= 0).map((e) => `${e.x},${e.y}`).join(" ");
1678
1685
  return {
1679
1686
  tag: "polygon",
1680
1687
  attrs: {
@@ -1695,45 +1702,45 @@ function Ge(e) {
1695
1702
  }
1696
1703
  //#endregion
1697
1704
  //#region src/components/painter/StrokeRenderer.vue
1698
- var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
1705
+ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1699
1706
  __name: "StrokeRenderer",
1700
1707
  props: {
1701
1708
  stroke: {},
1702
1709
  isSelected: { type: Boolean }
1703
1710
  },
1704
1711
  setup(e) {
1705
- return (t, n) => (_(), r(x(C(Ge)(e.stroke).tag), d(C(Ge)(e.stroke).attrs, {
1712
+ return (t, n) => (_(), r(S(w(fn)(e.stroke).tag), d(w(fn)(e.stroke).attrs, {
1706
1713
  class: { selected: e.isSelected },
1707
1714
  "data-stroke-id": e.stroke.id
1708
1715
  }), null, 16, ["class", "data-stroke-id"]));
1709
1716
  }
1710
- }), [["__scopeId", "data-v-d3706fa4"]]), qe = { key: 0 }, Je = [
1717
+ }), [["__scopeId", "data-v-d3706fa4"]]), mn = { key: 0 }, hn = [
1711
1718
  "x",
1712
1719
  "y",
1713
1720
  "width",
1714
1721
  "height"
1715
- ], Ye = [
1722
+ ], gn = [
1716
1723
  "x",
1717
1724
  "y",
1718
1725
  "onMousedown",
1719
1726
  "onTouchstart"
1720
- ], Xe = [
1727
+ ], _n = [
1721
1728
  "x",
1722
1729
  "y",
1723
1730
  "onMousedown",
1724
1731
  "onTouchstart"
1725
- ], Ze = 6, $ = 8, Qe = /* @__PURE__ */ l({
1732
+ ], vn = 6, $ = 8, yn = /* @__PURE__ */ l({
1726
1733
  __name: "SelectionOverlay",
1727
1734
  props: {
1728
1735
  stroke: {},
1729
1736
  startResize: { type: Function }
1730
1737
  },
1731
1738
  setup(t) {
1732
- let r = t, s = B(), c = n(() => {
1739
+ let r = t, s = st(), c = n(() => {
1733
1740
  let e = s.getStrokeDisplayBounds(r.stroke);
1734
1741
  return {
1735
- x: e.x - Ze,
1736
- y: e.y - Ze,
1742
+ x: e.x - vn,
1743
+ y: e.y - vn,
1737
1744
  w: e.width + 12,
1738
1745
  h: e.height + 12
1739
1746
  };
@@ -1806,7 +1813,7 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
1806
1813
  function p(e, t, n) {
1807
1814
  n.preventDefault(), n.stopPropagation(), r.startResize(r.stroke.id, e, t, n);
1808
1815
  }
1809
- return (n, r) => t.stroke ? (_(), a("g", qe, [
1816
+ return (n, r) => t.stroke ? (_(), a("g", mn, [
1810
1817
  o("rect", {
1811
1818
  x: c.value.x,
1812
1819
  y: c.value.y,
@@ -1817,8 +1824,8 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
1817
1824
  "stroke-width": "2",
1818
1825
  "stroke-dasharray": "6 4",
1819
1826
  rx: "4"
1820
- }, null, 8, Je),
1821
- (_(!0), a(e, null, b(u.value, (e) => D((_(), a("rect", {
1827
+ }, null, 8, hn),
1828
+ (_(!0), a(e, null, x(u.value, (e) => D((_(), a("rect", {
1822
1829
  key: e.name,
1823
1830
  x: e.cx - $ / 2,
1824
1831
  y: e.cy - $ / 2,
@@ -1829,10 +1836,10 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
1829
1836
  "stroke-width": "1.5",
1830
1837
  rx: "1",
1831
1838
  style: m({ cursor: e.cursor }),
1832
- onMousedown: k((t) => p(e.name, e.cursor, t), ["stop", "prevent"]),
1833
- onTouchstart: k((t) => p(e.name, e.cursor, t), ["stop", "prevent"])
1834
- }, null, 44, Ye)), [[T, l.value]])), 128)),
1835
- (_(!0), a(e, null, b(f.value, (e) => D((_(), a("rect", {
1839
+ onMousedown: O((t) => p(e.name, e.cursor, t), ["stop", "prevent"]),
1840
+ onTouchstart: O((t) => p(e.name, e.cursor, t), ["stop", "prevent"])
1841
+ }, null, 44, gn)), [[T, l.value]])), 128)),
1842
+ (_(!0), a(e, null, x(f.value, (e) => D((_(), a("rect", {
1836
1843
  key: e.name,
1837
1844
  x: e.cx - $ / 2,
1838
1845
  y: e.cy - $ / 2,
@@ -1843,68 +1850,68 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
1843
1850
  "stroke-width": "1.5",
1844
1851
  rx: "1",
1845
1852
  style: m({ cursor: e.cursor }),
1846
- onMousedown: k((t) => p(e.name, e.cursor, t), ["stop", "prevent"]),
1847
- onTouchstart: k((t) => p(e.name, e.cursor, t), ["stop", "prevent"])
1848
- }, null, 44, Xe)), [[T, !l.value]])), 128))
1853
+ onMousedown: O((t) => p(e.name, e.cursor, t), ["stop", "prevent"]),
1854
+ onTouchstart: O((t) => p(e.name, e.cursor, t), ["stop", "prevent"])
1855
+ }, null, 44, _n)), [[T, !l.value]])), 128))
1849
1856
  ])) : i("", !0);
1850
1857
  }
1851
- }), $e = ["viewBox"], et = [
1858
+ }), bn = ["viewBox"], xn = [
1852
1859
  "width",
1853
1860
  "height",
1854
1861
  "fill"
1855
- ], tt = [
1862
+ ], Sn = [
1856
1863
  "width",
1857
1864
  "height",
1858
1865
  "fill"
1859
- ], nt = [
1866
+ ], Cn = [
1860
1867
  "width",
1861
1868
  "height",
1862
1869
  "stroke"
1863
- ], rt = { class: "strokes-layer" }, it = [
1870
+ ], wn = { class: "strokes-layer" }, Tn = [
1864
1871
  "x",
1865
1872
  "y",
1866
1873
  "width"
1867
- ], at = ["contenteditable", "onDblclick"], ot = [
1874
+ ], En = ["contenteditable", "onDblclick"], Dn = [
1868
1875
  "x",
1869
1876
  "y",
1870
1877
  "width",
1871
1878
  "height"
1872
- ], st = [
1879
+ ], On = [
1873
1880
  "x",
1874
1881
  "y",
1875
1882
  "width",
1876
1883
  "height"
1877
- ], ct = ["disabled", "title"], lt = ["disabled", "title"], ut = ["title"], dt = ["title"], ft = ["title"], pt = ["title"], mt = { class: "zoom-percent" }, ht = ["title"], gt = { class: "font-size-value" }, _t = ["title"], vt = ["title"], yt = ["title"], bt = /*#__PURE__*/ Le(/* @__PURE__ */ l({
1884
+ ], kn = ["disabled", "title"], An = ["disabled", "title"], jn = ["title"], Mn = ["title"], Nn = ["title"], Pn = ["title"], Fn = { class: "zoom-percent" }, In = ["title"], Ln = { class: "font-size-value" }, Rn = ["title"], zn = ["title"], Bn = ["title"], Vn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1878
1885
  __name: "Whiteboard",
1879
1886
  setup(t) {
1880
- let c = B(), l = ie(), { t: u } = ee(), d = y(null), { isDrawing: v, previewStroke: x, onMouseDown: w, onMouseMove: T, onMouseUp: D, onTouchStart: O, onTouchMove: A, onTouchEnd: j, updateModifiers: M, clearModifiers: N, isResizing: P, resizeCursor: F, startResize: I, commitTextEdit: L, cancelTextEdit: te, startEditText: R, saveCurrentTextEdit: ne, setTextContentGetter: z } = Ue(d);
1881
- z(() => {
1887
+ let c = st(), l = ft(), { t: u } = ie(), d = b(null), { isDrawing: v, previewStroke: y, onMouseDown: S, onMouseMove: ee, onMouseUp: T, onTouchStart: D, onTouchMove: te, onTouchEnd: ne, updateModifiers: re, clearModifiers: k, isResizing: A, resizeCursor: j, startResize: M, commitTextEdit: ae, cancelTextEdit: oe, startEditText: se, saveCurrentTextEdit: ce, setTextContentGetter: le } = un(d);
1888
+ le(() => {
1882
1889
  let e = c.editingTextId;
1883
1890
  if (!e) return null;
1884
- let t = H.value.get(e);
1891
+ let t = P.value.get(e);
1885
1892
  return t ? t.innerText : null;
1886
1893
  }), E(() => l.activeTool, (e) => {
1887
- e !== "text" && ne();
1894
+ e !== "text" && ce();
1888
1895
  });
1889
- let re = n(() => P.value ? F.value : l.activeTool === "pan" ? "grab" : l.activeTool === "zoom" ? "zoom-in" : l.activeTool === "text" ? c.hoveredTextId ? "pointer" : "text" : l.activeTool === "select" ? "default" : "crosshair"), V = n(() => l.activeTool === "zoom"), H = y(/* @__PURE__ */ new Map()), U = n(() => {
1896
+ let ue = n(() => A.value ? j.value : l.activeTool === "pan" ? "grab" : l.activeTool === "zoom" ? "zoom-in" : l.activeTool === "text" ? c.hoveredTextId ? "pointer" : "text" : l.activeTool === "select" ? "default" : "crosshair"), N = n(() => l.activeTool === "zoom"), P = b(/* @__PURE__ */ new Map()), F = n(() => {
1890
1897
  let e = c.hoveredTextId;
1891
1898
  if (!e) return null;
1892
1899
  let t = c.strokes.find((t) => t.id === e);
1893
1900
  return t ? c.getStrokeDisplayBounds(t) : null;
1894
- }), W = n(() => {
1901
+ }), I = n(() => {
1895
1902
  let e = c.selectedStrokes;
1896
1903
  return e.length === 1 && e[0].type === "text" ? e[0] : null;
1897
1904
  });
1898
- function ae(e) {
1905
+ function L(e) {
1899
1906
  if (c.editingTextId) if (e.key === "Enter" && !e.shiftKey) {
1900
1907
  e.preventDefault(), e.stopPropagation();
1901
- let t = H.value.get(c.editingTextId), n = t ? t.innerText : "";
1902
- L(c.editingTextId, n), f(() => {});
1903
- } else e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), te(c.editingTextId));
1908
+ let t = P.value.get(c.editingTextId), n = t ? t.innerText : "";
1909
+ ae(c.editingTextId, n), f(() => {});
1910
+ } else e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), oe(c.editingTextId));
1904
1911
  }
1905
1912
  E(() => c.editingTextId, (e) => {
1906
1913
  e && f(() => {
1907
- let t = H.value.get(e);
1914
+ let t = P.value.get(e);
1908
1915
  if (t) {
1909
1916
  t.focus();
1910
1917
  let e = document.createRange();
@@ -1914,73 +1921,73 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
1914
1921
  }
1915
1922
  });
1916
1923
  });
1917
- function oe(e) {
1918
- (l.activeTool === "text" || l.activeTool === "select") && R(e);
1924
+ function R(e) {
1925
+ (l.activeTool === "text" || l.activeTool === "select") && se(e);
1919
1926
  }
1920
- function se() {
1927
+ function z() {
1921
1928
  c.hoveredTextId = null;
1922
1929
  }
1923
- function G() {
1930
+ function B() {
1924
1931
  let e = d.value?.parentElement;
1925
1932
  e && c.zoomAt(e.clientWidth / 2, e.clientHeight / 2, 1.1);
1926
1933
  }
1927
- function ce() {
1934
+ function V() {
1928
1935
  let e = d.value?.parentElement;
1929
1936
  e && c.zoomAt(e.clientWidth / 2, e.clientHeight / 2, .9);
1930
1937
  }
1931
- function le(e) {
1938
+ function H(e) {
1932
1939
  let t = e.ctrlKey || e.metaKey;
1933
- c.editingTextId || ((v.value || P.value) && M(e), e.key === "Delete" || e.key === "Backspace" ? c.deleteSelectedStrokes() : e.key === "Escape" ? c.clearSelection() : t && e.key === "z" && !e.shiftKey ? (e.preventDefault(), c.undo()) : t && (e.key === "y" || e.shiftKey && e.key === "z") ? (e.preventDefault(), c.redo()) : t && e.key === "x" ? (e.preventDefault(), c.cutSelectedStrokes()) : t && e.key === "c" ? (e.preventDefault(), c.copySelectedStrokes()) : t && e.key === "v" && (e.preventDefault(), c.pasteStrokes()));
1940
+ c.editingTextId || ((v.value || A.value) && re(e), e.key === "Delete" || e.key === "Backspace" ? c.deleteSelectedStrokes() : e.key === "Escape" ? c.clearSelection() : t && e.key === "z" && !e.shiftKey ? (e.preventDefault(), c.undo()) : t && (e.key === "y" || e.shiftKey && e.key === "z") ? (e.preventDefault(), c.redo()) : t && e.key === "x" ? (e.preventDefault(), c.cutSelectedStrokes()) : t && e.key === "c" ? (e.preventDefault(), c.copySelectedStrokes()) : t && e.key === "v" && (e.preventDefault(), c.pasteStrokes()));
1934
1941
  }
1935
- function ue(e) {
1936
- (v.value || P.value) && M(e);
1942
+ function U(e) {
1943
+ (v.value || A.value) && re(e);
1937
1944
  }
1938
- function K() {
1939
- N();
1945
+ function W() {
1946
+ k();
1940
1947
  }
1941
- let q = y(0), de = y(1), fe = y(0), pe = y(0);
1942
- function me(e) {
1948
+ let G = b(0), K = b(1), q = b(0), J = b(0);
1949
+ function Y(e) {
1943
1950
  let t = e[0].clientX - e[1].clientX, n = e[0].clientY - e[1].clientY;
1944
1951
  return Math.hypot(t, n);
1945
1952
  }
1946
- function he(e) {
1947
- l.activeTool === "zoom" && e.touches.length === 2 && (q.value = me(e.touches), de.value = c.zoomLevel, fe.value = (e.touches[0].clientX + e.touches[1].clientX) / 2, pe.value = (e.touches[0].clientY + e.touches[1].clientY) / 2);
1953
+ function X(e) {
1954
+ l.activeTool === "zoom" && e.touches.length === 2 && (G.value = Y(e.touches), K.value = c.zoomLevel, q.value = (e.touches[0].clientX + e.touches[1].clientX) / 2, J.value = (e.touches[0].clientY + e.touches[1].clientY) / 2);
1948
1955
  }
1949
- function ge(e) {
1950
- if (l.activeTool === "zoom" && e.touches.length === 2 && q.value > 0) {
1951
- let t = me(e.touches) / q.value, n = de.value * t, r = d.value;
1956
+ function de(e) {
1957
+ if (l.activeTool === "zoom" && e.touches.length === 2 && G.value > 0) {
1958
+ let t = Y(e.touches) / G.value, n = K.value * t, r = d.value;
1952
1959
  if (r) {
1953
1960
  let e = r.getBoundingClientRect();
1954
- c.continuousZoomAt(fe.value - e.left, pe.value - e.top, n);
1961
+ c.continuousZoomAt(q.value - e.left, J.value - e.top, n);
1955
1962
  }
1956
1963
  }
1957
1964
  }
1958
- function _e(e) {
1959
- l.activeTool === "zoom" && e.touches.length < 2 && (q.value = 0);
1965
+ function Z(e) {
1966
+ l.activeTool === "zoom" && e.touches.length < 2 && (G.value = 0);
1960
1967
  }
1961
- let ve = null;
1962
- function ye() {
1968
+ let fe = null;
1969
+ function pe() {
1963
1970
  let e = d.value?.parentElement;
1964
1971
  if (!e) return;
1965
1972
  let t = c.canvasWidth * c.zoomLevel, n = c.canvasHeight * c.zoomLevel, r = e.clientWidth, i = e.clientHeight;
1966
1973
  r > 0 && i > 0 && c.setPan((r - t) / 2, (i - n) / 2);
1967
1974
  }
1968
- function J(e) {
1969
- let t = W.value;
1975
+ function me(e) {
1976
+ let t = I.value;
1970
1977
  if (!t) return;
1971
1978
  let n = t.fontSize ?? 16, r = Math.max(8, Math.min(200, n + e));
1972
1979
  c.pushUndo(), c.updateStroke(t.id, { fontSize: r }), c.dataVersion++;
1973
1980
  }
1974
- function Y(e) {
1975
- let t = W.value;
1981
+ function he(e) {
1982
+ let t = I.value;
1976
1983
  t && (c.pushUndo(), c.updateStroke(t.id, { textAlign: e }), c.dataVersion++);
1977
1984
  }
1978
- function be(e) {
1985
+ function ge(e) {
1979
1986
  return (t) => {
1980
- t ? (H.value.set(e, t), f(() => xe(e, t))) : H.value.delete(e);
1987
+ t ? (P.value.set(e, t), f(() => _e(e, t))) : P.value.delete(e);
1981
1988
  };
1982
1989
  }
1983
- function xe(e, t) {
1990
+ function _e(e, t) {
1984
1991
  let n = c.strokes.find((t) => t.id === e);
1985
1992
  if (!n) return;
1986
1993
  let r = Math.max(t.scrollWidth / c.zoomLevel, n.fontSize ?? 16), i = Math.max(t.scrollHeight / c.zoomLevel, n.fontSize ?? 16);
@@ -2000,25 +2007,25 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2000
2007
  }
2001
2008
  }
2002
2009
  return h(() => {
2003
- window.addEventListener("keydown", le), window.addEventListener("keydown", ae), window.addEventListener("keyup", ue), window.addEventListener("blur", K), ye(), ve = new ResizeObserver(() => ye());
2010
+ window.addEventListener("keydown", H), window.addEventListener("keydown", L), window.addEventListener("keyup", U), window.addEventListener("blur", W), pe(), fe = new ResizeObserver(() => pe());
2004
2011
  let e = d.value?.parentElement;
2005
- e && ve.observe(e);
2012
+ e && fe.observe(e);
2006
2013
  }), g(() => {
2007
- window.removeEventListener("keydown", le), window.removeEventListener("keydown", ae), window.removeEventListener("keyup", ue), window.removeEventListener("blur", K), ve?.disconnect();
2014
+ window.removeEventListener("keydown", H), window.removeEventListener("keydown", L), window.removeEventListener("keyup", U), window.removeEventListener("blur", W), fe?.disconnect();
2008
2015
  }), (t, n) => (_(), a("div", {
2009
2016
  class: "whiteboard",
2010
- onContextmenu: n[23] ||= k(() => {}, ["prevent"]),
2011
- onMousedown: n[24] ||= (...e) => C(w) && C(w)(...e),
2012
- onMousemove: n[25] ||= (...e) => C(T) && C(T)(...e),
2013
- onMouseup: n[26] ||= (...e) => C(D) && C(D)(...e),
2014
- onTouchstart: n[27] ||= k((e) => {
2015
- C(O)(e), he(e);
2017
+ onContextmenu: n[23] ||= O(() => {}, ["prevent"]),
2018
+ onMousedown: n[24] ||= (...e) => w(S) && w(S)(...e),
2019
+ onMousemove: n[25] ||= (...e) => w(ee) && w(ee)(...e),
2020
+ onMouseup: n[26] ||= (...e) => w(T) && w(T)(...e),
2021
+ onTouchstart: n[27] ||= O((e) => {
2022
+ w(D)(e), X(e);
2016
2023
  }, ["prevent"]),
2017
- onTouchmove: n[28] ||= k((e) => {
2018
- C(A)(e), ge(e);
2024
+ onTouchmove: n[28] ||= O((e) => {
2025
+ w(te)(e), de(e);
2019
2026
  }, ["prevent"]),
2020
2027
  onTouchend: n[29] ||= (e) => {
2021
- C(j)(e), _e(e);
2028
+ w(ne)(e), Z(e);
2022
2029
  }
2023
2030
  }, [
2024
2031
  o("div", {
@@ -2026,45 +2033,45 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2026
2033
  ref: d,
2027
2034
  class: "canvas-wrapper",
2028
2035
  style: m({
2029
- width: C(c).canvasWidth + "px",
2030
- height: C(c).canvasHeight + "px",
2031
- transform: C(c).canvasTransform,
2036
+ width: w(c).canvasWidth + "px",
2037
+ height: w(c).canvasHeight + "px",
2038
+ transform: w(c).canvasTransform,
2032
2039
  transformOrigin: "0 0"
2033
2040
  })
2034
2041
  }, [(_(), a("svg", {
2035
2042
  class: "canvas",
2036
- viewBox: C(c).viewBox,
2043
+ viewBox: w(c).viewBox,
2037
2044
  width: "100%",
2038
2045
  height: "100%",
2039
- style: m({ cursor: re.value }),
2040
- onMouseleave: se
2046
+ style: m({ cursor: ue.value }),
2047
+ onMouseleave: z
2041
2048
  }, [
2042
2049
  n[30] ||= s("<defs data-v-975e0b8b><pattern id=\"grid-light\" width=\"16\" height=\"16\" patternUnits=\"userSpaceOnUse\" data-v-975e0b8b><rect width=\"16\" height=\"16\" fill=\"#ffffff\" data-v-975e0b8b></rect><rect width=\"8\" height=\"8\" fill=\"#f0f0f0\" data-v-975e0b8b></rect><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" fill=\"#f0f0f0\" data-v-975e0b8b></rect></pattern><pattern id=\"grid-dark\" width=\"16\" height=\"16\" patternUnits=\"userSpaceOnUse\" data-v-975e0b8b><rect width=\"16\" height=\"16\" fill=\"#1e1e30\" data-v-975e0b8b></rect><rect width=\"8\" height=\"8\" fill=\"#2a2a3e\" data-v-975e0b8b></rect><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" fill=\"#2a2a3e\" data-v-975e0b8b></rect></pattern></defs>", 1),
2043
- C(c).canvasBackgroundColor === "transparent" ? (_(), a("rect", {
2050
+ w(c).canvasBackgroundColor === "transparent" ? (_(), a("rect", {
2044
2051
  key: 0,
2045
2052
  x: "0",
2046
2053
  y: "0",
2047
- width: C(c).canvasWidth,
2048
- height: C(c).canvasHeight,
2049
- fill: C(c).theme === "dark" ? "url(#grid-dark)" : "url(#grid-light)"
2050
- }, null, 8, et)) : (_(), a("rect", {
2054
+ width: w(c).canvasWidth,
2055
+ height: w(c).canvasHeight,
2056
+ fill: w(c).theme === "dark" ? "url(#grid-dark)" : "url(#grid-light)"
2057
+ }, null, 8, xn)) : (_(), a("rect", {
2051
2058
  key: 1,
2052
2059
  x: "0",
2053
2060
  y: "0",
2054
- width: C(c).canvasWidth,
2055
- height: C(c).canvasHeight,
2056
- fill: C(c).canvasBackgroundColor
2057
- }, null, 8, tt)),
2061
+ width: w(c).canvasWidth,
2062
+ height: w(c).canvasHeight,
2063
+ fill: w(c).canvasBackgroundColor
2064
+ }, null, 8, Sn)),
2058
2065
  o("rect", {
2059
2066
  x: "0",
2060
2067
  y: "0",
2061
- width: C(c).canvasWidth,
2062
- height: C(c).canvasHeight,
2068
+ width: w(c).canvasWidth,
2069
+ height: w(c).canvasHeight,
2063
2070
  fill: "none",
2064
- stroke: C(c).theme === "dark" ? "#4a4a5a" : "#c0c0c0",
2071
+ stroke: w(c).theme === "dark" ? "#4a4a5a" : "#c0c0c0",
2065
2072
  "stroke-width": "2"
2066
- }, null, 8, nt),
2067
- o("g", rt, [(_(!0), a(e, null, b(C(c).strokes, (t) => (_(), a(e, { key: t.id }, [t.type === "text" ? (_(), a("foreignObject", {
2073
+ }, null, 8, Cn),
2074
+ o("g", wn, [(_(!0), a(e, null, x(w(c).strokes, (t) => (_(), a(e, { key: t.id }, [t.type === "text" ? (_(), a("foreignObject", {
2068
2075
  key: 0,
2069
2076
  x: t.x,
2070
2077
  y: t.y,
@@ -2076,9 +2083,9 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2076
2083
  }
2077
2084
  }, [o("div", {
2078
2085
  ref_for: !0,
2079
- ref: be(t.id),
2086
+ ref: ge(t.id),
2080
2087
  xmlns: "http://www.w3.org/1999/xhtml",
2081
- contenteditable: C(c).editingTextId === t.id,
2088
+ contenteditable: w(c).editingTextId === t.id,
2082
2089
  style: m({
2083
2090
  fontSize: (t.fontSize ?? 16) + "px",
2084
2091
  color: t.textColor ?? t.strokeColor,
@@ -2087,69 +2094,69 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2087
2094
  wordBreak: t.textAutoWidth ? "normal" : "break-word",
2088
2095
  padding: "2px 4px",
2089
2096
  minHeight: (t.fontSize ?? 16) + "px",
2090
- outline: C(c).editingTextId === t.id ? "2px solid #6366f1" : "none",
2091
- cursor: C(c).editingTextId === t.id ? "text" : "default",
2092
- userSelect: C(c).editingTextId === t.id ? "text" : "none",
2093
- pointerEvents: C(c).editingTextId === t.id ? "auto" : "none",
2094
- background: C(c).editingTextId === t.id ? "rgba(255,255,255,0.9)" : "transparent",
2097
+ outline: w(c).editingTextId === t.id ? "2px solid #6366f1" : "none",
2098
+ cursor: w(c).editingTextId === t.id ? "text" : "default",
2099
+ userSelect: w(c).editingTextId === t.id ? "text" : "none",
2100
+ pointerEvents: w(c).editingTextId === t.id ? "auto" : "none",
2101
+ background: w(c).editingTextId === t.id ? "rgba(255,255,255,0.9)" : "transparent",
2095
2102
  borderRadius: "2px",
2096
2103
  display: "inline-block",
2097
2104
  maxWidth: t.textAutoWidth ? "none" : "100%"
2098
2105
  }),
2099
- onDblclick: k((e) => oe(t.id), ["stop"])
2100
- }, S(t.text || ""), 45, at)], 8, it)) : (_(), r(Ke, {
2106
+ onDblclick: O((e) => R(t.id), ["stop"])
2107
+ }, C(t.text || ""), 45, En)], 8, Tn)) : (_(), r(pn, {
2101
2108
  key: 1,
2102
2109
  stroke: t,
2103
- "is-selected": C(c).isSelected(t.id)
2110
+ "is-selected": w(c).isSelected(t.id)
2104
2111
  }, null, 8, ["stroke", "is-selected"]))], 64))), 128))]),
2105
- C(x) ? (_(), r(Ke, {
2112
+ w(y) ? (_(), r(pn, {
2106
2113
  key: 2,
2107
- stroke: C(x),
2114
+ stroke: w(y),
2108
2115
  "is-selected": !1
2109
2116
  }, null, 8, ["stroke"])) : i("", !0),
2110
- (_(!0), a(e, null, b(C(c).selectedStrokes, (e) => (_(), r(Qe, {
2117
+ (_(!0), a(e, null, x(w(c).selectedStrokes, (e) => (_(), r(yn, {
2111
2118
  key: "sel-" + e.id,
2112
2119
  stroke: e,
2113
- "start-resize": C(I)
2120
+ "start-resize": w(M)
2114
2121
  }, null, 8, ["stroke", "start-resize"]))), 128)),
2115
- C(c).isSelecting && C(c).selectionBox ? (_(), a("rect", {
2122
+ w(c).isSelecting && w(c).selectionBox ? (_(), a("rect", {
2116
2123
  key: 3,
2117
- x: C(c).selectionBox.x,
2118
- y: C(c).selectionBox.y,
2119
- width: C(c).selectionBox.width,
2120
- height: C(c).selectionBox.height,
2124
+ x: w(c).selectionBox.x,
2125
+ y: w(c).selectionBox.y,
2126
+ width: w(c).selectionBox.width,
2127
+ height: w(c).selectionBox.height,
2121
2128
  fill: "rgba(99, 102, 241, 0.08)",
2122
2129
  stroke: "#6366f1",
2123
2130
  "stroke-width": "1",
2124
2131
  "stroke-dasharray": "6 4"
2125
- }, null, 8, ot)) : i("", !0),
2126
- U.value ? (_(), a("rect", {
2132
+ }, null, 8, Dn)) : i("", !0),
2133
+ F.value ? (_(), a("rect", {
2127
2134
  key: 4,
2128
- x: U.value.x - 4,
2129
- y: U.value.y - 4,
2130
- width: U.value.width + 8,
2131
- height: U.value.height + 8,
2135
+ x: F.value.x - 4,
2136
+ y: F.value.y - 4,
2137
+ width: F.value.width + 8,
2138
+ height: F.value.height + 8,
2132
2139
  fill: "none",
2133
2140
  stroke: "#6366f1",
2134
2141
  "stroke-width": "1",
2135
2142
  "stroke-dasharray": "4 3",
2136
2143
  "pointer-events": "none"
2137
- }, null, 8, st)) : i("", !0)
2138
- ], 44, $e))], 4),
2144
+ }, null, 8, On)) : i("", !0)
2145
+ ], 44, bn))], 4),
2139
2146
  o("div", {
2140
2147
  class: "canvas-toolbar",
2141
- onMousedown: n[5] ||= k(() => {}, ["stop"]),
2142
- onMouseup: n[6] ||= k(() => {}, ["stop"]),
2143
- onClick: n[7] ||= k(() => {}, ["stop"]),
2144
- onTouchstart: n[8] ||= k(() => {}, ["stop"]),
2145
- onTouchmove: n[9] ||= k(() => {}, ["stop"]),
2146
- onTouchend: n[10] ||= k(() => {}, ["stop"])
2148
+ onMousedown: n[5] ||= O(() => {}, ["stop"]),
2149
+ onMouseup: n[6] ||= O(() => {}, ["stop"]),
2150
+ onClick: n[7] ||= O(() => {}, ["stop"]),
2151
+ onTouchstart: n[8] ||= O(() => {}, ["stop"]),
2152
+ onTouchmove: n[9] ||= O(() => {}, ["stop"]),
2153
+ onTouchend: n[10] ||= O(() => {}, ["stop"])
2147
2154
  }, [
2148
2155
  o("button", {
2149
2156
  class: "canvas-tb-btn",
2150
- disabled: !C(c).canUndo,
2151
- title: C(u)("toolbar.undo"),
2152
- onClick: n[0] ||= (e) => C(c).undo()
2157
+ disabled: !w(c).canUndo,
2158
+ title: w(u)("toolbar.undo"),
2159
+ onClick: n[0] ||= (e) => w(c).undo()
2153
2160
  }, [...n[31] ||= [o("svg", {
2154
2161
  width: "16",
2155
2162
  height: "16",
@@ -2159,12 +2166,12 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2159
2166
  "stroke-width": "2",
2160
2167
  "stroke-linecap": "round",
2161
2168
  "stroke-linejoin": "round"
2162
- }, [o("path", { d: "M3 10h10a5 5 0 0 1 0 10H9" }), o("polyline", { points: "7 6 3 10 7 14" })], -1)]], 8, ct),
2169
+ }, [o("path", { d: "M3 10h10a5 5 0 0 1 0 10H9" }), o("polyline", { points: "7 6 3 10 7 14" })], -1)]], 8, kn),
2163
2170
  o("button", {
2164
2171
  class: "canvas-tb-btn",
2165
- disabled: !C(c).canRedo,
2166
- title: C(u)("toolbar.redo"),
2167
- onClick: n[1] ||= (e) => C(c).redo()
2172
+ disabled: !w(c).canRedo,
2173
+ title: w(u)("toolbar.redo"),
2174
+ onClick: n[1] ||= (e) => w(c).redo()
2168
2175
  }, [...n[32] ||= [o("svg", {
2169
2176
  width: "16",
2170
2177
  height: "16",
@@ -2174,12 +2181,12 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2174
2181
  "stroke-width": "2",
2175
2182
  "stroke-linecap": "round",
2176
2183
  "stroke-linejoin": "round"
2177
- }, [o("path", { d: "M21 10H11a5 5 0 0 0 0 10h4" }), o("polyline", { points: "17 6 21 10 17 14" })], -1)]], 8, lt),
2178
- C(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2184
+ }, [o("path", { d: "M21 10H11a5 5 0 0 0 0 10h4" }), o("polyline", { points: "17 6 21 10 17 14" })], -1)]], 8, An),
2185
+ w(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2179
2186
  key: 0,
2180
2187
  class: "canvas-tb-btn",
2181
- title: C(u)("toolbar.bringToFront"),
2182
- onClick: n[2] ||= (e) => C(c).moveSelectedUp()
2188
+ title: w(u)("toolbar.bringToFront"),
2189
+ onClick: n[2] ||= (e) => w(c).moveSelectedUp()
2183
2190
  }, [...n[33] ||= [o("svg", {
2184
2191
  width: "16",
2185
2192
  height: "16",
@@ -2189,12 +2196,12 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2189
2196
  "stroke-width": "2",
2190
2197
  "stroke-linecap": "round",
2191
2198
  "stroke-linejoin": "round"
2192
- }, [o("path", { d: "m18 15-6-6-6 6" })], -1)]], 8, ut)) : i("", !0),
2193
- C(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2199
+ }, [o("path", { d: "m18 15-6-6-6 6" })], -1)]], 8, jn)) : i("", !0),
2200
+ w(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2194
2201
  key: 1,
2195
2202
  class: "canvas-tb-btn",
2196
- title: C(u)("toolbar.sendToBack"),
2197
- onClick: n[3] ||= (e) => C(c).moveSelectedDown()
2203
+ title: w(u)("toolbar.sendToBack"),
2204
+ onClick: n[3] ||= (e) => w(c).moveSelectedDown()
2198
2205
  }, [...n[34] ||= [o("svg", {
2199
2206
  width: "16",
2200
2207
  height: "16",
@@ -2204,25 +2211,25 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2204
2211
  "stroke-width": "2",
2205
2212
  "stroke-linecap": "round",
2206
2213
  "stroke-linejoin": "round"
2207
- }, [o("path", { d: "m6 9 6 6 6-6" })], -1)]], 8, dt)) : i("", !0),
2208
- C(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2214
+ }, [o("path", { d: "m6 9 6 6 6-6" })], -1)]], 8, Mn)) : i("", !0),
2215
+ w(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2209
2216
  key: 2,
2210
2217
  class: "canvas-tb-btn canvas-tb-btn--danger",
2211
- title: C(u)("toolbar.delete"),
2212
- onClick: n[4] ||= (e) => C(c).deleteSelectedStrokes()
2213
- }, [...n[35] ||= [s("<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><polyline points=\"3 6 5 6 21 6\" data-v-975e0b8b></polyline><path d=\"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6\" data-v-975e0b8b></path><path d=\"M10 11v6\" data-v-975e0b8b></path><path d=\"M14 11v6\" data-v-975e0b8b></path><path d=\"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\" data-v-975e0b8b></path></svg>", 1)]], 8, ft)) : i("", !0)
2218
+ title: w(u)("toolbar.delete"),
2219
+ onClick: n[4] ||= (e) => w(c).deleteSelectedStrokes()
2220
+ }, [...n[35] ||= [s("<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><polyline points=\"3 6 5 6 21 6\" data-v-975e0b8b></polyline><path d=\"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6\" data-v-975e0b8b></path><path d=\"M10 11v6\" data-v-975e0b8b></path><path d=\"M14 11v6\" data-v-975e0b8b></path><path d=\"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\" data-v-975e0b8b></path></svg>", 1)]], 8, Nn)) : i("", !0)
2214
2221
  ], 32),
2215
- V.value || C(c).showZoomIndicator ? (_(), a("div", {
2222
+ N.value || w(c).showZoomIndicator ? (_(), a("div", {
2216
2223
  key: 0,
2217
2224
  class: "zoom-control",
2218
- onTouchstart: n[11] ||= k(() => {}, ["stop", "prevent"])
2225
+ onTouchstart: n[11] ||= O(() => {}, ["stop", "prevent"])
2219
2226
  }, [
2220
- V.value ? (_(), a("button", {
2227
+ N.value ? (_(), a("button", {
2221
2228
  key: 0,
2222
2229
  class: "zoom-btn",
2223
- title: C(u)("zoom.zoomOut"),
2224
- onMousedown: k(ce, ["stop", "prevent"]),
2225
- onTouchstart: k(ce, ["stop", "prevent"])
2230
+ title: w(u)("zoom.zoomOut"),
2231
+ onMousedown: O(V, ["stop", "prevent"]),
2232
+ onTouchstart: O(V, ["stop", "prevent"])
2226
2233
  }, [...n[36] ||= [o("svg", {
2227
2234
  width: "16",
2228
2235
  height: "16",
@@ -2236,14 +2243,14 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2236
2243
  y1: "12",
2237
2244
  x2: "19",
2238
2245
  y2: "12"
2239
- })], -1)]], 40, pt)) : i("", !0),
2240
- o("span", mt, S(C(c).getZoomPercent()) + "%", 1),
2241
- V.value ? (_(), a("button", {
2246
+ })], -1)]], 40, Pn)) : i("", !0),
2247
+ o("span", Fn, C(w(c).getZoomPercent()) + "%", 1),
2248
+ N.value ? (_(), a("button", {
2242
2249
  key: 1,
2243
2250
  class: "zoom-btn",
2244
- title: C(u)("zoom.zoomIn"),
2245
- onMousedown: k(G, ["stop", "prevent"]),
2246
- onTouchstart: k(G, ["stop", "prevent"])
2251
+ title: w(u)("zoom.zoomIn"),
2252
+ onMousedown: O(B, ["stop", "prevent"]),
2253
+ onTouchstart: O(B, ["stop", "prevent"])
2247
2254
  }, [...n[37] ||= [o("svg", {
2248
2255
  width: "16",
2249
2256
  height: "16",
@@ -2262,17 +2269,17 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2262
2269
  y1: "12",
2263
2270
  x2: "19",
2264
2271
  y2: "12"
2265
- })], -1)]], 40, ht)) : i("", !0)
2272
+ })], -1)]], 40, In)) : i("", !0)
2266
2273
  ], 32)) : i("", !0),
2267
- W.value ? (_(), a("div", {
2274
+ I.value ? (_(), a("div", {
2268
2275
  key: 1,
2269
2276
  class: "text-format-control",
2270
- onTouchstart: n[22] ||= k(() => {}, ["stop", "prevent"])
2277
+ onTouchstart: n[22] ||= O(() => {}, ["stop", "prevent"])
2271
2278
  }, [
2272
2279
  o("button", {
2273
2280
  class: "font-size-btn",
2274
- onMousedown: n[12] ||= k((e) => J(-1), ["stop", "prevent"]),
2275
- onTouchstart: n[13] ||= k((e) => J(-1), ["stop", "prevent"])
2281
+ onMousedown: n[12] ||= O((e) => me(-1), ["stop", "prevent"]),
2282
+ onTouchstart: n[13] ||= O((e) => me(-1), ["stop", "prevent"])
2276
2283
  }, [...n[38] ||= [o("svg", {
2277
2284
  width: "12",
2278
2285
  height: "12",
@@ -2287,11 +2294,11 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2287
2294
  x2: "19",
2288
2295
  y2: "12"
2289
2296
  })], -1)]], 32),
2290
- o("span", gt, S(W.value.fontSize ?? C(16)), 1),
2297
+ o("span", Ln, C(I.value.fontSize ?? w(16)), 1),
2291
2298
  o("button", {
2292
2299
  class: "font-size-btn",
2293
- onMousedown: n[14] ||= k((e) => J(1), ["stop", "prevent"]),
2294
- onTouchstart: n[15] ||= k((e) => J(1), ["stop", "prevent"])
2300
+ onMousedown: n[14] ||= O((e) => me(1), ["stop", "prevent"]),
2301
+ onTouchstart: n[15] ||= O((e) => me(1), ["stop", "prevent"])
2295
2302
  }, [...n[39] ||= [o("svg", {
2296
2303
  width: "12",
2297
2304
  height: "12",
@@ -2313,27 +2320,27 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2313
2320
  })], -1)]], 32),
2314
2321
  n[43] ||= o("div", { class: "text-align-separator" }, null, -1),
2315
2322
  o("button", {
2316
- class: p(["text-align-btn", { active: W.value.textAlign === "left" || !W.value.textAlign }]),
2317
- title: C(u)("textAlign.left"),
2318
- onMousedown: n[16] ||= k((e) => Y("left"), ["stop", "prevent"]),
2319
- onTouchstart: n[17] ||= k((e) => Y("left"), ["stop", "prevent"])
2320
- }, [...n[40] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"3\" y1=\"10\" x2=\"17\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"3\" y1=\"18\" x2=\"15\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, _t),
2323
+ class: p(["text-align-btn", { active: I.value.textAlign === "left" || !I.value.textAlign }]),
2324
+ title: w(u)("textAlign.left"),
2325
+ onMousedown: n[16] ||= O((e) => he("left"), ["stop", "prevent"]),
2326
+ onTouchstart: n[17] ||= O((e) => he("left"), ["stop", "prevent"])
2327
+ }, [...n[40] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"3\" y1=\"10\" x2=\"17\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"3\" y1=\"18\" x2=\"15\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, Rn),
2321
2328
  o("button", {
2322
- class: p(["text-align-btn", { active: W.value.textAlign === "center" }]),
2323
- title: C(u)("textAlign.center"),
2324
- onMousedown: n[18] ||= k((e) => Y("center"), ["stop", "prevent"]),
2325
- onTouchstart: n[19] ||= k((e) => Y("center"), ["stop", "prevent"])
2326
- }, [...n[41] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"5\" y1=\"10\" x2=\"19\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"7\" y1=\"18\" x2=\"17\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, vt),
2329
+ class: p(["text-align-btn", { active: I.value.textAlign === "center" }]),
2330
+ title: w(u)("textAlign.center"),
2331
+ onMousedown: n[18] ||= O((e) => he("center"), ["stop", "prevent"]),
2332
+ onTouchstart: n[19] ||= O((e) => he("center"), ["stop", "prevent"])
2333
+ }, [...n[41] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"5\" y1=\"10\" x2=\"19\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"7\" y1=\"18\" x2=\"17\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, zn),
2327
2334
  o("button", {
2328
- class: p(["text-align-btn", { active: W.value.textAlign === "right" }]),
2329
- title: C(u)("textAlign.right"),
2330
- onMousedown: n[20] ||= k((e) => Y("right"), ["stop", "prevent"]),
2331
- onTouchstart: n[21] ||= k((e) => Y("right"), ["stop", "prevent"])
2332
- }, [...n[42] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"7\" y1=\"10\" x2=\"21\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"9\" y1=\"18\" x2=\"21\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, yt)
2335
+ class: p(["text-align-btn", { active: I.value.textAlign === "right" }]),
2336
+ title: w(u)("textAlign.right"),
2337
+ onMousedown: n[20] ||= O((e) => he("right"), ["stop", "prevent"]),
2338
+ onTouchstart: n[21] ||= O((e) => he("right"), ["stop", "prevent"])
2339
+ }, [...n[42] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"7\" y1=\"10\" x2=\"21\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"9\" y1=\"18\" x2=\"21\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, Bn)
2333
2340
  ], 32)) : i("", !0)
2334
2341
  ], 32));
2335
2342
  }
2336
- }), [["__scopeId", "data-v-975e0b8b"]]), xt = { class: "palette-header" }, St = { class: "palette-title" }, Ct = { class: "current-color" }, wt = {
2343
+ }), [["__scopeId", "data-v-975e0b8b"]]), Hn = { class: "palette-header" }, Un = { class: "palette-title" }, Wn = { class: "current-color" }, Gn = {
2337
2344
  key: 0,
2338
2345
  width: "14",
2339
2346
  height: "14",
@@ -2342,13 +2349,13 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2342
2349
  stroke: "currentColor",
2343
2350
  "stroke-width": "2",
2344
2351
  "stroke-linecap": "round"
2345
- }, Tt = { class: "preset-grid" }, Et = ["title", "onClick"], Dt = {
2352
+ }, Kn = { class: "preset-grid" }, qn = ["title", "onClick"], Jn = {
2346
2353
  key: 0,
2347
2354
  class: "transparent-row"
2348
- }, Ot = { class: "palette-footer" }, kt = { class: "custom-color" }, At = ["value"], jt = { class: "custom-label" }, Mt = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2355
+ }, Yn = { class: "palette-footer" }, Xn = { class: "custom-color" }, Zn = ["value"], Qn = { class: "custom-label" }, $n = /*#__PURE__*/ en(/* @__PURE__ */ l({
2349
2356
  __name: "ColorPalette",
2350
2357
  setup(s) {
2351
- let c = B(), { t: l } = ee(), u = L(), d = n(() => {
2358
+ let c = st(), { t: l } = ie(), u = ae(), d = n(() => {
2352
2359
  if (!u?.value) return {};
2353
2360
  let e = u.value.getBoundingClientRect();
2354
2361
  return {
@@ -2392,35 +2399,35 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2392
2399
  function v() {
2393
2400
  c.setColor("transparent"), c.hideColorPalette();
2394
2401
  }
2395
- return (n, s) => (_(), r(t, { to: "body" }, [C(c).showColorPalette ? (_(), a("div", {
2402
+ return (n, s) => (_(), r(t, { to: "body" }, [w(c).showColorPalette ? (_(), a("div", {
2396
2403
  key: 0,
2397
2404
  class: "overlay",
2398
- onClick: s[1] ||= (...e) => C(c).hideColorPalette && C(c).hideColorPalette(...e)
2405
+ onClick: s[1] ||= (...e) => w(c).hideColorPalette && w(c).hideColorPalette(...e)
2399
2406
  }, [o("div", {
2400
2407
  class: "color-palette",
2401
2408
  style: m(d.value),
2402
- onClick: s[0] ||= k(() => {}, ["stop"])
2409
+ onClick: s[0] ||= O(() => {}, ["stop"])
2403
2410
  }, [
2404
- o("div", xt, [o("span", St, S(C(c).activeColorSlot === "textColor" ? C(l)("color.textColor") : C(c).activeColorSlot === "foreground" ? C(l)("palette.stroke") : C(l)("palette.fill")), 1), o("div", Ct, [o("div", {
2411
+ o("div", Hn, [o("span", Un, C(w(c).activeColorSlot === "textColor" ? w(l)("color.textColor") : w(c).activeColorSlot === "foreground" ? w(l)("palette.stroke") : w(l)("palette.fill")), 1), o("div", Wn, [o("div", {
2405
2412
  class: p(["current-swatch", {
2406
- fill: C(c).activeColorSlot === "background",
2407
- "current-transparent": C(c).activeColorSlot === "background" && C(c).backgroundColor === "transparent"
2413
+ fill: w(c).activeColorSlot === "background",
2414
+ "current-transparent": w(c).activeColorSlot === "background" && w(c).backgroundColor === "transparent"
2408
2415
  }]),
2409
- style: m({ background: C(c).activeColorSlot === "textColor" ? C(c).textColor : C(c).activeColorSlot === "foreground" ? C(c).foregroundColor : C(c).backgroundColor === "transparent" ? "none" : C(c).backgroundColor })
2410
- }, [C(c).activeColorSlot === "background" && C(c).backgroundColor === "transparent" ? (_(), a("svg", wt, [...s[2] ||= [o("line", {
2416
+ style: m({ background: w(c).activeColorSlot === "textColor" ? w(c).textColor : w(c).activeColorSlot === "foreground" ? w(c).foregroundColor : w(c).backgroundColor === "transparent" ? "none" : w(c).backgroundColor })
2417
+ }, [w(c).activeColorSlot === "background" && w(c).backgroundColor === "transparent" ? (_(), a("svg", Gn, [...s[2] ||= [o("line", {
2411
2418
  x1: "5",
2412
2419
  y1: "5",
2413
2420
  x2: "19",
2414
2421
  y2: "19"
2415
2422
  }, null, -1)]])) : i("", !0)], 6)])]),
2416
- o("div", Tt, [(_(), a(e, null, b(f, (e) => o("button", {
2423
+ o("div", Kn, [(_(), a(e, null, x(f, (e) => o("button", {
2417
2424
  key: e,
2418
2425
  class: "color-swatch",
2419
2426
  style: m({ background: e }),
2420
2427
  title: e,
2421
2428
  onClick: (t) => g(e)
2422
- }, null, 12, Et)), 64))]),
2423
- C(c).activeColorSlot === "background" ? (_(), a("div", Dt, [o("button", {
2429
+ }, null, 12, qn)), 64))]),
2430
+ w(c).activeColorSlot === "background" ? (_(), a("div", Jn, [o("button", {
2424
2431
  class: "color-swatch transparent-swatch",
2425
2432
  title: "透明(无填充)",
2426
2433
  onClick: v
@@ -2438,15 +2445,15 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2438
2445
  x2: "19",
2439
2446
  y2: "19"
2440
2447
  })], -1)]])])) : i("", !0),
2441
- o("div", Ot, [o("div", kt, [o("input", {
2448
+ o("div", Yn, [o("div", Xn, [o("input", {
2442
2449
  type: "color",
2443
- value: C(c).activeColorSlot === "textColor" ? C(c).textColor : C(c).activeColorSlot === "foreground" ? C(c).foregroundColor : C(c).backgroundColor === "transparent" ? "#ffffff" : C(c).backgroundColor,
2450
+ value: w(c).activeColorSlot === "textColor" ? w(c).textColor : w(c).activeColorSlot === "foreground" ? w(c).foregroundColor : w(c).backgroundColor === "transparent" ? "#ffffff" : w(c).backgroundColor,
2444
2451
  class: "color-picker",
2445
2452
  onChange: h
2446
- }, null, 40, At), o("span", jt, S(C(l)("palette.custom")), 1)])])
2453
+ }, null, 40, Zn), o("span", Qn, C(w(l)("palette.custom")), 1)])])
2447
2454
  ], 4)])) : i("", !0)]));
2448
2455
  }
2449
- }), [["__scopeId", "data-v-a8b8bc9c"]]), Nt = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2456
+ }), [["__scopeId", "data-v-a8b8bc9c"]]), er = /*#__PURE__*/ en(/* @__PURE__ */ l({
2450
2457
  __name: "Painter",
2451
2458
  props: {
2452
2459
  theme: { default: "light" },
@@ -2468,10 +2475,10 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2468
2475
  height: e(r.height)
2469
2476
  };
2470
2477
  });
2471
- P(o.value);
2472
- let l = y(null);
2473
- I(l);
2474
- let u = B(), d = ie();
2478
+ A(o.value);
2479
+ let l = b(null);
2480
+ M(l);
2481
+ let u = st(), d = ft();
2475
2482
  u.reset(), d.reset();
2476
2483
  let f = !1;
2477
2484
  function h(e) {
@@ -2512,11 +2519,11 @@ var Ke = /*#__PURE__*/ Le(/* @__PURE__ */ l({
2512
2519
  class: p(["wb-root", g.value]),
2513
2520
  style: m(s.value)
2514
2521
  }, [
2515
- c(Re),
2516
- c(bt),
2517
- c(Mt)
2522
+ c(tn),
2523
+ c(Vn),
2524
+ c($n)
2518
2525
  ], 6));
2519
2526
  }
2520
2527
  }), [["__scopeId", "data-v-40d42bb5"]]);
2521
2528
  //#endregion
2522
- export { R as DEFAULT_CANVAS_HEIGHT, te as DEFAULT_CANVAS_WIDTH, z as DEFAULT_FONT_SIZE, re as HIT_THRESHOLD, Nt as Painter, Nt as default, ne as STROKE_WIDTH };
2529
+ export { se as DEFAULT_CANVAS_HEIGHT, oe as DEFAULT_CANVAS_WIDTH, le as DEFAULT_FONT_SIZE, ue as HIT_THRESHOLD, er as Painter, er as default, ce as STROKE_WIDTH };