@mintplayer/web-components 2.16.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/accordion/index.mjs +5 -5
  2. package/calendar/index.mjs +1 -1
  3. package/carousel/index.mjs +57 -143
  4. package/charts/core/index.mjs +30 -20
  5. package/charts/core/src/attributes.d.ts +18 -0
  6. package/charts/core/src/index.d.ts +2 -0
  7. package/charts/core/src/view-window.d.ts +46 -0
  8. package/charts/hierarchy/index.mjs +245 -256
  9. package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +1 -3
  10. package/charts/sparkline/index.mjs +27 -26
  11. package/charts/trend/index.mjs +21 -20
  12. package/checkbox/index.mjs +1 -1
  13. package/checkbox/src/components/mp-checkbox.d.ts +1 -0
  14. package/chunks/attributes-L3eKsbdy.mjs +16 -0
  15. package/chunks/color-mode-warning-71FmlzWX.mjs +13 -0
  16. package/chunks/{form-check.styles-B0pxJ6YC.mjs → form-check.styles-DqvBnspm.mjs} +24 -3
  17. package/chunks/{mp-calendar.element-CJ8-t-Zn.mjs → mp-calendar.element-BIHS9SZZ.mjs} +11 -6
  18. package/chunks/{mp-checkbox-CzwS7Y_t.mjs → mp-checkbox-zV83gILn.mjs} +44 -36
  19. package/chunks/{mp-datatable-B7st6G-I.mjs → mp-datatable-CEpSxlkd.mjs} +660 -357
  20. package/chunks/{mp-datetime-picker.element-DsWA1AFs.mjs → mp-datetime-picker.element-Cxu5-qRE.mjs} +29 -32
  21. package/chunks/{mp-pagination-Dea75mD4.mjs → mp-pagination-hGy4dL7p.mjs} +9 -4
  22. package/chunks/{mp-radio-cL46sUA0.mjs → mp-radio-BhRVNdKp.mjs} +32 -28
  23. package/chunks/{mp-select-BNrbPwN4.mjs → mp-select-CgqYFvUj.mjs} +41 -26
  24. package/chunks/{mp-splitter-Ckn1kN4v.mjs → mp-splitter-DLehrw3Y.mjs} +144 -120
  25. package/chunks/{mp-timepicker.element-CwaAAOcm.mjs → mp-timepicker.element-BiB9lkgc.mjs} +58 -45
  26. package/chunks/{mp-toggle-button-eo_aTQtu.mjs → mp-toggle-button-CaS9uYLE.mjs} +26 -24
  27. package/chunks/{mp-treeview-C8iltDbq.mjs → mp-treeview-CaMTDrvY.mjs} +51 -50
  28. package/chunks/{overlay-controller-DifgO6jT.mjs → overlay-controller-BHDagokg.mjs} +96 -92
  29. package/chunks/{id-DNZVAnGC.mjs → resource.service--lqLwEqk.mjs} +144 -206
  30. package/chunks/view-window-DGvFiDnW.mjs +263 -0
  31. package/code-snippet/index.mjs +70 -66
  32. package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
  33. package/custom-elements.json +66193 -0
  34. package/datatable/index.mjs +1 -1
  35. package/datatable/src/components/column-resize.d.ts +11 -0
  36. package/datatable/src/components/index.d.ts +1 -1
  37. package/datatable/src/components/mp-datatable.d.ts +264 -20
  38. package/datatable/src/index.d.ts +1 -1
  39. package/datatable/src/types/labels.d.ts +11 -0
  40. package/datepicker/index.mjs +10 -9
  41. package/datetime-picker/index.mjs +1 -1
  42. package/datetime-picker/src/mp-datetime-picker.element.d.ts +3 -0
  43. package/dock/index.mjs +430 -463
  44. package/dock/src/components/mint-dock-manager.element.d.ts +25 -2
  45. package/dock/src/core/resize.d.ts +60 -0
  46. package/dropdown-menu/index.mjs +4 -2
  47. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +6 -1
  48. package/dropdown-menu/src/index.d.ts +1 -1
  49. package/dropdown-menu/src/types/dropdown.d.ts +14 -1
  50. package/dropdown-menu/src/types/index.d.ts +1 -1
  51. package/file-manager/index.mjs +63 -61
  52. package/file-manager/src/components/mp-file-manager.d.ts +4 -3
  53. package/multi-range/index.mjs +56 -50
  54. package/multi-range/src/mint-multi-range.element.d.ts +4 -10
  55. package/multi-range/src/pointer-geometry.d.ts +31 -0
  56. package/navbar/index.mjs +89 -439
  57. package/overlay/index.mjs +1 -1
  58. package/overlay/src/overlay-controller.d.ts +0 -14
  59. package/overlay/src/placement.d.ts +48 -0
  60. package/package.json +7 -1
  61. package/pagination/index.mjs +1 -1
  62. package/phone-input/index.mjs +44 -40
  63. package/phone-input/src/components/stack.d.ts +8 -0
  64. package/query-builder/index.mjs +418 -466
  65. package/query-builder/src/dnd/drag-controller.d.ts +12 -8
  66. package/query-builder/src/mp-query-builder.element.d.ts +5 -1
  67. package/query-builder/src/mp-query-condition.element.d.ts +1 -0
  68. package/radio/index.mjs +1 -1
  69. package/radio-group/index.mjs +1 -1
  70. package/ribbon/index.mjs +477 -498
  71. package/ribbon/src/core/band-text-color.d.ts +10 -0
  72. package/ribbon/src/core/key-tip-allocator.d.ts +10 -0
  73. package/ribbon/src/core/plan-reduce-steps.d.ts +62 -0
  74. package/ribbon/src/mp-ribbon.element.d.ts +0 -27
  75. package/scheduler/index.mjs +726 -711
  76. package/scheduler/src/components/mp-scheduler.d.ts +19 -3
  77. package/scheduler/src/drag/drag-manager.d.ts +1 -9
  78. package/scheduler/src/input/input-handler.d.ts +12 -2
  79. package/scheduler/src/utils/geometry.d.ts +39 -0
  80. package/scheduler/src/views/timeline-view.d.ts +0 -1
  81. package/scheduler-core/index.mjs +84 -71
  82. package/scheduler-core/src/services/resource.service.d.ts +0 -12
  83. package/scheduler-core/src/services/timeline.service.d.ts +0 -9
  84. package/select/index.mjs +1 -1
  85. package/select/src/components/mp-select.d.ts +1 -0
  86. package/signature-pad/index.mjs +21 -23
  87. package/signature-pad/src/canvas-point.d.ts +26 -0
  88. package/signature-pad/src/mp-signature-pad.element.d.ts +1 -7
  89. package/splitter/index.mjs +1 -1
  90. package/splitter/src/components/mp-splitter.d.ts +16 -0
  91. package/splitter/src/managers/index.d.ts +1 -0
  92. package/splitter/src/managers/rescale-panel-sizes.d.ts +14 -0
  93. package/swiper-core/index.mjs +2 -2
  94. package/theming/bs-theme-preboot.js +1 -0
  95. package/theming/color-mode.css +36 -0
  96. package/theming/index.d.ts +1 -0
  97. package/theming/index.mjs +327 -0
  98. package/theming/src/components/mp-theme-toggle.d.ts +71 -0
  99. package/theming/src/cookie.d.ts +31 -0
  100. package/theming/src/index.d.ts +5 -0
  101. package/theming/src/preboot.d.ts +1 -0
  102. package/theming/src/resolve.d.ts +36 -0
  103. package/theming/src/store.d.ts +27 -0
  104. package/theming/src/styles/theme-toggle.styles.d.ts +2 -0
  105. package/theming/src/testing/fake-broadcast-channel.d.ts +35 -0
  106. package/theming/src/toggle-modes.d.ts +23 -0
  107. package/tile-manager/index.mjs +252 -211
  108. package/tile-manager/src/components/mint-tile-manager.element.d.ts +8 -0
  109. package/tile-manager/src/utils/grid-geometry.d.ts +49 -0
  110. package/timeline/index.mjs +156 -164
  111. package/timeline/src/components/mp-timeline.d.ts +41 -7
  112. package/timepicker/index.mjs +7 -4
  113. package/timepicker/src/mp-time-list.element.d.ts +26 -0
  114. package/timepicker/src/mp-timepicker.element.d.ts +3 -0
  115. package/toggle-button/index.mjs +1 -1
  116. package/tree-select/index.mjs +21 -9
  117. package/treeview/index.mjs +1 -1
  118. package/treeview/src/components/mp-treeview.d.ts +6 -4
  119. package/chunks/color-DIeST-IS.mjs +0 -224
  120. package/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
package/dock/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { html as U, unsafeCSS as Q, LitElement as tt } from "lit";
1
+ import { html as G, unsafeCSS as tt, LitElement as et } from "lit";
2
2
  import "../chunks/mp-tab-page-CaCzX1ym.mjs";
3
- import "../chunks/mp-splitter-Ckn1kN4v.mjs";
4
- import { L as et } from "../chunks/live-announcer-Bi0orG4n.mjs";
5
- import { F as it } from "../chunks/focus-restore-DxuP1Oe2.mjs";
6
- const nt = U`<div class="dock-root">
3
+ import "../chunks/mp-splitter-DLehrw3Y.mjs";
4
+ import { L as it } from "../chunks/live-announcer-Bi0orG4n.mjs";
5
+ import { F as nt } from "../chunks/focus-restore-DxuP1Oe2.mjs";
6
+ const ot = G`<div class="dock-root">
7
7
  <div class="dock-docked"></div>
8
8
  <div class="dock-floating-layer"></div>
9
9
  <div class="dock-intersections-layer dock-intersection-layer"></div>
