@tatamicks/core 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/PalettePanel-BTB1LkgU.cjs +9 -0
  2. package/dist/PalettePanel-BTB1LkgU.cjs.map +1 -0
  3. package/dist/{PalettePanel-Cigl9i1N.js → PalettePanel-CrA2BGLq.js} +961 -959
  4. package/dist/PalettePanel-CrA2BGLq.js.map +1 -0
  5. package/dist/PalettePanel.css +1 -1
  6. package/dist/canvas.cjs +1 -1
  7. package/dist/canvas.mjs +4 -4
  8. package/dist/index.cjs +2 -2
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.css +1 -1
  11. package/dist/index.mjs +352 -343
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/{paperSettingsWidget-DvtghSA5.js → paperSettingsWidget-CAIw_Ofm.js} +1582 -1535
  14. package/dist/paperSettingsWidget-CAIw_Ofm.js.map +1 -0
  15. package/dist/paperSettingsWidget-CIRKgnz4.cjs +2 -0
  16. package/dist/paperSettingsWidget-CIRKgnz4.cjs.map +1 -0
  17. package/dist/shell.cjs +1 -1
  18. package/dist/shell.mjs +2 -2
  19. package/dist/sidebarPortal-Bigm11qq.js +880 -0
  20. package/dist/sidebarPortal-Bigm11qq.js.map +1 -0
  21. package/dist/sidebarPortal-Dit8f3sD.cjs +3 -0
  22. package/dist/sidebarPortal-Dit8f3sD.cjs.map +1 -0
  23. package/dist/src/canvas.d.ts +4 -0
  24. package/dist/src/index.d.ts +5 -3
  25. package/dist/src/shell.d.ts +3 -1
  26. package/package.json +1 -1
  27. package/dist/PalettePanel-BMZ6dfI3.cjs +0 -9
  28. package/dist/PalettePanel-BMZ6dfI3.cjs.map +0 -1
  29. package/dist/PalettePanel-Cigl9i1N.js.map +0 -1
  30. package/dist/paperSettingsWidget-7766a5Fe.cjs +0 -2
  31. package/dist/paperSettingsWidget-7766a5Fe.cjs.map +0 -1
  32. package/dist/paperSettingsWidget-DvtghSA5.js.map +0 -1
  33. package/dist/sidebarPortal-BN6FVwaF.js +0 -870
  34. package/dist/sidebarPortal-BN6FVwaF.js.map +0 -1
  35. package/dist/sidebarPortal-Cr-dLvA_.cjs +0 -3
  36. package/dist/sidebarPortal-Cr-dLvA_.cjs.map +0 -1
