@lumal/cockpit 0.0.1-beta

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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +103 -0
  3. package/dist/cockpit.css +2 -0
  4. package/dist/createCockpitRegistry-D5F4d5By.js +30 -0
  5. package/dist/createCockpitRegistry-DHr9nXJY.cjs +1 -0
  6. package/dist/designer.cjs +1 -0
  7. package/dist/designer.js +2282 -0
  8. package/dist/index.cjs +1 -0
  9. package/dist/index.js +30 -0
  10. package/dist/registry.cjs +1 -0
  11. package/dist/registry.js +2 -0
  12. package/dist/resolveComponent-BF1aCxAk.cjs +1 -0
  13. package/dist/resolveComponent-QbJRsdxR.js +308 -0
  14. package/dist/runtime-CXiih7DE.js +627 -0
  15. package/dist/runtime-wzWMTWrS.cjs +1 -0
  16. package/dist/runtime.cjs +1 -0
  17. package/dist/runtime.js +3 -0
  18. package/dist/src/composables/index.d.ts +9 -0
  19. package/dist/src/composables/index.d.ts.map +1 -0
  20. package/dist/src/composables/useCanvasScale.d.ts +30 -0
  21. package/dist/src/composables/useCanvasScale.d.ts.map +1 -0
  22. package/dist/src/composables/useCockpit.d.ts +14 -0
  23. package/dist/src/composables/useCockpit.d.ts.map +1 -0
  24. package/dist/src/composables/useCockpitAutoRefresh.d.ts +27 -0
  25. package/dist/src/composables/useCockpitAutoRefresh.d.ts.map +1 -0
  26. package/dist/src/composables/useCockpitContext.d.ts +16 -0
  27. package/dist/src/composables/useCockpitContext.d.ts.map +1 -0
  28. package/dist/src/composables/useCockpitRefresh.d.ts +9 -0
  29. package/dist/src/composables/useCockpitRefresh.d.ts.map +1 -0
  30. package/dist/src/config/defaults.d.ts +19 -0
  31. package/dist/src/config/defaults.d.ts.map +1 -0
  32. package/dist/src/config/index.d.ts +13 -0
  33. package/dist/src/config/index.d.ts.map +1 -0
  34. package/dist/src/config/migrate.d.ts +6 -0
  35. package/dist/src/config/migrate.d.ts.map +1 -0
  36. package/dist/src/config/normalize.d.ts +3 -0
  37. package/dist/src/config/normalize.d.ts.map +1 -0
  38. package/dist/src/config/validate.d.ts +8 -0
  39. package/dist/src/config/validate.d.ts.map +1 -0
  40. package/dist/src/designer/CockpitComponentLibrary.vue.d.ts +16 -0
  41. package/dist/src/designer/CockpitComponentLibrary.vue.d.ts.map +1 -0
  42. package/dist/src/designer/CockpitLayoutEditor.vue.d.ts +34 -0
  43. package/dist/src/designer/CockpitLayoutEditor.vue.d.ts.map +1 -0
  44. package/dist/src/designer/CockpitWidgetDropZone.vue.d.ts +45 -0
  45. package/dist/src/designer/CockpitWidgetDropZone.vue.d.ts.map +1 -0
  46. package/dist/src/designer/CockpitWidgetPreview.vue.d.ts +19 -0
  47. package/dist/src/designer/CockpitWidgetPreview.vue.d.ts.map +1 -0
  48. package/dist/src/designer/LumalCockpitDesigner.vue.d.ts +41 -0
  49. package/dist/src/designer/LumalCockpitDesigner.vue.d.ts.map +1 -0
  50. package/dist/src/designer/confirmWidgetReplacement.d.ts +3 -0
  51. package/dist/src/designer/confirmWidgetReplacement.d.ts.map +1 -0
  52. package/dist/src/designer/index.d.ts +13 -0
  53. package/dist/src/designer/index.d.ts.map +1 -0
  54. package/dist/src/designer/types.d.ts +13 -0
  55. package/dist/src/designer/types.d.ts.map +1 -0
  56. package/dist/src/designer/useCockpitDraft.d.ts +50 -0
  57. package/dist/src/designer/useCockpitDraft.d.ts.map +1 -0
  58. package/dist/src/index.d.ts +22 -0
  59. package/dist/src/index.d.ts.map +1 -0
  60. package/dist/src/messaging/createCockpitMessageBus.d.ts +16 -0
  61. package/dist/src/messaging/createCockpitMessageBus.d.ts.map +1 -0
  62. package/dist/src/messaging/index.d.ts +5 -0
  63. package/dist/src/messaging/index.d.ts.map +1 -0
  64. package/dist/src/messaging/topics.d.ts +10 -0
  65. package/dist/src/messaging/topics.d.ts.map +1 -0
  66. package/dist/src/messaging/types.d.ts +24 -0
  67. package/dist/src/messaging/types.d.ts.map +1 -0
  68. package/dist/src/registry/createCockpitRegistry.d.ts +4 -0
  69. package/dist/src/registry/createCockpitRegistry.d.ts.map +1 -0
  70. package/dist/src/registry/index.d.ts +3 -0
  71. package/dist/src/registry/index.d.ts.map +1 -0
  72. package/dist/src/registry/types.d.ts +20 -0
  73. package/dist/src/registry/types.d.ts.map +1 -0
  74. package/dist/src/runtime/CockpitErrorBoundary.vue.d.ts +26 -0
  75. package/dist/src/runtime/CockpitErrorBoundary.vue.d.ts.map +1 -0
  76. package/dist/src/runtime/LumalCockpit.vue.d.ts +105 -0
  77. package/dist/src/runtime/LumalCockpit.vue.d.ts.map +1 -0
  78. package/dist/src/runtime/LumalCockpitCanvas.vue.d.ts +47 -0
  79. package/dist/src/runtime/LumalCockpitCanvas.vue.d.ts.map +1 -0
  80. package/dist/src/runtime/LumalCockpitCard.vue.d.ts +31 -0
  81. package/dist/src/runtime/LumalCockpitCard.vue.d.ts.map +1 -0
  82. package/dist/src/runtime/LumalCockpitContainer.vue.d.ts +12 -0
  83. package/dist/src/runtime/LumalCockpitContainer.vue.d.ts.map +1 -0
  84. package/dist/src/runtime/LumalCockpitRegion.vue.d.ts +11 -0
  85. package/dist/src/runtime/LumalCockpitRegion.vue.d.ts.map +1 -0
  86. package/dist/src/runtime/LumalCockpitWidgetHost.vue.d.ts +12 -0
  87. package/dist/src/runtime/LumalCockpitWidgetHost.vue.d.ts.map +1 -0
  88. package/dist/src/runtime/card.d.ts +16 -0
  89. package/dist/src/runtime/card.d.ts.map +1 -0
  90. package/dist/src/runtime/context.d.ts +25 -0
  91. package/dist/src/runtime/context.d.ts.map +1 -0
  92. package/dist/src/runtime/index.d.ts +19 -0
  93. package/dist/src/runtime/index.d.ts.map +1 -0
  94. package/dist/src/runtime/resolveComponent.d.ts +13 -0
  95. package/dist/src/runtime/resolveComponent.d.ts.map +1 -0
  96. package/dist/src/types/index.d.ts +83 -0
  97. package/dist/src/types/index.d.ts.map +1 -0
  98. package/dist/validate-DkC_IHrC.js +94 -0
  99. package/dist/validate-KSzm5SZW.cjs +1 -0
  100. package/package.json +73 -0