@@ -54,7 +54,7 @@ const nt = U`<div class="dock-root">
54
54
  ↓
55
55
  </button>
56
56
  <div class="dock-drop-joystick__spacer"></div>
57
- </div>`, ot = Q(`:host {
57
+ </div>`, rt = tt(`:host {
58
58
  display: block;
59
59
  position: relative;
60
60
  width: 100%;
@@ -414,7 +414,7 @@ const nt = U`<div class="dock-root">
414
414
  animation: none !important;
415
415
  }
416
416
  }`);
417
- function R(s, t) {
417
+ function T(s, t) {
418
418
  if (t.width <= 0 || t.height <= 0) return s;
419
419
  const e = Math.min(s.width, t.width), i = Math.min(s.height, t.height), n = Math.min(Math.max(s.left, 0), t.width - e), o = Math.min(Math.max(s.top, 0), t.height - i);
420
420
  return { left: n, top: o, width: e, height: i };
@@ -433,39 +433,39 @@ function x(s, t) {
433
433
  const e = s.map((n) => Number.isFinite(n) ? Math.max(n, 0) : 0), i = e.reduce((n, o) => n + o, 0);
434
434
  return i <= 0 ? Array.from({ length: t }, () => 1 / t) : e.map((n) => n / i);
435
435
  }
436
- function rt(s) {
436
+ function st(s) {
437
437
  s.sizes = x(s.sizes, s.children.length);
438
438
  }
439
- function st(s, t, e) {
440
- const i = e - 1, n = x(s, i), o = 1 / e, r = 1 - o, d = [];
439
+ function at(s, t, e) {
440
+ const i = e - 1, n = x(s, i), o = 1 / e, r = 1 - o, c = [];
441
441
  for (let a = 0; a < e; a += 1)
442
442
  if (a === t)
443
- d.push(o);
443
+ c.push(o);
444
444
  else {
445
- const c = a < t ? a : a - 1;
446
- d.push(n[c] * r);
445
+ const l = a < t ? a : a - 1;
446
+ c.push(n[l] * r);
447
447
  }
448
- return d;
448
+ return c;
449
449
  }
450
- function at(s, t) {
450
+ function W(s, t) {
451
451
  let e = [];
452
452
  if (s)
453
453
  try {
454
- const l = JSON.parse(s);
455
- Array.isArray(l) && (e = l);
454
+ const d = JSON.parse(s);
455
+ Array.isArray(d) && (e = d);
456
456
  } catch {
457
457
  e = [];
458
458
  }
459
459
  if (e.length > 0) return e;
460
460
  const i = (t ?? "").split("|");
461
461
  if (i.length !== 2) return [];
462
- const [n, o] = i, r = n.lastIndexOf(":"), d = o.lastIndexOf(":");
463
- if (r <= 0 || d <= 0) return [];
464
- const a = Number.parseInt(n.slice(r + 1), 10), c = Number.parseInt(o.slice(d + 1), 10);
462
+ const [n, o] = i, r = n.lastIndexOf(":"), c = o.lastIndexOf(":");
463
+ if (r <= 0 || c <= 0) return [];
464
+ const a = Number.parseInt(n.slice(r + 1), 10), l = Number.parseInt(o.slice(c + 1), 10);
465
465
  return [
466
466
  {
467
467
  h: { pathStr: n.slice(0, r), index: a },
468
- v: { pathStr: o.slice(0, d), index: c }
468
+ v: { pathStr: o.slice(0, c), index: l }
469
469
  }
470
470
  ];
471
471
  }
@@ -480,30 +480,30 @@ function ct(s, t, e) {
480
480
  const i = { writes: [], remember: [], clearStored: !1 };
481
481
  if (s.length === 0) return i;
482
482
  const n = /* @__PURE__ */ new Set();
483
- if (s.forEach((c) => {
484
- n.add(c.h.pathStr), n.add(c.v.pathStr);
485
- }), [...n].some((c) => t.has(c)))
486
- return t.forEach((c, l) => {
487
- const h = e(l);
488
- h && i.writes.push({ pathStr: l, sizes: x(c, h.childCount) });
483
+ if (s.forEach((l) => {
484
+ n.add(l.h.pathStr), n.add(l.v.pathStr);
485
+ }), [...n].some((l) => t.has(l)))
486
+ return t.forEach((l, d) => {
487
+ const u = e(d);
488
+ u && i.writes.push({ pathStr: d, sizes: x(l, u.childCount) });
489
489
  }), i.clearStored = !0, i;
490
- const r = /* @__PURE__ */ new Map(), d = (c) => {
491
- const l = e(c);
492
- if (!l) return null;
493
- const h = r.get(c);
494
- return { childCount: l.childCount, sizes: h ?? l.sizes };
490
+ const r = /* @__PURE__ */ new Map(), c = (l) => {
491
+ const d = e(l);
492
+ if (!d) return null;
493
+ const u = r.get(l);
494
+ return { childCount: d.childCount, sizes: u ?? d.sizes };
495
495
  }, a = /* @__PURE__ */ new Set();
496
- return s.forEach((c) => {
497
- [c.h.pathStr, c.v.pathStr].forEach((l) => {
498
- if (a.has(l)) return;
499
- a.add(l);
500
- const h = e(l);
501
- h && Array.isArray(h.sizes) && i.remember.push({ pathStr: l, sizes: [...h.sizes] });
502
- }), [c.h, c.v].forEach(({ pathStr: l, index: h }) => {
503
- const u = d(l);
504
- if (!u) return;
505
- const f = x(u.sizes ?? [], u.childCount), p = lt(f, h);
506
- r.set(l, p), i.writes.push({ pathStr: l, sizes: p });
496
+ return s.forEach((l) => {
497
+ [l.h.pathStr, l.v.pathStr].forEach((d) => {
498
+ if (a.has(d)) return;
499
+ a.add(d);
500
+ const u = e(d);
501
+ u && Array.isArray(u.sizes) && i.remember.push({ pathStr: d, sizes: [...u.sizes] });
502
+ }), [l.h, l.v].forEach(({ pathStr: d, index: u }) => {
503
+ const h = c(d);
504
+ if (!h) return;
505
+ const g = x(h.sizes ?? [], h.childCount), p = lt(g, u);
506
+ r.set(d, p), i.writes.push({ pathStr: d, sizes: p });
507
507
  });
508
508
  }), i;
509
509
  }
@@ -537,13 +537,13 @@ function dt(s, t, e) {
537
537
  if (!s || s === t)
538
538
  return e;
539
539
  const i = X(s, t);
540
- return i && (i.parent.children[i.index] = e, rt(i.parent)), s;
540
+ return i && (i.parent.children[i.index] = e, st(i.parent)), s;
541
541
  }
542
- function _(s, t, e, i) {
542
+ function I(s, t, e, i) {
543
543
  const n = i === "left" || i === "right" ? "horizontal" : "vertical", o = i === "left" || i === "top", r = X(s, t);
544
544
  if (r && r.parent.direction === n) {
545
545
  const a = o ? r.index : r.index + 1;
546
- return r.parent.children.splice(a, 0, e), r.parent.sizes = st(
546
+ return r.parent.children.splice(a, 0, e), r.parent.sizes = at(
547
547
  r.parent.sizes,
548
548
  a,
549
549
  r.parent.children.length
@@ -571,7 +571,7 @@ function E(s) {
571
571
  t || e.panes.length === 0 || (e.activePane && e.panes.includes(e.activePane) ? t = e.activePane : t = e.panes[0]);
572
572
  }), t;
573
573
  }
574
- function I(s) {
574
+ function _(s) {
575
575
  const t = [];
576
576
  return N(s, (e) => {
577
577
  e.panes.forEach((i) => t.push(i));
@@ -587,9 +587,9 @@ function $(s) {
587
587
  const t = x(s.sizes, s.children.length), e = s.children.map((i, n) => ({ child: $(i), slot: t[n] })).filter((i) => i.child !== null).flatMap(({ child: i, slot: n }) => {
588
588
  if (i.kind === "split" && i.direction === s.direction) {
589
589
  const o = x(i.sizes, i.children.length);
590
- return i.children.map((r, d) => ({
590
+ return i.children.map((r, c) => ({
591
591
  child: r,
592
- slot: n * o[d]
592
+ slot: n * o[c]
593
593
  }));
594
594
  }
595
595
  return [{ child: i, slot: n }];
@@ -628,13 +628,13 @@ function ut(s) {
628
628
  };
629
629
  }
630
630
  const pt = 192, gt = 128;
631
- function W(s, t) {
631
+ function Z(s, t) {
632
632
  return t > 0 ? Math.min(s, t) : s;
633
633
  }
634
- function Z(s, t, e, i) {
635
- const n = W(pt, i.width), o = W(gt, i.height);
636
- let r = s.width, d = s.height, a = s.left, c = s.top;
637
- return t.horizontal === "right" ? (r = Math.max(n, s.width + e.x), i.width > 0 && (r = Math.min(r, i.width - s.left))) : t.horizontal === "left" && (r = Math.max(n, s.width - e.x), r = Math.min(r, s.left + s.width), a = s.left + s.width - r), t.vertical === "bottom" ? (d = Math.max(o, s.height + e.y), i.height > 0 && (d = Math.min(d, i.height - s.top))) : t.vertical === "top" && (d = Math.max(o, s.height - e.y), d = Math.min(d, s.top + s.height), c = s.top + s.height - d), { left: a, top: c, width: r, height: d };
634
+ function q(s, t, e, i) {
635
+ const n = Z(pt, i.width), o = Z(gt, i.height);
636
+ let r = s.width, c = s.height, a = s.left, l = s.top;
637
+ return t.horizontal === "right" ? (r = Math.max(n, s.width + e.x), i.width > 0 && (r = Math.min(r, i.width - s.left))) : t.horizontal === "left" && (r = Math.max(n, s.width - e.x), r = Math.min(r, s.left + s.width), a = s.left + s.width - r), t.vertical === "bottom" ? (c = Math.max(o, s.height + e.y), i.height > 0 && (c = Math.min(c, i.height - s.top))) : t.vertical === "top" && (c = Math.max(o, s.height - e.y), c = Math.min(c, s.top + s.height), l = s.top + s.height - c), { left: a, top: l, width: r, height: c };
638
638
  }
639
639
  const C = [1 / 3, 1 / 2, 2 / 3];
640
640
  function ft(s, t) {
@@ -647,7 +647,7 @@ function ft(s, t) {
647
647
  }
648
648
  return i * t;
649
649
  }
650
- function q(s, t, e) {
650
+ function K(s, t, e) {
651
651
  let i = s, n = e + 1;
652
652
  for (const o of t) {
653
653
  const r = Math.abs(o - s);
@@ -660,7 +660,24 @@ function mt(s, t, e, i, n = !1) {
660
660
  let r = Math.min(Math.max(s + e, i), o - i);
661
661
  return n && (r = ft(r, o)), { before: r, after: o - r };
662
662
  }
663
- function yt(s, t, e, i = 12) {
663
+ function yt(s, t, e, i, n = !1) {
664
+ if (t < 0 || t + 1 >= s.length) return null;
665
+ const o = s.reduce((l, d) => l + d, 0);
666
+ if (!(o > 0)) return null;
667
+ const { before: r, after: c } = mt(s[t], s[t + 1], e, i, n), a = s.map(
668
+ (l, d) => d === t ? r : d === t + 1 ? c : l
669
+ );
670
+ return { pixels: a, weights: a.map((l) => l / o) };
671
+ }
672
+ function bt(s, t, e) {
673
+ const { x: i, y: n } = s, o = n === null ? [] : t.filter(
674
+ ({ direction: c, rect: a }) => c === "horizontal" && n >= a.top && n <= a.bottom
675
+ ).map(({ rect: c }) => c.left + c.width / 2 - e.left), r = i === null ? [] : t.filter(
676
+ ({ direction: c, rect: a }) => c === "vertical" && i >= a.left && i <= a.right
677
+ ).map(({ rect: c }) => c.top + c.height / 2 - e.top);
678
+ return { x: o, y: r };
679
+ }
680
+ function kt(s, t, e, i = 12) {
664
681
  for (let n = 0; n < s.length; n += 1) {
665
682
  const r = (e !== null ? s[n] >= e : !1) ? s[n] + i : s[n];
666
683
  if (t < r)
@@ -676,15 +693,15 @@ function w(s) {
676
693
  const t = s.segments.join("/");
677
694
  return t.length > 0 ? `d:${t}` : "d:";
678
695
  }
679
- function S(s) {
696
+ function P(s) {
680
697
  if (s == null)
681
698
  return null;
682
699
  if (s.startsWith("f:")) {
683
700
  const i = s.slice(2), [n, ...o] = i.split("/"), r = Number.parseInt(n, 10);
684
701
  if (!Number.isFinite(r))
685
702
  return null;
686
- const d = o.filter((a) => a.length > 0).map((a) => Number.parseInt(a, 10)).filter((a) => Number.isFinite(a));
687
- return { type: "floating", index: r, segments: d };
703
+ const c = o.filter((a) => a.length > 0).map((a) => Number.parseInt(a, 10)).filter((a) => Number.isFinite(a));
704
+ return { type: "floating", index: r, segments: c };
688
705
  }
689
706
  const t = s.startsWith("d:") ? s.slice(2) : s;
690
707
  return t.length === 0 ? { type: "docked", segments: [] } : { type: "docked", segments: t.split("/").filter((i) => i.length > 0).map((i) => Number.parseInt(i, 10)).filter((i) => Number.isFinite(i)) };
@@ -699,27 +716,27 @@ function B(s, t) {
699
716
  const e = t;
700
717
  return s.segments.length !== e.segments.length ? !1 : s.segments.every((i, n) => i === e.segments[n]);
701
718
  }
702
- function T(s) {
719
+ function R(s) {
703
720
  return s.type === "floating" ? { type: "floating", index: s.index, segments: [...s.segments] } : { type: "docked", segments: [...s.segments] };
704
721
  }
705
- function bt(s, t) {
722
+ function vt(s, t) {
706
723
  return s.type !== t.type || s.type === "floating" && t.index !== s.index || s.segments.length > t.segments.length ? !1 : s.segments.every((e, i) => e === t.segments[i]);
707
724
  }
708
- class L extends tt {
725
+ class z extends et {
709
726
  constructor() {
710
- super(), this.liveAnnouncer = new et(this), this.paneMoveMode = null, this.paneMoveCandidateIndex = null, this.dropJoystickTarget = null, this.rootLayout = null, this.floatingLayouts = [], this.titles = {}, this.pendingTabDragMetrics = null, this.dragState = null, this.floatingDragState = null, this.floatingResizeState = null, this.intersectionRaf = null, this.rootResizeObserver = null, this.dockedMutationObserver = null, this.cornerResizeState = null, this.pointerTrackingActive = !1, this.dragPointerTrackingActive = !1, this.lastDragPointerPosition = null, this.cornerSnapXTargets = [], this.cornerSnapYTargets = [], this.debugLayoutIntegrity = !1, this.pendingDragEndTimeout = null, this.previousSplitSizes = /* @__PURE__ */ new Map(), this.layoutFocusRestore = new it(() => this.shadowRoot, {
727
+ super(), this.liveAnnouncer = new it(this), this.paneMoveMode = null, this.paneMoveCandidateIndex = null, this.dropJoystickTarget = null, this.rootLayout = null, this.floatingLayouts = [], this.titles = {}, this.pendingTabDragMetrics = null, this.dragState = null, this.floatingDragState = null, this.floatingResizeState = null, this.intersectionRaf = null, this.rootResizeObserver = null, this.dockedMutationObserver = null, this.cornerResizeState = null, this.pointerTrackingActive = !1, this.dragPointerTrackingActive = !1, this.lastDragPointerPosition = null, this.cornerSnapXTargets = [], this.cornerSnapYTargets = [], this.debugLayoutIntegrity = !1, this.pendingDragEndTimeout = null, this.previousSplitSizes = /* @__PURE__ */ new Map(), this.layoutFocusRestore = new nt(() => this.shadowRoot, {
711
728
  selector: ".dock-intersection-handle[data-key], mp-tab-control, .dock-tab[data-tab-id]",
712
729
  keyOf: (t) => t.dataset.key ?? t.dataset.tabId ?? (t.id || null)
713
- }), this.instanceId = `mint-dock-${++L.instanceCounter}`, this.windowRef = typeof window < "u" ? window : null, this.onPointerMove = this.onPointerMove.bind(this), this.onPointerUp = this.onPointerUp.bind(this), this.onPointerCancel = this.onPointerCancel.bind(this), this.onDragPointerMove = this.onDragPointerMove.bind(this), this.onDragPointerUp = this.onDragPointerUp.bind(this), this.onDragPointerCancel = this.onDragPointerCancel.bind(this), this.onSplitterResize = this.onSplitterResize.bind(this);
730
+ }), this.instanceId = `mint-dock-${++z.instanceCounter}`, this.windowRef = typeof window < "u" ? window : null, this.onPointerMove = this.onPointerMove.bind(this), this.onPointerUp = this.onPointerUp.bind(this), this.onPointerCancel = this.onPointerCancel.bind(this), this.onDragPointerMove = this.onDragPointerMove.bind(this), this.onDragPointerUp = this.onDragPointerUp.bind(this), this.onDragPointerCancel = this.onDragPointerCancel.bind(this), this.onSplitterResize = this.onSplitterResize.bind(this);
714
731
  }
715
732
  static {
716
- this.styles = [ot];
733
+ this.styles = [rt];
717
734
  }
718
735
  static {
719
736
  this.documentRef = typeof document < "u" ? document : null;
720
737
  }
721
738
  static configureDocument(t) {
722
- t && (L.documentRef = t);
739
+ t && (z.documentRef = t);
723
740
  }
724
741
  static get observedAttributes() {
725
742
  return [...super.observedAttributes ?? [], "layout", "debug-layout-integrity"];
@@ -740,7 +757,7 @@ class L extends tt {
740
757
  this.PANE_MOVE_ZONE_ORDER = ["top", "right", "bottom", "left"];
741
758
  }
742
759
  render() {
743
- return U`${nt}${this.liveAnnouncer.template()}`;
760
+ return G`${ot}${this.liveAnnouncer.template()}`;
744
761
  }
745
762
  firstUpdated() {
746
763
  const t = this.resolveDocument();
@@ -757,15 +774,15 @@ class L extends tt {
757
774
  const r = e.querySelector(".dock-drop-indicator");
758
775
  if (!r)
759
776
  throw new Error("mint-dock-manager template is missing the drop indicator element.");
760
- const d = e.querySelector(".dock-drop-joystick");
761
- if (!d)
777
+ const c = e.querySelector(".dock-drop-joystick");
778
+ if (!c)
762
779
  throw new Error("mint-dock-manager template is missing the drop joystick element.");
763
780
  const a = Array.from(
764
- d.querySelectorAll(".dock-drop-joystick__button[data-zone]")
781
+ c.querySelectorAll(".dock-drop-joystick__button[data-zone]")
765
782
  );
766
783
  if (a.length === 0)
767
784
  throw new Error("mint-dock-manager template is missing drop joystick buttons.");
768
- this.rootEl = i, this.dockedEl = n, this.floatingLayerEl = o, this.dropIndicator = r, this.dropJoystick = d, this.dropJoystickButtons = a, this.dockedEl.dataset.path = w({ type: "docked", segments: [] }), i.addEventListener("keydown", (c) => this.onRootKeyDown(c), { capture: !0 }), i.addEventListener("focusout", (c) => this.onRootFocusOut(c)), this.renderLayout(), this.rootResizeObserver = new ResizeObserver(() => {
785
+ this.rootEl = i, this.dockedEl = n, this.floatingLayerEl = o, this.dropIndicator = r, this.dropJoystick = c, this.dropJoystickButtons = a, this.dockedEl.dataset.path = w({ type: "docked", segments: [] }), i.addEventListener("keydown", (l) => this.onRootKeyDown(l), { capture: !0 }), i.addEventListener("focusout", (l) => this.onRootFocusOut(l)), this.renderLayout(), this.rootResizeObserver = new ResizeObserver(() => {
769
786
  this.scheduleRenderIntersectionHandles(), this.updateFloatingPanePositions();
770
787
  }), this.rootResizeObserver.observe(this.rootEl), this.dockedMutationObserver = new MutationObserver(() => this.scheduleRenderIntersectionHandles()), this.dockedMutationObserver.observe(this.dockedEl, { childList: !0, subtree: !0 }), this.dockedEl.addEventListener("resizing", this.onSplitterResize), this.dockedEl.addEventListener("resize-end", this.onSplitterResize);
771
788
  }
@@ -812,10 +829,10 @@ class L extends tt {
812
829
  return this.snapshot;
813
830
  }
814
831
  resolveDocument() {
815
- const t = L.documentRef, e = this.ownerDocument ?? null, n = t ?? e ?? (typeof document < "u" ? document : null);
832
+ const t = z.documentRef, e = this.ownerDocument ?? null, n = t ?? e ?? (typeof document < "u" ? document : null);
816
833
  if (!n)
817
834
  throw new Error("mint-dock-manager requires a Document to initialize.");
818
- return L.documentRef || (L.documentRef = n), n;
835
+ return z.documentRef || (z.documentRef = n), n;
819
836
  }
820
837
  resolveWindow(t) {
821
838
  return typeof window < "u" ? window : t.defaultView ?? null;
@@ -864,32 +881,23 @@ class L extends tt {
864
881
  });
865
882
  const o = this.getFloatingWindowTitle(e), r = `${this.instanceId}-floating-${i}-title`;
866
883
  n.setAttribute("role", "dialog"), n.setAttribute("aria-labelledby", r), n.setAttribute("aria-modal", "false");
867
- const { left: d, top: a, width: c, height: l } = R(e.bounds, t);
868
- n.style.left = `${d}px`, n.style.top = `${a}px`, n.style.width = `${c}px`, n.style.height = `${l}px`, n.style.minWidth = "0", n.style.minHeight = "0";
869
- const h = H(this.floatingLayouts[i], i);
870
- n.style.zIndex = String(h);
871
- const u = this.documentRef.createElement("div");
872
- u.classList.add("dock-floating__chrome"), u.addEventListener(
884
+ const { left: c, top: a, width: l, height: d } = T(e.bounds, t);
885
+ n.style.left = `${c}px`, n.style.top = `${a}px`, n.style.width = `${l}px`, n.style.height = `${d}px`, n.style.minWidth = "0", n.style.minHeight = "0";
886
+ const u = H(this.floatingLayouts[i], i);
887
+ n.style.zIndex = String(u);
888
+ const h = this.documentRef.createElement("div");
889
+ h.classList.add("dock-floating__chrome"), h.addEventListener(
873
890
  "pointerdown",
874
- (g) => this.beginFloatingDrag(g, i, n, u)
891
+ (m) => this.beginFloatingDrag(m, i, n, h)
875
892
  );
876
- const f = this.documentRef.createElement("div");
877
- f.classList.add("dock-floating__title"), f.id = r, f.textContent = o, u.appendChild(f);
893
+ const g = this.documentRef.createElement("div");
894
+ g.classList.add("dock-floating__title"), g.id = r, g.textContent = o, h.appendChild(g);
878
895
  const p = this.documentRef.createElement("button");
879
- if (p.type = "button", p.classList.add("dock-floating__close"), p.setAttribute("aria-label", `Close pane: ${o}`), p.textContent = "×", p.addEventListener("click", (g) => {
880
- g.stopPropagation(), this.closeFloatingPane(i);
881
- }), p.addEventListener("pointerdown", (g) => g.stopPropagation()), u.appendChild(p), n.appendChild(u), e.root) {
882
- const g = this.renderNode(e.root, [], i);
883
- g.classList.add("dock-floating__stack"), n.appendChild(g);
884
- } else {
885
- const g = this.documentRef.createElement("div");
886
- g.classList.add("dock-stack"), g.dataset.path = w({
887
- type: "floating",
888
- index: i,
889
- segments: []
890
- });
891
- const y = this.documentRef.createElement("div");
892
- y.classList.add("dock-stack__pane"), y.textContent = "No panes configured", g.appendChild(y), n.appendChild(g);
896
+ if (p.type = "button", p.classList.add("dock-floating__close"), p.setAttribute("aria-label", `Close pane: ${o}`), p.textContent = "×", p.addEventListener("click", (m) => {
897
+ m.stopPropagation(), this.closeFloatingPane(i);
898
+ }), p.addEventListener("pointerdown", (m) => m.stopPropagation()), h.appendChild(p), n.appendChild(h), e.root) {
899
+ const m = this.renderNode(e.root, [], i);
900
+ m.classList.add("dock-floating__stack"), n.appendChild(m);
893
901
  }
894
902
  [
895
903
  {
@@ -924,21 +932,21 @@ class L extends tt {
924
932
  classes: ["dock-floating__resizer", "dock-floating__resizer--left"],
925
933
  edges: { horizontal: "left", vertical: "none" }
926
934
  }
927
- ].forEach(({ classes: g, edges: y }) => {
935
+ ].forEach(({ classes: m, edges: y }) => {
928
936
  const b = this.documentRef.createElement("div");
929
- b.classList.add(...g), b.setAttribute("role", "separator");
937
+ b.classList.add(...m), b.setAttribute("role", "separator");
930
938
  const k = y.horizontal === "none" && y.vertical !== "none", D = y.vertical === "none" && y.horizontal !== "none";
931
939
  k ? b.setAttribute("aria-orientation", "horizontal") : D && b.setAttribute("aria-orientation", "vertical");
932
- const P = [];
933
- y.vertical === "top" ? P.push("top") : y.vertical === "bottom" && P.push("bottom"), y.horizontal === "left" ? P.push("left") : y.horizontal === "right" && P.push("right"), b.setAttribute(
940
+ const S = [];
941
+ y.vertical === "top" ? S.push("top") : y.vertical === "bottom" && S.push("bottom"), y.horizontal === "left" ? S.push("left") : y.horizontal === "right" && S.push("right"), b.setAttribute(
934
942
  "aria-label",
935
- `Resize pane ${P.length === 2 ? "corner " : "edge "}${P.join("-")}`
943
+ `Resize pane ${S.length === 2 ? "corner " : "edge "}${S.join("-")}`
936
944
  ), b.addEventListener(
937
945
  "pointerdown",
938
- (z) => this.beginFloatingResize(z, i, n, b, y)
946
+ (L) => this.beginFloatingResize(L, i, n, b, y)
939
947
  ), b.setAttribute("tabindex", "0"), b.setAttribute("aria-valuemin", "0"), b.setAttribute("aria-valuemax", "100"), this.syncFloatingResizerValue(b, i, y), b.addEventListener(
940
948
  "keydown",
941
- (z) => this.onFloatingResizeKeydown(z, i, n, b, y)
949
+ (L) => this.onFloatingResizeKeydown(L, i, n, b, y)
942
950
  ), n.appendChild(b);
943
951
  }), this.floatingLayerEl.appendChild(n);
944
952
  });
@@ -958,11 +966,11 @@ class L extends tt {
958
966
  if (!t) return;
959
967
  const e = this.rootEl.getBoundingClientRect();
960
968
  if (this.cornerResizeState) {
961
- const a = this.cornerResizeState, c = a.hs[0], l = a.vs[0], h = this.findSplitterByPath(c.path.segments), u = this.findSplitterByPath(l.path.segments), f = h ? this.getSplitterDividers(h)[c.index] : null, p = u ? this.getSplitterDividers(u)[l.index] : null;
962
- if (f && p) {
963
- const m = f.getBoundingClientRect(), g = p.getBoundingClientRect(), y = g.left + g.width / 2 - e.left, b = m.top + m.height / 2 - e.top;
964
- a.handle.style.left = `${y}px`, a.handle.style.top = `${b}px`, Array.from(t.querySelectorAll(".dock-intersection-handle")).forEach((k) => {
965
- k !== a.handle && k.remove();
969
+ const a = this.cornerResizeState, l = a.hs[0], d = a.vs[0], u = l ? this.getSplitterDividers(l.container)[l.index] : null, h = d ? this.getSplitterDividers(d.container)[d.index] : null;
970
+ if (u && h) {
971
+ const g = u.getBoundingClientRect(), p = h.getBoundingClientRect(), f = p.left + p.width / 2 - e.left, m = g.top + g.height / 2 - e.top;
972
+ a.handle.style.left = `${f}px`, a.handle.style.top = `${m}px`, Array.from(t.querySelectorAll(".dock-intersection-handle")).forEach((y) => {
973
+ y !== a.handle && y.remove();
966
974
  });
967
975
  }
968
976
  return;
@@ -972,31 +980,29 @@ class L extends tt {
972
980
  Array.from(
973
981
  this.shadowRoot?.querySelectorAll(".dock-split") ?? []
974
982
  ).forEach((a) => {
975
- const c = a.dataset.direction, l = a.dataset.path ?? "", h = this.splitterLayerKey(a);
976
- this.getSplitterDividers(a).forEach((u, f) => {
977
- const p = { rect: u.getBoundingClientRect(), pathStr: l, index: f, layerKey: h };
978
- c === "horizontal" ? n.push(p) : c === "vertical" && i.push(p);
983
+ const l = a.dataset.direction, d = a.dataset.path ?? "", u = this.splitterLayerKey(a);
984
+ this.getSplitterDividers(a).forEach((h, g) => {
985
+ const p = { rect: h.getBoundingClientRect(), pathStr: d, index: g, layerKey: u };
986
+ l === "horizontal" ? n.push(p) : l === "vertical" && i.push(p);
979
987
  });
980
988
  });
981
- const r = 24, d = /* @__PURE__ */ new Map();
989
+ const r = 24, c = /* @__PURE__ */ new Map();
982
990
  i.forEach((a) => {
983
- const c = a.rect.top + a.rect.height / 2;
984
- n.forEach((l) => {
985
- if (a.layerKey !== l.layerKey) return;
986
- const h = l.rect.left + l.rect.width / 2, u = h < a.rect.left ? a.rect.left - h : h > a.rect.right ? h - a.rect.right : 0, f = c < l.rect.top ? l.rect.top - c : c > l.rect.bottom ? c - l.rect.bottom : 0;
987
- if (u > r || f > r) return;
988
- const p = h - e.left, m = c - e.top, g = `${Math.round(p)}:${Math.round(m)}`, y = d.get(g) ?? { x: p, y: m, pairs: [] };
989
- y.pairs.push({ h: { pathStr: a.pathStr, index: a.index }, v: { pathStr: l.pathStr, index: l.index } }), d.set(g, y);
991
+ const l = a.rect.top + a.rect.height / 2;
992
+ n.forEach((d) => {
993
+ if (a.layerKey !== d.layerKey) return;
994
+ const u = d.rect.left + d.rect.width / 2, h = u < a.rect.left ? a.rect.left - u : u > a.rect.right ? u - a.rect.right : 0, g = l < d.rect.top ? d.rect.top - l : l > d.rect.bottom ? l - d.rect.bottom : 0;
995
+ if (h > r || g > r) return;
996
+ const p = u - e.left, f = l - e.top, m = `${Math.round(p)}:${Math.round(f)}`, y = c.get(m) ?? { x: p, y: f, pairs: [] };
997
+ y.pairs.push({ h: { pathStr: a.pathStr, index: a.index }, v: { pathStr: d.pathStr, index: d.index } }), c.set(m, y);
990
998
  });
991
- }), d.forEach((a, c) => {
992
- const l = this.documentRef.createElement("div");
993
- l.classList.add("dock-intersection-handle", "glyph"), l.setAttribute("role", "separator"), l.setAttribute("aria-label", "Resize split intersection");
994
- const h = e.width > 0 ? Math.round(a.x / e.width * 100) : 0;
995
- l.setAttribute("aria-valuemin", "0"), l.setAttribute("aria-valuemax", "100"), l.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, h)))), l.setAttribute("tabindex", "0");
996
- const u = a.pairs[0], f = `${u.h.pathStr}:${u.h.index}|${u.v.pathStr}:${u.v.index}`;
997
- l.dataset.key = f, l.dataset.pairs = JSON.stringify(a.pairs), l.style.left = `${a.x}px`, l.style.top = `${a.y}px`;
998
- const p = { path: S(u.h.pathStr), index: u.h.index, container: this.findSplitterByPath(S(u.h.pathStr)?.segments ?? []) ?? this.rootEl, rect: new DOMRect() }, m = { path: S(u.v.pathStr), index: u.v.index, container: this.findSplitterByPath(S(u.v.pathStr)?.segments ?? []) ?? this.rootEl, rect: new DOMRect() };
999
- l.addEventListener("pointerdown", (g) => this.beginCornerResize(g, p, m, l)), l.addEventListener("dblclick", (g) => this.onIntersectionDoubleClick(g, l)), l.addEventListener("keydown", (g) => this.onIntersectionKeyDown(g, l)), t.appendChild(l);
999
+ }), c.forEach((a, l) => {
1000
+ const d = this.documentRef.createElement("div");
1001
+ d.classList.add("dock-intersection-handle", "glyph"), d.setAttribute("role", "separator"), d.setAttribute("aria-label", "Resize split intersection");
1002
+ const u = e.width > 0 ? Math.round(a.x / e.width * 100) : 0;
1003
+ d.setAttribute("aria-valuemin", "0"), d.setAttribute("aria-valuemax", "100"), d.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, u)))), d.setAttribute("tabindex", "0");
1004
+ const h = a.pairs[0], g = `${h.h.pathStr}:${h.h.index}|${h.v.pathStr}:${h.v.index}`;
1005
+ d.dataset.key = g, d.dataset.pairs = JSON.stringify(a.pairs), d.style.left = `${a.x}px`, d.style.top = `${a.y}px`, d.addEventListener("pointerdown", (p) => this.beginCornerResize(p, d)), d.addEventListener("dblclick", (p) => this.onIntersectionDoubleClick(p, d)), d.addEventListener("keydown", (p) => this.onIntersectionKeyDown(p, d)), t.appendChild(d);
1000
1006
  });
1001
1007
  }
1002
1008
  /**
@@ -1015,94 +1021,64 @@ class L extends tt {
1015
1021
  if (!i && !n && !o) return;
1016
1022
  const r = e.dataset.pairs;
1017
1023
  if (!r) return;
1018
- let d;
1024
+ let c;
1019
1025
  try {
1020
- d = JSON.parse(r);
1026
+ c = JSON.parse(r);
1021
1027
  } catch {
1022
1028
  return;
1023
1029
  }
1024
- if (d.length === 0) return;
1030
+ if (c.length === 0) return;
1025
1031
  t.preventDefault();
1026
- const a = t.shiftKey, l = i || o ? d[0].v : d[0].h, h = S(l.pathStr);
1027
- this.findSplitterByPath(h?.segments ?? [])?.resizeDividerBy?.(l.index, t.key, a);
1032
+ const a = t.shiftKey, d = i || o ? c[0].v : c[0].h;
1033
+ this.findSplitterByPath(P(d.pathStr))?.resizeDividerBy?.(d.index, t.key, a);
1028
1034
  }
1029
- beginCornerResize(t, e, i, n) {
1035
+ beginCornerResize(t, e) {
1030
1036
  t.preventDefault();
1031
- const o = n.dataset.pairs, r = o ? JSON.parse(o) : [], d = [], a = [], c = (l, h, u) => {
1032
- const f = S(l);
1033
- if (!f) return;
1034
- const p = this.findSplitterByPath(f.segments);
1035
- if (!p) return;
1036
- const m = this.getSplitterPanels(p);
1037
- if (m.length === 0) return;
1038
- const g = u === "h" ? "height" : "width", y = m.map((k) => k.getBoundingClientRect()[g]), b = { path: f, index: h, container: p, initialSizes: y, before: y[h], after: y[h + 1] };
1039
- u === "h" ? d.push(b) : a.push(b);
1040
- };
1041
- if (r.length > 0 ? r.forEach((l) => {
1042
- c(l.h.pathStr, l.h.index, "h"), c(l.v.pathStr, l.v.index, "v");
1043
- }) : e.path && i.path && (c(w(e.path), e.index, "h"), c(w(i.path), i.index, "v")), !(d.length === 0 && a.length === 0)) {
1044
- try {
1045
- n.setPointerCapture(t.pointerId), n.dataset.resizing = "true", n.classList.add("hovering");
1046
- } catch {
1047
- }
1048
- this.cornerResizeState = {
1049
- pointerId: t.pointerId,
1050
- handle: n,
1051
- hs: d.map((l) => ({ path: T(l.path), index: l.index, container: l.container, beforeSize: l.before, afterSize: l.after, initialSizes: l.initialSizes, startY: t.clientY })),
1052
- vs: a.map((l) => ({ path: T(l.path), index: l.index, container: l.container, beforeSize: l.before, afterSize: l.after, initialSizes: l.initialSizes, startX: t.clientX }))
1053
- }, this.startPointerTracking(), n.dataset.key || (n.dataset.key = n.dataset.group ?? "");
1054
- try {
1055
- const l = this.rootEl.getBoundingClientRect();
1056
- let h = null, u = null;
1057
- if (a.length > 0) {
1058
- const g = a[0], b = this.getSplitterDividers(g.container)[g.index]?.getBoundingClientRect();
1059
- b && (h = b.left + b.width / 2);
1060
- }
1061
- if (d.length > 0) {
1062
- const g = d[0], b = this.getSplitterDividers(g.container)[g.index]?.getBoundingClientRect();
1063
- b && (u = b.top + b.height / 2);
1064
- }
1065
- const f = [], p = [];
1066
- Array.from(
1067
- this.shadowRoot?.querySelectorAll(".dock-split") ?? []
1068
- ).forEach((g) => {
1069
- const y = g.dataset.direction ?? void 0;
1070
- this.getSplitterDividers(g).forEach((b) => {
1071
- const k = b.getBoundingClientRect();
1072
- y === "horizontal" && u != null ? u >= k.top && u <= k.bottom && f.push(k.left + k.width / 2 - l.left) : y === "vertical" && h != null && h >= k.left && h <= k.right && p.push(k.top + k.height / 2 - l.top);
1073
- });
1074
- }), this.cornerSnapXTargets = f, this.cornerSnapYTargets = p;
1075
- } catch {
1076
- this.cornerSnapXTargets = [], this.cornerSnapYTargets = [];
1077
- }
1037
+ const i = W(e.dataset.pairs, e.dataset.key), n = ({ pathStr: h, index: g }, p) => {
1038
+ const f = P(h), m = this.findSplitterByPath(f), y = m ? this.getSplitterPanels(m) : [];
1039
+ return !f || !m || y.length === 0 ? null : { path: f, index: g, container: m, initialSizes: y.map((b) => b.getBoundingClientRect()[p]) };
1040
+ }, o = i.map((h) => n(h.h, "height")).filter((h) => h !== null), r = i.map((h) => n(h.v, "width")).filter((h) => h !== null);
1041
+ if (o.length === 0 && r.length === 0) return;
1042
+ try {
1043
+ e.setPointerCapture(t.pointerId);
1044
+ } catch {
1078
1045
  }
1046
+ e.dataset.resizing = "true", e.classList.add("hovering"), this.cornerResizeState = {
1047
+ pointerId: t.pointerId,
1048
+ handle: e,
1049
+ hs: o.map((h) => ({ path: R(h.path), index: h.index, container: h.container, initialSizes: h.initialSizes, startY: t.clientY })),
1050
+ vs: r.map((h) => ({ path: R(h.path), index: h.index, container: h.container, initialSizes: h.initialSizes, startX: t.clientX }))
1051
+ }, this.startPointerTracking(), e.dataset.key || (e.dataset.key = e.dataset.group ?? "");
1052
+ const c = (h) => h ? this.getSplitterDividers(h.container)[h.index]?.getBoundingClientRect() ?? null : null, a = c(r[0]), l = c(o[0]), d = Array.from(
1053
+ this.shadowRoot?.querySelectorAll(".dock-split") ?? []
1054
+ ).flatMap((h) => {
1055
+ const g = h.dataset.direction;
1056
+ return this.getSplitterDividers(h).map((p) => ({ direction: g, rect: p.getBoundingClientRect() }));
1057
+ }), u = bt(
1058
+ { x: a ? a.left + a.width / 2 : null, y: l ? l.top + l.height / 2 : null },
1059
+ d,
1060
+ this.rootEl.getBoundingClientRect()
1061
+ );
1062
+ this.cornerSnapXTargets = u.x, this.cornerSnapYTargets = u.y;
1079
1063
  }
1080
1064
  handleCornerResizeMove(t) {
1081
1065
  const e = this.cornerResizeState;
1082
1066
  if (!e || e.pointerId !== t.pointerId) return;
1083
- const i = 10, n = this.rootEl.getBoundingClientRect(), o = q(
1067
+ const i = 10, n = this.rootEl.getBoundingClientRect(), o = K(
1084
1068
  t.clientX,
1085
1069
  this.cornerSnapXTargets.map((a) => n.left + a),
1086
1070
  i
1087
- ), r = q(
1071
+ ), r = K(
1088
1072
  t.clientY,
1089
1073
  this.cornerSnapYTargets.map((a) => n.top + a),
1090
1074
  i
1091
- ), d = (a, c) => {
1092
- const l = A(a.path, this.rootLayout, this.floatingLayouts);
1093
- if (!l) return;
1094
- const h = 48, { before: u, after: f } = mt(
1095
- a.beforeSize,
1096
- a.afterSize,
1097
- c,
1098
- h,
1099
- t.shiftKey
1100
- ), p = [...a.initialSizes];
1101
- p[a.index] = u, p[a.index + 1] = f;
1102
- const m = p.reduce((g, y) => g + y, 0);
1103
- l.sizes = m > 0 ? p.map((g) => g / m) : [], a.container.setPanelSizes?.(p);
1075
+ ), c = (a, l) => {
1076
+ const d = A(a.path, this.rootLayout, this.floatingLayouts);
1077
+ if (!d) return;
1078
+ const h = yt(a.initialSizes, a.index, l, 48, t.shiftKey);
1079
+ h && (d.sizes = h.weights, a.container.setPanelSizes?.(h.pixels));
1104
1080
  };
1105
- e.hs.forEach((a) => d(a, r - a.startY)), e.vs.forEach((a) => d(a, o - a.startX)), this.dispatchLayoutChanged(), this.scheduleRenderIntersectionHandles();
1081
+ e.hs.forEach((a) => c(a, r - a.startY)), e.vs.forEach((a) => c(a, o - a.startX)), this.dispatchLayoutChanged(), this.scheduleRenderIntersectionHandles();
1106
1082
  }
1107
1083
  endCornerResize(t) {
1108
1084
  const e = this.cornerResizeState;
@@ -1116,19 +1092,19 @@ class L extends tt {
1116
1092
  }
1117
1093
  onIntersectionDoubleClick(t, e) {
1118
1094
  t.preventDefault();
1119
- const i = at(e.dataset.pairs, e.dataset.key);
1095
+ const i = W(e.dataset.pairs, e.dataset.key);
1120
1096
  if (i.length === 0) return;
1121
1097
  const n = ct(
1122
1098
  i,
1123
1099
  this.previousSplitSizes,
1124
1100
  (o) => {
1125
- const r = S(o), d = r ? A(r, this.rootLayout, this.floatingLayouts) : null;
1126
- return d ? { sizes: d.sizes, childCount: d.children.length } : null;
1101
+ const r = P(o), c = r ? A(r, this.rootLayout, this.floatingLayouts) : null;
1102
+ return c ? { sizes: c.sizes, childCount: c.children.length } : null;
1127
1103
  }
1128
1104
  );
1129
1105
  n.remember.forEach(({ pathStr: o, sizes: r }) => this.previousSplitSizes.set(o, r)), n.writes.forEach(({ pathStr: o, sizes: r }) => {
1130
- const d = S(o), a = d ? A(d, this.rootLayout, this.floatingLayouts) : null;
1131
- !a || !d || (a.sizes = r, this.pushSizesToSplitter(d, r));
1106
+ const c = P(o), a = c ? A(c, this.rootLayout, this.floatingLayouts) : null;
1107
+ !a || !c || (a.sizes = r, this.pushSizesToSplitter(c, r));
1132
1108
  }), n.clearStored && this.previousSplitSizes.clear(), this.dispatchLayoutChanged(), this.scheduleRenderIntersectionHandles();
1133
1109
  }
1134
1110
  /**
@@ -1141,21 +1117,21 @@ class L extends tt {
1141
1117
  * out of this method's shadow to become testable.
1142
1118
  */
1143
1119
  pushSizesToSplitter(t, e) {
1144
- const i = this.findSplitterByPath(t.segments);
1120
+ const i = this.findSplitterByPath(t);
1145
1121
  if (!i) return;
1146
1122
  const o = (i.dataset.direction ?? "horizontal") === "horizontal" ? i.getBoundingClientRect().width : i.getBoundingClientRect().height;
1147
1123
  if (!Number.isFinite(o) || o <= 0) return;
1148
- const r = e.reduce((a, c) => a + Math.max(c, 0), 0);
1124
+ const r = e.reduce((a, l) => a + Math.max(l, 0), 0);
1149
1125
  if (r <= 0) return;
1150
- const d = e.map((a) => Math.max(a, 0) / r * o);
1151
- i.setPanelSizes?.(d);
1126
+ const c = e.map((a) => Math.max(a, 0) / r * o);
1127
+ i.setPanelSizes?.(c);
1152
1128
  }
1153
1129
  beginFloatingDrag(t, e, i, n) {
1154
1130
  const o = this.floatingLayouts[e];
1155
1131
  if (!o)
1156
1132
  return;
1157
- t.preventDefault(), t.stopPropagation(), o.bounds = R(o.bounds, this.getHostSize());
1158
- const { left: r, top: d } = o.bounds;
1133
+ t.preventDefault(), t.stopPropagation(), o.bounds = T(o.bounds, this.getHostSize());
1134
+ const { left: r, top: c } = o.bounds;
1159
1135
  try {
1160
1136
  n.setPointerCapture(t.pointerId);
1161
1137
  } catch {
@@ -1166,7 +1142,7 @@ class L extends tt {
1166
1142
  startX: t.clientX,
1167
1143
  startY: t.clientY,
1168
1144
  startLeft: r,
1169
- startTop: d,
1145
+ startTop: c,
1170
1146
  wrapper: i,
1171
1147
  handle: n
1172
1148
  }, this.startPointerTracking();
@@ -1187,28 +1163,28 @@ class L extends tt {
1187
1163
  */
1188
1164
  onFloatingResizeKeydown(t, e, i, n, o) {
1189
1165
  if (t.altKey || t.ctrlKey || t.metaKey) return;
1190
- const r = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, d = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
1191
- if (r === 0 && d === 0 || r !== 0 && o.horizontal === "none" || d !== 0 && o.vertical === "none") return;
1166
+ const r = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, c = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
1167
+ if (r === 0 && c === 0 || r !== 0 && o.horizontal === "none" || c !== 0 && o.vertical === "none") return;
1192
1168
  const a = this.floatingLayouts[e];
1193
1169
  if (!a) return;
1194
1170
  t.preventDefault(), t.stopPropagation();
1195
- const c = t.shiftKey ? 1 : 10, l = Z(
1171
+ const l = t.shiftKey ? 1 : 10, d = q(
1196
1172
  a.bounds,
1197
1173
  o,
1198
- { x: r * c, y: d * c },
1174
+ { x: r * l, y: c * l },
1199
1175
  this.getHostSize()
1200
1176
  );
1201
- this.applyFloatingBounds(i, e, l), this.syncFloatingResizerValue(n, e, o), this.dispatchLayoutChanged();
1177
+ this.applyFloatingBounds(i, e, d), this.syncFloatingResizerValue(n, e, o), this.dispatchLayoutChanged();
1202
1178
  }
1203
1179
  beginFloatingResize(t, e, i, n, o) {
1204
1180
  const r = this.floatingLayouts[e];
1205
1181
  if (r) {
1206
1182
  t.preventDefault(), t.stopPropagation();
1207
1183
  try {
1208
- n.setPointerCapture(t.pointerId), n.dataset.resizing = "true";
1184
+ n.setPointerCapture(t.pointerId);
1209
1185
  } catch {
1210
1186
  }
1211
- this.promoteFloatingPane(e, i), r.bounds = R(r.bounds, this.getHostSize()), this.floatingResizeState = {
1187
+ n.dataset.resizing = "true", this.promoteFloatingPane(e, i), r.bounds = T(r.bounds, this.getHostSize()), this.floatingResizeState = {
1212
1188
  index: e,
1213
1189
  pointerId: t.pointerId,
1214
1190
  startX: t.clientX,
@@ -1229,7 +1205,7 @@ class L extends tt {
1229
1205
  return;
1230
1206
  const i = this.floatingLayouts[e.index];
1231
1207
  if (!i) return;
1232
- const n = t.clientX - e.startX, o = t.clientY - e.startY, r = R(
1208
+ const n = t.clientX - e.startX, o = t.clientY - e.startY, r = T(
1233
1209
  {
1234
1210
  left: e.startLeft + n,
1235
1211
  top: e.startTop + o,
@@ -1261,7 +1237,7 @@ class L extends tt {
1261
1237
  e.dropTarget && (delete e.dropTarget, this.hideDropIndicator());
1262
1238
  return;
1263
1239
  }
1264
- const n = S(i.dataset.path);
1240
+ const n = P(i.dataset.path);
1265
1241
  if (!n || n.type === "floating" && n.index === e.index) {
1266
1242
  e.dropTarget && (delete e.dropTarget, this.hideDropIndicator());
1267
1243
  return;
@@ -1274,7 +1250,7 @@ class L extends tt {
1274
1250
  const e = this.floatingResizeState;
1275
1251
  if (!e || t.pointerId !== e.pointerId)
1276
1252
  return;
1277
- const i = Z(
1253
+ const i = q(
1278
1254
  {
1279
1255
  left: e.startLeft,
1280
1256
  top: e.startTop,
@@ -1322,19 +1298,19 @@ class L extends tt {
1322
1298
  this.floatingLayouts.forEach((e, i) => {
1323
1299
  const n = this.floatingLayerEl.children[i];
1324
1300
  if (!n) return;
1325
- const { left: o, top: r, width: d, height: a } = R(e.bounds, t);
1326
- n.style.left = `${o}px`, n.style.top = `${r}px`, n.style.width = `${d}px`, n.style.height = `${a}px`, n.style.minWidth = "0", n.style.minHeight = "0";
1301
+ const { left: o, top: r, width: c, height: a } = T(e.bounds, t);
1302
+ n.style.left = `${o}px`, n.style.top = `${r}px`, n.style.width = `${c}px`, n.style.height = `${a}px`, n.style.minWidth = "0", n.style.minHeight = "0";
1327
1303
  });
1328
1304
  }
1329
1305
  promoteFloatingPane(t, e) {
1330
1306
  const i = this.floatingLayouts[t];
1331
1307
  if (!i)
1332
1308
  return;
1333
- const n = this.floatingLayouts.reduce((r, d, a) => {
1334
- if (!d)
1309
+ const n = this.floatingLayouts.reduce((r, c, a) => {
1310
+ if (!c)
1335
1311
  return r;
1336
- const c = a === t ? Number.NEGATIVE_INFINITY : H(this.floatingLayouts[a], a);
1337
- return Math.max(r, c);
1312
+ const l = a === t ? Number.NEGATIVE_INFINITY : H(this.floatingLayouts[a], a);
1313
+ return Math.max(r, l);
1338
1314
  }, 0), o = Math.max(n + 2, 12);
1339
1315
  i.zIndex = o, e.style.zIndex = String(o);
1340
1316
  }
@@ -1381,31 +1357,31 @@ class L extends tt {
1381
1357
  }
1382
1358
  renderSplit(t, e, i) {
1383
1359
  const n = this.documentRef.createElement("mp-splitter");
1384
- n.classList.add("dock-split"), n.dataset.direction = t.direction, n.dataset.path = e.join("/"), n.setAttribute("orientation", t.direction);
1360
+ n.classList.add("dock-split"), n.dataset.direction = t.direction, n.setAttribute("orientation", t.direction);
1385
1361
  const o = typeof i == "number" ? { type: "floating", index: i, segments: [...e] } : { type: "docked", segments: [...e] };
1386
- t.children.forEach((d, a) => {
1387
- n.appendChild(this.renderNode(d, [...e, a], i));
1362
+ n.dataset.path = w(o), t.children.forEach((c, a) => {
1363
+ n.appendChild(this.renderNode(c, [...e, a], i));
1388
1364
  });
1389
1365
  const r = Array.isArray(t.sizes) ? t.sizes : [];
1390
1366
  return r.length > 0 && requestAnimationFrame(() => {
1391
- const d = r.reduce((l, h) => l + Math.max(h, 0), 0);
1392
- if (d <= 0) return;
1367
+ const c = r.reduce((d, u) => d + Math.max(u, 0), 0);
1368
+ if (c <= 0) return;
1393
1369
  const a = t.direction === "horizontal" ? n.getBoundingClientRect().width : n.getBoundingClientRect().height;
1394
1370
  if (!Number.isFinite(a) || a <= 0) return;
1395
- const c = r.map((l) => Math.max(l, 0) / d * a);
1396
- n.setPanelSizes?.(c), requestAnimationFrame(() => this.scheduleRenderIntersectionHandles());
1397
- }), n.addEventListener("resize-end", (d) => {
1398
- if (d.target !== n) return;
1399
- const a = d.detail;
1371
+ const l = r.map((d) => Math.max(d, 0) / c * a);
1372
+ n.setPanelSizes?.(l), requestAnimationFrame(() => this.scheduleRenderIntersectionHandles());
1373
+ }), n.addEventListener("resize-end", (c) => {
1374
+ if (c.target !== n) return;
1375
+ const a = c.detail;
1400
1376
  if (!Array.isArray(a?.sizes) || a.sizes.length === 0) return;
1401
- const c = A(o, this.rootLayout, this.floatingLayouts);
1402
- if (!c) return;
1403
- const l = (c.sizes ?? []).reduce(
1404
- (f, p) => f + Math.max(p, 0),
1377
+ const l = A(o, this.rootLayout, this.floatingLayouts);
1378
+ if (!l) return;
1379
+ const d = (l.sizes ?? []).reduce(
1380
+ (g, p) => g + Math.max(p, 0),
1405
1381
  0
1406
- ), h = a.sizes.reduce((f, p) => f + Math.max(p, 0), 0), u = l > 0 ? l : a.sizes.length;
1407
- h > 0 && (c.sizes = a.sizes.map(
1408
- (f) => Math.max(f, 0) / h * u
1382
+ ), u = a.sizes.reduce((g, p) => g + Math.max(p, 0), 0), h = d > 0 ? d : a.sizes.length;
1383
+ u > 0 && (l.sizes = a.sizes.map(
1384
+ (g) => Math.max(g, 0) / u * h
1409
1385
  ), this.dispatchLayoutChanged());
1410
1386
  }), n;
1411
1387
  }
@@ -1416,28 +1392,26 @@ class L extends tt {
1416
1392
  n.dataset.path = w(o);
1417
1393
  const r = Array.from(new Set(t.panes));
1418
1394
  if (r.length === 0) {
1419
- const l = this.documentRef.createElement("span");
1420
- l.setAttribute("slot", "__empty__-header"), l.textContent = "(empty)";
1421
- const h = this.documentRef.createElement("div");
1422
- return h.setAttribute("slot", "__empty__-content"), h.classList.add("dock-stack__pane"), h.textContent = "No panes configured", n.append(l, h), n.setAttribute("active-tab", "__empty__"), n;
1395
+ const d = this.documentRef.createElement("span");
1396
+ d.setAttribute("slot", "__empty__-header"), d.textContent = "(empty)";
1397
+ const u = this.documentRef.createElement("div");
1398
+ return u.setAttribute("slot", "__empty__-content"), u.classList.add("dock-stack__pane"), u.textContent = "No panes configured", n.append(d, u), n.setAttribute("active-tab", "__empty__"), n;
1423
1399
  }
1424
- const d = r.includes(t.activePane ?? "") ? t.activePane : r[0], a = e.length ? e.join("-") : "root", c = typeof i == "number" ? `f${i}-${a}` : a;
1425
- return r.forEach((l) => {
1426
- const h = l.replace(/[^a-zA-Z0-9_-]/g, "-"), u = h.length > 0 ? h : "pane", f = `${this.instanceId}-tab-${c}-${u}`, p = `${this.instanceId}-panel-${c}-${u}`, m = this.documentRef.createElement("span");
1427
- m.setAttribute("slot", `${f}-header`), m.classList.add("dock-tab"), m.dataset.pane = l, m.dataset.tabId = f, m.textContent = this.titles[l] ?? l, m.addEventListener("pointerdown", (b) => {
1428
- this.captureTabDragMetrics(b, n), this.armPaneDragGesture(b, T(o), l, n), b.stopPropagation();
1400
+ const c = r.includes(t.activePane ?? "") ? t.activePane : r[0], a = e.length ? e.join("-") : "root", l = typeof i == "number" ? `f${i}-${a}` : a;
1401
+ return r.forEach((d) => {
1402
+ const u = d.replace(/[^a-zA-Z0-9_-]/g, "-"), h = u.length > 0 ? u : "pane", g = `${this.instanceId}-tab-${l}-${h}`, p = `${this.instanceId}-panel-${l}-${h}`, f = this.documentRef.createElement("span");
1403
+ f.setAttribute("slot", `${g}-header`), f.classList.add("dock-tab"), f.dataset.pane = d, f.dataset.tabId = g, f.textContent = this.titles[d] ?? d, f.addEventListener("pointerdown", (b) => {
1404
+ this.captureTabDragMetrics(b, n), this.armPaneDragGesture(b, R(o), d, n), b.stopPropagation();
1429
1405
  });
1430
- const g = this.documentRef.createElement("div");
1431
- g.setAttribute("slot", `${f}-content`), g.classList.add("dock-stack__pane"), g.dataset.pane = l, g.dataset.tabId = f, g.id = p;
1406
+ const m = this.documentRef.createElement("div");
1407
+ m.setAttribute("slot", `${g}-content`), m.classList.add("dock-stack__pane"), m.dataset.pane = d, m.dataset.tabId = g, m.id = p;
1432
1408
  const y = this.documentRef.createElement("slot");
1433
- y.name = l, g.appendChild(y), n.append(m, g), l === d && n.setAttribute("active-tab", f);
1434
- }), n.dataset.activePane = d, n.addEventListener("tab-activate", (l) => {
1435
- const h = l.detail, f = n.querySelector(
1436
- `:scope > [data-tab-id="${h.tabId}"]`
1437
- )?.dataset.pane;
1438
- f && (this.activatePane(n, f, T(o)), this.dispatchEvent(
1409
+ y.name = d, m.appendChild(y), n.append(f, m), d === c && n.setAttribute("active-tab", g);
1410
+ }), n.dataset.activePane = c, n.addEventListener("tab-activate", (d) => {
1411
+ const u = d.detail, g = this.stackChildren(n).find((p) => p.dataset.tabId === u.tabId)?.dataset.pane;
1412
+ g && (this.activatePane(n, g, R(o)), this.dispatchEvent(
1439
1413
  new CustomEvent("dock-pane-activated", {
1440
- detail: { pane: f },
1414
+ detail: { pane: g },
1441
1415
  bubbles: !0,
1442
1416
  composed: !0
1443
1417
  })
@@ -1486,13 +1460,13 @@ class L extends tt {
1486
1460
  );
1487
1461
  }
1488
1462
  /**
1489
- * Locate the rendered `<mp-splitter>` element for a given DockPath
1490
- * `segments` value (the split-tree path). Searches the dock's shadow.
1463
+ * Locate the rendered `<mp-splitter>` for a split path — layer included,
1464
+ * so a floating window's splitter never answers for a docked one.
1491
1465
  */
1492
1466
  findSplitterByPath(t) {
1493
- return this.shadowRoot?.querySelector(
1494
- `.dock-split[data-path="${t.join("/")}"]`
1495
- ) ?? null;
1467
+ return t ? this.shadowRoot?.querySelector(
1468
+ `.dock-split[data-path="${w(t)}"]`
1469
+ ) ?? null : null;
1496
1470
  }
1497
1471
  onPointerMove(t) {
1498
1472
  this.cornerResizeState && t.pointerId === this.cornerResizeState.pointerId && this.handleCornerResizeMove(t), this.floatingResizeState && t.pointerId === this.floatingResizeState.pointerId && this.handleFloatingResizeMove(t), this.floatingDragState && t.pointerId === this.floatingDragState.pointerId && this.handleFloatingDragMove(t);
@@ -1520,14 +1494,14 @@ class L extends tt {
1520
1494
  this.pendingTabDragMetrics = null;
1521
1495
  return;
1522
1496
  }
1523
- const i = this.getBoundingClientRect(), n = e.getBoundingClientRect(), o = t.clientX - n.left, r = t.clientY - n.top, d = n.left - i.left, a = n.top - i.top, c = Number.isFinite(n.width) ? n.width : 0, l = Number.isFinite(n.height) ? n.height : 0;
1497
+ const i = this.getBoundingClientRect(), n = e.getBoundingClientRect(), o = t.clientX - n.left, r = t.clientY - n.top, c = n.left - i.left, a = n.top - i.top, l = Number.isFinite(n.width) ? n.width : 0, d = Number.isFinite(n.height) ? n.height : 0;
1524
1498
  this.pendingTabDragMetrics = {
1525
1499
  pointerOffsetX: o,
1526
1500
  pointerOffsetY: r,
1527
- left: d,
1501
+ left: c,
1528
1502
  top: a,
1529
- width: c,
1530
- height: l,
1503
+ width: l,
1504
+ height: d,
1531
1505
  startClientX: t.clientX,
1532
1506
  startClientY: t.clientY
1533
1507
  };
@@ -1551,18 +1525,18 @@ class L extends tt {
1551
1525
  if (t.pointerType === "mouse" && t.button !== 0) return;
1552
1526
  const o = this.windowRef;
1553
1527
  if (!o) return;
1554
- const r = t.clientX, d = t.clientY, a = t.pointerId, c = 5;
1555
- let l = !1;
1556
- const h = () => {
1557
- l = !0, o.removeEventListener("pointermove", u, !0), o.removeEventListener("pointerup", f, !0), o.removeEventListener("pointercancel", f, !0);
1558
- }, u = (p) => {
1559
- if (l || p.pointerId !== a) return;
1560
- const m = p.clientX - r, g = p.clientY - d;
1561
- Math.hypot(m, g) < c || (h(), this.beginPaneDrag(p, e, i, n));
1562
- }, f = (p) => {
1563
- l || p.pointerId !== a || (h(), this.clearPendingTabDragMetrics());
1528
+ const r = t.clientX, c = t.clientY, a = t.pointerId, l = 5;
1529
+ let d = !1;
1530
+ const u = () => {
1531
+ d = !0, o.removeEventListener("pointermove", h, !0), o.removeEventListener("pointerup", g, !0), o.removeEventListener("pointercancel", g, !0);
1532
+ }, h = (p) => {
1533
+ if (d || p.pointerId !== a) return;
1534
+ const f = p.clientX - r, m = p.clientY - c;
1535
+ Math.hypot(f, m) < l || (u(), this.beginPaneDrag(p, e, i, n));
1536
+ }, g = (p) => {
1537
+ d || p.pointerId !== a || (u(), this.clearPendingTabDragMetrics());
1564
1538
  };
1565
- o.addEventListener("pointermove", u, !0), o.addEventListener("pointerup", f, !0), o.addEventListener("pointercancel", f, !0);
1539
+ o.addEventListener("pointermove", h, !0), o.addEventListener("pointerup", g, !0), o.addEventListener("pointercancel", g, !0);
1566
1540
  }
1567
1541
  /**
1568
1542
  * Touch-specific gesture arming. With `.dock-tab` set to `touch-action:
@@ -1588,35 +1562,35 @@ class L extends tt {
1588
1562
  armPaneDragGestureTouch(t, e, i, n) {
1589
1563
  const o = this.windowRef;
1590
1564
  if (!o) return;
1591
- const r = t.clientX, d = t.clientY, a = t.pointerId;
1592
- let c = r, l = d, h = r, u = !1, f = !1, p = !1;
1593
- const m = t.currentTarget instanceof HTMLElement ? t.currentTarget : t.target instanceof HTMLElement ? t.target.closest(".dock-tab") : null, g = n ? this.getStackStripEl(n)?.querySelector(
1565
+ const r = t.clientX, c = t.clientY, a = t.pointerId;
1566
+ let l = r, d = c, u = r, h = !1, g = !1, p = !1;
1567
+ const f = t.currentTarget instanceof HTMLElement ? t.currentTarget : t.target instanceof HTMLElement ? t.target.closest(".dock-tab") : null, m = n ? this.getStackStripEl(n)?.querySelector(
1594
1568
  "ul.nav.nav-tabs"
1595
1569
  ) ?? null : null, y = () => {
1596
- u || (u = !0, o.clearTimeout(P), o.clearTimeout(z), o.removeEventListener("pointermove", b, !0), o.removeEventListener("pointerup", k, !0), o.removeEventListener("pointercancel", D, !0), p && m && m.removeAttribute("data-pressing"));
1570
+ h || (h = !0, o.clearTimeout(S), o.clearTimeout(L), o.removeEventListener("pointermove", b, !0), o.removeEventListener("pointerup", k, !0), o.removeEventListener("pointercancel", D, !0), p && f && f.removeAttribute("data-pressing"));
1597
1571
  }, b = (v) => {
1598
- if (u || v.pointerId !== a) return;
1599
- if (f) {
1600
- const G = v.clientX - h;
1601
- h = v.clientX, g && (g.scrollLeft -= G);
1572
+ if (h || v.pointerId !== a) return;
1573
+ if (g) {
1574
+ const Q = v.clientX - u;
1575
+ u = v.clientX, m && (m.scrollLeft -= Q);
1602
1576
  return;
1603
1577
  }
1604
- c = v.clientX, l = v.clientY;
1605
- const O = v.clientX - r, Y = v.clientY - d;
1606
- if (Math.hypot(O, Y) <= L.TOUCH_LONG_PRESS_SLOP_PX)
1578
+ l = v.clientX, d = v.clientY;
1579
+ const O = v.clientX - r, Y = v.clientY - c;
1580
+ if (Math.hypot(O, Y) <= z.TOUCH_LONG_PRESS_SLOP_PX)
1607
1581
  return;
1608
- const V = !!g && g.scrollWidth > g.clientWidth;
1582
+ const V = !!m && m.scrollWidth > m.clientWidth;
1609
1583
  if (Math.abs(O) > Math.abs(Y) && V) {
1610
- o.clearTimeout(P), o.clearTimeout(z), p && m && (m.removeAttribute("data-pressing"), p = !1), f = !0, h = v.clientX, g.scrollLeft -= O, this.clearPendingTabDragMetrics();
1584
+ o.clearTimeout(S), o.clearTimeout(L), p && f && (f.removeAttribute("data-pressing"), p = !1), g = !0, u = v.clientX, m.scrollLeft -= O, this.clearPendingTabDragMetrics();
1611
1585
  return;
1612
1586
  }
1613
1587
  y(), this.clearPendingTabDragMetrics();
1614
1588
  }, k = (v) => {
1615
- u || v.pointerId !== a || (y(), this.clearPendingTabDragMetrics());
1589
+ h || v.pointerId !== a || (y(), this.clearPendingTabDragMetrics());
1616
1590
  }, D = (v) => {
1617
- u || v.pointerId !== a || (y(), this.clearPendingTabDragMetrics());
1618
- }, P = o.setTimeout(() => {
1619
- if (u) return;
1591
+ h || v.pointerId !== a || (y(), this.clearPendingTabDragMetrics());
1592
+ }, S = o.setTimeout(() => {
1593
+ if (h) return;
1620
1594
  y();
1621
1595
  try {
1622
1596
  this.setPointerCapture(a);
@@ -1631,47 +1605,47 @@ class L extends tt {
1631
1605
  pointerId: a,
1632
1606
  pointerType: "touch",
1633
1607
  isPrimary: !0,
1634
- clientX: c,
1635
- clientY: l,
1608
+ clientX: l,
1609
+ clientY: d,
1636
1610
  bubbles: !1,
1637
1611
  cancelable: !1
1638
1612
  });
1639
1613
  this.beginPaneDrag(v, e, i, n);
1640
- }, L.TOUCH_LONG_PRESS_MS), z = o.setTimeout(() => {
1641
- u || !m || (p = !0, m.setAttribute("data-pressing", "true"));
1642
- }, L.TOUCH_PRESS_FEEDBACK_DELAY_MS);
1614
+ }, z.TOUCH_LONG_PRESS_MS), L = o.setTimeout(() => {
1615
+ h || !f || (p = !0, f.setAttribute("data-pressing", "true"));
1616
+ }, z.TOUCH_PRESS_FEEDBACK_DELAY_MS);
1643
1617
  o.addEventListener("pointermove", b, !0), o.addEventListener("pointerup", k, !0), o.addEventListener("pointercancel", D, !0);
1644
1618
  }
1645
1619
  beginPaneDrag(t, e, i, n) {
1646
1620
  const {
1647
1621
  path: o,
1648
1622
  floatingIndex: r,
1649
- pointerOffsetX: d,
1623
+ pointerOffsetX: c,
1650
1624
  pointerOffsetY: a
1651
- } = this.preparePaneDragSource(e, i, n, t), c = n ? this.getStackStripEl(n) : null, l = c ? c.getBoundingClientRect() : null, h = l ? { left: l.left, top: l.top, right: l.right, bottom: l.bottom } : null, u = this.pendingTabDragMetrics;
1625
+ } = this.preparePaneDragSource(e, i, n, t), l = n ? this.getStackStripEl(n) : null, d = l ? l.getBoundingClientRect() : null, u = d ? { left: d.left, top: d.top, right: d.right, bottom: d.bottom } : null, h = this.pendingTabDragMetrics;
1652
1626
  if (this.dragState = {
1653
1627
  pane: i,
1654
- sourcePath: T(o),
1628
+ sourcePath: R(o),
1655
1629
  floatingIndex: r,
1656
- pointerOffsetX: d,
1630
+ pointerOffsetX: c,
1657
1631
  pointerOffsetY: a,
1658
1632
  dropHandled: !1,
1659
1633
  sourceStackEl: n,
1660
- sourceHeaderBounds: h,
1661
- startClientX: u && Number.isFinite(u.startClientX) ? u.startClientX : t.clientX,
1662
- startClientY: u && Number.isFinite(u.startClientY) ? u.startClientY : t.clientY
1634
+ sourceHeaderBounds: u,
1635
+ startClientX: h && Number.isFinite(h.startClientX) ? h.startClientX : t.clientX,
1636
+ startClientY: h && Number.isFinite(h.startClientY) ? h.startClientY : t.clientY
1663
1637
  }, this.lastDragPointerPosition = {
1664
1638
  x: this.dragState.startClientX,
1665
1639
  y: this.dragState.startClientY
1666
1640
  }, this.updateDraggedFloatingPositionFromPoint(t.clientX, t.clientY), this.startDragPointerTracking(), this.markDraggedFloatingWrapper(), this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0) {
1667
- const f = this.resolveStackLocation(this.dragState.sourcePath);
1668
- if (f && Array.isArray(f.node.panes) && f.node.panes.length === 1) {
1641
+ const g = this.resolveStackLocation(this.dragState.sourcePath);
1642
+ if (g && Array.isArray(g.node.panes) && g.node.panes.length === 1) {
1669
1643
  let p = !1;
1670
- if (f.context === "docked")
1644
+ if (g.context === "docked")
1671
1645
  p = !0;
1672
- else if (f.context === "floating") {
1673
- const m = this.floatingLayouts[f.index];
1674
- p = (m && m.root ? J(m.root) : 0) > 1;
1646
+ else if (g.context === "floating") {
1647
+ const f = this.floatingLayouts[g.index];
1648
+ p = (f && f.root ? J(f.root) : 0) > 1;
1675
1649
  }
1676
1650
  p && this.convertPendingTabDragToFloating(t.clientX, t.clientY);
1677
1651
  }
@@ -1686,19 +1660,19 @@ class L extends tt {
1686
1660
  pointerOffsetX: 0,
1687
1661
  pointerOffsetY: 0
1688
1662
  };
1689
- const r = this.pendingTabDragMetrics, d = !!i && Array.from(i.querySelectorAll(".dock-tab")).some(
1663
+ const r = this.pendingTabDragMetrics, c = !!i && Array.from(i.querySelectorAll(".dock-tab")).some(
1690
1664
  (p) => p.dataset.pane && p.dataset.pane !== e
1691
- ), a = o.node.panes.some((p) => p !== e), c = o.context === "floating" ? this.floatingLayouts[o.index] : null, l = c && c.root ? J(c.root) : a ? 2 : 1;
1692
- if (o.context === "floating" && !!c && !a && !d && l <= 1) {
1693
- if (c) {
1694
- c.activePane = e, this.updateFloatingWindowTitle(o.index);
1665
+ ), a = o.node.panes.some((p) => p !== e), l = o.context === "floating" ? this.floatingLayouts[o.index] : null, d = l && l.root ? J(l.root) : a ? 2 : 1;
1666
+ if (o.context === "floating" && !!l && !a && !c && d <= 1) {
1667
+ if (l) {
1668
+ l.activePane = e, this.updateFloatingWindowTitle(o.index);
1695
1669
  const p = this.getFloatingWrapper(o.index);
1696
1670
  p && this.promoteFloatingPane(o.index, p);
1697
- const m = this.getBoundingClientRect(), g = r && Number.isFinite(r.pointerOffsetX) && Number.isFinite(r.left) && Number.isFinite(c.bounds.left) ? r.pointerOffsetX + (r.left - c.bounds.left) : Number.isFinite(n.clientX) && Number.isFinite(c.bounds.left) ? n.clientX - m.left - c.bounds.left : c.bounds.width / 2, y = r && Number.isFinite(r.pointerOffsetY) && Number.isFinite(r.top) && Number.isFinite(c.bounds.top) ? r.pointerOffsetY + (r.top - c.bounds.top) : Number.isFinite(n.clientY) && Number.isFinite(c.bounds.top) ? n.clientY - m.top - c.bounds.top : c.bounds.height / 2;
1671
+ const f = this.getBoundingClientRect(), m = r && Number.isFinite(r.pointerOffsetX) && Number.isFinite(r.left) && Number.isFinite(l.bounds.left) ? r.pointerOffsetX + (r.left - l.bounds.left) : Number.isFinite(n.clientX) && Number.isFinite(l.bounds.left) ? n.clientX - f.left - l.bounds.left : l.bounds.width / 2, y = r && Number.isFinite(r.pointerOffsetY) && Number.isFinite(r.top) && Number.isFinite(l.bounds.top) ? r.pointerOffsetY + (r.top - l.bounds.top) : Number.isFinite(n.clientY) && Number.isFinite(l.bounds.top) ? n.clientY - f.top - l.bounds.top : l.bounds.height / 2;
1698
1672
  return {
1699
1673
  path: t,
1700
1674
  floatingIndex: o.index,
1701
- pointerOffsetX: g,
1675
+ pointerOffsetX: m,
1702
1676
  pointerOffsetY: y
1703
1677
  };
1704
1678
  }
@@ -1709,12 +1683,12 @@ class L extends tt {
1709
1683
  pointerOffsetY: 0
1710
1684
  };
1711
1685
  }
1712
- const u = r && Number.isFinite(r.pointerOffsetX) ? r.pointerOffsetX : 0, f = r && Number.isFinite(r.pointerOffsetY) ? r.pointerOffsetY : 0;
1686
+ const h = r && Number.isFinite(r.pointerOffsetX) ? r.pointerOffsetX : 0, g = r && Number.isFinite(r.pointerOffsetY) ? r.pointerOffsetY : 0;
1713
1687
  return {
1714
1688
  path: t,
1715
1689
  floatingIndex: -1,
1716
- pointerOffsetX: u,
1717
- pointerOffsetY: f
1690
+ pointerOffsetX: h,
1691
+ pointerOffsetY: g
1718
1692
  };
1719
1693
  }
1720
1694
  endPaneDrag() {
@@ -1726,10 +1700,10 @@ class L extends tt {
1726
1700
  if (!this.dragState || !Number.isFinite(t) || !Number.isFinite(e))
1727
1701
  return;
1728
1702
  if (this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0) {
1729
- const h = this.dragState.sourceHeaderBounds, u = this.dragState.startClientX ?? t, f = this.dragState.startClientY ?? e, p = Math.hypot(t - u, e - f), m = 8;
1730
- let g = !0;
1731
- const y = h ? j(h, t, e) : !0, b = this.isPointerOverSourceHeader(t, e);
1732
- g = y || b, !g && p > m && this.convertPendingTabDragToFloating(t, e);
1703
+ const u = this.dragState.sourceHeaderBounds, h = this.dragState.startClientX ?? t, g = this.dragState.startClientY ?? e, p = Math.hypot(t - h, e - g), f = 8;
1704
+ let m = !0;
1705
+ const y = u ? j(u, t, e) : !0, b = this.isPointerOverSourceHeader(t, e);
1706
+ m = y || b, !m && p > f && this.convertPendingTabDragToFloating(t, e);
1733
1707
  }
1734
1708
  this.updatePaneDragDropTargetFromPoint(t, e);
1735
1709
  const { floatingIndex: i, pointerOffsetX: n, pointerOffsetY: o } = this.dragState;
@@ -1738,25 +1712,25 @@ class L extends tt {
1738
1712
  const r = this.floatingLayouts[i];
1739
1713
  if (!r)
1740
1714
  return;
1741
- const d = this.getBoundingClientRect(), a = t - d.left - n, c = e - d.top - o;
1742
- r.bounds.left = a, r.bounds.top = c;
1743
- const l = this.getFloatingWrapper(i);
1744
- l && (l.style.left = `${a}px`, l.style.top = `${c}px`);
1715
+ const c = this.getBoundingClientRect(), a = t - c.left - n, l = e - c.top - o;
1716
+ r.bounds.left = a, r.bounds.top = l;
1717
+ const d = this.getFloatingWrapper(i);
1718
+ d && (d.style.left = `${a}px`, d.style.top = `${l}px`);
1745
1719
  }
1746
1720
  updatePaneDragDropTargetFromPoint(t, e) {
1747
1721
  if (!this.dragState)
1748
1722
  return;
1749
- const i = this.findStackAtPoint(t, e), n = i ? S(i.dataset.path) : null;
1723
+ const i = this.findStackAtPoint(t, e), n = i ? P(i.dataset.path) : null;
1750
1724
  if (!i || !n) {
1751
1725
  this.dropJoystick.dataset.visible !== "true" && this.hideDropIndicator(), this.clearHeaderDragPlaceholder();
1752
1726
  return;
1753
1727
  }
1754
1728
  if (this.dropJoystickTarget && this.dropJoystickTarget !== i && (delete this.dropJoystick.dataset.zone, this.updateDropJoystickActiveZone(null)), this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && n && B(n, this.dragState.sourcePath)) {
1755
- const d = !!this.dragState.sourceHeaderBounds && j(this.dragState.sourceHeaderBounds, t, e), a = this.isPointerOverSourceHeader(t, e);
1756
- if (d || a) {
1729
+ const c = !!this.dragState.sourceHeaderBounds && j(this.dragState.sourceHeaderBounds, t, e), a = this.isPointerOverSourceHeader(t, e);
1730
+ if (c || a) {
1757
1731
  this.ensureHeaderDragPlaceholder(i, this.dragState.pane);
1758
- const c = this.computeHeaderInsertIndex(i, t);
1759
- this.dragState.liveReorderIndex !== c && (this.updateHeaderDragPlaceholderPosition(i, c), this.dragState.liveReorderIndex = c), this.hideDropIndicator();
1732
+ const l = this.computeHeaderInsertIndex(i, t);
1733
+ this.dragState.liveReorderIndex !== l && (this.updateHeaderDragPlaceholderPosition(i, l), this.dragState.liveReorderIndex = l), this.hideDropIndicator();
1760
1734
  return;
1761
1735
  }
1762
1736
  }
@@ -1786,21 +1760,41 @@ class L extends tt {
1786
1760
  ensureHeaderDragPlaceholder(t, e) {
1787
1761
  if (t.tagName !== "MP-TAB-CONTROL" || this.dragState?.placeholderHeader === t && this.dragState.placeholderEl)
1788
1762
  return;
1789
- const i = t.querySelector(
1790
- `:scope > .dock-tab[data-pane="${CSS.escape(e)}"]`
1791
- ), n = t.querySelector(
1792
- `:scope > .dock-stack__pane[data-pane="${CSS.escape(e)}"]`
1793
- );
1763
+ const i = this.stackChildForPane(t, "dock-tab", e), n = this.stackChildForPane(t, "dock-stack__pane", e);
1794
1764
  if (!i || !n) return;
1795
- const o = this.windowRef ? this.windowRef.getComputedStyle(i) : globalThis.getComputedStyle(i), r = parseFloat(o.paddingLeft) + parseFloat(o.paddingRight), d = Math.max(
1765
+ const o = this.windowRef ? this.windowRef.getComputedStyle(i) : globalThis.getComputedStyle(i), r = parseFloat(o.paddingLeft) + parseFloat(o.paddingRight), c = Math.max(
1796
1766
  0,
1797
1767
  i.offsetWidth - r
1798
1768
  );
1799
1769
  n.setAttribute("data-hidden", "");
1800
- const a = "__dock-placeholder__", c = this.documentRef.createElement("span");
1801
- c.setAttribute("slot", `${a}-header`), c.classList.add("dock-tab"), c.dataset.placeholder = "true", c.dataset.tabId = a, c.setAttribute("aria-hidden", "true"), c.textContent = i.textContent, c.style.display = "inline-block", c.style.minWidth = `${d}px`, c.style.opacity = "0.5";
1802
- const l = this.documentRef.createElement("div");
1803
- l.setAttribute("slot", `${a}-content`), l.classList.add("dock-stack__pane"), l.dataset.placeholder = "true", t.insertBefore(c, i), t.insertBefore(l, n), this.dragState && (this.dragState.placeholderHeader = t, this.dragState.placeholderEl = c);
1770
+ const a = "__dock-placeholder__", l = this.documentRef.createElement("span");
1771
+ l.setAttribute("slot", `${a}-header`), l.classList.add("dock-tab"), l.dataset.placeholder = "true", l.dataset.tabId = a, l.setAttribute("aria-hidden", "true"), l.textContent = i.textContent, l.style.display = "inline-block", l.style.minWidth = `${c}px`, l.style.opacity = "0.5";
1772
+ const d = this.documentRef.createElement("div");
1773
+ d.setAttribute("slot", `${a}-content`), d.classList.add("dock-stack__pane"), d.dataset.placeholder = "true", t.insertBefore(l, i), t.insertBefore(d, n), this.dragState && (this.dragState.placeholderHeader = t, this.dragState.placeholderEl = l);
1774
+ }
1775
+ /**
1776
+ * The slotted children of a stack — the header spans, pane hosts and drag
1777
+ * placeholders the dock owns. Every lookup among them walks this list and
1778
+ * matches on the dataset instead of building a `:scope > [data-…="…"]`
1779
+ * selector: an arbitrary pane name then never has to survive CSS escaping,
1780
+ * and nothing depends on `CSS.escape` or `:scope`, neither of which every
1781
+ * DOM implementation provides (jsdom has no `CSS.escape`, and matches
1782
+ * nothing for `:scope >` here). Same reasoning as verifyProjectionSlots.
1783
+ */
1784
+ stackChildren(t) {
1785
+ return Array.from(t.children).filter((e) => e instanceof HTMLElement);
1786
+ }
1787
+ /** The direct child of `stack` carrying `className` for `pane`. */
1788
+ stackChildForPane(t, e, i) {
1789
+ return this.stackChildren(t).find(
1790
+ (n) => n.classList.contains(e) && n.dataset.pane === i
1791
+ ) ?? null;
1792
+ }
1793
+ /** The drag placeholder of `className` (header span or pane host) in `stack`. */
1794
+ stackPlaceholder(t, e) {
1795
+ return this.stackChildren(t).find(
1796
+ (i) => i.classList.contains(e) && i.dataset.placeholder === "true"
1797
+ ) ?? null;
1804
1798
  }
1805
1799
  // Move the placeholder to the computed target index within the strip.
1806
1800
  // We reorder light-DOM children (header span + matching content div); the
@@ -1809,25 +1803,17 @@ class L extends tt {
1809
1803
  if (t.tagName !== "MP-TAB-CONTROL") return;
1810
1804
  const i = this.dragState?.placeholderEl ?? null;
1811
1805
  if (!i) return;
1812
- const n = this.dragState?.pane ?? null, o = Array.from(
1813
- t.querySelectorAll(":scope > .dock-tab")
1814
- ).filter(
1815
- (c) => c !== i && (!n || c.dataset.pane !== n)
1816
- ), r = Math.max(0, Math.min(e, o.length)), d = o[r] ?? null;
1817
- t.insertBefore(i, d);
1818
- const a = t.querySelector(
1819
- ':scope > .dock-stack__pane[data-placeholder="true"]'
1820
- );
1806
+ const n = this.dragState?.pane ?? null, o = this.stackChildren(t).filter(
1807
+ (l) => l.classList.contains("dock-tab") && l !== i && (!n || l.dataset.pane !== n)
1808
+ ), r = Math.max(0, Math.min(e, o.length)), c = o[r] ?? null;
1809
+ t.insertBefore(i, c);
1810
+ const a = this.stackPlaceholder(t, "dock-stack__pane");
1821
1811
  a && i.nextElementSibling !== a && t.insertBefore(a, i.nextElementSibling);
1822
1812
  }
1823
1813
  // Remove placeholder and restore the dragged tab's visibility.
1824
1814
  clearHeaderDragPlaceholder() {
1825
1815
  const t = this.dragState?.placeholderEl ?? null, e = this.dragState?.placeholderHeader ?? null;
1826
- e && (this.dragState?.pane && e.querySelector(
1827
- `:scope > .dock-stack__pane[data-pane="${CSS.escape(this.dragState.pane)}"]`
1828
- )?.removeAttribute("data-hidden"), e.querySelector(
1829
- ':scope > .dock-stack__pane[data-placeholder="true"]'
1830
- )?.remove()), t && t.parentElement && t.parentElement.removeChild(t), this.dragState && (this.dragState.placeholderEl = null, this.dragState.placeholderHeader = null);
1816
+ e && (this.dragState?.pane && this.stackChildForPane(e, "dock-stack__pane", this.dragState.pane)?.removeAttribute("data-hidden"), this.stackPlaceholder(e, "dock-stack__pane")?.remove()), t && t.parentElement && t.parentElement.removeChild(t), this.dragState && (this.dragState.placeholderEl = null, this.dragState.placeholderHeader = null);
1831
1817
  }
1832
1818
  startDragPointerTracking() {
1833
1819
  if (this.dragPointerTrackingActive)
@@ -1870,12 +1856,12 @@ class L extends tt {
1870
1856
  const n = this.resolveStackLocation(i.sourcePath);
1871
1857
  if (!n)
1872
1858
  return;
1873
- const o = i.pane, r = i.sourceStackEl ?? null, d = this.getBoundingClientRect(), a = r?.getBoundingClientRect() ?? null, c = this.pendingTabDragMetrics, l = 320, h = 240, u = c && Number.isFinite(c.width) && c.width > 0 ? c.width : a && Number.isFinite(a.width) ? a.width : l, f = c && Number.isFinite(c.height) && c.height > 0 ? c.height : a && Number.isFinite(a.height) ? a.height : h, p = 1, m = c && Number.isFinite(c.left) ? c.left - p : Number.isFinite(t) ? t - d.left - u / 2 : 0, g = c && Number.isFinite(c.top) ? c.top - p : Number.isFinite(e) ? e - d.top - f / 2 : 0, y = R(
1874
- { left: m, top: g, width: u, height: f },
1859
+ const o = i.pane, r = i.sourceStackEl ?? null, c = this.getBoundingClientRect(), a = r?.getBoundingClientRect() ?? null, l = this.pendingTabDragMetrics, d = 320, u = 240, h = l && Number.isFinite(l.width) && l.width > 0 ? l.width : a && Number.isFinite(a.width) ? a.width : d, g = l && Number.isFinite(l.height) && l.height > 0 ? l.height : a && Number.isFinite(a.height) ? a.height : u, p = 1, f = l && Number.isFinite(l.left) ? l.left - p : Number.isFinite(t) ? t - c.left - h / 2 : 0, m = l && Number.isFinite(l.top) ? l.top - p : Number.isFinite(e) ? e - c.top - g / 2 : 0, y = T(
1860
+ { left: f, top: m, width: h, height: g },
1875
1861
  this.getHostSize()
1876
- ), b = Number.isFinite(t) ? t - d.left - y.left : y.width / 2, k = Number.isFinite(e) ? e - d.top - y.top : y.height / 2;
1862
+ ), b = Number.isFinite(t) ? t - c.left - y.left : y.width / 2, k = Number.isFinite(e) ? e - c.top - y.top : y.height / 2;
1877
1863
  this.removePaneFromLocation(n, o);
1878
- const P = {
1864
+ const S = {
1879
1865
  bounds: y,
1880
1866
  root: {
1881
1867
  kind: "stack",
@@ -1884,11 +1870,11 @@ class L extends tt {
1884
1870
  },
1885
1871
  activePane: o
1886
1872
  };
1887
- this.floatingLayouts.push(P);
1888
- const z = this.floatingLayouts.length - 1;
1873
+ this.floatingLayouts.push(S);
1874
+ const L = this.floatingLayouts.length - 1;
1889
1875
  this.renderLayout();
1890
- const v = this.getFloatingWrapper(z);
1891
- v && this.promoteFloatingPane(z, v), this.liveAnnouncer.announce(`Pane ${this.titles[o] ?? o} torn off into a floating window.`), i.sourcePath = { type: "floating", index: z, segments: [] }, i.floatingIndex = z, i.pointerOffsetX = b, i.pointerOffsetY = k, this.markDraggedFloatingWrapper(), this.dispatchLayoutChanged();
1876
+ const v = this.getFloatingWrapper(L);
1877
+ v && this.promoteFloatingPane(L, v), this.liveAnnouncer.announce(`Pane ${this.titles[o] ?? o} torn off into a floating window.`), i.sourcePath = { type: "floating", index: L, segments: [] }, i.floatingIndex = L, i.pointerOffsetX = b, i.pointerOffsetY = k, this.markDraggedFloatingWrapper(), this.dispatchLayoutChanged();
1892
1878
  }
1893
1879
  // Toggle data-dragging on the floating wrapper currently associated with
1894
1880
  // the active pane drag (dragState.floatingIndex), if any. Used to make the
@@ -1915,27 +1901,16 @@ class L extends tt {
1915
1901
  const i = this.getStackTabButtons(t);
1916
1902
  if (i.length === 0)
1917
1903
  return 0;
1918
- const o = t.querySelector(
1919
- ':scope > .dock-tab[data-placeholder="true"]'
1920
- )?.dataset.tabId, r = o ? i.find((m) => m.id === `${o}-header-button`) ?? null : null, d = this.dragState?.pane ?? null;
1921
- let a = null;
1922
- if (d) {
1923
- for (const m of Array.from(t.children))
1924
- if (m instanceof HTMLElement && m.classList.contains("dock-tab") && !m.hasAttribute("data-placeholder") && m.dataset.pane === d) {
1925
- a = m.dataset.tabId ?? null;
1926
- break;
1927
- }
1928
- }
1929
- const c = a ? i.find((m) => m.id === `${a}-header-button`) ?? null : null, l = i.filter(
1930
- (m) => m !== r && m !== c
1904
+ const o = this.stackPlaceholder(t, "dock-tab")?.dataset.tabId, r = o ? i.find((f) => f.id === `${o}-header-button`) ?? null : null, c = this.dragState?.pane ?? null, a = c ? this.stackChildForPane(t, "dock-tab", c)?.dataset.tabId ?? null : null, l = a ? i.find((f) => f.id === `${a}-header-button`) ?? null : null, d = i.filter(
1905
+ (f) => f !== r && f !== l
1931
1906
  );
1932
- if (l.length === 0)
1907
+ if (d.length === 0)
1933
1908
  return 0;
1934
- const h = r ? r.getBoundingClientRect() : null, f = !!h && Number.isFinite(h.width) && h.width > 0 && h ? h.left + h.width / 2 : null, p = l.map((m) => {
1935
- const g = m.getBoundingClientRect();
1936
- return g.left + g.width / 2;
1909
+ const u = r ? r.getBoundingClientRect() : null, g = !!u && Number.isFinite(u.width) && u.width > 0 && u ? u.left + u.width / 2 : null, p = d.map((f) => {
1910
+ const m = f.getBoundingClientRect();
1911
+ return m.left + m.width / 2;
1937
1912
  });
1938
- return yt(p, e, f);
1913
+ return kt(p, e, g);
1939
1914
  }
1940
1915
  reorderPaneInLocationAtIndex(t, e, i) {
1941
1916
  const n = t.node.panes, o = n.indexOf(e);
@@ -1943,24 +1918,24 @@ class L extends tt {
1943
1918
  return;
1944
1919
  const r = Math.max(0, Math.min(i, n.length - 1));
1945
1920
  if (r !== o && (n.splice(o, 1), n.splice(r, 0, e), t.node.activePane = e, t.context === "floating")) {
1946
- const d = this.floatingLayouts[t.index];
1947
- d && (d.activePane = e);
1921
+ const c = this.floatingLayouts[t.index];
1922
+ c && (c.activePane = e);
1948
1923
  }
1949
1924
  }
1950
1925
  // Commit a drop using current pointer coordinates and joystick state
1951
1926
  finalizeDropFromPoint(t, e) {
1952
1927
  if (!this.dragState)
1953
1928
  return;
1954
- const i = this.findStackAtPoint(t, e), n = i ? S(i.dataset.path) : null, o = this.dropJoystick.dataset.visible === "true", r = S(this.dropJoystick.dataset.path), d = this.dropJoystickTarget, a = d ? S(d.dataset.path) : null, c = (o ? r ?? a : null) ?? n, l = this.dropJoystick.dataset.zone, h = this.isDropZone(l) ? l : i ? this.computeDropZone(i, { clientX: t, clientY: e }, null) : null;
1955
- if (this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && i && c && n && B(n, this.dragState.sourcePath) && (!h || h === "center")) {
1956
- const u = this.resolveStackLocation(c);
1957
- if (u) {
1958
- const f = this.computeHeaderInsertIndex(i, t);
1959
- this.reorderPaneInLocationAtIndex(u, this.dragState.pane, f), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState.dropHandled = !0;
1929
+ const i = this.findStackAtPoint(t, e), n = i ? P(i.dataset.path) : null, o = this.dropJoystick.dataset.visible === "true", r = P(this.dropJoystick.dataset.path), c = this.dropJoystickTarget, a = c ? P(c.dataset.path) : null, l = (o ? r ?? a : null) ?? n, d = this.dropJoystick.dataset.zone, u = this.isDropZone(d) ? d : i ? this.computeDropZone(i, { clientX: t, clientY: e }, null) : null;
1930
+ if (this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && i && l && n && B(n, this.dragState.sourcePath) && (!u || u === "center")) {
1931
+ const h = this.resolveStackLocation(l);
1932
+ if (h) {
1933
+ const g = this.computeHeaderInsertIndex(i, t);
1934
+ this.reorderPaneInLocationAtIndex(h, this.dragState.pane, g), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState.dropHandled = !0;
1960
1935
  return;
1961
1936
  }
1962
1937
  }
1963
- c && this.isDropZone(h) && (this.handleDrop(c, h), this.dragState.dropHandled = !0);
1938
+ l && this.isDropZone(u) && (this.handleDrop(l, u), this.dragState.dropHandled = !0);
1964
1939
  }
1965
1940
  clearPendingDragEndTimeout() {
1966
1941
  if (this.pendingDragEndTimeout !== null) {
@@ -2008,20 +1983,20 @@ class L extends tt {
2008
1983
  this.addPaneToLocation(r, i), this.setActivePaneForLocation(r, i), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState && (this.dragState.dropHandled = !0);
2009
1984
  return;
2010
1985
  }
2011
- const d = {
1986
+ const c = {
2012
1987
  kind: "stack",
2013
1988
  panes: [i],
2014
1989
  activePane: i
2015
1990
  };
2016
1991
  if (r.context === "docked")
2017
- this.rootLayout = _(this.rootLayout, r.node, d, e);
1992
+ this.rootLayout = I(this.rootLayout, r.node, c, e);
2018
1993
  else {
2019
1994
  const a = this.floatingLayouts[r.index];
2020
1995
  if (!a) {
2021
1996
  this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged();
2022
1997
  return;
2023
1998
  }
2024
- a.root = _(a.root, r.node, d, e), a.activePane = i;
1999
+ a.root = I(a.root, r.node, c, e), a.activePane = i;
2025
2000
  }
2026
2001
  this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState && (this.dragState.dropHandled = !0);
2027
2002
  }
@@ -2035,20 +2010,20 @@ class L extends tt {
2035
2010
  if (!o || o.context === "floating" && o.index === t)
2036
2011
  return !1;
2037
2012
  if (i === "center") {
2038
- const r = I(n.root);
2013
+ const r = _(n.root);
2039
2014
  if (r.length === 0)
2040
2015
  return !1;
2041
2016
  r.forEach((a) => {
2042
2017
  this.addPaneToLocation(o, a);
2043
2018
  });
2044
- const d = n.activePane && r.includes(n.activePane) ? n.activePane : E(n.root) ?? r[0];
2045
- return d && this.setActivePaneForLocation(o, d), this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0;
2019
+ const c = n.activePane && r.includes(n.activePane) ? n.activePane : E(n.root) ?? r[0];
2020
+ return c && this.setActivePaneForLocation(o, c), this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0;
2046
2021
  }
2047
2022
  if (o.context === "floating") {
2048
2023
  const r = this.floatingLayouts[o.index];
2049
- return r ? (r.root = _(r.root, o.node, n.root, i), r.activePane = n.activePane ?? E(n.root) ?? void 0, this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0) : !1;
2024
+ return r ? (r.root = I(r.root, o.node, n.root, i), r.activePane = n.activePane ?? E(n.root) ?? void 0, this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0) : !1;
2050
2025
  }
2051
- return this.rootLayout = _(this.rootLayout, o.node, n.root, i), this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0;
2026
+ return this.rootLayout = I(this.rootLayout, o.node, n.root, i), this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0;
2052
2027
  }
2053
2028
  computeDropZone(t, e, i) {
2054
2029
  const n = this.isDropZone(i) ? i : null;
@@ -2099,17 +2074,10 @@ class L extends tt {
2099
2074
  findDropZoneByPoint(t, e) {
2100
2075
  if (!this.dropJoystickButtons || this.dropJoystick.dataset.visible !== "true" || !this.dropJoystickTarget)
2101
2076
  return null;
2102
- for (const i of this.dropJoystickButtons) {
2103
- if (i.dataset.hidden === "true" || i.style.visibility === "hidden" || i.style.display === "none")
2104
- continue;
2105
- const n = i.getBoundingClientRect();
2106
- if (t >= n.left && t <= n.right && e >= n.top && e <= n.bottom) {
2107
- const o = i.dataset.zone;
2108
- if (this.isDropZone(o))
2109
- return o;
2110
- }
2111
- }
2112
- return null;
2077
+ const i = this.elementsAt(t, e).filter(
2078
+ (n) => n instanceof HTMLElement && this.dropJoystickButtons.includes(n) && n.dataset.hidden !== "true"
2079
+ );
2080
+ return this.findDropZoneInTargets(i);
2113
2081
  }
2114
2082
  updateDropJoystickActiveZone(t) {
2115
2083
  const i = this.dropJoystick.dataset.visible === "true" ? this.dropJoystick.dataset.zone : void 0, n = t ?? (this.isDropZone(i) ? i : null);
@@ -2121,37 +2089,37 @@ class L extends tt {
2121
2089
  return t === "left" || t === "right" || t === "top" || t === "bottom" || t === "center";
2122
2090
  }
2123
2091
  showDropIndicator(t, e) {
2124
- const i = S(t.dataset.path), n = this.dragState?.sourcePath ?? null;
2125
- if (i && n && bt(i, n))
2092
+ const i = P(t.dataset.path), n = this.dragState?.sourcePath ?? null;
2093
+ if (i && n && vt(i, n))
2126
2094
  return;
2127
- const o = t.getBoundingClientRect(), r = this.getBoundingClientRect(), d = this.dropIndicator, a = this.dropJoystick;
2095
+ const o = t.getBoundingClientRect(), r = this.getBoundingClientRect(), c = this.dropIndicator, a = this.dropJoystick;
2128
2096
  a.hidden = !1;
2129
- const c = S(t.dataset.path);
2130
- let l = 100;
2131
- c && c.type === "floating" && (l = H(this.floatingLayouts[c.index], c.index) + 100), d.style.zIndex = String(l), a.style.zIndex = String(l + 1);
2132
- let h = o.left - r.left, u = o.top - r.top, f = o.width, p = o.height;
2133
- const m = 0.5;
2097
+ const l = P(t.dataset.path);
2098
+ let d = 100;
2099
+ l && l.type === "floating" && (d = H(this.floatingLayouts[l.index], l.index) + 100), c.style.zIndex = String(d), a.style.zIndex = String(d + 1);
2100
+ let u = o.left - r.left, h = o.top - r.top, g = o.width, p = o.height;
2101
+ const f = 0.5;
2134
2102
  if (e) {
2135
2103
  switch (e) {
2136
2104
  case "left":
2137
- f = o.width * m;
2105
+ g = o.width * f;
2138
2106
  break;
2139
2107
  case "right":
2140
- f = o.width * m, h += o.width * (1 - m);
2108
+ g = o.width * f, u += o.width * (1 - f);
2141
2109
  break;
2142
2110
  case "top":
2143
- p = o.height * m;
2111
+ p = o.height * f;
2144
2112
  break;
2145
2113
  case "bottom":
2146
- p = o.height * m, u += o.height * (1 - m);
2114
+ p = o.height * f, h += o.height * (1 - f);
2147
2115
  break;
2148
2116
  }
2149
- d.style.left = `${h}px`, d.style.top = `${u}px`, d.style.width = `${f}px`, d.style.height = `${p}px`, d.dataset.visible = "true";
2117
+ c.style.left = `${u}px`, c.style.top = `${h}px`, c.style.width = `${g}px`, c.style.height = `${p}px`, c.dataset.visible = "true";
2150
2118
  } else
2151
- d.dataset.visible = "false";
2119
+ c.dataset.visible = "false";
2152
2120
  a.style.left = `${o.left - r.left + o.width / 2}px`, a.style.top = `${o.top - r.top + o.height / 2}px`, a.dataset.visible = "true", this.dropJoystick.style.display = "grid", a.dataset.path = t.dataset.path ?? "";
2153
- const g = this.dropJoystickTarget && this.dropJoystickTarget !== t;
2154
- this.dropJoystickTarget = t, g && delete this.dropJoystick.dataset.zone;
2121
+ const m = this.dropJoystickTarget && this.dropJoystickTarget !== t;
2122
+ this.dropJoystickTarget = t, m && delete this.dropJoystick.dataset.zone;
2155
2123
  const y = !this.rootLayout && (t === this.dockedEl || i && i.type === "docked" && i.segments.length === 0), b = Array.from(this.dropJoystick.querySelectorAll(".dock-drop-joystick__spacer"));
2156
2124
  y ? (b.forEach((k) => {
2157
2125
  k.style.display = "";
@@ -2166,19 +2134,20 @@ class L extends tt {
2166
2134
  t.style.display = "", t.style.visibility = "", t.style.pointerEvents = "", delete t.dataset.hidden;
2167
2135
  }), Array.from(this.dropJoystick.querySelectorAll(".dock-drop-joystick__spacer")).forEach((t) => t.style.display = ""), this.dropJoystick.style.gridTemplateColumns = "", this.dropJoystick.style.gridTemplateRows = "";
2168
2136
  }
2137
+ /**
2138
+ * The dock's single hit-test: which of its own shadow elements lie under a
2139
+ * client point, topmost first. Every "what is the pointer over" question —
2140
+ * the target stack, the joystick button, the empty docked surface — is
2141
+ * answered from this list, so the answers can never disagree with each
2142
+ * other, and a test can say what is under the pointer in one place without
2143
+ * inventing any geometry.
2144
+ */
2145
+ elementsAt(t, e) {
2146
+ return this.shadowRoot?.elementsFromPoint(t, e) ?? [];
2147
+ }
2169
2148
  findStackAtPoint(t, e) {
2170
- const i = this.shadowRoot;
2171
- if (!i)
2172
- return null;
2173
- const n = i.elementsFromPoint(t, e), o = this.findStackInTargets(n);
2174
- if (o)
2175
- return o;
2176
- if (!this.rootLayout) {
2177
- const r = this.dockedEl.getBoundingClientRect();
2178
- if (t >= r.left && t <= r.right && e >= r.top && e <= r.bottom)
2179
- return this.dockedEl;
2180
- }
2181
- return null;
2149
+ const i = this.elementsAt(t, e), n = this.findStackInTargets(i);
2150
+ return n || (!this.rootLayout && i.includes(this.dockedEl) ? this.dockedEl : null);
2182
2151
  }
2183
2152
  findStackInTargets(t) {
2184
2153
  for (const e of t)
@@ -2192,9 +2161,7 @@ class L extends tt {
2192
2161
  }
2193
2162
  activatePane(t, e, i) {
2194
2163
  if (t.dataset.activePane = e, t.tagName === "MP-TAB-CONTROL") {
2195
- const r = t.querySelector(
2196
- `:scope > .dock-tab[data-pane="${CSS.escape(e)}"]`
2197
- )?.dataset.tabId;
2164
+ const r = this.stackChildForPane(t, "dock-tab", e)?.dataset.tabId;
2198
2165
  r && t.setAttribute("active-tab", r);
2199
2166
  }
2200
2167
  const n = this.resolveStackLocation(i);
@@ -2316,14 +2283,14 @@ class L extends tt {
2316
2283
  t.preventDefault(), t.stopPropagation(), this.commitHighlightedPaneMoveCandidate();
2317
2284
  return;
2318
2285
  }
2319
- const o = t.key.toLowerCase(), d = {
2286
+ const o = t.key.toLowerCase(), c = {
2320
2287
  t: "top",
2321
2288
  r: "right",
2322
2289
  b: "bottom",
2323
2290
  l: "left",
2324
2291
  f: "float"
2325
2292
  }[o];
2326
- d && (t.preventDefault(), t.stopPropagation(), d === "float" ? this.commitPaneMoveAsFloat() : this.commitPaneMoveToZone(d));
2293
+ c && (t.preventDefault(), t.stopPropagation(), c === "float" ? this.commitPaneMoveAsFloat() : this.commitPaneMoveToZone(c));
2327
2294
  }
2328
2295
  /**
2329
2296
  * Enumerated keyboard drop targets, in cycle order: every docked leaf stack
@@ -2347,7 +2314,7 @@ class L extends tt {
2347
2314
  });
2348
2315
  }), [
2349
2316
  ...e.flatMap(
2350
- ({ pathStr: i, targetTitles: n }) => L.PANE_MOVE_ZONE_ORDER.map((o) => ({ pathStr: i, zone: o, targetTitles: n }))
2317
+ ({ pathStr: i, targetTitles: n }) => z.PANE_MOVE_ZONE_ORDER.map((o) => ({ pathStr: i, zone: o, targetTitles: n }))
2351
2318
  ),
2352
2319
  { pathStr: null, zone: "float", targetTitles: "" }
2353
2320
  ];
@@ -2383,7 +2350,7 @@ class L extends tt {
2383
2350
  this.commitPaneMoveAsFloat();
2384
2351
  return;
2385
2352
  }
2386
- this.commitPaneMoveToZone(e.zone, S(e.pathStr));
2353
+ this.commitPaneMoveToZone(e.zone, P(e.pathStr));
2387
2354
  }
2388
2355
  /** Sole exit point for move mode: drops the arming AND any highlight together. */
2389
2356
  clearPaneMoveState() {
@@ -2406,7 +2373,7 @@ class L extends tt {
2406
2373
  if (!i) return null;
2407
2374
  const n = i.closest(".dock-stack");
2408
2375
  if (!n) return null;
2409
- const o = S(n.dataset.path);
2376
+ const o = P(n.dataset.path);
2410
2377
  return o ? { paneName: i.dataset.pane, sourcePath: o } : null;
2411
2378
  }
2412
2379
  /**
@@ -2418,7 +2385,7 @@ class L extends tt {
2418
2385
  synthesiseDragStateForKeyboardMove() {
2419
2386
  this.paneMoveMode && (this.dragState = {
2420
2387
  pane: this.paneMoveMode.paneName,
2421
- sourcePath: T(this.paneMoveMode.sourcePath),
2388
+ sourcePath: R(this.paneMoveMode.sourcePath),
2422
2389
  floatingIndex: this.paneMoveMode.sourcePath.type === "floating" ? this.paneMoveMode.sourcePath.index : null,
2423
2390
  pointerOffsetX: 0,
2424
2391
  pointerOffsetY: 0,
@@ -2487,9 +2454,9 @@ class L extends tt {
2487
2454
  const r = M(o.root, e);
2488
2455
  if (!r || r.kind !== "stack")
2489
2456
  return !1;
2490
- if (r.panes = r.panes.filter((d) => d !== i), r.panes.includes(r.activePane ?? "") || (r.panes.length > 0 ? r.activePane = r.panes[0] : delete r.activePane), o.activePane === i) {
2491
- const d = E(o.root);
2492
- d ? o.activePane = d : delete o.activePane;
2457
+ if (r.panes = r.panes.filter((c) => c !== i), r.panes.includes(r.activePane ?? "") || (r.panes.length > 0 ? r.activePane = r.panes[0] : delete r.activePane), o.activePane === i) {
2458
+ const c = E(o.root);
2459
+ c ? o.activePane = c : delete o.activePane;
2493
2460
  }
2494
2461
  return r.panes.length > 0 ? !1 : (n || this.normalizeAllLayouts(), !0);
2495
2462
  }
@@ -2503,7 +2470,7 @@ class L extends tt {
2503
2470
  normalizeAllLayouts() {
2504
2471
  this.rootLayout = $(this.rootLayout), this.floatingLayouts = this.floatingLayouts.map((t) => {
2505
2472
  if (t.root = $(t.root), !t.root) return null;
2506
- const e = I(t.root);
2473
+ const e = _(t.root);
2507
2474
  if (!t.activePane || !e.includes(t.activePane)) {
2508
2475
  const i = E(t.root);
2509
2476
  i ? t.activePane = i : delete t.activePane;
@@ -2526,8 +2493,8 @@ class L extends tt {
2526
2493
  const e = new Set(
2527
2494
  Array.from(t.querySelectorAll("slot")).map((o) => o.getAttribute("name")).filter((o) => !!o)
2528
2495
  ), n = [
2529
- ...I(this.rootLayout),
2530
- ...this.floatingLayouts.flatMap((o) => I(o.root))
2496
+ ..._(this.rootLayout),
2497
+ ...this.floatingLayouts.flatMap((o) => _(o.root))
2531
2498
  ].find((o) => !e.has(o));
2532
2499
  if (n)
2533
2500
  throw new Error(
@@ -2547,8 +2514,8 @@ class L extends tt {
2547
2514
  return JSON.parse(JSON.stringify(t));
2548
2515
  }
2549
2516
  }
2550
- const K = "mint-dock-manager";
2551
- typeof customElements < "u" && !customElements.get(K) && customElements.define(K, L);
2517
+ const U = "mint-dock-manager";
2518
+ typeof customElements < "u" && !customElements.get(U) && customElements.define(U, z);
2552
2519
  export {
2553
- L as MintDockManagerElement
2520
+ z as MintDockManagerElement
2554
2521
  };