@@ -0,0 +1,880 @@
1
+ import { jsxs as q, jsx as R } from "react/jsx-runtime";
2
+ import { useMemo as A, useCallback as O } from "react";
3
+ var Z = /* @__PURE__ */ ((t) => (t.left = "left", t.center = "center", t.right = "right", t))(Z || {}), Q = /* @__PURE__ */ ((t) => (t.top = "top", t.center = "center", t.bottom = "bottom", t))(Q || {});
4
+ const Ut = {
5
+ kind: "alignment",
6
+ defaultProps: {
7
+ horizontal: "left",
8
+ vertical: "center"
9
+ /* center */
10
+ }
11
+ }, Wt = {
12
+ kind: "checkboxStyle",
13
+ defaultProps: {
14
+ styleConfig: {
15
+ checkboxSize: { value: 16, unit: "px" },
16
+ borderWidth: { value: 1, unit: "px" },
17
+ borderColor: "#000000",
18
+ checkWidth: { value: 3.5, unit: "px" },
19
+ checkColor: "#000000",
20
+ backgroundColor: "#ffffff",
21
+ checkedBackgroundColor: "#ffffff"
22
+ }
23
+ }
24
+ }, U = "application/x-tatamicks-block", S = "application/x-tatamicks-block-kind-";
25
+ function Ft(t, e, r) {
26
+ if (!t.dataTransfer) return;
27
+ const n = { kind: e, defaultSize: r };
28
+ t.dataTransfer.setData(U, JSON.stringify(n)), t.dataTransfer.setData(`${S}${e}`, ""), t.dataTransfer.effectAllowed = "copy";
29
+ }
30
+ function Ht(t) {
31
+ if (!t.dataTransfer) return null;
32
+ const e = t.dataTransfer.getData(U);
33
+ if (!e) return null;
34
+ try {
35
+ return JSON.parse(e);
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
40
+ function Vt(t) {
41
+ if (!t.dataTransfer) return null;
42
+ const e = Array.from(t.dataTransfer.types).find(
43
+ (r) => r.startsWith(S)
44
+ );
45
+ return e ? e.slice(S.length) : null;
46
+ }
47
+ const Kt = {
48
+ colCount: 20,
49
+ rowCount: 28
50
+ };
51
+ var tt = /* @__PURE__ */ ((t) => (t.A4 = "A4", t.B5 = "B5", t.A3 = "A3", t.LETTER = "Letter", t.LEGAL = "Legal", t.CUSTOM = "Custom", t))(tt || {});
52
+ const et = {
53
+ A4: {
54
+ preset: "A4",
55
+ width: { value: 210, unit: "mm" },
56
+ height: { value: 297, unit: "mm" }
57
+ },
58
+ A3: {
59
+ preset: "A3",
60
+ width: { value: 297, unit: "mm" },
61
+ height: { value: 420, unit: "mm" }
62
+ },
63
+ B5: {
64
+ preset: "B5",
65
+ width: { value: 182, unit: "mm" },
66
+ height: { value: 257, unit: "mm" }
67
+ },
68
+ Letter: {
69
+ preset: "Letter",
70
+ width: { value: 8.5, unit: "inch" },
71
+ height: { value: 11, unit: "inch" }
72
+ },
73
+ Legal: {
74
+ preset: "Legal",
75
+ width: { value: 8.5, unit: "inch" },
76
+ height: { value: 14, unit: "inch" }
77
+ },
78
+ Custom: {
79
+ preset: "Custom",
80
+ width: { value: 210, unit: "mm" },
81
+ height: { value: 297, unit: "mm" }
82
+ }
83
+ }, rt = {
84
+ top: { value: 10, unit: "mm" },
85
+ right: { value: 10, unit: "mm" },
86
+ bottom: { value: 10, unit: "mm" },
87
+ left: { value: 10, unit: "mm" }
88
+ }, Xt = {
89
+ size: et.A4,
90
+ margin: rt
91
+ }, zt = {
92
+ // ==================== GridLayer (10-90) ====================
93
+ GRID_CANVAS: 10,
94
+ MARGIN_OVERLAY: 20,
95
+ GRID_OVERLAY: 30,
96
+ BORDER_OVERLAY: 40,
97
+ // ==================== BlockLayer (100-999,999) ====================
98
+ BLOCK_LAYER_MIN: 100,
99
+ BLOCK_LAYER_MAX: 999999,
100
+ BLOCK_LAYER_STEP: 100,
101
+ // ==================== InteractionLayer (2,000,000+) ====================
102
+ SELECT_BLOCK: 2e6,
103
+ INTERACTION_LAYER_BASE: 21e5,
104
+ BLOCK_GHOST: 22e5,
105
+ HOVER_OUTLINE: 23e5,
106
+ EDIT_BLOCK: 24e5,
107
+ BLOCK_SELECT_BORDER: 25e5,
108
+ BLOCK_HANDLES: 26e5,
109
+ GRID_GHOST: 27e5,
110
+ TOOLTIP: 33e5,
111
+ DROPDOWN: 34e5,
112
+ FLOATING_WIDGET: 37e5,
113
+ FLOATING_WIDGET_DRAGGING: 375e4
114
+ }, Jt = {
115
+ BG: 10,
116
+ CONTENT: 50,
117
+ GUIDE: 70,
118
+ BORDER: 80,
119
+ VALIDATION: 90
120
+ }, Yt = {
121
+ isolation: "isolate"
122
+ };
123
+ function qt(t, e) {
124
+ const r = t.match(/^(\d+(?:\.\d+)?)([a-zA-Z%]+)$/);
125
+ if (!r)
126
+ throw new Error(`Invalid dimension string: ${t}`);
127
+ const n = Number(r[1]), o = r[2];
128
+ if (!e.includes(o))
129
+ throw new Error(`Invalid unit: ${o}`);
130
+ return { value: n, unit: o };
131
+ }
132
+ function Zt(t) {
133
+ return `${t.value}${t.unit}`;
134
+ }
135
+ const b = 96, nt = 10, W = 25.4, ot = 0.352778, at = W / b, h = {
136
+ fromCm: (t) => t * nt,
137
+ fromInch: (t) => t * W,
138
+ fromPt: (t) => t * ot,
139
+ fromPx: (t) => t * at,
140
+ fromDim(t) {
141
+ switch (t.unit) {
142
+ case "mm":
143
+ return t.value;
144
+ case "cm":
145
+ return h.fromCm(t.value);
146
+ case "inch":
147
+ return h.fromInch(t.value);
148
+ case "pt":
149
+ return h.fromPt(t.value);
150
+ case "px":
151
+ return h.fromPx(t.value);
152
+ case "fr":
153
+ case "%":
154
+ throw new Error(
155
+ `Cannot convert ${t.unit} to mm. Use physical units only.`
156
+ );
157
+ default: {
158
+ const e = t.unit;
159
+ throw new Error(`Unsupported unit: ${e}`);
160
+ }
161
+ }
162
+ }
163
+ }, it = 25.4, st = 2.54, ct = 72, l = {
164
+ fromMm: (t, e = b) => t * e / it,
165
+ fromCm: (t, e = b) => t * e / st,
166
+ fromInch: (t, e = b) => t * e,
167
+ fromPt: (t, e = b) => t * e / ct,
168
+ // CSS px(96dpi 基準)を指定 DPI のスクリーン物理 px に変換
169
+ fromPx: (t, e = b) => t * e / b,
170
+ fromDim(t, e = b, r) {
171
+ switch (t.unit) {
172
+ case "mm":
173
+ return l.fromMm(t.value, e);
174
+ case "cm":
175
+ return l.fromCm(t.value, e);
176
+ case "inch":
177
+ return l.fromInch(t.value, e);
178
+ case "pt":
179
+ return l.fromPt(t.value, e);
180
+ case "px":
181
+ return l.fromPx(t.value, e);
182
+ case "%":
183
+ if (r === void 0)
184
+ throw new Error("Base size must be defined for percentage values.");
185
+ return t.value / 100 * r;
186
+ case "fr":
187
+ throw new Error(
188
+ `Cannot convert ${t.unit} to px. Use physical units only.`
189
+ );
190
+ default: {
191
+ const n = t.unit;
192
+ throw new Error(`Unsupported unit: ${n}`);
193
+ }
194
+ }
195
+ }
196
+ }, ut = {
197
+ "flex-start": "left",
198
+ center: "center",
199
+ "flex-end": "right"
200
+ }, lt = {
201
+ "flex-start": "top",
202
+ center: "center",
203
+ "flex-end": "bottom"
204
+ };
205
+ function ft(t) {
206
+ return typeof t == "object" && t !== null && t.value === 1 && t.unit === "fr";
207
+ }
208
+ function L(t) {
209
+ const e = {};
210
+ for (let r = 0; r < t.length; r++) {
211
+ const n = t[r];
212
+ n !== void 0 && !ft(n) && (e[r] = n);
213
+ }
214
+ return e;
215
+ }
216
+ function F(t) {
217
+ if (typeof t != "object" || t === null)
218
+ throw new Error("grid must be an object");
219
+ const e = t;
220
+ if (Array.isArray(e.cols) && Array.isArray(e.rows)) {
221
+ const r = e.cols, n = e.rows, o = {
222
+ colCount: r.length,
223
+ rowCount: n.length
224
+ }, a = L(r);
225
+ Object.keys(a).length > 0 && (o.cols = a);
226
+ const s = L(n);
227
+ return Object.keys(s).length > 0 && (o.rows = s), o;
228
+ }
229
+ return t;
230
+ }
231
+ function mt(t) {
232
+ if (!("isIndividual" in t))
233
+ return t;
234
+ const e = { ...t }, r = e.isIndividual ?? !0;
235
+ if (delete e.isIndividual, r)
236
+ e.bulk = !1, delete e.all;
237
+ else if (e.bulk = !0, e.all === void 0) {
238
+ const n = e.top ?? e.right ?? e.bottom ?? e.left;
239
+ n !== void 0 && (e.all = n);
240
+ }
241
+ return e;
242
+ }
243
+ function ht(t) {
244
+ const e = { ...t };
245
+ if ("justifyContent" in e) {
246
+ const r = e.justifyContent;
247
+ e.horizontal = ut[r] ?? r, delete e.justifyContent;
248
+ }
249
+ if ("alignItems" in e) {
250
+ const r = e.alignItems;
251
+ e.vertical = lt[r] ?? r, delete e.alignItems;
252
+ }
253
+ return e;
254
+ }
255
+ function dt(t) {
256
+ if (typeof t != "object" || t === null)
257
+ return t;
258
+ let e = { ...t };
259
+ return e = mt(e), e = ht(e), e;
260
+ }
261
+ function gt(t) {
262
+ if (typeof t != "object" || t === null) return t;
263
+ const e = { ...t };
264
+ if (typeof e.border != "object" || e.border === null) return e;
265
+ const r = { ...e.border }, n = r.all, o = (a) => typeof a == "object" && a !== null && typeof a.type == "string";
266
+ if (o(n)) {
267
+ for (const a of ["top", "right", "bottom", "left"])
268
+ o(r[a]) || (r[a] = n);
269
+ delete r.all;
270
+ }
271
+ return e.border = r, e;
272
+ }
273
+ function H(t, e) {
274
+ if (typeof t != "object" || t === null) return t;
275
+ const r = { ...t };
276
+ "props" in r && (r.props = dt(r.props)), "style" in r && (r.style = gt(r.style));
277
+ const n = typeof r.kind == "string" ? r.kind : void 0;
278
+ if (n && e) {
279
+ const o = e[n];
280
+ o != null && o.migrateProps && (r.props = o.migrateProps(r.props));
281
+ }
282
+ return r;
283
+ }
284
+ function bt(t, e) {
285
+ if (typeof t != "object" || t === null)
286
+ throw new Error("page must be an object");
287
+ const r = { ...t };
288
+ return "grid" in r && (r.grid = F(r.grid)), Array.isArray(r.blocks) && (r.blocks = r.blocks.map((n) => H(n, e))), {
289
+ grid: r.grid,
290
+ blocks: r.blocks,
291
+ ...r.blockDefaults !== void 0 ? { blockDefaults: r.blockDefaults } : {},
292
+ ...r.metaData !== void 0 ? { metaData: r.metaData } : {}
293
+ };
294
+ }
295
+ function pt(t) {
296
+ return typeof t == "object" && t !== null && !("pages" in t) && "grid" in t && "blocks" in t;
297
+ }
298
+ function wt(t) {
299
+ return typeof t == "object" && t !== null && "pages" in t;
300
+ }
301
+ function Mt(t, e) {
302
+ if (typeof t != "object" || t === null)
303
+ throw new Error("Book must be a JSON object");
304
+ const r = { ...t };
305
+ return Array.isArray(r.pages) && (r.pages = r.pages.map((n) => bt(n, e))), {
306
+ paper: r.paper,
307
+ pages: r.pages,
308
+ ...r.metaData !== void 0 ? { metaData: r.metaData } : {}
309
+ };
310
+ }
311
+ function Et(t, e) {
312
+ if (typeof t != "object" || t === null)
313
+ throw new Error("Schema must be a JSON object");
314
+ const r = { ...t }, n = {};
315
+ if ("grid" in r && (n.grid = F(r.grid), delete r.grid), "blocks" in r) {
316
+ const s = r.blocks;
317
+ Array.isArray(s) && (n.blocks = s.map((c) => H(c, e))), delete r.blocks;
318
+ }
319
+ "metaData" in r && (n.metaData = r.metaData, delete r.metaData);
320
+ const o = {};
321
+ "paper" in r && (o.paper = r.paper, delete r.paper);
322
+ const a = {
323
+ grid: n.grid,
324
+ blocks: n.blocks ?? [],
325
+ ...n.metaData !== void 0 ? { metaData: n.metaData } : {}
326
+ };
327
+ return {
328
+ paper: o.paper,
329
+ pages: [a]
330
+ };
331
+ }
332
+ function vt(t, e) {
333
+ if (pt(t))
334
+ return Et(t, e);
335
+ if (wt(t))
336
+ return Mt(t, e);
337
+ throw new Error(
338
+ `入力データの形式を判別できません。
339
+ 形式 A(旧 FormSchema): トップレベルに 'grid' と 'blocks' が必要
340
+ 形式 B(Book): トップレベルに 'pages' が必要`
341
+ );
342
+ }
343
+ function T(t) {
344
+ if (t === null) return !0;
345
+ switch (typeof t) {
346
+ case "string":
347
+ case "number":
348
+ case "boolean":
349
+ return !0;
350
+ case "object":
351
+ return Array.isArray(t) ? t.every(T) : Object.getPrototypeOf(t) === Object.prototype ? Object.values(t).every(T) : !1;
352
+ default:
353
+ return !1;
354
+ }
355
+ }
356
+ function x(t) {
357
+ if (t === null || typeof t != "object" || Array.isArray(t) || Object.getPrototypeOf(t) !== Object.prototype)
358
+ throw new Error("values must be a plain object");
359
+ const e = t;
360
+ for (const [r, n] of Object.entries(e))
361
+ if (!T(n))
362
+ throw new Error(`values["${r}"] contains an invalid value`);
363
+ return e;
364
+ }
365
+ function Qt(t) {
366
+ let e;
367
+ try {
368
+ e = JSON.parse(t);
369
+ } catch {
370
+ throw new SyntaxError("invalid JSON for values");
371
+ }
372
+ return x(e);
373
+ }
374
+ function kt(t) {
375
+ if (typeof t != "object" || t === null) return !1;
376
+ const e = t;
377
+ return !(typeof e.colCount != "number" || e.colCount < 1 || typeof e.rowCount != "number" || e.rowCount < 1);
378
+ }
379
+ function Dt(t) {
380
+ if (typeof t == "string") return !0;
381
+ if (typeof t != "object" || t === null) return !1;
382
+ const e = t;
383
+ if (typeof e.path != "string") return !1;
384
+ const r = (n) => n === null || typeof n == "string" || typeof n == "number" || typeof n == "boolean";
385
+ return "eq" in e ? r(e.eq) : "neq" in e ? r(e.neq) : !1;
386
+ }
387
+ function yt(t) {
388
+ if (typeof t != "object" || t === null) return !1;
389
+ const e = t;
390
+ if (typeof e.id != "string" || typeof e.kind != "string" || typeof e.layout != "object" || e.layout === null) return !1;
391
+ const r = e.layout;
392
+ if (typeof r.x != "number" || typeof r.y != "number" || typeof r.w != "number" || typeof r.h != "number" || typeof e.props != "object" || e.props === null || Array.isArray(e.props))
393
+ return !1;
394
+ try {
395
+ x(e.props);
396
+ } catch {
397
+ return !1;
398
+ }
399
+ return !("initValue" in e && !T(e.initValue) || "hiddenBinding" in e && !Dt(e.hiddenBinding));
400
+ }
401
+ function V(t) {
402
+ if (typeof t != "object" || t === null)
403
+ throw new Error("Page must be an object");
404
+ const e = t;
405
+ if (e.id !== void 0 && typeof e.id != "string")
406
+ throw new Error("Page.id must be a string if provided");
407
+ if (!kt(e.grid))
408
+ throw new Error("Invalid grid definition");
409
+ if (!Array.isArray(e.blocks))
410
+ throw new Error("blocks must be an array");
411
+ if (!e.blocks.every(yt))
412
+ throw new Error("Invalid block definition in blocks array");
413
+ if (e.metaData !== void 0) {
414
+ if (typeof e.metaData != "object" || e.metaData === null)
415
+ throw new Error("metaData must be an object if provided");
416
+ try {
417
+ x(e.metaData);
418
+ } catch (r) {
419
+ throw new Error(
420
+ `Invalid metaData: ${r instanceof Error ? r.message : String(r)}`
421
+ );
422
+ }
423
+ }
424
+ if (e.blockDefaults !== void 0) {
425
+ if (typeof e.blockDefaults != "object" || e.blockDefaults === null || Array.isArray(e.blockDefaults))
426
+ throw new Error("blockDefaults must be a plain object if provided");
427
+ const r = e.blockDefaults;
428
+ for (const [n, o] of Object.entries(r))
429
+ try {
430
+ x(o);
431
+ } catch (a) {
432
+ throw new Error(
433
+ `Invalid blockDefaults["${n}"]: ${a instanceof Error ? a.message : String(a)}`
434
+ );
435
+ }
436
+ }
437
+ return t;
438
+ }
439
+ function Pt(t) {
440
+ if (typeof t != "object" || t === null)
441
+ throw new Error("Book must be an object");
442
+ const e = t;
443
+ if (!Array.isArray(e.pages) || e.pages.length === 0)
444
+ throw new Error("Book must have at least one page in pages");
445
+ if (e.pages.forEach((r, n) => {
446
+ try {
447
+ V(r);
448
+ } catch (o) {
449
+ throw new Error(
450
+ `Invalid Page at pages[${n}]: ${o instanceof Error ? o.message : String(o)}`
451
+ );
452
+ }
453
+ }), !e.paper || typeof e.paper != "object")
454
+ throw new Error("Book.paper is required and must be an object");
455
+ return t;
456
+ }
457
+ function te(t) {
458
+ return JSON.stringify(t);
459
+ }
460
+ function ee(t) {
461
+ return JSON.stringify(t);
462
+ }
463
+ function re(t) {
464
+ let e;
465
+ try {
466
+ e = JSON.parse(t);
467
+ } catch {
468
+ throw new SyntaxError("invalid JSON for Page");
469
+ }
470
+ return V(e);
471
+ }
472
+ function ne(t) {
473
+ let e;
474
+ try {
475
+ e = JSON.parse(t);
476
+ } catch {
477
+ throw new SyntaxError("invalid JSON for Book");
478
+ }
479
+ return Pt(vt(e));
480
+ }
481
+ function oe({
482
+ checked: t,
483
+ styleConfig: e
484
+ }) {
485
+ const r = (e == null ? void 0 : e.borderColor) ?? "#000000", n = (e == null ? void 0 : e.checkColor) ?? "#000000", o = t ? (e == null ? void 0 : e.checkedBackgroundColor) ?? "#ffffff" : (e == null ? void 0 : e.backgroundColor) ?? "#ffffff", a = e != null && e.borderWidth ? l.fromDim(e.borderWidth) : 1, s = e != null && e.checkWidth ? l.fromDim(e.checkWidth) : 3.5;
486
+ return /* @__PURE__ */ q(
487
+ "svg",
488
+ {
489
+ viewBox: "0 0 20 20",
490
+ xmlns: "http://www.w3.org/2000/svg",
491
+ style: { width: "100%", height: "100%", display: "block" },
492
+ "aria-hidden": "true",
493
+ children: [
494
+ /* @__PURE__ */ R(
495
+ "rect",
496
+ {
497
+ x: "2",
498
+ y: "2",
499
+ width: "16",
500
+ height: "16",
501
+ rx: "2",
502
+ ry: "2",
503
+ fill: o,
504
+ stroke: r,
505
+ strokeWidth: a
506
+ }
507
+ ),
508
+ t && /* @__PURE__ */ R(
509
+ "path",
510
+ {
511
+ d: "M3 11l4 4L17 4",
512
+ fill: "none",
513
+ stroke: n,
514
+ strokeWidth: s,
515
+ strokeLinecap: "round",
516
+ strokeLinejoin: "round"
517
+ }
518
+ )
519
+ ]
520
+ }
521
+ );
522
+ }
523
+ var At = /* @__PURE__ */ ((t) => (t.SOLID = "solid", t.DASHED = "dashed", t.DOTTED = "dotted", t))(At || {}), It = /* @__PURE__ */ ((t) => (t.FORM = "Form", t.EDIT = "Edit", t.VIEW = "View", t))(It || {});
524
+ const i = {
525
+ MM: "mm",
526
+ CM: "cm",
527
+ FR: "fr",
528
+ INCH: "inch",
529
+ PT: "pt",
530
+ PX: "px",
531
+ PERCENT: "%"
532
+ }, ae = [
533
+ i.MM,
534
+ i.CM,
535
+ i.FR,
536
+ i.INCH,
537
+ i.PT,
538
+ i.PX,
539
+ i.PERCENT
540
+ ], ie = [
541
+ i.MM,
542
+ i.CM,
543
+ i.INCH,
544
+ i.PT,
545
+ i.PX
546
+ ], se = [i.MM, i.CM, i.INCH], ce = [
547
+ i.MM,
548
+ i.CM,
549
+ i.FR,
550
+ i.INCH,
551
+ i.PT,
552
+ i.PX
553
+ ], ue = [i.PX, i.PT, i.MM], le = [i.PT, i.PX, i.MM], fe = [
554
+ i.MM,
555
+ i.PT,
556
+ i.PX,
557
+ i.PERCENT
558
+ ], me = [
559
+ i.MM,
560
+ i.CM,
561
+ i.INCH,
562
+ i.PT,
563
+ i.PX,
564
+ i.PERCENT
565
+ ];
566
+ var _t = /* @__PURE__ */ ((t) => (t.normal = "normal", t.breakWord = "break-word", t.breakAll = "break-all", t))(_t || {}), Tt = /* @__PURE__ */ ((t) => (t.normal = "normal", t.nowrap = "nowrap", t.pre = "pre", t.preWrap = "pre-wrap", t.preLine = "pre-line", t))(Tt || {}), xt = /* @__PURE__ */ ((t) => (t.text = "text", t.number = "number", t.email = "email", t.tel = "tel", t.url = "url", t.date = "date", t.password = "password", t))(xt || {});
567
+ const he = {
568
+ kind: "textBehavior",
569
+ defaultProps: {
570
+ lineHeight: 1.2,
571
+ multiline: !0,
572
+ wordWrap: "normal",
573
+ whiteSpace: "normal"
574
+ /* normal */
575
+ }
576
+ }, de = {
577
+ kind: "textValidation",
578
+ defaultProps: {
579
+ inputType: "text"
580
+ /* text */
581
+ }
582
+ };
583
+ function ge(t) {
584
+ return `move-arrow-session-${t}`;
585
+ }
586
+ function be(t, e) {
587
+ return `layout-${t}-${[...e].sort().join(",")}`;
588
+ }
589
+ function pe(t) {
590
+ return `binding-${t}`;
591
+ }
592
+ function we(t) {
593
+ return `initValue-${t}`;
594
+ }
595
+ function Me(t) {
596
+ return `grid-size-${t}`;
597
+ }
598
+ function Ee(t) {
599
+ return `resize-arrow-session-${t}`;
600
+ }
601
+ const K = { value: 1, unit: "fr" };
602
+ function Ot(t) {
603
+ return Array.from(
604
+ { length: t.colCount },
605
+ (e, r) => {
606
+ var n;
607
+ return ((n = t.cols) == null ? void 0 : n[r]) ?? K;
608
+ }
609
+ );
610
+ }
611
+ function Nt(t) {
612
+ return Array.from(
613
+ { length: t.rowCount },
614
+ (e, r) => {
615
+ var n;
616
+ return ((n = t.rows) == null ? void 0 : n[r]) ?? K;
617
+ }
618
+ );
619
+ }
620
+ function ve(t) {
621
+ const e = {};
622
+ for (let r = 0; r < t.length; r++) {
623
+ const n = t[r];
624
+ n !== void 0 && !(n.value === 1 && n.unit === "fr") && (e[r] = n);
625
+ }
626
+ return {
627
+ colCount: t.length,
628
+ cols: Object.keys(e).length > 0 ? e : void 0
629
+ };
630
+ }
631
+ function ke(t) {
632
+ const e = {};
633
+ for (let r = 0; r < t.length; r++) {
634
+ const n = t[r];
635
+ n !== void 0 && !(n.value === 1 && n.unit === "fr") && (e[r] = n);
636
+ }
637
+ return {
638
+ rowCount: t.length,
639
+ rows: Object.keys(e).length > 0 ? e : void 0
640
+ };
641
+ }
642
+ function St(t) {
643
+ const e = A(() => Ot(t), [t]), r = A(() => Nt(t), [t]);
644
+ return { expandedCols: e, expandedRows: r };
645
+ }
646
+ function Rt(t) {
647
+ if (t.length === 0) return [];
648
+ const e = [];
649
+ let r = 0;
650
+ for (const n of t) {
651
+ const o = n + r, a = Math.round(o);
652
+ e.push(a), r = o - a;
653
+ }
654
+ return e;
655
+ }
656
+ const Lt = 8, jt = 32, Bt = 64, Ct = 512, j = (t, e, r) => Math.min(Math.max(t, e), r);
657
+ function B(t) {
658
+ const e = t.length - 1, r = e >= 1 ? t[e] ?? 0 : 0, n = t.length >= 1 ? r / e : 0, o = j(Math.ceil(Math.log2(e + 1)), Lt, jt), a = j(n * 2, Bt, Ct);
659
+ return { step: o, windowPx: a };
660
+ }
661
+ function N(t, e) {
662
+ const r = e.length - 1;
663
+ if (r <= 0 || e[0] === void 0 || t < e[0] || e[r] === void 0) return -1;
664
+ if (t >= e[r]) return r - 1;
665
+ let n = 1, o = r;
666
+ for (; n <= o; ) {
667
+ const a = n + o >>> 1, s = e[a];
668
+ if (s === void 0) {
669
+ o = a - 1;
670
+ continue;
671
+ }
672
+ s <= t ? n = a + 1 : o = a - 1;
673
+ }
674
+ return n - 1;
675
+ }
676
+ function C(t, e, r) {
677
+ const n = t.length - 1;
678
+ let o = 0;
679
+ return (a) => {
680
+ if (n <= 0 || t[0] === void 0 || a < t[0] || t[n] === void 0) return -1;
681
+ if (a >= t[n]) return n - 1;
682
+ const s = t[o], c = t[o + 1];
683
+ if (s === void 0 || c === void 0) return -1;
684
+ if (s <= a && a < c) return o;
685
+ const g = s - r, v = c + r;
686
+ if (a < g || a >= v)
687
+ return o = N(a, t), o;
688
+ let I = 0;
689
+ const _ = t[o + 1];
690
+ if (_ !== void 0 && a >= _)
691
+ for (; o + 1 < n; ) {
692
+ const k = t[o + 1];
693
+ if (k === void 0 || a < k) break;
694
+ if (o++, ++I > e)
695
+ return o = N(a, t), o;
696
+ }
697
+ else
698
+ for (; o > 0; ) {
699
+ const k = t[o];
700
+ if (k === void 0 || a >= k) break;
701
+ if (o--, ++I > e)
702
+ return o = N(a, t), o;
703
+ }
704
+ return o;
705
+ };
706
+ }
707
+ function G(t, e) {
708
+ if (t.length === 0) return [];
709
+ let r = 0, n = 0;
710
+ const o = t.map((c) => {
711
+ if (c.unit === "fr")
712
+ return r += c.value, null;
713
+ const g = h.fromDim(c);
714
+ return n += g, g;
715
+ });
716
+ if (r === 0)
717
+ return o;
718
+ const s = Math.max(0, e - n) / r;
719
+ return o.map((c, g) => {
720
+ if (c != null) return c;
721
+ const v = t[g];
722
+ if (!v) throw new Error(`dims[${g}] is undefined`);
723
+ return v.value * s;
724
+ });
725
+ }
726
+ function $(t, e = b) {
727
+ const r = t.map((n) => l.fromMm(n, e));
728
+ return Rt(r);
729
+ }
730
+ function De(t, e, r = b) {
731
+ const { expandedCols: n, expandedRows: o } = St(e), a = A(() => {
732
+ var D;
733
+ const d = t.orientation ? t.size.height : t.size.width, M = t.orientation ? t.size.width : t.size.height, p = h.fromDim(d), E = h.fromDim(M), f = t.margin.bulk && ((D = t.margin.all) != null && D.unit) ? h.fromDim(t.margin.all) : void 0, u = f ?? h.fromDim(t.margin.top), m = f ?? h.fromDim(t.margin.bottom), w = f ?? h.fromDim(t.margin.left), y = f ?? h.fromDim(t.margin.right);
734
+ return {
735
+ canvasWidthMm: p,
736
+ canvasHeightMm: E,
737
+ marginTopMm: u,
738
+ marginBottomMm: m,
739
+ marginLeftMm: w,
740
+ marginRightMm: y,
741
+ contentWidthMm: Math.max(0, p - w - y),
742
+ contentHeightMm: Math.max(
743
+ 0,
744
+ E - u - m
745
+ )
746
+ };
747
+ }, [t]), s = A(() => {
748
+ const {
749
+ canvasWidthMm: d,
750
+ canvasHeightMm: M,
751
+ marginTopMm: p,
752
+ marginBottomMm: E,
753
+ marginLeftMm: f,
754
+ marginRightMm: u,
755
+ contentWidthMm: m,
756
+ contentHeightMm: w
757
+ } = a;
758
+ return {
759
+ canvas: {
760
+ width: l.fromMm(d, r),
761
+ height: l.fromMm(M, r)
762
+ },
763
+ margin: {
764
+ top: l.fromMm(p, r),
765
+ bottom: l.fromMm(E, r),
766
+ left: l.fromMm(f, r),
767
+ right: l.fromMm(u, r)
768
+ },
769
+ content: {
770
+ width: l.fromMm(m, r),
771
+ height: l.fromMm(w, r)
772
+ }
773
+ };
774
+ }, [a, r]), { gridPosPx: c, colIndexer: g, rowIndexer: v } = A(() => {
775
+ const { contentWidthMm: d, contentHeightMm: M } = a, p = $(G(n, d), r), E = $(G(o, M), r), f = [0];
776
+ for (const P of p)
777
+ f.push((f[f.length - 1] ?? 0) + P);
778
+ const u = [0];
779
+ for (const P of E)
780
+ u.push((u[u.length - 1] ?? 0) + P);
781
+ const { step: m, windowPx: w } = B(f), { step: y, windowPx: D } = B(u);
782
+ return {
783
+ gridPosPx: { cols: f, rows: u },
784
+ colIndexer: C(f, m, w),
785
+ rowIndexer: C(u, y, D)
786
+ };
787
+ }, [a, n, o, r]), I = O(
788
+ (d) => g(d - s.margin.left),
789
+ [g, s]
790
+ ), _ = O(
791
+ (d) => v(d - s.margin.top),
792
+ [v, s]
793
+ ), k = O(
794
+ (d) => {
795
+ const { x: M, y: p, w: E, h: f } = d.layout, u = c.cols, m = c.rows;
796
+ if (!u.length || !m.length)
797
+ return { left: 0, top: 0, width: 0, height: 0 };
798
+ const w = Math.min(Math.max(0, M), u.length - 1), y = Math.min(Math.max(0, M + E), u.length - 1), D = Math.min(Math.max(0, p), m.length - 1), P = Math.min(Math.max(0, p + f), m.length - 1), X = (u[w] ?? 0) + s.margin.left, z = (m[D] ?? 0) + s.margin.top, J = (u[y] ?? 0) - (u[w] ?? 0), Y = (m[P] ?? 0) - (m[D] ?? 0);
799
+ return { left: X, top: z, width: J, height: Y };
800
+ },
801
+ [c, s]
802
+ );
803
+ return {
804
+ paperPx: s,
805
+ gridPosPx: c,
806
+ getColIndex: I,
807
+ getRowIndex: _,
808
+ getBlockRectPx: k
809
+ };
810
+ }
811
+ const ye = '[data-sidebar="true"]', Pe = { "data-sidebar": "true" };
812
+ export {
813
+ Ee as $,
814
+ ie as A,
815
+ ue as B,
816
+ T as C,
817
+ b as D,
818
+ Ft as E,
819
+ le as F,
820
+ ce as G,
821
+ Z as H,
822
+ xt as I,
823
+ qt as J,
824
+ he as K,
825
+ At as L,
826
+ de as M,
827
+ It as N,
828
+ h as O,
829
+ tt as P,
830
+ l as Q,
831
+ V as R,
832
+ Pe as S,
833
+ x as T,
834
+ i as U,
835
+ Q as V,
836
+ Tt as W,
837
+ oe as X,
838
+ pe as Y,
839
+ zt as Z,
840
+ Jt as _,
841
+ Yt as a,
842
+ ge as a0,
843
+ we as a1,
844
+ St as a2,
845
+ Vt as a3,
846
+ U as a4,
847
+ Ht as a5,
848
+ ve as a6,
849
+ ke as a7,
850
+ ye as a8,
851
+ Ot as a9,
852
+ Nt as aa,
853
+ be as ab,
854
+ Me as ac,
855
+ Kt as b,
856
+ Xt as c,
857
+ rt as d,
858
+ et as e,
859
+ ne as f,
860
+ re as g,
861
+ Qt as h,
862
+ wt as i,
863
+ pt as j,
864
+ Mt as k,
865
+ Et as l,
866
+ vt as m,
867
+ bt as n,
868
+ te as o,
869
+ Pt as p,
870
+ ae as q,
871
+ fe as r,
872
+ ee as s,
873
+ se as t,
874
+ De as u,
875
+ me as v,
876
+ _t as w,
877
+ Ut as x,
878
+ Wt as y,
879
+ Zt as z
880
+ };