@@ -0,0 +1,2282 @@
1
+ import { _ as e, d as t, f as n, g as r, i, m as a, n as o, p as s, r as c, t as l, v as u, x as d } from "./resolveComponent-QbJRsdxR.js";
2
+ import { t as f } from "./validate-DkC_IHrC.js";
3
+ import { Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as y, createVNode as b, defineComponent as x, mergeModels as S, nextTick as ee, normalizeClass as C, normalizeStyle as w, onBeforeUnmount as T, onMounted as te, openBlock as E, ref as D, renderList as O, renderSlot as k, resolveDynamicComponent as ne, shallowReactive as re, toDisplayString as ie, unref as A, useModel as ae, watch as oe, watchEffect as se, withCtx as j, withModifiers as ce } from "vue";
4
+ import { ElAlert as le, ElButton as M, ElEmpty as ue, ElInput as de, ElInputNumber as fe, ElMessage as pe, ElMessageBox as me, ElOption as he, ElSelect as ge, ElSwitch as _e, ElTooltip as ve } from "element-plus";
5
+ import { LumalIcon as N } from "@lumal/icons-vue";
6
+ //#region ../../node_modules/.pnpm/sortablejs@1.15.7/node_modules/sortablejs/modular/sortable.esm.js
7
+ function ye(e, t, n) {
8
+ return (t = Ee(t)) in e ? Object.defineProperty(e, t, {
9
+ value: n,
10
+ enumerable: !0,
11
+ configurable: !0,
12
+ writable: !0
13
+ }) : e[t] = n, e;
14
+ }
15
+ function be() {
16
+ return be = Object.assign ? Object.assign.bind() : function(e) {
17
+ for (var t = 1; t < arguments.length; t++) {
18
+ var n = arguments[t];
19
+ for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
20
+ }
21
+ return e;
22
+ }, be.apply(null, arguments);
23
+ }
24
+ function xe(e, t) {
25
+ var n = Object.keys(e);
26
+ if (Object.getOwnPropertySymbols) {
27
+ var r = Object.getOwnPropertySymbols(e);
28
+ t && (r = r.filter(function(t) {
29
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
30
+ })), n.push.apply(n, r);
31
+ }
32
+ return n;
33
+ }
34
+ function Se(e) {
35
+ for (var t = 1; t < arguments.length; t++) {
36
+ var n = arguments[t] == null ? {} : arguments[t];
37
+ t % 2 ? xe(Object(n), !0).forEach(function(t) {
38
+ ye(e, t, n[t]);
39
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : xe(Object(n)).forEach(function(t) {
40
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
41
+ });
42
+ }
43
+ return e;
44
+ }
45
+ function Ce(e, t) {
46
+ if (e == null) return {};
47
+ var n, r, i = we(e, t);
48
+ if (Object.getOwnPropertySymbols) {
49
+ var a = Object.getOwnPropertySymbols(e);
50
+ for (r = 0; r < a.length; r++) n = a[r], t.indexOf(n) === -1 && {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
51
+ }
52
+ return i;
53
+ }
54
+ function we(e, t) {
55
+ if (e == null) return {};
56
+ var n = {};
57
+ for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
58
+ if (t.indexOf(r) !== -1) continue;
59
+ n[r] = e[r];
60
+ }
61
+ return n;
62
+ }
63
+ function Te(e, t) {
64
+ if (typeof e != "object" || !e) return e;
65
+ var n = e[Symbol.toPrimitive];
66
+ if (n !== void 0) {
67
+ var r = n.call(e, t || "default");
68
+ if (typeof r != "object") return r;
69
+ throw TypeError("@@toPrimitive must return a primitive value.");
70
+ }
71
+ return (t === "string" ? String : Number)(e);
72
+ }
73
+ function Ee(e) {
74
+ var t = Te(e, "string");
75
+ return typeof t == "symbol" ? t : t + "";
76
+ }
77
+ function De(e) {
78
+ "@babel/helpers - typeof";
79
+ return De = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
80
+ return typeof e;
81
+ } : function(e) {
82
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
83
+ }, De(e);
84
+ }
85
+ var Oe = "1.15.7";
86
+ function ke(e) {
87
+ if (typeof window < "u" && window.navigator) return !!/*@__PURE__*/ navigator.userAgent.match(e);
88
+ }
89
+ var Ae = ke(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), je = ke(/Edge/i), Me = ke(/firefox/i), Ne = ke(/safari/i) && !ke(/chrome/i) && !ke(/android/i), Pe = ke(/iP(ad|od|hone)/i), Fe = ke(/chrome/i) && ke(/android/i), Ie = {
90
+ capture: !1,
91
+ passive: !1
92
+ };
93
+ function P(e, t, n) {
94
+ e.addEventListener(t, n, !Ae && Ie);
95
+ }
96
+ function F(e, t, n) {
97
+ e.removeEventListener(t, n, !Ae && Ie);
98
+ }
99
+ function Le(e, t) {
100
+ if (t) {
101
+ if (t[0] === ">" && (t = t.substring(1)), e) try {
102
+ if (e.matches) return e.matches(t);
103
+ if (e.msMatchesSelector) return e.msMatchesSelector(t);
104
+ if (e.webkitMatchesSelector) return e.webkitMatchesSelector(t);
105
+ } catch {
106
+ return !1;
107
+ }
108
+ return !1;
109
+ }
110
+ }
111
+ function Re(e) {
112
+ return e.host && e !== document && e.host.nodeType && e.host !== e ? e.host : e.parentNode;
113
+ }
114
+ function I(e, t, n, r) {
115
+ if (e) {
116
+ n ||= document;
117
+ do {
118
+ if (t != null && (t[0] === ">" ? e.parentNode === n && Le(e, t) : Le(e, t)) || r && e === n) return e;
119
+ if (e === n) break;
120
+ } while (e = Re(e));
121
+ }
122
+ return null;
123
+ }
124
+ var ze = /\s+/g;
125
+ function L(e, t, n) {
126
+ e && t && (e.classList ? e.classList[n ? "add" : "remove"](t) : e.className = ((" " + e.className + " ").replace(ze, " ").replace(" " + t + " ", " ") + (n ? " " + t : "")).replace(ze, " "));
127
+ }
128
+ function R(e, t, n) {
129
+ var r = e && e.style;
130
+ if (r) {
131
+ if (n === void 0) return document.defaultView && document.defaultView.getComputedStyle ? n = document.defaultView.getComputedStyle(e, "") : e.currentStyle && (n = e.currentStyle), t === void 0 ? n : n[t];
132
+ !(t in r) && t.indexOf("webkit") === -1 && (t = "-webkit-" + t), r[t] = n + (typeof n == "string" ? "" : "px");
133
+ }
134
+ }
135
+ function Be(e, t) {
136
+ var n = "";
137
+ if (typeof e == "string") n = e;
138
+ else do {
139
+ var r = R(e, "transform");
140
+ r && r !== "none" && (n = r + " " + n);
141
+ } while (!t && (e = e.parentNode));
142
+ var i = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
143
+ return i && new i(n);
144
+ }
145
+ function Ve(e, t, n) {
146
+ if (e) {
147
+ var r = e.getElementsByTagName(t), i = 0, a = r.length;
148
+ if (n) for (; i < a; i++) n(r[i], i);
149
+ return r;
150
+ }
151
+ return [];
152
+ }
153
+ function He() {
154
+ return document.scrollingElement || document.documentElement;
155
+ }
156
+ function z(e, t, n, r, i) {
157
+ if (!(!e.getBoundingClientRect && e !== window)) {
158
+ var a, o, s, c, l, u, d;
159
+ if (e !== window && e.parentNode && e !== He() ? (a = e.getBoundingClientRect(), o = a.top, s = a.left, c = a.bottom, l = a.right, u = a.height, d = a.width) : (o = 0, s = 0, c = window.innerHeight, l = window.innerWidth, u = window.innerHeight, d = window.innerWidth), (t || n) && e !== window && (i ||= e.parentNode, !Ae)) do
160
+ if (i && i.getBoundingClientRect && (R(i, "transform") !== "none" || n && R(i, "position") !== "static")) {
161
+ var f = i.getBoundingClientRect();
162
+ o -= f.top + parseInt(R(i, "border-top-width")), s -= f.left + parseInt(R(i, "border-left-width")), c = o + a.height, l = s + a.width;
163
+ break;
164
+ }
165
+ while (i = i.parentNode);
166
+ if (r && e !== window) {
167
+ var p = Be(i || e), m = p && p.a, h = p && p.d;
168
+ p && (o /= h, s /= m, d /= m, u /= h, c = o + u, l = s + d);
169
+ }
170
+ return {
171
+ top: o,
172
+ left: s,
173
+ bottom: c,
174
+ right: l,
175
+ width: d,
176
+ height: u
177
+ };
178
+ }
179
+ }
180
+ function Ue(e, t, n) {
181
+ for (var r = Je(e, !0), i = z(e)[t]; r;) {
182
+ var a = z(r)[n], o = void 0;
183
+ if (o = n === "top" || n === "left" ? i >= a : i <= a, !o) return r;
184
+ if (r === He()) break;
185
+ r = Je(r, !1);
186
+ }
187
+ return !1;
188
+ }
189
+ function We(e, t, n, r) {
190
+ for (var i = 0, a = 0, o = e.children; a < o.length;) {
191
+ if (o[a].style.display !== "none" && o[a] !== Q.ghost && (r || o[a] !== Q.dragged) && I(o[a], n.draggable, e, !1)) {
192
+ if (i === t) return o[a];
193
+ i++;
194
+ }
195
+ a++;
196
+ }
197
+ return null;
198
+ }
199
+ function Ge(e, t) {
200
+ for (var n = e.lastElementChild; n && (n === Q.ghost || R(n, "display") === "none" || t && !Le(n, t));) n = n.previousElementSibling;
201
+ return n || null;
202
+ }
203
+ function B(e, t) {
204
+ var n = 0;
205
+ if (!e || !e.parentNode) return -1;
206
+ for (; e = e.previousElementSibling;) e.nodeName.toUpperCase() !== "TEMPLATE" && e !== Q.clone && (!t || Le(e, t)) && n++;
207
+ return n;
208
+ }
209
+ function Ke(e) {
210
+ var t = 0, n = 0, r = He();
211
+ if (e) do {
212
+ var i = Be(e), a = i.a, o = i.d;
213
+ t += e.scrollLeft * a, n += e.scrollTop * o;
214
+ } while (e !== r && (e = e.parentNode));
215
+ return [t, n];
216
+ }
217
+ function qe(e, t) {
218
+ for (var n in e) if (e.hasOwnProperty(n)) {
219
+ for (var r in t) if (t.hasOwnProperty(r) && t[r] === e[n][r]) return Number(n);
220
+ }
221
+ return -1;
222
+ }
223
+ function Je(e, t) {
224
+ if (!e || !e.getBoundingClientRect) return He();
225
+ var n = e, r = !1;
226
+ do
227
+ if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) {
228
+ var i = R(n);
229
+ if (n.clientWidth < n.scrollWidth && (i.overflowX == "auto" || i.overflowX == "scroll") || n.clientHeight < n.scrollHeight && (i.overflowY == "auto" || i.overflowY == "scroll")) {
230
+ if (!n.getBoundingClientRect || n === document.body) return He();
231
+ if (r || t) return n;
232
+ r = !0;
233
+ }
234
+ }
235
+ while (n = n.parentNode);
236
+ return He();
237
+ }
238
+ function Ye(e, t) {
239
+ if (e && t) for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
240
+ return e;
241
+ }
242
+ function Xe(e, t) {
243
+ return Math.round(e.top) === Math.round(t.top) && Math.round(e.left) === Math.round(t.left) && Math.round(e.height) === Math.round(t.height) && Math.round(e.width) === Math.round(t.width);
244
+ }
245
+ var Ze;
246
+ function Qe(e, t) {
247
+ return function() {
248
+ if (!Ze) {
249
+ var n = arguments, r = this;
250
+ n.length === 1 ? e.call(r, n[0]) : e.apply(r, n), Ze = setTimeout(function() {
251
+ Ze = void 0;
252
+ }, t);
253
+ }
254
+ };
255
+ }
256
+ function $e() {
257
+ clearTimeout(Ze), Ze = void 0;
258
+ }
259
+ function et(e, t, n) {
260
+ e.scrollLeft += t, e.scrollTop += n;
261
+ }
262
+ function tt(e) {
263
+ var t = window.Polymer, n = window.jQuery || window.Zepto;
264
+ return t && t.dom ? t.dom(e).cloneNode(!0) : n ? n(e).clone(!0)[0] : e.cloneNode(!0);
265
+ }
266
+ function nt(e, t, n) {
267
+ var r = {};
268
+ return Array.from(e.children).forEach(function(i) {
269
+ if (!(!I(i, t.draggable, e, !1) || i.animated || i === n)) {
270
+ var a = z(i);
271
+ r.left = Math.min(r.left ?? Infinity, a.left), r.top = Math.min(r.top ?? Infinity, a.top), r.right = Math.max(r.right ?? -Infinity, a.right), r.bottom = Math.max(r.bottom ?? -Infinity, a.bottom);
272
+ }
273
+ }), r.width = r.right - r.left, r.height = r.bottom - r.top, r.x = r.left, r.y = r.top, r;
274
+ }
275
+ var V = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
276
+ function rt() {
277
+ var e = [], t;
278
+ return {
279
+ captureAnimationState: function() {
280
+ e = [], this.options.animation && [].slice.call(this.el.children).forEach(function(t) {
281
+ if (!(R(t, "display") === "none" || t === Q.ghost)) {
282
+ e.push({
283
+ target: t,
284
+ rect: z(t)
285
+ });
286
+ var n = Se({}, e[e.length - 1].rect);
287
+ if (t.thisAnimationDuration) {
288
+ var r = Be(t, !0);
289
+ r && (n.top -= r.f, n.left -= r.e);
290
+ }
291
+ t.fromRect = n;
292
+ }
293
+ });
294
+ },
295
+ addAnimationState: function(t) {
296
+ e.push(t);
297
+ },
298
+ removeAnimationState: function(t) {
299
+ e.splice(qe(e, { target: t }), 1);
300
+ },
301
+ animateAll: function(n) {
302
+ var r = this;
303
+ if (!this.options.animation) {
304
+ clearTimeout(t), typeof n == "function" && n();
305
+ return;
306
+ }
307
+ var i = !1, a = 0;
308
+ e.forEach(function(e) {
309
+ var t = 0, n = e.target, o = n.fromRect, s = z(n), c = n.prevFromRect, l = n.prevToRect, u = e.rect, d = Be(n, !0);
310
+ d && (s.top -= d.f, s.left -= d.e), n.toRect = s, n.thisAnimationDuration && Xe(c, s) && !Xe(o, s) && (u.top - s.top) / (u.left - s.left) === (o.top - s.top) / (o.left - s.left) && (t = at(u, c, l, r.options)), Xe(s, o) || (n.prevFromRect = o, n.prevToRect = s, t ||= r.options.animation, r.animate(n, u, s, t)), t && (i = !0, a = Math.max(a, t), clearTimeout(n.animationResetTimer), n.animationResetTimer = setTimeout(function() {
311
+ n.animationTime = 0, n.prevFromRect = null, n.fromRect = null, n.prevToRect = null, n.thisAnimationDuration = null;
312
+ }, t), n.thisAnimationDuration = t);
313
+ }), clearTimeout(t), i ? t = setTimeout(function() {
314
+ typeof n == "function" && n();
315
+ }, a) : typeof n == "function" && n(), e = [];
316
+ },
317
+ animate: function(e, t, n, r) {
318
+ if (r) {
319
+ R(e, "transition", ""), R(e, "transform", "");
320
+ var i = Be(this.el), a = i && i.a, o = i && i.d, s = (t.left - n.left) / (a || 1), c = (t.top - n.top) / (o || 1);
321
+ e.animatingX = !!s, e.animatingY = !!c, R(e, "transform", "translate3d(" + s + "px," + c + "px,0)"), this.forRepaintDummy = it(e), R(e, "transition", "transform " + r + "ms" + (this.options.easing ? " " + this.options.easing : "")), R(e, "transform", "translate3d(0,0,0)"), typeof e.animated == "number" && clearTimeout(e.animated), e.animated = setTimeout(function() {
322
+ R(e, "transition", ""), R(e, "transform", ""), e.animated = !1, e.animatingX = !1, e.animatingY = !1;
323
+ }, r);
324
+ }
325
+ }
326
+ };
327
+ }
328
+ function it(e) {
329
+ return e.offsetWidth;
330
+ }
331
+ function at(e, t, n, r) {
332
+ return Math.sqrt((t.top - e.top) ** 2 + (t.left - e.left) ** 2) / Math.sqrt((t.top - n.top) ** 2 + (t.left - n.left) ** 2) * r.animation;
333
+ }
334
+ var ot = [], st = { initializeByDefault: !0 }, ct = {
335
+ mount: function(e) {
336
+ for (var t in st) st.hasOwnProperty(t) && !(t in e) && (e[t] = st[t]);
337
+ ot.forEach(function(t) {
338
+ if (t.pluginName === e.pluginName) throw `Sortable: Cannot mount plugin ${e.pluginName} more than once`;
339
+ }), ot.push(e);
340
+ },
341
+ pluginEvent: function(e, t, n) {
342
+ var r = this;
343
+ this.eventCanceled = !1, n.cancel = function() {
344
+ r.eventCanceled = !0;
345
+ };
346
+ var i = e + "Global";
347
+ ot.forEach(function(r) {
348
+ t[r.pluginName] && (t[r.pluginName][i] && t[r.pluginName][i](Se({ sortable: t }, n)), t.options[r.pluginName] && t[r.pluginName][e] && t[r.pluginName][e](Se({ sortable: t }, n)));
349
+ });
350
+ },
351
+ initializePlugins: function(e, t, n, r) {
352
+ for (var i in ot.forEach(function(r) {
353
+ var i = r.pluginName;
354
+ if (!(!e.options[i] && !r.initializeByDefault)) {
355
+ var a = new r(e, t, e.options);
356
+ a.sortable = e, a.options = e.options, e[i] = a, be(n, a.defaults);
357
+ }
358
+ }), e.options) if (e.options.hasOwnProperty(i)) {
359
+ var a = this.modifyOption(e, i, e.options[i]);
360
+ a !== void 0 && (e.options[i] = a);
361
+ }
362
+ },
363
+ getEventProperties: function(e, t) {
364
+ var n = {};
365
+ return ot.forEach(function(r) {
366
+ typeof r.eventProperties == "function" && be(n, r.eventProperties.call(t[r.pluginName], e));
367
+ }), n;
368
+ },
369
+ modifyOption: function(e, t, n) {
370
+ var r;
371
+ return ot.forEach(function(i) {
372
+ e[i.pluginName] && i.optionListeners && typeof i.optionListeners[t] == "function" && (r = i.optionListeners[t].call(e[i.pluginName], n));
373
+ }), r;
374
+ }
375
+ };
376
+ function lt(e) {
377
+ var t = e.sortable, n = e.rootEl, r = e.name, i = e.targetEl, a = e.cloneEl, o = e.toEl, s = e.fromEl, c = e.oldIndex, l = e.newIndex, u = e.oldDraggableIndex, d = e.newDraggableIndex, f = e.originalEvent, p = e.putSortable, m = e.extraEventProperties;
378
+ if (t ||= n && n[V], t) {
379
+ var h, g = t.options, _ = "on" + r.charAt(0).toUpperCase() + r.substr(1);
380
+ window.CustomEvent && !Ae && !je ? h = new CustomEvent(r, {
381
+ bubbles: !0,
382
+ cancelable: !0
383
+ }) : (h = document.createEvent("Event"), h.initEvent(r, !0, !0)), h.to = o || n, h.from = s || n, h.item = i || n, h.clone = a, h.oldIndex = c, h.newIndex = l, h.oldDraggableIndex = u, h.newDraggableIndex = d, h.originalEvent = f, h.pullMode = p ? p.lastPutMode : void 0;
384
+ var v = Se(Se({}, m), ct.getEventProperties(r, t));
385
+ for (var y in v) h[y] = v[y];
386
+ n && n.dispatchEvent(h), g[_] && g[_].call(t, h);
387
+ }
388
+ }
389
+ var ut = ["evt"], H = function(e, t) {
390
+ var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = n.evt, i = Ce(n, ut);
391
+ ct.pluginEvent.bind(Q)(e, t, Se({
392
+ dragEl: W,
393
+ parentEl: G,
394
+ ghostEl: K,
395
+ rootEl: q,
396
+ nextEl: dt,
397
+ lastDownEl: ft,
398
+ cloneEl: J,
399
+ cloneHidden: pt,
400
+ dragStarted: Dt,
401
+ putSortable: X,
402
+ activeSortable: Q.active,
403
+ originalEvent: r,
404
+ oldIndex: mt,
405
+ oldDraggableIndex: ht,
406
+ newIndex: Y,
407
+ newDraggableIndex: gt,
408
+ hideGhostForTarget: Gt,
409
+ unhideGhostForTarget: Kt,
410
+ cloneNowHidden: function() {
411
+ pt = !0;
412
+ },
413
+ cloneNowShown: function() {
414
+ pt = !1;
415
+ },
416
+ dispatchSortableEvent: function(e) {
417
+ U({
418
+ sortable: t,
419
+ name: e,
420
+ originalEvent: r
421
+ });
422
+ }
423
+ }, i));
424
+ };
425
+ function U(e) {
426
+ lt(Se({
427
+ putSortable: X,
428
+ cloneEl: J,
429
+ targetEl: W,
430
+ rootEl: q,
431
+ oldIndex: mt,
432
+ oldDraggableIndex: ht,
433
+ newIndex: Y,
434
+ newDraggableIndex: gt
435
+ }, e));
436
+ }
437
+ var W, G, K, q, dt, ft, J, pt, mt, Y, ht, gt, _t, X, vt = !1, yt = !1, bt = [], xt, St, Ct, wt, Tt, Et, Dt, Ot, kt, At = !1, jt = !1, Mt, Z, Nt = [], Pt = !1, Ft = [], It = typeof document < "u", Lt = Pe, Rt = je || Ae ? "cssFloat" : "float", zt = It && !Fe && !Pe && "draggable" in document.createElement("div"), Bt = function() {
438
+ if (It) {
439
+ if (Ae) return !1;
440
+ var e = document.createElement("x");
441
+ return e.style.cssText = "pointer-events:auto", e.style.pointerEvents === "auto";
442
+ }
443
+ }(), Vt = function(e, t) {
444
+ var n = R(e), r = parseInt(n.width) - parseInt(n.paddingLeft) - parseInt(n.paddingRight) - parseInt(n.borderLeftWidth) - parseInt(n.borderRightWidth), i = We(e, 0, t), a = We(e, 1, t), o = i && R(i), s = a && R(a), c = o && parseInt(o.marginLeft) + parseInt(o.marginRight) + z(i).width, l = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + z(a).width;
445
+ if (n.display === "flex") return n.flexDirection === "column" || n.flexDirection === "column-reverse" ? "vertical" : "horizontal";
446
+ if (n.display === "grid") return n.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
447
+ if (i && o.float && o.float !== "none") {
448
+ var u = o.float === "left" ? "left" : "right";
449
+ return a && (s.clear === "both" || s.clear === u) ? "vertical" : "horizontal";
450
+ }
451
+ return i && (o.display === "block" || o.display === "flex" || o.display === "table" || o.display === "grid" || c >= r && n[Rt] === "none" || a && n[Rt] === "none" && c + l > r) ? "vertical" : "horizontal";
452
+ }, Ht = function(e, t, n) {
453
+ var r = n ? e.left : e.top, i = n ? e.right : e.bottom, a = n ? e.width : e.height, o = n ? t.left : t.top, s = n ? t.right : t.bottom, c = n ? t.width : t.height;
454
+ return r === o || i === s || r + a / 2 === o + c / 2;
455
+ }, Ut = function(e, t) {
456
+ var n;
457
+ return bt.some(function(r) {
458
+ var i = r[V].options.emptyInsertThreshold;
459
+ if (!(!i || Ge(r))) {
460
+ var a = z(r), o = e >= a.left - i && e <= a.right + i, s = t >= a.top - i && t <= a.bottom + i;
461
+ if (o && s) return n = r;
462
+ }
463
+ }), n;
464
+ }, Wt = function(e) {
465
+ function t(e, n) {
466
+ return function(r, i, a, o) {
467
+ var s = r.options.group.name && i.options.group.name && r.options.group.name === i.options.group.name;
468
+ if (e == null && (n || s)) return !0;
469
+ if (e == null || e === !1) return !1;
470
+ if (n && e === "clone") return e;
471
+ if (typeof e == "function") return t(e(r, i, a, o), n)(r, i, a, o);
472
+ var c = (n ? r : i).options.group.name;
473
+ return e === !0 || typeof e == "string" && e === c || e.join && e.indexOf(c) > -1;
474
+ };
475
+ }
476
+ var n = {}, r = e.group;
477
+ (!r || De(r) != "object") && (r = { name: r }), n.name = r.name, n.checkPull = t(r.pull, !0), n.checkPut = t(r.put), n.revertClone = r.revertClone, e.group = n;
478
+ }, Gt = function() {
479
+ !Bt && K && R(K, "display", "none");
480
+ }, Kt = function() {
481
+ !Bt && K && R(K, "display", "");
482
+ };
483
+ It && !Fe && document.addEventListener("click", function(e) {
484
+ if (yt) return e.preventDefault(), e.stopPropagation && e.stopPropagation(), e.stopImmediatePropagation && e.stopImmediatePropagation(), yt = !1, !1;
485
+ }, !0);
486
+ var qt = function(e) {
487
+ if (W) {
488
+ e = e.touches ? e.touches[0] : e;
489
+ var t = Ut(e.clientX, e.clientY);
490
+ if (t) {
491
+ var n = {};
492
+ for (var r in e) e.hasOwnProperty(r) && (n[r] = e[r]);
493
+ n.target = n.rootEl = t, n.preventDefault = void 0, n.stopPropagation = void 0, t[V]._onDragOver(n);
494
+ }
495
+ }
496
+ }, Jt = function(e) {
497
+ W && W.parentNode[V]._isOutsideThisEl(e.target);
498
+ };
499
+ function Q(e, t) {
500
+ if (!(e && e.nodeType && e.nodeType === 1)) throw `Sortable: \`el\` must be an HTMLElement, not ${{}.toString.call(e)}`;
501
+ this.el = e, this.options = t = be({}, t), e[V] = this;
502
+ var n = {
503
+ group: null,
504
+ sort: !0,
505
+ disabled: !1,
506
+ store: null,
507
+ handle: null,
508
+ draggable: /^[uo]l$/i.test(e.nodeName) ? ">li" : ">*",
509
+ swapThreshold: 1,
510
+ invertSwap: !1,
511
+ invertedSwapThreshold: null,
512
+ removeCloneOnHide: !0,
513
+ direction: function() {
514
+ return Vt(e, this.options);
515
+ },
516
+ ghostClass: "sortable-ghost",
517
+ chosenClass: "sortable-chosen",
518
+ dragClass: "sortable-drag",
519
+ ignore: "a, img",
520
+ filter: null,
521
+ preventOnFilter: !0,
522
+ animation: 0,
523
+ easing: null,
524
+ setData: function(e, t) {
525
+ e.setData("Text", t.textContent);
526
+ },
527
+ dropBubble: !1,
528
+ dragoverBubble: !1,
529
+ dataIdAttr: "data-id",
530
+ delay: 0,
531
+ delayOnTouchOnly: !1,
532
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
533
+ forceFallback: !1,
534
+ fallbackClass: "sortable-fallback",
535
+ fallbackOnBody: !1,
536
+ fallbackTolerance: 0,
537
+ fallbackOffset: {
538
+ x: 0,
539
+ y: 0
540
+ },
541
+ supportPointer: Q.supportPointer !== !1 && "PointerEvent" in window && (!Ne || Pe),
542
+ emptyInsertThreshold: 5
543
+ };
544
+ for (var r in ct.initializePlugins(this, e, n), n) !(r in t) && (t[r] = n[r]);
545
+ for (var i in Wt(t), this) i.charAt(0) === "_" && typeof this[i] == "function" && (this[i] = this[i].bind(this));
546
+ this.nativeDraggable = !t.forceFallback && zt, this.nativeDraggable && (this.options.touchStartThreshold = 1), t.supportPointer ? P(e, "pointerdown", this._onTapStart) : (P(e, "mousedown", this._onTapStart), P(e, "touchstart", this._onTapStart)), this.nativeDraggable && (P(e, "dragover", this), P(e, "dragenter", this)), bt.push(this.el), t.store && t.store.get && this.sort(t.store.get(this) || []), be(this, rt());
547
+ }
548
+ Q.prototype = {
549
+ constructor: Q,
550
+ _isOutsideThisEl: function(e) {
551
+ !this.el.contains(e) && e !== this.el && (Ot = null);
552
+ },
553
+ _getDirection: function(e, t) {
554
+ return typeof this.options.direction == "function" ? this.options.direction.call(this, e, t, W) : this.options.direction;
555
+ },
556
+ _onTapStart: function(e) {
557
+ if (e.cancelable) {
558
+ var t = this, n = this.el, r = this.options, i = r.preventOnFilter, a = e.type, o = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (o || e).target, c = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, l = r.filter;
559
+ if (an(n), !W && !(/mousedown|pointerdown/.test(a) && e.button !== 0 || r.disabled) && !c.isContentEditable && !(!this.nativeDraggable && Ne && s && s.tagName.toUpperCase() === "SELECT") && (s = I(s, r.draggable, n, !1), !(s && s.animated) && ft !== s)) {
560
+ if (mt = B(s), ht = B(s, r.draggable), typeof l == "function") {
561
+ if (l.call(this, e, s, this)) {
562
+ U({
563
+ sortable: t,
564
+ rootEl: c,
565
+ name: "filter",
566
+ targetEl: s,
567
+ toEl: n,
568
+ fromEl: n
569
+ }), H("filter", t, { evt: e }), i && e.preventDefault();
570
+ return;
571
+ }
572
+ } else if (l && (l = l.split(",").some(function(r) {
573
+ if (r = I(c, r.trim(), n, !1), r) return U({
574
+ sortable: t,
575
+ rootEl: r,
576
+ name: "filter",
577
+ targetEl: s,
578
+ fromEl: n,
579
+ toEl: n
580
+ }), H("filter", t, { evt: e }), !0;
581
+ }), l)) {
582
+ i && e.preventDefault();
583
+ return;
584
+ }
585
+ r.handle && !I(c, r.handle, n, !1) || this._prepareDragStart(e, o, s);
586
+ }
587
+ }
588
+ },
589
+ _prepareDragStart: function(e, t, n) {
590
+ var r = this, i = r.el, a = r.options, o = i.ownerDocument, s;
591
+ if (n && !W && n.parentNode === i) {
592
+ var c = z(n);
593
+ if (q = i, W = n, G = W.parentNode, dt = W.nextSibling, ft = n, _t = a.group, Q.dragged = W, xt = {
594
+ target: W,
595
+ clientX: (t || e).clientX,
596
+ clientY: (t || e).clientY
597
+ }, Tt = xt.clientX - c.left, Et = xt.clientY - c.top, this._lastX = (t || e).clientX, this._lastY = (t || e).clientY, W.style["will-change"] = "all", s = function() {
598
+ if (H("delayEnded", r, { evt: e }), Q.eventCanceled) {
599
+ r._onDrop();
600
+ return;
601
+ }
602
+ r._disableDelayedDragEvents(), !Me && r.nativeDraggable && (W.draggable = !0), r._triggerDragStart(e, t), U({
603
+ sortable: r,
604
+ name: "choose",
605
+ originalEvent: e
606
+ }), L(W, a.chosenClass, !0);
607
+ }, a.ignore.split(",").forEach(function(e) {
608
+ Ve(W, e.trim(), Zt);
609
+ }), P(o, "dragover", qt), P(o, "mousemove", qt), P(o, "touchmove", qt), a.supportPointer ? (P(o, "pointerup", r._onDrop), !this.nativeDraggable && P(o, "pointercancel", r._onDrop)) : (P(o, "mouseup", r._onDrop), P(o, "touchend", r._onDrop), P(o, "touchcancel", r._onDrop)), Me && this.nativeDraggable && (this.options.touchStartThreshold = 4, W.draggable = !0), H("delayStart", this, { evt: e }), a.delay && (!a.delayOnTouchOnly || t) && (!this.nativeDraggable || !(je || Ae))) {
610
+ if (Q.eventCanceled) {
611
+ this._onDrop();
612
+ return;
613
+ }
614
+ a.supportPointer ? (P(o, "pointerup", r._disableDelayedDrag), P(o, "pointercancel", r._disableDelayedDrag)) : (P(o, "mouseup", r._disableDelayedDrag), P(o, "touchend", r._disableDelayedDrag), P(o, "touchcancel", r._disableDelayedDrag)), P(o, "mousemove", r._delayedDragTouchMoveHandler), P(o, "touchmove", r._delayedDragTouchMoveHandler), a.supportPointer && P(o, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(s, a.delay);
615
+ } else s();
616
+ }
617
+ },
618
+ _delayedDragTouchMoveHandler: function(e) {
619
+ var t = e.touches ? e.touches[0] : e;
620
+ Math.max(Math.abs(t.clientX - this._lastX), Math.abs(t.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag();
621
+ },
622
+ _disableDelayedDrag: function() {
623
+ W && Zt(W), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
624
+ },
625
+ _disableDelayedDragEvents: function() {
626
+ var e = this.el.ownerDocument;
627
+ F(e, "mouseup", this._disableDelayedDrag), F(e, "touchend", this._disableDelayedDrag), F(e, "touchcancel", this._disableDelayedDrag), F(e, "pointerup", this._disableDelayedDrag), F(e, "pointercancel", this._disableDelayedDrag), F(e, "mousemove", this._delayedDragTouchMoveHandler), F(e, "touchmove", this._delayedDragTouchMoveHandler), F(e, "pointermove", this._delayedDragTouchMoveHandler);
628
+ },
629
+ _triggerDragStart: function(e, t) {
630
+ t ||= e.pointerType == "touch" && e, !this.nativeDraggable || t ? this.options.supportPointer ? P(document, "pointermove", this._onTouchMove) : t ? P(document, "touchmove", this._onTouchMove) : P(document, "mousemove", this._onTouchMove) : (P(W, "dragend", this), P(q, "dragstart", this._onDragStart));
631
+ try {
632
+ document.selection ? on(function() {
633
+ document.selection.empty();
634
+ }) : window.getSelection().removeAllRanges();
635
+ } catch {}
636
+ },
637
+ _dragStarted: function(e, t) {
638
+ if (vt = !1, q && W) {
639
+ H("dragStarted", this, { evt: t }), this.nativeDraggable && P(document, "dragover", Jt);
640
+ var n = this.options;
641
+ !e && L(W, n.dragClass, !1), L(W, n.ghostClass, !0), Q.active = this, e && this._appendGhost(), U({
642
+ sortable: this,
643
+ name: "start",
644
+ originalEvent: t
645
+ });
646
+ } else this._nulling();
647
+ },
648
+ _emulateDragOver: function() {
649
+ if (St) {
650
+ this._lastX = St.clientX, this._lastY = St.clientY, Gt();
651
+ for (var e = document.elementFromPoint(St.clientX, St.clientY), t = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(St.clientX, St.clientY), e !== t);) t = e;
652
+ if (W.parentNode[V]._isOutsideThisEl(e), t) do {
653
+ if (t[V]) {
654
+ var n = void 0;
655
+ if (n = t[V]._onDragOver({
656
+ clientX: St.clientX,
657
+ clientY: St.clientY,
658
+ target: e,
659
+ rootEl: t
660
+ }), n && !this.options.dragoverBubble) break;
661
+ }
662
+ e = t;
663
+ } while (t = Re(t));
664
+ Kt();
665
+ }
666
+ },
667
+ _onTouchMove: function(e) {
668
+ if (xt) {
669
+ var t = this.options, n = t.fallbackTolerance, r = t.fallbackOffset, i = e.touches ? e.touches[0] : e, a = K && Be(K, !0), o = K && a && a.a, s = K && a && a.d, c = Lt && Z && Ke(Z), l = (i.clientX - xt.clientX + r.x) / (o || 1) + (c ? c[0] - Nt[0] : 0) / (o || 1), u = (i.clientY - xt.clientY + r.y) / (s || 1) + (c ? c[1] - Nt[1] : 0) / (s || 1);
670
+ if (!Q.active && !vt) {
671
+ if (n && Math.max(Math.abs(i.clientX - this._lastX), Math.abs(i.clientY - this._lastY)) < n) return;
672
+ this._onDragStart(e, !0);
673
+ }
674
+ if (K) {
675
+ a ? (a.e += l - (Ct || 0), a.f += u - (wt || 0)) : a = {
676
+ a: 1,
677
+ b: 0,
678
+ c: 0,
679
+ d: 1,
680
+ e: l,
681
+ f: u
682
+ };
683
+ var d = `matrix(${a.a},${a.b},${a.c},${a.d},${a.e},${a.f})`;
684
+ R(K, "webkitTransform", d), R(K, "mozTransform", d), R(K, "msTransform", d), R(K, "transform", d), Ct = l, wt = u, St = i;
685
+ }
686
+ e.cancelable && e.preventDefault();
687
+ }
688
+ },
689
+ _appendGhost: function() {
690
+ if (!K) {
691
+ var e = this.options.fallbackOnBody ? document.body : q, t = z(W, !0, Lt, !0, e), n = this.options;
692
+ if (Lt) {
693
+ for (Z = e; R(Z, "position") === "static" && R(Z, "transform") === "none" && Z !== document;) Z = Z.parentNode;
694
+ Z !== document.body && Z !== document.documentElement ? (Z === document && (Z = He()), t.top += Z.scrollTop, t.left += Z.scrollLeft) : Z = He(), Nt = Ke(Z);
695
+ }
696
+ K = W.cloneNode(!0), L(K, n.ghostClass, !1), L(K, n.fallbackClass, !0), L(K, n.dragClass, !0), R(K, "transition", ""), R(K, "transform", ""), R(K, "box-sizing", "border-box"), R(K, "margin", 0), R(K, "top", t.top), R(K, "left", t.left), R(K, "width", t.width), R(K, "height", t.height), R(K, "opacity", "0.8"), R(K, "position", Lt ? "absolute" : "fixed"), R(K, "zIndex", "100000"), R(K, "pointerEvents", "none"), Q.ghost = K, e.appendChild(K), R(K, "transform-origin", Tt / parseInt(K.style.width) * 100 + "% " + Et / parseInt(K.style.height) * 100 + "%");
697
+ }
698
+ },
699
+ _onDragStart: function(e, t) {
700
+ var n = this, r = e.dataTransfer, i = n.options;
701
+ if (H("dragStart", this, { evt: e }), Q.eventCanceled) {
702
+ this._onDrop();
703
+ return;
704
+ }
705
+ H("setupClone", this), Q.eventCanceled || (J = tt(W), J.removeAttribute("id"), J.draggable = !1, J.style["will-change"] = "", this._hideClone(), L(J, this.options.chosenClass, !1), Q.clone = J), n.cloneId = on(function() {
706
+ H("clone", n), !Q.eventCanceled && (n.options.removeCloneOnHide || q.insertBefore(J, W), n._hideClone(), U({
707
+ sortable: n,
708
+ name: "clone"
709
+ }));
710
+ }), !t && L(W, i.dragClass, !0), t ? (yt = !0, n._loopId = setInterval(n._emulateDragOver, 50)) : (F(document, "mouseup", n._onDrop), F(document, "touchend", n._onDrop), F(document, "touchcancel", n._onDrop), r && (r.effectAllowed = "move", i.setData && i.setData.call(n, r, W)), P(document, "drop", n), R(W, "transform", "translateZ(0)")), vt = !0, n._dragStartId = on(n._dragStarted.bind(n, t, e)), P(document, "selectstart", n), Dt = !0, window.getSelection().removeAllRanges(), Ne && R(document.body, "user-select", "none");
711
+ },
712
+ _onDragOver: function(e) {
713
+ var t = this.el, n = e.target, r, i, a, o = this.options, s = o.group, c = Q.active, l = _t === s, u = o.sort, d = X || c, f, p = this, m = !1;
714
+ if (Pt) return;
715
+ function h(o, s) {
716
+ H(o, p, Se({
717
+ evt: e,
718
+ isOwner: l,
719
+ axis: f ? "vertical" : "horizontal",
720
+ revert: a,
721
+ dragRect: r,
722
+ targetRect: i,
723
+ canSort: u,
724
+ fromSortable: d,
725
+ target: n,
726
+ completed: _,
727
+ onMove: function(n, i) {
728
+ return Xt(q, t, W, r, n, z(n), e, i);
729
+ },
730
+ changed: v
731
+ }, s));
732
+ }
733
+ function g() {
734
+ h("dragOverAnimationCapture"), p.captureAnimationState(), p !== d && d.captureAnimationState();
735
+ }
736
+ function _(r) {
737
+ return h("dragOverCompleted", { insertion: r }), r && (l ? c._hideClone() : c._showClone(p), p !== d && (L(W, X ? X.options.ghostClass : c.options.ghostClass, !1), L(W, o.ghostClass, !0)), X !== p && p !== Q.active ? X = p : p === Q.active && X && (X = null), d === p && (p._ignoreWhileAnimating = n), p.animateAll(function() {
738
+ h("dragOverAnimationComplete"), p._ignoreWhileAnimating = null;
739
+ }), p !== d && (d.animateAll(), d._ignoreWhileAnimating = null)), (n === W && !W.animated || n === t && !n.animated) && (Ot = null), !o.dragoverBubble && !e.rootEl && n !== document && (W.parentNode[V]._isOutsideThisEl(e.target), !r && qt(e)), !o.dragoverBubble && e.stopPropagation && e.stopPropagation(), m = !0;
740
+ }
741
+ function v() {
742
+ Y = B(W), gt = B(W, o.draggable), U({
743
+ sortable: p,
744
+ name: "change",
745
+ toEl: t,
746
+ newIndex: Y,
747
+ newDraggableIndex: gt,
748
+ originalEvent: e
749
+ });
750
+ }
751
+ if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), n = I(n, o.draggable, t, !0), h("dragOver"), Q.eventCanceled) return m;
752
+ if (W.contains(e.target) || n.animated && n.animatingX && n.animatingY || p._ignoreWhileAnimating === n) return _(!1);
753
+ if (yt = !1, c && !o.disabled && (l ? u || (a = G !== q) : X === this || (this.lastPutMode = _t.checkPull(this, c, W, e)) && s.checkPut(this, c, W, e))) {
754
+ if (f = this._getDirection(e, n) === "vertical", r = z(W), h("dragOverValid"), Q.eventCanceled) return m;
755
+ if (a) return G = q, g(), this._hideClone(), h("revert"), Q.eventCanceled || (dt ? q.insertBefore(W, dt) : q.appendChild(W)), _(!0);
756
+ var y = Ge(t, o.draggable);
757
+ if (!y || en(e, f, this) && !y.animated) {
758
+ if (y === W) return _(!1);
759
+ if (y && t === e.target && (n = y), n && (i = z(n)), Xt(q, t, W, r, n, i, e, !!n) !== !1) return g(), y && y.nextSibling ? t.insertBefore(W, y.nextSibling) : t.appendChild(W), G = t, v(), _(!0);
760
+ } else if (y && $t(e, f, this)) {
761
+ var b = We(t, 0, o, !0);
762
+ if (b === W) return _(!1);
763
+ if (n = b, i = z(n), Xt(q, t, W, r, n, i, e, !1) !== !1) return g(), t.insertBefore(W, b), G = t, v(), _(!0);
764
+ } else if (n.parentNode === t) {
765
+ i = z(n);
766
+ var x = 0, S, ee = W.parentNode !== t, C = !Ht(W.animated && W.toRect || r, n.animated && n.toRect || i, f), w = f ? "top" : "left", T = Ue(n, "top", "top") || Ue(W, "top", "top"), te = T ? T.scrollTop : void 0;
767
+ Ot !== n && (S = i[w], At = !1, jt = !C && o.invertSwap || ee), x = tn(e, n, i, f, C ? 1 : o.swapThreshold, o.invertedSwapThreshold == null ? o.swapThreshold : o.invertedSwapThreshold, jt, Ot === n);
768
+ var E;
769
+ if (x !== 0) {
770
+ var D = B(W);
771
+ do
772
+ D -= x, E = G.children[D];
773
+ while (E && (R(E, "display") === "none" || E === K));
774
+ }
775
+ if (x === 0 || E === n) return _(!1);
776
+ Ot = n, kt = x;
777
+ var O = n.nextElementSibling, k = !1;
778
+ k = x === 1;
779
+ var ne = Xt(q, t, W, r, n, i, e, k);
780
+ if (ne !== !1) return (ne === 1 || ne === -1) && (k = ne === 1), Pt = !0, setTimeout(Qt, 30), g(), k && !O ? t.appendChild(W) : n.parentNode.insertBefore(W, k ? O : n), T && et(T, 0, te - T.scrollTop), G = W.parentNode, S !== void 0 && !jt && (Mt = Math.abs(S - z(n)[w])), v(), _(!0);
781
+ }
782
+ if (t.contains(W)) return _(!1);
783
+ }
784
+ return !1;
785
+ },
786
+ _ignoreWhileAnimating: null,
787
+ _offMoveEvents: function() {
788
+ F(document, "mousemove", this._onTouchMove), F(document, "touchmove", this._onTouchMove), F(document, "pointermove", this._onTouchMove), F(document, "dragover", qt), F(document, "mousemove", qt), F(document, "touchmove", qt);
789
+ },
790
+ _offUpEvents: function() {
791
+ var e = this.el.ownerDocument;
792
+ F(e, "mouseup", this._onDrop), F(e, "touchend", this._onDrop), F(e, "pointerup", this._onDrop), F(e, "pointercancel", this._onDrop), F(e, "touchcancel", this._onDrop), F(document, "selectstart", this);
793
+ },
794
+ _onDrop: function(e) {
795
+ var t = this.el, n = this.options;
796
+ if (Y = B(W), gt = B(W, n.draggable), H("drop", this, { evt: e }), G = W && W.parentNode, Y = B(W), gt = B(W, n.draggable), Q.eventCanceled) {
797
+ this._nulling();
798
+ return;
799
+ }
800
+ vt = !1, jt = !1, At = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), sn(this.cloneId), sn(this._dragStartId), this.nativeDraggable && (F(document, "drop", this), F(t, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Ne && R(document.body, "user-select", ""), R(W, "transform", ""), e && (Dt && (e.cancelable && e.preventDefault(), !n.dropBubble && e.stopPropagation()), K && K.parentNode && K.parentNode.removeChild(K), (q === G || X && X.lastPutMode !== "clone") && J && J.parentNode && J.parentNode.removeChild(J), W && (this.nativeDraggable && F(W, "dragend", this), Zt(W), W.style["will-change"] = "", Dt && !vt && L(W, X ? X.options.ghostClass : this.options.ghostClass, !1), L(W, this.options.chosenClass, !1), U({
801
+ sortable: this,
802
+ name: "unchoose",
803
+ toEl: G,
804
+ newIndex: null,
805
+ newDraggableIndex: null,
806
+ originalEvent: e
807
+ }), q === G ? Y !== mt && Y >= 0 && (U({
808
+ sortable: this,
809
+ name: "update",
810
+ toEl: G,
811
+ originalEvent: e
812
+ }), U({
813
+ sortable: this,
814
+ name: "sort",
815
+ toEl: G,
816
+ originalEvent: e
817
+ })) : (Y >= 0 && (U({
818
+ rootEl: G,
819
+ name: "add",
820
+ toEl: G,
821
+ fromEl: q,
822
+ originalEvent: e
823
+ }), U({
824
+ sortable: this,
825
+ name: "remove",
826
+ toEl: G,
827
+ originalEvent: e
828
+ }), U({
829
+ rootEl: G,
830
+ name: "sort",
831
+ toEl: G,
832
+ fromEl: q,
833
+ originalEvent: e
834
+ }), U({
835
+ sortable: this,
836
+ name: "sort",
837
+ toEl: G,
838
+ originalEvent: e
839
+ })), X && X.save()), Q.active && ((Y == null || Y === -1) && (Y = mt, gt = ht), U({
840
+ sortable: this,
841
+ name: "end",
842
+ toEl: G,
843
+ originalEvent: e
844
+ }), this.save()))), this._nulling();
845
+ },
846
+ _nulling: function() {
847
+ H("nulling", this), q = W = G = K = dt = J = ft = pt = xt = St = Dt = Y = gt = mt = ht = Ot = kt = X = _t = Q.dragged = Q.ghost = Q.clone = Q.active = null;
848
+ var e = this.el;
849
+ Ft.forEach(function(t) {
850
+ e.contains(t) && (t.checked = !0);
851
+ }), Ft.length = Ct = wt = 0;
852
+ },
853
+ handleEvent: function(e) {
854
+ switch (e.type) {
855
+ case "drop":
856
+ case "dragend":
857
+ this._onDrop(e);
858
+ break;
859
+ case "dragenter":
860
+ case "dragover":
861
+ W && (this._onDragOver(e), Yt(e));
862
+ break;
863
+ case "selectstart":
864
+ e.preventDefault();
865
+ break;
866
+ }
867
+ },
868
+ toArray: function() {
869
+ for (var e = [], t, n = this.el.children, r = 0, i = n.length, a = this.options; r < i; r++) t = n[r], I(t, a.draggable, this.el, !1) && e.push(t.getAttribute(a.dataIdAttr) || rn(t));
870
+ return e;
871
+ },
872
+ sort: function(e, t) {
873
+ var n = {}, r = this.el;
874
+ this.toArray().forEach(function(e, t) {
875
+ var i = r.children[t];
876
+ I(i, this.options.draggable, r, !1) && (n[e] = i);
877
+ }, this), t && this.captureAnimationState(), e.forEach(function(e) {
878
+ n[e] && (r.removeChild(n[e]), r.appendChild(n[e]));
879
+ }), t && this.animateAll();
880
+ },
881
+ save: function() {
882
+ var e = this.options.store;
883
+ e && e.set && e.set(this);
884
+ },
885
+ closest: function(e, t) {
886
+ return I(e, t || this.options.draggable, this.el, !1);
887
+ },
888
+ option: function(e, t) {
889
+ var n = this.options;
890
+ if (t === void 0) return n[e];
891
+ var r = ct.modifyOption(this, e, t);
892
+ r === void 0 ? n[e] = t : n[e] = r, e === "group" && Wt(n);
893
+ },
894
+ destroy: function() {
895
+ H("destroy", this);
896
+ var e = this.el;
897
+ e[V] = null, F(e, "mousedown", this._onTapStart), F(e, "touchstart", this._onTapStart), F(e, "pointerdown", this._onTapStart), this.nativeDraggable && (F(e, "dragover", this), F(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(e) {
898
+ e.removeAttribute("draggable");
899
+ }), this._onDrop(), this._disableDelayedDragEvents(), bt.splice(bt.indexOf(this.el), 1), this.el = e = null;
900
+ },
901
+ _hideClone: function() {
902
+ if (!pt) {
903
+ if (H("hideClone", this), Q.eventCanceled) return;
904
+ R(J, "display", "none"), this.options.removeCloneOnHide && J.parentNode && J.parentNode.removeChild(J), pt = !0;
905
+ }
906
+ },
907
+ _showClone: function(e) {
908
+ if (e.lastPutMode !== "clone") {
909
+ this._hideClone();
910
+ return;
911
+ }
912
+ if (pt) {
913
+ if (H("showClone", this), Q.eventCanceled) return;
914
+ W.parentNode == q && !this.options.group.revertClone ? q.insertBefore(J, W) : dt ? q.insertBefore(J, dt) : q.appendChild(J), this.options.group.revertClone && this.animate(W, J), R(J, "display", ""), pt = !1;
915
+ }
916
+ }
917
+ };
918
+ function Yt(e) {
919
+ e.dataTransfer && (e.dataTransfer.dropEffect = "move"), e.cancelable && e.preventDefault();
920
+ }
921
+ function Xt(e, t, n, r, i, a, o, s) {
922
+ var c, l = e[V], u = l.options.onMove, d;
923
+ return window.CustomEvent && !Ae && !je ? c = new CustomEvent("move", {
924
+ bubbles: !0,
925
+ cancelable: !0
926
+ }) : (c = document.createEvent("Event"), c.initEvent("move", !0, !0)), c.to = t, c.from = e, c.dragged = n, c.draggedRect = r, c.related = i || t, c.relatedRect = a || z(t), c.willInsertAfter = s, c.originalEvent = o, e.dispatchEvent(c), u && (d = u.call(l, c, o)), d;
927
+ }
928
+ function Zt(e) {
929
+ e.draggable = !1;
930
+ }
931
+ function Qt() {
932
+ Pt = !1;
933
+ }
934
+ function $t(e, t, n) {
935
+ var r = z(We(n.el, 0, n.options, !0)), i = nt(n.el, n.options, K), a = 10;
936
+ return t ? e.clientX < i.left - a || e.clientY < r.top && e.clientX < r.right : e.clientY < i.top - a || e.clientY < r.bottom && e.clientX < r.left;
937
+ }
938
+ function en(e, t, n) {
939
+ var r = z(Ge(n.el, n.options.draggable)), i = nt(n.el, n.options, K), a = 10;
940
+ return t ? e.clientX > i.right + a || e.clientY > r.bottom && e.clientX > r.left : e.clientY > i.bottom + a || e.clientX > r.right && e.clientY > r.top;
941
+ }
942
+ function tn(e, t, n, r, i, a, o, s) {
943
+ var c = r ? e.clientY : e.clientX, l = r ? n.height : n.width, u = r ? n.top : n.left, d = r ? n.bottom : n.right, f = !1;
944
+ if (!o) {
945
+ if (s && Mt < l * i) {
946
+ if (!At && (kt === 1 ? c > u + l * a / 2 : c < d - l * a / 2) && (At = !0), At) f = !0;
947
+ else if (kt === 1 ? c < u + Mt : c > d - Mt) return -kt;
948
+ } else if (c > u + l * (1 - i) / 2 && c < d - l * (1 - i) / 2) return nn(t);
949
+ }
950
+ return f ||= o, f && (c < u + l * a / 2 || c > d - l * a / 2) ? c > u + l / 2 ? 1 : -1 : 0;
951
+ }
952
+ function nn(e) {
953
+ return B(W) < B(e) ? 1 : -1;
954
+ }
955
+ function rn(e) {
956
+ for (var t = e.tagName + e.className + e.src + e.href + e.textContent, n = t.length, r = 0; n--;) r += t.charCodeAt(n);
957
+ return r.toString(36);
958
+ }
959
+ function an(e) {
960
+ Ft.length = 0;
961
+ for (var t = e.getElementsByTagName("input"), n = t.length; n--;) {
962
+ var r = t[n];
963
+ r.checked && Ft.push(r);
964
+ }
965
+ }
966
+ function on(e) {
967
+ return setTimeout(e, 0);
968
+ }
969
+ function sn(e) {
970
+ return clearTimeout(e);
971
+ }
972
+ It && P(document, "touchmove", function(e) {
973
+ (Q.active || vt) && e.cancelable && e.preventDefault();
974
+ }), Q.utils = {
975
+ on: P,
976
+ off: F,
977
+ css: R,
978
+ find: Ve,
979
+ is: function(e, t) {
980
+ return !!I(e, t, e, !1);
981
+ },
982
+ extend: Ye,
983
+ throttle: Qe,
984
+ closest: I,
985
+ toggleClass: L,
986
+ clone: tt,
987
+ index: B,
988
+ nextTick: on,
989
+ cancelNextTick: sn,
990
+ detectDirection: Vt,
991
+ getChild: We,
992
+ expando: V
993
+ }, Q.get = function(e) {
994
+ return e[V];
995
+ }, Q.mount = function() {
996
+ var e = [...arguments];
997
+ e[0].constructor === Array && (e = e[0]), e.forEach(function(e) {
998
+ if (!e.prototype || !e.prototype.constructor) throw `Sortable: Mounted plugin must be a constructor function, not ${{}.toString.call(e)}`;
999
+ e.utils && (Q.utils = Se(Se({}, Q.utils), e.utils)), ct.mount(e);
1000
+ });
1001
+ }, Q.create = function(e, t) {
1002
+ return new Q(e, t);
1003
+ }, Q.version = Oe;
1004
+ var $ = [], cn, ln, un = !1, dn, fn, pn, mn;
1005
+ function hn() {
1006
+ function e() {
1007
+ for (var e in this.defaults = {
1008
+ scroll: !0,
1009
+ forceAutoScrollFallback: !1,
1010
+ scrollSensitivity: 30,
1011
+ scrollSpeed: 10,
1012
+ bubbleScroll: !0
1013
+ }, this) e.charAt(0) === "_" && typeof this[e] == "function" && (this[e] = this[e].bind(this));
1014
+ }
1015
+ return e.prototype = {
1016
+ dragStarted: function(e) {
1017
+ var t = e.originalEvent;
1018
+ this.sortable.nativeDraggable ? P(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? P(document, "pointermove", this._handleFallbackAutoScroll) : t.touches ? P(document, "touchmove", this._handleFallbackAutoScroll) : P(document, "mousemove", this._handleFallbackAutoScroll);
1019
+ },
1020
+ dragOverCompleted: function(e) {
1021
+ var t = e.originalEvent;
1022
+ !this.options.dragOverBubble && !t.rootEl && this._handleAutoScroll(t);
1023
+ },
1024
+ drop: function() {
1025
+ this.sortable.nativeDraggable ? F(document, "dragover", this._handleAutoScroll) : (F(document, "pointermove", this._handleFallbackAutoScroll), F(document, "touchmove", this._handleFallbackAutoScroll), F(document, "mousemove", this._handleFallbackAutoScroll)), _n(), gn(), $e();
1026
+ },
1027
+ nulling: function() {
1028
+ pn = ln = cn = un = mn = dn = fn = null, $.length = 0;
1029
+ },
1030
+ _handleFallbackAutoScroll: function(e) {
1031
+ this._handleAutoScroll(e, !0);
1032
+ },
1033
+ _handleAutoScroll: function(e, t) {
1034
+ var n = this, r = (e.touches ? e.touches[0] : e).clientX, i = (e.touches ? e.touches[0] : e).clientY, a = document.elementFromPoint(r, i);
1035
+ if (pn = e, t || this.options.forceAutoScrollFallback || je || Ae || Ne) {
1036
+ vn(e, this.options, a, t);
1037
+ var o = Je(a, !0);
1038
+ un && (!mn || r !== dn || i !== fn) && (mn && _n(), mn = setInterval(function() {
1039
+ var a = Je(document.elementFromPoint(r, i), !0);
1040
+ a !== o && (o = a, gn()), vn(e, n.options, a, t);
1041
+ }, 10), dn = r, fn = i);
1042
+ } else {
1043
+ if (!this.options.bubbleScroll || Je(a, !0) === He()) {
1044
+ gn();
1045
+ return;
1046
+ }
1047
+ vn(e, this.options, Je(a, !1), !1);
1048
+ }
1049
+ }
1050
+ }, be(e, {
1051
+ pluginName: "scroll",
1052
+ initializeByDefault: !0
1053
+ });
1054
+ }
1055
+ function gn() {
1056
+ $.forEach(function(e) {
1057
+ clearInterval(e.pid);
1058
+ }), $ = [];
1059
+ }
1060
+ function _n() {
1061
+ clearInterval(mn);
1062
+ }
1063
+ var vn = Qe(function(e, t, n, r) {
1064
+ if (t.scroll) {
1065
+ var i = (e.touches ? e.touches[0] : e).clientX, a = (e.touches ? e.touches[0] : e).clientY, o = t.scrollSensitivity, s = t.scrollSpeed, c = He(), l = !1, u;
1066
+ ln !== n && (ln = n, gn(), cn = t.scroll, u = t.scrollFn, cn === !0 && (cn = Je(n, !0)));
1067
+ var d = 0, f = cn;
1068
+ do {
1069
+ var p = f, m = z(p), h = m.top, g = m.bottom, _ = m.left, v = m.right, y = m.width, b = m.height, x = void 0, S = void 0, ee = p.scrollWidth, C = p.scrollHeight, w = R(p), T = p.scrollLeft, te = p.scrollTop;
1070
+ p === c ? (x = y < ee && (w.overflowX === "auto" || w.overflowX === "scroll" || w.overflowX === "visible"), S = b < C && (w.overflowY === "auto" || w.overflowY === "scroll" || w.overflowY === "visible")) : (x = y < ee && (w.overflowX === "auto" || w.overflowX === "scroll"), S = b < C && (w.overflowY === "auto" || w.overflowY === "scroll"));
1071
+ var E = x && (Math.abs(v - i) <= o && T + y < ee) - (Math.abs(_ - i) <= o && !!T), D = S && (Math.abs(g - a) <= o && te + b < C) - (Math.abs(h - a) <= o && !!te);
1072
+ if (!$[d]) for (var O = 0; O <= d; O++) $[O] || ($[O] = {});
1073
+ ($[d].vx != E || $[d].vy != D || $[d].el !== p) && ($[d].el = p, $[d].vx = E, $[d].vy = D, clearInterval($[d].pid), (E != 0 || D != 0) && (l = !0, $[d].pid = setInterval(function() {
1074
+ r && this.layer === 0 && Q.active._onTouchMove(pn);
1075
+ var t = $[this.layer].vy ? $[this.layer].vy * s : 0, n = $[this.layer].vx ? $[this.layer].vx * s : 0;
1076
+ typeof u == "function" && u.call(Q.dragged.parentNode[V], n, t, e, pn, $[this.layer].el) !== "continue" || et($[this.layer].el, n, t);
1077
+ }.bind({ layer: d }), 24))), d++;
1078
+ } while (t.bubbleScroll && f !== c && (f = Je(f, !1)));
1079
+ un = l;
1080
+ }
1081
+ }, 30), yn = function(e) {
1082
+ var t = e.originalEvent, n = e.putSortable, r = e.dragEl, i = e.activeSortable, a = e.dispatchSortableEvent, o = e.hideGhostForTarget, s = e.unhideGhostForTarget;
1083
+ if (t) {
1084
+ var c = n || i;
1085
+ o();
1086
+ var l = t.changedTouches && t.changedTouches.length ? t.changedTouches[0] : t, u = document.elementFromPoint(l.clientX, l.clientY);
1087
+ s(), c && !c.el.contains(u) && (a("spill"), this.onSpill({
1088
+ dragEl: r,
1089
+ putSortable: n
1090
+ }));
1091
+ }
1092
+ };
1093
+ function bn() {}
1094
+ bn.prototype = {
1095
+ startIndex: null,
1096
+ dragStart: function(e) {
1097
+ var t = e.oldDraggableIndex;
1098
+ this.startIndex = t;
1099
+ },
1100
+ onSpill: function(e) {
1101
+ var t = e.dragEl, n = e.putSortable;
1102
+ this.sortable.captureAnimationState(), n && n.captureAnimationState();
1103
+ var r = We(this.sortable.el, this.startIndex, this.options);
1104
+ r ? this.sortable.el.insertBefore(t, r) : this.sortable.el.appendChild(t), this.sortable.animateAll(), n && n.animateAll();
1105
+ },
1106
+ drop: yn
1107
+ }, be(bn, { pluginName: "revertOnSpill" });
1108
+ function xn() {}
1109
+ xn.prototype = {
1110
+ onSpill: function(e) {
1111
+ var t = e.dragEl, n = e.putSortable || this.sortable;
1112
+ n.captureAnimationState(), t.parentNode && t.parentNode.removeChild(t), n.animateAll();
1113
+ },
1114
+ drop: yn
1115
+ }, be(xn, { pluginName: "removeOnSpill" }), Q.mount(new hn()), Q.mount(xn, bn);
1116
+ //#endregion
1117
+ //#region src/designer/CockpitWidgetPreview.vue?vue&type=script&setup=true&lang.ts
1118
+ var Sn = ["src", "alt"], Cn = { class: "lumal-cockpit-designer__widget-preview-fallback" }, wn = /* @__PURE__ */ x({
1119
+ __name: "CockpitWidgetPreview",
1120
+ props: {
1121
+ cockpitId: {},
1122
+ definition: {},
1123
+ instanceId: {},
1124
+ layoutId: {},
1125
+ messageBus: {},
1126
+ baseWidth: { default: 480 },
1127
+ baseHeight: { default: 270 }
1128
+ },
1129
+ setup(e) {
1130
+ let t = e, n = D(null), r = t.messageBus ?? c(), i = re({
1131
+ cockpitId: t.cockpitId,
1132
+ layoutId: t.layoutId,
1133
+ instanceId: t.instanceId,
1134
+ mode: "design",
1135
+ messages: r
1136
+ });
1137
+ se(() => {
1138
+ i.cockpitId = t.cockpitId, i.layoutId = t.layoutId, i.instanceId = t.instanceId;
1139
+ }), u(i);
1140
+ let a = m(() => l(t.definition.component)), { result: s } = d(n, {
1141
+ baseWidth: () => t.baseWidth,
1142
+ baseHeight: () => t.baseHeight
1143
+ }), f = m(() => ({
1144
+ width: `${t.baseWidth}px`,
1145
+ height: `${t.baseHeight}px`,
1146
+ transform: `translate(${s.value.offsetX}px, ${s.value.offsetY}px) scale(${s.value.scale})`,
1147
+ transformOrigin: "top left"
1148
+ }));
1149
+ return T(() => {
1150
+ r.clearInstance(t.instanceId);
1151
+ }), (t, r) => (E(), _("div", {
1152
+ ref_key: "previewRef",
1153
+ ref: n,
1154
+ class: "lumal-cockpit-designer__widget-preview"
1155
+ }, [e.definition.thumbnail ? (E(), _("img", {
1156
+ key: 0,
1157
+ src: e.definition.thumbnail,
1158
+ alt: `${e.definition.label}预览`,
1159
+ class: "lumal-cockpit-designer__widget-preview-image"
1160
+ }, null, 8, Sn)) : (E(), _("div", {
1161
+ key: 1,
1162
+ class: "lumal-cockpit-designer__widget-preview-stage",
1163
+ style: w(f.value),
1164
+ inert: "",
1165
+ "aria-hidden": "true"
1166
+ }, [b(o, null, {
1167
+ error: j(() => [v("div", Cn, [b(A(N), {
1168
+ name: e.definition.icon || "lumal:grid",
1169
+ size: 28
1170
+ }, null, 8, ["name"]), r[0] ||= v("span", null, "预览不可用", -1)])]),
1171
+ default: j(() => [(E(), h(ne(a.value), { context: A(i) }, null, 8, ["context"]))]),
1172
+ _: 1
1173
+ })], 4))], 512));
1174
+ }
1175
+ }), Tn = {
1176
+ class: "lumal-cockpit-designer__library",
1177
+ "aria-label": "模块库"
1178
+ }, En = ["data-cockpit-library-type", "data-cockpit-library-title"], Dn = /* @__PURE__ */ x({
1179
+ __name: "CockpitComponentLibrary",
1180
+ props: {
1181
+ cockpitId: {},
1182
+ layoutId: {},
1183
+ registry: {},
1184
+ selectedType: {}
1185
+ },
1186
+ emits: ["selectWidget"],
1187
+ setup(e, { emit: t }) {
1188
+ let n = e, r = t, i = D(null), a, o = m(() => n.registry.listWidgets());
1189
+ return te(() => {
1190
+ i.value && (a = Q.create(i.value, {
1191
+ animation: 160,
1192
+ group: {
1193
+ name: "lumal-cockpit-designer-modules",
1194
+ pull: "clone",
1195
+ put: !1
1196
+ },
1197
+ sort: !1,
1198
+ draggable: ".lumal-cockpit-designer__library-card",
1199
+ ghostClass: "is-drag-ghost",
1200
+ chosenClass: "is-drag-chosen"
1201
+ }));
1202
+ }), T(() => {
1203
+ a?.destroy();
1204
+ }), (t, n) => (E(), _("aside", Tn, [v("div", {
1205
+ ref_key: "libraryRef",
1206
+ ref: i,
1207
+ class: "lumal-cockpit-designer__library-grid"
1208
+ }, [(E(!0), _(p, null, O(o.value, (t) => (E(), _("article", {
1209
+ key: t.type,
1210
+ class: C(["lumal-cockpit-designer__library-card", { "is-selected": e.selectedType === t.type }]),
1211
+ "data-cockpit-library-type": t.type,
1212
+ "data-cockpit-library-title": t.label
1213
+ }, [b(wn, {
1214
+ "cockpit-id": e.cockpitId,
1215
+ definition: t,
1216
+ "instance-id": `library-preview:${t.type}`,
1217
+ "layout-id": e.layoutId
1218
+ }, null, 8, [
1219
+ "cockpit-id",
1220
+ "definition",
1221
+ "instance-id",
1222
+ "layout-id"
1223
+ ]), b(A(M), {
1224
+ text: "",
1225
+ class: "lumal-cockpit-designer__library-select",
1226
+ "aria-label": `选择或拖动模块:${t.label}`,
1227
+ "aria-pressed": e.selectedType === t.type,
1228
+ onClick: (e) => r("selectWidget", t)
1229
+ }, {
1230
+ default: j(() => [y(ie(t.label), 1)]),
1231
+ _: 2
1232
+ }, 1032, [
1233
+ "aria-label",
1234
+ "aria-pressed",
1235
+ "onClick"
1236
+ ])], 10, En))), 128)), o.value.length ? g("", !0) : (E(), h(A(ue), {
1237
+ key: 0,
1238
+ class: "lumal-cockpit-designer__library-empty",
1239
+ description: "暂无可用模块",
1240
+ "image-size": 56
1241
+ }))], 512)]));
1242
+ }
1243
+ });
1244
+ //#endregion
1245
+ //#region src/designer/confirmWidgetReplacement.ts
1246
+ async function On() {
1247
+ try {
1248
+ return await me.confirm("目标槽位已有模块,是否替换?", "确认替换", {
1249
+ cancelButtonText: "取消",
1250
+ confirmButtonText: "替换",
1251
+ type: "warning"
1252
+ }), !0;
1253
+ } catch {
1254
+ return !1;
1255
+ }
1256
+ }
1257
+ //#endregion
1258
+ //#region src/designer/CockpitWidgetDropZone.vue
1259
+ var kn = /* @__PURE__ */ x({
1260
+ __name: "CockpitWidgetDropZone",
1261
+ props: {
1262
+ allowMultiple: {
1263
+ type: Boolean,
1264
+ default: !1
1265
+ },
1266
+ dragHandle: { default: "" },
1267
+ sortableTarget: { default: "" },
1268
+ target: {},
1269
+ widget: { default: void 0 }
1270
+ },
1271
+ emits: ["drop"],
1272
+ setup(e, { emit: t }) {
1273
+ let n = e, r = t, i = D(null), a;
1274
+ function o(e) {
1275
+ if (e) try {
1276
+ let t = JSON.parse(e);
1277
+ if (t.kind === "cell" || t.kind === "tabs") return t;
1278
+ } catch {
1279
+ return;
1280
+ }
1281
+ }
1282
+ function s(e) {
1283
+ return e.to !== e.from || n.allowMultiple;
1284
+ }
1285
+ function c(e, t = !1) {
1286
+ let n = o(e.dataset.cockpitDragSource), r = e.dataset.cockpitLibraryType;
1287
+ return n ? {
1288
+ source: n,
1289
+ replace: t
1290
+ } : r ? {
1291
+ library: {
1292
+ type: r,
1293
+ title: e.dataset.cockpitLibraryTitle
1294
+ },
1295
+ replace: t
1296
+ } : {};
1297
+ }
1298
+ async function l(e) {
1299
+ let t = e.item, i = c(t), a = !n.allowMultiple && !!n.widget;
1300
+ if (a && !await On()) {
1301
+ if (i.source) {
1302
+ let n = e.from.children.item(e.oldIndex ?? e.from.children.length);
1303
+ e.from.insertBefore(t, n);
1304
+ } else t.remove();
1305
+ return;
1306
+ }
1307
+ r("drop", {
1308
+ ...i,
1309
+ replace: a
1310
+ }), ee(() => t.remove());
1311
+ }
1312
+ return te(() => {
1313
+ if (!i.value) return;
1314
+ let e = n.sortableTarget ? i.value.querySelector(n.sortableTarget) : i.value;
1315
+ e && (a = Q.create(e, {
1316
+ animation: 160,
1317
+ group: {
1318
+ name: "lumal-cockpit-designer-modules",
1319
+ pull: !0,
1320
+ put: !0
1321
+ },
1322
+ handle: n.dragHandle || void 0,
1323
+ sort: n.allowMultiple,
1324
+ draggable: ".lumal-cockpit-designer__drag-item",
1325
+ ghostClass: "is-drag-ghost",
1326
+ chosenClass: "is-drag-chosen",
1327
+ onMove: s,
1328
+ onAdd: (e) => void l(e),
1329
+ onUpdate(e) {
1330
+ n.allowMultiple && e.oldIndex !== void 0 && e.newIndex !== void 0 && r("drop", { reorder: {
1331
+ oldIndex: e.oldIndex,
1332
+ newIndex: e.newIndex
1333
+ } });
1334
+ }
1335
+ }));
1336
+ }), T(() => {
1337
+ a?.destroy();
1338
+ }), (t, n) => (E(), _("div", {
1339
+ ref_key: "zoneRef",
1340
+ ref: i,
1341
+ class: C(["lumal-cockpit-designer__drop-zone", { "is-tabs": e.allowMultiple }])
1342
+ }, [k(t.$slots, "default")], 2));
1343
+ }
1344
+ }), An = ["data-side"], jn = ["aria-label"], Mn = { class: "lumal-cockpit-designer__region-head-meta" }, Nn = { class: "lumal-cockpit-designer__field" }, Pn = { class: "lumal-cockpit-designer__field" }, Fn = { class: "lumal-cockpit-designer__field lumal-cockpit-designer__region-width-field" }, In = {
1345
+ key: 0,
1346
+ class: "lumal-cockpit-designer__grid-rows"
1347
+ }, Ln = ["aria-label"], Rn = { class: "lumal-cockpit-designer__field" }, zn = { class: "lumal-cockpit-designer__tabs-switch" }, Bn = ["data-cockpit-drag-source"], Vn = { class: "lumal-cockpit-designer__placed-widget-header" }, Hn = { class: "lumal-cockpit-designer__placed-widget-actions" }, Un = { class: "lumal-cockpit-designer__placed-widget-body" }, Wn = {
1348
+ key: 1,
1349
+ class: "lumal-cockpit-designer__widget-preview-fallback"
1350
+ }, Gn = ["aria-label"], Kn = ["data-cockpit-drag-source"], qn = ["id", "aria-labelledby"], Jn = {
1351
+ key: 1,
1352
+ class: "lumal-cockpit-designer__widget-preview-fallback"
1353
+ }, Yn = /* @__PURE__ */ x({
1354
+ __name: "CockpitLayoutEditor",
1355
+ props: {
1356
+ cockpitId: {},
1357
+ draft: {},
1358
+ registry: {},
1359
+ placementSelection: {},
1360
+ previewMessageBus: {},
1361
+ side: {}
1362
+ },
1363
+ emits: ["selectPlaced", "clearPlacement"],
1364
+ setup(e, { emit: t }) {
1365
+ let n = e, r = t, i = m(() => {
1366
+ let e = n.draft.activeLayout.value;
1367
+ if (e) return n.side === "left" ? e.left : e.right;
1368
+ });
1369
+ function a(e, t) {
1370
+ return {
1371
+ kind: "cell",
1372
+ side: n.side,
1373
+ rowId: e.id,
1374
+ cellId: t
1375
+ };
1376
+ }
1377
+ function o(e, t) {
1378
+ return {
1379
+ kind: "tabs",
1380
+ side: n.side,
1381
+ rowId: e.id,
1382
+ widgetId: t
1383
+ };
1384
+ }
1385
+ function s(e) {
1386
+ return n.registry.resolveWidget(e);
1387
+ }
1388
+ function c() {
1389
+ let e = i.value?.columns.length ?? 1;
1390
+ return Array.from({ length: Math.max(1, e) }, () => "minmax(0, 1fr)").join(" ");
1391
+ }
1392
+ function l(e) {
1393
+ return e.widgets.find((t) => t.id === e.activeWidgetId) ?? e.widgets[0];
1394
+ }
1395
+ function u(e, t) {
1396
+ return e.kind !== t.kind || e.side !== t.side || e.rowId !== t.rowId ? !1 : e.kind === "cell" ? e.cellId === t.cellId : e.widgetId === t.widgetId;
1397
+ }
1398
+ function d(e) {
1399
+ return n.placementSelection?.kind === "placed" && u(n.placementSelection.location, e);
1400
+ }
1401
+ function f(e) {
1402
+ let t = n.placementSelection;
1403
+ return !!(t && (t.kind !== "placed" || !u(t.location, e)));
1404
+ }
1405
+ function x(e, t) {
1406
+ n.draft.resizeRegion(n.side, e, t) || pe.warning("缩减区域会移除已放置模块,请先拖动模块到保留槽位后再操作。");
1407
+ }
1408
+ function S(e, t) {
1409
+ if (!n.draft.setRowTabs(n.side, e.id, t)) {
1410
+ pe.warning("Tab 行中的模块数超过当前列数,无法解除合并。");
1411
+ return;
1412
+ }
1413
+ n.placementSelection?.kind === "placed" && n.placementSelection.location.side === n.side && n.placementSelection.location.rowId === e.id && r("clearPlacement");
1414
+ }
1415
+ function T(e, t) {
1416
+ r("selectPlaced", {
1417
+ kind: "placed",
1418
+ location: e,
1419
+ widgetId: t.id,
1420
+ title: t.title ?? s(t.type)?.label ?? t.type
1421
+ });
1422
+ }
1423
+ function te(e) {
1424
+ d(e) && r("clearPlacement"), n.draft.removeWidget(e);
1425
+ }
1426
+ async function D(e) {
1427
+ let t = n.placementSelection;
1428
+ if (!t || t.kind === "placed" && u(t.location, e)) return;
1429
+ let i = !1;
1430
+ if (e.kind === "cell" && n.draft.hasWidgetAt(e) && (i = await On(), !i)) return;
1431
+ if (t.kind === "library") {
1432
+ n.draft.addWidget(e, t.type, t.title, i) || pe.warning("模块放置失败,请检查目标槽位。");
1433
+ return;
1434
+ }
1435
+ let a = n.draft.moveWidget(t.location, e, i);
1436
+ if (a.requiresReplace && await On() && (a = n.draft.moveWidget(t.location, e, !0)), !a.moved) {
1437
+ pe.warning("模块移动失败,请重新选择目标。");
1438
+ return;
1439
+ }
1440
+ r("clearPlacement");
1441
+ }
1442
+ function k(e, t) {
1443
+ if (t.reorder && e.kind === "tabs") {
1444
+ n.draft.reorderTabWidgets(n.side, e.rowId, t.reorder.oldIndex, t.reorder.newIndex);
1445
+ return;
1446
+ }
1447
+ if (t.library) {
1448
+ n.draft.addWidget(e, t.library.type, t.library.title, t.replace) || pe.warning("目标槽位已有模块,请确认替换后再操作。");
1449
+ return;
1450
+ }
1451
+ if (!t.source) return;
1452
+ let i = n.draft.moveWidget(t.source, e, t.replace);
1453
+ !i.moved && !i.requiresReplace ? pe.error("模块移动失败。") : i.moved && n.placementSelection?.kind === "placed" && u(n.placementSelection.location, t.source) && r("clearPlacement");
1454
+ }
1455
+ async function ne(e, t, r) {
1456
+ if (![
1457
+ "ArrowLeft",
1458
+ "ArrowRight",
1459
+ "Home",
1460
+ "End"
1461
+ ].includes(r.key) || !e.widgets.length) return;
1462
+ r.preventDefault();
1463
+ let i = e.widgets.length - 1, a = r.key === "Home" ? 0 : r.key === "End" ? i : r.key === "ArrowRight" ? (t + 1) % e.widgets.length : (t - 1 + e.widgets.length) % e.widgets.length;
1464
+ n.draft.setActiveTab(n.side, e.id, e.widgets[a].id), await ee(), r.currentTarget.closest("[role=\"tablist\"]")?.querySelectorAll("[role=\"tab\"]")[a]?.focus();
1465
+ }
1466
+ return (t, n) => (E(), _("section", {
1467
+ class: "lumal-cockpit-designer__region",
1468
+ "data-side": e.side
1469
+ }, [v("header", {
1470
+ class: "lumal-cockpit-designer__region-head",
1471
+ "data-role": "region-tools",
1472
+ role: "group",
1473
+ "aria-label": `${e.side === "left" ? "左侧" : "右侧"}区域布局设置`
1474
+ }, [
1475
+ v("div", Mn, [v("strong", null, ie(e.side === "left" ? "左侧区域" : "右侧区域"), 1), n[7] ||= v("span", null, "调整网格结构与区域宽", -1)]),
1476
+ v("label", Nn, [n[8] ||= v("span", null, "行", -1), b(A(fe), {
1477
+ "model-value": i.value?.rows.length ?? 1,
1478
+ min: 1,
1479
+ "aria-label": `${e.side === "left" ? "左侧" : "右侧"}区域行数`,
1480
+ onChange: n[0] ||= (e) => x(e ?? 1, i.value?.columns.length ?? 1)
1481
+ }, null, 8, ["model-value", "aria-label"])]),
1482
+ v("label", Pn, [n[9] ||= v("span", null, "列", -1), b(A(fe), {
1483
+ "model-value": i.value?.columns.length ?? 1,
1484
+ min: 1,
1485
+ "aria-label": `${e.side === "left" ? "左侧" : "右侧"}区域列数`,
1486
+ onChange: n[1] ||= (e) => x(i.value?.rows.length ?? 1, e ?? 1)
1487
+ }, null, 8, ["model-value", "aria-label"])]),
1488
+ v("label", Fn, [
1489
+ n[10] ||= v("span", null, "区域宽", -1),
1490
+ b(A(fe), {
1491
+ "model-value": i.value?.width ?? 0,
1492
+ min: Math.max(1, i.value?.columns.length ?? 1),
1493
+ "aria-label": `${e.side === "left" ? "左侧" : "右侧"}区域宽度像素`,
1494
+ onChange: n[2] ||= (t) => e.draft.setRegionWidth(e.side, t ?? i.value?.width ?? 0)
1495
+ }, null, 8, [
1496
+ "model-value",
1497
+ "min",
1498
+ "aria-label"
1499
+ ]),
1500
+ n[11] ||= v("em", null, "px", -1)
1501
+ ])
1502
+ ], 8, jn), i.value ? (E(), _("div", In, [(E(!0), _(p, null, O(i.value.rows, (t, r) => (E(), _("section", {
1503
+ key: t.id,
1504
+ class: "lumal-cockpit-designer__grid-row",
1505
+ style: w({ flex: `${t.height} 1 0` })
1506
+ }, [v("header", {
1507
+ class: "lumal-cockpit-designer__grid-row-head",
1508
+ "data-role": "row-tools",
1509
+ role: "group",
1510
+ "aria-label": `${e.side === "left" ? "左侧" : "右侧"}第 ${r + 1} 行布局设置`
1511
+ }, [
1512
+ v("strong", null, "第 " + ie(r + 1) + " 行", 1),
1513
+ v("label", Rn, [
1514
+ n[12] ||= v("span", null, "行高", -1),
1515
+ b(A(fe), {
1516
+ "model-value": t.height,
1517
+ min: 1,
1518
+ max: 100,
1519
+ precision: 3,
1520
+ "aria-label": `第 ${r + 1} 行高度百分比`,
1521
+ onChange: (n) => e.draft.setRowHeight(e.side, t.id, n ?? t.height)
1522
+ }, null, 8, [
1523
+ "model-value",
1524
+ "aria-label",
1525
+ "onChange"
1526
+ ]),
1527
+ n[13] ||= v("em", null, "%", -1)
1528
+ ]),
1529
+ v("label", zn, [n[14] ||= v("span", null, "合并列", -1), b(A(_e), {
1530
+ "model-value": t.mode === "tabs",
1531
+ onChange: (e) => S(t, !!e)
1532
+ }, null, 8, ["model-value", "onChange"])])
1533
+ ], 8, Ln), t.mode === "grid" ? (E(), _("div", {
1534
+ key: 0,
1535
+ class: "lumal-cockpit-designer__grid-cells",
1536
+ style: w({ gridTemplateColumns: c() })
1537
+ }, [(E(!0), _(p, null, O(t.cells, (r) => (E(), h(kn, {
1538
+ key: r.id,
1539
+ target: a(t, r.id),
1540
+ widget: r.widget,
1541
+ onDrop: (e) => k(a(t, r.id), e)
1542
+ }, {
1543
+ default: j(() => [r.widget ? (E(), _("article", {
1544
+ key: 0,
1545
+ class: C(["lumal-cockpit-designer__placed-widget lumal-cockpit-designer__drag-item", { "is-keyboard-selected": d(a(t, r.id)) }]),
1546
+ "data-cockpit-drag-source": JSON.stringify(a(t, r.id)),
1547
+ "data-role": "placed-widget"
1548
+ }, [v("header", Vn, [v("span", null, ie(r.widget.title ?? r.widget.type), 1), v("div", Hn, [
1549
+ b(A(ve), {
1550
+ content: "选择并移动模块",
1551
+ placement: "top"
1552
+ }, {
1553
+ default: j(() => [b(A(M), {
1554
+ class: "lumal-cockpit-designer__widget-action",
1555
+ "data-role": "select-move-source",
1556
+ "aria-label": `选择移动模块 ${r.widget.title ?? r.widget.type}`,
1557
+ "aria-pressed": d(a(t, r.id)),
1558
+ onMousedown: n[3] ||= ce(() => {}, ["stop"]),
1559
+ onClick: ce((e) => T(a(t, r.id), r.widget), ["stop"])
1560
+ }, {
1561
+ default: j(() => [b(A(N), {
1562
+ name: "lumal:more",
1563
+ size: 12
1564
+ })]),
1565
+ _: 1
1566
+ }, 8, [
1567
+ "aria-label",
1568
+ "aria-pressed",
1569
+ "onClick"
1570
+ ])]),
1571
+ _: 2
1572
+ }, 1024),
1573
+ f(a(t, r.id)) ? (E(), h(A(ve), {
1574
+ key: 0,
1575
+ content: "移动并替换到此槽位",
1576
+ placement: "top"
1577
+ }, {
1578
+ default: j(() => [b(A(M), {
1579
+ class: "lumal-cockpit-designer__widget-action",
1580
+ "data-role": "keyboard-target",
1581
+ "aria-label": `移动并替换 ${r.widget.title ?? r.widget.type}`,
1582
+ onMousedown: n[4] ||= ce(() => {}, ["stop"]),
1583
+ onClick: ce((e) => D(a(t, r.id)), ["stop"])
1584
+ }, {
1585
+ default: j(() => [b(A(N), {
1586
+ name: "lumal:plus",
1587
+ size: 12
1588
+ })]),
1589
+ _: 1
1590
+ }, 8, ["aria-label", "onClick"])]),
1591
+ _: 2
1592
+ }, 1024)) : g("", !0),
1593
+ b(A(ve), {
1594
+ content: "移除模块",
1595
+ placement: "top"
1596
+ }, {
1597
+ default: j(() => [b(A(M), {
1598
+ type: "danger",
1599
+ class: "lumal-cockpit-designer__widget-action",
1600
+ "data-role": "remove-widget",
1601
+ "aria-label": `移除模块 ${r.widget.title ?? r.widget.type}`,
1602
+ onClick: (e) => te(a(t, r.id))
1603
+ }, {
1604
+ default: j(() => [b(A(N), {
1605
+ name: "lumal:close",
1606
+ size: 12
1607
+ })]),
1608
+ _: 1
1609
+ }, 8, ["aria-label", "onClick"])]),
1610
+ _: 2
1611
+ }, 1024)
1612
+ ])]), v("div", Un, [s(r.widget.type) ? (E(), h(wn, {
1613
+ key: 0,
1614
+ "cockpit-id": e.cockpitId,
1615
+ definition: s(r.widget.type),
1616
+ "instance-id": r.widget.id,
1617
+ "layout-id": e.draft.activeLayout.value?.id ?? "",
1618
+ "message-bus": e.previewMessageBus
1619
+ }, null, 8, [
1620
+ "cockpit-id",
1621
+ "definition",
1622
+ "instance-id",
1623
+ "layout-id",
1624
+ "message-bus"
1625
+ ])) : (E(), _("div", Wn, " 未注册模块 "))])], 10, Bn)) : (E(), h(A(M), {
1626
+ key: 1,
1627
+ class: "lumal-cockpit-designer__empty-cell",
1628
+ plain: "",
1629
+ disabled: !e.placementSelection,
1630
+ "data-role": "keyboard-target",
1631
+ onClick: (e) => D(a(t, r.id))
1632
+ }, {
1633
+ default: j(() => [v("span", null, ie(e.placementSelection ? `放入 ${e.placementSelection.title}` : "请置入模块"), 1)]),
1634
+ _: 1
1635
+ }, 8, ["disabled", "onClick"]))]),
1636
+ _: 2
1637
+ }, 1032, [
1638
+ "target",
1639
+ "widget",
1640
+ "onDrop"
1641
+ ]))), 128))], 4)) : (E(), h(kn, {
1642
+ key: 1,
1643
+ class: "lumal-cockpit-designer__tab-row",
1644
+ "allow-multiple": "",
1645
+ "drag-handle": ".lumal-cockpit-designer__tab-move",
1646
+ "sortable-target": ".lumal-cockpit-designer__tab-list",
1647
+ target: o(t),
1648
+ onDrop: (e) => k(o(t), e)
1649
+ }, {
1650
+ default: j(() => [v("section", { class: C(["lumal-cockpit-designer__tab-card", { "is-empty": !t.widgets.length }]) }, [v("header", {
1651
+ class: "lumal-cockpit-designer__tab-list",
1652
+ role: "tablist",
1653
+ "aria-label": `${e.side === "left" ? "左侧" : "右侧"}第 ${r + 1} 行模块`
1654
+ }, [(E(!0), _(p, null, O(t.widgets, (r, i) => (E(), _("div", {
1655
+ key: r.id,
1656
+ class: C(["lumal-cockpit-designer__tab-item lumal-cockpit-designer__drag-item", {
1657
+ "is-active": t.activeWidgetId === r.id,
1658
+ "is-keyboard-selected": d(o(t, r.id))
1659
+ }]),
1660
+ "data-cockpit-drag-source": JSON.stringify(o(t, r.id))
1661
+ }, [
1662
+ b(A(M), {
1663
+ text: "",
1664
+ class: "lumal-cockpit-designer__tab-widget-title",
1665
+ role: "tab",
1666
+ id: `designer-tab-${r.id}`,
1667
+ "aria-controls": `designer-tabpanel-${t.id}`,
1668
+ "aria-selected": t.activeWidgetId === r.id,
1669
+ tabindex: t.activeWidgetId === r.id ? 0 : -1,
1670
+ onClick: (n) => e.draft.setActiveTab(e.side, t.id, r.id),
1671
+ onKeydown: (e) => ne(t, i, e)
1672
+ }, {
1673
+ default: j(() => [y(ie(r.title ?? r.type), 1)]),
1674
+ _: 2
1675
+ }, 1032, [
1676
+ "id",
1677
+ "aria-controls",
1678
+ "aria-selected",
1679
+ "tabindex",
1680
+ "onClick",
1681
+ "onKeydown"
1682
+ ]),
1683
+ b(A(ve), {
1684
+ content: "拖拽或选择移动 Tab",
1685
+ placement: "top"
1686
+ }, {
1687
+ default: j(() => [b(A(M), {
1688
+ class: "lumal-cockpit-designer__tab-action lumal-cockpit-designer__tab-move",
1689
+ "data-role": "select-move-source",
1690
+ "aria-label": `选择移动 Tab ${r.title ?? r.type}`,
1691
+ "aria-pressed": d(o(t, r.id)),
1692
+ onMousedown: n[5] ||= ce(() => {}, ["stop"]),
1693
+ onClick: ce((e) => T(o(t, r.id), r), ["stop"])
1694
+ }, {
1695
+ default: j(() => [b(A(N), {
1696
+ name: "lumal:more",
1697
+ size: 11
1698
+ })]),
1699
+ _: 1
1700
+ }, 8, [
1701
+ "aria-label",
1702
+ "aria-pressed",
1703
+ "onClick"
1704
+ ])]),
1705
+ _: 2
1706
+ }, 1024),
1707
+ b(A(ve), {
1708
+ content: "移除 Tab",
1709
+ placement: "top"
1710
+ }, {
1711
+ default: j(() => [b(A(M), {
1712
+ type: "danger",
1713
+ class: "lumal-cockpit-designer__tab-action",
1714
+ "data-role": "remove-widget",
1715
+ "aria-label": `移除 Tab 模块 ${r.title ?? r.type}`,
1716
+ onMousedown: n[6] ||= ce(() => {}, ["stop"]),
1717
+ onClick: ce((e) => te(o(t, r.id)), ["stop"])
1718
+ }, {
1719
+ default: j(() => [b(A(N), {
1720
+ name: "lumal:close",
1721
+ size: 11
1722
+ })]),
1723
+ _: 1
1724
+ }, 8, ["aria-label", "onClick"])]),
1725
+ _: 2
1726
+ }, 1024)
1727
+ ], 10, Kn))), 128)), t.widgets.length && e.placementSelection ? (E(), h(A(ve), {
1728
+ key: 0,
1729
+ content: "移入此 Tab 行",
1730
+ placement: "top"
1731
+ }, {
1732
+ default: j(() => [b(A(M), {
1733
+ class: "lumal-cockpit-designer__tab-target",
1734
+ "data-role": "keyboard-target",
1735
+ "aria-label": "移入此 Tab 行",
1736
+ onClick: (e) => D(o(t))
1737
+ }, {
1738
+ default: j(() => [b(A(N), {
1739
+ name: "lumal:plus",
1740
+ size: 12
1741
+ })]),
1742
+ _: 1
1743
+ }, 8, ["onClick"])]),
1744
+ _: 2
1745
+ }, 1024)) : g("", !0)], 8, Gn), v("div", {
1746
+ class: "lumal-cockpit-designer__tab-preview",
1747
+ role: "tabpanel",
1748
+ id: `designer-tabpanel-${t.id}`,
1749
+ "aria-labelledby": l(t) ? `designer-tab-${l(t).id}` : void 0
1750
+ }, [l(t) ? (E(), _(p, { key: 0 }, [s(l(t).type) ? (E(), h(wn, {
1751
+ key: l(t).id,
1752
+ "cockpit-id": e.cockpitId,
1753
+ definition: s(l(t).type),
1754
+ "instance-id": l(t).id,
1755
+ "layout-id": e.draft.activeLayout.value?.id ?? "",
1756
+ "message-bus": e.previewMessageBus
1757
+ }, null, 8, [
1758
+ "cockpit-id",
1759
+ "definition",
1760
+ "instance-id",
1761
+ "layout-id",
1762
+ "message-bus"
1763
+ ])) : (E(), _("div", Jn, " 未注册模块 "))], 64)) : (E(), h(A(M), {
1764
+ key: 1,
1765
+ class: "lumal-cockpit-designer__empty-cell",
1766
+ plain: "",
1767
+ disabled: !e.placementSelection,
1768
+ "data-role": "keyboard-target",
1769
+ onClick: (e) => D(o(t))
1770
+ }, {
1771
+ default: j(() => [v("span", null, ie(e.placementSelection ? `添加 ${e.placementSelection.title} 到 Tab` : "请置入模块"), 1)]),
1772
+ _: 1
1773
+ }, 8, ["disabled", "onClick"]))], 8, qn)], 2)]),
1774
+ _: 2
1775
+ }, 1032, ["target", "onDrop"]))], 4))), 128))])) : g("", !0)], 8, An));
1776
+ }
1777
+ });
1778
+ //#endregion
1779
+ //#region src/designer/useCockpitDraft.ts
1780
+ function Xn(e) {
1781
+ return JSON.parse(JSON.stringify(e));
1782
+ }
1783
+ function Zn(e) {
1784
+ return e.mode === "tabs" ? e.widgets : e.cells.flatMap((e) => e.widget ? [e.widget] : []);
1785
+ }
1786
+ function Qn(e) {
1787
+ return Zn(e).length > 0;
1788
+ }
1789
+ function $n(e) {
1790
+ if (!e.length) return;
1791
+ let t = e.reduce((e, t) => e + Math.max(0, t.height), 0);
1792
+ if (t <= 0) {
1793
+ let t = 100 / e.length;
1794
+ e.forEach((e) => {
1795
+ e.height = t;
1796
+ });
1797
+ return;
1798
+ }
1799
+ e.forEach((e) => {
1800
+ e.height = Number((Math.max(0, e.height) / t * 100).toFixed(3));
1801
+ });
1802
+ let n = Number((100 - e.reduce((e, t) => e + t.height, 0)).toFixed(3));
1803
+ e[e.length - 1].height = Number((e[e.length - 1].height + n).toFixed(3));
1804
+ }
1805
+ function er(e, t) {
1806
+ return t === "left" ? e.left : e.right;
1807
+ }
1808
+ function tr(e) {
1809
+ let i = JSON.parse(JSON.stringify(e));
1810
+ i.id = a().id;
1811
+ for (let e of ["left", "right"]) {
1812
+ let a = er(i, e);
1813
+ a.columns.forEach((e) => {
1814
+ e.id = n().id;
1815
+ }), a.rows.forEach((e) => {
1816
+ let n = e.mode === "tabs" ? Math.max(0, e.widgets.findIndex((t) => t.id === e.activeWidgetId)) : -1;
1817
+ e.id = s(1).id, e.cells.forEach((e) => {
1818
+ e.id = t().id, e.widget && (e.widget.id = r(e.widget.type).id);
1819
+ }), e.widgets.forEach((e) => {
1820
+ e.id = r(e.type).id;
1821
+ }), e.activeWidgetId = e.mode === "tabs" ? e.widgets[n]?.id : void 0;
1822
+ });
1823
+ }
1824
+ return i;
1825
+ }
1826
+ function nr(o) {
1827
+ let c = Xn(o), l = D(Xn(o)), u = D({ layoutId: o.activeLayoutId ?? o.layouts[0]?.id }), d = m(() => l.value.layouts), p = m(() => {
1828
+ let e = u.value.layoutId;
1829
+ return d.value.find((t) => t.id === e) ?? d.value[0];
1830
+ });
1831
+ function h(e, t) {
1832
+ let n = p.value;
1833
+ return n ? er(n, e).rows.find((e) => e.id === t) : void 0;
1834
+ }
1835
+ function g(e) {
1836
+ return h(e.side, e.rowId)?.cells.find((t) => t.id === e.cellId);
1837
+ }
1838
+ function _(e) {
1839
+ if (e.kind === "cell") return g(e)?.widget;
1840
+ let t = h(e.side, e.rowId)?.widgets ?? [];
1841
+ return e.widgetId ? t.find((t) => t.id === e.widgetId) : t[0];
1842
+ }
1843
+ function v() {
1844
+ let e = a(`布局 ${d.value.length + 1}`);
1845
+ l.value.layouts.push(e), l.value.activeLayoutId = e.id, u.value = { layoutId: e.id };
1846
+ }
1847
+ function y(e) {
1848
+ let t = d.value.findIndex((t) => t.id === e);
1849
+ if (t < 0) return;
1850
+ let n = tr(d.value[t]);
1851
+ n.title = `${n.title} 副本`, d.value.splice(t + 1, 0, n), u.value = { layoutId: n.id };
1852
+ }
1853
+ function b(e) {
1854
+ if (d.value.length <= 1) return !1;
1855
+ let t = d.value.findIndex((t) => t.id === e);
1856
+ if (t < 0) return !1;
1857
+ if (d.value.splice(t, 1), u.value.layoutId === e) {
1858
+ let e = d.value[t] ?? d.value[t - 1];
1859
+ u.value = { layoutId: e?.id }, l.value.activeLayoutId = e?.id;
1860
+ }
1861
+ return !0;
1862
+ }
1863
+ function x(e, t) {
1864
+ let n = d.value.find((t) => t.id === e);
1865
+ n && t.trim() && (n.title = t.trim());
1866
+ }
1867
+ function S(e) {
1868
+ d.value.some((t) => t.id === e) && (u.value = { layoutId: e }, l.value.activeLayoutId = e);
1869
+ }
1870
+ function ee(r, i, a, o = !1) {
1871
+ let c = p.value;
1872
+ if (!c) return !1;
1873
+ let l = er(c, r), u = Math.max(1, Math.floor(i)), d = Math.max(1, Math.floor(a)), f = l.rows.slice(u), m = l.rows.filter((e) => e.mode === "grid").flatMap((e) => e.cells.slice(d));
1874
+ if (!o && (f.some(Qn) || m.some((e) => e.widget))) return !1;
1875
+ for (; l.columns.length < d;) l.columns.push(n());
1876
+ for (l.columns.length > d && l.columns.splice(d), e(l), l.rows.forEach((e) => {
1877
+ if (e.mode === "grid") {
1878
+ for (; e.cells.length < d;) e.cells.push(t());
1879
+ e.cells.length > d && e.cells.splice(d);
1880
+ }
1881
+ }), l.rows.length > u && l.rows.splice(u); l.rows.length < u;) l.rows.push(s(d, "grid", 100 / u));
1882
+ return $n(l.rows), !0;
1883
+ }
1884
+ function C(t, n) {
1885
+ let r = p.value;
1886
+ if (!r || !Number.isFinite(n) || n <= 0) return;
1887
+ let i = er(r, t);
1888
+ i.width = Math.max(i.columns.length, Math.round(n)), e(i);
1889
+ }
1890
+ function w(e, t, n) {
1891
+ let r = p.value;
1892
+ if (!r || !Number.isFinite(n)) return;
1893
+ let i = er(r, e).rows, a = i.find((e) => e.id === t);
1894
+ if (!a) return;
1895
+ if (i.length === 1) {
1896
+ a.height = 100;
1897
+ return;
1898
+ }
1899
+ let o = i.filter((e) => e.id !== t), s = Math.min(Math.max(1, n), 100 - o.length), c = 100 - s, l = o.reduce((e, t) => e + t.height, 0);
1900
+ a.height = s, o.forEach((e) => {
1901
+ e.height = l > 0 ? e.height / l * c : c / o.length;
1902
+ }), $n(i);
1903
+ }
1904
+ function T(e, n, r) {
1905
+ let i = p.value;
1906
+ if (!i) return !1;
1907
+ let a = er(i, e), o = a.rows.find((e) => e.id === n);
1908
+ return !o || r && o.mode === "tabs" || !r && o.mode === "grid" ? !!o : r ? (o.widgets = o.cells.flatMap((e) => e.widget ? [e.widget] : []), o.cells = [], o.mode = "tabs", o.activeWidgetId = o.widgets[0]?.id, !0) : o.widgets.length > a.columns.length ? !1 : (o.cells = Array.from({ length: a.columns.length }, t), o.widgets.forEach((e, t) => {
1909
+ o.cells[t].widget = e;
1910
+ }), o.widgets = [], o.activeWidgetId = void 0, o.mode = "grid", !0);
1911
+ }
1912
+ function te(e) {
1913
+ return !!_(e);
1914
+ }
1915
+ function E(e, t, n, i = !1) {
1916
+ let a = r(t, n);
1917
+ if (e.kind === "tabs") {
1918
+ let t = h(e.side, e.rowId);
1919
+ return !t || t.mode !== "tabs" ? !1 : (t.widgets.push(a), t.activeWidgetId = a.id, !0);
1920
+ }
1921
+ let o = g(e);
1922
+ return !o || o.widget && !i ? !1 : (o.widget = a, !0);
1923
+ }
1924
+ function O(e) {
1925
+ if (e.kind === "cell") {
1926
+ let t = g(e);
1927
+ t && (t.widget = void 0);
1928
+ return;
1929
+ }
1930
+ let t = h(e.side, e.rowId);
1931
+ if (!t || t.mode !== "tabs") return;
1932
+ let n = e.widgetId ? t.widgets.findIndex((t) => t.id === e.widgetId) : 0;
1933
+ if (n >= 0) {
1934
+ let e = t.widgets[n]?.id === t.activeWidgetId;
1935
+ t.widgets.splice(n, 1), (e || !t.widgets.some((e) => e.id === t.activeWidgetId)) && (t.activeWidgetId = t.widgets[n]?.id ?? t.widgets[n - 1]?.id);
1936
+ }
1937
+ }
1938
+ function k(e, t) {
1939
+ if (e.kind === "cell") {
1940
+ let t = g(e), n = t?.widget;
1941
+ return t && (t.widget = void 0), n;
1942
+ }
1943
+ let n = h(e.side, e.rowId);
1944
+ if (!n || n.mode !== "tabs") return;
1945
+ let r = t ? n.widgets.findIndex((e) => e.id === t) : 0;
1946
+ if (r < 0) return;
1947
+ let [i] = n.widgets.splice(r, 1);
1948
+ return n.activeWidgetId = n.widgets.some((e) => e.id === n.activeWidgetId) ? n.activeWidgetId : n.widgets[0]?.id, i;
1949
+ }
1950
+ function ne(e, t, n = !1) {
1951
+ let r = _(e);
1952
+ if (!r) return {
1953
+ moved: !1,
1954
+ requiresReplace: !1
1955
+ };
1956
+ if (t.kind === "cell") {
1957
+ let i = g(t);
1958
+ if (!i) return {
1959
+ moved: !1,
1960
+ requiresReplace: !1
1961
+ };
1962
+ if (i.widget && i.widget.id !== r.id && !n) return {
1963
+ moved: !1,
1964
+ requiresReplace: !0
1965
+ };
1966
+ let a = k(e, r.id);
1967
+ return a ? (i.widget = a, {
1968
+ moved: !0,
1969
+ requiresReplace: !1
1970
+ }) : {
1971
+ moved: !1,
1972
+ requiresReplace: !1
1973
+ };
1974
+ }
1975
+ let i = h(t.side, t.rowId);
1976
+ if (!i || i.mode !== "tabs") return {
1977
+ moved: !1,
1978
+ requiresReplace: !1
1979
+ };
1980
+ let a = k(e, r.id);
1981
+ return a ? (i.widgets.push(a), i.activeWidgetId = a.id, {
1982
+ moved: !0,
1983
+ requiresReplace: !1
1984
+ }) : {
1985
+ moved: !1,
1986
+ requiresReplace: !1
1987
+ };
1988
+ }
1989
+ function re(e, t, n, r) {
1990
+ let i = h(e, t);
1991
+ if (!i || i.mode !== "tabs" || n === r || n < 0 || r < 0 || n >= i.widgets.length || r >= i.widgets.length) return;
1992
+ let [a] = i.widgets.splice(n, 1);
1993
+ i.widgets.splice(r, 0, a);
1994
+ }
1995
+ function ie(e, t, n) {
1996
+ let r = h(e, t);
1997
+ r?.mode === "tabs" && r.widgets.some((e) => e.id === n) && (r.activeWidgetId = n);
1998
+ }
1999
+ function A() {
2000
+ l.value = Xn(c), u.value = { layoutId: c.activeLayoutId ?? c.layouts[0]?.id };
2001
+ }
2002
+ function ae() {
2003
+ let e = f(l.value);
2004
+ return {
2005
+ config: i(l.value),
2006
+ validation: e
2007
+ };
2008
+ }
2009
+ return {
2010
+ draft: l,
2011
+ selection: u,
2012
+ layouts: d,
2013
+ activeLayout: p,
2014
+ addLayout: v,
2015
+ duplicateLayout: y,
2016
+ removeLayout: b,
2017
+ renameLayout: x,
2018
+ selectLayout: S,
2019
+ resizeRegion: ee,
2020
+ setRegionWidth: C,
2021
+ setRowHeight: w,
2022
+ setRowTabs: T,
2023
+ hasWidgetAt: te,
2024
+ addWidget: E,
2025
+ moveWidget: ne,
2026
+ removeWidget: O,
2027
+ reorderTabWidgets: re,
2028
+ setActiveTab: ie,
2029
+ reset: A,
2030
+ buildSaveConfig: ae
2031
+ };
2032
+ }
2033
+ //#endregion
2034
+ //#region src/designer/LumalCockpitDesigner.vue?vue&type=script&setup=true&lang.ts
2035
+ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar" }, ar = { class: "lumal-cockpit-designer__heading" }, or = { class: "lumal-cockpit-designer__title-actions" }, sr = { class: "lumal-cockpit-designer__controlbar" }, cr = { class: "lumal-cockpit-designer__layout-controls" }, lr = { class: "lumal-cockpit-designer__field" }, ur = { class: "lumal-cockpit-designer__layout-tools" }, dr = { class: "lumal-cockpit-designer__workspace" }, fr = {
2036
+ class: "lumal-cockpit-designer__assembly",
2037
+ "aria-label": "驾驶舱布局装配区"
2038
+ }, pr = { class: "lumal-cockpit-designer__assembly-stage" }, mr = { class: "lumal-cockpit-designer__footer" }, hr = {
2039
+ class: "lumal-cockpit-designer__placement-status",
2040
+ role: "status",
2041
+ "aria-live": "polite"
2042
+ }, gr = { class: "lumal-cockpit-designer__footer-actions" }, _r = /* @__PURE__ */ x({
2043
+ __name: "LumalCockpitDesigner",
2044
+ props: /*@__PURE__*/ S({
2045
+ config: {},
2046
+ registry: {},
2047
+ saving: { type: Boolean },
2048
+ saveError: {}
2049
+ }, {
2050
+ themeMode: { default: "dark" },
2051
+ themeModeModifiers: {}
2052
+ }),
2053
+ emits: /*@__PURE__*/ S(["save", "cancel"], ["update:themeMode"]),
2054
+ setup(e, { expose: t, emit: n }) {
2055
+ let r = e, i = n, a = ae(e, "themeMode"), o = nr(r.config), s = D([]), l = D(), u = m(() => o.activeLayout.value), d = m(() => s.value.filter((e) => e.level === "error")), f = c(), x = m(() => {
2056
+ let e = l.value;
2057
+ return e ? e.kind === "library" ? `已选择模块“${e.title}”,可连续放入多个槽位,按 Esc 取消。` : `正在移动“${e.title}”,请选择目标槽位或 Tab 行,按 Esc 取消。` : "PS:将需要的业务板块拖入上方白框内,已占用槽位会在确认后替换。";
2058
+ });
2059
+ oe(() => u.value?.id, () => {
2060
+ l.value = void 0;
2061
+ });
2062
+ function S(e) {
2063
+ l.value = {
2064
+ kind: "library",
2065
+ type: e.type,
2066
+ title: e.label
2067
+ };
2068
+ }
2069
+ function ee(e) {
2070
+ l.value = e;
2071
+ }
2072
+ function w() {
2073
+ l.value = void 0;
2074
+ }
2075
+ function T(e) {
2076
+ e.key !== "Escape" || !l.value || (e.preventDefault(), w());
2077
+ }
2078
+ function te() {
2079
+ let e = o.buildSaveConfig();
2080
+ if (s.value = e.validation.issues, !e.validation.valid) return;
2081
+ let t = u.value?.id ?? e.config.activeLayoutId, n = e.config.layouts.find((e) => e.id === t);
2082
+ n && i("save", {
2083
+ config: e.config,
2084
+ layout: n
2085
+ });
2086
+ }
2087
+ async function ne() {
2088
+ let e = u.value;
2089
+ if (e) {
2090
+ if (o.layouts.value.length <= 1) {
2091
+ await me.alert("至少保留一个布局。", "无法删除", {
2092
+ confirmButtonText: "知道了",
2093
+ type: "warning"
2094
+ });
2095
+ return;
2096
+ }
2097
+ try {
2098
+ await me.confirm(`确定删除布局“${e.title}”吗?`, "删除布局", {
2099
+ cancelButtonText: "取消",
2100
+ confirmButtonText: "删除",
2101
+ type: "warning"
2102
+ }), o.removeLayout(e.id);
2103
+ } catch {}
2104
+ }
2105
+ }
2106
+ async function re() {
2107
+ try {
2108
+ await me.confirm("将放弃本次尚未保存的所有布局调整,是否继续?", "重置草稿", {
2109
+ cancelButtonText: "取消",
2110
+ confirmButtonText: "重置",
2111
+ type: "warning"
2112
+ }), o.reset(), s.value = [];
2113
+ } catch {}
2114
+ }
2115
+ function se() {
2116
+ a.value = a.value === "dark" ? "light" : "dark";
2117
+ }
2118
+ return t({ toggleTheme: se }), (t, n) => (E(), _("div", {
2119
+ class: "lumal-cockpit-designer",
2120
+ "data-cockpit-theme": a.value,
2121
+ onKeydown: T
2122
+ }, [
2123
+ v("header", ir, [v("h2", ar, [b(A(N), {
2124
+ name: "lumal:settings",
2125
+ size: 18
2126
+ }), n[4] ||= y(" 模块设置 ", -1)]), v("div", or, [k(t.$slots, "title-actions", {
2127
+ themeMode: a.value,
2128
+ toggleTheme: se
2129
+ })])]),
2130
+ v("section", sr, [v("div", cr, [
2131
+ v("label", lr, [n[5] ||= v("span", null, "模板名称", -1), b(A(ge), {
2132
+ "model-value": u.value?.id,
2133
+ "aria-label": "选择布局",
2134
+ "onUpdate:modelValue": A(o).selectLayout
2135
+ }, {
2136
+ default: j(() => [(E(!0), _(p, null, O(A(o).layouts.value, (e) => (E(), h(A(he), {
2137
+ key: e.id,
2138
+ label: e.title,
2139
+ value: e.id
2140
+ }, null, 8, ["label", "value"]))), 128))]),
2141
+ _: 1
2142
+ }, 8, ["model-value", "onUpdate:modelValue"])]),
2143
+ u.value ? (E(), h(A(de), {
2144
+ key: 0,
2145
+ "model-value": u.value.title,
2146
+ "aria-label": "当前布局名称",
2147
+ onChange: n[0] ||= (e) => A(o).renameLayout(u.value.id, e)
2148
+ }, null, 8, ["model-value"])) : g("", !0),
2149
+ v("div", ur, [
2150
+ b(A(ve), {
2151
+ content: "添加布局",
2152
+ placement: "top"
2153
+ }, {
2154
+ default: j(() => [b(A(M), {
2155
+ circle: "",
2156
+ "aria-label": "添加布局",
2157
+ onClick: n[1] ||= (e) => A(o).addLayout()
2158
+ }, {
2159
+ default: j(() => [b(A(N), {
2160
+ name: "lumal:plus",
2161
+ size: 15
2162
+ })]),
2163
+ _: 1
2164
+ })]),
2165
+ _: 1
2166
+ }),
2167
+ u.value ? (E(), h(A(M), {
2168
+ key: 0,
2169
+ onClick: n[2] ||= (e) => A(o).duplicateLayout(u.value.id)
2170
+ }, {
2171
+ default: j(() => [...n[6] ||= [y(" 复制 ", -1)]]),
2172
+ _: 1
2173
+ })) : g("", !0),
2174
+ u.value ? (E(), h(A(M), {
2175
+ key: 1,
2176
+ type: "danger",
2177
+ plain: "",
2178
+ onClick: ne
2179
+ }, {
2180
+ default: j(() => [...n[7] ||= [y(" 删除 ", -1)]]),
2181
+ _: 1
2182
+ })) : g("", !0)
2183
+ ])
2184
+ ])]),
2185
+ v("div", {
2186
+ class: C(["lumal-cockpit-designer__issues", { "is-empty": !d.value.length && !e.saveError }]),
2187
+ role: "alert"
2188
+ }, [e.saveError ? (E(), h(A(le), {
2189
+ key: 0,
2190
+ type: "error",
2191
+ closable: !1,
2192
+ title: `保存失败:${e.saveError}`,
2193
+ "show-icon": ""
2194
+ }, null, 8, ["title"])) : g("", !0), (E(!0), _(p, null, O(d.value, (e, t) => (E(), h(A(le), {
2195
+ key: t,
2196
+ type: "error",
2197
+ closable: !1,
2198
+ title: e.message,
2199
+ "show-icon": ""
2200
+ }, null, 8, ["title"]))), 128))], 2),
2201
+ v("main", dr, [v("section", fr, [v("div", pr, [b(Yn, {
2202
+ "cockpit-id": e.config.id,
2203
+ draft: A(o),
2204
+ registry: e.registry,
2205
+ "placement-selection": l.value,
2206
+ "preview-message-bus": A(f),
2207
+ side: "left",
2208
+ onSelectPlaced: ee,
2209
+ onClearPlacement: w
2210
+ }, null, 8, [
2211
+ "cockpit-id",
2212
+ "draft",
2213
+ "registry",
2214
+ "placement-selection",
2215
+ "preview-message-bus"
2216
+ ]), b(Yn, {
2217
+ "cockpit-id": e.config.id,
2218
+ draft: A(o),
2219
+ registry: e.registry,
2220
+ "placement-selection": l.value,
2221
+ "preview-message-bus": A(f),
2222
+ side: "right",
2223
+ onSelectPlaced: ee,
2224
+ onClearPlacement: w
2225
+ }, null, 8, [
2226
+ "cockpit-id",
2227
+ "draft",
2228
+ "registry",
2229
+ "placement-selection",
2230
+ "preview-message-bus"
2231
+ ])])]), b(Dn, {
2232
+ "cockpit-id": e.config.id,
2233
+ "layout-id": u.value?.id ?? "",
2234
+ registry: e.registry,
2235
+ "selected-type": l.value?.kind === "library" ? l.value.type : void 0,
2236
+ onSelectWidget: S
2237
+ }, null, 8, [
2238
+ "cockpit-id",
2239
+ "layout-id",
2240
+ "registry",
2241
+ "selected-type"
2242
+ ])]),
2243
+ v("footer", mr, [v("p", hr, ie(x.value), 1), v("div", gr, [
2244
+ b(A(M), { onClick: re }, {
2245
+ default: j(() => [b(A(N), {
2246
+ name: "lumal:reset",
2247
+ size: 16
2248
+ }), n[8] ||= y(" 重置 ", -1)]),
2249
+ _: 1
2250
+ }),
2251
+ b(A(M), { onClick: n[3] ||= (e) => i("cancel") }, {
2252
+ default: j(() => [b(A(N), {
2253
+ name: "lumal:close",
2254
+ size: 15
2255
+ }), n[9] ||= y(" 取消 ", -1)]),
2256
+ _: 1
2257
+ }),
2258
+ b(A(M), {
2259
+ type: "primary",
2260
+ class: "lumal-cockpit-designer__save",
2261
+ loading: e.saving,
2262
+ "aria-busy": e.saving,
2263
+ onClick: te
2264
+ }, {
2265
+ default: j(() => [y(ie(e.saving ? "保存中…" : "保存"), 1)]),
2266
+ _: 1
2267
+ }, 8, ["loading", "aria-busy"])
2268
+ ])])
2269
+ ], 40, rr));
2270
+ }
2271
+ });
2272
+ //#endregion
2273
+ //#region src/designer/index.ts
2274
+ function vr(e, t) {
2275
+ let n = e;
2276
+ return n.install = function(n) {
2277
+ n.component(t, e);
2278
+ }, n;
2279
+ }
2280
+ var yr = vr(_r, "LumalCockpitDesigner");
2281
+ //#endregion
2282
+ export { Dn as CockpitComponentLibrary, Yn as CockpitLayoutEditor, kn as CockpitWidgetDropZone, wn as CockpitWidgetPreview, yr as LumalCockpitDesigner, nr as useCockpitDraft };