@affino/datagrid-vue-app 0.1.44 → 0.1.45

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.
@@ -0,0 +1,4742 @@
1
+ import { defineComponent as kn, h as B, inject as wr, ref as q, computed as w, watch as te, nextTick as et, openBlock as Ht, createElementBlock as An, Fragment as Gl, createElementVNode as oe, mergeProps as Ll, unref as m, toDisplayString as Qe, createBlock as gr, Teleport as vr, renderList as hr, normalizeClass as br, createCommentVNode as yr, onMounted as Rr, onBeforeUnmount as $l, shallowRef as Ml, defineAsyncComponent as Pl, markRaw as Cr, toRaw as pr, onUnmounted as Sr } from "vue";
2
+ import { resolveDataGridCellClickAction as Ir, invokeDataGridCellInteraction as xr, toggleDataGridCellValue as Mr, buildDataGridCellRenderModel as Fr, buildDataGridAdvancedFilterExpressionFromLegacyFilters as Ar, useDataGridContextMenu as Dr, cloneDataGridFilterSnapshot as Or, createClientRowModel as Rl } from "@affino/datagrid-vue";
3
+ import { useDataGridAppIntentHistory as _r, createDataGridAppRowHeightMetrics as kr, useDataGridAppViewport as Er, useDataGridAppRowSizing as Pr, useDataGridAppCellSelection as Tr, useDataGridAppRowPresentation as zr, useDataGridAppClipboard as Hr, useDataGridAppActiveCellViewport as Vr, useDataGridAppInlineEditing as Br, useDataGridAppInteractionController as jr, useDataGridAppHeaderResize as Gr, useDataGridAppRuntimeSync as Lr, useDataGridAppViewportLifecycle as $r, useDataGridAppColumnLayoutPanel as Kr } from "@affino/datagrid-vue/app";
4
+ import { useDataGridViewportContextMenuRouter as Nr, useDataGridContextMenuAnchor as Wr, useDataGridContextMenuActionRouter as Ur } from "@affino/datagrid-vue/advanced";
5
+ import { c as qr, q as Yr, D as Kl, a as Nl, s as Jr } from "./DataGridGanttStageEntry-CKjSVRMy.js";
6
+ import { usePopoverController as Xr, useFloatingPopover as Zr } from "@affino/popover-vue";
7
+ import { d as Qr, r as eo } from "./dataGridOverlayThemeVars-vzY74EIz.js";
8
+ import { u as to } from "./useDataGridDraggableOverlaySurface-BgkSR_nl.js";
9
+ import { a as no } from "./dataGridAdvancedFilter-xnME5bRa.js";
10
+ const Wl = kn({
11
+ name: "DataGridModuleHost",
12
+ props: {
13
+ modules: {
14
+ type: Array,
15
+ default: () => []
16
+ },
17
+ variant: {
18
+ type: String,
19
+ default: "standalone"
20
+ }
21
+ },
22
+ setup(e) {
23
+ return () => e.modules.length === 0 ? null : B("div", {
24
+ class: [
25
+ "datagrid-app-toolbar",
26
+ e.variant === "integrated" ? "datagrid-app-toolbar--integrated" : null
27
+ ]
28
+ }, [
29
+ B("div", { class: "datagrid-app-toolbar__group" }, e.modules.map((l) => B(l.component, {
30
+ key: l.key,
31
+ ...l.props ?? {}
32
+ })))
33
+ ]);
34
+ }
35
+ }), Ul = kn({
36
+ name: "DataGridHistoryToolbarButton",
37
+ props: {
38
+ action: {
39
+ type: String,
40
+ required: !0
41
+ },
42
+ label: {
43
+ type: String,
44
+ required: !0
45
+ },
46
+ disabled: {
47
+ type: Boolean,
48
+ default: !1
49
+ },
50
+ onTrigger: {
51
+ type: Function,
52
+ required: !0
53
+ }
54
+ },
55
+ setup(e) {
56
+ return () => B("button", {
57
+ type: "button",
58
+ class: "datagrid-app-toolbar__button",
59
+ "data-datagrid-toolbar-action": e.action,
60
+ disabled: e.disabled,
61
+ onClick: () => {
62
+ e.onTrigger();
63
+ }
64
+ }, e.label);
65
+ }
66
+ }), or = "Columns", Te = Object.freeze({
67
+ buttonLabel: or,
68
+ eyebrow: "Column layout",
69
+ title: "Order and visibility",
70
+ close: "Close",
71
+ cancel: "Cancel",
72
+ apply: "Apply",
73
+ moveUp: "Move up",
74
+ moveDown: "Move down"
75
+ });
76
+ function Pe(e, l) {
77
+ return typeof e == "string" && e.trim().length > 0 ? e.trim() : l;
78
+ }
79
+ function Cl(e, l) {
80
+ const a = Pe(l, Pe(e?.buttonLabel, or));
81
+ return Object.freeze({
82
+ buttonLabel: a,
83
+ eyebrow: Pe(e?.eyebrow, Te.eyebrow),
84
+ title: Pe(e?.title, Te.title),
85
+ close: Pe(e?.close, Te.close),
86
+ cancel: Pe(e?.cancel, Te.cancel),
87
+ apply: Pe(e?.apply, Te.apply),
88
+ moveUp: Pe(e?.moveUp, Te.moveUp),
89
+ moveDown: Pe(e?.moveDown, Te.moveDown)
90
+ });
91
+ }
92
+ function La(e) {
93
+ if (typeof e == "boolean") {
94
+ const a = Cl(void 0);
95
+ return {
96
+ enabled: e,
97
+ buttonLabel: a.buttonLabel,
98
+ labels: a
99
+ };
100
+ }
101
+ if (!e) {
102
+ const a = Cl(void 0);
103
+ return {
104
+ enabled: !1,
105
+ buttonLabel: a.buttonLabel,
106
+ labels: a
107
+ };
108
+ }
109
+ const l = Cl(e.labels, e.buttonLabel);
110
+ return {
111
+ enabled: e.enabled ?? !0,
112
+ buttonLabel: l.buttonLabel,
113
+ labels: l
114
+ };
115
+ }
116
+ const lo = ["data-datagrid-overlay-dragging"], ro = { class: "datagrid-column-layout__header" }, oo = { class: "datagrid-column-layout__eyebrow" }, ao = { class: "datagrid-column-layout__title" }, io = { class: "datagrid-column-layout__list" }, so = ["onDragstart", "onDragover", "onDrop"], uo = { class: "datagrid-column-layout__visibility" }, co = /* @__PURE__ */ oe("span", {
117
+ class: "datagrid-column-layout__drag-handle",
118
+ "aria-hidden": "true"
119
+ }, "::", -1), mo = ["name", "checked", "onChange"], fo = { class: "datagrid-column-layout__label" }, wo = { class: "datagrid-column-layout__move-actions" }, go = ["disabled", "aria-label", "title", "onClick"], vo = ["disabled", "aria-label", "title", "onClick"], ho = { class: "datagrid-column-layout__footer" }, bo = /* @__PURE__ */ kn({
120
+ __name: "DataGridColumnLayoutPopover",
121
+ props: {
122
+ isOpen: { type: Boolean },
123
+ items: {},
124
+ buttonLabel: {},
125
+ labels: { default: () => Te },
126
+ active: { type: Boolean, default: !1 }
127
+ },
128
+ emits: ["open", "toggle-visibility", "move-up", "move-down", "move-to-position", "apply", "cancel"],
129
+ setup(e, { emit: l }) {
130
+ const a = e, r = l, u = wr(Qr, q(null)), i = q({}), g = Xr(
131
+ {
132
+ id: "column-layout",
133
+ role: "dialog",
134
+ closeOnEscape: !0,
135
+ closeOnInteractOutside: !0
136
+ },
137
+ {
138
+ onOpen: () => {
139
+ a.isOpen || r("open"), Y();
140
+ },
141
+ onClose: () => {
142
+ a.isOpen && r("cancel");
143
+ }
144
+ }
145
+ ), h = Zr(g, {
146
+ placement: "bottom",
147
+ align: "start",
148
+ gutter: 10,
149
+ viewportPadding: 12,
150
+ zIndex: 180,
151
+ lockScroll: !1,
152
+ returnFocus: !0
153
+ }), R = to({
154
+ surfaceId: "column-layout",
155
+ rootElementRef: u,
156
+ floating: h
157
+ }), E = w(() => g.getTriggerProps({ role: "dialog" })), O = w(() => g.getContentProps({ role: "dialog", tabIndex: -1 })), G = w(() => g.state.value.open), I = w(() => h.teleportTarget.value), b = w(() => a.labels ?? Te), F = w(() => typeof a.buttonLabel == "string" && a.buttonLabel.trim().length > 0 ? a.buttonLabel.trim() : b.value.buttonLabel), A = q(null), C = q(null), M = q(null);
158
+ te(
159
+ () => a.isOpen,
160
+ async (T) => {
161
+ if (T) {
162
+ Y(), g.state.value.open || g.open("programmatic"), await et(), h.contentRef.value?.querySelector('input[type="checkbox"]')?.focus({ preventScroll: !0 }), await h.updatePosition();
163
+ return;
164
+ }
165
+ g.state.value.open && g.close("programmatic");
166
+ },
167
+ { immediate: !0 }
168
+ ), te(u, () => {
169
+ g.state.value.open && Y();
170
+ }), te(
171
+ () => a.items.length,
172
+ async () => {
173
+ g.state.value.open && (await et(), await h.updatePosition());
174
+ }
175
+ );
176
+ function Y() {
177
+ i.value = eo(u.value);
178
+ }
179
+ function ne(T, z) {
180
+ r("toggle-visibility", { key: T, visible: z });
181
+ }
182
+ function j(T) {
183
+ const _ = (T.currentTarget instanceof HTMLElement ? T.currentTarget : null)?.getBoundingClientRect();
184
+ return !_ || _.height <= 0 ? "after" : T.clientY < _.top + _.height / 2 ? "before" : "after";
185
+ }
186
+ function Me(T, z) {
187
+ A.value = z, C.value = null, M.value = null, T.dataTransfer && (T.dataTransfer.effectAllowed = "move", T.dataTransfer.setData("text/plain", z));
188
+ }
189
+ function ft(T, z) {
190
+ if (!A.value || A.value === z) {
191
+ C.value = null, M.value = null;
192
+ return;
193
+ }
194
+ T.preventDefault(), T.dataTransfer && (T.dataTransfer.dropEffect = "move"), C.value = z, M.value = j(T);
195
+ }
196
+ function wt(T, z) {
197
+ if (!A.value || A.value === z) {
198
+ We();
199
+ return;
200
+ }
201
+ T.preventDefault(), r("move-to-position", {
202
+ key: A.value,
203
+ targetKey: z,
204
+ placement: j(T)
205
+ }), We();
206
+ }
207
+ function We() {
208
+ A.value = null, C.value = null, M.value = null;
209
+ }
210
+ return (T, z) => (Ht(), An(Gl, null, [
211
+ oe("button", Ll({
212
+ ref: m(h).triggerRef,
213
+ type: "button",
214
+ class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": T.active }],
215
+ "data-datagrid-toolbar-action": "column-layout",
216
+ style: i.value
217
+ }, E.value), Qe(F.value), 17),
218
+ (Ht(), gr(vr, { to: I.value }, [
219
+ G.value ? (Ht(), An("section", Ll({
220
+ key: 0,
221
+ ref: m(h).contentRef,
222
+ class: "datagrid-column-layout",
223
+ "data-datagrid-overlay-surface": "true",
224
+ "data-datagrid-overlay-surface-id": "column-layout",
225
+ "data-datagrid-overlay-dragging": m(R).dragging.value ? "true" : "false",
226
+ style: [m(R).surfaceStyle.value, i.value]
227
+ }, O.value), [
228
+ oe("header", ro, [
229
+ oe("div", {
230
+ class: "datagrid-overlay-drag-handle",
231
+ "data-datagrid-overlay-drag-handle": "true",
232
+ onPointerdown: z[0] || (z[0] = //@ts-ignore
233
+ (..._) => m(R).handlePointerDown && m(R).handlePointerDown(..._))
234
+ }, [
235
+ oe("div", oo, Qe(b.value.eyebrow), 1),
236
+ oe("h3", ao, Qe(b.value.title), 1)
237
+ ], 32),
238
+ oe("button", {
239
+ type: "button",
240
+ class: "datagrid-column-layout__ghost",
241
+ onClick: z[1] || (z[1] = (_) => r("cancel"))
242
+ }, Qe(b.value.close), 1)
243
+ ]),
244
+ oe("div", io, [
245
+ (Ht(!0), An(Gl, null, hr(T.items, (_) => (Ht(), An("div", {
246
+ key: _.key,
247
+ class: br(["datagrid-column-layout__row", {
248
+ "datagrid-column-layout__row--drag-source": A.value === _.key,
249
+ "datagrid-column-layout__row--drop-before": C.value === _.key && M.value === "before",
250
+ "datagrid-column-layout__row--drop-after": C.value === _.key && M.value === "after"
251
+ }]),
252
+ draggable: !0,
253
+ onDragstart: (le) => Me(le, _.key),
254
+ onDragover: (le) => ft(le, _.key),
255
+ onDrop: (le) => wt(le, _.key),
256
+ onDragend: We
257
+ }, [
258
+ oe("label", uo, [
259
+ co,
260
+ oe("input", {
261
+ name: `datagrid-column-layout-visible-${_.key}`,
262
+ type: "checkbox",
263
+ checked: _.visible,
264
+ onChange: (le) => ne(_.key, le.target.checked)
265
+ }, null, 40, mo),
266
+ oe("span", fo, Qe(_.label), 1)
267
+ ]),
268
+ oe("div", wo, [
269
+ oe("button", {
270
+ type: "button",
271
+ class: "datagrid-column-layout__icon-button",
272
+ disabled: !_.canMoveUp,
273
+ "aria-label": `${b.value.moveUp}: ${_.label}`,
274
+ title: `${b.value.moveUp}: ${_.label}`,
275
+ onClick: (le) => r("move-up", _.key)
276
+ }, " ↑ ", 8, go),
277
+ oe("button", {
278
+ type: "button",
279
+ class: "datagrid-column-layout__icon-button",
280
+ disabled: !_.canMoveDown,
281
+ "aria-label": `${b.value.moveDown}: ${_.label}`,
282
+ title: `${b.value.moveDown}: ${_.label}`,
283
+ onClick: (le) => r("move-down", _.key)
284
+ }, " ↓ ", 8, vo)
285
+ ])
286
+ ], 42, so))), 128))
287
+ ]),
288
+ oe("footer", ho, [
289
+ oe("button", {
290
+ type: "button",
291
+ class: "datagrid-column-layout__secondary",
292
+ onClick: z[2] || (z[2] = (_) => r("cancel"))
293
+ }, Qe(b.value.cancel), 1),
294
+ oe("button", {
295
+ type: "button",
296
+ class: "datagrid-column-layout__primary",
297
+ onClick: z[3] || (z[3] = (_) => r("apply"))
298
+ }, Qe(b.value.apply), 1)
299
+ ])
300
+ ], 16, lo)) : yr("", !0)
301
+ ], 8, ["to"]))
302
+ ], 64));
303
+ }
304
+ }), ze = ["sort", "group", "pin", "filter"], yo = ["button", "contextmenu", "button+contextmenu"], ar = [
305
+ "sortAsc",
306
+ "sortDesc",
307
+ "clearSort",
308
+ "toggleGroup",
309
+ "pinMenu",
310
+ "pinLeft",
311
+ "pinRight",
312
+ "unpin",
313
+ "clearFilter",
314
+ "addCurrentSelectionToFilter",
315
+ "selectAllValues",
316
+ "clearAllValues",
317
+ "applyFilter",
318
+ "cancelFilter"
319
+ ], pl = 120, Fl = "button+contextmenu";
320
+ function Tl(e) {
321
+ const l = new Set(ze), a = Array.isArray(e) ? e : ze, r = [];
322
+ for (const u of a)
323
+ !l.has(u) || r.includes(u) || r.push(u);
324
+ return r.length > 0 ? r : [...ze];
325
+ }
326
+ function Al(e) {
327
+ if (!Array.isArray(e))
328
+ return [];
329
+ const l = new Set(ze), a = [];
330
+ for (const r of e)
331
+ !l.has(r) || a.includes(r) || a.push(r);
332
+ return a;
333
+ }
334
+ function ir(e) {
335
+ if (!e)
336
+ return Object.freeze({});
337
+ const l = Object.entries(e).filter(([a, r]) => ze.includes(a) && typeof r == "string").map(([a, r]) => [a, r.trim()]).filter(([, a]) => a.length > 0);
338
+ return Object.freeze(Object.fromEntries(l));
339
+ }
340
+ function sr(e) {
341
+ if (!e)
342
+ return Object.freeze({});
343
+ const l = Object.entries(e).filter(([a, r]) => ze.includes(a) && typeof r == "string").map(([a, r]) => [a, r.trim()]).filter(([, a]) => a.length > 0);
344
+ return Object.freeze(Object.fromEntries(l));
345
+ }
346
+ function Ro(e) {
347
+ return yo.includes(e) ? e : Fl;
348
+ }
349
+ function Co(e) {
350
+ if (e === "start" || e === "end")
351
+ return !0;
352
+ if (!e.includes(":"))
353
+ return !1;
354
+ const [l, a] = e.split(":");
355
+ return (l === "before" || l === "after") && ze.includes(a);
356
+ }
357
+ function zl(e) {
358
+ if (!Array.isArray(e))
359
+ return Object.freeze([]);
360
+ const l = [], a = /* @__PURE__ */ new Set();
361
+ for (const r of e) {
362
+ const u = typeof r?.key == "string" ? r.key.trim() : "", i = typeof r?.label == "string" ? r.label.trim() : "";
363
+ if (u.length === 0 || i.length === 0 || a.has(u))
364
+ continue;
365
+ a.add(u);
366
+ const g = typeof r.placement == "string" && Co(r.placement) ? r.placement : void 0, h = {
367
+ key: u,
368
+ label: i,
369
+ ...g ? { placement: g } : {},
370
+ ...r.hidden === !0 ? { hidden: !0 } : {},
371
+ ...r.disabled === !0 ? { disabled: !0 } : {},
372
+ ...typeof r.disabledReason == "string" && r.disabledReason.trim().length > 0 ? { disabledReason: r.disabledReason.trim() } : {}
373
+ };
374
+ if (r.kind === "submenu") {
375
+ const R = zl(r.items);
376
+ if (R.length === 0)
377
+ continue;
378
+ l.push(Object.freeze({
379
+ ...h,
380
+ kind: "submenu",
381
+ items: R
382
+ }));
383
+ continue;
384
+ }
385
+ l.push(Object.freeze({
386
+ ...h,
387
+ ...typeof r.onSelect == "function" ? { onSelect: r.onSelect } : {}
388
+ }));
389
+ }
390
+ return Object.freeze(l);
391
+ }
392
+ function ur(e) {
393
+ if (!e)
394
+ return Object.freeze({});
395
+ const l = Object.entries(e).filter(([a, r]) => ar.includes(a) && !!r).map(([a, r]) => {
396
+ const u = r, i = {
397
+ ...u.hidden === !0 ? { hidden: !0 } : {},
398
+ ...u.disabled === !0 ? { disabled: !0 } : {},
399
+ ...typeof u.disabledReason == "string" && u.disabledReason.trim().length > 0 ? { disabledReason: u.disabledReason.trim() } : {},
400
+ ...typeof u.label == "string" && u.label.trim().length > 0 ? { label: u.label.trim() } : {}
401
+ };
402
+ return [a, Object.freeze(i)];
403
+ }).filter(([, a]) => Object.keys(a).length > 0);
404
+ return Object.freeze(Object.fromEntries(l));
405
+ }
406
+ function po(e) {
407
+ if (!e)
408
+ return {};
409
+ const l = Object.entries(e).filter(([a]) => a.trim().length > 0).map(([a, r]) => {
410
+ const u = r?.items ? Tl(r.items) : void 0, i = Al(r?.hide), g = Al(r?.disabled), h = sr(r?.disabledReasons), R = ir(r?.labels), E = ur(r?.actions), O = zl(r?.customItems);
411
+ return [
412
+ a,
413
+ {
414
+ ...u ? { items: u } : {},
415
+ ...i.length > 0 ? { hide: i } : {},
416
+ ...g.length > 0 ? { disabled: g } : {},
417
+ ...Object.keys(h).length > 0 ? { disabledReasons: h } : {},
418
+ ...Object.keys(R).length > 0 ? { labels: R } : {},
419
+ ...Object.keys(E).length > 0 ? { actions: E } : {},
420
+ ...O.length > 0 ? { customItems: O } : {}
421
+ }
422
+ ];
423
+ });
424
+ return Object.fromEntries(l);
425
+ }
426
+ function $a(e) {
427
+ return typeof e == "boolean" ? {
428
+ enabled: e,
429
+ trigger: Fl,
430
+ maxFilterValues: pl,
431
+ items: [...ze],
432
+ disabled: [],
433
+ disabledReasons: Object.freeze({}),
434
+ labels: Object.freeze({}),
435
+ actions: Object.freeze({}),
436
+ customItems: Object.freeze([]),
437
+ columns: {}
438
+ } : e ? {
439
+ enabled: e.enabled ?? !0,
440
+ trigger: Ro(e.trigger),
441
+ maxFilterValues: Number.isFinite(e.maxFilterValues) ? Math.max(20, Math.trunc(e.maxFilterValues)) : pl,
442
+ items: Tl(e.items),
443
+ disabled: Al(e.disabled),
444
+ disabledReasons: sr(e.disabledReasons),
445
+ labels: ir(e.labels),
446
+ actions: ur(e.actions),
447
+ customItems: zl(e.customItems),
448
+ columns: po(e.columns)
449
+ } : {
450
+ enabled: !1,
451
+ trigger: Fl,
452
+ maxFilterValues: pl,
453
+ items: [...ze],
454
+ disabled: [],
455
+ disabledReasons: Object.freeze({}),
456
+ labels: Object.freeze({}),
457
+ actions: Object.freeze({}),
458
+ customItems: Object.freeze([]),
459
+ columns: {}
460
+ };
461
+ }
462
+ function dr(e, l) {
463
+ const a = e.columns[l], r = a?.items ? Tl(a.items) : e.items, u = new Set(a?.hide ?? []), i = r.filter((g) => !u.has(g));
464
+ return i.length > 0 ? i : [];
465
+ }
466
+ function So(e, l) {
467
+ const a = dr(e, l), r = new Set(e.columns[l]?.disabled ?? []), u = new Set(e.disabled);
468
+ return a.filter((i) => u.has(i) || r.has(i));
469
+ }
470
+ function Io(e, l) {
471
+ return Object.freeze({
472
+ ...e.labels,
473
+ ...e.columns[l]?.labels ?? {}
474
+ });
475
+ }
476
+ function xo(e, l) {
477
+ return Object.freeze({
478
+ ...e.disabledReasons,
479
+ ...e.columns[l]?.disabledReasons ?? {}
480
+ });
481
+ }
482
+ function Mo(e, l) {
483
+ const a = e.columns[l]?.actions ?? {}, r = ar.map((u) => {
484
+ const i = {
485
+ ...e.actions[u] ?? {},
486
+ ...a[u] ?? {}
487
+ };
488
+ return [u, Object.freeze(i)];
489
+ }).filter(([, u]) => Object.keys(u).length > 0);
490
+ return Object.freeze(Object.fromEntries(r));
491
+ }
492
+ function Fo(e, l) {
493
+ const a = /* @__PURE__ */ new Map();
494
+ for (const r of e.customItems)
495
+ a.set(r.key, r);
496
+ for (const r of e.columns[l]?.customItems ?? [])
497
+ a.set(r.key, r);
498
+ return Object.freeze(Array.from(a.values()));
499
+ }
500
+ const fe = ["clipboard", "pasteSpecial", "edit"], Hl = ["cut", "copy", "paste", "pasteValues", "clear"], dt = ["insert", "clipboard", "selection"], cr = [
501
+ "insertAbove",
502
+ "insertBelow",
503
+ "cut",
504
+ "copy",
505
+ "paste",
506
+ "deleteSelected"
507
+ ];
508
+ function En(e, l) {
509
+ const a = new Set(l), r = Array.isArray(e) ? e : l, u = [];
510
+ for (const i of r)
511
+ !a.has(i) || u.includes(i) || u.push(i);
512
+ return u.length > 0 ? u : [...l];
513
+ }
514
+ function _n(e, l) {
515
+ if (!Array.isArray(e))
516
+ return [];
517
+ const a = new Set(l), r = [];
518
+ for (const u of e)
519
+ !a.has(u) || r.includes(u) || r.push(u);
520
+ return r;
521
+ }
522
+ function mt(e, l) {
523
+ if (!e)
524
+ return Object.freeze({});
525
+ const a = Object.entries(e).filter((r) => l.includes(r[0]) && typeof r[1] == "string").map(([r, u]) => [r, u.trim()]).filter(([, r]) => r.length > 0);
526
+ return Object.freeze(Object.fromEntries(a));
527
+ }
528
+ function Vl(e, l) {
529
+ if (!e)
530
+ return Object.freeze({});
531
+ const a = Object.entries(e).filter(([r, u]) => l.includes(r) && !!u).map(([r, u]) => {
532
+ const i = u, g = {
533
+ ...i.hidden === !0 ? { hidden: !0 } : {},
534
+ ...i.disabled === !0 ? { disabled: !0 } : {},
535
+ ...typeof i.disabledReason == "string" && i.disabledReason.trim().length > 0 ? { disabledReason: i.disabledReason.trim() } : {},
536
+ ...typeof i.label == "string" && i.label.trim().length > 0 ? { label: i.label.trim() } : {}
537
+ };
538
+ return [r, Object.freeze(g)];
539
+ }).filter(([, r]) => Object.keys(r).length > 0);
540
+ return Object.freeze(Object.fromEntries(a));
541
+ }
542
+ function Ao(e) {
543
+ if (e === "start" || e === "end")
544
+ return !0;
545
+ if (!e.includes(":"))
546
+ return !1;
547
+ const [l, a] = e.split(":");
548
+ return (l === "before" || l === "after") && fe.includes(a);
549
+ }
550
+ function Bl(e) {
551
+ if (!Array.isArray(e))
552
+ return Object.freeze([]);
553
+ const l = [], a = /* @__PURE__ */ new Set();
554
+ for (const r of e) {
555
+ const u = typeof r?.key == "string" ? r.key.trim() : "", i = typeof r?.label == "string" ? r.label.trim() : "";
556
+ if (u.length === 0 || i.length === 0 || a.has(u))
557
+ continue;
558
+ a.add(u);
559
+ const g = typeof r.placement == "string" && Ao(r.placement) ? r.placement : void 0, h = {
560
+ key: u,
561
+ label: i,
562
+ ...g ? { placement: g } : {},
563
+ ...r.hidden === !0 ? { hidden: !0 } : {},
564
+ ...r.disabled === !0 ? { disabled: !0 } : {},
565
+ ...typeof r.disabledReason == "string" && r.disabledReason.trim().length > 0 ? { disabledReason: r.disabledReason.trim() } : {}
566
+ };
567
+ if (r.kind === "submenu") {
568
+ const R = Bl(r.items);
569
+ if (R.length === 0)
570
+ continue;
571
+ l.push(Object.freeze({
572
+ ...h,
573
+ kind: "submenu",
574
+ items: R
575
+ }));
576
+ continue;
577
+ }
578
+ l.push(Object.freeze({
579
+ ...h,
580
+ ...typeof r.onSelect == "function" ? { onSelect: r.onSelect } : {}
581
+ }));
582
+ }
583
+ return Object.freeze(l);
584
+ }
585
+ function Do(e) {
586
+ if (!e)
587
+ return {};
588
+ const l = Object.entries(e).filter(([a]) => a.trim().length > 0).map(([a, r]) => {
589
+ const u = r?.items ? En(r.items, fe) : void 0, i = _n(r?.hide, fe), g = _n(r?.disabled, fe), h = mt(r?.disabledReasons, fe), R = mt(r?.labels, fe), E = Vl(r?.actions, Hl), O = Bl(r?.customItems);
590
+ return [
591
+ a,
592
+ {
593
+ ...u ? { items: u } : {},
594
+ ...i.length > 0 ? { hide: i } : {},
595
+ ...g.length > 0 ? { disabled: g } : {},
596
+ ...Object.keys(h).length > 0 ? { disabledReasons: h } : {},
597
+ ...Object.keys(R).length > 0 ? { labels: R } : {},
598
+ ...Object.keys(E).length > 0 ? { actions: E } : {},
599
+ ...O.length > 0 ? { customItems: O } : {}
600
+ }
601
+ ];
602
+ });
603
+ return Object.freeze(Object.fromEntries(l));
604
+ }
605
+ function Ka(e) {
606
+ return typeof e == "boolean" ? {
607
+ enabled: e,
608
+ items: [...fe],
609
+ disabled: [],
610
+ disabledReasons: Object.freeze({}),
611
+ labels: Object.freeze({}),
612
+ actions: Object.freeze({}),
613
+ customItems: Object.freeze([]),
614
+ columns: {}
615
+ } : e ? {
616
+ enabled: e.enabled ?? !0,
617
+ items: En(e.items, fe),
618
+ disabled: _n(e.disabled, fe),
619
+ disabledReasons: mt(e.disabledReasons, fe),
620
+ labels: mt(e.labels, fe),
621
+ actions: Vl(e.actions, Hl),
622
+ customItems: Bl(e.customItems),
623
+ columns: Do(e.columns)
624
+ } : {
625
+ enabled: !1,
626
+ items: [...fe],
627
+ disabled: [],
628
+ disabledReasons: Object.freeze({}),
629
+ labels: Object.freeze({}),
630
+ actions: Object.freeze({}),
631
+ customItems: Object.freeze([]),
632
+ columns: {}
633
+ };
634
+ }
635
+ function On(e, l) {
636
+ const a = e.columns[l], r = a?.items ? En(a.items, fe) : e.items, u = new Set(a?.hide ?? []), i = r.filter((g) => !u.has(g));
637
+ return i.length > 0 ? i : [];
638
+ }
639
+ function Oo(e, l) {
640
+ const a = On(e, l), r = new Set(e.columns[l]?.disabled ?? []), u = new Set(e.disabled);
641
+ return a.filter((i) => u.has(i) || r.has(i));
642
+ }
643
+ function _o(e, l) {
644
+ return Object.freeze({
645
+ ...e.labels,
646
+ ...e.columns[l]?.labels ?? {}
647
+ });
648
+ }
649
+ function ko(e, l) {
650
+ return Object.freeze({
651
+ ...e.disabledReasons,
652
+ ...e.columns[l]?.disabledReasons ?? {}
653
+ });
654
+ }
655
+ function Eo(e, l) {
656
+ const a = e.columns[l]?.actions ?? {}, r = Hl.map((u) => {
657
+ const i = {
658
+ ...e.actions[u] ?? {},
659
+ ...a[u] ?? {}
660
+ };
661
+ return [u, Object.freeze(i)];
662
+ }).filter(([, u]) => Object.keys(u).length > 0);
663
+ return Object.freeze(Object.fromEntries(r));
664
+ }
665
+ function Po(e, l) {
666
+ const a = /* @__PURE__ */ new Map();
667
+ for (const r of e.customItems)
668
+ a.set(r.key, r);
669
+ for (const r of e.columns[l]?.customItems ?? [])
670
+ a.set(r.key, r);
671
+ return Object.freeze(Array.from(a.values()));
672
+ }
673
+ function Na(e) {
674
+ return typeof e == "boolean" ? {
675
+ enabled: e,
676
+ items: [...dt],
677
+ disabled: [],
678
+ disabledReasons: Object.freeze({}),
679
+ labels: Object.freeze({}),
680
+ actions: Object.freeze({})
681
+ } : e ? {
682
+ enabled: e.enabled ?? !0,
683
+ items: En(e.items, dt),
684
+ disabled: _n(e.disabled, dt),
685
+ disabledReasons: mt(e.disabledReasons, dt),
686
+ labels: mt(e.labels, dt),
687
+ actions: Vl(e.actions, cr)
688
+ } : {
689
+ enabled: !1,
690
+ items: [...dt],
691
+ disabled: [],
692
+ disabledReasons: Object.freeze({}),
693
+ labels: Object.freeze({}),
694
+ actions: Object.freeze({})
695
+ };
696
+ }
697
+ function To(e) {
698
+ return e.items;
699
+ }
700
+ function zo(e) {
701
+ return e.disabled;
702
+ }
703
+ function Ho(e) {
704
+ return e.disabledReasons;
705
+ }
706
+ function Vo(e) {
707
+ const l = cr.map((a) => [a, Object.freeze({ ...e.actions[a] ?? {} })]).filter(([, a]) => Object.keys(a).length > 0);
708
+ return Object.freeze(Object.fromEntries(l));
709
+ }
710
+ function ql(e) {
711
+ return (l) => {
712
+ e.value = l instanceof HTMLElement ? l : null;
713
+ };
714
+ }
715
+ function Bo(e) {
716
+ const l = ql(e.headerViewportRef), a = ql(e.bodyViewportRef), r = (F) => {
717
+ e.editingCellValueRef.value = F;
718
+ }, u = w(() => ({
719
+ gridContentStyle: m(e.gridContentStyle),
720
+ mainTrackStyle: m(e.mainTrackStyle),
721
+ indexColumnStyle: m(e.indexColumnStyle),
722
+ stageStyle: m(e.stageStyle),
723
+ bodyShellStyle: m(e.bodyShellStyle),
724
+ columnStyle: m(e.columnStyle)
725
+ })), i = w(() => ({
726
+ topSpacerHeight: m(e.topSpacerHeight),
727
+ bottomSpacerHeight: m(e.bottomSpacerHeight),
728
+ viewportRowStart: m(e.viewportRowStart),
729
+ viewportRowEnd: m(e.viewportRowEnd),
730
+ virtualRowTotal: m(e.virtualRowTotal),
731
+ baseRowHeight: m(e.baseRowHeight),
732
+ resolveRowHeight: m(e.resolveRowHeight),
733
+ resolveRowOffset: m(e.resolveRowOffset),
734
+ columnWindowStart: m(e.columnWindowStart),
735
+ leftColumnSpacerWidth: m(e.leftColumnSpacerWidth),
736
+ rightColumnSpacerWidth: m(e.rightColumnSpacerWidth),
737
+ headerViewportRef: l,
738
+ bodyViewportRef: a,
739
+ handleHeaderWheel: m(e.handleHeaderWheel),
740
+ handleHeaderScroll: m(e.handleHeaderScroll),
741
+ handleViewportScroll: m(e.handleViewportScroll),
742
+ handleViewportKeydown: m(e.handleViewportKeydown)
743
+ })), g = w(() => ({
744
+ visibleColumns: m(e.visibleColumns),
745
+ renderedColumns: m(e.renderedColumns),
746
+ columnFilterTextByKey: m(e.columnFilterTextByKey),
747
+ reorderColumnsByHeader: m(e.reorderColumnsByHeader),
748
+ toggleSortForColumn: m(e.toggleSortForColumn),
749
+ handleHeaderColumnClick: m(e.handleHeaderColumnClick),
750
+ sortIndicator: m(e.sortIndicator),
751
+ setColumnFilterText: m(e.setColumnFilterText),
752
+ columnMenuEnabled: m(e.columnMenuEnabled),
753
+ columnMenuTrigger: m(e.columnMenuTrigger),
754
+ columnMenuValueFilterEnabled: m(e.columnMenuValueFilterEnabled),
755
+ columnMenuValueFilterRowLimit: m(e.columnMenuValueFilterRowLimit),
756
+ columnMenuMaxFilterValues: m(e.columnMenuMaxFilterValues),
757
+ resolveColumnMenuItems: m(e.resolveColumnMenuItems),
758
+ resolveColumnMenuDisabledItems: m(e.resolveColumnMenuDisabledItems),
759
+ resolveColumnMenuDisabledReasons: m(e.resolveColumnMenuDisabledReasons),
760
+ resolveColumnMenuLabels: m(e.resolveColumnMenuLabels),
761
+ resolveColumnMenuActionOptions: m(e.resolveColumnMenuActionOptions),
762
+ resolveColumnMenuCustomItems: m(e.resolveColumnMenuCustomItems),
763
+ isColumnFilterActive: m(e.isColumnFilterActive),
764
+ isColumnGrouped: m(e.isColumnGrouped),
765
+ resolveColumnGroupOrder: m(e.resolveColumnGroupOrder),
766
+ resolveColumnMenuSortDirection: m(e.resolveColumnMenuSortDirection),
767
+ resolveColumnMenuSelectedTokens: m(e.resolveColumnMenuSelectedTokens),
768
+ resolveColumnMenuValueEntries: m(e.resolveColumnMenuValueEntries),
769
+ applyColumnMenuSort: m(e.applyColumnMenuSort),
770
+ applyColumnMenuPin: m(e.applyColumnMenuPin),
771
+ applyColumnMenuGroupBy: m(e.applyColumnMenuGroupBy),
772
+ applyColumnMenuFilter: m(e.applyColumnMenuFilter),
773
+ clearColumnMenuFilter: m(e.clearColumnMenuFilter),
774
+ startResize: m(e.startResize),
775
+ handleResizeDoubleClick: m(e.handleResizeDoubleClick)
776
+ })), h = w(() => ({
777
+ displayRows: m(e.displayRows),
778
+ displayRowsRevision: m(e.displayRowsRevision),
779
+ runtimeRevision: m(e.runtimeRevision),
780
+ pinnedBottomRows: m(e.pinnedBottomRows),
781
+ sourceRows: m(e.sourceRows),
782
+ showRowIndex: m(e.showRowIndex),
783
+ rowHover: m(e.rowHover),
784
+ stripedRows: m(e.stripedRows),
785
+ rowClass: m(e.rowClass),
786
+ isRowAutosizeProbe: m(e.isRowAutosizeProbe),
787
+ rowStyle: m(e.rowStyle),
788
+ isRowInPendingClipboardCut: m(e.isRowInPendingClipboardCut),
789
+ isRowFocused: m(e.isRowFocused),
790
+ isRowCheckboxSelected: m(e.isRowCheckboxSelected),
791
+ allVisibleRowsSelected: m(e.allVisibleRowsSelected),
792
+ someVisibleRowsSelected: m(e.someVisibleRowsSelected),
793
+ handleRowClick: m(e.handleRowClick),
794
+ handleRowIndexClick: m(e.handleRowIndexClick),
795
+ handleRowIndexKeydown: m(e.handleRowIndexKeydown),
796
+ reorderRowsByIndex: m(e.reorderRowsByIndex),
797
+ handleToggleAllVisibleRows: m(e.handleToggleAllVisibleRows),
798
+ toggleGroupRow: m(e.toggleGroupRow),
799
+ rowIndexLabel: m(e.rowIndexLabel),
800
+ startRowResize: m(e.startRowResize),
801
+ autosizeRow: m(e.autosizeRow)
802
+ })), R = w(() => ({
803
+ selectionRange: m(e.selectionRange),
804
+ selectionRanges: m(e.selectionRanges),
805
+ selectionAnchorCell: m(e.selectionAnchorCell),
806
+ totalRowCount: m(e.totalRowCount),
807
+ fillPreviewRange: m(e.fillPreviewRange),
808
+ rangeMovePreviewRange: m(e.rangeMovePreviewRange),
809
+ fillHandleEnabled: m(e.fillHandleEnabled),
810
+ rangeMoveEnabled: m(e.rangeMoveEnabled),
811
+ isFillDragging: m(e.isFillDragging),
812
+ isRangeMoving: m(e.isRangeMoving),
813
+ fillActionAnchorCell: m(e.fillActionAnchorCell),
814
+ fillActionBehavior: m(e.fillActionBehavior),
815
+ applyFillActionBehavior: m(e.applyFillActionBehavior),
816
+ isFillHandleCell: m(e.isFillHandleCell),
817
+ startFillHandleDrag: m(e.startFillHandleDrag),
818
+ startFillHandleDoubleClick: m(e.startFillHandleDoubleClick)
819
+ })), E = w(() => ({
820
+ editingCellValue: e.editingCellValueRef.value,
821
+ editingCellInitialFilter: m(e.editingCellInitialFilter),
822
+ editingCellOpenOnMount: m(e.editingCellOpenOnMount),
823
+ isEditingCell: m(e.isEditingCell),
824
+ startInlineEdit: m(e.startInlineEdit),
825
+ updateEditingCellValue: r,
826
+ handleEditorKeydown: m(e.handleEditorKeydown),
827
+ handleEditorBlur: m(e.handleEditorBlur),
828
+ commitInlineEdit: m(e.commitInlineEdit),
829
+ cancelInlineEdit: m(e.cancelInlineEdit)
830
+ })), O = w(() => ({
831
+ cellClass: m(e.cellClass),
832
+ cellStyle: m(e.cellStyle),
833
+ isCellSelected: m(e.isCellSelected),
834
+ isSelectionAnchorCell: m(e.isSelectionAnchorCell),
835
+ shouldHighlightSelectedCell: m(e.shouldHighlightSelectedCell),
836
+ isCellOnSelectionEdge: m(e.isCellOnSelectionEdge),
837
+ isCellInFillPreview: m(e.isCellInFillPreview),
838
+ isCellInPendingClipboardRange: m(e.isCellInPendingClipboardRange),
839
+ isCellOnPendingClipboardEdge: m(e.isCellOnPendingClipboardEdge),
840
+ isCellEditable: m(e.isCellEditable),
841
+ readCell: m(e.readCell),
842
+ readDisplayCell: m(e.readDisplayCell)
843
+ })), G = w(() => ({
844
+ handleCellMouseDown: m(e.handleCellMouseDown),
845
+ handleCellClick: m(e.handleCellClick),
846
+ handleCellKeydown: m(e.handleCellKeydown)
847
+ })), I = w(() => ({
848
+ mode: m(e.mode),
849
+ rowHeightMode: m(e.rowHeightMode),
850
+ layoutMode: m(e.layoutMode),
851
+ chromeSignature: m(e.chromeSignature),
852
+ customOverlays: m(e.customOverlays),
853
+ reportCenterPaneDiagnostics: m(e.reportCenterPaneDiagnostics),
854
+ reportFillPlumbingState: m(e.reportFillPlumbingState),
855
+ reportFillPlumbingDetail: m(e.reportFillPlumbingDetail),
856
+ layout: u.value,
857
+ viewport: i.value,
858
+ columns: g.value,
859
+ rows: h.value,
860
+ selection: R.value,
861
+ editing: E.value,
862
+ cells: O.value,
863
+ interaction: G.value
864
+ })), b = qr({
865
+ mode: w(() => m(e.mode)),
866
+ rowHeightMode: w(() => m(e.rowHeightMode)),
867
+ layoutMode: w(() => m(e.layoutMode)),
868
+ layout: u,
869
+ viewport: i,
870
+ columns: g,
871
+ rows: h,
872
+ selection: R,
873
+ editing: E,
874
+ cells: O,
875
+ interaction: G
876
+ });
877
+ return {
878
+ tableStageProps: I,
879
+ tableStageContext: b,
880
+ captureHeaderViewportRef: l,
881
+ captureBodyViewportRef: a,
882
+ updateEditingCellValue: r
883
+ };
884
+ }
885
+ function jo(e) {
886
+ const l = (i, g) => Number.isFinite(i.displayIndex) ? Math.max(0, Math.trunc(i.displayIndex)) : e.viewportRowStart.value + g;
887
+ return {
888
+ readStageCell: (i, g) => e.isRowSelectionColumnKey(g) ? e.readRowSelectionCell(i) : e.readCell(i, g),
889
+ readStageDisplayCell: (i, g) => e.isRowSelectionColumnKey(g) ? e.readRowSelectionDisplayCell(i) : e.readDisplayCell(i, g),
890
+ handleCellClick: (i, g, h, R) => {
891
+ if (e.isRowSelectionColumn(h)) {
892
+ e.toggleRowCheckboxSelected(i);
893
+ return;
894
+ }
895
+ const E = l(i, g), O = e.isCellEditableByKey(i, E, h.key, R), G = Ir({
896
+ column: h.column,
897
+ row: i.kind !== "group" ? i.data : void 0,
898
+ rowId: i.rowId,
899
+ editable: O
900
+ });
901
+ if (G === "invoke") {
902
+ xr({
903
+ column: h.column,
904
+ row: i.kind !== "group" ? i.data : void 0,
905
+ rowId: i.rowId,
906
+ editable: O,
907
+ trigger: "click"
908
+ });
909
+ return;
910
+ }
911
+ if (G !== "toggle" || i.kind === "group" || i.rowId == null)
912
+ return;
913
+ const I = e.captureHistorySnapshot(), b = e.ensureEditableRowAtIndex?.(E) ?? i;
914
+ if (b.kind === "group" || b.rowId == null)
915
+ return;
916
+ const F = b.data[h.key], A = Mr({
917
+ column: h.column,
918
+ row: b.data
919
+ });
920
+ e.runtime.api.rows.applyEdits([
921
+ {
922
+ rowId: b.rowId,
923
+ data: {
924
+ [h.key]: A
925
+ }
926
+ }
927
+ ]), e.onCellEdit?.({
928
+ rowId: b.rowId,
929
+ columnKey: h.key,
930
+ oldValue: F,
931
+ newValue: A,
932
+ patch: {
933
+ rowId: b.rowId,
934
+ data: {
935
+ [h.key]: A
936
+ }
937
+ }
938
+ }), e.recordHistoryIntentTransaction({
939
+ intent: "edit",
940
+ label: `Toggle ${h.key}`,
941
+ affectedRange: {
942
+ startRow: E,
943
+ endRow: E,
944
+ startColumn: R,
945
+ endColumn: R
946
+ }
947
+ }, I), e.syncViewport();
948
+ }
949
+ };
950
+ }
951
+ const Yl = 140, Dn = 108, Sl = "__datagrid_row_selection__";
952
+ function Go(e) {
953
+ const l = w(() => (e.showRowSelection?.value ?? !0) && e.runtime.api.rowSelection.hasSupport()), a = w(() => l.value ? {
954
+ key: Sl,
955
+ state: {
956
+ visible: !0,
957
+ pin: "left",
958
+ width: Dn
959
+ },
960
+ visible: !0,
961
+ pin: "left",
962
+ width: Dn,
963
+ column: {
964
+ key: Sl,
965
+ label: "",
966
+ cellType: "checkbox",
967
+ cellInteraction: {
968
+ click: !0,
969
+ keyboard: ["enter", "space"],
970
+ role: "checkbox",
971
+ label: "Toggle row selection",
972
+ checked: ({ rowId: b }) => b != null && e.runtime.api.rowSelection.isSelected(b),
973
+ onInvoke: ({ rowId: b }) => {
974
+ b == null || !e.runtime.api.rowSelection.hasSupport() || e.runtime.api.rowSelection.setSelected(
975
+ b,
976
+ !e.runtime.api.rowSelection.isSelected(b)
977
+ );
978
+ }
979
+ },
980
+ minWidth: Dn,
981
+ maxWidth: Dn,
982
+ capabilities: {
983
+ editable: !0,
984
+ sortable: !1,
985
+ filterable: !1,
986
+ groupable: !1,
987
+ pivotable: !1,
988
+ aggregatable: !1
989
+ },
990
+ presentation: {
991
+ align: "center",
992
+ headerAlign: "center"
993
+ },
994
+ meta: {
995
+ isSystem: !0,
996
+ rowSelection: !0
997
+ }
998
+ }
999
+ } : null), r = (b) => b === Sl, u = (b) => r(b.key), i = w(() => {
1000
+ const b = a.value, F = e.visibleColumns.value.filter((M) => M.pin === "left"), A = e.visibleColumns.value.filter((M) => M.pin !== "left" && M.pin !== "right"), C = e.visibleColumns.value.filter((M) => M.pin === "right");
1001
+ return b ? [b, ...F, ...A, ...C] : [...F, ...A, ...C];
1002
+ }), g = w(() => i.value.filter((b) => b.pin !== "left" && b.pin !== "right")), h = (b) => b.width ?? Yl, R = (b) => {
1003
+ const F = i.value.find((M) => M.key === b), C = `${F ? h(F) : Yl}px`;
1004
+ return {
1005
+ width: C,
1006
+ minWidth: C,
1007
+ maxWidth: C
1008
+ };
1009
+ }, E = (b) => b.column.capabilities?.editable !== !1, O = (b, F, A) => u(A) ? b.kind !== "group" && b.rowId != null : b.kind === "group" || b.rowId == null || !E(A) ? !1 : e.isCellEditable ? e.isCellEditable({
1010
+ row: b.data,
1011
+ rowId: b.rowId,
1012
+ rowIndex: F,
1013
+ column: A.column,
1014
+ columnKey: A.key
1015
+ }) : !0, G = (b, F) => {
1016
+ const A = i.value[F];
1017
+ if (A?.key === b)
1018
+ return { column: A, columnIndex: F };
1019
+ const C = i.value.findIndex((M) => M.key === b);
1020
+ return C < 0 ? null : {
1021
+ column: i.value[C],
1022
+ columnIndex: C
1023
+ };
1024
+ };
1025
+ return {
1026
+ orderedVisibleColumns: i,
1027
+ centerColumns: g,
1028
+ resolveColumnWidth: h,
1029
+ stageColumnStyle: R,
1030
+ isRowSelectionColumnKey: r,
1031
+ isRowSelectionColumn: u,
1032
+ isCellEditable: O,
1033
+ isCellEditableByKey: (b, F, A, C) => {
1034
+ const M = G(A, C);
1035
+ return M ? O(b, F, M.column) : !1;
1036
+ },
1037
+ rowSelectionColumn: a
1038
+ };
1039
+ }
1040
+ function Lo(e) {
1041
+ const l = w(() => {
1042
+ const r = e.lastAppliedFill.value, u = e.selectionRange.value;
1043
+ return !r || !u || e.isFillDragging.value || r.allowBehaviorToggle === !1 || r.previewRange.startRow !== u.startRow || r.previewRange.endRow !== u.endRow || r.previewRange.startColumn !== u.startColumn || r.previewRange.endColumn !== u.endColumn ? null : {
1044
+ rowIndex: r.previewRange.endRow,
1045
+ columnIndex: r.previewRange.endColumn
1046
+ };
1047
+ }), a = w(() => e.lastAppliedFill.value?.behavior ?? null);
1048
+ return {
1049
+ fillActionAnchorCell: l,
1050
+ fillActionBehavior: a
1051
+ };
1052
+ }
1053
+ function $o(e) {
1054
+ const l = e.enabled === !1 || e.history ? null : _r({
1055
+ runtime: e.runtime,
1056
+ cloneRowData: e.cloneRowData,
1057
+ syncViewport: e.syncViewport,
1058
+ maxHistoryDepth: e.maxHistoryDepth
1059
+ }), a = () => e.enabled === !1 ? null : e.history ? e.history.captureSnapshot() : l?.captureRowsSnapshot() ?? null, r = (O) => e.enabled === !1 ? null : e.history ? e.history.captureSnapshotForRowIds?.(O) ?? e.history.captureSnapshot() : l?.captureRowsSnapshotByIds(O) ?? null, u = (O, G, I) => {
1060
+ if (e.enabled !== !1) {
1061
+ if (e.history) {
1062
+ e.history.recordIntentTransaction(O, G, I);
1063
+ return;
1064
+ }
1065
+ l?.recordIntentTransaction(
1066
+ O,
1067
+ G,
1068
+ I
1069
+ );
1070
+ }
1071
+ }, i = (O) => {
1072
+ e.enabled !== !1 && e.history?.recordServerFillTransaction?.(O);
1073
+ }, g = () => e.enabled === !1 ? !1 : e.history ? e.history.canUndo() : l?.canUndo.value ?? !1, h = () => e.enabled === !1 ? !1 : e.history ? e.history.canRedo() : l?.canRedo.value ?? !1;
1074
+ return {
1075
+ captureHistorySnapshot: a,
1076
+ captureHistorySnapshotForRowIds: r,
1077
+ recordHistoryIntentTransaction: u,
1078
+ recordServerFillTransaction: i,
1079
+ canUndoHistory: g,
1080
+ canRedoHistory: h,
1081
+ canUndo: g,
1082
+ canRedo: h,
1083
+ runHistoryAction: (O) => e.enabled === !1 ? Promise.resolve(null) : e.history ? e.history.runHistoryAction(O) : l?.runHistoryAction(O) ?? Promise.resolve(null),
1084
+ disposeIntentHistory: () => {
1085
+ l?.dispose();
1086
+ }
1087
+ };
1088
+ }
1089
+ function Ko(e) {
1090
+ const l = e.isPlaceholderRow ?? (() => !1), a = e.applyRowSelectionMutation ?? ((C) => {
1091
+ e.runtime.api.rowSelection.hasSupport() && C(e.runtime.api.rowSelection);
1092
+ }), r = w(() => new Set(e.rowSelectionSnapshot.value?.selectedRows ?? [])), u = (C) => !l(C) && C.rowId != null && e.rowSelectionSnapshot.value?.focusedRow === C.rowId, i = (C) => !l(C) && C.kind !== "group" && C.rowId != null && r.value.has(C.rowId), g = (C) => i(C), h = (C) => g(C) ? "true" : "false", R = (C) => {
1093
+ const M = e.rowSelectionColumn.value?.column;
1094
+ return !M || C.kind === "group" || l(C) ? "" : Fr({
1095
+ column: M,
1096
+ value: g(C)
1097
+ }).displayValue;
1098
+ }, E = w(() => {
1099
+ const C = e.runtime.api.rows.getCount(), M = [];
1100
+ for (let Y = 0; Y < C; Y += 1) {
1101
+ const ne = e.runtime.api.rows.get(Y);
1102
+ !ne || ne.kind === "group" || ne.rowId == null || M.push(ne.rowId);
1103
+ }
1104
+ return M;
1105
+ }), O = w(() => {
1106
+ const C = E.value;
1107
+ return C.length > 0 && C.every((M) => r.value.has(M));
1108
+ }), G = w(() => E.value.some((M) => r.value.has(M))), I = (C) => {
1109
+ l(C) || C.rowId == null || !e.runtime.api.rowSelection.hasSupport() || e.runtime.api.rowSelection.setFocusedRow(C.rowId);
1110
+ };
1111
+ return {
1112
+ rowSelectionSet: r,
1113
+ isRowFocused: u,
1114
+ isRowCheckboxSelected: i,
1115
+ readRowSelectionCell: h,
1116
+ readRowSelectionDisplayCell: R,
1117
+ areAllVisibleRowsSelected: O,
1118
+ areSomeVisibleRowsSelected: G,
1119
+ focusRow: I,
1120
+ toggleRowCheckboxSelected: (C) => {
1121
+ l(C) || C.kind === "group" || C.rowId == null || !e.runtime.api.rowSelection.hasSupport() || a((M) => {
1122
+ M.setSelected(C.rowId, !r.value.has(C.rowId));
1123
+ });
1124
+ },
1125
+ toggleVisibleRowsSelected: () => {
1126
+ if (!e.runtime.api.rowSelection.hasSupport())
1127
+ return;
1128
+ const C = E.value;
1129
+ if (!O.value) {
1130
+ a((M) => {
1131
+ M.selectRows(C);
1132
+ });
1133
+ return;
1134
+ }
1135
+ a((M) => {
1136
+ M.deselectRows(C);
1137
+ });
1138
+ },
1139
+ selectRowRange: (C, M, Y) => {
1140
+ I(C);
1141
+ const ne = e.orderedVisibleColumns.value.length - 1;
1142
+ if (ne < 0)
1143
+ return;
1144
+ const j = e.viewportRowStart.value + M;
1145
+ if (!Y) {
1146
+ e.applySelectionRange({
1147
+ startRow: j,
1148
+ endRow: j,
1149
+ startColumn: 0,
1150
+ endColumn: ne
1151
+ });
1152
+ return;
1153
+ }
1154
+ const Me = e.selectionAnchorCell.value?.rowIndex ?? j;
1155
+ e.applySelectionRange({
1156
+ startRow: Math.min(Me, j),
1157
+ endRow: Math.max(Me, j),
1158
+ startColumn: 0,
1159
+ endColumn: ne
1160
+ });
1161
+ }
1162
+ };
1163
+ }
1164
+ function No(e) {
1165
+ const l = (g) => ({ target: g });
1166
+ return {
1167
+ handleWindowMouseMove: (g) => {
1168
+ if (e.isColumnResizing.value) {
1169
+ e.applyColumnResizeFromPointer(g.clientX);
1170
+ return;
1171
+ }
1172
+ e.handleInteractionWindowMouseMove(g);
1173
+ },
1174
+ handleHeaderWheel: (g) => {
1175
+ const h = e.bodyViewportRef.value;
1176
+ if (!h)
1177
+ return;
1178
+ const R = Math.abs(g.deltaX) > 0 ? g.deltaX : g.shiftKey ? g.deltaY : 0, E = R === 0 ? g.deltaY : 0;
1179
+ R === 0 && E === 0 || (g.preventDefault(), R !== 0 && (h.scrollLeft += R), E !== 0 && (h.scrollTop += E), e.syncViewport(l(h)));
1180
+ },
1181
+ handleHeaderScroll: (g) => {
1182
+ const h = g.target, R = e.bodyViewportRef.value;
1183
+ !h || !R || (R.scrollLeft !== h.scrollLeft && (R.scrollLeft = h.scrollLeft), e.syncViewport(l(R)));
1184
+ },
1185
+ handleWindowMouseUp: () => {
1186
+ e.stopColumnResize(), e.handleInteractionWindowMouseUp();
1187
+ }
1188
+ };
1189
+ }
1190
+ function Wo(e) {
1191
+ const l = (i) => i.ctrlKey || i.metaKey || i.altKey ? !1 : i.key.startsWith("Arrow") || i.key === "Home" || i.key === "End" || i.key === "PageUp" || i.key === "PageDown" || i.key === "Tab" || i.key === "Enter" || i.key === " " || i.key === "Spacebar" || i.key === "F2" || i.key === "Escape" || i.key.length === 1, a = (i) => (i.ctrlKey || i.metaKey) && !i.altKey && !i.shiftKey && i.key.toLowerCase() === "a", r = () => {
1192
+ const i = e.totalRows.value - 1, g = e.orderedVisibleColumns.value.length - 1;
1193
+ i < 0 || g < 0 || e.applySelectionRange({
1194
+ startRow: 0,
1195
+ endRow: i,
1196
+ startColumn: 0,
1197
+ endColumn: g
1198
+ });
1199
+ };
1200
+ return {
1201
+ handleViewportKeydown: (i) => {
1202
+ (l(i) || a(i)) && i.preventDefault();
1203
+ const g = e.selectionSnapshot.value?.activeCell;
1204
+ if (!g) {
1205
+ a(i) && r();
1206
+ return;
1207
+ }
1208
+ const h = e.runtime.getBodyRowAtIndex(g.rowIndex);
1209
+ h && e.handleCellKeydown(
1210
+ i,
1211
+ h,
1212
+ g.rowIndex - e.viewportRowStart.value,
1213
+ g.colIndex
1214
+ );
1215
+ }
1216
+ };
1217
+ }
1218
+ function Uo(e) {
1219
+ const l = w(() => e.interactionSelectionRange.value ?? e.resolveCommittedSelectionRange()), a = w(() => {
1220
+ const I = e.interactionSelectionRange.value;
1221
+ return I ? [I] : e.resolveCommittedSelectionRanges();
1222
+ }), r = () => {
1223
+ const I = l.value;
1224
+ return I && I.startRow === I.endRow && I.startColumn === I.endColumn ? {
1225
+ rowIndex: I.startRow,
1226
+ columnIndex: I.startColumn
1227
+ } : e.selectionAnchorCell.value;
1228
+ }, u = () => l.value, i = () => a.value, g = () => e.mode.value === "base" && e.isFillDragging.value && !!e.fillPreviewRange.value, h = (I, b, F) => {
1229
+ const A = e.viewportRowStart.value + b;
1230
+ return A >= I.startRow && A <= I.endRow && F >= I.startColumn && F <= I.endColumn;
1231
+ }, R = (I, b) => {
1232
+ const F = r();
1233
+ return F ? F.rowIndex === e.viewportRowStart.value + I && F.columnIndex === b : e.isCommittedSelectionAnchorCell(I, b);
1234
+ };
1235
+ return {
1236
+ selectionRange: l,
1237
+ selectionRanges: a,
1238
+ isSelectionAnchorCell: R,
1239
+ isCellSelected: (I, b) => {
1240
+ if (!g())
1241
+ return i().some((A) => h(A, I, b));
1242
+ const F = u();
1243
+ return F ? h(F, I, b) : !1;
1244
+ },
1245
+ shouldHighlightSelectedCell: (I, b) => {
1246
+ if (!g()) {
1247
+ const C = i();
1248
+ return C.length === 0 || !C.some((M) => h(M, I, b)) || C.length === 1 && C[0] && C[0].startRow === C[0].endRow && C[0].startColumn === C[0].endColumn ? !1 : !R(I, b);
1249
+ }
1250
+ const F = u();
1251
+ return !F || !h(F, I, b) || F.startRow === F.endRow && F.startColumn === F.endColumn ? !1 : !R(I, b);
1252
+ },
1253
+ isCellOnSelectionEdge: (I, b, F) => {
1254
+ if (!g())
1255
+ return i().some((M) => {
1256
+ if (!h(M, I, b))
1257
+ return !1;
1258
+ const Y = e.viewportRowStart.value + I;
1259
+ switch (F) {
1260
+ case "top":
1261
+ return Y === M.startRow;
1262
+ case "right":
1263
+ return b === M.endColumn;
1264
+ case "bottom":
1265
+ return Y === M.endRow;
1266
+ case "left":
1267
+ return b === M.startColumn;
1268
+ }
1269
+ });
1270
+ const A = u();
1271
+ if (!A || !h(A, I, b))
1272
+ return !1;
1273
+ const C = e.viewportRowStart.value + I;
1274
+ switch (F) {
1275
+ case "top":
1276
+ return C === A.startRow;
1277
+ case "right":
1278
+ return b === A.endColumn;
1279
+ case "bottom":
1280
+ return C === A.endRow;
1281
+ case "left":
1282
+ return b === A.startColumn;
1283
+ }
1284
+ }
1285
+ };
1286
+ }
1287
+ const Il = 140, qo = 72, Yo = 80, Jo = 24, Xo = 400;
1288
+ function Zo(e) {
1289
+ const l = e.syncRowSelectionSnapshotFromRuntime ?? (() => {
1290
+ }), a = e.flushRowSelectionSnapshotUpdates ?? (() => {
1291
+ }), r = e.rowSelectionSnapshot ?? q(null), u = q(null), i = w(() => e.showRowIndex?.value !== !1), g = w(() => e.runtime.rowPartition.value.bodyRowCount), h = Yr({
1292
+ runtime: e.runtime,
1293
+ sourceRows: e.sourceRows ?? e.rows,
1294
+ totalBodyRows: g,
1295
+ placeholderRows: e.placeholderRows,
1296
+ cloneRowData: e.cloneRowData
1297
+ }), R = w(() => Math.max(0, h.totalVisualRows.value)), E = w(() => Math.max(0, R.value + e.runtime.rowPartition.value.pinnedBottomRows.length)), O = w(() => i.value ? qo : 0), G = Go({
1298
+ runtime: e.runtime,
1299
+ visibleColumns: e.visibleColumns,
1300
+ showRowSelection: e.showRowSelection,
1301
+ isCellEditable: e.isCellEditable
1302
+ }), {
1303
+ orderedVisibleColumns: I,
1304
+ centerColumns: b,
1305
+ resolveColumnWidth: F,
1306
+ isRowSelectionColumnKey: A,
1307
+ isRowSelectionColumn: C,
1308
+ isCellEditable: M,
1309
+ isCellEditableByKey: Y,
1310
+ rowSelectionColumn: ne
1311
+ } = G, j = kr({
1312
+ totalRows: () => R.value,
1313
+ resolveBaseRowHeight: () => e.normalizedBaseRowHeight.value,
1314
+ resolveRowHeightOverride: (c) => e.runtime.api.view.getRowHeightOverride(c),
1315
+ resolveRowHeightVersion: () => e.runtime.api.view.getRowHeightVersion(),
1316
+ hasRowHeightOverrides: () => e.runtime.api.view.getRowHeightVersion() > 0,
1317
+ resolveRowHeightOverridesSnapshot: () => e.runtime.api.view.getRowHeightOverridesSnapshot?.() ?? null,
1318
+ resolveLastRowHeightMutation: () => e.runtime.api.view.getLastRowHeightMutation?.() ?? null
1319
+ }), Me = (c) => {
1320
+ const y = Math.max(0, Math.trunc(c));
1321
+ if (y <= 0)
1322
+ return 0;
1323
+ const S = j.resolveTotalHeight();
1324
+ return y <= g.value ? j.resolveRowOffset(y) : S + (y - g.value) * e.normalizedBaseRowHeight.value;
1325
+ }, ft = w(() => {
1326
+ if (e.layoutMode.value !== "auto-height")
1327
+ return null;
1328
+ let c = j.resolveTotalHeight();
1329
+ return e.minRows.value !== null && (c = Math.max(c, Me(e.minRows.value))), e.maxRows.value !== null && (c = Math.min(c, Me(e.maxRows.value))), Math.max(0, Math.trunc(c));
1330
+ }), wt = w(() => e.layoutMode.value !== "auto-height" ? {} : {
1331
+ height: "auto"
1332
+ }), We = w(() => {
1333
+ if (e.layoutMode.value !== "auto-height")
1334
+ return {};
1335
+ const c = ft.value ?? 0;
1336
+ return {
1337
+ height: `${c}px`,
1338
+ maxHeight: `${c}px`
1339
+ };
1340
+ });
1341
+ let T = () => !1;
1342
+ const {
1343
+ headerViewportRef: z,
1344
+ bodyViewportRef: _,
1345
+ displayRows: le,
1346
+ displayRowsRevision: Pn,
1347
+ renderedViewportRange: gt,
1348
+ pinnedBottomRows: se,
1349
+ renderedColumns: Bt,
1350
+ viewportRowStart: N,
1351
+ viewportRowEnd: tt,
1352
+ viewportColumnStart: nt,
1353
+ topSpacerHeight: Tn,
1354
+ bottomSpacerHeight: zn,
1355
+ leftColumnSpacerWidth: Hn,
1356
+ rightColumnSpacerWidth: Vn,
1357
+ gridContentStyle: Bn,
1358
+ mainTrackStyle: jn,
1359
+ indexColumnStyle: Gn,
1360
+ columnStyle: Ln,
1361
+ handleViewportScroll: Fe,
1362
+ syncRenderedRowsInRange: J,
1363
+ syncViewportFromDom: re,
1364
+ scheduleViewportSync: lt,
1365
+ cancelScheduledViewportSync: jt
1366
+ } = Er({
1367
+ runtime: h.visualRuntime,
1368
+ mode: e.mode,
1369
+ rowRenderMode: e.rowRenderMode,
1370
+ rowVirtualizationEnabled: w(() => e.virtualization.value.rows),
1371
+ columnVirtualizationEnabled: w(() => e.virtualization.value.columns),
1372
+ totalRows: R,
1373
+ visibleColumns: b,
1374
+ sizingColumns: I,
1375
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1376
+ resolveColumnWidth: F,
1377
+ defaultColumnWidth: Il,
1378
+ indexColumnWidth: 0,
1379
+ flexFillOffsetWidth: O.value,
1380
+ rowOverscan: w(() => e.virtualization.value.rowOverscan),
1381
+ columnOverscan: w(() => e.virtualization.value.columnOverscan),
1382
+ measureVisibleRowHeights: () => vt(),
1383
+ resolveRowHeight: j.resolveRowHeight,
1384
+ resolveRowOffset: j.resolveRowOffset,
1385
+ resolveRowIndexAtOffset: j.resolveRowIndexAtOffset,
1386
+ resolveTotalRowHeight: j.resolveTotalHeight
1387
+ }), Gt = w(() => (e.rowVersion.value, e.runtime.rowPartition.value, e.runtimeRowModel?.getSnapshot?.().revision ?? e.runtime.api.rows.getSnapshot().revision ?? null)), Ue = (c) => {
1388
+ if ("renderedViewport" in c && c.renderedViewport && (u.value = {
1389
+ startRow: Math.max(0, Math.trunc(c.renderedViewport.start)),
1390
+ endRow: Math.max(Math.max(0, Math.trunc(c.renderedViewport.start)), Math.trunc(c.renderedViewport.end))
1391
+ }, e.reportFillPlumbingDetail?.("centerPaneStoredRenderedViewport", Dt(u.value))), typeof c.debugJson == "string" && c.debugJson.length > 0)
1392
+ try {
1393
+ const y = JSON.parse(c.debugJson), S = y.renderedViewport?.start, D = y.renderedViewport?.end;
1394
+ u.value == null && Number.isFinite(S) && Number.isFinite(D) && (u.value = {
1395
+ startRow: Math.max(0, Math.trunc(S)),
1396
+ endRow: Math.max(Math.max(0, Math.trunc(S)), Math.trunc(D))
1397
+ }, e.reportFillPlumbingDetail?.("centerPaneStoredRenderedViewport", Dt(u.value)));
1398
+ } catch {
1399
+ }
1400
+ e.reportCenterPaneDiagnostics?.(c);
1401
+ }, Lt = (c) => Ln(c), W = h.visualRuntime, $t = W.resolveBodyRowIndexById, Kt = (c) => {
1402
+ if (!Number.isFinite(c))
1403
+ return null;
1404
+ const y = Math.max(0, Math.trunc(c));
1405
+ if (y < R.value)
1406
+ return W.getBodyRowAtIndex(y);
1407
+ const S = y - R.value;
1408
+ return e.runtime.rowPartition.value.pinnedBottomRows[S] ?? null;
1409
+ }, {
1410
+ rowStyle: Nt,
1411
+ isRowAutosizeProbe: Wt,
1412
+ measureVisibleRowHeights: vt,
1413
+ startRowResize: Ut,
1414
+ autosizeRow: qt,
1415
+ consumeRecentRowResizeInteraction: Yt,
1416
+ dispose: Jt
1417
+ } = Pr({
1418
+ mode: e.mode,
1419
+ rowHeightMode: e.rowHeightMode,
1420
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1421
+ viewportRowStart: N,
1422
+ bodyViewportRef: _,
1423
+ runtime: e.runtime,
1424
+ minRowHeight: Jo,
1425
+ syncViewport: () => re()
1426
+ }), de = Tr({
1427
+ mode: e.mode,
1428
+ runtime: {
1429
+ api: W.api,
1430
+ getBodyRowAtIndex: Kt
1431
+ },
1432
+ totalRows: E,
1433
+ visibleColumns: I,
1434
+ viewportRowStart: N,
1435
+ resolveRowIndex: (c) => {
1436
+ const y = le.value[c];
1437
+ return y && Number.isFinite(y.displayIndex) ? Math.max(0, Math.trunc(y.displayIndex)) : N.value + c;
1438
+ },
1439
+ selectionSnapshot: e.selectionSnapshot,
1440
+ selectionAnchor: e.selectionAnchor,
1441
+ isEditingCell: (c, y) => T(c, y)
1442
+ }), {
1443
+ normalizeRowId: Xt,
1444
+ normalizeCellCoord: Zt,
1445
+ resolveSelectionRange: rt,
1446
+ resolveSelectionRanges: ot,
1447
+ resolveCurrentCellCoord: $n,
1448
+ applySelectionRange: qe,
1449
+ applyCellSelectionByCoord: Qt,
1450
+ setCellSelection: Kn,
1451
+ clearCellSelection: en,
1452
+ isCellSelected: tn
1453
+ } = de, Nn = de.isSelectionAnchorCell ?? (() => !1), Wn = de.shouldHighlightSelectedCell ?? ((c, y) => tn(c, y)), nn = de.isCellOnSelectionEdge ?? (() => !1), ht = w(() => {
1454
+ const c = e.selectionSnapshot.value;
1455
+ if (!c || c.ranges.length === 0)
1456
+ return null;
1457
+ const y = c.activeRangeIndex ?? 0, S = c.ranges[y]?.anchor ?? c.ranges[0]?.anchor ?? null;
1458
+ return !S || typeof S.rowIndex != "number" || typeof S.colIndex != "number" || !Number.isFinite(S.rowIndex) || !Number.isFinite(S.colIndex) ? null : {
1459
+ rowIndex: Math.trunc(S.rowIndex),
1460
+ columnIndex: Math.trunc(S.colIndex)
1461
+ };
1462
+ }), ln = Ko({
1463
+ runtime: e.runtime,
1464
+ isPlaceholderRow: h.isPlaceholderRow,
1465
+ rowSelectionColumn: ne,
1466
+ orderedVisibleColumns: I,
1467
+ displayRows: le,
1468
+ rowSelectionSnapshot: r,
1469
+ applyRowSelectionMutation: (c) => {
1470
+ e.runtime.api.rowSelection.hasSupport() && (c(e.runtime.api.rowSelection), l(), a());
1471
+ },
1472
+ viewportRowStart: N,
1473
+ selectionAnchorCell: ht,
1474
+ applySelectionRange: qe
1475
+ }), {
1476
+ readRowSelectionCell: Un,
1477
+ readRowSelectionDisplayCell: qn,
1478
+ toggleRowCheckboxSelected: Yn
1479
+ } = ln, rn = w(() => {
1480
+ const c = `${O.value}px`;
1481
+ return {
1482
+ ...Gn.value,
1483
+ width: c,
1484
+ minWidth: c,
1485
+ maxWidth: c
1486
+ };
1487
+ }), at = $o({
1488
+ runtime: e.runtime,
1489
+ cloneRowData: e.cloneRowData,
1490
+ syncViewport: () => re(),
1491
+ enabled: e.historyEnabled?.value !== !1,
1492
+ maxHistoryDepth: e.historyMaxDepth?.value,
1493
+ history: e.history
1494
+ }), {
1495
+ captureHistorySnapshot: Ae,
1496
+ captureHistorySnapshotForRowIds: Be,
1497
+ recordHistoryIntentTransaction: De,
1498
+ canUndoHistory: bt,
1499
+ canRedoHistory: pe,
1500
+ runHistoryAction: ae
1501
+ } = at, je = q(null), ve = q(null), yt = w(() => {
1502
+ const c = je.value;
1503
+ return c?.affectedRange ? [{
1504
+ key: "server-fill-affected-range",
1505
+ ranges: [c.affectedRange],
1506
+ className: "grid-selection-overlay--server-fill",
1507
+ segmentClassName: "grid-selection-overlay__segment--server-fill",
1508
+ borderColor: "color-mix(in srgb, var(--datagrid-accent-strong) 72%, var(--datagrid-text-color) 28%)",
1509
+ backgroundColor: "color-mix(in srgb, var(--datagrid-accent-strong) 10%, transparent)",
1510
+ borderStyle: "solid",
1511
+ hideSingleCell: !1,
1512
+ zIndex: 7
1513
+ }] : [];
1514
+ }), {
1515
+ rowIndexLabel: on,
1516
+ readCell: an,
1517
+ readDisplayCell: Jn,
1518
+ rowClass: Xn,
1519
+ toggleGroupRow: Ye
1520
+ } = zr({
1521
+ mode: e.mode,
1522
+ runtime: e.runtime,
1523
+ viewportRowStart: N,
1524
+ firstColumnKey: e.firstColumnKey
1525
+ }), Ge = jo({
1526
+ runtime: e.runtime,
1527
+ viewportRowStart: N,
1528
+ ensureEditableRowAtIndex: (c) => h.ensureMaterializedRowAt(c, "toggle"),
1529
+ isRowSelectionColumnKey: A,
1530
+ isRowSelectionColumn: C,
1531
+ isCellEditableByKey: Y,
1532
+ readRowSelectionCell: Un,
1533
+ readRowSelectionDisplayCell: qn,
1534
+ readCell: an,
1535
+ readDisplayCell: Jn,
1536
+ toggleRowCheckboxSelected: Yn,
1537
+ captureHistorySnapshot: Ae,
1538
+ captureHistorySnapshotForRowIds: Be,
1539
+ recordHistoryIntentTransaction: De,
1540
+ syncViewport: () => re()
1541
+ }), {
1542
+ readStageCell: Rt
1543
+ } = Ge, sn = (c, y, S) => h.isPlaceholderRow(c) ? h.isPlaceholderCellEditable(y) : S(), Ct = (c, y, S, D) => sn(
1544
+ c,
1545
+ I.value[D],
1546
+ () => Y(c, y, S, D)
1547
+ ), Zn = Hr({
1548
+ mode: e.mode,
1549
+ runtime: W,
1550
+ totalRows: R,
1551
+ visibleColumns: I,
1552
+ viewportRowStart: N,
1553
+ resolveSelectionRange: rt,
1554
+ resolveSelectionRanges: ot,
1555
+ resolveCurrentCellCoord: $n,
1556
+ applySelectionRange: qe,
1557
+ clearCellSelection: en,
1558
+ captureRowsSnapshot: Ae,
1559
+ captureRowsSnapshotForRowIds: Be,
1560
+ recordEditTransaction: (c, y, S) => {
1561
+ De({
1562
+ intent: "edit",
1563
+ label: S ?? "Cell edit"
1564
+ }, c, y);
1565
+ },
1566
+ readCell: (c, y) => Rt(c, y),
1567
+ readClipboardCell: e.readClipboardCell ? (c, y) => e.readClipboardCell?.(c, y) ?? "" : void 0,
1568
+ isCellEditable: Ct,
1569
+ syncViewport: () => re(),
1570
+ applyClipboardEdits: e.applyClipboardEdits,
1571
+ buildFillMatrixFromRange: e.buildFillMatrixFromRange,
1572
+ buildPasteSpecialMatrixFromRange: e.buildPasteSpecialMatrixFromRange,
1573
+ ensureEditableRowAtIndex: (c) => h.ensureMaterializedRowAt(c, "paste")
1574
+ }), {
1575
+ normalizeClipboardRange: pt,
1576
+ applyClipboardEdits: un,
1577
+ rangesEqual: dn,
1578
+ buildFillMatrixFromRange: it,
1579
+ clearPendingClipboardOperation: St,
1580
+ copySelectedCells: cn,
1581
+ pasteSelectedCells: mn,
1582
+ cutSelectedCells: It,
1583
+ isCellInPendingClipboardRange: fn,
1584
+ isCellOnPendingClipboardEdge: Se
1585
+ } = Zn, {
1586
+ ensureKeyboardActiveCellVisible: Oe,
1587
+ revealCellInComfortZone: st
1588
+ } = Vr({
1589
+ bodyViewportRef: _,
1590
+ visibleColumns: I,
1591
+ resolveColumnWidth: F,
1592
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1593
+ resolveRowHeight: j.resolveRowHeight,
1594
+ resolveRowOffset: j.resolveRowOffset,
1595
+ indexColumnWidth: O.value,
1596
+ defaultColumnWidth: Il,
1597
+ syncViewport: () => re()
1598
+ }), {
1599
+ editingCell: he,
1600
+ editingCellValue: Le,
1601
+ editingCellInitialFilter: xt,
1602
+ editingCellOpenOnMount: Qn,
1603
+ isEditingCell: wn,
1604
+ startInlineEdit: Mt,
1605
+ appendInlineEditTextInput: gn,
1606
+ commitInlineEdit: Ft,
1607
+ cancelInlineEdit: ut,
1608
+ handleEditorKeydown: vn,
1609
+ handleEditorBlur: el
1610
+ } = Br({
1611
+ mode: e.mode,
1612
+ bodyViewportRef: _,
1613
+ visibleColumns: I,
1614
+ totalRows: R,
1615
+ runtime: W,
1616
+ readCell: (c, y) => Rt(c, y),
1617
+ resolveRowIndexById: $t,
1618
+ applyCellSelection: (c) => {
1619
+ Qt(c, !1);
1620
+ },
1621
+ ensureActiveCellVisible: (c, y) => {
1622
+ Oe(c, y);
1623
+ },
1624
+ isCellEditable: Ct,
1625
+ captureRowsSnapshot: Ae,
1626
+ captureRowsSnapshotForRowIds: Be,
1627
+ recordEditTransaction: (c, y, S) => {
1628
+ De({
1629
+ intent: "edit",
1630
+ label: S ?? "Cell edit"
1631
+ }, c, y);
1632
+ },
1633
+ ensureEditableRowAtIndex: (c) => h.ensureMaterializedRowAt(c, "edit"),
1634
+ onCellEdit: e.onCellEdit
1635
+ });
1636
+ T = wn;
1637
+ const Je = w(() => he.value);
1638
+ Rr(() => {
1639
+ e.reportFillPlumbingState?.("runtime_diagnostics_alive", !0), e.reportFillPlumbingDetail?.("runtime_diagnostics_alive", "yes");
1640
+ });
1641
+ function Ie() {
1642
+ const c = e.runtime.api.rows.getSnapshot();
1643
+ return {
1644
+ sortModel: c.sortModel ?? [],
1645
+ filterModel: c.filterModel ?? null,
1646
+ groupBy: c.groupBy ?? null,
1647
+ groupExpansion: c.groupExpansion ?? { expandedByDefault: !1, toggledGroupKeys: [] },
1648
+ treeData: null,
1649
+ pivot: null,
1650
+ pagination: c.pagination ?? {
1651
+ enabled: !1,
1652
+ pageSize: 0,
1653
+ currentPage: 0,
1654
+ pageCount: 0,
1655
+ totalRowCount: 0,
1656
+ startIndex: 0,
1657
+ endIndex: 0
1658
+ }
1659
+ };
1660
+ }
1661
+ function $e() {
1662
+ const c = e.runtimeRowModel?.getSnapshot?.();
1663
+ if (!c)
1664
+ return "none";
1665
+ const y = c.viewportRange;
1666
+ return [
1667
+ `rowCount=${c.rowCount}`,
1668
+ `loading=${c.loading ? "yes" : "no"}`,
1669
+ `viewport=${y.start}..${y.end}`,
1670
+ `revision=${c.revision ?? "none"}`
1671
+ ].join(" ");
1672
+ }
1673
+ function hn(c) {
1674
+ return !c || c.kind === "group" ? "none" : String(c.row.region ?? c.data.region ?? "none");
1675
+ }
1676
+ function Xe(c) {
1677
+ return c ? `${String(c.rowId)}:${hn(c)}` : "none";
1678
+ }
1679
+ function At() {
1680
+ const c = le.value;
1681
+ if (c.length === 0)
1682
+ return null;
1683
+ const y = c[0], S = c[c.length - 1], D = y && Number.isFinite(y.displayIndex) ? Math.max(0, Math.trunc(y.displayIndex)) : null, ee = S && Number.isFinite(S.displayIndex) ? Math.max(0, Math.trunc(S.displayIndex)) : null, U = D ?? N.value, V = ee != null ? Math.max(U, ee) : Math.max(U, U + c.length - 1);
1684
+ return {
1685
+ startRow: U,
1686
+ endRow: V,
1687
+ startColumn: 0,
1688
+ endColumn: Math.max(0, e.visibleColumns.value.length - 1)
1689
+ };
1690
+ }
1691
+ function tl(c) {
1692
+ const S = W.resolveBodyRowIndexById("srv-000025"), D = S >= 0 ? W.getBodyRowAtIndex(S) : null, ee = D && D.kind !== "group" ? String(D.row.region ?? "none") : "none", U = [
1693
+ W.getBodyRowAtIndex(0),
1694
+ W.getBodyRowAtIndex(1),
1695
+ W.getBodyRowAtIndex(2),
1696
+ W.getBodyRowAtIndex(3),
1697
+ W.getBodyRowAtIndex(4)
1698
+ ].filter((ge) => ge != null).map((ge) => String(ge.rowId)).join(", ");
1699
+ e.reportFillPlumbingDetail?.("runtime_viewport_range", `${N.value}..${tt.value}`), e.reportFillPlumbingDetail?.("runtime_rowModel_snapshot", $e()), e.reportFillPlumbingDetail?.("runtime_visible_first5", U || "none"), e.reportFillPlumbingDetail?.("runtime_sample_row25_visible_index", S >= 0 ? String(S) : "none"), e.reportFillPlumbingDetail?.("runtime_sample_row25_region", ee);
1700
+ const V = e.runtime.getBodyRowAtIndex(1), $ = e.runtime.syncBodyRowsInRange({
1701
+ start: 0,
1702
+ end: Math.min(23, Math.max(0, e.runtime.rowPartition.value.bodyRowCount - 1))
1703
+ }), ue = $.find((ge) => Math.trunc(ge.displayIndex) === 1) ?? $[1] ?? null, X = e.runtime.getBodyRowAtIndex(1), ye = le.value[1] ?? null;
1704
+ e.reportFillPlumbingDetail?.(
1705
+ "server_fill_row1_cache_status",
1706
+ V != null && ue != null && V === ue ? "cache-hit" : "pulled-fresh"
1707
+ ), e.reportFillPlumbingDetail?.("server_fill_row1_sync_value", Xe(ue)), e.reportFillPlumbingDetail?.("source_body_row1", Xe(X)), e.reportFillPlumbingDetail?.("source_body_row1_identity", [
1708
+ `before=${Xe(V)}`,
1709
+ `sameDisplay=${X != null && ye != null && X === ye ? "yes" : "no"}`,
1710
+ `sameSync=${X != null && ue != null && X === ue ? "yes" : "no"}`,
1711
+ `revision=${Gt.value ?? "none"}`
1712
+ ].join(" ")), e.reportFillPlumbingDetail?.("source_sync_row1", Xe(ue)), e.reportFillPlumbingState?.("runtime_redraw_happened", !0), e.reportFillPlumbingDetail?.("runtime_redraw_reason", c);
1713
+ }
1714
+ async function bn(c) {
1715
+ const y = e.runtimeRowModel, S = e.runtime.api.rows, D = u.value ? {
1716
+ startRow: u.value.startRow,
1717
+ endRow: u.value.endRow,
1718
+ endColumn: Math.max(0, e.visibleColumns.value.length - 1)
1719
+ } : null, ee = gt.value ? {
1720
+ startRow: gt.value.start,
1721
+ endRow: gt.value.end,
1722
+ endColumn: Math.max(0, e.visibleColumns.value.length - 1)
1723
+ } : null, U = At(), V = D ?? ee ?? U ?? {
1724
+ startRow: N.value,
1725
+ endRow: tt.value,
1726
+ endColumn: Math.max(0, e.visibleColumns.value.length - 1)
1727
+ };
1728
+ e.reportFillPlumbingDetail?.("server_fill_latest_rendered_viewport", Dt(u.value)), e.reportFillPlumbingDetail?.("server_fill_runtime_rendered_viewport", Ke(ee)), e.reportFillPlumbingDetail?.("server_fill_displayrows_rendered_viewport", Ke(U)), e.reportFillPlumbingDetail?.("server_fill_selected_rendered_viewport", Ke(V)), e.reportFillPlumbingDetail?.("server_fill_refresh_used_stored_rendered", D ? "yes" : "no");
1729
+ const $ = yn(c) ?? yn({
1730
+ startRow: V.startRow,
1731
+ endRow: V.endRow
1732
+ });
1733
+ e.reportFillPlumbingDetail?.("server_fill_raw_invalidation", c ? JSON.stringify(c) : "none"), e.reportFillPlumbingDetail?.("server_fill_invalidation_range", $ ? `${$.start}..${$.end}` : "none"), e.reportFillPlumbingDetail?.("server_fill_normalized_invalidation", $ ? `${$.start}..${$.end}` : "none"), e.reportFillPlumbingDetail?.("server_fill_sync_input_range", Ke(V)), e.reportFillPlumbingDetail?.("server_fill_runtime_rowModel_invalidate_type", typeof y?.invalidateRange == "function" ? "function" : typeof y?.invalidateRange);
1734
+ const ue = e.runtime.getBodyRowAtIndex(1);
1735
+ let X = !1;
1736
+ $ && typeof y?.invalidateRange == "function" && (y.invalidateRange($), X = !0);
1737
+ const ye = e.runtime.getBodyRowAtIndex(1);
1738
+ e.reportFillPlumbingState?.("server_fill_invalidation_called", X), e.reportFillPlumbingDetail?.("server_fill_cache_row1_before_invalidation", ue ? "yes" : "no"), e.reportFillPlumbingDetail?.("server_fill_cache_row1_after_invalidation", ye ? "yes" : "no"), e.reportFillPlumbingState?.("server_fill_invalidation_applied", X), typeof S.refresh == "function" && await S.refresh(), V && (e.runtime.setViewportRange?.({
1739
+ start: V.startRow,
1740
+ end: V.endRow
1741
+ }), e.reportFillPlumbingDetail?.("server_fill_rendered_viewport", Ke(V))), V ? J({
1742
+ start: V.startRow,
1743
+ end: V.endRow
1744
+ }) : re(), await et(), tl("server-fill-refresh");
1745
+ }
1746
+ function Dt(c) {
1747
+ return c ? `${c.startRow}..${c.endRow}` : "none";
1748
+ }
1749
+ function Ke(c) {
1750
+ return c ? `${c.startRow}..${c.endRow}` : "none";
1751
+ }
1752
+ function yn(c) {
1753
+ if (!c)
1754
+ return null;
1755
+ const y = c, S = Number.isFinite(y.startRow) ? y.startRow : y.start, D = Number.isFinite(y.endRow) ? y.endRow : y.end, ee = Number(S), U = Number(D ?? S);
1756
+ return !Number.isFinite(ee) || !Number.isFinite(U) ? null : {
1757
+ start: Math.max(0, Math.trunc(ee)),
1758
+ end: Math.max(Math.max(0, Math.trunc(ee)), Math.trunc(U))
1759
+ };
1760
+ }
1761
+ function Rn(c) {
1762
+ return c ? c.endRow >= N.value && c.startRow <= tt.value : !1;
1763
+ }
1764
+ const Ot = () => (e.historyShortcuts?.value ?? "grid") !== "grid" ? !1 : bt() || ve.value === "committed", _t = () => (e.historyShortcuts?.value ?? "grid") !== "grid" ? !1 : pe() || ve.value === "undone", kt = (c) => {
1765
+ if ((e.historyShortcuts?.value ?? "grid") !== "grid")
1766
+ return Promise.resolve(null);
1767
+ if (je.value && (c === "undo" || c === "redo") && (c === "undo" && ve.value === "committed" || c === "redo" && ve.value === "undone")) {
1768
+ const S = je.value, D = e.runtimeRowModel?.dataSource, ee = Ie(), U = c === "undo" ? D?.undoFillOperation : D?.redoFillOperation;
1769
+ if (U)
1770
+ return Promise.resolve(U({
1771
+ operationId: S.operationId,
1772
+ revision: S.revision,
1773
+ projection: ee
1774
+ })).then(async (V) => {
1775
+ const $ = V?.invalidation?.kind === "range" ? V.invalidation.range : S.affectedRange ?? null;
1776
+ return e.reportFillPlumbingDetail?.("server_fill_affected_range", Ke($)), e.reportFillPlumbingDetail?.("server_fill_visible_overlap", Rn($) ? "yes" : "no"), await bn($), ve.value = c === "undo" ? "undone" : "committed", S.operationId;
1777
+ });
1778
+ }
1779
+ return ae(c);
1780
+ }, Cn = async (c, y) => {
1781
+ const S = pt(c), D = pt(y);
1782
+ if (!S || !D || dn(S, D))
1783
+ return !1;
1784
+ const ee = it(S), U = S.endRow - S.startRow + 1, V = S.endColumn - S.startColumn + 1, $ = /* @__PURE__ */ new Map();
1785
+ for (let t = 0; t < U; t += 1) {
1786
+ let n = !1;
1787
+ for (let o = 0; o < V; o += 1)
1788
+ if ((ee[t]?.[o] ?? "").length > 0) {
1789
+ n = !0;
1790
+ break;
1791
+ }
1792
+ $.set(D.startRow + t, n);
1793
+ }
1794
+ const ue = Ae(), X = /* @__PURE__ */ new Map();
1795
+ let ye = 0, ge = 0;
1796
+ const Fn = (t) => {
1797
+ const n = X.get(t);
1798
+ if (n)
1799
+ return n;
1800
+ const o = {};
1801
+ return X.set(t, o), o;
1802
+ };
1803
+ for (let t = S.startRow; t <= S.endRow; t += 1) {
1804
+ const n = W.getBodyRowAtIndex(t);
1805
+ if (!(!n || n.kind === "group" || n.rowId == null || h.isPlaceholderRow(n)))
1806
+ for (let o = S.startColumn; o <= S.endColumn; o += 1) {
1807
+ const s = I.value[o]?.key;
1808
+ !s || A(s) || (Fn(n.rowId)[s] = "");
1809
+ }
1810
+ }
1811
+ for (let t = D.startRow; t <= D.endRow; t += 1) {
1812
+ let n = W.getBodyRowAtIndex(t);
1813
+ h.isPlaceholderRow(n) && $.get(t) === !0 && (n = h.ensureMaterializedRowAt(t, "paste"));
1814
+ for (let o = D.startColumn; o <= D.endColumn; o += 1) {
1815
+ const s = I.value[o]?.key;
1816
+ if (!s || A(s))
1817
+ continue;
1818
+ const d = t - D.startRow, v = o - D.startColumn, f = ee[d]?.[v] ?? "";
1819
+ if (!n || n.kind === "group" || n.rowId == null || h.isPlaceholderRow(n)) {
1820
+ ye += 1;
1821
+ continue;
1822
+ }
1823
+ Fn(n.rowId)[s] = f, ge += 1;
1824
+ }
1825
+ }
1826
+ return ge <= 0 || X.size === 0 ? !1 : (await e.runtime.api.rows.applyEdits(Array.from(X.entries()).map(([t, n]) => ({
1827
+ rowId: t,
1828
+ data: n
1829
+ }))), qe(D), De({
1830
+ intent: "move",
1831
+ label: ye > 0 ? `Move ${ge} cells (blocked ${ye})` : `Move ${ge} cells`,
1832
+ affectedRange: D
1833
+ }, ue), re(), !0);
1834
+ }, Et = {
1835
+ mode: e.mode,
1836
+ enableFillHandle: e.enableFillHandle,
1837
+ enableRangeMove: e.enableRangeMove,
1838
+ runtime: W,
1839
+ totalRows: R,
1840
+ visibleColumns: I,
1841
+ viewportRowStart: N,
1842
+ selectionSnapshot: e.selectionSnapshot,
1843
+ bodyViewportRef: _,
1844
+ indexColumnWidth: O.value,
1845
+ resolveColumnWidth: F,
1846
+ resolveRowHeight: j.resolveRowHeight,
1847
+ resolveRowIndexAtOffset: j.resolveRowIndexAtOffset,
1848
+ normalizeRowId: Xt,
1849
+ normalizeCellCoord: Zt,
1850
+ resolveSelectionRange: rt,
1851
+ applySelectionRange: qe,
1852
+ applyCellSelectionByCoord: Qt,
1853
+ setCellSelection: Kn,
1854
+ clearCellSelection: en,
1855
+ readCell: (c, y) => Rt(c, y),
1856
+ isCellEditable: Ct,
1857
+ cloneRowData: e.cloneRowData,
1858
+ resolveRowIndexById: $t,
1859
+ isRowMaterializedAtIndex: (c) => {
1860
+ const y = W.getBodyRowAtIndex(c);
1861
+ return !!y && y.__placeholder !== !0;
1862
+ },
1863
+ resolveFillBoundary: (() => {
1864
+ const y = e.runtimeRowModel?.dataSource?.resolveFillBoundary;
1865
+ if (e.reportFillPlumbingState?.("stage_runtime_rowmodel", typeof y == "function"), typeof y == "function")
1866
+ return async (S) => {
1867
+ const D = e.runtime.api.rows.getSnapshot();
1868
+ return y({
1869
+ ...S,
1870
+ projection: {
1871
+ sortModel: D.sortModel ?? [],
1872
+ filterModel: D.filterModel ?? null,
1873
+ groupBy: D.groupBy ?? null,
1874
+ groupExpansion: D.groupExpansion ?? { expandedByDefault: !1, toggledGroupKeys: [] },
1875
+ treeData: null,
1876
+ pivot: null,
1877
+ pagination: D.pagination ?? {
1878
+ enabled: !1,
1879
+ pageSize: 0,
1880
+ currentPage: 0,
1881
+ pageCount: 0,
1882
+ totalRowCount: 0,
1883
+ startIndex: 0,
1884
+ endIndex: 0
1885
+ }
1886
+ }
1887
+ });
1888
+ };
1889
+ })(),
1890
+ runtimeRowModel: e.runtimeRowModel ?? null,
1891
+ reportFillWarning: e.reportFillWarning,
1892
+ reportCenterPaneDiagnostics: Ue,
1893
+ reportFillPlumbingState: e.reportFillPlumbingState,
1894
+ reportFillPlumbingDetail: e.reportFillPlumbingDetail,
1895
+ ensureEditableRowAtIndex: (c) => h.ensureMaterializedRowAt(c, "toggle"),
1896
+ captureRowsSnapshot: Ae,
1897
+ captureRowsSnapshotForRowIds: Be,
1898
+ recordIntentTransaction: (c, y, S) => {
1899
+ je.value = null, ve.value = null, De(c, y, S);
1900
+ },
1901
+ recordServerFillTransaction: (c) => {
1902
+ at.recordServerFillTransaction(c), je.value = {
1903
+ operationId: c.operationId,
1904
+ revision: c.revision,
1905
+ affectedRange: c.affectedRange ?? null,
1906
+ mode: c.mode
1907
+ }, ve.value = "committed";
1908
+ },
1909
+ clearPendingClipboardOperation: St,
1910
+ clearExternalPendingClipboardOperation: e.clearExternalPendingClipboardOperation,
1911
+ copySelectedCells: cn,
1912
+ pasteSelectedCells: mn,
1913
+ cutSelectedCells: It,
1914
+ normalizeClipboardRange: pt,
1915
+ applyClipboardEdits: un,
1916
+ rangesEqual: dn,
1917
+ buildFillMatrixFromRange: it,
1918
+ applyRangeMove: e.applyRangeMove ?? Cn,
1919
+ refreshServerFillViewport: bn,
1920
+ syncViewport: () => re(),
1921
+ editingCell: Je,
1922
+ startInlineEdit: Mt,
1923
+ appendInlineEditTextInput: gn,
1924
+ cancelInlineEdit: ut,
1925
+ commitInlineEdit: Ft,
1926
+ canUndo: Ot,
1927
+ canRedo: _t,
1928
+ runHistoryAction: kt,
1929
+ ensureKeyboardActiveCellVisible: Oe,
1930
+ isContextMenuVisible: e.isContextMenuVisible,
1931
+ closeContextMenu: e.closeContextMenu,
1932
+ openContextMenuFromCurrentCell: e.openContextMenuFromCurrentCell,
1933
+ runRowIndexKeyboardAction: e.runRowIndexKeyboardAction
1934
+ }, nl = jr(Et), {
1935
+ isPointerSelectingCells: Ze,
1936
+ isFillDragging: _e,
1937
+ fillPreviewRange: ke,
1938
+ lastAppliedFill: ll,
1939
+ isRangeMoving: rl,
1940
+ selectionRange: ol,
1941
+ rangeMovePreviewRange: al,
1942
+ stopPointerSelection: we,
1943
+ stopFillSelection: il,
1944
+ startFillHandleDrag: pn,
1945
+ startFillHandleDoubleClick: sl,
1946
+ applyLastFillBehavior: ul,
1947
+ handleCellMouseDown: Pt,
1948
+ handleCellKeydown: Sn,
1949
+ handleRowIndexKeydown: ie,
1950
+ handleWindowMouseMove: xe,
1951
+ handleWindowMouseUp: L,
1952
+ isCellInFillPreview: ce,
1953
+ isFillHandleCell: In,
1954
+ clearSelectedCells: dl,
1955
+ dispose: Ee
1956
+ } = nl, Tt = w(() => Ze.value ? ol.value : null), cl = Wo({
1957
+ runtime: W,
1958
+ selectionSnapshot: e.selectionSnapshot,
1959
+ totalRows: R,
1960
+ orderedVisibleColumns: I,
1961
+ viewportRowStart: N,
1962
+ applySelectionRange: qe,
1963
+ handleCellKeydown: Sn
1964
+ }), {
1965
+ isColumnResizing: ml,
1966
+ startResize: fl,
1967
+ handleResizeDoubleClick: wl,
1968
+ applyColumnResizeFromPointer: be,
1969
+ stopColumnResize: xn,
1970
+ dispose: gl
1971
+ } = Gr({
1972
+ visibleColumns: I,
1973
+ rows: e.rows,
1974
+ persistColumnWidth: (c, y) => {
1975
+ e.runtime.api.columns.setWidth(c, y);
1976
+ },
1977
+ defaultColumnWidth: Il,
1978
+ minColumnWidth: Yo,
1979
+ autoSizeSampleLimit: Xo,
1980
+ autoSizeCharWidth: 7.2,
1981
+ autoSizeHorizontalPadding: 42,
1982
+ autoSizeMaxWidth: 640,
1983
+ isFillDragging: () => _e.value,
1984
+ stopFillSelection: () => {
1985
+ il(!1);
1986
+ },
1987
+ isDragSelecting: () => Ze.value,
1988
+ stopDragSelection: () => {
1989
+ we();
1990
+ },
1991
+ readCellText: (c, y) => {
1992
+ const S = c[y];
1993
+ return S == null ? "" : String(S);
1994
+ }
1995
+ }), Ne = Uo({
1996
+ mode: e.mode,
1997
+ viewportRowStart: N,
1998
+ selectionAnchorCell: ht,
1999
+ fillPreviewRange: ke,
2000
+ isFillDragging: _e,
2001
+ interactionSelectionRange: Tt,
2002
+ resolveCommittedSelectionRange: rt,
2003
+ resolveCommittedSelectionRanges: ot,
2004
+ isCommittedSelectionAnchorCell: Nn,
2005
+ isCommittedCellSelected: tn,
2006
+ shouldHighlightCommittedSelectedCell: Wn,
2007
+ isCommittedCellOnSelectionEdge: nn
2008
+ }), { selectionRange: zt, selectionRanges: vl } = Ne, hl = Lo({
2009
+ lastAppliedFill: ll,
2010
+ selectionRange: zt,
2011
+ isFillDragging: _e
2012
+ }), bl = No({
2013
+ bodyViewportRef: _,
2014
+ isColumnResizing: ml,
2015
+ applyColumnResizeFromPointer: be,
2016
+ stopColumnResize: xn,
2017
+ handleInteractionWindowMouseMove: xe,
2018
+ handleInteractionWindowMouseUp: L,
2019
+ syncViewport: Fe
2020
+ }), H = {
2021
+ rowSelection: ln,
2022
+ history: at,
2023
+ cellIo: Ge,
2024
+ viewportKeyboard: cl,
2025
+ visualSelection: Ne,
2026
+ fillAction: hl,
2027
+ scrollSync: bl
2028
+ }, {
2029
+ tableStageProps: yl,
2030
+ tableStageContext: Mn
2031
+ } = Bo({
2032
+ mode: e.mode,
2033
+ rowHeightMode: e.rowHeightMode,
2034
+ layoutMode: e.layoutMode,
2035
+ chromeSignature: e.chromeSignature,
2036
+ visibleColumns: I,
2037
+ renderedColumns: Bt,
2038
+ displayRows: le,
2039
+ displayRowsRevision: Pn,
2040
+ runtimeRevision: Gt,
2041
+ pinnedBottomRows: se,
2042
+ sourceRows: e.sourceRows ?? e.rows,
2043
+ showRowIndex: i,
2044
+ rowHover: w(() => e.rowHover?.value === !0),
2045
+ stripedRows: w(() => e.stripedRows?.value === !0),
2046
+ columnFilterTextByKey: e.columnFilterTextByKey,
2047
+ gridContentStyle: Bn,
2048
+ mainTrackStyle: jn,
2049
+ indexColumnStyle: rn,
2050
+ stageStyle: wt,
2051
+ bodyShellStyle: We,
2052
+ topSpacerHeight: Tn,
2053
+ bottomSpacerHeight: zn,
2054
+ viewportRowStart: N,
2055
+ viewportRowEnd: tt,
2056
+ virtualRowTotal: R,
2057
+ baseRowHeight: e.normalizedBaseRowHeight,
2058
+ resolveRowHeight: j.resolveRowHeight,
2059
+ resolveRowOffset: j.resolveRowOffset,
2060
+ columnWindowStart: nt,
2061
+ leftColumnSpacerWidth: Hn,
2062
+ rightColumnSpacerWidth: Vn,
2063
+ editingCellValueRef: Le,
2064
+ editingCellInitialFilter: xt,
2065
+ editingCellOpenOnMount: Qn,
2066
+ selectionRange: zt,
2067
+ selectionRanges: vl,
2068
+ selectionAnchorCell: ht,
2069
+ totalRowCount: R,
2070
+ fillPreviewRange: ke,
2071
+ rangeMovePreviewRange: al,
2072
+ customOverlays: yt,
2073
+ reportCenterPaneDiagnostics: Ue,
2074
+ fillHandleEnabled: w(() => e.enableFillHandle.value),
2075
+ rangeMoveEnabled: w(() => e.enableRangeMove.value),
2076
+ isFillDragging: _e,
2077
+ isRangeMoving: rl,
2078
+ headerViewportRef: z,
2079
+ bodyViewportRef: _,
2080
+ columnStyle: Lt,
2081
+ reorderColumnsByHeader: e.reorderColumnsByHeader,
2082
+ toggleSortForColumn: e.toggleSortForColumn,
2083
+ handleHeaderColumnClick: e.handleHeaderColumnClick,
2084
+ sortIndicator: e.sortIndicator,
2085
+ setColumnFilterText: e.setColumnFilterText,
2086
+ columnMenuEnabled: e.columnMenuEnabled,
2087
+ columnMenuTrigger: e.columnMenuTrigger,
2088
+ columnMenuValueFilterEnabled: e.columnMenuValueFilterEnabled,
2089
+ columnMenuValueFilterRowLimit: e.columnMenuValueFilterRowLimit,
2090
+ columnMenuMaxFilterValues: e.columnMenuMaxFilterValues,
2091
+ resolveColumnMenuItems: e.resolveColumnMenuItems,
2092
+ resolveColumnMenuDisabledItems: e.resolveColumnMenuDisabledItems,
2093
+ resolveColumnMenuDisabledReasons: e.resolveColumnMenuDisabledReasons,
2094
+ resolveColumnMenuLabels: e.resolveColumnMenuLabels,
2095
+ resolveColumnMenuActionOptions: e.resolveColumnMenuActionOptions,
2096
+ resolveColumnMenuCustomItems: e.resolveColumnMenuCustomItems,
2097
+ isColumnFilterActive: e.isColumnFilterActive,
2098
+ isColumnGrouped: e.isColumnGrouped,
2099
+ resolveColumnGroupOrder: e.resolveColumnGroupOrder,
2100
+ resolveColumnMenuSortDirection: e.resolveColumnMenuSortDirection,
2101
+ resolveColumnMenuSelectedTokens: e.resolveColumnMenuSelectedTokens,
2102
+ resolveColumnMenuValueEntries: e.resolveColumnMenuValueEntries,
2103
+ applyColumnMenuSort: e.applyColumnMenuSort,
2104
+ applyColumnMenuPin: e.applyColumnMenuPin,
2105
+ applyColumnMenuGroupBy: e.applyColumnMenuGroupBy,
2106
+ applyColumnMenuFilter: e.applyColumnMenuFilter,
2107
+ clearColumnMenuFilter: e.clearColumnMenuFilter,
2108
+ handleHeaderWheel: H.scrollSync.handleHeaderWheel,
2109
+ handleHeaderScroll: H.scrollSync.handleHeaderScroll,
2110
+ handleViewportScroll: Fe,
2111
+ handleViewportKeydown: H.viewportKeyboard.handleViewportKeydown,
2112
+ rowClass: Xn,
2113
+ isRowAutosizeProbe: Wt,
2114
+ rowStyle: Nt,
2115
+ isRowInPendingClipboardCut: e.isRowInPendingClipboardCut,
2116
+ isRowFocused: H.rowSelection.isRowFocused,
2117
+ isRowCheckboxSelected: H.rowSelection.isRowCheckboxSelected,
2118
+ allVisibleRowsSelected: H.rowSelection.areAllVisibleRowsSelected,
2119
+ someVisibleRowsSelected: H.rowSelection.areSomeVisibleRowsSelected,
2120
+ handleRowClick: H.rowSelection.focusRow,
2121
+ handleRowIndexClick: H.rowSelection.selectRowRange,
2122
+ handleRowIndexKeydown: ie,
2123
+ reorderRowsByIndex: e.reorderRowsByIndex,
2124
+ handleToggleAllVisibleRows: H.rowSelection.toggleVisibleRowsSelected,
2125
+ toggleGroupRow: Ye,
2126
+ rowIndexLabel: on,
2127
+ startResize: fl,
2128
+ handleResizeDoubleClick: wl,
2129
+ startRowResize: Ut,
2130
+ autosizeRow: qt,
2131
+ isCellSelected: H.visualSelection.isCellSelected,
2132
+ isSelectionAnchorCell: H.visualSelection.isSelectionAnchorCell,
2133
+ shouldHighlightSelectedCell: H.visualSelection.shouldHighlightSelectedCell,
2134
+ isCellOnSelectionEdge: H.visualSelection.isCellOnSelectionEdge,
2135
+ isCellInFillPreview: ce,
2136
+ isCellInPendingClipboardRange: fn,
2137
+ isCellOnPendingClipboardEdge: Se,
2138
+ isEditingCell: wn,
2139
+ isCellEditable: (c, y, S, D) => sn(
2140
+ c,
2141
+ S,
2142
+ () => M(c, N.value + y, S)
2143
+ ),
2144
+ handleCellMouseDown: Pt,
2145
+ handleCellClick: H.cellIo.handleCellClick,
2146
+ handleCellKeydown: Sn,
2147
+ startInlineEdit: Mt,
2148
+ isFillHandleCell: In,
2149
+ startFillHandleDrag: pn,
2150
+ startFillHandleDoubleClick: sl,
2151
+ fillActionAnchorCell: H.fillAction.fillActionAnchorCell,
2152
+ fillActionBehavior: H.fillAction.fillActionBehavior,
2153
+ applyFillActionBehavior: ul,
2154
+ handleEditorKeydown: vn,
2155
+ handleEditorBlur: el,
2156
+ commitInlineEdit: Ft,
2157
+ cancelInlineEdit: ut,
2158
+ readCell: H.cellIo.readStageCell,
2159
+ readDisplayCell: H.cellIo.readStageDisplayCell,
2160
+ cellClass: e.cellClass ? (c, y, S, D) => e.cellClass?.(
2161
+ c,
2162
+ N.value + y,
2163
+ S,
2164
+ D
2165
+ ) : void 0,
2166
+ cellStyle: e.cellStyle ? (c, y, S, D) => e.cellStyle?.(
2167
+ c,
2168
+ N.value + y,
2169
+ S,
2170
+ D
2171
+ ) : void 0
2172
+ });
2173
+ return Lr({
2174
+ mode: e.mode,
2175
+ rows: e.rows,
2176
+ runtime: e.runtime,
2177
+ totalRows: R,
2178
+ rowVersion: e.rowVersion,
2179
+ rowHeightMode: e.rowHeightMode,
2180
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
2181
+ syncSelectionSnapshotFromRuntime: e.syncSelectionSnapshotFromRuntime,
2182
+ syncRowSelectionSnapshotFromRuntime: l,
2183
+ syncViewport: re,
2184
+ scheduleViewportSync: lt,
2185
+ measureVisibleRowHeights: vt,
2186
+ applyRowHeightSettings: e.applyRowHeightSettings
2187
+ }), $r({
2188
+ bodyViewportRef: _,
2189
+ syncViewport: re,
2190
+ handleWindowMouseMove: H.scrollSync.handleWindowMouseMove,
2191
+ handleWindowMouseUp: H.scrollSync.handleWindowMouseUp,
2192
+ cancelScheduledViewportSync: jt,
2193
+ onAfterMount: () => {
2194
+ e.syncSelectionSnapshotFromRuntime(), l(), et(() => {
2195
+ e.applyRowHeightSettings(), re();
2196
+ });
2197
+ },
2198
+ dispose: [
2199
+ Jt,
2200
+ gl,
2201
+ Ee,
2202
+ H.history.disposeIntentHistory
2203
+ ]
2204
+ }), {
2205
+ tableStageProps: yl,
2206
+ tableStageContext: Mn,
2207
+ historyController: {
2208
+ canUndo: Ot,
2209
+ canRedo: _t,
2210
+ runHistoryAction: kt
2211
+ },
2212
+ syncViewportFromDom: re,
2213
+ copySelectedCells: cn,
2214
+ pasteSelectedCells: mn,
2215
+ cutSelectedCells: It,
2216
+ clearSelectedCells: dl,
2217
+ captureHistorySnapshot: Ae,
2218
+ captureHistorySnapshotForRowIds: Be,
2219
+ recordHistoryIntentTransaction: De,
2220
+ revealCellInComfortZone: st
2221
+ };
2222
+ }
2223
+ function Dl(e) {
2224
+ return e === "or" ? "or" : "and";
2225
+ }
2226
+ function jl(e) {
2227
+ return e == null ? "" : e instanceof Date ? e.toISOString() : Array.isArray(e) ? e.map((l) => jl(l)).filter((l) => l.length > 0).join(", ") : String(e);
2228
+ }
2229
+ function Qo(e) {
2230
+ const l = e.indexOf(":");
2231
+ if (l > 0) {
2232
+ const a = e.slice(0, l);
2233
+ if (/^[a-z-]+$/i.test(a))
2234
+ return e.slice(l + 1);
2235
+ }
2236
+ return e;
2237
+ }
2238
+ function ea(e) {
2239
+ const l = [];
2240
+ for (const [a, r] of Object.entries(e.columnFilters ?? {})) {
2241
+ if (!r)
2242
+ continue;
2243
+ if (r.kind === "valueSet") {
2244
+ const i = Array.from(new Set(
2245
+ (r.tokens ?? []).map((g) => Qo(String(g ?? ""))).map((g) => g.trim()).filter((g) => g.length > 0)
2246
+ ));
2247
+ if (i.length === 0)
2248
+ continue;
2249
+ l.push({
2250
+ id: l.length,
2251
+ join: "and",
2252
+ columnKey: a,
2253
+ operator: "in",
2254
+ value: i.join(", ")
2255
+ });
2256
+ continue;
2257
+ }
2258
+ const u = [r.value, r.value2].map((i) => jl(i)).filter((i) => i.length > 0);
2259
+ u.length !== 0 && l.push({
2260
+ id: l.length,
2261
+ join: "and",
2262
+ columnKey: a,
2263
+ operator: String(r.operator ?? "contains"),
2264
+ value: u.join(", ")
2265
+ });
2266
+ }
2267
+ return l;
2268
+ }
2269
+ function mr(e) {
2270
+ if (!e || e.kind === "not")
2271
+ return [];
2272
+ if (e.kind === "condition")
2273
+ return [{
2274
+ id: 0,
2275
+ join: "and",
2276
+ columnKey: String(e.key ?? e.field ?? ""),
2277
+ operator: String(e.operator ?? "contains"),
2278
+ value: jl(e.value)
2279
+ }];
2280
+ const l = [];
2281
+ for (let a = 0; a < e.children.length; a += 1) {
2282
+ const r = e.children[a];
2283
+ if (!r)
2284
+ continue;
2285
+ const u = mr(r);
2286
+ if (u.length === 0)
2287
+ continue;
2288
+ const i = u[0];
2289
+ a > 0 && i && (u[0] = {
2290
+ ...i,
2291
+ id: i.id,
2292
+ join: Dl(e.operator)
2293
+ }), l.push(...u);
2294
+ }
2295
+ return l;
2296
+ }
2297
+ function Jl(e) {
2298
+ if (!e)
2299
+ return [];
2300
+ const l = ea(e), a = e.advancedExpression ?? Ar(e.advancedFilters), r = mr(a ?? null);
2301
+ return [
2302
+ ...l,
2303
+ ...r.map((i, g) => l.length > 0 && g === 0 ? {
2304
+ ...i,
2305
+ join: Dl("and")
2306
+ } : i)
2307
+ ].map((i, g) => ({
2308
+ ...i,
2309
+ id: g,
2310
+ join: g === 0 ? Dl("and") : i.join
2311
+ }));
2312
+ }
2313
+ const ta = Pl(() => import("./DataGridAdvancedFilterPopover-C_MjEKFo.js")), na = Pl(() => import("./DataGridAggregationsPopover-C8kdwv0O.js")), la = Pl(() => import("./DataGridFindReplacePopover-Dou8Fsm3.js"));
2314
+ function ra(e) {
2315
+ return {
2316
+ ...e,
2317
+ component: Cr(pr(e.component))
2318
+ };
2319
+ }
2320
+ function oa(e, l) {
2321
+ if (!e)
2322
+ return l ?? null;
2323
+ if (!l)
2324
+ return e;
2325
+ const a = {}, r = (u) => {
2326
+ if (typeof u == "string") {
2327
+ for (const i of u.split(/\s+/).filter(Boolean))
2328
+ a[i] = !0;
2329
+ return;
2330
+ }
2331
+ if (Array.isArray(u)) {
2332
+ for (const i of u)
2333
+ if (typeof i == "string")
2334
+ for (const g of i.split(/\s+/).filter(Boolean))
2335
+ a[g] = !0;
2336
+ return;
2337
+ }
2338
+ for (const [i, g] of Object.entries(u))
2339
+ a[i] = g === !0 || a[i] === !0;
2340
+ };
2341
+ return r(e), r(l), Object.keys(a).length > 0 ? a : null;
2342
+ }
2343
+ function aa(e) {
2344
+ return Number.isFinite(e) ? Math.max(24, Math.trunc(e)) : 31;
2345
+ }
2346
+ function Xl(e) {
2347
+ return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
2348
+ }
2349
+ function Zl(e) {
2350
+ return (e ?? []).map((l) => ({
2351
+ key: l.key,
2352
+ direction: l.direction
2353
+ }));
2354
+ }
2355
+ function Ol() {
2356
+ return {
2357
+ columnFilters: {},
2358
+ advancedFilters: {},
2359
+ advancedExpression: null
2360
+ };
2361
+ }
2362
+ function ct(e) {
2363
+ return Or(e ?? Ol()) ?? Ol();
2364
+ }
2365
+ function _l(e) {
2366
+ return e.startsWith("string:") ? `string:${e.slice(7).toLowerCase()}` : e;
2367
+ }
2368
+ function ia(e) {
2369
+ const l = {};
2370
+ for (const [u, i] of Object.entries(e.columnFilters ?? {})) {
2371
+ if (i.kind === "valueSet") {
2372
+ const g = Array.from(new Set(
2373
+ (i.tokens ?? []).map((h) => _l(String(h ?? ""))).filter((h) => h.length > 0)
2374
+ ));
2375
+ if (g.length === 0)
2376
+ continue;
2377
+ l[u] = {
2378
+ kind: "valueSet",
2379
+ tokens: g
2380
+ };
2381
+ continue;
2382
+ }
2383
+ l[u] = {
2384
+ kind: "predicate",
2385
+ operator: i.operator,
2386
+ value: i.value,
2387
+ value2: i.value2,
2388
+ caseSensitive: i.caseSensitive
2389
+ };
2390
+ }
2391
+ const a = { ...e.advancedFilters ?? {} }, r = e.advancedExpression ?? null;
2392
+ return Object.keys(l).length === 0 && Object.keys(a).length === 0 && !r ? null : {
2393
+ columnFilters: l,
2394
+ advancedFilters: a,
2395
+ advancedExpression: r
2396
+ };
2397
+ }
2398
+ function sa(e) {
2399
+ const l = {}, a = e?.columnFilters ?? {};
2400
+ for (const [r, u] of Object.entries(a))
2401
+ u?.kind === "predicate" && typeof u.value == "string" && (l[r] = u.value);
2402
+ return l;
2403
+ }
2404
+ function Ce(e) {
2405
+ if (typeof globalThis.structuredClone == "function")
2406
+ try {
2407
+ return globalThis.structuredClone(e);
2408
+ } catch {
2409
+ }
2410
+ return kl(e, /* @__PURE__ */ new WeakMap());
2411
+ }
2412
+ function kl(e, l) {
2413
+ if (e == null || typeof e != "object")
2414
+ return e;
2415
+ if (e instanceof Date)
2416
+ return new Date(e.getTime());
2417
+ if (Array.isArray(e)) {
2418
+ if (l.has(e))
2419
+ return l.get(e);
2420
+ const a = [];
2421
+ l.set(e, a);
2422
+ for (const r of e)
2423
+ a.push(kl(r, l));
2424
+ return a;
2425
+ }
2426
+ if (fr(e)) {
2427
+ if (l.has(e))
2428
+ return l.get(e);
2429
+ const a = {};
2430
+ l.set(e, a);
2431
+ for (const [r, u] of Object.entries(e))
2432
+ a[r] = kl(u, l);
2433
+ return a;
2434
+ }
2435
+ return e && typeof e == "object" ? { ...e } : e;
2436
+ }
2437
+ function fr(e) {
2438
+ if (!e || typeof e != "object")
2439
+ return !1;
2440
+ const l = Object.getPrototypeOf(e);
2441
+ return l === Object.prototype || l === null;
2442
+ }
2443
+ function ua(e) {
2444
+ const l = /* @__PURE__ */ new WeakSet();
2445
+ try {
2446
+ return JSON.stringify(e, (a, r) => {
2447
+ if (r == null || typeof r != "object")
2448
+ return r;
2449
+ if (r instanceof Date)
2450
+ return r.toISOString();
2451
+ if (Array.isArray(r) || fr(r))
2452
+ return l.has(r) ? void 0 : (l.add(r), r);
2453
+ });
2454
+ } catch {
2455
+ return null;
2456
+ }
2457
+ }
2458
+ function Vt(e) {
2459
+ return e ? {
2460
+ columns: e.columns.map((l) => ({ ...l })),
2461
+ basis: e.basis === "source" ? "source" : "filtered"
2462
+ } : null;
2463
+ }
2464
+ function da(e) {
2465
+ return e ? {
2466
+ fields: [...e.fields],
2467
+ expandedByDefault: e.expandedByDefault
2468
+ } : null;
2469
+ }
2470
+ function He(e) {
2471
+ return e == null ? "blank" : e instanceof Date ? e.toISOString() : typeof e == "string" ? `"${e}"` : String(e);
2472
+ }
2473
+ function Ve(e, l) {
2474
+ return no(l, e);
2475
+ }
2476
+ function ca(e, l) {
2477
+ const a = String(e ?? "");
2478
+ if (a === "null")
2479
+ return l.blankValueLabel;
2480
+ const r = a.indexOf(":");
2481
+ if (r < 0)
2482
+ return a;
2483
+ const u = a.slice(0, r), i = a.slice(r + 1);
2484
+ return u === "string" || u === "number" || u === "boolean" || u === "bigint" || u === "date" || u === "repr" || u === "json" ? i : a;
2485
+ }
2486
+ function ma(e, l, a) {
2487
+ return l.kind === "valueSet" ? l.tokens.length === 1 ? `${e}: ${ca(l.tokens[0] ?? "", a)}` : `${e}: ${l.tokens.length} ${a.valuesSummaryLabel}` : l.operator === "between" ? `${e} ${Ve(l.operator, a)} ${He(l.value)} ${a.betweenJoiner} ${He(l.value2)}` : l.operator === "isEmpty" || l.operator === "notEmpty" || l.operator === "isNull" || l.operator === "notNull" ? `${e} ${Ve(l.operator, a)}` : `${e} ${Ve(l.operator, a)} ${He(l.value)}`;
2488
+ }
2489
+ function fa(e, l, a) {
2490
+ const r = l.clauses.map((u, i) => {
2491
+ const g = u.join === "or" ? a.joins.or : a.joins.and, h = i === 0 ? "" : `${g} `;
2492
+ return u.operator === "between" ? `${h}${Ve(u.operator, a)} ${He(u.value)} ${a.betweenJoiner} ${He(u.value2)}` : u.operator === "isEmpty" || u.operator === "notEmpty" || u.operator === "isNull" || u.operator === "notNull" ? `${h}${Ve(u.operator, a)}` : `${h}${Ve(u.operator, a)} ${He(u.value)}`;
2493
+ }).filter((u) => u.length > 0);
2494
+ return r.length === 0 ? `${e}: ${a.activeSummaryFallback}` : `${e} ${r.join(" ")}`;
2495
+ }
2496
+ function El(e, l, a) {
2497
+ if (e.kind === "condition") {
2498
+ const u = l(e.key);
2499
+ return e.operator === "between" ? `${u} ${Ve(e.operator, a)} ${He(e.value)} ${a.betweenJoiner} ${He(e.value2)}` : e.operator === "isEmpty" || e.operator === "notEmpty" || e.operator === "isNull" || e.operator === "notNull" ? `${u} ${Ve(e.operator, a)}` : `${u} ${Ve(e.operator, a)} ${He(e.value)}`;
2500
+ }
2501
+ if (e.kind === "not")
2502
+ return `${a.notOperatorLabel} (${El(e.child, l, a)})`;
2503
+ const r = e.operator === "or" ? a.joins.or : a.joins.and;
2504
+ return e.children.map((u) => El(u, l, a)).filter((u) => u.length > 0).join(` ${r} `);
2505
+ }
2506
+ function Ql(e, l) {
2507
+ return l.activeSummaryPrefix.length > 0 ? `${l.activeSummaryPrefix}: ${e}` : e;
2508
+ }
2509
+ const wa = [
2510
+ "sum",
2511
+ "avg",
2512
+ "min",
2513
+ "max",
2514
+ "count",
2515
+ "countNonNull",
2516
+ "first",
2517
+ "last"
2518
+ ], ga = [
2519
+ "min",
2520
+ "max",
2521
+ "count",
2522
+ "countNonNull",
2523
+ "first",
2524
+ "last"
2525
+ ], va = [
2526
+ "count",
2527
+ "countNonNull",
2528
+ "first",
2529
+ "last"
2530
+ ];
2531
+ function ha(e) {
2532
+ return e === "number" || e === "currency" || e === "percent" ? wa : e === "date" || e === "datetime" ? ga : va;
2533
+ }
2534
+ const ba = {
2535
+ clipboard: ["cut", "copy", "paste"],
2536
+ pasteSpecial: ["paste-values"],
2537
+ edit: ["clear"]
2538
+ }, ya = {
2539
+ insert: ["insert-row-above", "insert-row-below"],
2540
+ clipboard: ["cut-row", "copy-row", "paste-row"],
2541
+ selection: ["delete-selected-rows"]
2542
+ }, er = {
2543
+ cut: "Cut",
2544
+ copy: "Copy",
2545
+ paste: "Paste",
2546
+ "paste-values": "Values only",
2547
+ clear: "Clear values",
2548
+ "insert-row-above": "Insert above",
2549
+ "insert-row-below": "Insert below",
2550
+ "copy-row": "Copy row",
2551
+ "paste-row": "Paste row",
2552
+ "cut-row": "Cut row",
2553
+ "delete-selected-rows": "Delete selected rows",
2554
+ "sort-asc": "Sort ascending",
2555
+ "sort-desc": "Sort descending",
2556
+ "sort-clear": "Clear sort",
2557
+ filter: "Filter column",
2558
+ "auto-size": "Auto size column"
2559
+ }, Ra = {
2560
+ "insert-row-above": "Insert / Ctrl/Cmd+I",
2561
+ "copy-row": "Ctrl/Cmd+C",
2562
+ "paste-row": "Ctrl/Cmd+V",
2563
+ "cut-row": "Ctrl/Cmd+X"
2564
+ }, Wa = kn({
2565
+ name: "DataGridDefaultRenderer",
2566
+ props: {
2567
+ mode: {
2568
+ type: String,
2569
+ required: !0
2570
+ },
2571
+ rows: {
2572
+ type: Array,
2573
+ default: () => []
2574
+ },
2575
+ runtime: {
2576
+ type: Object,
2577
+ required: !0
2578
+ },
2579
+ runtimeRowModel: {
2580
+ type: Object,
2581
+ required: !0
2582
+ },
2583
+ reportFillWarning: {
2584
+ type: Function,
2585
+ default: void 0
2586
+ },
2587
+ reportCenterPaneDiagnostics: {
2588
+ type: Function,
2589
+ default: void 0
2590
+ },
2591
+ reportFillPlumbingState: {
2592
+ type: Function,
2593
+ default: void 0
2594
+ },
2595
+ reportFillPlumbingDetail: {
2596
+ type: Function,
2597
+ default: void 0
2598
+ },
2599
+ selectionSnapshot: {
2600
+ type: Object,
2601
+ required: !0
2602
+ },
2603
+ selectionAnchor: {
2604
+ type: Object,
2605
+ required: !0
2606
+ },
2607
+ rowSelectionSnapshot: {
2608
+ type: Object,
2609
+ required: !0
2610
+ },
2611
+ onCellEdit: {
2612
+ type: Function,
2613
+ default: void 0
2614
+ },
2615
+ syncSelectionSnapshotFromRuntime: {
2616
+ type: Function,
2617
+ required: !0
2618
+ },
2619
+ syncRowSelectionSnapshotFromRuntime: {
2620
+ type: Function,
2621
+ default: () => {
2622
+ }
2623
+ },
2624
+ flushRowSelectionSnapshotUpdates: {
2625
+ type: Function,
2626
+ default: () => {
2627
+ }
2628
+ },
2629
+ sortModel: {
2630
+ type: Array,
2631
+ default: void 0
2632
+ },
2633
+ filterModel: {
2634
+ type: Object,
2635
+ default: void 0
2636
+ },
2637
+ groupBy: {
2638
+ type: Object,
2639
+ default: void 0
2640
+ },
2641
+ pivotModel: {
2642
+ type: Object,
2643
+ default: void 0
2644
+ },
2645
+ renderMode: {
2646
+ type: String,
2647
+ default: "virtualization"
2648
+ },
2649
+ virtualization: {
2650
+ type: Object,
2651
+ required: !0
2652
+ },
2653
+ columnMenu: {
2654
+ type: Object,
2655
+ required: !0
2656
+ },
2657
+ cellMenu: {
2658
+ type: Object,
2659
+ required: !0
2660
+ },
2661
+ rowIndexMenu: {
2662
+ type: Object,
2663
+ required: !0
2664
+ },
2665
+ columnLayout: {
2666
+ type: Object,
2667
+ required: !0
2668
+ },
2669
+ columnReorder: {
2670
+ type: Object,
2671
+ required: !0
2672
+ },
2673
+ aggregations: {
2674
+ type: Object,
2675
+ required: !0
2676
+ },
2677
+ advancedFilter: {
2678
+ type: Object,
2679
+ required: !0
2680
+ },
2681
+ findReplace: {
2682
+ type: Object,
2683
+ required: !0
2684
+ },
2685
+ gridLines: {
2686
+ type: Object,
2687
+ required: !0
2688
+ },
2689
+ rowHeightMode: {
2690
+ type: String,
2691
+ default: "fixed"
2692
+ },
2693
+ baseRowHeight: {
2694
+ type: Number,
2695
+ default: 31
2696
+ },
2697
+ layoutMode: {
2698
+ type: String,
2699
+ default: "fill"
2700
+ },
2701
+ minRows: {
2702
+ type: Number,
2703
+ default: null
2704
+ },
2705
+ maxRows: {
2706
+ type: Number,
2707
+ default: null
2708
+ },
2709
+ placeholderRows: {
2710
+ type: Object,
2711
+ required: !0
2712
+ },
2713
+ fillHandle: {
2714
+ type: Boolean,
2715
+ default: !1
2716
+ },
2717
+ rangeMove: {
2718
+ type: Boolean,
2719
+ default: !1
2720
+ },
2721
+ rowHover: {
2722
+ type: Boolean,
2723
+ default: !1
2724
+ },
2725
+ stripedRows: {
2726
+ type: Boolean,
2727
+ default: !1
2728
+ },
2729
+ readSelectionCell: {
2730
+ type: Function,
2731
+ default: void 0
2732
+ },
2733
+ cellClass: {
2734
+ type: Function,
2735
+ default: void 0
2736
+ },
2737
+ cellStyle: {
2738
+ type: Function,
2739
+ default: void 0
2740
+ },
2741
+ showRowIndex: {
2742
+ type: Boolean,
2743
+ default: !0
2744
+ },
2745
+ rowSelection: {
2746
+ type: Boolean,
2747
+ default: !0
2748
+ },
2749
+ rowReorder: {
2750
+ type: Object,
2751
+ required: !0
2752
+ },
2753
+ isCellEditable: {
2754
+ type: Function,
2755
+ default: void 0
2756
+ },
2757
+ viewMode: {
2758
+ type: String,
2759
+ default: "table"
2760
+ },
2761
+ gantt: {
2762
+ type: [Boolean, Object],
2763
+ default: void 0
2764
+ },
2765
+ toolbarModules: {
2766
+ type: Array,
2767
+ default: () => []
2768
+ },
2769
+ customOverlays: {
2770
+ type: Array,
2771
+ default: void 0
2772
+ },
2773
+ history: {
2774
+ type: Object,
2775
+ required: !0
2776
+ },
2777
+ chrome: {
2778
+ type: Object,
2779
+ required: !0
2780
+ },
2781
+ registerHistoryController: {
2782
+ type: Function,
2783
+ default: () => {
2784
+ }
2785
+ },
2786
+ reportToolbarModules: {
2787
+ type: Function,
2788
+ default: () => {
2789
+ }
2790
+ },
2791
+ runStructuralRowAction: {
2792
+ type: Function,
2793
+ default: void 0
2794
+ },
2795
+ registerStructuralRowActionRunner: {
2796
+ type: Function,
2797
+ default: () => {
2798
+ }
2799
+ },
2800
+ inspectorPanel: {
2801
+ type: Object,
2802
+ default: null
2803
+ }
2804
+ },
2805
+ setup(e) {
2806
+ const l = w(() => ({
2807
+ "--datagrid-row-divider-size": e.gridLines.bodyRows ? "1px" : "0px",
2808
+ "--datagrid-column-divider-size": e.gridLines.bodyColumns ? "1px" : "0px",
2809
+ "--datagrid-header-column-divider-size": e.gridLines.headerColumns ? "1px" : "0px",
2810
+ "--datagrid-pinned-pane-separator-size": e.gridLines.pinnedSeparators ? "2px" : "0px",
2811
+ "--datagrid-app-layout-gap": `${e.chrome.toolbarGap}px`,
2812
+ "--datagrid-app-workspace-gap": `${e.chrome.workspaceGap}px`,
2813
+ "--datagrid-app-toolbar-gap": e.chrome.density === "compact" ? "10px" : "12px",
2814
+ "--datagrid-app-toolbar-group-gap": e.chrome.density === "compact" ? "6px" : "8px",
2815
+ "--datagrid-app-toolbar-button-gap": e.chrome.density === "compact" ? "6px" : "8px",
2816
+ "--datagrid-app-toolbar-button-height": e.chrome.density === "compact" ? "28px" : "32px",
2817
+ "--datagrid-app-toolbar-button-padding-inline": e.chrome.density === "compact" ? "10px" : "12px",
2818
+ "--datagrid-app-toolbar-button-font-size": e.chrome.density === "compact" ? "11px" : "12px",
2819
+ "--datagrid-app-toolbar-surface-padding-block": e.chrome.density === "compact" ? "8px" : "10px",
2820
+ "--datagrid-app-toolbar-surface-padding-inline": e.chrome.density === "compact" ? "10px" : "12px"
2821
+ })), a = w(() => [
2822
+ e.gridLines.body,
2823
+ e.gridLines.header,
2824
+ e.gridLines.pinnedSeparators ? "sep:1" : "sep:0"
2825
+ ].join("|")), r = q(0), u = q(Zl(e.sortModel)), i = q(ct(e.filterModel)), g = w(() => sa(i.value));
2826
+ let h = "";
2827
+ const R = () => {
2828
+ const t = e.runtimeRowModel.getSnapshot();
2829
+ return [
2830
+ t.kind,
2831
+ t.revision ?? "",
2832
+ t.rowCount,
2833
+ t.loading ? 1 : 0,
2834
+ t.projection?.recomputeVersion ?? t.projection?.version ?? ""
2835
+ ].join("|");
2836
+ };
2837
+ h = R();
2838
+ const E = e.runtimeRowModel.subscribe(() => {
2839
+ const t = R();
2840
+ t !== h && (h = t, r.value += 1);
2841
+ });
2842
+ $l(() => {
2843
+ E();
2844
+ }), te(
2845
+ () => e.sortModel,
2846
+ (t) => {
2847
+ u.value = Zl(t);
2848
+ },
2849
+ { deep: !0 }
2850
+ ), te(
2851
+ () => e.filterModel,
2852
+ (t) => {
2853
+ i.value = ct(t);
2854
+ },
2855
+ { deep: !0 }
2856
+ );
2857
+ const O = w(() => e.mode), G = w(() => e.rows), I = w(() => (r.value, e.runtime.api.rows.getSnapshot().rowCount)), b = w(() => e.runtime.columnSnapshot.value.visibleColumns), F = w(() => e.runtime.columnSnapshot.value.columns ?? []), A = w(() => b.value.filter((t) => t.visible !== !1).map((t) => ({
2858
+ key: t.key,
2859
+ label: t.column.label ?? t.key
2860
+ }))), C = w(() => F.value.map((t) => ({
2861
+ key: t.key,
2862
+ label: t.column.label ?? t.key,
2863
+ visible: t.visible !== !1
2864
+ }))), M = w(() => F.value.filter((t) => t.column.capabilities?.aggregatable === !0).map((t) => ({
2865
+ key: t.key,
2866
+ label: t.column.label ?? t.key,
2867
+ allowedOps: ha(t.column.dataType)
2868
+ }))), Y = q(e.rowHeightMode), ne = w(() => aa(e.baseRowHeight)), j = w(() => b.value[0]?.key ?? "name"), Me = w(() => {
2869
+ const t = /* @__PURE__ */ new Map();
2870
+ for (const n of F.value)
2871
+ t.set(n.key, n.column.label ?? n.key);
2872
+ return t;
2873
+ }), {
2874
+ isColumnLayoutPanelOpen: ft,
2875
+ columnLayoutPanelItems: wt,
2876
+ openColumnLayoutPanel: We,
2877
+ cancelColumnLayoutPanel: T,
2878
+ applyColumnLayoutPanel: z,
2879
+ moveColumnUp: _,
2880
+ moveColumnDown: le,
2881
+ moveColumnToPosition: Pn,
2882
+ updateColumnVisibility: gt
2883
+ } = Kr({
2884
+ resolveColumns: () => C.value,
2885
+ applyColumnLayout: (t) => {
2886
+ e.runtime.api.columns.setOrder(t.order);
2887
+ for (const [n, o] of Object.entries(t.visibilityByKey))
2888
+ e.runtime.api.columns.setVisibility(n, o);
2889
+ }
2890
+ }), se = Ml(null), Bt = w(() => se.value?.isAdvancedFilterPanelOpen.value ?? !1), N = w(() => se.value?.advancedFilterDraftClauses.value ?? []), tt = w(() => se.value?.appliedAdvancedFilterExpression.value ?? null), nt = async () => {
2891
+ if (se.value)
2892
+ return se.value;
2893
+ const { useDataGridAppAdvancedFilterBuilder: t } = await import("@affino/datagrid-vue/app"), n = t({
2894
+ resolveColumns: () => A.value
2895
+ });
2896
+ return n.hydrateAdvancedFilterClauses(Jl(i.value)), se.value = n, n;
2897
+ }, Tn = (t) => {
2898
+ se.value?.hydrateAdvancedFilterClauses(t);
2899
+ }, zn = async () => {
2900
+ (await nt()).openAdvancedFilterPanel();
2901
+ }, Hn = async () => {
2902
+ const t = se.value;
2903
+ if (t) {
2904
+ t.addAdvancedFilterClause();
2905
+ return;
2906
+ }
2907
+ (await nt()).addAdvancedFilterClause();
2908
+ }, Vn = async (t) => {
2909
+ const n = se.value;
2910
+ if (n) {
2911
+ n.removeAdvancedFilterClause(t);
2912
+ return;
2913
+ }
2914
+ (await nt()).removeAdvancedFilterClause(t);
2915
+ }, Bn = async (t) => {
2916
+ const n = se.value;
2917
+ if (n) {
2918
+ n.updateAdvancedFilterClause(t);
2919
+ return;
2920
+ }
2921
+ (await nt()).updateAdvancedFilterClause(t);
2922
+ }, jn = () => {
2923
+ se.value?.cancelAdvancedFilterPanel();
2924
+ }, Gn = () => {
2925
+ se.value?.applyAdvancedFilterPanel();
2926
+ }, Ln = () => {
2927
+ se.value?.clearAdvancedFilterPanel();
2928
+ }, Fe = q(!1), J = q(null), re = w(() => !!e.groupBy?.fields?.length), lt = w(() => (r.value, Vt(e.runtime.api.rows.getAggregationModel()))), jt = w(() => (r.value, da(e.runtime.api.rows.getSnapshot().groupBy))), Gt = w(() => {
2929
+ const t = new Map(
2930
+ (J.value?.columns ?? []).map((n) => [n.key, n.op])
2931
+ );
2932
+ return M.value.map((n) => {
2933
+ const o = n.allowedOps[0] ?? "count", s = t.get(n.key), d = s && n.allowedOps.includes(s) ? s : o;
2934
+ return {
2935
+ key: n.key,
2936
+ label: n.label,
2937
+ enabled: t.has(n.key),
2938
+ op: d,
2939
+ allowedOps: n.allowedOps
2940
+ };
2941
+ });
2942
+ }), Ue = w(() => J.value?.basis === "source" ? "source" : "filtered");
2943
+ te(
2944
+ lt,
2945
+ (t) => {
2946
+ Fe.value || (J.value = Vt(t));
2947
+ },
2948
+ { immediate: !0, deep: !0 }
2949
+ ), te(
2950
+ () => e.rowHeightMode,
2951
+ (t) => {
2952
+ Y.value = t;
2953
+ }
2954
+ );
2955
+ const Lt = (t) => {
2956
+ const n = i.value.columnFilters?.[t];
2957
+ return n ? n.kind === "valueSet" ? n.tokens.length > 0 : !0 : !1;
2958
+ }, W = (t) => {
2959
+ const n = i.value.columnFilters?.[t];
2960
+ return !n || n.kind !== "valueSet" ? [] : n.tokens.map((o) => _l(String(o ?? "")));
2961
+ }, $t = (t, n) => e.runtime.api.columns.getHistogram(t, {
2962
+ ignoreSelfFilter: !0,
2963
+ orderBy: "valueAsc",
2964
+ search: n
2965
+ }), Kt = (t) => dr(e.columnMenu, t), Nt = (t) => So(e.columnMenu, t), Wt = (t) => xo(e.columnMenu, t), vt = (t) => Io(e.columnMenu, t), Ut = (t) => Mo(e.columnMenu, t), qt = (t) => Fo(e.columnMenu, t), Yt = (t) => {
2966
+ const n = jt.value?.fields.findIndex((o) => o === t) ?? -1;
2967
+ return n >= 0 ? n : null;
2968
+ }, Jt = (t) => Yt(t) !== null, de = () => {
2969
+ const t = u.value.map((s) => ({
2970
+ key: s.key,
2971
+ direction: s.direction
2972
+ })), n = i.value.advancedExpression ?? null, o = e.advancedFilter.enabled ? {
2973
+ ...i.value,
2974
+ advancedFilters: {},
2975
+ advancedExpression: n
2976
+ } : {
2977
+ ...i.value,
2978
+ advancedExpression: n
2979
+ };
2980
+ e.runtime.api.rows.setSortAndFilterModel({
2981
+ sortModel: t,
2982
+ filterModel: ia(o)
2983
+ });
2984
+ }, Xt = () => {
2985
+ Tn(Jl(i.value));
2986
+ }, Zt = w(() => i.value.advancedExpression ?? null), rt = w(() => {
2987
+ const t = (s) => Me.value.get(s) ?? s, n = e.advancedFilter.labels, o = [];
2988
+ for (const [s, d] of Object.entries(i.value.columnFilters ?? {}))
2989
+ d && o.push(ma(t(s), d, n));
2990
+ for (const [s, d] of Object.entries(i.value.advancedFilters ?? {}))
2991
+ d && o.push(Ql(
2992
+ fa(t(s), d, n),
2993
+ n
2994
+ ));
2995
+ return Zt.value && o.push(Ql(
2996
+ El(Zt.value, t, n),
2997
+ n
2998
+ )), Object.freeze(o);
2999
+ }), ot = w(() => rt.value.length > 0), $n = () => {
3000
+ i.value = Ol(), Ln(), de();
3001
+ };
3002
+ te(
3003
+ i,
3004
+ () => {
3005
+ !e.advancedFilter.enabled || Bt.value || Xt();
3006
+ },
3007
+ { immediate: !0, deep: !0 }
3008
+ );
3009
+ const qe = () => {
3010
+ Xt(), zn();
3011
+ }, Qt = () => {
3012
+ Gn(), i.value = {
3013
+ ...ct(i.value),
3014
+ columnFilters: {},
3015
+ advancedFilters: {},
3016
+ advancedExpression: tt.value
3017
+ }, de();
3018
+ }, Kn = (t, n = !1) => {
3019
+ const o = u.value.findIndex((d) => d.key === t), s = o >= 0 ? u.value[o] : null;
3020
+ if (!s) {
3021
+ const d = { key: t, direction: "asc" };
3022
+ u.value = n ? [...u.value, d] : [d], de();
3023
+ return;
3024
+ }
3025
+ if (s.direction === "asc") {
3026
+ const d = { key: t, direction: "desc" };
3027
+ n ? u.value = u.value.map((v) => v.key === t ? d : v) : u.value = [d], de();
3028
+ return;
3029
+ }
3030
+ u.value = n ? u.value.filter((d) => d.key !== t) : [], de();
3031
+ }, en = (t) => {
3032
+ const n = u.value.findIndex((d) => d.key === t);
3033
+ if (n < 0)
3034
+ return "";
3035
+ const o = u.value[n];
3036
+ if (!o)
3037
+ return "";
3038
+ const s = o.direction === "asc" ? "↑" : "↓";
3039
+ return u.value.length > 1 ? `${s}${n + 1}` : s;
3040
+ }, tn = (t, n) => {
3041
+ const o = ct(i.value), s = n.trim();
3042
+ s ? o.columnFilters[t] = {
3043
+ kind: "predicate",
3044
+ operator: "contains",
3045
+ value: s,
3046
+ caseSensitive: !1
3047
+ } : delete o.columnFilters[t], i.value = o, de();
3048
+ }, Nn = () => {
3049
+ e.runtime.api.view.setRowHeightMode(Y.value), e.runtime.api.view.setBaseRowHeight(ne.value);
3050
+ }, Wn = () => {
3051
+ J.value = Vt(lt.value), Fe.value = !0;
3052
+ }, nn = () => {
3053
+ J.value = Vt(lt.value), Fe.value = !1;
3054
+ };
3055
+ te(
3056
+ re,
3057
+ (t) => {
3058
+ t || nn();
3059
+ },
3060
+ { immediate: !0 }
3061
+ );
3062
+ const ht = () => {
3063
+ J.value = null;
3064
+ }, ln = (t) => {
3065
+ J.value = {
3066
+ basis: t,
3067
+ columns: J.value?.columns ?? []
3068
+ };
3069
+ }, Un = (t, n) => {
3070
+ const o = M.value.find((f) => f.key === t);
3071
+ if (!o)
3072
+ return;
3073
+ const s = J.value?.columns ?? [];
3074
+ if (!n) {
3075
+ const f = s.filter((p) => p.key !== t);
3076
+ J.value = f.length > 0 ? { basis: Ue.value, columns: f } : null;
3077
+ return;
3078
+ }
3079
+ const v = s.find((f) => f.key === t) ?? {
3080
+ key: t,
3081
+ op: o.allowedOps[0] ?? "count"
3082
+ };
3083
+ J.value = {
3084
+ basis: Ue.value,
3085
+ columns: [
3086
+ ...s.filter((f) => f.key !== t),
3087
+ v
3088
+ ]
3089
+ };
3090
+ }, qn = (t, n) => {
3091
+ const o = M.value.find((d) => d.key === t);
3092
+ if (!o || !o.allowedOps.includes(n))
3093
+ return;
3094
+ const s = (J.value?.columns ?? []).map((d) => d.key !== t ? d : {
3095
+ ...d,
3096
+ op: n
3097
+ });
3098
+ J.value = {
3099
+ basis: Ue.value,
3100
+ columns: s
3101
+ };
3102
+ }, Yn = () => {
3103
+ const t = J.value && J.value.columns.length > 0 ? J.value : null;
3104
+ e.runtime.api.rows.setAggregationModel(t), J.value = Vt(t), Fe.value = !1;
3105
+ }, rn = (t) => u.value.find((n) => n.key === t)?.direction ?? null, at = (t, n) => {
3106
+ const o = b.value.find((s) => s.key === t);
3107
+ !o || o.column.capabilities?.sortable === !1 || (u.value = n === null ? u.value.filter((s) => s.key !== t) : [{ key: t, direction: n }], de());
3108
+ }, Ae = (t, n) => {
3109
+ e.runtime.api.columns.setPin(t, n);
3110
+ }, Be = (t, n) => {
3111
+ const o = jt.value, s = n ? Array.from(/* @__PURE__ */ new Set([...o?.fields ?? [], t])) : (o?.fields ?? []).filter((d) => d !== t);
3112
+ e.runtime.api.rows.setGroupBy(s.length > 0 ? {
3113
+ fields: s,
3114
+ expandedByDefault: o?.expandedByDefault ?? !0
3115
+ } : null);
3116
+ }, De = (t, n) => {
3117
+ const o = Array.from(new Set(
3118
+ n.map((d) => _l(String(d ?? ""))).filter((d) => d.length > 0)
3119
+ ));
3120
+ if (o.length === 0) {
3121
+ bt(t);
3122
+ return;
3123
+ }
3124
+ const s = ct(i.value);
3125
+ s.columnFilters[t] = {
3126
+ kind: "valueSet",
3127
+ tokens: o
3128
+ }, i.value = s, de();
3129
+ }, bt = (t) => {
3130
+ const n = ct(i.value);
3131
+ delete n.columnFilters[t], i.value = n, de();
3132
+ }, pe = q(null), ae = q(null);
3133
+ let je = 0;
3134
+ const ve = () => {
3135
+ const t = e.selectionSnapshot.value, n = t?.ranges[t.activeRangeIndex] ?? null;
3136
+ return n ? {
3137
+ startRow: n.startRow,
3138
+ endRow: n.endRow,
3139
+ startColumn: n.startCol,
3140
+ endColumn: n.endCol
3141
+ } : null;
3142
+ }, yt = () => {
3143
+ const t = e.selectionSnapshot.value?.activeCell;
3144
+ return t ? {
3145
+ rowIndex: t.rowIndex,
3146
+ columnIndex: t.colIndex
3147
+ } : null;
3148
+ }, on = (t) => t ? t.startRow !== t.endRow || t.startColumn !== t.endColumn : !1, an = (t, n) => t.rowIndex >= Math.min(n.startRow, n.endRow) && t.rowIndex <= Math.max(n.startRow, n.endRow) && t.columnIndex >= Math.min(n.startColumn, n.endColumn) && t.columnIndex <= Math.max(n.startColumn, n.endColumn), Jn = (t, n) => {
3149
+ const o = e.runtime.resolveBodyRowIndexById(t), s = b.value.findIndex((d) => d.key === n);
3150
+ return o < 0 || s < 0 ? null : { rowIndex: o, columnIndex: s };
3151
+ }, Xn = (t) => ({
3152
+ ranges: [{
3153
+ startRow: t.rowIndex,
3154
+ endRow: t.rowIndex,
3155
+ startCol: t.columnIndex,
3156
+ endCol: t.columnIndex,
3157
+ anchor: {
3158
+ rowIndex: t.rowIndex,
3159
+ colIndex: t.columnIndex,
3160
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
3161
+ },
3162
+ focus: {
3163
+ rowIndex: t.rowIndex,
3164
+ colIndex: t.columnIndex,
3165
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
3166
+ },
3167
+ startRowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null,
3168
+ endRowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
3169
+ }],
3170
+ activeRangeIndex: 0,
3171
+ activeCell: {
3172
+ rowIndex: t.rowIndex,
3173
+ colIndex: t.columnIndex,
3174
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
3175
+ }
3176
+ }), Ye = (t, n) => {
3177
+ if (!Number.isFinite(n))
3178
+ return null;
3179
+ const o = Math.trunc(n);
3180
+ return t[o] ?? null;
3181
+ }, Ge = (t) => typeof t == "string" || typeof t == "number" ? t : null, Rt = () => {
3182
+ const t = e.selectionSnapshot.value, n = b.value.map((d) => d.key);
3183
+ if (!t || n.length === 0)
3184
+ return null;
3185
+ const o = t.ranges.map((d) => {
3186
+ const v = Ye(n, d.startCol), f = Ye(n, d.endCol);
3187
+ if (!v || !f)
3188
+ return null;
3189
+ const p = Ye(n, d.anchor?.colIndex ?? d.startCol) ?? v, x = Ye(n, d.focus?.colIndex ?? d.endCol) ?? f;
3190
+ return {
3191
+ startRow: d.startRow,
3192
+ endRow: d.endRow,
3193
+ startColumnKey: v,
3194
+ endColumnKey: f,
3195
+ startRowId: Ge(d.startRowId),
3196
+ endRowId: Ge(d.endRowId),
3197
+ anchor: {
3198
+ rowIndex: d.anchor?.rowIndex ?? d.startRow,
3199
+ rowId: Ge(d.anchor?.rowId),
3200
+ columnKey: p
3201
+ },
3202
+ focus: {
3203
+ rowIndex: d.focus?.rowIndex ?? d.endRow,
3204
+ rowId: Ge(d.focus?.rowId),
3205
+ columnKey: x
3206
+ }
3207
+ };
3208
+ }).filter((d) => d != null);
3209
+ if (o.length === 0)
3210
+ return null;
3211
+ const s = t.activeCell ? Ye(n, t.activeCell.colIndex) : null;
3212
+ return {
3213
+ ranges: o,
3214
+ activeRangeIndex: Math.max(0, Math.trunc(t.activeRangeIndex ?? 0)),
3215
+ activeCell: t.activeCell && s ? {
3216
+ rowIndex: t.activeCell.rowIndex,
3217
+ rowId: Ge(t.activeCell.rowId),
3218
+ columnKey: s
3219
+ } : null
3220
+ };
3221
+ }, sn = (t) => {
3222
+ const n = b.value.map((f) => f.key);
3223
+ if (n.length === 0)
3224
+ return null;
3225
+ const o = [];
3226
+ for (const f of t.ranges) {
3227
+ const p = n.indexOf(f.startColumnKey), x = n.indexOf(f.endColumnKey), P = n.indexOf(f.anchor.columnKey), k = n.indexOf(f.focus.columnKey);
3228
+ p < 0 || x < 0 || P < 0 || k < 0 || o.push({
3229
+ startRow: f.startRow,
3230
+ endRow: f.endRow,
3231
+ startCol: p,
3232
+ endCol: x,
3233
+ startRowId: f.startRowId,
3234
+ endRowId: f.endRowId,
3235
+ anchor: {
3236
+ rowIndex: f.anchor.rowIndex,
3237
+ colIndex: P,
3238
+ rowId: f.anchor.rowId
3239
+ },
3240
+ focus: {
3241
+ rowIndex: f.focus.rowIndex,
3242
+ colIndex: k,
3243
+ rowId: f.focus.rowId
3244
+ }
3245
+ });
3246
+ }
3247
+ if (o.length === 0)
3248
+ return null;
3249
+ const s = Math.min(o.length - 1, Math.max(0, t.activeRangeIndex)), d = o[s] ?? o[0] ?? null;
3250
+ if (!d)
3251
+ return null;
3252
+ const v = t.activeCell ? n.indexOf(t.activeCell.columnKey) : -1;
3253
+ return {
3254
+ ranges: o,
3255
+ activeRangeIndex: s,
3256
+ activeCell: v >= 0 && t.activeCell ? {
3257
+ rowIndex: t.activeCell.rowIndex,
3258
+ colIndex: v,
3259
+ rowId: t.activeCell.rowId
3260
+ } : {
3261
+ rowIndex: d.focus.rowIndex,
3262
+ colIndex: d.focus.colIndex,
3263
+ rowId: d.focus.rowId
3264
+ }
3265
+ };
3266
+ }, Ct = (t) => {
3267
+ const n = t ? sn(t) : null;
3268
+ n && (e.runtime.api.selection.setSnapshot(n), e.syncSelectionSnapshotFromRuntime()), un();
3269
+ }, Zn = (t) => {
3270
+ if (t.length === 0)
3271
+ return null;
3272
+ const n = new Set(t), o = e.selectionSnapshot.value?.activeCell?.rowId;
3273
+ if (o != null) {
3274
+ const f = String(o);
3275
+ if (n.has(f))
3276
+ return f;
3277
+ }
3278
+ const d = (e.selectionSnapshot.value?.ranges[e.selectionSnapshot.value?.activeRangeIndex ?? 0] ?? null)?.anchor?.rowId;
3279
+ if (d != null) {
3280
+ const f = String(d);
3281
+ if (n.has(f))
3282
+ return f;
3283
+ }
3284
+ const v = e.rowSelectionSnapshot.value?.focusedRow;
3285
+ if (v != null) {
3286
+ const f = String(v);
3287
+ if (n.has(f))
3288
+ return f;
3289
+ }
3290
+ return t[0] ?? null;
3291
+ }, pt = (t, n) => {
3292
+ const o = b.value.length - 1;
3293
+ if (t.length === 0 || o < 0)
3294
+ return null;
3295
+ const s = t.map((p) => ({ rowId: p, rowIndex: e.runtime.resolveBodyRowIndexById(p) })).filter((p) => p.rowIndex >= 0).sort((p, x) => p.rowIndex - x.rowIndex);
3296
+ if (s.length === 0)
3297
+ return null;
3298
+ const d = s[0] ?? null, v = e.runtime.resolveBodyRowIndexById(n), f = v >= 0 ? { rowId: n, rowIndex: v } : d;
3299
+ return !f || f.rowIndex < 0 ? null : {
3300
+ ranges: [{
3301
+ startRow: s[0]?.rowIndex ?? f.rowIndex,
3302
+ endRow: s[s.length - 1]?.rowIndex ?? f.rowIndex,
3303
+ startCol: 0,
3304
+ endCol: o,
3305
+ anchor: {
3306
+ rowIndex: f.rowIndex,
3307
+ colIndex: 0,
3308
+ rowId: f.rowId
3309
+ },
3310
+ focus: {
3311
+ rowIndex: f.rowIndex,
3312
+ colIndex: 0,
3313
+ rowId: f.rowId
3314
+ },
3315
+ startRowId: s[0]?.rowId ?? f.rowId,
3316
+ endRowId: s[s.length - 1]?.rowId ?? f.rowId
3317
+ }],
3318
+ activeRangeIndex: 0,
3319
+ activeCell: {
3320
+ rowIndex: f.rowIndex,
3321
+ colIndex: 0,
3322
+ rowId: f.rowId
3323
+ }
3324
+ };
3325
+ }, un = () => {
3326
+ const t = () => {
3327
+ const o = pe.value?.querySelector(".grid-body-viewport");
3328
+ if (!o)
3329
+ return !1;
3330
+ try {
3331
+ o.focus({ preventScroll: !0 });
3332
+ } catch {
3333
+ o.focus();
3334
+ }
3335
+ return document.activeElement === o;
3336
+ }, n = (o) => {
3337
+ et(() => {
3338
+ if (!(t() || o >= 3)) {
3339
+ if (typeof window < "u") {
3340
+ window.requestAnimationFrame(() => {
3341
+ n(o + 1);
3342
+ });
3343
+ return;
3344
+ }
3345
+ n(o + 1);
3346
+ }
3347
+ });
3348
+ };
3349
+ n(0);
3350
+ }, dn = (t) => {
3351
+ const n = Zn(t);
3352
+ if (!n)
3353
+ return;
3354
+ e.runtime.api.rowSelection.hasSupport() && (e.runtime.api.rowSelection.setFocusedRow(n), e.syncRowSelectionSnapshotFromRuntime?.(), e.flushRowSelectionSnapshotUpdates?.());
3355
+ const o = pt(t, n);
3356
+ o && (e.runtime.api.selection.setSnapshot(o), e.syncSelectionSnapshotFromRuntime()), un();
3357
+ }, it = (t) => {
3358
+ const n = e.runtime.api.rows.getCount();
3359
+ for (let o = 0; o < n; o += 1) {
3360
+ const s = e.runtime.api.rows.get(o);
3361
+ if (s && String(s.rowId) === t)
3362
+ return s;
3363
+ }
3364
+ return null;
3365
+ }, St = (t) => {
3366
+ if (!e.placeholderRows.enabled || !e.placeholderRows.createRowAt || it(t))
3367
+ return null;
3368
+ const n = `.datagrid-stage__row-index-cell[data-row-id="${Xl(t)}"]`, o = pe.value?.querySelector(n), s = Number.parseInt(o?.dataset.rowIndex ?? "", 10);
3369
+ if (!Number.isFinite(s))
3370
+ return null;
3371
+ const d = Math.max(0, Math.trunc(s));
3372
+ return d < e.runtime.api.rows.getCount() ? null : d;
3373
+ }, cn = async (t) => {
3374
+ try {
3375
+ return globalThis.navigator?.clipboard?.writeText ? (await globalThis.navigator.clipboard.writeText(t), !0) : !1;
3376
+ } catch {
3377
+ return !1;
3378
+ }
3379
+ }, mn = async () => {
3380
+ try {
3381
+ return globalThis.navigator?.clipboard?.readText ? await globalThis.navigator.clipboard.readText() : "";
3382
+ } catch {
3383
+ return "";
3384
+ }
3385
+ }, It = async () => {
3386
+ if (ae.value?.rows.length)
3387
+ return ae.value.rows.map((n) => Ce(n));
3388
+ const t = (await mn()).trim();
3389
+ if (!t)
3390
+ return null;
3391
+ try {
3392
+ const n = JSON.parse(t);
3393
+ if (Array.isArray(n))
3394
+ return n.filter((o) => !!o && typeof o == "object").map((o) => Ce(o));
3395
+ if (n && typeof n == "object")
3396
+ return [Ce(n)];
3397
+ } catch {
3398
+ return null;
3399
+ }
3400
+ return null;
3401
+ }, fn = async (t, n, o = []) => {
3402
+ const s = t.map((v) => Ce(v));
3403
+ ae.value = {
3404
+ rows: s,
3405
+ operation: n,
3406
+ sourceRowIds: o.map((v) => String(v))
3407
+ };
3408
+ const d = ua(s);
3409
+ return d && await cn(d), !0;
3410
+ }, Se = () => e.runtime.api.rows.hasInsertSupport(), Oe = () => e.runtime.api.rows.hasDataMutationSupport(), st = (t) => !t || typeof t != "object" ? !1 : "data" in t || "row" in t || "kind" in t || "state" in t || "sourceIndex" in t || "originalIndex" in t || "displayIndex" in t, he = (t) => {
3411
+ const n = t;
3412
+ return n.rowId != null ? String(n.rowId) : n.id != null ? String(n.id) : null;
3413
+ }, Le = (t) => {
3414
+ for (const n of e.rows) {
3415
+ if (!n || typeof n != "object")
3416
+ continue;
3417
+ const o = n;
3418
+ if ((o.rowId != null ? String(o.rowId) : o.rowKey != null ? String(o.rowKey) : null) === t && st(o))
3419
+ return o;
3420
+ }
3421
+ for (const n of e.rows) {
3422
+ if (!n || typeof n != "object")
3423
+ continue;
3424
+ const o = n;
3425
+ if (st(o))
3426
+ return o;
3427
+ }
3428
+ return null;
3429
+ }, xt = () => (je += 1, `datagrid-row-${Date.now()}-${je}`), Qn = (t) => {
3430
+ const n = Ce(t), o = xt();
3431
+ let s = !1;
3432
+ return "id" in n && (n.id = o, s = !0), "rowId" in n && (n.rowId = o, s = !0), s || (n.id = o), n;
3433
+ }, wn = (t) => {
3434
+ const n = xt(), o = {};
3435
+ for (const [s, d] of Object.entries(t)) {
3436
+ if (s === "id" || s === "rowId") {
3437
+ o[s] = n;
3438
+ continue;
3439
+ }
3440
+ o[s] = typeof d == "number" ? null : "";
3441
+ }
3442
+ return !("id" in o) && !("rowId" in o) && (o.id = n), o;
3443
+ }, Mt = (t, n, o) => {
3444
+ const s = xt(), d = o === "clone" ? Ce(t) : Object.entries(t).reduce((f, [p, x]) => (f[p] = typeof x == "number" ? null : "", f), {});
3445
+ ("id" in d || !("rowId" in d) && !("id" in d)) && (d.id = s), "rowId" in d && (d.rowId = s), "rowKey" in d && (d.rowKey = s);
3446
+ const v = typeof n.state == "object" && n.state != null ? n.state : null;
3447
+ return {
3448
+ kind: n.kind === "group" ? "leaf" : n.kind ?? "leaf",
3449
+ rowId: s,
3450
+ rowKey: s,
3451
+ state: {
3452
+ ...v ?? {},
3453
+ selected: !1,
3454
+ group: !1,
3455
+ pinned: "none",
3456
+ expanded: !1
3457
+ },
3458
+ data: d,
3459
+ row: Ce(d)
3460
+ };
3461
+ }, gn = (t, n = null) => n && st(n) ? Mt(t, n, "clone") : Qn(t), Ft = (t, n = null) => n && st(n) ? Mt(t, n, "blank") : wn(t), ut = (t, n, o) => {
3462
+ if (!e.placeholderRows.enabled || !e.placeholderRows.createRowAt)
3463
+ return null;
3464
+ const s = e.placeholderRows.createRowAt({
3465
+ visualRowIndex: t,
3466
+ materializedRowCount: n,
3467
+ sourceRows: o,
3468
+ reason: "edit"
3469
+ });
3470
+ return s ? Ce(s) : null;
3471
+ }, vn = (t, n) => {
3472
+ if (!Se())
3473
+ return !1;
3474
+ const o = Ie().map((f) => Ce(f));
3475
+ let s = e.runtime.api.rows.getCount();
3476
+ for (; s < n; ) {
3477
+ const f = ut(
3478
+ s,
3479
+ s,
3480
+ o
3481
+ );
3482
+ if (!f || !e.runtime.api.rows.insertDataAt(s, [f]))
3483
+ return !1;
3484
+ o.push(f), s += 1;
3485
+ }
3486
+ const d = Math.max(0, Math.min(s, Math.trunc(t))), v = ut(
3487
+ d,
3488
+ s,
3489
+ o
3490
+ );
3491
+ return v ? e.runtime.api.rows.insertDataAt(d, [v]) : !1;
3492
+ }, el = (t) => {
3493
+ if (!Se())
3494
+ return null;
3495
+ const n = Ie().map((d) => Ce(d));
3496
+ let o = e.runtime.api.rows.getCount();
3497
+ const s = Math.max(0, Math.trunc(t));
3498
+ for (; o < s; ) {
3499
+ const d = ut(
3500
+ o,
3501
+ o,
3502
+ n
3503
+ );
3504
+ if (!d || !e.runtime.api.rows.insertDataAt(o, [d]))
3505
+ return null;
3506
+ n.push(d), o += 1;
3507
+ }
3508
+ return n;
3509
+ }, Je = (t) => {
3510
+ const n = (f) => {
3511
+ const p = e.runtime.resolveBodyRowIndexById(f);
3512
+ if (p < 0 || p >= e.runtime.api.rows.getCount())
3513
+ return !1;
3514
+ const x = e.runtime.getBodyRowAtIndex(p);
3515
+ return x != null && x.kind !== "group" && !Jr(x);
3516
+ }, s = (e.rowSelectionSnapshot.value?.selectedRows ?? []).map((f) => String(f)).filter((f) => f.length > 0 && n(f));
3517
+ if (s.length > 0)
3518
+ return s;
3519
+ const d = ve(), v = b.value.length - 1;
3520
+ if (d && v >= 0) {
3521
+ const f = Math.min(d.startColumn, d.endColumn), p = Math.max(d.startColumn, d.endColumn), x = Math.min(d.startRow, d.endRow), P = Math.max(d.startRow, d.endRow), k = t.length > 0 ? e.runtime.resolveBodyRowIndexById(t) : -1;
3522
+ if (f === 0 && p === v && (k < 0 || k >= x && k <= P)) {
3523
+ const K = [];
3524
+ for (let Z = x; Z <= P; Z += 1) {
3525
+ const me = e.runtime.getBodyRowAtIndex(Z);
3526
+ if (!me || me.kind === "group" || me.rowId == null)
3527
+ continue;
3528
+ const Re = String(me.rowId);
3529
+ n(Re) && K.push(Re);
3530
+ }
3531
+ if (K.length > 0)
3532
+ return K;
3533
+ }
3534
+ }
3535
+ return t.length > 0 && n(t) ? [t] : [];
3536
+ }, Ie = () => {
3537
+ const t = [], n = e.runtime.api.rows.getCount();
3538
+ for (let o = 0; o < n; o += 1) {
3539
+ const s = e.runtime.api.rows.get(o);
3540
+ !s || s.kind === "group" || t.push(s.data);
3541
+ }
3542
+ return t;
3543
+ }, $e = (t) => {
3544
+ const n = new Set(
3545
+ Ie().map((o) => he(o)).filter((o) => o != null)
3546
+ );
3547
+ return Array.from(new Set(t.map((o) => String(o)).filter((o) => n.has(o))));
3548
+ }, hn = (t) => {
3549
+ if (t.length === 0)
3550
+ return [];
3551
+ const n = new Set(t.map((o) => String(o)));
3552
+ return Ie().filter((o) => {
3553
+ const s = he(o);
3554
+ return s != null && n.has(s);
3555
+ });
3556
+ }, Xe = (t) => {
3557
+ if (!Oe() || t.length === 0)
3558
+ return !1;
3559
+ const n = new Set(t), o = Ie().filter((s) => {
3560
+ const d = he(s);
3561
+ return d == null || !n.has(d);
3562
+ });
3563
+ return o.length === e.runtime.api.rows.getCount() ? !1 : (e.runtime.api.rows.replaceData(o), e.runtime.api.rowSelection.hasSupport() && (e.runtime.api.rowSelection.clearSelectedRows(), e.syncRowSelectionSnapshotFromRuntime?.()), !0);
3564
+ }, At = (t, n) => {
3565
+ if (!Oe() || t.length === 0)
3566
+ return !1;
3567
+ const o = Ie(), s = new Set(t.map((p) => String(p))), d = o.filter((p) => {
3568
+ const x = he(p);
3569
+ return x != null && s.has(x);
3570
+ });
3571
+ if (d.length === 0)
3572
+ return !1;
3573
+ const v = o.filter((p) => {
3574
+ const x = he(p);
3575
+ return x == null || !s.has(x);
3576
+ }), f = Number.isFinite(n) ? Math.max(0, Math.min(v.length, Math.trunc(n))) : v.length;
3577
+ return e.runtime.api.rows.replaceData([
3578
+ ...v.slice(0, f),
3579
+ ...d,
3580
+ ...v.slice(f)
3581
+ ]), e.runtime.api.rowSelection.hasSupport() && (e.runtime.api.rowSelection.selectRows(t), e.syncRowSelectionSnapshotFromRuntime?.()), !0;
3582
+ }, tl = (t, n) => {
3583
+ if (!Oe() || t.length === 0 || !n)
3584
+ return !1;
3585
+ const o = new Set(t.map((f) => String(f)));
3586
+ if (o.has(String(n)))
3587
+ return !1;
3588
+ const v = Ie().filter((f) => {
3589
+ const p = he(f);
3590
+ return p == null || !o.has(p);
3591
+ }).findIndex((f) => he(f) === n);
3592
+ return v < 0 ? !1 : At(t, v + 1);
3593
+ }, bn = (t) => {
3594
+ if (!Oe())
3595
+ return !1;
3596
+ const n = String(t.sourceRowId), o = String(t.targetRowId);
3597
+ if (!n || !o || n === o)
3598
+ return !1;
3599
+ const s = $e(Je(n)), d = s.includes(n) ? s : $e([n]);
3600
+ if (d.length === 0 || d.includes(o))
3601
+ return !1;
3602
+ const v = Ie(), f = new Set(d), x = v.filter((K) => {
3603
+ const Z = he(K);
3604
+ return Z == null || !f.has(Z);
3605
+ }).findIndex((K) => he(K) === o);
3606
+ if (x < 0)
3607
+ return !1;
3608
+ const P = we(), k = At(
3609
+ d,
3610
+ t.placement === "after" ? x + 1 : x
3611
+ );
3612
+ return k && (dn(d), be(P, d.length > 1 ? `Move ${d.length} rows` : "Move row")), k;
3613
+ }, Dt = (t) => {
3614
+ const n = String(t.sourceColumnKey), o = String(t.targetColumnKey);
3615
+ if (!n || !o || n === o)
3616
+ return !1;
3617
+ const s = F.value, d = s.find((Q) => Q.key === n), v = s.find((Q) => Q.key === o);
3618
+ if (!d || !v)
3619
+ return !1;
3620
+ const f = s.map((Q) => Q.key), p = f.indexOf(n), x = f.indexOf(o);
3621
+ if (p < 0 || x < 0)
3622
+ return !1;
3623
+ const P = f[p];
3624
+ if (!P)
3625
+ return !1;
3626
+ f.splice(p, 1);
3627
+ const k = f.indexOf(o);
3628
+ if (k < 0)
3629
+ return !1;
3630
+ const K = t.placement === "after" ? k + 1 : k;
3631
+ f.splice(K, 0, P);
3632
+ const Z = Rt(), me = v.pin ?? "none";
3633
+ return (d.pin ?? "none") !== me && e.runtime.api.columns.setPin(n, me), e.runtime.api.columns.setOrder(f), Ct(Z), !0;
3634
+ }, Ke = () => ae.value ? (ae.value = null, !0) : !1, yn = (t) => {
3635
+ if (t.kind === "group")
3636
+ return !1;
3637
+ const n = ae.value;
3638
+ return n ? n.sourceRowIds.includes(String(t.rowId)) : !1;
3639
+ }, Rn = () => typeof e.runStructuralRowAction == "function";
3640
+ let Ot = () => !1, _t = () => {
3641
+ }, kt = () => {
3642
+ };
3643
+ const Cn = q(null);
3644
+ let Et = async (t, n) => !1;
3645
+ const nl = (t, n) => {
3646
+ if (n)
3647
+ return n;
3648
+ const o = er[t], s = Ra[t];
3649
+ return s ? `${o} (${s})` : o;
3650
+ }, {
3651
+ tableStageProps: Ze,
3652
+ tableStageContext: _e,
3653
+ historyController: ke,
3654
+ copySelectedCells: ll,
3655
+ pasteSelectedCells: rl,
3656
+ cutSelectedCells: ol,
3657
+ clearSelectedCells: al,
3658
+ captureHistorySnapshot: we,
3659
+ captureHistorySnapshotForRowIds: il,
3660
+ recordHistoryIntentTransaction: pn,
3661
+ revealCellInComfortZone: sl
3662
+ } = Zo({
3663
+ mode: O,
3664
+ layoutMode: w(() => e.layoutMode),
3665
+ minRows: w(() => e.minRows),
3666
+ maxRows: w(() => e.maxRows),
3667
+ placeholderRows: w(() => e.placeholderRows),
3668
+ enableFillHandle: w(() => e.fillHandle),
3669
+ enableRangeMove: w(() => e.rangeMove),
3670
+ rows: G,
3671
+ sourceRows: G,
3672
+ runtime: e.runtime,
3673
+ runtimeRowModel: e.runtimeRowModel ?? null,
3674
+ rowVersion: r,
3675
+ totalRuntimeRows: I,
3676
+ visibleColumns: b,
3677
+ rowRenderMode: w(() => e.renderMode),
3678
+ rowHeightMode: Y,
3679
+ normalizedBaseRowHeight: ne,
3680
+ selectionSnapshot: e.selectionSnapshot,
3681
+ selectionAnchor: e.selectionAnchor,
3682
+ rowSelectionSnapshot: e.rowSelectionSnapshot,
3683
+ rowHover: w(() => e.rowHover),
3684
+ stripedRows: w(() => e.stripedRows),
3685
+ chromeSignature: a,
3686
+ onCellEdit: e.onCellEdit,
3687
+ showRowIndex: w(() => e.showRowIndex),
3688
+ showRowSelection: w(() => e.rowSelection),
3689
+ isRowInPendingClipboardCut: yn,
3690
+ syncSelectionSnapshotFromRuntime: e.syncSelectionSnapshotFromRuntime,
3691
+ syncRowSelectionSnapshotFromRuntime: e.syncRowSelectionSnapshotFromRuntime,
3692
+ flushRowSelectionSnapshotUpdates: e.flushRowSelectionSnapshotUpdates,
3693
+ clearExternalPendingClipboardOperation: Ke,
3694
+ reportFillWarning: e.reportFillWarning,
3695
+ reportCenterPaneDiagnostics: e.reportCenterPaneDiagnostics,
3696
+ reportFillPlumbingState: e.reportFillPlumbingState,
3697
+ reportFillPlumbingDetail: e.reportFillPlumbingDetail,
3698
+ firstColumnKey: j,
3699
+ columnFilterTextByKey: g,
3700
+ virtualization: w(() => e.virtualization),
3701
+ toggleSortForColumn: Kn,
3702
+ sortIndicator: en,
3703
+ setColumnFilterText: tn,
3704
+ columnMenuEnabled: w(() => e.columnMenu.enabled),
3705
+ columnMenuTrigger: w(() => e.columnMenu.trigger),
3706
+ columnMenuMaxFilterValues: w(() => e.columnMenu.maxFilterValues),
3707
+ resolveColumnMenuItems: Kt,
3708
+ resolveColumnMenuDisabledItems: Nt,
3709
+ resolveColumnMenuDisabledReasons: Wt,
3710
+ resolveColumnMenuLabels: vt,
3711
+ resolveColumnMenuActionOptions: Ut,
3712
+ resolveColumnMenuCustomItems: qt,
3713
+ isColumnFilterActive: Lt,
3714
+ isColumnGrouped: Jt,
3715
+ resolveColumnGroupOrder: Yt,
3716
+ resolveColumnMenuSortDirection: rn,
3717
+ resolveColumnMenuSelectedTokens: W,
3718
+ resolveColumnMenuValueEntries: $t,
3719
+ applyColumnMenuSort: at,
3720
+ applyColumnMenuPin: Ae,
3721
+ applyColumnMenuGroupBy: Be,
3722
+ applyColumnMenuFilter: De,
3723
+ clearColumnMenuFilter: bt,
3724
+ applyRowHeightSettings: Nn,
3725
+ cloneRowData: Ce,
3726
+ readSelectionCell: e.readSelectionCell,
3727
+ historyEnabled: w(() => e.history.enabled),
3728
+ historyMaxDepth: w(() => e.history.depth),
3729
+ historyShortcuts: w(() => e.history.shortcuts),
3730
+ history: e.history.adapter,
3731
+ isCellEditable: e.isCellEditable,
3732
+ isContextMenuVisible: () => Ot(),
3733
+ closeContextMenu: () => _t(),
3734
+ openContextMenuFromCurrentCell: () => {
3735
+ kt();
3736
+ },
3737
+ runRowIndexKeyboardAction: (t, n) => Et(t, n),
3738
+ reorderColumnsByHeader: e.columnReorder.enabled ? Dt : void 0,
3739
+ reorderRowsByIndex: e.rowReorder.enabled ? bn : void 0,
3740
+ cellClass: (t, n, o, s) => {
3741
+ const d = Cn.value, v = !d || t.kind === "group" || t.rowId == null || t.rowId !== d.rowId || o.key !== d.columnKey ? null : {
3742
+ "grid-cell--find-match-active": !0,
3743
+ "grid-cell--find-match-flash-a": d.flashPhase === 0,
3744
+ "grid-cell--find-match-flash-b": d.flashPhase === 1
3745
+ };
3746
+ return oa(
3747
+ v,
3748
+ e.cellClass?.(t, n, o, s)
3749
+ );
3750
+ },
3751
+ cellStyle: e.cellStyle
3752
+ });
3753
+ te(
3754
+ () => e.registerHistoryController,
3755
+ (t) => {
3756
+ t?.(ke);
3757
+ },
3758
+ { immediate: !0 }
3759
+ ), te(
3760
+ () => e.registerStructuralRowActionRunner,
3761
+ (t) => {
3762
+ t?.(xn);
3763
+ },
3764
+ { immediate: !0 }
3765
+ ), te(
3766
+ () => e.history.shortcuts,
3767
+ (t, n, o) => {
3768
+ if (t !== "window" || typeof window > "u")
3769
+ return;
3770
+ const s = (d) => {
3771
+ if (d.defaultPrevented || d.altKey || !(d.ctrlKey || d.metaKey))
3772
+ return;
3773
+ const v = d.key.toLowerCase(), f = v === "z" ? d.shiftKey ? "redo" : "undo" : v === "y" && !d.shiftKey ? "redo" : null;
3774
+ f && (d.preventDefault(), ke.runHistoryAction(f));
3775
+ };
3776
+ window.addEventListener("keydown", s), o(() => {
3777
+ window.removeEventListener("keydown", s);
3778
+ });
3779
+ },
3780
+ { immediate: !0 }
3781
+ ), $l(() => {
3782
+ e.registerHistoryController?.(null), e.registerStructuralRowActionRunner?.(null);
3783
+ });
3784
+ const ul = w(() => Ze.value.columns.visibleColumns), Pt = (t) => {
3785
+ e.runtime.api.selection.setSnapshot(Xn(t)), e.syncSelectionSnapshotFromRuntime();
3786
+ }, Sn = (t, n, o, s) => t.kind === "group" || t.rowId == null || o.column.capabilities?.editable === !1 ? !1 : e.isCellEditable ? e.isCellEditable({
3787
+ row: t.data,
3788
+ rowId: t.rowId,
3789
+ rowIndex: n,
3790
+ column: o.column,
3791
+ columnKey: o.key
3792
+ }) : !0, ie = Ml(null), xe = async () => {
3793
+ if (ie.value)
3794
+ return ie.value;
3795
+ const { useDataGridAppFindReplace: t } = await import("./useDataGridAppFindReplace-DTSLds4f.js"), n = t({
3796
+ runtime: e.runtime,
3797
+ visibleColumns: b,
3798
+ stageVisibleColumns: ul,
3799
+ resolveCurrentCellCoord: yt,
3800
+ applyActiveCell: Pt,
3801
+ revealCellInComfortZone: sl,
3802
+ captureRowsSnapshot: we,
3803
+ captureRowsSnapshotForRowIds: il,
3804
+ recordHistoryIntentTransaction: pn,
3805
+ isCellEditable: Sn
3806
+ });
3807
+ return ie.value = n, n;
3808
+ }, L = {
3809
+ isPanelOpen: w(() => ie.value?.isPanelOpen.value ?? !1),
3810
+ findText: w(() => ie.value?.findText.value ?? ""),
3811
+ replaceText: w(() => ie.value?.replaceText.value ?? ""),
3812
+ matchCase: w(() => ie.value?.matchCase.value ?? !1),
3813
+ statusText: w(() => ie.value?.statusText.value ?? ""),
3814
+ active: w(() => ie.value?.active.value ?? !1),
3815
+ canFind: w(() => ie.value?.canFind.value ?? !1),
3816
+ canReplaceCurrent: w(() => ie.value?.canReplaceCurrent.value ?? !1),
3817
+ canReplaceAll: w(() => ie.value?.canReplaceAll.value ?? !1),
3818
+ highlightedCell: w(() => ie.value?.highlightedCell.value ?? null),
3819
+ openPanel: async () => {
3820
+ (await xe()).openPanel();
3821
+ },
3822
+ closePanel: () => {
3823
+ ie.value?.closePanel();
3824
+ },
3825
+ updateFindText: async (t) => {
3826
+ (await xe()).updateFindText(t);
3827
+ },
3828
+ updateReplaceText: async (t) => {
3829
+ (await xe()).updateReplaceText(t);
3830
+ },
3831
+ updateMatchCase: async (t) => {
3832
+ (await xe()).updateMatchCase(t);
3833
+ },
3834
+ findNext: async () => (await xe()).findNext(),
3835
+ findPrevious: async () => (await xe()).findPrevious(),
3836
+ replaceCurrent: async () => (await xe()).replaceCurrent(),
3837
+ replaceAll: async () => (await xe()).replaceAll()
3838
+ };
3839
+ te(
3840
+ () => L.highlightedCell.value,
3841
+ (t) => {
3842
+ Cn.value = t;
3843
+ },
3844
+ { immediate: !0 }
3845
+ );
3846
+ const {
3847
+ contextMenu: ce,
3848
+ contextMenuRef: In,
3849
+ contextMenuStyle: dl,
3850
+ closeContextMenu: Ee,
3851
+ openContextMenu: Tt,
3852
+ onContextMenuKeyDown: cl
3853
+ } = Dr();
3854
+ Ot = () => ce.value.visible, _t = Ee;
3855
+ const ml = Nr({
3856
+ isInteractionBlocked: () => !1,
3857
+ isRangeMoveModifierActive: () => !1,
3858
+ resolveSelectionRange: ve,
3859
+ resolveCellCoordFromDataset: Jn,
3860
+ applyCellSelection: (t) => {
3861
+ Pt(t);
3862
+ },
3863
+ resolveActiveCellCoord: yt,
3864
+ setActiveCellCoord: (t) => {
3865
+ Pt(t);
3866
+ },
3867
+ cellCoordsEqual: (t, n) => t?.rowIndex === n?.rowIndex && t?.columnIndex === n?.columnIndex,
3868
+ isMultiCellSelection: on,
3869
+ isCoordInsideRange: an,
3870
+ openContextMenu: Tt,
3871
+ closeContextMenu: Ee,
3872
+ isColumnContextEnabled: (t) => e.cellMenu.enabled ? On(e.cellMenu, t).length > 0 : !1,
3873
+ isRowIndexContextEnabled: () => e.rowIndexMenu.enabled && e.showRowIndex
3874
+ }), fl = Wr({
3875
+ resolveCurrentCellCoord: yt,
3876
+ resolveViewportElement: () => pe.value,
3877
+ resolveRowAtIndex: (t) => e.runtime.getBodyRowAtIndex(t) ?? void 0,
3878
+ resolveColumnAtIndex: (t) => b.value[t] ?? void 0,
3879
+ resolveSelectionRange: ve,
3880
+ isMultiCellSelection: (t) => on(t),
3881
+ isCoordInsideRange: an,
3882
+ openContextMenu: Tt,
3883
+ isColumnContextEnabled: (t) => e.cellMenu.enabled && On(e.cellMenu, t.key).length > 0
3884
+ });
3885
+ kt = () => {
3886
+ fl.openContextMenuFromCurrentCell();
3887
+ };
3888
+ const wl = (t) => {
3889
+ if (!e.rowIndexMenu.enabled || !e.showRowIndex || !pe.value)
3890
+ return !1;
3891
+ const n = String(t), o = `.datagrid-stage__row-index-cell[data-row-id="${Xl(n)}"]`, s = pe.value.querySelector(o);
3892
+ if (!s)
3893
+ return !1;
3894
+ const d = s.getBoundingClientRect();
3895
+ return Tt(
3896
+ d.left + Math.max(10, Math.min(d.width / 2, Math.max(10, d.width - 10))),
3897
+ d.bottom - 4,
3898
+ {
3899
+ zone: "row-index",
3900
+ rowId: n
3901
+ }
3902
+ ), !0;
3903
+ }, be = (t, n) => {
3904
+ pn({
3905
+ intent: "edit",
3906
+ label: n
3907
+ }, t);
3908
+ };
3909
+ async function xn(t, n) {
3910
+ const o = String(n), s = St(o), d = s == null ? it(o) : null, v = $e(Je(o)), f = await e.runStructuralRowAction?.({
3911
+ action: t,
3912
+ rowId: n,
3913
+ row: d && d.kind !== "group" ? d : null,
3914
+ rowIndex: s ?? e.runtime.resolveBodyRowIndexById(o),
3915
+ placeholderVisualRowIndex: s,
3916
+ selectedRowIds: v
3917
+ });
3918
+ if (typeof f == "boolean")
3919
+ return f;
3920
+ if (s != null) {
3921
+ if (t === "delete-selected-rows") {
3922
+ if (v.length === 0)
3923
+ return !1;
3924
+ const p = we(), x = Xe(v);
3925
+ return x && be(p, v.length > 1 ? `Delete ${v.length} rows` : "Delete row"), x;
3926
+ }
3927
+ if (t === "insert-row-above") {
3928
+ const p = we(), x = vn(
3929
+ s,
3930
+ s
3931
+ );
3932
+ return x && be(p, "Insert row above"), x;
3933
+ }
3934
+ if (t === "insert-row-below") {
3935
+ const p = we(), x = vn(
3936
+ s + 1,
3937
+ s + 1
3938
+ );
3939
+ return x && be(p, "Insert row below"), x;
3940
+ }
3941
+ return !1;
3942
+ }
3943
+ if (!d || d.kind === "group")
3944
+ return !1;
3945
+ if (t === "delete-selected-rows") {
3946
+ if (v.length === 0)
3947
+ return !1;
3948
+ const p = we(), x = Xe(v);
3949
+ return x && be(p, v.length > 1 ? `Delete ${v.length} rows` : "Delete row"), x;
3950
+ }
3951
+ if (t === "insert-row-above") {
3952
+ if (!Se())
3953
+ return !1;
3954
+ const p = we(), x = e.runtime.api.rows.insertDataBefore(
3955
+ n,
3956
+ [Ft(d.data, Le(o))]
3957
+ );
3958
+ return x && be(p, "Insert row above"), x;
3959
+ }
3960
+ if (t === "insert-row-below") {
3961
+ if (!Se())
3962
+ return !1;
3963
+ const p = we(), x = e.runtime.api.rows.insertDataAfter(
3964
+ n,
3965
+ [Ft(d.data, Le(o))]
3966
+ );
3967
+ return x && be(p, "Insert row below"), x;
3968
+ }
3969
+ return !1;
3970
+ }
3971
+ Et = async (t, n) => {
3972
+ const o = String(n);
3973
+ if (t === "open-row-menu")
3974
+ return wl(o);
3975
+ if (t === "insert-row-above" || t === "insert-row-below" || t === "delete-selected-rows")
3976
+ return xn(t, n);
3977
+ const s = St(o);
3978
+ if (s != null) {
3979
+ if (t === "paste-row") {
3980
+ if (!Se())
3981
+ return !1;
3982
+ const v = await It();
3983
+ if (!v || v.length === 0)
3984
+ return !1;
3985
+ const f = we(), p = ae.value?.operation === "cut" ? ae.value.sourceRowIds : [];
3986
+ if (!el(s + 1))
3987
+ return !1;
3988
+ const P = Math.max(0, s + 1), k = Le(
3989
+ p[0] ?? o
3990
+ ) ?? Le(o), K = p.length > 0 ? At(p, P) : e.runtime.api.rows.insertDataAt(
3991
+ P,
3992
+ v.map((Z) => gn(Z, k))
3993
+ );
3994
+ return K && ae.value?.operation === "cut" && (ae.value = null), K && be(
3995
+ f,
3996
+ p.length > 0 ? p.length > 1 ? `Move ${p.length} rows` : "Move row" : v.length > 1 ? `Paste ${v.length} rows` : "Paste row"
3997
+ ), K;
3998
+ }
3999
+ return !1;
4000
+ }
4001
+ const d = it(o);
4002
+ if (!d || d.kind === "group")
4003
+ return !1;
4004
+ if (t === "copy-row") {
4005
+ const v = $e(Je(o)), f = hn(v);
4006
+ return fn(
4007
+ f.length > 0 ? f : [d.data],
4008
+ "copy",
4009
+ v.length > 0 ? v : [o]
4010
+ );
4011
+ }
4012
+ if (t === "cut-row") {
4013
+ const v = $e(Je(o)), f = hn(v);
4014
+ return fn(
4015
+ f.length > 0 ? f : [d.data],
4016
+ "cut",
4017
+ v.length > 0 ? v : [o]
4018
+ );
4019
+ }
4020
+ if (t === "paste-row") {
4021
+ if (!Se())
4022
+ return !1;
4023
+ const v = await It();
4024
+ if (!v || v.length === 0)
4025
+ return !1;
4026
+ const f = we(), p = ae.value?.operation === "cut" ? ae.value.sourceRowIds : [], x = Le(
4027
+ p[0] ?? o
4028
+ ) ?? Le(o), P = p.length > 0 ? tl(p, o) : e.runtime.api.rows.insertDataAfter(
4029
+ n,
4030
+ v.map((k) => gn(k, x))
4031
+ );
4032
+ return P && ae.value?.operation === "cut" && (ae.value = null), P && be(
4033
+ f,
4034
+ p.length > 0 ? p.length > 1 ? `Move ${p.length} rows` : "Move row" : v.length > 1 ? `Paste ${v.length} rows` : "Paste row"
4035
+ ), P;
4036
+ }
4037
+ return !1;
4038
+ };
4039
+ const gl = Ur({
4040
+ resolveContextMenuState: () => ({
4041
+ zone: ce.value.zone,
4042
+ columnKey: ce.value.columnKey,
4043
+ rowId: ce.value.rowId
4044
+ }),
4045
+ runHeaderContextAction: () => !1,
4046
+ runRowIndexContextAction: Et,
4047
+ copySelection: ll,
4048
+ pasteSelection: rl,
4049
+ cutSelection: ol,
4050
+ clearCurrentSelection: al,
4051
+ closeContextMenu: Ee
4052
+ }), Ne = q([]), zt = (t) => Ne.value.includes(t), vl = (t) => {
4053
+ Ne.value = Ne.value.filter((n) => n !== t && !n.startsWith(`${t}/`));
4054
+ }, hl = (t, n = []) => {
4055
+ if (zt(t)) {
4056
+ vl(t);
4057
+ return;
4058
+ }
4059
+ Ne.value = Array.from(/* @__PURE__ */ new Set([...n, t]));
4060
+ }, bl = (t, n, o, s, d) => {
4061
+ const f = d[n === "paste-values" ? "pasteValues" : n];
4062
+ if (f?.hidden)
4063
+ return null;
4064
+ const p = o.has(t) || f?.disabled === !0;
4065
+ return {
4066
+ kind: "action",
4067
+ id: n,
4068
+ label: f?.label ?? er[n],
4069
+ disabled: p,
4070
+ title: f?.disabledReason ?? s[t],
4071
+ actionId: n
4072
+ };
4073
+ }, H = (t, n, o) => {
4074
+ if (t.hidden === !0)
4075
+ return null;
4076
+ const s = n.length > 0 ? `${n}/${t.key}` : t.key, d = `custom:${s}`, v = t.disabledReason?.trim() || void 0;
4077
+ if (t.kind === "submenu") {
4078
+ const f = t.items.flatMap((p) => {
4079
+ const x = H(p, s, o);
4080
+ return x ? [x] : [];
4081
+ });
4082
+ return f.length === 0 ? null : {
4083
+ kind: "submenu",
4084
+ id: d,
4085
+ label: t.label,
4086
+ disabled: t.disabled === !0,
4087
+ title: v,
4088
+ entries: f
4089
+ };
4090
+ }
4091
+ return {
4092
+ kind: "action",
4093
+ id: d,
4094
+ label: t.label,
4095
+ disabled: t.disabled === !0,
4096
+ title: v,
4097
+ onSelect: async () => {
4098
+ t.disabled !== !0 && await t.onSelect?.({
4099
+ zone: o.zone,
4100
+ columnKey: o.columnKey,
4101
+ rowId: o.rowId,
4102
+ closeMenu: Ee
4103
+ });
4104
+ }
4105
+ };
4106
+ }, yl = (t, n, o) => {
4107
+ const s = /* @__PURE__ */ new Map(), d = (f, p) => {
4108
+ if (!p)
4109
+ return;
4110
+ const x = s.get(f) ?? [];
4111
+ x.push([p]), s.set(f, x);
4112
+ };
4113
+ for (const f of n)
4114
+ d(f.placement ?? "end", H(f, "", o));
4115
+ const v = [
4116
+ ...s.get("start") ?? []
4117
+ ];
4118
+ for (const f of t)
4119
+ v.push(...s.get(`before:${f.itemKey}`) ?? []), v.push([...f.entries]), v.push(...s.get(`after:${f.itemKey}`) ?? []);
4120
+ return v.push(...s.get("end") ?? []), v.filter((f) => f.length > 0);
4121
+ }, Mn = w(() => {
4122
+ if (!ce.value.visible)
4123
+ return [];
4124
+ const t = ce.value.zone;
4125
+ if (t === "cell" || t === "range") {
4126
+ const n = ce.value.columnKey ?? "";
4127
+ if (!e.cellMenu.enabled || !n)
4128
+ return [];
4129
+ const o = On(e.cellMenu, n), s = new Set(Oo(e.cellMenu, n)), d = ko(e.cellMenu, n), v = _o(e.cellMenu, n), f = Eo(e.cellMenu, n), p = Po(e.cellMenu, n), x = [];
4130
+ for (const P of o) {
4131
+ const K = (ba[P] ?? []).flatMap((Z) => {
4132
+ const me = bl(P, Z, s, d, f);
4133
+ return me ? [me] : [];
4134
+ });
4135
+ if (K.length !== 0) {
4136
+ if (P === "pasteSpecial") {
4137
+ const Z = s.has(P) || K.every((me) => me.disabled);
4138
+ x.push({
4139
+ itemKey: P,
4140
+ entries: [{
4141
+ kind: "submenu",
4142
+ id: "paste-special-submenu",
4143
+ label: v.pasteSpecial ?? "Paste special",
4144
+ disabled: Z,
4145
+ title: d[P] ?? (K.length === 1 ? K[0]?.title : void 0),
4146
+ entries: K
4147
+ }]
4148
+ });
4149
+ continue;
4150
+ }
4151
+ x.push({
4152
+ itemKey: P,
4153
+ entries: K
4154
+ });
4155
+ }
4156
+ }
4157
+ return yl(x, p, {
4158
+ zone: t,
4159
+ columnKey: n,
4160
+ rowId: ce.value.rowId
4161
+ });
4162
+ }
4163
+ if (t === "row-index") {
4164
+ if (!e.rowIndexMenu.enabled)
4165
+ return [];
4166
+ const n = St(ce.value.rowId ?? ""), o = To(e.rowIndexMenu), s = new Set(zo(e.rowIndexMenu)), d = Ho(e.rowIndexMenu), v = Vo(e.rowIndexMenu), f = [];
4167
+ for (const p of o) {
4168
+ const P = (ya[p] ?? []).flatMap((k) => {
4169
+ const Z = v[k === "insert-row-above" ? "insertAbove" : k === "insert-row-below" ? "insertBelow" : k === "copy-row" ? "copy" : k === "paste-row" ? "paste" : k === "delete-selected-rows" ? "deleteSelected" : "cut"];
4170
+ if (Z?.hidden)
4171
+ return [];
4172
+ let Re = s.has(p) || Z?.disabled === !0, Q = Z?.disabledReason ?? d[p];
4173
+ return n != null && k !== "delete-selected-rows" && k !== "insert-row-above" && k !== "insert-row-below" && k !== "paste-row" && (Re = !0, Q = Q ?? "Placeholder rows must be materialized before this action is available"), (k === "insert-row-above" || k === "insert-row-below") && !Se() && !Rn() && (Re = !0, Q = Q ?? "Row insertion is not supported by the current row model"), k === "paste-row" && !Se() && (Re = !0, Q = Q ?? "Row insertion is not supported by the current row model"), k === "cut-row" && !Oe() && (Re = !0, Q = Q ?? "Row deletion is not supported by the current row model"), k === "delete-selected-rows" && !Oe() && !Rn() && (Re = !0, Q = Q ?? "Row deletion is not supported by the current row model"), k === "delete-selected-rows" && $e(
4174
+ Je(ce.value.rowId ?? "")
4175
+ ).length === 0 && (Re = !0, Q = Q ?? "No deletable rows are selected"), [{
4176
+ kind: "action",
4177
+ id: k,
4178
+ label: nl(k, Z?.label),
4179
+ disabled: Re,
4180
+ title: Q,
4181
+ actionId: k
4182
+ }];
4183
+ });
4184
+ P.length > 0 && f.push(P);
4185
+ }
4186
+ return f;
4187
+ }
4188
+ return [];
4189
+ }), c = (t) => {
4190
+ ml.dispatchViewportContextMenu(t);
4191
+ }, y = () => {
4192
+ pe.value?.querySelector(".grid-body-viewport")?.focus({ preventScroll: !0 });
4193
+ }, S = () => {
4194
+ et(() => {
4195
+ if (typeof window < "u") {
4196
+ window.requestAnimationFrame(() => {
4197
+ y();
4198
+ });
4199
+ return;
4200
+ }
4201
+ y();
4202
+ });
4203
+ }, D = async (t) => {
4204
+ await gl.runContextMenuAction(t) && (y(), Ee(), S());
4205
+ }, ee = async (t) => {
4206
+ if (!t.disabled && t.kind !== "submenu") {
4207
+ if (t.actionId) {
4208
+ await D(t.actionId);
4209
+ return;
4210
+ }
4211
+ await t.onSelect?.();
4212
+ }
4213
+ }, U = (t, n = [], o = 0) => t.flatMap((s) => {
4214
+ if (s.kind === "submenu") {
4215
+ const d = zt(s.id), v = d ? B("div", {
4216
+ class: "datagrid-context-menu__submenu-panel",
4217
+ role: "menu",
4218
+ "data-datagrid-menu-parent-action": s.id
4219
+ }, U(s.entries, [...n, s.id], o + 1)) : null;
4220
+ return [B("div", {
4221
+ class: [
4222
+ "datagrid-context-menu__submenu",
4223
+ d ? "datagrid-context-menu__submenu--open" : null
4224
+ ]
4225
+ }, [
4226
+ B("button", {
4227
+ type: "button",
4228
+ class: [
4229
+ "datagrid-context-menu__item",
4230
+ "datagrid-context-menu__item--submenu"
4231
+ ],
4232
+ "data-datagrid-menu-action": s.id,
4233
+ "data-datagrid-menu-depth": String(o),
4234
+ "data-datagrid-menu-open": d ? "true" : void 0,
4235
+ "aria-haspopup": "menu",
4236
+ "aria-expanded": d ? "true" : "false",
4237
+ disabled: s.disabled,
4238
+ title: s.title,
4239
+ onClick: () => {
4240
+ hl(s.id, n);
4241
+ }
4242
+ }, [
4243
+ B("span", s.label),
4244
+ B("span", {
4245
+ class: "datagrid-context-menu__submenu-arrow",
4246
+ "aria-hidden": "true"
4247
+ }, ">")
4248
+ ]),
4249
+ ...v ? [v] : []
4250
+ ])];
4251
+ }
4252
+ return [B("button", {
4253
+ type: "button",
4254
+ class: "datagrid-context-menu__item",
4255
+ "data-datagrid-menu-action": s.id,
4256
+ "data-datagrid-menu-depth": String(o),
4257
+ disabled: s.disabled,
4258
+ title: s.title,
4259
+ onClick: () => {
4260
+ ee(s);
4261
+ }
4262
+ }, s.label)];
4263
+ }), V = () => !ce.value.visible || Mn.value.length === 0 ? null : B("div", {
4264
+ ref: In,
4265
+ class: "datagrid-context-menu",
4266
+ style: dl.value,
4267
+ role: "menu",
4268
+ tabindex: -1,
4269
+ onKeydown: (t) => {
4270
+ cl(t, {
4271
+ onEscape: () => {
4272
+ y();
4273
+ }
4274
+ });
4275
+ }
4276
+ }, Mn.value.flatMap((t, n) => {
4277
+ const o = [];
4278
+ return n > 0 && o.push(B("div", {
4279
+ class: "datagrid-context-menu__separator",
4280
+ "aria-hidden": "true"
4281
+ })), o.push(...U(t)), o;
4282
+ }));
4283
+ te(
4284
+ () => ce.value.visible,
4285
+ (t, n, o) => {
4286
+ if (t || (Ne.value = []), !t || typeof window > "u")
4287
+ return;
4288
+ const s = (v) => {
4289
+ const f = v.target;
4290
+ f && In.value?.contains(f) || Ee();
4291
+ }, d = () => {
4292
+ Ee();
4293
+ };
4294
+ window.addEventListener("mousedown", s, !0), window.addEventListener("blur", d), o(() => {
4295
+ window.removeEventListener("mousedown", s, !0), window.removeEventListener("blur", d);
4296
+ });
4297
+ }
4298
+ );
4299
+ const $ = w(() => ({
4300
+ ...Ze.value,
4301
+ customOverlays: e.customOverlays,
4302
+ columns: {
4303
+ ...Ze.value.columns,
4304
+ columnMenuEnabled: e.columnMenu.enabled,
4305
+ columnMenuTrigger: e.columnMenu.trigger,
4306
+ columnMenuMaxFilterValues: e.columnMenu.maxFilterValues,
4307
+ resolveColumnMenuItems: Kt,
4308
+ resolveColumnMenuDisabledItems: Nt,
4309
+ resolveColumnMenuDisabledReasons: Wt,
4310
+ resolveColumnMenuLabels: vt,
4311
+ resolveColumnMenuActionOptions: Ut,
4312
+ resolveColumnMenuCustomItems: qt,
4313
+ isColumnFilterActive: Lt,
4314
+ isColumnGrouped: Jt,
4315
+ resolveColumnGroupOrder: Yt,
4316
+ resolveColumnMenuSortDirection: rn,
4317
+ resolveColumnMenuSelectedTokens: W,
4318
+ applyColumnMenuSort: at,
4319
+ applyColumnMenuPin: Ae,
4320
+ applyColumnMenuGroupBy: Be,
4321
+ applyColumnMenuFilter: De,
4322
+ clearColumnMenuFilter: bt
4323
+ },
4324
+ rows: {
4325
+ ...Ze.value.rows,
4326
+ sourceRows: e.rows,
4327
+ rowHover: e.rowHover,
4328
+ stripedRows: e.stripedRows
4329
+ }
4330
+ })), ue = w(() => {
4331
+ const t = [];
4332
+ return e.history.enabled && e.history.controls === "toolbar" && (t.push({
4333
+ key: "history-undo",
4334
+ component: Ul,
4335
+ props: {
4336
+ action: "undo",
4337
+ label: "Undo",
4338
+ disabled: !ke.canUndo(),
4339
+ onTrigger: () => ke.runHistoryAction("undo")
4340
+ }
4341
+ }), t.push({
4342
+ key: "history-redo",
4343
+ component: Ul,
4344
+ props: {
4345
+ action: "redo",
4346
+ label: "Redo",
4347
+ disabled: !ke.canRedo(),
4348
+ onTrigger: () => ke.runHistoryAction("redo")
4349
+ }
4350
+ })), e.columnLayout.enabled && t.push({
4351
+ key: "column-layout",
4352
+ component: bo,
4353
+ props: {
4354
+ isOpen: ft.value,
4355
+ items: wt.value,
4356
+ buttonLabel: e.columnLayout.buttonLabel,
4357
+ labels: e.columnLayout.labels,
4358
+ active: !1,
4359
+ onOpen: We,
4360
+ onToggleVisibility: gt,
4361
+ onMoveUp: _,
4362
+ onMoveDown: le,
4363
+ onMoveToPosition: (n) => {
4364
+ Pn(n.key, n.targetKey, n.placement);
4365
+ },
4366
+ onApply: z,
4367
+ onCancel: T
4368
+ }
4369
+ }), e.advancedFilter.enabled && t.push({
4370
+ key: "advanced-filter",
4371
+ component: ta,
4372
+ props: {
4373
+ isOpen: Bt.value,
4374
+ clauses: N.value,
4375
+ columns: A.value,
4376
+ appliedFilterSummaryItems: rt.value,
4377
+ hasAnyFilters: ot.value,
4378
+ buttonLabel: e.advancedFilter.buttonLabel,
4379
+ labels: e.advancedFilter.labels,
4380
+ active: ot.value,
4381
+ showActiveIcon: ot.value,
4382
+ onOpen: qe,
4383
+ onAdd: Hn,
4384
+ onRemove: Vn,
4385
+ onUpdateClause: Bn,
4386
+ onApply: Qt,
4387
+ onCancel: jn,
4388
+ onResetAll: $n
4389
+ }
4390
+ }), e.findReplace.enabled && t.push({
4391
+ key: "find-replace",
4392
+ component: la,
4393
+ props: {
4394
+ isOpen: L.isPanelOpen.value,
4395
+ findText: L.findText.value,
4396
+ replaceText: L.replaceText.value,
4397
+ matchCase: L.matchCase.value,
4398
+ statusText: L.statusText.value,
4399
+ buttonLabel: e.findReplace.buttonLabel,
4400
+ active: L.active.value,
4401
+ canFind: L.canFind.value,
4402
+ canReplaceCurrent: L.canReplaceCurrent.value,
4403
+ canReplaceAll: L.canReplaceAll.value,
4404
+ onOpen: L.openPanel,
4405
+ onCancel: L.closePanel,
4406
+ onUpdateFindText: L.updateFindText,
4407
+ onUpdateReplaceText: L.updateReplaceText,
4408
+ onUpdateMatchCase: L.updateMatchCase,
4409
+ onFindNext: L.findNext,
4410
+ onFindPrevious: L.findPrevious,
4411
+ onReplaceCurrent: L.replaceCurrent,
4412
+ onReplaceAll: L.replaceAll
4413
+ }
4414
+ }), e.aggregations.enabled && e.mode !== "pivot" && t.push({
4415
+ key: "aggregations",
4416
+ component: na,
4417
+ props: {
4418
+ isOpen: Fe.value,
4419
+ basis: Ue.value,
4420
+ items: Gt.value,
4421
+ buttonLabel: e.aggregations.buttonLabel,
4422
+ active: re.value && (Fe.value || !!lt.value?.columns.length),
4423
+ disabled: !re.value,
4424
+ disabledReason: re.value ? "" : "Aggregations require an active group-by model.",
4425
+ onOpen: Wn,
4426
+ onUpdateBasis: ln,
4427
+ onToggleColumn: Un,
4428
+ onUpdateOp: qn,
4429
+ onClear: ht,
4430
+ onApply: Yn,
4431
+ onCancel: nn
4432
+ }
4433
+ }), [...t, ...e.toolbarModules].map(ra);
4434
+ });
4435
+ te(
4436
+ ue,
4437
+ (t) => {
4438
+ e.reportToolbarModules?.(t);
4439
+ },
4440
+ { immediate: !0, flush: "post" }
4441
+ );
4442
+ const X = w(() => e.viewMode === "gantt" && e.chrome.toolbarPlacement === "integrated" ? "stacked" : e.chrome.toolbarPlacement), ye = w(() => ue.value.length > 0 && X.value !== "hidden"), ge = w(() => ye.value && X.value === "stacked"), Fn = w(() => ye.value && X.value === "integrated");
4443
+ return () => B("div", {
4444
+ class: [
4445
+ "datagrid-app-layout",
4446
+ `datagrid-app-layout--toolbar-${X.value}`,
4447
+ `datagrid-app-layout--density-${e.chrome.density}`,
4448
+ e.layoutMode === "auto-height" ? "datagrid-app-layout--auto-height" : "datagrid-app-layout--fill"
4449
+ ],
4450
+ style: l.value
4451
+ }, [
4452
+ ge.value ? B(Wl, {
4453
+ modules: ue.value,
4454
+ variant: "standalone"
4455
+ }) : null,
4456
+ B("div", {
4457
+ class: [
4458
+ "datagrid-app-workspace",
4459
+ e.layoutMode === "auto-height" ? "datagrid-app-workspace--auto-height" : "datagrid-app-workspace--fill"
4460
+ ]
4461
+ }, [
4462
+ Fn.value ? B("div", {
4463
+ class: [
4464
+ "datagrid-app-stage-surface",
4465
+ e.layoutMode === "auto-height" ? "datagrid-app-stage-surface--auto-height" : "datagrid-app-stage-surface--fill",
4466
+ "datagrid-app-stage-surface--integrated"
4467
+ ]
4468
+ }, [
4469
+ B(Wl, {
4470
+ modules: ue.value,
4471
+ variant: "integrated"
4472
+ }),
4473
+ B("div", {
4474
+ class: [
4475
+ "datagrid-app-stage",
4476
+ "datagrid-app-stage--integrated",
4477
+ e.layoutMode === "auto-height" ? "datagrid-app-stage--auto-height" : "datagrid-app-stage--fill"
4478
+ ],
4479
+ ref: pe
4480
+ }, [
4481
+ e.viewMode === "gantt" ? B(Kl, {
4482
+ stageContext: _e,
4483
+ runtime: e.runtime,
4484
+ gantt: e.gantt,
4485
+ baseRowHeight: ne.value,
4486
+ rowVersion: r.value
4487
+ }) : B(Nl, {
4488
+ ...$.value,
4489
+ stageContext: _e,
4490
+ onViewportContextMenu: c
4491
+ }),
4492
+ V()
4493
+ ])
4494
+ ]) : B("div", {
4495
+ class: [
4496
+ "datagrid-app-stage",
4497
+ e.layoutMode === "auto-height" ? "datagrid-app-stage--auto-height" : "datagrid-app-stage--fill"
4498
+ ],
4499
+ ref: pe
4500
+ }, [
4501
+ e.viewMode === "gantt" ? B(Kl, {
4502
+ stageContext: _e,
4503
+ runtime: e.runtime,
4504
+ gantt: e.gantt,
4505
+ baseRowHeight: ne.value,
4506
+ rowVersion: r.value
4507
+ }) : B(Nl, {
4508
+ ...$.value,
4509
+ stageContext: _e,
4510
+ onViewportContextMenu: c
4511
+ }),
4512
+ V()
4513
+ ]),
4514
+ e.inspectorPanel ? B("aside", {
4515
+ class: "datagrid-app-inspector-shell"
4516
+ }, [
4517
+ B(e.inspectorPanel.component, {
4518
+ ...e.inspectorPanel.props ?? {}
4519
+ })
4520
+ ]) : null
4521
+ ])
4522
+ ]);
4523
+ }
4524
+ });
4525
+ function Ua() {
4526
+ return (e) => e;
4527
+ }
4528
+ const xl = /* @__PURE__ */ new WeakMap(), tr = /* @__PURE__ */ new WeakMap();
4529
+ function Ca(e) {
4530
+ if (!e)
4531
+ return;
4532
+ const l = xl.get(e);
4533
+ if (l)
4534
+ return l;
4535
+ const a = e.initialTreeData?.expandedByDefault ?? !1;
4536
+ if (e.initialTreeData?.expandedByDefault === a)
4537
+ return xl.set(e, e), e;
4538
+ const r = {
4539
+ ...e
4540
+ };
4541
+ return e.initialTreeData && (r.initialTreeData = {
4542
+ ...e.initialTreeData,
4543
+ expandedByDefault: a
4544
+ }), xl.set(e, r), r;
4545
+ }
4546
+ function pa(e) {
4547
+ return !e || e.length === 0 ? [] : e.map((l) => ({ ...l }));
4548
+ }
4549
+ function Sa(e) {
4550
+ return !e || e.length === 0 ? [] : e.map((l) => ({ ...l }));
4551
+ }
4552
+ function Ia(e) {
4553
+ return !e || e.length === 0 ? [] : e.map(({ formula: l, ...a }) => ({ ...a }));
4554
+ }
4555
+ function xa(e) {
4556
+ return !e || e.length === 0 ? [] : e.flatMap((l) => {
4557
+ const a = typeof l.formula == "string" ? l.formula.trim() : "";
4558
+ return a ? [{
4559
+ name: l.key,
4560
+ formula: a
4561
+ }] : [];
4562
+ });
4563
+ }
4564
+ function Ma(e, l) {
4565
+ const a = /* @__PURE__ */ new Map();
4566
+ for (const r of e)
4567
+ a.set(r.name, { ...r });
4568
+ for (const r of pa(l))
4569
+ a.set(r.name, r);
4570
+ return Array.from(a.values());
4571
+ }
4572
+ function qa(e) {
4573
+ return Ia(e);
4574
+ }
4575
+ function Ya(e) {
4576
+ const l = Ca(e.clientRowModelOptions), a = e.enterpriseClientRowModelOptions, r = xa(e.columns), u = e.formulas !== void 0, i = e.computedFields !== void 0, g = e.formulaFunctions !== void 0, h = r.length > 0, R = u || h ? Ma(r, e.formulas) : void 0, E = i ? Sa(e.computedFields) : void 0, O = g ? e.formulaFunctions ?? {} : void 0, G = !!(h || u || i || g);
4577
+ if (!l && !G)
4578
+ return a ? {
4579
+ ...a
4580
+ } : void 0;
4581
+ if (!G) {
4582
+ if (l && !a)
4583
+ return l;
4584
+ if (!l && a)
4585
+ return a;
4586
+ if (l && a) {
4587
+ let I = tr.get(l);
4588
+ I || (I = /* @__PURE__ */ new WeakMap(), tr.set(l, I));
4589
+ const b = I.get(a);
4590
+ if (b)
4591
+ return b;
4592
+ const F = {
4593
+ ...l,
4594
+ ...a
4595
+ };
4596
+ return I.set(
4597
+ a,
4598
+ F
4599
+ ), F;
4600
+ }
4601
+ }
4602
+ return {
4603
+ ...l ?? {},
4604
+ ...i ? { initialComputedFields: E } : {},
4605
+ ...u || h ? { initialFormulaFields: R } : {},
4606
+ ...g ? { initialFormulaFunctionRegistry: O } : {},
4607
+ ...a?.computeMode ? { computeMode: a.computeMode } : {},
4608
+ ...a?.workerPatchDispatchThreshold !== void 0 ? { workerPatchDispatchThreshold: a.workerPatchDispatchThreshold } : {},
4609
+ ...a?.formulaColumnCacheMaxColumns !== void 0 ? { formulaColumnCacheMaxColumns: a.formulaColumnCacheMaxColumns } : {}
4610
+ };
4611
+ }
4612
+ const Fa = "comfortable", Aa = {
4613
+ comfortable: {
4614
+ toolbarGap: 10,
4615
+ workspaceGap: 12
4616
+ },
4617
+ compact: {
4618
+ toolbarGap: 6,
4619
+ workspaceGap: 8
4620
+ }
4621
+ };
4622
+ function Da(e) {
4623
+ return e === "compact" ? "compact" : Fa;
4624
+ }
4625
+ function Oa(e) {
4626
+ return e === "integrated" || e === "hidden" || e === "stacked" ? e : "stacked";
4627
+ }
4628
+ function nr(e, l) {
4629
+ return Number.isFinite(e) ? Math.max(0, e) : l;
4630
+ }
4631
+ function Ja(e) {
4632
+ const l = typeof e == "object" && e !== null ? e : null, a = Da(typeof e == "string" ? e : l?.density), r = Aa[a];
4633
+ return {
4634
+ density: a,
4635
+ toolbarPlacement: Oa(l?.toolbarPlacement),
4636
+ toolbarGap: nr(l?.toolbarGap, r.toolbarGap),
4637
+ workspaceGap: nr(l?.workspaceGap, r.workspaceGap)
4638
+ };
4639
+ }
4640
+ function Xa(e) {
4641
+ return typeof e == "boolean" ? {
4642
+ enabled: e
4643
+ } : e ? {
4644
+ enabled: e.enabled ?? !0
4645
+ } : {
4646
+ enabled: !1
4647
+ };
4648
+ }
4649
+ function Za(e) {
4650
+ return typeof e == "boolean" ? {
4651
+ enabled: e
4652
+ } : e ? {
4653
+ enabled: e.enabled ?? !0
4654
+ } : {
4655
+ enabled: !1
4656
+ };
4657
+ }
4658
+ function lr() {
4659
+ const e = globalThis.performance;
4660
+ return e && typeof e.now == "function" ? e.now() : Date.now();
4661
+ }
4662
+ const _a = (e, l) => {
4663
+ const a = lr();
4664
+ return {
4665
+ result: l(),
4666
+ duration: Math.max(0, lr() - a)
4667
+ };
4668
+ };
4669
+ function rr(e) {
4670
+ return {
4671
+ projectionStageTimer: _a,
4672
+ ...e ?? {}
4673
+ };
4674
+ }
4675
+ function Qa(e) {
4676
+ const l = q(0), a = Rl(), r = Ml(
4677
+ e.rowModel.value ? null : Rl({
4678
+ rows: e.rows.value,
4679
+ ...rr(e.clientRowModelOptions.value)
4680
+ })
4681
+ ), u = (R) => {
4682
+ !R || R === e.rowModel.value || "dispose" in R && typeof R.dispose == "function" && R.dispose();
4683
+ }, i = (R) => {
4684
+ !R || R === e.rowModel.value || et(() => {
4685
+ u(R);
4686
+ });
4687
+ }, g = () => {
4688
+ if (e.rowModel.value)
4689
+ return;
4690
+ const R = r.value;
4691
+ r.value = Rl({
4692
+ rows: e.rows.value,
4693
+ ...rr(e.clientRowModelOptions.value)
4694
+ }), l.value += 1, e.onOwnedRowModelRecreated?.(), i(R);
4695
+ }, h = w(() => e.rowModel.value ?? r.value ?? a);
4696
+ return te(
4697
+ e.rows,
4698
+ (R) => {
4699
+ r.value && r.value.setRows(R);
4700
+ },
4701
+ { deep: !1 }
4702
+ ), te(
4703
+ e.clientRowModelOptions,
4704
+ () => {
4705
+ g();
4706
+ },
4707
+ { deep: !0 }
4708
+ ), te(
4709
+ e.rowModel,
4710
+ (R) => {
4711
+ if (R) {
4712
+ const E = r.value;
4713
+ r.value = null, l.value += 1, i(E);
4714
+ return;
4715
+ }
4716
+ r.value || g();
4717
+ }
4718
+ ), Sr(() => {
4719
+ u(r.value), u(a);
4720
+ }), {
4721
+ dataGridInstanceKey: l,
4722
+ resolvedRowModel: h,
4723
+ disposeOwnedRowModel: u
4724
+ };
4725
+ }
4726
+ export {
4727
+ Wa as D,
4728
+ Wl as a,
4729
+ Xa as b,
4730
+ Ya as c,
4731
+ Za as d,
4732
+ Bo as e,
4733
+ Zo as f,
4734
+ $a as g,
4735
+ Ka as h,
4736
+ Na as i,
4737
+ La as j,
4738
+ qa as k,
4739
+ Ua as l,
4740
+ Ja as r,
4741
+ Qa as u
4742
+ };