@mintplayer/web-components 2.14.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +15 -0
  2. package/badge/src/styles/badge.styles.d.ts +2 -0
  3. package/chunks/install-light-styles-DbCAGFOC.mjs +209 -0
  4. package/chunks/{mp-datatable-GmKqaN8y.mjs → mp-datatable-UJI8E73X.mjs} +484 -476
  5. package/chunks/{mp-treeview-tkWu28iF.mjs → mp-treeview-C8iltDbq.mjs} +61 -63
  6. package/datatable/index.mjs +2 -2
  7. package/datatable/src/components/mp-datatable.d.ts +9 -1
  8. package/datatable/src/index.d.ts +1 -1
  9. package/datatable/src/styles/datatable.light.styles.d.ts +2 -0
  10. package/datatable/src/styles/index.d.ts +1 -1
  11. package/dock/index.mjs +477 -492
  12. package/dock/src/components/mint-dock-manager.element.d.ts +10 -8
  13. package/dock/src/core/index.d.ts +1 -0
  14. package/dock/src/core/intersection-sizing.d.ts +83 -0
  15. package/dock/src/core/layout-tree.d.ts +23 -2
  16. package/dock/src/core/types.d.ts +14 -0
  17. package/file-manager/index.mjs +30 -29
  18. package/file-manager/src/components/mp-file-manager.d.ts +2 -0
  19. package/light-dom/index.d.ts +1 -0
  20. package/light-dom/index.mjs +11 -0
  21. package/light-dom/src/index.d.ts +2 -0
  22. package/light-dom/src/install-light-styles.d.ts +25 -0
  23. package/light-dom/src/scoped-html.d.ts +26 -0
  24. package/package.json +5 -1
  25. package/query-builder/index.mjs +1472 -2651
  26. package/query-builder/src/index.d.ts +4 -0
  27. package/query-builder/src/mp-query-builder.element.d.ts +1 -1
  28. package/query-builder/src/mp-query-builder.light.styles.d.ts +2 -0
  29. package/query-builder/src/mp-query-condition.element.d.ts +1 -1
  30. package/query-builder/src/mp-query-condition.light.styles.d.ts +2 -0
  31. package/query-builder/src/mp-query-group.element.d.ts +1 -1
  32. package/query-builder/src/mp-query-group.light.styles.d.ts +2 -0
  33. package/query-builder/src/mp-query-subquery.element.d.ts +1 -1
  34. package/query-builder/src/mp-query-subquery.light.styles.d.ts +2 -0
  35. package/tree-select/index.mjs +60 -58
  36. package/tree-select/src/components/mp-tree-select.d.ts +1 -1
  37. package/tree-select/src/index.d.ts +1 -1
  38. package/tree-select/src/styles/index.d.ts +1 -1
  39. package/tree-select/src/styles/tree-select.light.styles.d.ts +2 -0
  40. package/treeview/index.mjs +3 -3
  41. package/treeview/src/components/mp-treeview.d.ts +1 -1
  42. package/treeview/src/index.d.ts +1 -1
  43. package/treeview/src/styles/index.d.ts +1 -1
  44. package/treeview/src/styles/treeview.light.styles.d.ts +2 -0
@@ -1,9 +1,10 @@
1
- import { html as d, unsafeCSS as S, LitElement as R, nothing as u } from "lit";
2
- import { createContext as A, ContextConsumer as p, ContextProvider as k } from "@lit/context";
3
- import { createRef as ee, ref as te } from "lit/directives/ref.js";
1
+ import { unsafeCSS as A, LitElement as L, nothing as c } from "lit";
2
+ import { s as M, i as T } from "../chunks/install-light-styles-DbCAGFOC.mjs";
3
+ import { createContext as P, ContextConsumer as f, ContextProvider as x } from "@lit/context";
4
+ import { createRef as ie, ref as se } from "lit/directives/ref.js";
4
5
  import "../chunks/mp-select-BNrbPwN4.mjs";
5
6
  import "../chunks/mp-checkbox-CzwS7Y_t.mjs";
6
- const j = {
7
+ const W = {
7
8
  string: [
8
9
  "equals",
9
10
  "not-equals",
@@ -100,7 +101,7 @@ const j = {
100
101
  enum: ["equals", "not-equals", "in", "not-in", "is-null", "is-not-null"],
101
102
  relation: ["in", "not-in"],
102
103
  array: ["any-of", "all-of", "none-of", "is-empty", "is-not-empty"]
103
- }, re = /* @__PURE__ */ new Set([
104
+ }, ae = /* @__PURE__ */ new Set([
104
105
  "is-null",
105
106
  "is-not-null",
106
107
  "is-true",
@@ -119,18 +120,18 @@ const j = {
119
120
  "last-year",
120
121
  "next-year",
121
122
  "year-to-date"
122
- ]), oe = /* @__PURE__ */ new Set(["between", "not-between"]), ne = /* @__PURE__ */ new Set([
123
+ ]), de = /* @__PURE__ */ new Set(["between", "not-between"]), le = /* @__PURE__ */ new Set([
123
124
  "in",
124
125
  "not-in",
125
126
  "any-of",
126
127
  "all-of",
127
128
  "none-of"
128
- ]), se = /* @__PURE__ */ new Set(["last-n-days", "next-n-days"]);
129
- function g(o) {
130
- return re.has(o) ? "null" : oe.has(o) ? "tuple" : ne.has(o) ? "array" : se.has(o) ? "n-input" : "scalar";
129
+ ]), ue = /* @__PURE__ */ new Set(["last-n-days", "next-n-days"]);
130
+ function h(o) {
131
+ return ae.has(o) ? "null" : de.has(o) ? "tuple" : le.has(o) ? "array" : ue.has(o) ? "n-input" : "scalar";
131
132
  }
132
- function x(o) {
133
- switch (g(o)) {
133
+ function $(o) {
134
+ switch (h(o)) {
134
135
  case "null":
135
136
  return null;
136
137
  case "tuple":
@@ -143,39 +144,39 @@ function x(o) {
143
144
  return null;
144
145
  }
145
146
  }
146
- function y(o, e = j) {
147
+ function w(o, e = W) {
147
148
  return e[o] ?? [];
148
149
  }
149
- function Ge(o, e, t = j) {
150
+ function We(o, e, t = W) {
150
151
  const r = {
151
152
  sanitized: {},
152
153
  warnings: []
153
154
  };
154
155
  if (!e) return r;
155
156
  const n = /* @__PURE__ */ new Map();
156
- for (const s of o)
157
- for (const b of s.fields)
158
- n.has(b.name) || n.set(b.name, { entity: s.name, type: b.type });
159
- for (const [s, b] of Object.entries(e)) {
160
- const i = b ?? [], a = n.get(s);
161
- if (!a) {
157
+ for (const i of o)
158
+ for (const s of i.fields)
159
+ n.has(s.name) || n.set(s.name, { entity: i.name, type: s.type });
160
+ for (const [i, s] of Object.entries(e)) {
161
+ const a = s ?? [], d = n.get(i);
162
+ if (!d) {
162
163
  r.warnings.push(
163
- `[operatorOverrides] Unknown field "${s}" — no entity in schema declares it. Override ignored.`
164
+ `[operatorOverrides] Unknown field "${i}" — no entity in schema declares it. Override ignored.`
164
165
  );
165
166
  continue;
166
167
  }
167
- const l = new Set(y(a.type, t)), c = [], h = [];
168
- for (const f of i)
169
- l.has(f) ? c.push(f) : h.push(f);
170
- h.length > 0 && r.warnings.push(
171
- `[operatorOverrides] Field "${s}" (${a.entity}.${s}, type=${a.type}) has operator(s) [${h.join(", ")}] not in the catalog for that type. Stripping.`
172
- ), c.length === 0 && i.length > 0 && r.warnings.push(
173
- `[operatorOverrides] Field "${s}" has no valid operators after intersection — empty operator dropdown.`
174
- ), r.sanitized[s] = c;
168
+ const l = new Set(w(d.type, t)), u = [], p = [];
169
+ for (const m of a)
170
+ l.has(m) ? u.push(m) : p.push(m);
171
+ p.length > 0 && r.warnings.push(
172
+ `[operatorOverrides] Field "${i}" (${d.entity}.${i}, type=${d.type}) has operator(s) [${p.join(", ")}] not in the catalog for that type. Stripping.`
173
+ ), u.length === 0 && a.length > 0 && r.warnings.push(
174
+ `[operatorOverrides] Field "${i}" has no valid operators after intersection — empty operator dropdown.`
175
+ ), r.sanitized[i] = u;
175
176
  }
176
177
  return r;
177
178
  }
178
- function be() {
179
+ function ce() {
179
180
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
180
181
  return crypto.randomUUID();
181
182
  const o = new Uint8Array(16);
@@ -187,61 +188,61 @@ function be() {
187
188
  const e = Array.from(o, (t) => t.toString(16).padStart(2, "0"));
188
189
  return `${e.slice(0, 4).join("")}-${e.slice(4, 6).join("")}-${e.slice(6, 8).join("")}-${e.slice(8, 10).join("")}-${e.slice(10, 16).join("")}`;
189
190
  }
190
- function $() {
191
- return be();
191
+ function C() {
192
+ return ce();
192
193
  }
193
- function I(o = "and") {
194
- return { kind: "group", id: $(), logic: o, children: [] };
194
+ function Q(o = "and") {
195
+ return { kind: "group", id: C(), logic: o, children: [] };
195
196
  }
196
- function ie(o) {
197
+ function me(o) {
197
198
  const e = o.fields.find((r) => r.type !== "relation") ?? o.fields[0];
198
199
  if (!e)
199
- return { kind: "condition", id: $(), field: "", operator: "equals", value: null };
200
- const t = y(e.type)[0] ?? "equals";
200
+ return { kind: "condition", id: C(), field: "", operator: "equals", value: null };
201
+ const t = w(e.type)[0] ?? "equals";
201
202
  return {
202
203
  kind: "condition",
203
- id: $(),
204
+ id: C(),
204
205
  field: e.name,
205
206
  operator: t,
206
- value: x(t)
207
+ value: $(t)
207
208
  };
208
209
  }
209
- function ae(o) {
210
+ function pe(o) {
210
211
  const e = o.fields.find((t) => t.type === "relation" && t.targetEntity);
211
212
  return e ? {
212
213
  kind: "subquery",
213
- id: $(),
214
+ id: C(),
214
215
  field: e.name,
215
216
  operator: "in",
216
- subQuery: I("and")
217
+ subQuery: Q("and")
217
218
  } : null;
218
219
  }
219
- function Q(o) {
220
+ function G(o) {
220
221
  switch (o.kind) {
221
222
  case "group":
222
223
  return {
223
224
  ...o,
224
- children: o.children.map((e) => Q(e))
225
+ children: o.children.map((e) => G(e))
225
226
  };
226
227
  case "condition":
227
228
  return {
228
229
  ...o,
229
- value: T(o.value)
230
+ value: N(o.value)
230
231
  };
231
232
  case "subquery":
232
233
  return {
233
234
  ...o,
234
- subQuery: Q(o.subQuery)
235
+ subQuery: G(o.subQuery)
235
236
  };
236
237
  }
237
238
  }
238
- function T(o) {
239
+ function N(o) {
239
240
  if (o == null) return o;
240
- if (Array.isArray(o)) return o.map(T);
241
+ if (Array.isArray(o)) return o.map(N);
241
242
  if (typeof o == "object") {
242
243
  const e = {};
243
244
  for (const [t, r] of Object.entries(o))
244
- e[t] = T(r);
245
+ e[t] = N(r);
245
246
  return e;
246
247
  }
247
248
  return o;
@@ -255,64 +256,64 @@ function v(o, e) {
255
256
  }
256
257
  if (t.kind === "subquery") {
257
258
  const r = v(t.subQuery, e);
258
- return r !== null && r.kind === "group" ? { ...t, subQuery: r } : { ...t, subQuery: I("and") };
259
+ return r !== null && r.kind === "group" ? { ...t, subQuery: r } : { ...t, subQuery: Q("and") };
259
260
  }
260
261
  return t;
261
262
  }
262
- function _(o, e) {
263
+ function E(o, e) {
263
264
  if (o.id === e) return o;
264
265
  if (o.kind === "group")
265
266
  for (const t of o.children) {
266
- const r = _(t, e);
267
+ const r = E(t, e);
267
268
  if (r) return r;
268
269
  }
269
270
  else if (o.kind === "subquery")
270
- return _(o.subQuery, e);
271
+ return E(o.subQuery, e);
271
272
  return null;
272
273
  }
273
- function E(o, e) {
274
+ function D(o, e) {
274
275
  if (o.kind === "group") {
275
276
  const t = o.children.findIndex((r) => r.id === e);
276
277
  if (t >= 0) return { parent: o, index: t };
277
278
  for (const r of o.children) {
278
- const n = E(r, e);
279
+ const n = D(r, e);
279
280
  if (n) return n;
280
281
  }
281
282
  } else if (o.kind === "subquery")
282
- return E(o.subQuery, e);
283
+ return D(o.subQuery, e);
283
284
  return null;
284
285
  }
285
- function V(o) {
286
+ function J(o) {
286
287
  const e = /* @__PURE__ */ new Set(), t = (r) => {
287
288
  e.add(r.id), r.kind === "group" ? r.children.forEach(t) : r.kind === "subquery" && t(r.subQuery);
288
289
  };
289
290
  return t(o), e;
290
291
  }
291
- function L(o, e, t) {
292
+ function H(o, e, t) {
292
293
  return v(o, (r) => r.kind === "group" && r.id === e ? { ...r, children: [...r.children, t] } : r) ?? o;
293
294
  }
294
- function de(o, e, t) {
295
- return L(o, e, ie(t));
295
+ function be(o, e, t) {
296
+ return H(o, e, me(t));
296
297
  }
297
- function le(o, e, t = "and") {
298
- return L(o, e, I(t));
298
+ function he(o, e, t = "and") {
299
+ return H(o, e, Q(t));
299
300
  }
300
- function ce(o, e, t) {
301
- const r = ae(t);
302
- return r ? L(o, e, r) : o;
301
+ function fe(o, e, t) {
302
+ const r = pe(t);
303
+ return r ? H(o, e, r) : o;
303
304
  }
304
- function X(o, e) {
305
+ function Z(o, e) {
305
306
  return v(o, (r) => r.id === e ? null : r) ?? o;
306
307
  }
307
- function ue(o, e, t) {
308
+ function ye(o, e, t) {
308
309
  return v(o, (r) => r.kind === "group" && r.id === e ? { ...r, logic: t } : r) ?? o;
309
310
  }
310
- function fe(o, e, t) {
311
+ function ge(o, e, t) {
311
312
  return v(o, (r) => {
312
313
  if ((r.kind === "condition" || r.kind === "subquery") && r.id === e) {
313
314
  if (r.kind === "subquery") {
314
- const s = { ...r };
315
- return t.field !== void 0 && (s.field = t.field), t.operator !== void 0 && (t.operator === "in" || t.operator === "not-in") && (s.operator = t.operator), s;
315
+ const i = { ...r };
316
+ return t.field !== void 0 && (i.field = t.field), t.operator !== void 0 && (t.operator === "in" || t.operator === "not-in") && (i.operator = t.operator), i;
316
317
  }
317
318
  const n = { ...r };
318
319
  return t.field !== void 0 && (n.field = t.field), t.operator !== void 0 && (n.operator = t.operator), t.value !== void 0 && (n.value = t.value), n;
@@ -320,64 +321,64 @@ function fe(o, e, t) {
320
321
  return r;
321
322
  }) ?? o;
322
323
  }
323
- function he(o, e, t) {
324
+ function ve(o, e, t) {
324
325
  return v(o, (r) => {
325
326
  if (r.kind === "condition" && r.id === e) {
326
- const n = y(t.type), s = n.includes(r.operator) ? r.operator : n[0] ?? "equals", b = n.includes(r.operator) && g(r.operator) === g(s) ? r.value : x(s);
327
- return { ...r, field: t.name, operator: s, value: b };
327
+ const n = w(t.type), i = n.includes(r.operator) ? r.operator : n[0] ?? "equals", s = n.includes(r.operator) && h(r.operator) === h(i) ? r.value : $(i);
328
+ return { ...r, field: t.name, operator: i, value: s };
328
329
  }
329
330
  return r;
330
331
  }) ?? o;
331
332
  }
332
- function ge(o, e, t) {
333
+ function qe(o, e, t) {
333
334
  return v(o, (r) => {
334
335
  if (r.kind === "condition" && r.id === e) {
335
- const s = g(r.operator) === g(t) ? r.value : x(t);
336
- return { ...r, operator: t, value: s };
336
+ const i = h(r.operator) === h(t) ? r.value : $(t);
337
+ return { ...r, operator: t, value: i };
337
338
  }
338
339
  return r;
339
340
  }) ?? o;
340
341
  }
341
- function H(o, e, t, r, n) {
342
+ function j(o, e, t, r, n) {
342
343
  if (e === t) return o;
343
- const s = _(o, e);
344
- if (!s) return o;
345
- const b = _(o, t);
346
- if (!b || b.kind !== "group" || V(s).has(t)) return o;
347
- const a = n ? Y(s, n) : s, l = X(o, e);
348
- return v(l, (c) => {
349
- if (c.kind === "group" && c.id === t) {
350
- const h = [...c.children], f = Math.max(0, Math.min(r, h.length));
351
- return h.splice(f, 0, a), { ...c, children: h };
344
+ const i = E(o, e);
345
+ if (!i) return o;
346
+ const s = E(o, t);
347
+ if (!s || s.kind !== "group" || J(i).has(t)) return o;
348
+ const d = n ? ee(i, n) : i, l = Z(o, e);
349
+ return v(l, (u) => {
350
+ if (u.kind === "group" && u.id === t) {
351
+ const p = [...u.children], m = Math.max(0, Math.min(r, p.length));
352
+ return p.splice(m, 0, d), { ...u, children: p };
352
353
  }
353
- return c;
354
+ return u;
354
355
  }) ?? l;
355
356
  }
356
- function Y(o, e) {
357
+ function ee(o, e) {
357
358
  const t = e.fields.find((r) => r.type !== "relation");
358
359
  if (o.kind === "condition") {
359
- const r = e.fields.find((s) => s.name === o.field);
360
+ const r = e.fields.find((i) => i.name === o.field);
360
361
  if (r && r.type !== "relation") {
361
- const s = y(r.type), b = s.includes(o.operator) ? o.operator : s[0] ?? "equals", i = s.includes(o.operator) && g(o.operator) === g(b) ? o.value : x(b);
362
- return { ...o, operator: b, value: i };
362
+ const i = w(r.type), s = i.includes(o.operator) ? o.operator : i[0] ?? "equals", a = i.includes(o.operator) && h(o.operator) === h(s) ? o.value : $(s);
363
+ return { ...o, operator: s, value: a };
363
364
  }
364
365
  if (!t) return o;
365
- const n = y(t.type)[0] ?? "equals";
366
+ const n = w(t.type)[0] ?? "equals";
366
367
  return {
367
368
  ...o,
368
369
  field: t.name,
369
370
  operator: n,
370
- value: x(n)
371
+ value: $(n)
371
372
  };
372
373
  }
373
- return o.kind === "group" ? { ...o, children: o.children.map((r) => Y(r, e)) } : o;
374
+ return o.kind === "group" ? { ...o, children: o.children.map((r) => ee(r, e)) } : o;
374
375
  }
375
- class K extends Error {
376
+ class te extends Error {
376
377
  constructor(e, t) {
377
378
  super(`Query tree depth ${e} exceeds maxDepth ${t}.`), this.depth = e, this.maxDepth = t, this.name = "MaxDepthExceededError";
378
379
  }
379
380
  }
380
- const m = {
381
+ const y = {
381
382
  addCondition: "Add condition",
382
383
  addGroup: "Add group",
383
384
  addSubquery: "Add sub-query",
@@ -438,727 +439,100 @@ const m = {
438
439
  "is-empty": "is empty",
439
440
  "is-not-empty": "is not empty"
440
441
  }
441
- }, pe = 32;
442
- function je(o, e, t, r = {}) {
443
- const n = r.maxDepth ?? pe, s = {
442
+ }, we = 32;
443
+ function Je(o, e, t, r = {}) {
444
+ const n = r.maxDepth ?? we, i = {
444
445
  schema: t.schema,
445
446
  currentEntity: t.rootEntity,
446
447
  depth: 0
447
448
  };
448
- return P(o, e, s, n);
449
+ return z(o, e, i, n);
449
450
  }
450
- function P(o, e, t, r) {
451
- if (t.depth > r) throw new K(t.depth, r);
451
+ function z(o, e, t, r) {
452
+ if (t.depth > r) throw new te(t.depth, r);
452
453
  switch (o.kind) {
453
454
  case "condition":
454
455
  return e.condition(o, t);
455
456
  case "group": {
456
- const n = { ...t, depth: t.depth + 1 }, s = o.children.map((b) => P(b, e, n, r));
457
- return e.group(o, s, t);
457
+ const n = { ...t, depth: t.depth + 1 }, i = o.children.map((s) => z(s, e, n, r));
458
+ return e.group(o, i, t);
458
459
  }
459
460
  case "subquery": {
460
461
  const n = t.schema.find((l) => l.name === t.currentEntity);
461
462
  if (!n) throw new Error(`visitTree: schema has no entity "${t.currentEntity}".`);
462
- const s = n.fields.find((l) => l.name === o.field);
463
- if (!s) throw new Error(`visitTree: entity "${t.currentEntity}" has no field "${o.field}".`);
464
- if (s.type !== "relation" || !s.targetEntity)
463
+ const i = n.fields.find((l) => l.name === o.field);
464
+ if (!i) throw new Error(`visitTree: entity "${t.currentEntity}" has no field "${o.field}".`);
465
+ if (i.type !== "relation" || !i.targetEntity)
465
466
  throw new Error(`visitTree: field "${o.field}" is not a relation.`);
466
- const b = s.targetEntity;
467
- if (!t.schema.some((l) => l.name === b))
468
- throw new Error(`visitTree: relation target "${b}" missing from schema.`);
469
- const i = {
467
+ const s = i.targetEntity;
468
+ if (!t.schema.some((l) => l.name === s))
469
+ throw new Error(`visitTree: relation target "${s}" missing from schema.`);
470
+ const a = {
470
471
  ...t,
471
- currentEntity: b,
472
+ currentEntity: s,
472
473
  depth: t.depth + 1
473
- }, a = () => P(o.subQuery, e, i, r);
474
- return e.subquery(o, t, a);
474
+ }, d = () => z(o.subQuery, e, a, r);
475
+ return e.subquery(o, t, d);
475
476
  }
476
477
  }
477
478
  }
478
- const me = 32;
479
- function ve(o, e, t = {}) {
480
- const r = ye(t.messages), n = t.maxDepth ?? me, s = t.rootEntity ?? e[0]?.name ?? "";
481
- return N(o, e, s, r, 0, n);
479
+ const _e = 32;
480
+ function $e(o, e, t = {}) {
481
+ const r = Ee(t.messages), n = t.maxDepth ?? _e, i = t.rootEntity ?? e[0]?.name ?? "";
482
+ return B(o, e, i, r, 0, n);
482
483
  }
483
- function ye(o) {
484
+ function Ee(o) {
484
485
  return {
485
- ...m,
486
+ ...y,
486
487
  ...o ?? {},
487
- operators: { ...m.operators, ...o?.operators ?? {} }
488
+ operators: { ...y.operators, ...o?.operators ?? {} }
488
489
  };
489
490
  }
490
- function N(o, e, t, r, n, s) {
491
- if (n > s) throw new K(n, s);
491
+ function B(o, e, t, r, n, i) {
492
+ if (n > i) throw new te(n, i);
492
493
  switch (o.kind) {
493
494
  case "group":
494
- return we(o, e, t, r, n, s);
495
+ return ke(o, e, t, r, n, i);
495
496
  case "condition":
496
497
  return xe(o, e, t, r);
497
498
  case "subquery":
498
- return _e(o, e, t, r, n, s);
499
+ return Ce(o, e, t, r, n, i);
499
500
  }
500
501
  }
501
- function we(o, e, t, r, n, s) {
502
+ function ke(o, e, t, r, n, i) {
502
503
  if (o.children.length === 0)
503
504
  return o.logic === "and" ? "TRUE" : "FALSE";
504
- const b = o.logic === "and" ? ` ${r.logicAnd} ` : ` ${r.logicOr} `;
505
- return `(${o.children.map((a) => N(a, e, t, r, n + 1, s)).join(b)})`;
505
+ const s = o.logic === "and" ? ` ${r.logicAnd} ` : ` ${r.logicOr} `;
506
+ return `(${o.children.map((d) => B(d, e, t, r, n + 1, i)).join(s)})`;
506
507
  }
507
508
  function xe(o, e, t, r) {
508
- const s = W(e, t, o.field)?.label ?? o.field, b = r.operators[o.operator] ?? o.operator, i = qe(o.operator, o.value);
509
- return i === "" ? `${s} ${b}` : `${s} ${b} ${i}`;
509
+ const i = re(e, t, o.field)?.label ?? o.field, s = r.operators[o.operator] ?? o.operator, a = De(o.operator, o.value);
510
+ return a === "" ? `${i} ${s}` : `${i} ${s} ${a}`;
510
511
  }
511
- function _e(o, e, t, r, n, s) {
512
- const b = W(e, t, o.field), i = b?.label ?? o.field, a = r.operators[o.operator] ?? o.operator, l = b?.targetEntity ?? "", c = N(o.subQuery, e, l, r, n + 1, s);
513
- return `${i} ${a} ${c}`;
512
+ function Ce(o, e, t, r, n, i) {
513
+ const s = re(e, t, o.field), a = s?.label ?? o.field, d = r.operators[o.operator] ?? o.operator, l = s?.targetEntity ?? "", u = B(o.subQuery, e, l, r, n + 1, i);
514
+ return `${a} ${d} ${u}`;
514
515
  }
515
- function qe(o, e) {
516
- const t = g(o);
516
+ function De(o, e) {
517
+ const t = h(o);
517
518
  if (t === "null") return "";
518
519
  if (t === "tuple" && Array.isArray(e))
519
- return `[${e.map(M).join(", ")}]`;
520
+ return `[${e.map(I).join(", ")}]`;
520
521
  if (t === "array" && Array.isArray(e))
521
- return `[${e.map(M).join(", ")}]`;
522
+ return `[${e.map(I).join(", ")}]`;
522
523
  if (t === "n-input" && typeof e == "object" && e !== null) {
523
524
  const r = e.n;
524
525
  return typeof r == "number" ? String(r) : JSON.stringify(e);
525
526
  }
526
- return M(e);
527
+ return I(e);
527
528
  }
528
- function M(o) {
529
+ function I(o) {
529
530
  return o == null ? "?" : typeof o == "string" ? `"${o}"` : o instanceof Date ? o.toISOString() : String(o);
530
531
  }
531
- function W(o, e, t) {
532
+ function re(o, e, t) {
532
533
  return o.find((r) => r.name === e)?.fields.find((r) => r.name === t);
533
534
  }
534
- const ke = 99999;
535
- class $e {
536
- constructor() {
537
- this._source = null, this._ghost = null, this._lastTarget = null, this._offsetX = 0, this._offsetY = 0;
538
- }
539
- isActive() {
540
- return this._source !== null;
541
- }
542
- source() {
543
- return this._source;
544
- }
545
- currentTarget() {
546
- return this._lastTarget;
547
- }
548
- start(e, t) {
549
- if (typeof document > "u") return;
550
- this._source = e;
551
- const r = e.rowElement.getBoundingClientRect();
552
- this._offsetX = t.clientX - r.left, this._offsetY = t.clientY - r.top;
553
- const n = e.rowElement.cloneNode(!0);
554
- n.style.position = "fixed", n.style.top = `${r.top}px`, n.style.left = `${r.left}px`, n.style.width = `${r.width}px`, n.style.pointerEvents = "none", n.style.zIndex = String(ke), n.style.opacity = "0.85", n.classList.add("qb-drag-ghost"), document.body.appendChild(n), this._ghost = n;
555
- }
556
- move(e) {
557
- if (!this._source || !this._ghost) return;
558
- this._ghost.style.top = `${e.clientY - this._offsetY}px`, this._ghost.style.left = `${e.clientX - this._offsetX}px`;
559
- const t = this.resolveDropTarget(e.clientX, e.clientY);
560
- this._lastTarget = t;
561
- }
562
- end(e) {
563
- const t = this._lastTarget;
564
- return this.cleanup(), t;
565
- }
566
- cancel() {
567
- this.cleanup();
568
- }
569
- cleanup() {
570
- this._ghost && typeof document < "u" && this._ghost.remove(), this._ghost = null, this._source = null, this._lastTarget = null, this._offsetX = 0, this._offsetY = 0;
571
- }
572
- /**
573
- * Walks `document.elementsFromPoint(x, y)` (composed path; cross-browser
574
- * supported in Chromium / Firefox / modern WebKit) and returns the first
575
- * `[data-drop-slot]` ancestor whose data-parent-id is NOT in the source's
576
- * descendant set.
577
- *
578
- * For older WebKit which doesn't implement `elementsFromPoint`, callers
579
- * can extend the resolver with a shadow-DOM walker (FR-38 fallback) —
580
- * not implemented here since we target evergreen browsers.
581
- */
582
- resolveDropTarget(e, t) {
583
- if (typeof document > "u") return null;
584
- const r = this._source;
585
- if (!r) return null;
586
- const n = document.elementsFromPoint;
587
- let s = [];
588
- if (typeof n == "function")
589
- s = n.call(document, e, t) ?? [];
590
- else {
591
- const i = document.elementFromPoint(e, t);
592
- i && (s = [i]);
593
- }
594
- const b = Ee(s, e, t);
595
- for (const i of b) {
596
- const a = i.closest("[data-drop-slot]");
597
- if (!a) continue;
598
- const l = a.dataset.parentId, c = a.dataset.index, h = a.dataset.qbRoot;
599
- if (!(!l || !c || !h) && !r.descendantIds.has(l))
600
- return { parentId: l, index: Number(c), qbRoot: h };
601
- }
602
- return null;
603
- }
604
- }
605
- function Ee(o, e, t) {
606
- const r = [...o], n = /* @__PURE__ */ new Set();
607
- for (const s of o) {
608
- const b = s.shadowRoot;
609
- if (!b || n.has(b)) continue;
610
- n.add(b);
611
- const i = b.elementFromPoint(e, t);
612
- i && r.push(i);
613
- }
614
- return r;
615
- }
616
- const F = A(
617
- Symbol("mp-query-builder.editorRegistry")
618
- ), C = A(
619
- Symbol("mp-query-builder.disabled")
620
- ), q = A(
621
- Symbol("mp-query-builder.messages")
622
- ), B = A(
623
- Symbol("mp-query-builder.maxDepth")
624
- );
625
- function D(o, e, t, r, n = {}) {
626
- const s = document.createElement("input");
627
- s.type = o, s.className = "form-control form-control-sm qb-editor-input", s.value = e, r && (s.disabled = !0);
628
- for (const [i, a] of Object.entries(n))
629
- a !== void 0 && s.setAttribute(i, a);
630
- const b = () => t(s.value);
631
- return s.addEventListener("input", b), s.addEventListener("change", b), s;
632
- }
633
- function J(o, e) {
634
- return o == null ? "" : e === "date" && o instanceof Date ? o.toISOString().slice(0, 10) : e === "datetime" && o instanceof Date ? o.toISOString().slice(0, 16) : typeof o == "string" && (e === "date" || e === "datetime") ? e === "date" ? o.slice(0, 10) : o.slice(0, 16) : String(o);
635
- }
636
- function Z(o, e) {
637
- if (o === "") return null;
638
- switch (e) {
639
- case "number":
640
- return Number(o);
641
- case "integer":
642
- return Number.parseInt(o, 10);
643
- case "date":
644
- case "datetime":
645
- return o;
646
- // Keep as ISO string; backend parses.
647
- default:
648
- return o;
649
- }
650
- }
651
- function w(o) {
652
- return (e) => {
653
- const t = o === "string" ? "text" : o === "date" ? "date" : o === "datetime" ? "datetime-local" : "number", r = {};
654
- o === "integer" && (r.step = "1"), o === "number" && (r.step = "any");
655
- const n = J(e.value, o), s = D(
656
- t,
657
- n,
658
- (b) => e.onChange(Z(b, o)),
659
- e.disabled,
660
- r
661
- );
662
- return s.setAttribute("aria-label", e.field.label), { element: s };
663
- };
664
- }
665
- function U(o) {
666
- return (e) => {
667
- const t = document.createElement("span");
668
- t.className = "qb-editor-tuple";
669
- const [r, n] = Array.isArray(e.value) ? [e.value[0] ?? null, e.value[1] ?? null] : [null, null], s = (f, z) => {
670
- const O = Array.isArray(e.value) ? [e.value[0] ?? null, e.value[1] ?? null] : [null, null];
671
- O[f] = Z(z, o), e.onChange(O);
672
- }, b = (f) => J(f, o), i = o === "date" ? "date" : o === "datetime" ? "datetime-local" : "number", a = {};
673
- o === "integer" && (a.step = "1"), o === "number" && (a.step = "any");
674
- const l = D(i, b(r), (f) => s(0, f), e.disabled, a), c = D(i, b(n), (f) => s(1, f), e.disabled, a);
675
- l.setAttribute("aria-label", `${e.field.label} (from)`), c.setAttribute("aria-label", `${e.field.label} (to)`);
676
- const h = document.createElement("span");
677
- return h.textContent = " … ", h.className = "qb-editor-tuple-sep", t.append(l, h, c), { element: t };
678
- };
679
- }
680
- function Ce() {
681
- return (o) => {
682
- const e = typeof o.value == "object" && o.value !== null ? String(o.value.n ?? 1) : "1", t = D(
683
- "number",
684
- e,
685
- (r) => {
686
- const n = Math.max(1, Number.parseInt(r, 10) || 1);
687
- o.onChange({ n });
688
- },
689
- o.disabled,
690
- { min: "1", step: "1" }
691
- );
692
- return t.classList.add("qb-editor-n-input"), t.setAttribute("aria-label", `${o.field.label} — number of days`), { element: t };
693
- };
694
- }
695
- function De(o) {
696
- return (e) => {
697
- const t = document.createElement("select");
698
- t.className = "form-select form-select-sm qb-editor-select", t.setAttribute("aria-label", e.field.label), e.disabled && (t.disabled = !0);
699
- const r = document.createElement("option");
700
- r.value = "", r.textContent = "—", t.appendChild(r);
701
- for (const n of o) {
702
- const s = document.createElement("option");
703
- s.value = String(n.value), s.textContent = n.label, e.value === n.value && (s.selected = !0), t.appendChild(s);
704
- }
705
- return t.addEventListener("change", () => {
706
- if (t.value === "") {
707
- e.onChange(null);
708
- return;
709
- }
710
- const n = o.find((s) => String(s.value) === t.value);
711
- e.onChange(n?.value ?? t.value);
712
- }), { element: t };
713
- };
714
- }
715
- function Se(o) {
716
- return (e) => {
717
- const t = document.createElement("select");
718
- t.className = "form-select form-select-sm qb-editor-multiselect", t.multiple = !0, t.setAttribute("aria-label", e.field.label), e.disabled && (t.disabled = !0);
719
- const r = Array.isArray(e.value) ? e.value : [];
720
- for (const n of o) {
721
- const s = document.createElement("option");
722
- s.value = String(n.value), s.textContent = n.label, r.includes(n.value) && (s.selected = !0), t.appendChild(s);
723
- }
724
- return t.addEventListener("change", () => {
725
- const n = Array.from(t.selectedOptions).map((s) => o.find((i) => String(i.value) === s.value)?.value ?? s.value);
726
- e.onChange(n);
727
- }), { element: t };
728
- };
729
- }
730
- function G(o) {
731
- return (e) => {
732
- const t = document.createElement("span");
733
- return t.className = "qb-editor-chip-input", (() => {
734
- t.innerHTML = "";
735
- const n = Array.isArray(e.value) ? e.value : [];
736
- for (let b = 0; b < n.length; b++) {
737
- const i = n[b], a = document.createElement("span");
738
- a.className = "qb-editor-chip", a.textContent = String(i);
739
- const l = document.createElement("button");
740
- l.type = "button", l.className = "qb-editor-chip-remove", l.setAttribute("aria-label", `Remove ${String(i)}`), l.textContent = "×", e.disabled && (l.disabled = !0), l.addEventListener("click", () => {
741
- const c = (Array.isArray(e.value) ? e.value : []).filter((h, f) => f !== b);
742
- e.onChange(c);
743
- }), a.appendChild(l), t.appendChild(a);
744
- }
745
- const s = document.createElement("input");
746
- s.type = "text", s.className = "form-control form-control-sm qb-editor-chip-add", s.placeholder = "+ add", s.size = 8, s.setAttribute("aria-label", `${e.field.label} — add value`), e.disabled && (s.disabled = !0), s.addEventListener("keydown", (b) => {
747
- if (b.key === "Enter" && s.value.trim() !== "") {
748
- b.preventDefault();
749
- const i = o(s.value.trim()), a = [...Array.isArray(e.value) ? e.value : [], i];
750
- s.value = "", e.onChange(a);
751
- }
752
- }), t.appendChild(s);
753
- })(), {
754
- element: t,
755
- dispose: () => {
756
- }
757
- };
758
- };
759
- }
760
- function Re(o, e) {
761
- const t = g(e);
762
- if (t === "null") return null;
763
- if (t === "n-input") return Ce();
764
- if (t === "tuple") {
765
- const r = o.type;
766
- return U(r === "number" || r === "integer" || r === "date" || r === "datetime" ? r : "number");
767
- }
768
- return t === "array" ? o.options && o.options.length > 0 ? Se(o.options) : o.type === "number" || o.type === "integer" ? G(
769
- (r) => o.type === "integer" ? Number.parseInt(r, 10) : Number(r)
770
- ) : G((r) => r) : o.type === "enum" && o.options && o.options.length > 0 ? De(o.options) : o.type === "string" ? w("string") : o.type === "number" ? w("number") : o.type === "integer" ? w("integer") : o.type === "date" ? w("date") : o.type === "datetime" ? w("datetime") : null;
771
- }
772
- d`<!-- Rendered dynamically by render(). Codegen-wc emits styles from the
773
- sibling .scss; the template export is intentionally unused. -->`;
774
- const Ae = S(`.btn {
775
- --bs-btn-padding-x: 0.75rem;
776
- --bs-btn-padding-y: 0.375rem;
777
- --bs-btn-font-family: ;
778
- --bs-btn-font-size: 1rem;
779
- --bs-btn-font-weight: 400;
780
- --bs-btn-line-height: 1.5;
781
- --bs-btn-color: var(--bs-body-color);
782
- --bs-btn-bg: transparent;
783
- --bs-btn-border-width: var(--bs-border-width);
784
- --bs-btn-border-color: transparent;
785
- --bs-btn-border-radius: var(--bs-border-radius);
786
- --bs-btn-hover-border-color: transparent;
787
- --bs-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
788
- --bs-btn-disabled-opacity: 0.65;
789
- --bs-btn-focus-box-shadow: 0 0 0 0.25rem rgba(var(--bs-btn-focus-shadow-rgb), .5);
790
- display: inline-block;
791
- padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
792
- font-family: var(--bs-btn-font-family);
793
- font-size: var(--bs-btn-font-size);
794
- font-weight: var(--bs-btn-font-weight);
795
- line-height: var(--bs-btn-line-height);
796
- color: var(--bs-btn-color);
797
- text-align: center;
798
- text-decoration: none;
799
- vertical-align: middle;
800
- cursor: pointer;
801
- user-select: none;
802
- border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);
803
- border-radius: var(--bs-btn-border-radius);
804
- background-color: var(--bs-btn-bg);
805
- transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
806
- }
807
- @media (prefers-reduced-motion: reduce) {
808
- .btn {
809
- transition: none;
810
- }
811
- }
812
- .btn:hover {
813
- color: var(--bs-btn-hover-color);
814
- background-color: var(--bs-btn-hover-bg);
815
- border-color: var(--bs-btn-hover-border-color);
816
- }
817
- .btn-check + .btn:hover {
818
- color: var(--bs-btn-color);
819
- background-color: var(--bs-btn-bg);
820
- border-color: var(--bs-btn-border-color);
821
- }
822
- .btn:focus-visible {
823
- color: var(--bs-btn-hover-color);
824
- background-color: var(--bs-btn-hover-bg);
825
- border-color: var(--bs-btn-hover-border-color);
826
- outline: 0;
827
- box-shadow: var(--bs-btn-focus-box-shadow);
828
- }
829
- .btn-check:focus-visible + .btn {
830
- border-color: var(--bs-btn-hover-border-color);
831
- outline: 0;
832
- box-shadow: var(--bs-btn-focus-box-shadow);
833
- }
834
- .btn-check:checked + .btn, :not(.btn-check) + .btn:active, .btn:first-child:active, .btn.active, .btn.show {
835
- color: var(--bs-btn-active-color);
836
- background-color: var(--bs-btn-active-bg);
837
- border-color: var(--bs-btn-active-border-color);
838
- }
839
- .btn-check:checked + .btn:focus-visible, :not(.btn-check) + .btn:active:focus-visible, .btn:first-child:active:focus-visible, .btn.active:focus-visible, .btn.show:focus-visible {
840
- box-shadow: var(--bs-btn-focus-box-shadow);
841
- }
842
- .btn-check:checked:focus-visible + .btn {
843
- box-shadow: var(--bs-btn-focus-box-shadow);
844
- }
845
- .btn:disabled, .btn.disabled, fieldset:disabled .btn {
846
- color: var(--bs-btn-disabled-color);
847
- pointer-events: none;
848
- background-color: var(--bs-btn-disabled-bg);
849
- border-color: var(--bs-btn-disabled-border-color);
850
- opacity: var(--bs-btn-disabled-opacity);
851
- }
852
-
853
- .btn-primary {
854
- --bs-btn-color: #fff;
855
- --bs-btn-bg: #0d6efd;
856
- --bs-btn-border-color: #0d6efd;
857
- --bs-btn-hover-color: #fff;
858
- --bs-btn-hover-bg: rgb(4.3333333333%, 36.6666666667%, 84.3333333333%);
859
- --bs-btn-hover-border-color: rgb(4.0784313725%, 34.5098039216%, 79.3725490196%);
860
- --bs-btn-focus-shadow-rgb: 49, 132, 253;
861
- --bs-btn-active-color: #fff;
862
- --bs-btn-active-bg: rgb(4.0784313725%, 34.5098039216%, 79.3725490196%);
863
- --bs-btn-active-border-color: rgb(3.8235294118%, 32.3529411765%, 74.4117647059%);
864
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
865
- --bs-btn-disabled-color: #fff;
866
- --bs-btn-disabled-bg: #0d6efd;
867
- --bs-btn-disabled-border-color: #0d6efd;
868
- }
869
-
870
- .btn-secondary {
871
- --bs-btn-color: #fff;
872
- --bs-btn-bg: #6c757d;
873
- --bs-btn-border-color: #6c757d;
874
- --bs-btn-hover-color: #fff;
875
- --bs-btn-hover-bg: rgb(36%, 39%, 41.6666666667%);
876
- --bs-btn-hover-border-color: rgb(33.8823529412%, 36.7058823529%, 39.2156862745%);
877
- --bs-btn-focus-shadow-rgb: 130, 138, 145;
878
- --bs-btn-active-color: #fff;
879
- --bs-btn-active-bg: rgb(33.8823529412%, 36.7058823529%, 39.2156862745%);
880
- --bs-btn-active-border-color: rgb(31.7647058824%, 34.4117647059%, 36.7647058824%);
881
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
882
- --bs-btn-disabled-color: #fff;
883
- --bs-btn-disabled-bg: #6c757d;
884
- --bs-btn-disabled-border-color: #6c757d;
885
- }
886
-
887
- .btn-success {
888
- --bs-btn-color: #fff;
889
- --bs-btn-bg: #198754;
890
- --bs-btn-border-color: #198754;
891
- --bs-btn-hover-color: #fff;
892
- --bs-btn-hover-bg: rgb(8.3333333333%, 45%, 28%);
893
- --bs-btn-hover-border-color: rgb(7.8431372549%, 42.3529411765%, 26.3529411765%);
894
- --bs-btn-focus-shadow-rgb: 60, 153, 110;
895
- --bs-btn-active-color: #fff;
896
- --bs-btn-active-bg: rgb(7.8431372549%, 42.3529411765%, 26.3529411765%);
897
- --bs-btn-active-border-color: rgb(7.3529411765%, 39.7058823529%, 24.7058823529%);
898
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
899
- --bs-btn-disabled-color: #fff;
900
- --bs-btn-disabled-bg: #198754;
901
- --bs-btn-disabled-border-color: #198754;
902
- }
903
-
904
- .btn-info {
905
- --bs-btn-color: #000;
906
- --bs-btn-bg: #0dcaf0;
907
- --bs-btn-border-color: #0dcaf0;
908
- --bs-btn-hover-color: #000;
909
- --bs-btn-hover-bg: rgb(19.3333333333%, 82.3333333333%, 95%);
910
- --bs-btn-hover-border-color: rgb(14.5882352941%, 81.2941176471%, 94.7058823529%);
911
- --bs-btn-focus-shadow-rgb: 11, 172, 204;
912
- --bs-btn-active-color: #000;
913
- --bs-btn-active-bg: rgb(24.0784313725%, 83.3725490196%, 95.2941176471%);
914
- --bs-btn-active-border-color: rgb(14.5882352941%, 81.2941176471%, 94.7058823529%);
915
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
916
- --bs-btn-disabled-color: #000;
917
- --bs-btn-disabled-bg: #0dcaf0;
918
- --bs-btn-disabled-border-color: #0dcaf0;
919
- }
920
-
921
- .btn-warning {
922
- --bs-btn-color: #000;
923
- --bs-btn-bg: #ffc107;
924
- --bs-btn-border-color: #ffc107;
925
- --bs-btn-hover-color: #000;
926
- --bs-btn-hover-bg: rgb(100%, 79.3333333333%, 17.3333333333%);
927
- --bs-btn-hover-border-color: rgb(100%, 78.1176470588%, 12.4705882353%);
928
- --bs-btn-focus-shadow-rgb: 217, 164, 6;
929
- --bs-btn-active-color: #000;
930
- --bs-btn-active-bg: rgb(100%, 80.5490196078%, 22.1960784314%);
931
- --bs-btn-active-border-color: rgb(100%, 78.1176470588%, 12.4705882353%);
932
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
933
- --bs-btn-disabled-color: #000;
934
- --bs-btn-disabled-bg: #ffc107;
935
- --bs-btn-disabled-border-color: #ffc107;
936
- }
937
-
938
- .btn-danger {
939
- --bs-btn-color: #fff;
940
- --bs-btn-bg: #dc3545;
941
- --bs-btn-border-color: #dc3545;
942
- --bs-btn-hover-color: #fff;
943
- --bs-btn-hover-bg: rgb(73.3333333333%, 17.6666666667%, 23%);
944
- --bs-btn-hover-border-color: rgb(69.0196078431%, 16.6274509804%, 21.6470588235%);
945
- --bs-btn-focus-shadow-rgb: 225, 83, 97;
946
- --bs-btn-active-color: #fff;
947
- --bs-btn-active-bg: rgb(69.0196078431%, 16.6274509804%, 21.6470588235%);
948
- --bs-btn-active-border-color: rgb(64.7058823529%, 15.5882352941%, 20.2941176471%);
949
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
950
- --bs-btn-disabled-color: #fff;
951
- --bs-btn-disabled-bg: #dc3545;
952
- --bs-btn-disabled-border-color: #dc3545;
953
- }
954
-
955
- .btn-light {
956
- --bs-btn-color: #000;
957
- --bs-btn-bg: #f8f9fa;
958
- --bs-btn-border-color: #f8f9fa;
959
- --bs-btn-hover-color: #000;
960
- --bs-btn-hover-bg: rgb(82.6666666667%, 83%, 83.3333333333%);
961
- --bs-btn-hover-border-color: rgb(77.8039215686%, 78.1176470588%, 78.431372549%);
962
- --bs-btn-focus-shadow-rgb: 211, 212, 213;
963
- --bs-btn-active-color: #000;
964
- --bs-btn-active-bg: rgb(77.8039215686%, 78.1176470588%, 78.431372549%);
965
- --bs-btn-active-border-color: rgb(72.9411764706%, 73.2352941176%, 73.5294117647%);
966
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
967
- --bs-btn-disabled-color: #000;
968
- --bs-btn-disabled-bg: #f8f9fa;
969
- --bs-btn-disabled-border-color: #f8f9fa;
970
- }
971
-
972
- .btn-dark {
973
- --bs-btn-color: #fff;
974
- --bs-btn-bg: #212529;
975
- --bs-btn-border-color: #212529;
976
- --bs-btn-hover-color: #fff;
977
- --bs-btn-hover-bg: rgb(26%, 27.3333333333%, 28.6666666667%);
978
- --bs-btn-hover-border-color: rgb(21.6470588235%, 23.0588235294%, 24.4705882353%);
979
- --bs-btn-focus-shadow-rgb: 66, 70, 73;
980
- --bs-btn-active-color: #fff;
981
- --bs-btn-active-bg: rgb(30.3529411765%, 31.6078431373%, 32.862745098%);
982
- --bs-btn-active-border-color: rgb(21.6470588235%, 23.0588235294%, 24.4705882353%);
983
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
984
- --bs-btn-disabled-color: #fff;
985
- --bs-btn-disabled-bg: #212529;
986
- --bs-btn-disabled-border-color: #212529;
987
- }
988
-
989
- .btn-outline-primary {
990
- --bs-btn-color: #0d6efd;
991
- --bs-btn-border-color: #0d6efd;
992
- --bs-btn-hover-color: #fff;
993
- --bs-btn-hover-bg: #0d6efd;
994
- --bs-btn-hover-border-color: #0d6efd;
995
- --bs-btn-focus-shadow-rgb: 13, 110, 253;
996
- --bs-btn-active-color: #fff;
997
- --bs-btn-active-bg: #0d6efd;
998
- --bs-btn-active-border-color: #0d6efd;
999
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1000
- --bs-btn-disabled-color: #0d6efd;
1001
- --bs-btn-disabled-bg: transparent;
1002
- --bs-btn-disabled-border-color: #0d6efd;
1003
- --bs-gradient: none;
1004
- }
1005
-
1006
- .btn-outline-secondary {
1007
- --bs-btn-color: #6c757d;
1008
- --bs-btn-border-color: #6c757d;
1009
- --bs-btn-hover-color: #fff;
1010
- --bs-btn-hover-bg: #6c757d;
1011
- --bs-btn-hover-border-color: #6c757d;
1012
- --bs-btn-focus-shadow-rgb: 108, 117, 125;
1013
- --bs-btn-active-color: #fff;
1014
- --bs-btn-active-bg: #6c757d;
1015
- --bs-btn-active-border-color: #6c757d;
1016
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1017
- --bs-btn-disabled-color: #6c757d;
1018
- --bs-btn-disabled-bg: transparent;
1019
- --bs-btn-disabled-border-color: #6c757d;
1020
- --bs-gradient: none;
1021
- }
1022
-
1023
- .btn-outline-success {
1024
- --bs-btn-color: #198754;
1025
- --bs-btn-border-color: #198754;
1026
- --bs-btn-hover-color: #fff;
1027
- --bs-btn-hover-bg: #198754;
1028
- --bs-btn-hover-border-color: #198754;
1029
- --bs-btn-focus-shadow-rgb: 25, 135, 84;
1030
- --bs-btn-active-color: #fff;
1031
- --bs-btn-active-bg: #198754;
1032
- --bs-btn-active-border-color: #198754;
1033
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1034
- --bs-btn-disabled-color: #198754;
1035
- --bs-btn-disabled-bg: transparent;
1036
- --bs-btn-disabled-border-color: #198754;
1037
- --bs-gradient: none;
1038
- }
1039
-
1040
- .btn-outline-info {
1041
- --bs-btn-color: #0dcaf0;
1042
- --bs-btn-border-color: #0dcaf0;
1043
- --bs-btn-hover-color: #000;
1044
- --bs-btn-hover-bg: #0dcaf0;
1045
- --bs-btn-hover-border-color: #0dcaf0;
1046
- --bs-btn-focus-shadow-rgb: 13, 202, 240;
1047
- --bs-btn-active-color: #000;
1048
- --bs-btn-active-bg: #0dcaf0;
1049
- --bs-btn-active-border-color: #0dcaf0;
1050
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1051
- --bs-btn-disabled-color: #0dcaf0;
1052
- --bs-btn-disabled-bg: transparent;
1053
- --bs-btn-disabled-border-color: #0dcaf0;
1054
- --bs-gradient: none;
1055
- }
1056
-
1057
- .btn-outline-warning {
1058
- --bs-btn-color: #ffc107;
1059
- --bs-btn-border-color: #ffc107;
1060
- --bs-btn-hover-color: #000;
1061
- --bs-btn-hover-bg: #ffc107;
1062
- --bs-btn-hover-border-color: #ffc107;
1063
- --bs-btn-focus-shadow-rgb: 255, 193, 7;
1064
- --bs-btn-active-color: #000;
1065
- --bs-btn-active-bg: #ffc107;
1066
- --bs-btn-active-border-color: #ffc107;
1067
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1068
- --bs-btn-disabled-color: #ffc107;
1069
- --bs-btn-disabled-bg: transparent;
1070
- --bs-btn-disabled-border-color: #ffc107;
1071
- --bs-gradient: none;
1072
- }
1073
-
1074
- .btn-outline-danger {
1075
- --bs-btn-color: #dc3545;
1076
- --bs-btn-border-color: #dc3545;
1077
- --bs-btn-hover-color: #fff;
1078
- --bs-btn-hover-bg: #dc3545;
1079
- --bs-btn-hover-border-color: #dc3545;
1080
- --bs-btn-focus-shadow-rgb: 220, 53, 69;
1081
- --bs-btn-active-color: #fff;
1082
- --bs-btn-active-bg: #dc3545;
1083
- --bs-btn-active-border-color: #dc3545;
1084
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1085
- --bs-btn-disabled-color: #dc3545;
1086
- --bs-btn-disabled-bg: transparent;
1087
- --bs-btn-disabled-border-color: #dc3545;
1088
- --bs-gradient: none;
1089
- }
1090
-
1091
- .btn-outline-light {
1092
- --bs-btn-color: #f8f9fa;
1093
- --bs-btn-border-color: #f8f9fa;
1094
- --bs-btn-hover-color: #000;
1095
- --bs-btn-hover-bg: #f8f9fa;
1096
- --bs-btn-hover-border-color: #f8f9fa;
1097
- --bs-btn-focus-shadow-rgb: 248, 249, 250;
1098
- --bs-btn-active-color: #000;
1099
- --bs-btn-active-bg: #f8f9fa;
1100
- --bs-btn-active-border-color: #f8f9fa;
1101
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1102
- --bs-btn-disabled-color: #f8f9fa;
1103
- --bs-btn-disabled-bg: transparent;
1104
- --bs-btn-disabled-border-color: #f8f9fa;
1105
- --bs-gradient: none;
1106
- }
1107
-
1108
- .btn-outline-dark {
1109
- --bs-btn-color: #212529;
1110
- --bs-btn-border-color: #212529;
1111
- --bs-btn-hover-color: #fff;
1112
- --bs-btn-hover-bg: #212529;
1113
- --bs-btn-hover-border-color: #212529;
1114
- --bs-btn-focus-shadow-rgb: 33, 37, 41;
1115
- --bs-btn-active-color: #fff;
1116
- --bs-btn-active-bg: #212529;
1117
- --bs-btn-active-border-color: #212529;
1118
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1119
- --bs-btn-disabled-color: #212529;
1120
- --bs-btn-disabled-bg: transparent;
1121
- --bs-btn-disabled-border-color: #212529;
1122
- --bs-gradient: none;
1123
- }
1124
-
1125
- .btn-link {
1126
- --bs-btn-font-weight: 400;
1127
- --bs-btn-color: var(--bs-link-color);
1128
- --bs-btn-bg: transparent;
1129
- --bs-btn-border-color: transparent;
1130
- --bs-btn-hover-color: var(--bs-link-hover-color);
1131
- --bs-btn-hover-border-color: transparent;
1132
- --bs-btn-active-color: var(--bs-link-hover-color);
1133
- --bs-btn-active-border-color: transparent;
1134
- --bs-btn-disabled-color: #6c757d;
1135
- --bs-btn-disabled-border-color: transparent;
1136
- --bs-btn-box-shadow: 0 0 0 #000;
1137
- --bs-btn-focus-shadow-rgb: 49, 132, 253;
1138
- text-decoration: underline;
1139
- }
1140
- .btn-link:focus-visible {
1141
- color: var(--bs-btn-color);
1142
- }
1143
- .btn-link:hover {
1144
- color: var(--bs-btn-hover-color);
1145
- }
1146
-
1147
- .btn-lg {
1148
- --bs-btn-padding-y: 0.5rem;
1149
- --bs-btn-padding-x: 1rem;
1150
- --bs-btn-font-size: 1.25rem;
1151
- --bs-btn-border-radius: var(--bs-border-radius-lg);
1152
- }
1153
-
1154
- .btn-sm {
1155
- --bs-btn-padding-y: 0.25rem;
1156
- --bs-btn-padding-x: 0.5rem;
1157
- --bs-btn-font-size: 0.875rem;
1158
- --bs-btn-border-radius: var(--bs-border-radius-sm);
1159
- }
1160
-
1161
- .form-control {
535
+ const Se = A(`.form-control[data-mps=query-builder] {
1162
536
  display: block;
1163
537
  width: 100%;
1164
538
  padding: 0.375rem 0.75rem;
@@ -1174,41 +548,41 @@ const Ae = S(`.btn {
1174
548
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
1175
549
  }
1176
550
  @media (prefers-reduced-motion: reduce) {
1177
- .form-control {
551
+ .form-control[data-mps=query-builder] {
1178
552
  transition: none;
1179
553
  }
1180
554
  }
1181
- .form-control[type=file] {
555
+ .form-control[type=file][data-mps=query-builder] {
1182
556
  overflow: hidden;
1183
557
  }
1184
- .form-control[type=file]:not(:disabled):not([readonly]) {
558
+ .form-control[type=file]:not(:disabled):not([readonly])[data-mps=query-builder] {
1185
559
  cursor: pointer;
1186
560
  }
1187
- .form-control:focus {
561
+ .form-control:focus[data-mps=query-builder] {
1188
562
  color: var(--bs-body-color);
1189
563
  background-color: var(--bs-body-bg);
1190
564
  border-color: rgb(52.5490196078%, 71.568627451%, 99.6078431373%);
1191
565
  outline: 0;
1192
566
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
1193
567
  }
1194
- .form-control::-webkit-date-and-time-value {
568
+ .form-control[data-mps=query-builder]::-webkit-date-and-time-value {
1195
569
  min-width: 85px;
1196
570
  height: 1.5em;
1197
571
  margin: 0;
1198
572
  }
1199
- .form-control::-webkit-datetime-edit {
573
+ .form-control[data-mps=query-builder]::-webkit-datetime-edit {
1200
574
  display: block;
1201
575
  padding: 0;
1202
576
  }
1203
- .form-control::placeholder {
577
+ .form-control[data-mps=query-builder]::placeholder {
1204
578
  color: var(--bs-secondary-color);
1205
579
  opacity: 1;
1206
580
  }
1207
- .form-control:disabled {
581
+ .form-control:disabled[data-mps=query-builder] {
1208
582
  background-color: var(--bs-secondary-bg);
1209
583
  opacity: 1;
1210
584
  }
1211
- .form-control::file-selector-button {
585
+ .form-control[data-mps=query-builder]::file-selector-button {
1212
586
  padding: 0.375rem 0.75rem;
1213
587
  margin: -0.375rem -0.75rem;
1214
588
  margin-inline-end: 0.75rem;
@@ -1223,15 +597,15 @@ const Ae = S(`.btn {
1223
597
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
1224
598
  }
1225
599
  @media (prefers-reduced-motion: reduce) {
1226
- .form-control::file-selector-button {
600
+ .form-control[data-mps=query-builder]::file-selector-button {
1227
601
  transition: none;
1228
602
  }
1229
603
  }
1230
- .form-control:hover:not(:disabled):not([readonly])::file-selector-button {
604
+ .form-control:hover:not(:disabled):not([readonly])[data-mps=query-builder]::file-selector-button {
1231
605
  background-color: var(--bs-secondary-bg);
1232
606
  }
1233
607
 
1234
- .form-control-plaintext {
608
+ .form-control-plaintext[data-mps=query-builder] {
1235
609
  display: block;
1236
610
  width: 100%;
1237
611
  padding: 0.375rem 0;
@@ -1242,1026 +616,603 @@ const Ae = S(`.btn {
1242
616
  border: solid transparent;
1243
617
  border-width: var(--bs-border-width) 0;
1244
618
  }
1245
- .form-control-plaintext:focus {
619
+ .form-control-plaintext:focus[data-mps=query-builder] {
1246
620
  outline: 0;
1247
621
  }
1248
- .form-control-plaintext.form-control-sm, .form-control-plaintext.form-control-lg {
622
+ .form-control-plaintext.form-control-sm[data-mps=query-builder], .form-control-plaintext.form-control-lg[data-mps=query-builder] {
1249
623
  padding-right: 0;
1250
624
  padding-left: 0;
1251
625
  }
1252
626
 
1253
- .form-control-sm {
627
+ .form-control-sm[data-mps=query-builder] {
1254
628
  min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
1255
629
  padding: 0.25rem 0.5rem;
1256
630
  font-size: 0.875rem;
1257
631
  border-radius: var(--bs-border-radius-sm);
1258
632
  }
1259
- .form-control-sm::file-selector-button {
633
+ .form-control-sm[data-mps=query-builder]::file-selector-button {
1260
634
  padding: 0.25rem 0.5rem;
1261
635
  margin: -0.25rem -0.5rem;
1262
636
  margin-inline-end: 0.5rem;
1263
637
  }
1264
638
 
1265
- .form-control-lg {
639
+ .form-control-lg[data-mps=query-builder] {
1266
640
  min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
1267
641
  padding: 0.5rem 1rem;
1268
642
  font-size: 1.25rem;
1269
643
  border-radius: var(--bs-border-radius-lg);
1270
644
  }
1271
- .form-control-lg::file-selector-button {
645
+ .form-control-lg[data-mps=query-builder]::file-selector-button {
1272
646
  padding: 0.5rem 1rem;
1273
647
  margin: -0.5rem -1rem;
1274
648
  margin-inline-end: 1rem;
1275
649
  }
1276
650
 
1277
- textarea.form-control {
651
+ textarea.form-control[data-mps=query-builder] {
1278
652
  min-height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
1279
653
  }
1280
- textarea.form-control-sm {
654
+ textarea.form-control-sm[data-mps=query-builder] {
1281
655
  min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
1282
656
  }
1283
- textarea.form-control-lg {
657
+ textarea.form-control-lg[data-mps=query-builder] {
1284
658
  min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
1285
659
  }
1286
660
 
1287
- .form-control-color {
661
+ .form-control-color[data-mps=query-builder] {
1288
662
  width: 3rem;
1289
663
  height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
1290
664
  padding: 0.375rem;
1291
665
  }
1292
- .form-control-color:not(:disabled):not([readonly]) {
666
+ .form-control-color:not(:disabled):not([readonly])[data-mps=query-builder] {
1293
667
  cursor: pointer;
1294
668
  }
1295
- .form-control-color::-moz-color-swatch {
669
+ .form-control-color[data-mps=query-builder]::-moz-color-swatch {
1296
670
  border: 0 !important;
1297
671
  border-radius: var(--bs-border-radius);
1298
672
  }
1299
- .form-control-color::-webkit-color-swatch {
673
+ .form-control-color[data-mps=query-builder]::-webkit-color-swatch {
1300
674
  border: 0 !important;
1301
675
  border-radius: var(--bs-border-radius);
1302
676
  }
1303
- .form-control-color.form-control-sm {
677
+ .form-control-color.form-control-sm[data-mps=query-builder] {
1304
678
  height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
1305
679
  }
1306
- .form-control-color.form-control-lg {
680
+ .form-control-color.form-control-lg[data-mps=query-builder] {
1307
681
  height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
1308
682
  }
1309
683
 
1310
- .form-select {
1311
- --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
684
+ mp-query-builder {
1312
685
  display: block;
1313
- width: 100%;
1314
- padding: 0.375rem 2.25rem 0.375rem 0.75rem;
1315
- font-size: 1rem;
1316
- font-weight: 400;
1317
- line-height: 1.5;
1318
- color: var(--bs-body-color);
1319
- appearance: none;
1320
- background-color: var(--bs-body-bg);
1321
- background-image: var(--bs-form-select-bg-img), var(--bs-form-select-bg-icon, none);
1322
- background-repeat: no-repeat;
1323
- background-position: right 0.75rem center;
1324
- background-size: 16px 12px;
1325
- border: var(--bs-border-width) solid var(--bs-border-color);
1326
- border-radius: var(--bs-border-radius);
1327
- transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
1328
- }
1329
- @media (prefers-reduced-motion: reduce) {
1330
- .form-select {
1331
- transition: none;
1332
- }
1333
- }
1334
- .form-select:focus {
1335
- border-color: rgb(52.5490196078%, 71.568627451%, 99.6078431373%);
1336
- outline: 0;
1337
- box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
1338
- }
1339
- .form-select[multiple], .form-select[size]:not([size="1"]) {
1340
- padding-right: 0.75rem;
1341
- background-image: none;
1342
- }
1343
- .form-select:disabled {
1344
- background-color: var(--bs-secondary-bg);
1345
- }
1346
- .form-select:-moz-focusring {
1347
- color: transparent;
1348
- text-shadow: 0 0 0 var(--bs-body-color);
686
+ font-family: var(--bs-body-font-family, system-ui);
687
+ font-size: var(--bs-body-font-size, 1rem);
688
+ color: var(--bs-body-color, currentColor);
1349
689
  }
1350
690
 
1351
- .form-select-sm {
1352
- padding-top: 0.25rem;
1353
- padding-bottom: 0.25rem;
1354
- padding-left: 0.5rem;
1355
- font-size: 0.875rem;
1356
- border-radius: var(--bs-border-radius-sm);
691
+ .qb-root[data-mps=query-builder] {
692
+ border: 1px solid var(--bs-border-color, #dee2e6);
693
+ border-radius: var(--bs-border-radius, 0.375rem);
694
+ padding: 0.5rem;
695
+ background: var(--bs-body-bg, transparent);
1357
696
  }
1358
697
 
1359
- .form-select-lg {
1360
- padding-top: 0.5rem;
1361
- padding-bottom: 0.5rem;
1362
- padding-left: 1rem;
1363
- font-size: 1.25rem;
1364
- border-radius: var(--bs-border-radius-lg);
698
+ .qb-toolbar[data-mps=query-builder] {
699
+ display: flex;
700
+ flex-wrap: wrap;
701
+ gap: 0.75rem;
702
+ align-items: center;
703
+ margin-bottom: 0.5rem;
704
+ padding: 0.5rem;
705
+ background: var(--bs-tertiary-bg, #f8f9fa);
706
+ border: 1px solid var(--bs-border-color, #dee2e6);
707
+ border-radius: var(--bs-border-radius-sm, 0.25rem);
1365
708
  }
1366
709
 
1367
- [data-bs-theme=dark] .form-select {
1368
- --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
710
+ .qb-toolbar-label[data-mps=query-builder] {
711
+ display: inline-flex;
712
+ align-items: center;
713
+ gap: 0.375rem;
714
+ font-size: 0.875rem;
715
+ font-weight: 500;
716
+ margin: 0;
1369
717
  }
1370
718
 
1371
- :host {
1372
- display: block;
719
+ .qb-entity-picker[data-mps=query-builder] {
720
+ width: auto;
721
+ min-width: 8rem;
1373
722
  }
1374
723
 
1375
- .qb-condition {
1376
- display: flex;
1377
- align-items: center;
1378
- gap: 0.5rem;
1379
- padding: 0.25rem 0;
1380
- font-size: 0.875rem;
724
+ .qb-toolbar-section[data-mps=query-builder] {
725
+ display: inline-flex;
1381
726
  flex-wrap: wrap;
727
+ gap: 0.5rem;
728
+ align-items: center;
1382
729
  }
1383
730
 
1384
- .qb-field-select,
1385
- .qb-operator-select {
1386
- display: inline-block;
1387
- width: auto;
1388
- min-width: 8rem;
1389
- }
1390
-
1391
- .qb-remove {
1392
- flex: 0 0 auto;
1393
- margin-left: auto;
1394
- padding: 0 0.5rem;
1395
- line-height: 1;
1396
- font-size: 1rem;
1397
- color: var(--bs-danger, #dc3545);
1398
- }
1399
-
1400
- .qb-drag-handle {
1401
- flex: 0 0 auto;
731
+ .qb-field-checkbox[data-mps=query-builder] {
1402
732
  display: inline-flex;
1403
733
  align-items: center;
1404
- justify-content: center;
1405
- width: 1rem;
1406
- height: 1.25rem;
1407
- padding: 0;
1408
- background: transparent;
1409
- border: 0;
1410
- color: var(--bs-secondary-color, #6c757d);
1411
- cursor: grab;
1412
- font-size: 1rem;
1413
- line-height: 1;
1414
- touch-action: none;
734
+ gap: 0.25rem;
735
+ font-size: 0.875rem;
736
+ font-weight: 400;
737
+ margin: 0;
738
+ cursor: pointer;
1415
739
  }
1416
-
1417
- .qb-drag-handle:active {
1418
- cursor: grabbing;
740
+ .qb-field-checkbox[data-mps=query-builder] input[type=checkbox][data-mps=query-builder] {
741
+ margin: 0;
1419
742
  }
1420
743
 
1421
- .qb-drag-handle:disabled {
1422
- cursor: not-allowed;
1423
- opacity: 0.5;
744
+ .qb-sort-row[data-mps=query-builder] {
745
+ display: inline-flex;
746
+ align-items: center;
747
+ gap: 0.25rem;
748
+ font-size: 0.875rem;
1424
749
  }
1425
-
1426
- .qb-field {
1427
- font-weight: 600;
1428
- color: var(--bs-body-color, currentColor);
750
+ .qb-sort-row[data-mps=query-builder] .qb-sort-field[data-mps=query-builder],
751
+ .qb-sort-row[data-mps=query-builder] .qb-sort-direction[data-mps=query-builder] {
752
+ width: auto;
1429
753
  }
1430
-
1431
- .qb-operator {
1432
- color: var(--bs-secondary-color, #6c757d);
754
+ .qb-sort-row[data-mps=query-builder] .qb-sort-field[data-mps=query-builder] {
755
+ min-width: 6rem;
1433
756
  }
1434
-
1435
- .qb-value {
1436
- color: var(--bs-primary-text-emphasis, #084298);
757
+ .qb-sort-row[data-mps=query-builder] .qb-sort-direction[data-mps=query-builder] {
758
+ min-width: 4.5rem;
1437
759
  }
1438
-
1439
- .qb-value-list {
1440
- display: inline-flex;
1441
- gap: 0.25rem;
760
+ .qb-sort-row[data-mps=query-builder] .qb-sort-remove[data-mps=query-builder] {
761
+ padding: 0 0.375rem;
762
+ line-height: 1;
763
+ color: var(--bs-danger, #dc3545);
1442
764
  }
1443
765
 
1444
- .qb-value-pill {
1445
- display: inline-block;
1446
- padding: 0 0.375rem;
1447
- background: var(--bs-info-bg-subtle, #cff4fc);
1448
- color: var(--bs-info-text-emphasis, #055160);
1449
- border-radius: var(--bs-border-radius-sm, 0.25rem);
766
+ .qb-sort-add[data-mps=query-builder] {
767
+ --bs-btn-color: #646b72;
1450
768
  }
1451
769
 
1452
- .qb-missing {
1453
- color: var(--bs-danger-text-emphasis, #842029);
770
+ .qb-too-deep[data-mps=query-builder] {
771
+ padding: 0.5rem;
772
+ color: var(--bs-warning-text-emphasis, #997404);
773
+ background: var(--bs-warning-bg-subtle, #fff3cd);
774
+ border: 1px solid var(--bs-warning-border-subtle, #ffe69c);
775
+ border-radius: var(--bs-border-radius, 0.375rem);
1454
776
  font-style: italic;
1455
777
  }
1456
778
 
1457
- .qb-editor-input {
1458
- display: inline-block;
1459
- width: auto;
1460
- min-width: 6rem;
1461
- vertical-align: middle;
779
+ .qb-saved[data-mps=query-builder] {
780
+ display: flex;
781
+ flex-wrap: wrap;
782
+ gap: 0.5rem;
783
+ align-items: center;
784
+ margin-bottom: 0.5rem;
785
+ padding: 0.5rem;
786
+ background: var(--bs-tertiary-bg, #f8f9fa);
787
+ border: 1px solid var(--bs-border-color, #dee2e6);
788
+ border-radius: var(--bs-border-radius-sm, 0.25rem);
1462
789
  }
1463
790
 
1464
- .qb-editor-n-input {
1465
- min-width: 4rem;
1466
- max-width: 6rem;
791
+ .qb-saved-list[data-mps=query-builder] {
792
+ display: flex;
793
+ flex-wrap: wrap;
794
+ gap: 0.5rem;
1467
795
  }
1468
796
 
1469
- .qb-editor-select,
1470
- .qb-editor-multiselect {
1471
- display: inline-block;
1472
- width: auto;
1473
- min-width: 8rem;
1474
- vertical-align: middle;
797
+ .qb-saved-row[data-mps=query-builder] {
798
+ display: inline-flex;
799
+ align-items: center;
800
+ gap: 0.125rem;
1475
801
  }
1476
802
 
1477
- .qb-editor-tuple {
803
+ .qb-saved-new[data-mps=query-builder] {
1478
804
  display: inline-flex;
1479
805
  align-items: center;
1480
806
  gap: 0.25rem;
807
+ margin-left: auto;
1481
808
  }
1482
809
 
1483
- .qb-editor-tuple-sep {
810
+ .qb-saved-empty[data-mps=query-builder] {
1484
811
  color: var(--bs-secondary-color, #6c757d);
812
+ font-style: italic;
1485
813
  font-size: 0.875rem;
1486
814
  }
1487
815
 
1488
- .qb-editor-chip-input {
1489
- display: inline-flex;
1490
- flex-wrap: wrap;
1491
- align-items: center;
1492
- gap: 0.25rem;
1493
- padding: 0.125rem;
816
+ .qb-preview[data-mps=query-builder] {
817
+ margin: 0 0 0.5rem;
818
+ padding: 0.5rem;
819
+ background: var(--bs-secondary-bg, #f8f9fa);
1494
820
  border: 1px solid var(--bs-border-color, #dee2e6);
1495
821
  border-radius: var(--bs-border-radius-sm, 0.25rem);
1496
- background: var(--bs-body-bg, transparent);
1497
- min-height: 1.75rem;
822
+ font-family: var(--bs-font-monospace, monospace);
823
+ font-size: 0.8125rem;
824
+ color: var(--bs-body-color, currentColor);
825
+ white-space: pre-wrap;
826
+ word-break: break-word;
827
+ }`), Re = A(`.form-control[data-mps=query-condition] {
828
+ display: block;
829
+ width: 100%;
830
+ padding: 0.375rem 0.75rem;
831
+ font-size: 1rem;
832
+ font-weight: 400;
833
+ line-height: 1.5;
834
+ color: var(--bs-body-color);
835
+ appearance: none;
836
+ background-color: var(--bs-body-bg);
837
+ background-clip: padding-box;
838
+ border: var(--bs-border-width) solid var(--bs-border-color);
839
+ border-radius: var(--bs-border-radius);
840
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
841
+ }
842
+ @media (prefers-reduced-motion: reduce) {
843
+ .form-control[data-mps=query-condition] {
844
+ transition: none;
845
+ }
846
+ }
847
+ .form-control[type=file][data-mps=query-condition] {
848
+ overflow: hidden;
849
+ }
850
+ .form-control[type=file]:not(:disabled):not([readonly])[data-mps=query-condition] {
851
+ cursor: pointer;
852
+ }
853
+ .form-control:focus[data-mps=query-condition] {
854
+ color: var(--bs-body-color);
855
+ background-color: var(--bs-body-bg);
856
+ border-color: rgb(52.5490196078%, 71.568627451%, 99.6078431373%);
857
+ outline: 0;
858
+ box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
859
+ }
860
+ .form-control[data-mps=query-condition]::-webkit-date-and-time-value {
861
+ min-width: 85px;
862
+ height: 1.5em;
863
+ margin: 0;
864
+ }
865
+ .form-control[data-mps=query-condition]::-webkit-datetime-edit {
866
+ display: block;
867
+ padding: 0;
868
+ }
869
+ .form-control[data-mps=query-condition]::placeholder {
870
+ color: var(--bs-secondary-color);
871
+ opacity: 1;
872
+ }
873
+ .form-control:disabled[data-mps=query-condition] {
874
+ background-color: var(--bs-secondary-bg);
875
+ opacity: 1;
876
+ }
877
+ .form-control[data-mps=query-condition]::file-selector-button {
878
+ padding: 0.375rem 0.75rem;
879
+ margin: -0.375rem -0.75rem;
880
+ margin-inline-end: 0.75rem;
881
+ color: var(--bs-body-color);
882
+ background-color: var(--bs-tertiary-bg);
883
+ pointer-events: none;
884
+ border-color: inherit;
885
+ border-style: solid;
886
+ border-width: 0;
887
+ border-inline-end-width: var(--bs-border-width);
888
+ border-radius: 0;
889
+ transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
890
+ }
891
+ @media (prefers-reduced-motion: reduce) {
892
+ .form-control[data-mps=query-condition]::file-selector-button {
893
+ transition: none;
894
+ }
895
+ }
896
+ .form-control:hover:not(:disabled):not([readonly])[data-mps=query-condition]::file-selector-button {
897
+ background-color: var(--bs-secondary-bg);
1498
898
  }
1499
899
 
1500
- .qb-editor-chip {
1501
- display: inline-flex;
1502
- align-items: center;
1503
- gap: 0.25rem;
1504
- padding: 0 0.375rem;
1505
- background: var(--bs-info-bg-subtle, #cff4fc);
1506
- color: var(--bs-info-text-emphasis, #055160);
1507
- border-radius: var(--bs-border-radius-sm, 0.25rem);
1508
- font-size: 0.75rem;
900
+ .form-control-plaintext[data-mps=query-condition] {
901
+ display: block;
902
+ width: 100%;
903
+ padding: 0.375rem 0;
904
+ margin-bottom: 0;
905
+ line-height: 1.5;
906
+ color: var(--bs-body-color);
907
+ background-color: transparent;
908
+ border: solid transparent;
909
+ border-width: var(--bs-border-width) 0;
910
+ }
911
+ .form-control-plaintext:focus[data-mps=query-condition] {
912
+ outline: 0;
913
+ }
914
+ .form-control-plaintext.form-control-sm[data-mps=query-condition], .form-control-plaintext.form-control-lg[data-mps=query-condition] {
915
+ padding-right: 0;
916
+ padding-left: 0;
1509
917
  }
1510
918
 
1511
- .qb-editor-chip-remove {
1512
- background: transparent;
1513
- border: 0;
1514
- padding: 0 0.125rem;
1515
- color: inherit;
1516
- cursor: pointer;
1517
- line-height: 1;
919
+ .form-control-sm[data-mps=query-condition] {
920
+ min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
921
+ padding: 0.25rem 0.5rem;
1518
922
  font-size: 0.875rem;
923
+ border-radius: var(--bs-border-radius-sm);
924
+ }
925
+ .form-control-sm[data-mps=query-condition]::file-selector-button {
926
+ padding: 0.25rem 0.5rem;
927
+ margin: -0.25rem -0.5rem;
928
+ margin-inline-end: 0.5rem;
1519
929
  }
1520
930
 
1521
- .qb-editor-chip-remove:disabled {
1522
- cursor: not-allowed;
1523
- opacity: 0.5;
931
+ .form-control-lg[data-mps=query-condition] {
932
+ min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
933
+ padding: 0.5rem 1rem;
934
+ font-size: 1.25rem;
935
+ border-radius: var(--bs-border-radius-lg);
936
+ }
937
+ .form-control-lg[data-mps=query-condition]::file-selector-button {
938
+ padding: 0.5rem 1rem;
939
+ margin: -0.5rem -1rem;
940
+ margin-inline-end: 1rem;
1524
941
  }
1525
942
 
1526
- .qb-editor-chip-add {
1527
- display: inline-block;
1528
- width: auto;
1529
- border: 0;
1530
- padding: 0 0.25rem;
1531
- font-size: 0.875rem;
1532
- background: transparent;
1533
- min-width: 4rem;
943
+ textarea.form-control[data-mps=query-condition] {
944
+ min-height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
945
+ }
946
+ textarea.form-control-sm[data-mps=query-condition] {
947
+ min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
948
+ }
949
+ textarea.form-control-lg[data-mps=query-condition] {
950
+ min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
1534
951
  }
1535
952
 
1536
- .qb-editor-chip-add:focus {
1537
- outline: none;
1538
- box-shadow: none;
1539
- }`);
1540
- class ze extends R {
1541
- constructor() {
1542
- super(...arguments), this.node = null, this.schema = [], this.currentEntity = "", this._messagesConsumer = new p(this, {
1543
- context: q,
1544
- subscribe: !0
1545
- }), this._disabledConsumer = new p(this, {
1546
- context: C,
1547
- subscribe: !0
1548
- }), this._registryConsumer = new p(this, {
1549
- context: F,
1550
- subscribe: !0
1551
- }), this._editorMount = ee(), this._currentHandle = null, this._editorKey = "", this._registryTokens = /* @__PURE__ */ new WeakMap(), this._nextRegistryToken = 1, this._onFieldChange = (e) => {
1552
- const t = e.target, r = this.node;
1553
- r && this.dispatchEvent(new CustomEvent("condition-field-change", {
1554
- detail: { id: r.id, field: t.value },
1555
- bubbles: !0,
1556
- composed: !0
1557
- }));
1558
- }, this._onOperatorChange = (e) => {
1559
- const t = e.target, r = this.node;
1560
- r && this.dispatchEvent(new CustomEvent("condition-operator-change", {
1561
- detail: { id: r.id, operator: t.value },
1562
- bubbles: !0,
1563
- composed: !0
1564
- }));
1565
- }, this._onRemove = () => {
1566
- const e = this.node;
1567
- e && this.dispatchEvent(new CustomEvent("node-remove", {
1568
- detail: { id: e.id },
1569
- bubbles: !0,
1570
- composed: !0
1571
- }));
1572
- }, this._onRowKeyDown = (e) => {
1573
- if (!e.altKey || e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
1574
- const t = this.node;
1575
- if (!t || this.isDisabled()) return;
1576
- const r = this.shadowRoot?.querySelector(".qb-condition"), n = e.composedPath()[0], s = n instanceof HTMLElement && n.classList.contains("qb-drag-handle");
1577
- n !== r && !s || (e.preventDefault(), this.dispatchEvent(new CustomEvent("qb-keyboard-move", {
1578
- detail: { id: t.id, direction: e.key === "ArrowUp" ? "up" : "down" },
1579
- bubbles: !0,
1580
- composed: !0
1581
- })));
1582
- }, this._onDragPointerDown = (e) => {
1583
- if (this.isDisabled()) return;
1584
- const t = this.node;
1585
- if (!t) return;
1586
- const r = this.shadowRoot?.querySelector(".qb-condition");
1587
- r && this.dispatchEvent(new CustomEvent("qb-drag-start", {
1588
- detail: {
1589
- id: t.id,
1590
- pointerId: e.pointerId,
1591
- clientX: e.clientX,
1592
- clientY: e.clientY,
1593
- rowElement: r
1594
- },
1595
- bubbles: !0,
1596
- composed: !0
1597
- }));
1598
- };
1599
- }
1600
- static {
1601
- this.styles = [Ae];
1602
- }
1603
- static {
1604
- this.properties = {
1605
- node: { attribute: !1 },
1606
- schema: { attribute: !1 },
1607
- currentEntity: { attribute: !1 }
1608
- };
1609
- }
1610
- _registryIdentityToken(e) {
1611
- if (!e) return 0;
1612
- const t = this._registryTokens.get(e);
1613
- if (t !== void 0) return t;
1614
- const r = this._nextRegistryToken++;
1615
- return this._registryTokens.set(e, r), r;
1616
- }
1617
- disconnectedCallback() {
1618
- super.disconnectedCallback(), this._disposeEditor();
1619
- }
1620
- _disposeEditor() {
1621
- const e = this._currentHandle;
1622
- if (e) {
1623
- try {
1624
- e.dispose?.();
1625
- } catch {
1626
- }
1627
- e.element.remove(), this._currentHandle = null;
1628
- }
1629
- }
1630
- resolveField(e) {
1631
- return this.schema.find((t) => t.name === this.currentEntity)?.fields.find((t) => t.name === e);
1632
- }
1633
- messages() {
1634
- const e = this._messagesConsumer.value ?? {};
1635
- return {
1636
- ...m,
1637
- ...e,
1638
- operators: { ...m.operators, ...e.operators ?? {} }
1639
- };
1640
- }
1641
- isDisabled() {
1642
- return this._disabledConsumer.value ?? !1;
1643
- }
1644
- updated(e) {
1645
- this._refreshEditor();
1646
- }
1647
- _refreshEditor() {
1648
- const e = this._editorMount.value;
1649
- if (!e) return;
1650
- const t = this.node;
1651
- if (!t) {
1652
- this._disposeEditor();
1653
- return;
1654
- }
1655
- const r = this.resolveField(t.field);
1656
- if (!r) {
1657
- this._disposeEditor();
1658
- return;
1659
- }
1660
- if (g(t.operator) === "null") {
1661
- this._disposeEditor();
1662
- return;
1663
- }
1664
- const s = this.isDisabled(), b = this._registryConsumer.value, i = b?.[r.name], a = i ? `r${this._registryIdentityToken(b)}` : "b", l = `${r.name}|${t.operator}|${s ? "1" : "0"}|${a}`;
1665
- if (this._currentHandle && l === this._editorKey) return;
1666
- this._disposeEditor();
1667
- const c = i ?? Re(r, t.operator);
1668
- if (!c) return;
1669
- const h = {
1670
- field: r,
1671
- operator: t.operator,
1672
- value: t.value,
1673
- disabled: s,
1674
- onChange: (z) => {
1675
- this.dispatchEvent(new CustomEvent("condition-value-change", {
1676
- detail: { id: t.id, value: z },
1677
- bubbles: !0,
1678
- composed: !0
1679
- }));
1680
- }
1681
- }, f = c(h);
1682
- e.appendChild(f.element), this._currentHandle = f, this._editorKey = l;
1683
- }
1684
- _availableFields() {
1685
- return this.schema.find((e) => e.name === this.currentEntity)?.fields.filter((e) => e.type !== "relation") ?? [];
1686
- }
1687
- _availableOperators(e) {
1688
- return e ? y(e.type) : [];
1689
- }
1690
- render() {
1691
- const e = this.node;
1692
- if (!e) return u;
1693
- const t = this.resolveField(e.field), r = this.messages(), n = g(e.operator), s = this.isDisabled(), b = this._availableFields(), i = this._availableOperators(t);
1694
- return d`
1695
- <div
1696
- class="qb-condition"
1697
- part="condition"
1698
- tabindex="0"
1699
- role="group"
1700
- aria-label=${// The row is a tab stop (Alt+Up/Down reorder) — without a role and
1701
- // name a blind user lands on silence. The name tracks the row's
1702
- // current field + operator, re-derived every render (§11a).
1703
- `${t?.label ?? e.field} ${r.operators[e.operator] ?? e.operator}`}
1704
- data-row-id=${e.id}
1705
- @keydown=${this._onRowKeyDown}
1706
- >
1707
- <button
1708
- type="button"
1709
- class="qb-drag-handle"
1710
- part="drag-handle"
1711
- ?disabled=${s}
1712
- aria-label=${r.reorderHint}
1713
- title=${r.reorderHint}
1714
- @pointerdown=${this._onDragPointerDown}
1715
- >⋮</button>
1716
- <mp-select
1717
- class="qb-field-select"
1718
- size="sm"
1719
- part="field-select"
1720
- .value=${e.field}
1721
- ?disabled=${s}
1722
- @change=${this._onFieldChange}
1723
- aria-label=${r.field}
1724
- >
1725
- ${b.map((a) => d`<option value=${a.name}>${a.label}</option>`)}
1726
- ${t ? u : d`<option value=${e.field}>(${e.field})</option>`}
1727
- </mp-select>
1728
- <mp-select
1729
- class="qb-operator-select"
1730
- size="sm"
1731
- part="operator-select"
1732
- .value=${e.operator}
1733
- ?disabled=${s || !t}
1734
- @change=${this._onOperatorChange}
1735
- aria-label=${r.operator}
1736
- >
1737
- ${i.map((a) => d`
1738
- <option value=${a}>${r.operators[a] ?? a}</option>
1739
- `)}
1740
- ${i.includes(e.operator) ? u : d`<option value=${e.operator}>${e.operator}</option>`}
1741
- </mp-select>
1742
- ${n === "null" ? u : d`<span class="qb-value" part="value" ${te(this._editorMount)}></span>`}
1743
- <button
1744
- type="button"
1745
- class="btn btn-sm btn-link qb-remove"
1746
- part="remove"
1747
- ?disabled=${s}
1748
- @click=${this._onRemove}
1749
- aria-label=${r.removeRow}
1750
- title=${r.removeRow}
1751
- >×</button>
1752
- </div>
1753
- `;
1754
- }
953
+ .form-control-color[data-mps=query-condition] {
954
+ width: 3rem;
955
+ height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
956
+ padding: 0.375rem;
957
+ }
958
+ .form-control-color:not(:disabled):not([readonly])[data-mps=query-condition] {
959
+ cursor: pointer;
960
+ }
961
+ .form-control-color[data-mps=query-condition]::-moz-color-swatch {
962
+ border: 0 !important;
963
+ border-radius: var(--bs-border-radius);
964
+ }
965
+ .form-control-color[data-mps=query-condition]::-webkit-color-swatch {
966
+ border: 0 !important;
967
+ border-radius: var(--bs-border-radius);
968
+ }
969
+ .form-control-color.form-control-sm[data-mps=query-condition] {
970
+ height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
1755
971
  }
1756
- typeof customElements < "u" && !customElements.get("mp-query-condition") && customElements.define("mp-query-condition", ze);
1757
- d`<!-- Rendered dynamically by render(). Codegen-wc emits styles from the
1758
- sibling .scss; the template export is intentionally unused. -->`;
1759
- const Me = S(`:host {
972
+ .form-control-color.form-control-lg[data-mps=query-condition] {
973
+ height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
974
+ }
975
+
976
+ .form-select[data-mps=query-condition] {
977
+ --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
1760
978
  display: block;
1761
- margin: 0.25rem 0;
979
+ width: 100%;
980
+ padding: 0.375rem 2.25rem 0.375rem 0.75rem;
981
+ font-size: 1rem;
982
+ font-weight: 400;
983
+ line-height: 1.5;
984
+ color: var(--bs-body-color);
985
+ appearance: none;
986
+ background-color: var(--bs-body-bg);
987
+ background-image: var(--bs-form-select-bg-img), var(--bs-form-select-bg-icon, none);
988
+ background-repeat: no-repeat;
989
+ background-position: right 0.75rem center;
990
+ background-size: 16px 12px;
991
+ border: var(--bs-border-width) solid var(--bs-border-color);
992
+ border-radius: var(--bs-border-radius);
993
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
994
+ }
995
+ @media (prefers-reduced-motion: reduce) {
996
+ .form-select[data-mps=query-condition] {
997
+ transition: none;
998
+ }
999
+ }
1000
+ .form-select:focus[data-mps=query-condition] {
1001
+ border-color: rgb(52.5490196078%, 71.568627451%, 99.6078431373%);
1002
+ outline: 0;
1003
+ box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
1004
+ }
1005
+ .form-select[multiple][data-mps=query-condition], .form-select[size]:not([size="1"])[data-mps=query-condition] {
1006
+ padding-right: 0.75rem;
1007
+ background-image: none;
1008
+ }
1009
+ .form-select:disabled[data-mps=query-condition] {
1010
+ background-color: var(--bs-secondary-bg);
1011
+ }
1012
+ .form-select:-moz-focusring[data-mps=query-condition] {
1013
+ color: transparent;
1014
+ text-shadow: 0 0 0 var(--bs-body-color);
1762
1015
  }
1763
1016
 
1764
- .qb-subquery {
1765
- border: 1px dashed var(--bs-border-color, #dee2e6);
1766
- border-radius: var(--bs-border-radius, 0.375rem);
1767
- padding: 0.5rem;
1768
- background: var(--bs-tertiary-bg, #f8f9fa);
1017
+ .form-select-sm[data-mps=query-condition] {
1018
+ padding-top: 0.25rem;
1019
+ padding-bottom: 0.25rem;
1020
+ padding-left: 0.5rem;
1021
+ font-size: 0.875rem;
1022
+ border-radius: var(--bs-border-radius-sm);
1023
+ }
1024
+
1025
+ .form-select-lg[data-mps=query-condition] {
1026
+ padding-top: 0.5rem;
1027
+ padding-bottom: 0.5rem;
1028
+ padding-left: 1rem;
1029
+ font-size: 1.25rem;
1030
+ border-radius: var(--bs-border-radius-lg);
1769
1031
  }
1770
1032
 
1771
- .qb-subquery-header {
1033
+ [data-bs-theme=dark][data-mps=query-condition] .form-select[data-mps=query-condition] {
1034
+ --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
1035
+ }
1036
+
1037
+ mp-query-condition {
1038
+ display: block;
1039
+ }
1040
+
1041
+ .qb-condition[data-mps=query-condition] {
1772
1042
  display: flex;
1773
1043
  align-items: center;
1774
1044
  gap: 0.5rem;
1045
+ padding: 0.25rem 0;
1775
1046
  font-size: 0.875rem;
1776
- margin-bottom: 0.5rem;
1047
+ flex-wrap: wrap;
1777
1048
  }
1778
1049
 
1779
- .qb-subquery-field {
1780
- font-weight: 600;
1050
+ .qb-field-select[data-mps=query-condition],
1051
+ .qb-operator-select[data-mps=query-condition] {
1052
+ display: inline-block;
1053
+ width: auto;
1054
+ min-width: 8rem;
1781
1055
  }
1782
1056
 
1783
- .qb-subquery-operator {
1784
- color: var(--bs-secondary-color, #6c757d);
1785
- text-transform: lowercase;
1057
+ .qb-remove[data-mps=query-condition] {
1058
+ flex: 0 0 auto;
1059
+ margin-left: auto;
1060
+ padding: 0 0.5rem;
1061
+ line-height: 1;
1062
+ font-size: 1rem;
1063
+ color: var(--bs-danger, #dc3545);
1786
1064
  }
1787
1065
 
1788
- .qb-subquery-target {
1789
- font-style: italic;
1066
+ .qb-drag-handle[data-mps=query-condition] {
1067
+ flex: 0 0 auto;
1068
+ display: inline-flex;
1069
+ align-items: center;
1070
+ justify-content: center;
1071
+ width: 1rem;
1072
+ height: 1.25rem;
1073
+ padding: 0;
1074
+ background: transparent;
1075
+ border: 0;
1790
1076
  color: var(--bs-secondary-color, #6c757d);
1791
- }`);
1792
- class Te extends R {
1793
- constructor() {
1794
- super(...arguments), this.node = null, this.schema = [], this.currentEntity = "", this.depth = 0, this.qbRoot = "", this.isDragging = !1, this._messagesConsumer = new p(this, {
1795
- context: q,
1796
- subscribe: !0
1797
- }), this._onHeaderKeyDown = (e) => {
1798
- if (!e.altKey || e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
1799
- const t = this.node;
1800
- if (!t) return;
1801
- const r = this.shadowRoot?.querySelector(".qb-subquery-header");
1802
- e.composedPath()[0] === r && (e.preventDefault(), this.dispatchEvent(new CustomEvent("qb-keyboard-move", {
1803
- detail: { id: t.id, direction: e.key === "ArrowUp" ? "up" : "down" },
1804
- bubbles: !0,
1805
- composed: !0
1806
- })));
1807
- };
1808
- }
1809
- static {
1810
- this.styles = [Me];
1811
- }
1812
- static {
1813
- this.properties = {
1814
- node: { attribute: !1 },
1815
- schema: { attribute: !1 },
1816
- currentEntity: { attribute: !1 },
1817
- depth: { attribute: !1 },
1818
- qbRoot: { attribute: !1 },
1819
- isDragging: { attribute: !1 }
1820
- };
1821
- }
1822
- resolveField(e) {
1823
- return this.schema.find((t) => t.name === this.currentEntity)?.fields.find((t) => t.name === e);
1824
- }
1825
- messages() {
1826
- const e = this._messagesConsumer.value ?? {};
1827
- return {
1828
- ...m,
1829
- ...e,
1830
- operators: { ...m.operators, ...e.operators ?? {} }
1831
- };
1832
- }
1833
- render() {
1834
- const e = this.node;
1835
- if (!e) return u;
1836
- const t = this.resolveField(e.field), r = this.messages(), n = t?.label ?? e.field, s = r.operators[e.operator] ?? e.operator, b = t?.targetEntity ?? "";
1837
- return d`
1838
- <div class="qb-subquery" part="subquery" data-row-id=${e.id}>
1839
- <div
1840
- class="qb-subquery-header"
1841
- part="subquery-header"
1842
- tabindex="0"
1843
- role="group"
1844
- aria-label=${// Focusable reorder stop — role + a name mirroring the visible
1845
- // field/operator/target text, re-derived every render (§11a).
1846
- `${n} ${s}${b ? ` ${b}` : ""}`}
1847
- @keydown=${this._onHeaderKeyDown}
1848
- >
1849
- <span class="qb-subquery-field">${n}</span>
1850
- <span class="qb-subquery-operator">${s}</span>
1851
- ${b ? d`<span class="qb-subquery-target">(${b})</span>` : u}
1852
- </div>
1853
- <mp-query-builder
1854
- .query=${e.subQuery}
1855
- .schema=${this.schema}
1856
- .rootEntity=${b}
1857
- .depth=${this.depth + 1}
1858
- part="subquery-builder"
1859
- ></mp-query-builder>
1860
- </div>
1861
- `;
1862
- }
1077
+ cursor: grab;
1078
+ font-size: 1rem;
1079
+ line-height: 1;
1080
+ touch-action: none;
1081
+ }
1082
+
1083
+ .qb-drag-handle:active[data-mps=query-condition] {
1084
+ cursor: grabbing;
1085
+ }
1086
+
1087
+ .qb-drag-handle:disabled[data-mps=query-condition] {
1088
+ cursor: not-allowed;
1089
+ opacity: 0.5;
1090
+ }
1091
+
1092
+ .qb-field[data-mps=query-condition] {
1093
+ font-weight: 600;
1094
+ color: var(--bs-body-color, currentColor);
1095
+ }
1096
+
1097
+ .qb-operator[data-mps=query-condition] {
1098
+ color: var(--bs-secondary-color, #6c757d);
1099
+ }
1100
+
1101
+ .qb-value[data-mps=query-condition] {
1102
+ color: var(--bs-primary-text-emphasis, #084298);
1103
+ }
1104
+
1105
+ .qb-value-list[data-mps=query-condition] {
1106
+ display: inline-flex;
1107
+ gap: 0.25rem;
1108
+ }
1109
+
1110
+ .qb-value-pill[data-mps=query-condition] {
1111
+ display: inline-block;
1112
+ padding: 0 0.375rem;
1113
+ background: var(--bs-info-bg-subtle, #cff4fc);
1114
+ color: var(--bs-info-text-emphasis, #055160);
1115
+ border-radius: var(--bs-border-radius-sm, 0.25rem);
1116
+ }
1117
+
1118
+ .qb-missing[data-mps=query-condition] {
1119
+ color: var(--bs-danger-text-emphasis, #842029);
1120
+ font-style: italic;
1863
1121
  }
1864
- typeof customElements < "u" && !customElements.get("mp-query-subquery") && customElements.define("mp-query-subquery", Te);
1865
- d`<!-- Rendered dynamically by render(). Codegen-wc emits styles from the
1866
- sibling .scss; the template export is intentionally unused. -->`;
1867
- const Pe = S(`.btn {
1868
- --bs-btn-padding-x: 0.75rem;
1869
- --bs-btn-padding-y: 0.375rem;
1870
- --bs-btn-font-family: ;
1871
- --bs-btn-font-size: 1rem;
1872
- --bs-btn-font-weight: 400;
1873
- --bs-btn-line-height: 1.5;
1874
- --bs-btn-color: var(--bs-body-color);
1875
- --bs-btn-bg: transparent;
1876
- --bs-btn-border-width: var(--bs-border-width);
1877
- --bs-btn-border-color: transparent;
1878
- --bs-btn-border-radius: var(--bs-border-radius);
1879
- --bs-btn-hover-border-color: transparent;
1880
- --bs-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
1881
- --bs-btn-disabled-opacity: 0.65;
1882
- --bs-btn-focus-box-shadow: 0 0 0 0.25rem rgba(var(--bs-btn-focus-shadow-rgb), .5);
1122
+
1123
+ .qb-editor-input[data-mps=query-condition] {
1883
1124
  display: inline-block;
1884
- padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
1885
- font-family: var(--bs-btn-font-family);
1886
- font-size: var(--bs-btn-font-size);
1887
- font-weight: var(--bs-btn-font-weight);
1888
- line-height: var(--bs-btn-line-height);
1889
- color: var(--bs-btn-color);
1890
- text-align: center;
1891
- text-decoration: none;
1125
+ width: auto;
1126
+ min-width: 6rem;
1892
1127
  vertical-align: middle;
1893
- cursor: pointer;
1894
- user-select: none;
1895
- border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);
1896
- border-radius: var(--bs-btn-border-radius);
1897
- background-color: var(--bs-btn-bg);
1898
- transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
1899
1128
  }
1900
- @media (prefers-reduced-motion: reduce) {
1901
- .btn {
1902
- transition: none;
1903
- }
1129
+
1130
+ .qb-editor-n-input[data-mps=query-condition] {
1131
+ min-width: 4rem;
1132
+ max-width: 6rem;
1133
+ }
1134
+
1135
+ .qb-editor-select[data-mps=query-condition],
1136
+ .qb-editor-multiselect[data-mps=query-condition] {
1137
+ display: inline-block;
1138
+ width: auto;
1139
+ min-width: 8rem;
1140
+ vertical-align: middle;
1904
1141
  }
1905
- .btn:hover {
1906
- color: var(--bs-btn-hover-color);
1907
- background-color: var(--bs-btn-hover-bg);
1908
- border-color: var(--bs-btn-hover-border-color);
1142
+
1143
+ .qb-editor-tuple[data-mps=query-condition] {
1144
+ display: inline-flex;
1145
+ align-items: center;
1146
+ gap: 0.25rem;
1909
1147
  }
1910
- .btn-check + .btn:hover {
1911
- color: var(--bs-btn-color);
1912
- background-color: var(--bs-btn-bg);
1913
- border-color: var(--bs-btn-border-color);
1148
+
1149
+ .qb-editor-tuple-sep[data-mps=query-condition] {
1150
+ color: var(--bs-secondary-color, #6c757d);
1151
+ font-size: 0.875rem;
1914
1152
  }
1915
- .btn:focus-visible {
1916
- color: var(--bs-btn-hover-color);
1917
- background-color: var(--bs-btn-hover-bg);
1918
- border-color: var(--bs-btn-hover-border-color);
1919
- outline: 0;
1920
- box-shadow: var(--bs-btn-focus-box-shadow);
1153
+
1154
+ .qb-editor-chip-input[data-mps=query-condition] {
1155
+ display: inline-flex;
1156
+ flex-wrap: wrap;
1157
+ align-items: center;
1158
+ gap: 0.25rem;
1159
+ padding: 0.125rem;
1160
+ border: 1px solid var(--bs-border-color, #dee2e6);
1161
+ border-radius: var(--bs-border-radius-sm, 0.25rem);
1162
+ background: var(--bs-body-bg, transparent);
1163
+ min-height: 1.75rem;
1921
1164
  }
1922
- .btn-check:focus-visible + .btn {
1923
- border-color: var(--bs-btn-hover-border-color);
1924
- outline: 0;
1925
- box-shadow: var(--bs-btn-focus-box-shadow);
1165
+
1166
+ .qb-editor-chip[data-mps=query-condition] {
1167
+ display: inline-flex;
1168
+ align-items: center;
1169
+ gap: 0.25rem;
1170
+ padding: 0 0.375rem;
1171
+ background: var(--bs-info-bg-subtle, #cff4fc);
1172
+ color: var(--bs-info-text-emphasis, #055160);
1173
+ border-radius: var(--bs-border-radius-sm, 0.25rem);
1174
+ font-size: 0.75rem;
1926
1175
  }
1927
- .btn-check:checked + .btn, :not(.btn-check) + .btn:active, .btn:first-child:active, .btn.active, .btn.show {
1928
- color: var(--bs-btn-active-color);
1929
- background-color: var(--bs-btn-active-bg);
1930
- border-color: var(--bs-btn-active-border-color);
1176
+
1177
+ .qb-editor-chip-remove[data-mps=query-condition] {
1178
+ background: transparent;
1179
+ border: 0;
1180
+ padding: 0 0.125rem;
1181
+ color: inherit;
1182
+ cursor: pointer;
1183
+ line-height: 1;
1184
+ font-size: 0.875rem;
1931
1185
  }
1932
- .btn-check:checked + .btn:focus-visible, :not(.btn-check) + .btn:active:focus-visible, .btn:first-child:active:focus-visible, .btn.active:focus-visible, .btn.show:focus-visible {
1933
- box-shadow: var(--bs-btn-focus-box-shadow);
1186
+
1187
+ .qb-editor-chip-remove:disabled[data-mps=query-condition] {
1188
+ cursor: not-allowed;
1189
+ opacity: 0.5;
1934
1190
  }
1935
- .btn-check:checked:focus-visible + .btn {
1936
- box-shadow: var(--bs-btn-focus-box-shadow);
1191
+
1192
+ .qb-editor-chip-add[data-mps=query-condition] {
1193
+ display: inline-block;
1194
+ width: auto;
1195
+ border: 0;
1196
+ padding: 0 0.25rem;
1197
+ font-size: 0.875rem;
1198
+ background: transparent;
1199
+ min-width: 4rem;
1937
1200
  }
1938
- .btn:disabled, .btn.disabled, fieldset:disabled .btn {
1939
- color: var(--bs-btn-disabled-color);
1940
- pointer-events: none;
1941
- background-color: var(--bs-btn-disabled-bg);
1942
- border-color: var(--bs-btn-disabled-border-color);
1943
- opacity: var(--bs-btn-disabled-opacity);
1944
- }
1945
-
1946
- .btn-primary {
1947
- --bs-btn-color: #fff;
1948
- --bs-btn-bg: #0d6efd;
1949
- --bs-btn-border-color: #0d6efd;
1950
- --bs-btn-hover-color: #fff;
1951
- --bs-btn-hover-bg: rgb(4.3333333333%, 36.6666666667%, 84.3333333333%);
1952
- --bs-btn-hover-border-color: rgb(4.0784313725%, 34.5098039216%, 79.3725490196%);
1953
- --bs-btn-focus-shadow-rgb: 49, 132, 253;
1954
- --bs-btn-active-color: #fff;
1955
- --bs-btn-active-bg: rgb(4.0784313725%, 34.5098039216%, 79.3725490196%);
1956
- --bs-btn-active-border-color: rgb(3.8235294118%, 32.3529411765%, 74.4117647059%);
1957
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1958
- --bs-btn-disabled-color: #fff;
1959
- --bs-btn-disabled-bg: #0d6efd;
1960
- --bs-btn-disabled-border-color: #0d6efd;
1961
- }
1962
-
1963
- .btn-secondary {
1964
- --bs-btn-color: #fff;
1965
- --bs-btn-bg: #6c757d;
1966
- --bs-btn-border-color: #6c757d;
1967
- --bs-btn-hover-color: #fff;
1968
- --bs-btn-hover-bg: rgb(36%, 39%, 41.6666666667%);
1969
- --bs-btn-hover-border-color: rgb(33.8823529412%, 36.7058823529%, 39.2156862745%);
1970
- --bs-btn-focus-shadow-rgb: 130, 138, 145;
1971
- --bs-btn-active-color: #fff;
1972
- --bs-btn-active-bg: rgb(33.8823529412%, 36.7058823529%, 39.2156862745%);
1973
- --bs-btn-active-border-color: rgb(31.7647058824%, 34.4117647059%, 36.7647058824%);
1974
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1975
- --bs-btn-disabled-color: #fff;
1976
- --bs-btn-disabled-bg: #6c757d;
1977
- --bs-btn-disabled-border-color: #6c757d;
1978
- }
1979
-
1980
- .btn-success {
1981
- --bs-btn-color: #fff;
1982
- --bs-btn-bg: #198754;
1983
- --bs-btn-border-color: #198754;
1984
- --bs-btn-hover-color: #fff;
1985
- --bs-btn-hover-bg: rgb(8.3333333333%, 45%, 28%);
1986
- --bs-btn-hover-border-color: rgb(7.8431372549%, 42.3529411765%, 26.3529411765%);
1987
- --bs-btn-focus-shadow-rgb: 60, 153, 110;
1988
- --bs-btn-active-color: #fff;
1989
- --bs-btn-active-bg: rgb(7.8431372549%, 42.3529411765%, 26.3529411765%);
1990
- --bs-btn-active-border-color: rgb(7.3529411765%, 39.7058823529%, 24.7058823529%);
1991
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1992
- --bs-btn-disabled-color: #fff;
1993
- --bs-btn-disabled-bg: #198754;
1994
- --bs-btn-disabled-border-color: #198754;
1995
- }
1996
-
1997
- .btn-info {
1998
- --bs-btn-color: #000;
1999
- --bs-btn-bg: #0dcaf0;
2000
- --bs-btn-border-color: #0dcaf0;
2001
- --bs-btn-hover-color: #000;
2002
- --bs-btn-hover-bg: rgb(19.3333333333%, 82.3333333333%, 95%);
2003
- --bs-btn-hover-border-color: rgb(14.5882352941%, 81.2941176471%, 94.7058823529%);
2004
- --bs-btn-focus-shadow-rgb: 11, 172, 204;
2005
- --bs-btn-active-color: #000;
2006
- --bs-btn-active-bg: rgb(24.0784313725%, 83.3725490196%, 95.2941176471%);
2007
- --bs-btn-active-border-color: rgb(14.5882352941%, 81.2941176471%, 94.7058823529%);
2008
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2009
- --bs-btn-disabled-color: #000;
2010
- --bs-btn-disabled-bg: #0dcaf0;
2011
- --bs-btn-disabled-border-color: #0dcaf0;
2012
- }
2013
-
2014
- .btn-warning {
2015
- --bs-btn-color: #000;
2016
- --bs-btn-bg: #ffc107;
2017
- --bs-btn-border-color: #ffc107;
2018
- --bs-btn-hover-color: #000;
2019
- --bs-btn-hover-bg: rgb(100%, 79.3333333333%, 17.3333333333%);
2020
- --bs-btn-hover-border-color: rgb(100%, 78.1176470588%, 12.4705882353%);
2021
- --bs-btn-focus-shadow-rgb: 217, 164, 6;
2022
- --bs-btn-active-color: #000;
2023
- --bs-btn-active-bg: rgb(100%, 80.5490196078%, 22.1960784314%);
2024
- --bs-btn-active-border-color: rgb(100%, 78.1176470588%, 12.4705882353%);
2025
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2026
- --bs-btn-disabled-color: #000;
2027
- --bs-btn-disabled-bg: #ffc107;
2028
- --bs-btn-disabled-border-color: #ffc107;
2029
- }
2030
-
2031
- .btn-danger {
2032
- --bs-btn-color: #fff;
2033
- --bs-btn-bg: #dc3545;
2034
- --bs-btn-border-color: #dc3545;
2035
- --bs-btn-hover-color: #fff;
2036
- --bs-btn-hover-bg: rgb(73.3333333333%, 17.6666666667%, 23%);
2037
- --bs-btn-hover-border-color: rgb(69.0196078431%, 16.6274509804%, 21.6470588235%);
2038
- --bs-btn-focus-shadow-rgb: 225, 83, 97;
2039
- --bs-btn-active-color: #fff;
2040
- --bs-btn-active-bg: rgb(69.0196078431%, 16.6274509804%, 21.6470588235%);
2041
- --bs-btn-active-border-color: rgb(64.7058823529%, 15.5882352941%, 20.2941176471%);
2042
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2043
- --bs-btn-disabled-color: #fff;
2044
- --bs-btn-disabled-bg: #dc3545;
2045
- --bs-btn-disabled-border-color: #dc3545;
2046
- }
2047
-
2048
- .btn-light {
2049
- --bs-btn-color: #000;
2050
- --bs-btn-bg: #f8f9fa;
2051
- --bs-btn-border-color: #f8f9fa;
2052
- --bs-btn-hover-color: #000;
2053
- --bs-btn-hover-bg: rgb(82.6666666667%, 83%, 83.3333333333%);
2054
- --bs-btn-hover-border-color: rgb(77.8039215686%, 78.1176470588%, 78.431372549%);
2055
- --bs-btn-focus-shadow-rgb: 211, 212, 213;
2056
- --bs-btn-active-color: #000;
2057
- --bs-btn-active-bg: rgb(77.8039215686%, 78.1176470588%, 78.431372549%);
2058
- --bs-btn-active-border-color: rgb(72.9411764706%, 73.2352941176%, 73.5294117647%);
2059
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2060
- --bs-btn-disabled-color: #000;
2061
- --bs-btn-disabled-bg: #f8f9fa;
2062
- --bs-btn-disabled-border-color: #f8f9fa;
2063
- }
2064
-
2065
- .btn-dark {
2066
- --bs-btn-color: #fff;
2067
- --bs-btn-bg: #212529;
2068
- --bs-btn-border-color: #212529;
2069
- --bs-btn-hover-color: #fff;
2070
- --bs-btn-hover-bg: rgb(26%, 27.3333333333%, 28.6666666667%);
2071
- --bs-btn-hover-border-color: rgb(21.6470588235%, 23.0588235294%, 24.4705882353%);
2072
- --bs-btn-focus-shadow-rgb: 66, 70, 73;
2073
- --bs-btn-active-color: #fff;
2074
- --bs-btn-active-bg: rgb(30.3529411765%, 31.6078431373%, 32.862745098%);
2075
- --bs-btn-active-border-color: rgb(21.6470588235%, 23.0588235294%, 24.4705882353%);
2076
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2077
- --bs-btn-disabled-color: #fff;
2078
- --bs-btn-disabled-bg: #212529;
2079
- --bs-btn-disabled-border-color: #212529;
2080
- }
2081
-
2082
- .btn-outline-primary {
2083
- --bs-btn-color: #0d6efd;
2084
- --bs-btn-border-color: #0d6efd;
2085
- --bs-btn-hover-color: #fff;
2086
- --bs-btn-hover-bg: #0d6efd;
2087
- --bs-btn-hover-border-color: #0d6efd;
2088
- --bs-btn-focus-shadow-rgb: 13, 110, 253;
2089
- --bs-btn-active-color: #fff;
2090
- --bs-btn-active-bg: #0d6efd;
2091
- --bs-btn-active-border-color: #0d6efd;
2092
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2093
- --bs-btn-disabled-color: #0d6efd;
2094
- --bs-btn-disabled-bg: transparent;
2095
- --bs-btn-disabled-border-color: #0d6efd;
2096
- --bs-gradient: none;
2097
- }
2098
-
2099
- .btn-outline-secondary {
2100
- --bs-btn-color: #6c757d;
2101
- --bs-btn-border-color: #6c757d;
2102
- --bs-btn-hover-color: #fff;
2103
- --bs-btn-hover-bg: #6c757d;
2104
- --bs-btn-hover-border-color: #6c757d;
2105
- --bs-btn-focus-shadow-rgb: 108, 117, 125;
2106
- --bs-btn-active-color: #fff;
2107
- --bs-btn-active-bg: #6c757d;
2108
- --bs-btn-active-border-color: #6c757d;
2109
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2110
- --bs-btn-disabled-color: #6c757d;
2111
- --bs-btn-disabled-bg: transparent;
2112
- --bs-btn-disabled-border-color: #6c757d;
2113
- --bs-gradient: none;
2114
- }
2115
-
2116
- .btn-outline-success {
2117
- --bs-btn-color: #198754;
2118
- --bs-btn-border-color: #198754;
2119
- --bs-btn-hover-color: #fff;
2120
- --bs-btn-hover-bg: #198754;
2121
- --bs-btn-hover-border-color: #198754;
2122
- --bs-btn-focus-shadow-rgb: 25, 135, 84;
2123
- --bs-btn-active-color: #fff;
2124
- --bs-btn-active-bg: #198754;
2125
- --bs-btn-active-border-color: #198754;
2126
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2127
- --bs-btn-disabled-color: #198754;
2128
- --bs-btn-disabled-bg: transparent;
2129
- --bs-btn-disabled-border-color: #198754;
2130
- --bs-gradient: none;
2131
- }
2132
-
2133
- .btn-outline-info {
2134
- --bs-btn-color: #0dcaf0;
2135
- --bs-btn-border-color: #0dcaf0;
2136
- --bs-btn-hover-color: #000;
2137
- --bs-btn-hover-bg: #0dcaf0;
2138
- --bs-btn-hover-border-color: #0dcaf0;
2139
- --bs-btn-focus-shadow-rgb: 13, 202, 240;
2140
- --bs-btn-active-color: #000;
2141
- --bs-btn-active-bg: #0dcaf0;
2142
- --bs-btn-active-border-color: #0dcaf0;
2143
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2144
- --bs-btn-disabled-color: #0dcaf0;
2145
- --bs-btn-disabled-bg: transparent;
2146
- --bs-btn-disabled-border-color: #0dcaf0;
2147
- --bs-gradient: none;
2148
- }
2149
-
2150
- .btn-outline-warning {
2151
- --bs-btn-color: #ffc107;
2152
- --bs-btn-border-color: #ffc107;
2153
- --bs-btn-hover-color: #000;
2154
- --bs-btn-hover-bg: #ffc107;
2155
- --bs-btn-hover-border-color: #ffc107;
2156
- --bs-btn-focus-shadow-rgb: 255, 193, 7;
2157
- --bs-btn-active-color: #000;
2158
- --bs-btn-active-bg: #ffc107;
2159
- --bs-btn-active-border-color: #ffc107;
2160
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2161
- --bs-btn-disabled-color: #ffc107;
2162
- --bs-btn-disabled-bg: transparent;
2163
- --bs-btn-disabled-border-color: #ffc107;
2164
- --bs-gradient: none;
2165
- }
2166
-
2167
- .btn-outline-danger {
2168
- --bs-btn-color: #dc3545;
2169
- --bs-btn-border-color: #dc3545;
2170
- --bs-btn-hover-color: #fff;
2171
- --bs-btn-hover-bg: #dc3545;
2172
- --bs-btn-hover-border-color: #dc3545;
2173
- --bs-btn-focus-shadow-rgb: 220, 53, 69;
2174
- --bs-btn-active-color: #fff;
2175
- --bs-btn-active-bg: #dc3545;
2176
- --bs-btn-active-border-color: #dc3545;
2177
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2178
- --bs-btn-disabled-color: #dc3545;
2179
- --bs-btn-disabled-bg: transparent;
2180
- --bs-btn-disabled-border-color: #dc3545;
2181
- --bs-gradient: none;
2182
- }
2183
-
2184
- .btn-outline-light {
2185
- --bs-btn-color: #f8f9fa;
2186
- --bs-btn-border-color: #f8f9fa;
2187
- --bs-btn-hover-color: #000;
2188
- --bs-btn-hover-bg: #f8f9fa;
2189
- --bs-btn-hover-border-color: #f8f9fa;
2190
- --bs-btn-focus-shadow-rgb: 248, 249, 250;
2191
- --bs-btn-active-color: #000;
2192
- --bs-btn-active-bg: #f8f9fa;
2193
- --bs-btn-active-border-color: #f8f9fa;
2194
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2195
- --bs-btn-disabled-color: #f8f9fa;
2196
- --bs-btn-disabled-bg: transparent;
2197
- --bs-btn-disabled-border-color: #f8f9fa;
2198
- --bs-gradient: none;
2199
- }
2200
-
2201
- .btn-outline-dark {
2202
- --bs-btn-color: #212529;
2203
- --bs-btn-border-color: #212529;
2204
- --bs-btn-hover-color: #fff;
2205
- --bs-btn-hover-bg: #212529;
2206
- --bs-btn-hover-border-color: #212529;
2207
- --bs-btn-focus-shadow-rgb: 33, 37, 41;
2208
- --bs-btn-active-color: #fff;
2209
- --bs-btn-active-bg: #212529;
2210
- --bs-btn-active-border-color: #212529;
2211
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2212
- --bs-btn-disabled-color: #212529;
2213
- --bs-btn-disabled-bg: transparent;
2214
- --bs-btn-disabled-border-color: #212529;
2215
- --bs-gradient: none;
2216
- }
2217
-
2218
- .btn-link {
2219
- --bs-btn-font-weight: 400;
2220
- --bs-btn-color: var(--bs-link-color);
2221
- --bs-btn-bg: transparent;
2222
- --bs-btn-border-color: transparent;
2223
- --bs-btn-hover-color: var(--bs-link-hover-color);
2224
- --bs-btn-hover-border-color: transparent;
2225
- --bs-btn-active-color: var(--bs-link-hover-color);
2226
- --bs-btn-active-border-color: transparent;
2227
- --bs-btn-disabled-color: #6c757d;
2228
- --bs-btn-disabled-border-color: transparent;
2229
- --bs-btn-box-shadow: 0 0 0 #000;
2230
- --bs-btn-focus-shadow-rgb: 49, 132, 253;
2231
- text-decoration: underline;
2232
- }
2233
- .btn-link:focus-visible {
2234
- color: var(--bs-btn-color);
2235
- }
2236
- .btn-link:hover {
2237
- color: var(--bs-btn-hover-color);
2238
- }
2239
-
2240
- .btn-lg {
2241
- --bs-btn-padding-y: 0.5rem;
2242
- --bs-btn-padding-x: 1rem;
2243
- --bs-btn-font-size: 1.25rem;
2244
- --bs-btn-border-radius: var(--bs-border-radius-lg);
2245
- }
2246
-
2247
- .btn-sm {
2248
- --bs-btn-padding-y: 0.25rem;
2249
- --bs-btn-padding-x: 0.5rem;
2250
- --bs-btn-font-size: 0.875rem;
2251
- --bs-btn-border-radius: var(--bs-border-radius-sm);
2252
- }
2253
-
2254
- :host {
1201
+
1202
+ .qb-editor-chip-add:focus[data-mps=query-condition] {
1203
+ outline: none;
1204
+ box-shadow: none;
1205
+ }`), Ae = A(`mp-query-group {
2255
1206
  display: block;
2256
1207
  margin: 0.25rem 0;
2257
1208
  }
2258
1209
 
2259
- .qb-group {
1210
+ .qb-group[data-mps=query-group] {
2260
1211
  border-left: 3px solid var(--bs-border-color, #dee2e6);
2261
1212
  padding-left: 0.5rem;
2262
1213
  }
2263
1214
 
2264
- .qb-group-header {
1215
+ .qb-group-header[data-mps=query-group] {
2265
1216
  display: flex;
2266
1217
  align-items: center;
2267
1218
  gap: 0.5rem;
@@ -2270,41 +1221,41 @@ const Pe = S(`.btn {
2270
1221
  flex-wrap: wrap;
2271
1222
  }
2272
1223
 
2273
- .qb-group-actions {
1224
+ .qb-group-actions[data-mps=query-group] {
2274
1225
  display: inline-flex;
2275
1226
  align-items: center;
2276
1227
  gap: 0.25rem;
2277
1228
  margin-left: auto;
2278
1229
  }
2279
1230
 
2280
- .qb-logic-btn {
1231
+ .qb-logic-btn[data-mps=query-group] {
2281
1232
  font-size: 0.75rem;
2282
1233
  text-transform: uppercase;
2283
1234
  letter-spacing: 0.05em;
2284
1235
  padding: 0.125rem 0.5rem;
2285
1236
  }
2286
1237
 
2287
- .qb-remove-group {
1238
+ .qb-remove-group[data-mps=query-group] {
2288
1239
  padding: 0 0.5rem;
2289
1240
  line-height: 1;
2290
1241
  font-size: 1rem;
2291
1242
  color: var(--bs-danger, #dc3545);
2292
1243
  }
2293
1244
 
2294
- .qb-children {
1245
+ .qb-children[data-mps=query-group] {
2295
1246
  display: flex;
2296
1247
  flex-direction: column;
2297
1248
  gap: 0.125rem;
2298
1249
  }
2299
1250
 
2300
- .qb-empty {
1251
+ .qb-empty[data-mps=query-group] {
2301
1252
  color: var(--bs-secondary-color, #6c757d);
2302
1253
  font-style: italic;
2303
1254
  font-size: 0.875rem;
2304
1255
  padding: 0.25rem 0;
2305
1256
  }
2306
1257
 
2307
- .qb-drop-slot {
1258
+ .qb-drop-slot[data-mps=query-group] {
2308
1259
  display: block;
2309
1260
  height: 0.25rem;
2310
1261
  margin: 0.0625rem 0;
@@ -2313,12 +1264,12 @@ const Pe = S(`.btn {
2313
1264
  transition: background 0.1s ease-in-out, height 0.1s ease-in-out;
2314
1265
  }
2315
1266
 
2316
- .qb-drop-slot:hover {
1267
+ .qb-drop-slot:hover[data-mps=query-group] {
2317
1268
  background: var(--bs-primary, #0d6efd);
2318
1269
  height: 0.375rem;
2319
1270
  }
2320
1271
 
2321
- .qb-drop-slot-placeholder {
1272
+ .qb-drop-slot-placeholder[data-mps=query-group] {
2322
1273
  height: 2rem;
2323
1274
  display: flex;
2324
1275
  align-items: center;
@@ -2330,975 +1281,843 @@ const Pe = S(`.btn {
2330
1281
  }
2331
1282
 
2332
1283
  @media (prefers-reduced-motion: reduce) {
2333
- * {
1284
+ [data-mps=query-group] {
2334
1285
  transition-duration: 0.01ms !important;
2335
1286
  }
2336
- }`);
2337
- class Fe extends R {
1287
+ }`), Le = A(`mp-query-subquery {
1288
+ display: block;
1289
+ margin: 0.25rem 0;
1290
+ }
1291
+
1292
+ .qb-subquery[data-mps=query-subquery] {
1293
+ border: 1px dashed var(--bs-border-color, #dee2e6);
1294
+ border-radius: var(--bs-border-radius, 0.375rem);
1295
+ padding: 0.5rem;
1296
+ background: var(--bs-tertiary-bg, #f8f9fa);
1297
+ }
1298
+
1299
+ .qb-subquery-header[data-mps=query-subquery] {
1300
+ display: flex;
1301
+ align-items: center;
1302
+ gap: 0.5rem;
1303
+ font-size: 0.875rem;
1304
+ margin-bottom: 0.5rem;
1305
+ }
1306
+
1307
+ .qb-subquery-field[data-mps=query-subquery] {
1308
+ font-weight: 600;
1309
+ }
1310
+
1311
+ .qb-subquery-operator[data-mps=query-subquery] {
1312
+ color: var(--bs-secondary-color, #6c757d);
1313
+ text-transform: lowercase;
1314
+ }
1315
+
1316
+ .qb-subquery-target[data-mps=query-subquery] {
1317
+ font-style: italic;
1318
+ color: var(--bs-secondary-color, #6c757d);
1319
+ }`), Me = 99999;
1320
+ class Te {
2338
1321
  constructor() {
2339
- super(...arguments), this.node = null, this.schema = [], this.currentEntity = "", this.depth = 0, this.isRoot = !1, this.qbRoot = "", this.isDragging = !1, this._messagesConsumer = new p(this, {
2340
- context: q,
2341
- subscribe: !0
2342
- }), this._disabledConsumer = new p(this, {
2343
- context: C,
2344
- subscribe: !0
2345
- }), this._onLogicChange = (e) => {
2346
- const t = this.node;
2347
- !t || t.logic === e || this._emit("group-logic-change", { id: t.id, logic: e });
2348
- }, this._onAddCondition = () => {
2349
- this.node && this._emit("add-condition", { groupId: this.node.id });
2350
- }, this._onAddGroup = () => {
2351
- this.node && this._emit("add-group", { groupId: this.node.id });
2352
- }, this._onAddSubquery = () => {
2353
- this.node && this._emit("add-subquery", { groupId: this.node.id });
2354
- }, this._onRemove = () => {
2355
- this.node && this._emit("node-remove", { id: this.node.id });
2356
- };
1322
+ this._source = null, this._ghost = null, this._lastTarget = null, this._offsetX = 0, this._offsetY = 0;
2357
1323
  }
2358
- static {
2359
- this.styles = [Pe];
1324
+ isActive() {
1325
+ return this._source !== null;
2360
1326
  }
2361
- static {
2362
- this.properties = {
2363
- node: { attribute: !1 },
2364
- schema: { attribute: !1 },
2365
- currentEntity: { attribute: !1 },
2366
- depth: { attribute: !1 },
2367
- isRoot: { attribute: !1 },
2368
- qbRoot: { attribute: !1 },
2369
- isDragging: { attribute: !1 }
2370
- };
1327
+ source() {
1328
+ return this._source;
2371
1329
  }
2372
- isDisabled() {
2373
- return this._disabledConsumer.value ?? !1;
1330
+ currentTarget() {
1331
+ return this._lastTarget;
2374
1332
  }
2375
- _hasRelation() {
2376
- return (this.schema.find((e) => e.name === this.currentEntity)?.fields ?? []).some((e) => e.type === "relation" && !!e.targetEntity);
1333
+ start(e, t) {
1334
+ if (typeof document > "u") return;
1335
+ this._source = e;
1336
+ const r = e.rowElement.getBoundingClientRect();
1337
+ this._offsetX = t.clientX - r.left, this._offsetY = t.clientY - r.top;
1338
+ const n = e.rowElement.cloneNode(!0);
1339
+ n.style.position = "fixed", n.style.top = `${r.top}px`, n.style.left = `${r.left}px`, n.style.width = `${r.width}px`, n.style.pointerEvents = "none", n.style.zIndex = String(Me), n.style.opacity = "0.85", n.classList.add("qb-drag-ghost"), document.body.appendChild(n), this._ghost = n;
2377
1340
  }
2378
- _emit(e, t) {
2379
- this.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
1341
+ move(e) {
1342
+ if (!this._source || !this._ghost) return;
1343
+ this._ghost.style.top = `${e.clientY - this._offsetY}px`, this._ghost.style.left = `${e.clientX - this._offsetX}px`;
1344
+ const t = this.resolveDropTarget(e.clientX, e.clientY);
1345
+ this._lastTarget = t;
2380
1346
  }
2381
- messages() {
2382
- const e = this._messagesConsumer.value ?? {};
2383
- return {
2384
- ...m,
2385
- ...e,
2386
- operators: { ...m.operators, ...e.operators ?? {} }
2387
- };
1347
+ end(e) {
1348
+ const t = this._lastTarget;
1349
+ return this.cleanup(), t;
2388
1350
  }
2389
- renderChild(e) {
2390
- switch (e.kind) {
2391
- case "group":
2392
- return d`<mp-query-group
2393
- .node=${e}
2394
- .schema=${this.schema}
2395
- .currentEntity=${this.currentEntity}
2396
- .depth=${this.depth + 1}
2397
- .qbRoot=${this.qbRoot}
2398
- .isDragging=${this.isDragging}
2399
- part="child-group"
2400
- ></mp-query-group>`;
2401
- case "condition":
2402
- return d`<mp-query-condition
2403
- .node=${e}
2404
- .schema=${this.schema}
2405
- .currentEntity=${this.currentEntity}
2406
- part="child-condition"
2407
- ></mp-query-condition>`;
2408
- case "subquery":
2409
- return d`<mp-query-subquery
2410
- .node=${e}
2411
- .schema=${this.schema}
2412
- .currentEntity=${this.currentEntity}
2413
- .depth=${this.depth + 1}
2414
- .qbRoot=${this.qbRoot}
2415
- .isDragging=${this.isDragging}
2416
- part="child-subquery"
2417
- ></mp-query-subquery>`;
2418
- }
2419
- }
2420
- renderDropSlot(e) {
2421
- return !this.isDragging || !this.node ? u : d`<div
2422
- class="qb-drop-slot"
2423
- data-drop-slot
2424
- data-parent-id=${this.node.id}
2425
- data-index=${String(e)}
2426
- data-qb-root=${this.qbRoot}
2427
- part="drop-slot"
2428
- aria-hidden="true"
2429
- ></div>`;
2430
- }
2431
- _renderChildrenWithSlots(e) {
2432
- const t = [];
2433
- this.isDragging && t.push(this.renderDropSlot(0));
2434
- for (let r = 0; r < e.length; r++)
2435
- t.push(this.renderChild(e[r])), this.isDragging && t.push(this.renderDropSlot(r + 1));
2436
- return t;
1351
+ cancel() {
1352
+ this.cleanup();
2437
1353
  }
2438
- _dropPlaceholder() {
2439
- return d`<div
2440
- class="qb-drop-slot qb-drop-slot-placeholder"
2441
- data-drop-slot
2442
- data-parent-id=${this.node?.id ?? ""}
2443
- data-index="0"
2444
- data-qb-root=${this.qbRoot}
2445
- aria-hidden="true"
2446
- >Drop here</div>`;
1354
+ cleanup() {
1355
+ this._ghost && typeof document < "u" && this._ghost.remove(), this._ghost = null, this._source = null, this._lastTarget = null, this._offsetX = 0, this._offsetY = 0;
2447
1356
  }
2448
- render() {
2449
- const e = this.node;
2450
- if (!e) return u;
2451
- const t = this.messages(), r = this.isDisabled(), n = this._hasRelation();
2452
- return d`
2453
- <div
2454
- class="qb-group"
2455
- role="group"
2456
- aria-label=${// Depth rides in the NAME: aria-level is not an allowed attribute
2457
- // on role=group (axe aria-allowed-attr, serious) — it belongs to
2458
- // treeitem/row/heading.
2459
- `${e.logic === "and" ? "AND" : "OR"} group${this.depth > 0 ? `, level ${this.depth + 1}` : ""}`}
2460
- part="group"
2461
- >
2462
- <div class="qb-group-header" part="group-header">
2463
- <span class="qb-logic-toggle btn-group btn-group-sm" role="group" aria-label=${t.groupLogic}>
2464
- <button
2465
- type="button"
2466
- class="btn ${e.logic === "and" ? "btn-primary" : "btn-outline-primary"} qb-logic-btn"
2467
- ?disabled=${r}
2468
- @click=${() => this._onLogicChange("and")}
2469
- aria-pressed=${e.logic === "and"}
2470
- >${t.logicAnd}</button>
2471
- <button
2472
- type="button"
2473
- class="btn ${e.logic === "or" ? "btn-primary" : "btn-outline-primary"} qb-logic-btn"
2474
- ?disabled=${r}
2475
- @click=${() => this._onLogicChange("or")}
2476
- aria-pressed=${e.logic === "or"}
2477
- >${t.logicOr}</button>
2478
- </span>
2479
- <span class="qb-group-actions">
2480
- <button
2481
- type="button"
2482
- class="btn btn-sm btn-outline-secondary qb-add-condition"
2483
- part="add-condition"
2484
- ?disabled=${r}
2485
- @click=${this._onAddCondition}
2486
- >+ ${t.addCondition}</button>
2487
- <button
2488
- type="button"
2489
- class="btn btn-sm btn-outline-secondary qb-add-group"
2490
- part="add-group"
2491
- ?disabled=${r}
2492
- @click=${this._onAddGroup}
2493
- >+ ${t.addGroup}</button>
2494
- ${n ? d`<button
2495
- type="button"
2496
- class="btn btn-sm btn-outline-secondary qb-add-subquery"
2497
- part="add-subquery"
2498
- ?disabled=${r}
2499
- @click=${this._onAddSubquery}
2500
- >+ ${t.addSubquery}</button>` : u}
2501
- ${this.isRoot ? u : d`<button
2502
- type="button"
2503
- class="btn btn-sm btn-link qb-remove-group"
2504
- part="remove-group"
2505
- ?disabled=${r}
2506
- @click=${this._onRemove}
2507
- aria-label=${t.removeGroup}
2508
- title=${t.removeGroup}
2509
- >×</button>`}
2510
- </span>
2511
- </div>
2512
- <div class="qb-children" part="children">
2513
- ${e.children.length === 0 ? d`<div class="qb-empty">${this.isDragging ? this._dropPlaceholder() : t.emptyGroup}</div>` : this._renderChildrenWithSlots(e.children)}
2514
- </div>
2515
- </div>
2516
- `;
1357
+ /**
1358
+ * Walks `document.elementsFromPoint(x, y)` (composed path; cross-browser
1359
+ * supported in Chromium / Firefox / modern WebKit) and returns the first
1360
+ * `[data-drop-slot]` ancestor whose data-parent-id is NOT in the source's
1361
+ * descendant set.
1362
+ *
1363
+ * For older WebKit which doesn't implement `elementsFromPoint`, callers
1364
+ * can extend the resolver with a shadow-DOM walker (FR-38 fallback) —
1365
+ * not implemented here since we target evergreen browsers.
1366
+ */
1367
+ resolveDropTarget(e, t) {
1368
+ if (typeof document > "u") return null;
1369
+ const r = this._source;
1370
+ if (!r) return null;
1371
+ const n = document.elementsFromPoint;
1372
+ let i = [];
1373
+ if (typeof n == "function")
1374
+ i = n.call(document, e, t) ?? [];
1375
+ else {
1376
+ const a = document.elementFromPoint(e, t);
1377
+ a && (i = [a]);
1378
+ }
1379
+ const s = Pe(i, e, t);
1380
+ for (const a of s) {
1381
+ const d = a.closest("[data-drop-slot]");
1382
+ if (!d) continue;
1383
+ const l = d.dataset.parentId, u = d.dataset.index, p = d.dataset.qbRoot;
1384
+ if (!(!l || !u || !p) && !r.descendantIds.has(l))
1385
+ return { parentId: l, index: Number(u), qbRoot: p };
1386
+ }
1387
+ return null;
2517
1388
  }
2518
1389
  }
2519
- typeof customElements < "u" && !customElements.get("mp-query-group") && customElements.define("mp-query-group", Fe);
2520
- d`<!-- Rendered dynamically by render(). Codegen-wc emits styles from the
2521
- sibling .scss; the template export is intentionally unused. -->`;
2522
- const Ie = S(`.btn {
2523
- --bs-btn-padding-x: 0.75rem;
2524
- --bs-btn-padding-y: 0.375rem;
2525
- --bs-btn-font-family: ;
2526
- --bs-btn-font-size: 1rem;
2527
- --bs-btn-font-weight: 400;
2528
- --bs-btn-line-height: 1.5;
2529
- --bs-btn-color: var(--bs-body-color);
2530
- --bs-btn-bg: transparent;
2531
- --bs-btn-border-width: var(--bs-border-width);
2532
- --bs-btn-border-color: transparent;
2533
- --bs-btn-border-radius: var(--bs-border-radius);
2534
- --bs-btn-hover-border-color: transparent;
2535
- --bs-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
2536
- --bs-btn-disabled-opacity: 0.65;
2537
- --bs-btn-focus-box-shadow: 0 0 0 0.25rem rgba(var(--bs-btn-focus-shadow-rgb), .5);
2538
- display: inline-block;
2539
- padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
2540
- font-family: var(--bs-btn-font-family);
2541
- font-size: var(--bs-btn-font-size);
2542
- font-weight: var(--bs-btn-font-weight);
2543
- line-height: var(--bs-btn-line-height);
2544
- color: var(--bs-btn-color);
2545
- text-align: center;
2546
- text-decoration: none;
2547
- vertical-align: middle;
2548
- cursor: pointer;
2549
- user-select: none;
2550
- border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);
2551
- border-radius: var(--bs-btn-border-radius);
2552
- background-color: var(--bs-btn-bg);
2553
- transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
2554
- }
2555
- @media (prefers-reduced-motion: reduce) {
2556
- .btn {
2557
- transition: none;
1390
+ function Pe(o, e, t) {
1391
+ const r = [...o], n = /* @__PURE__ */ new Set();
1392
+ for (const i of o) {
1393
+ const s = i.shadowRoot;
1394
+ if (!s || n.has(s)) continue;
1395
+ n.add(s);
1396
+ const a = s.elementFromPoint(e, t);
1397
+ a && r.push(a);
2558
1398
  }
1399
+ return r;
2559
1400
  }
2560
- .btn:hover {
2561
- color: var(--bs-btn-hover-color);
2562
- background-color: var(--bs-btn-hover-bg);
2563
- border-color: var(--bs-btn-hover-border-color);
2564
- }
2565
- .btn-check + .btn:hover {
2566
- color: var(--bs-btn-color);
2567
- background-color: var(--bs-btn-bg);
2568
- border-color: var(--bs-btn-border-color);
2569
- }
2570
- .btn:focus-visible {
2571
- color: var(--bs-btn-hover-color);
2572
- background-color: var(--bs-btn-hover-bg);
2573
- border-color: var(--bs-btn-hover-border-color);
2574
- outline: 0;
2575
- box-shadow: var(--bs-btn-focus-box-shadow);
2576
- }
2577
- .btn-check:focus-visible + .btn {
2578
- border-color: var(--bs-btn-hover-border-color);
2579
- outline: 0;
2580
- box-shadow: var(--bs-btn-focus-box-shadow);
2581
- }
2582
- .btn-check:checked + .btn, :not(.btn-check) + .btn:active, .btn:first-child:active, .btn.active, .btn.show {
2583
- color: var(--bs-btn-active-color);
2584
- background-color: var(--bs-btn-active-bg);
2585
- border-color: var(--bs-btn-active-border-color);
2586
- }
2587
- .btn-check:checked + .btn:focus-visible, :not(.btn-check) + .btn:active:focus-visible, .btn:first-child:active:focus-visible, .btn.active:focus-visible, .btn.show:focus-visible {
2588
- box-shadow: var(--bs-btn-focus-box-shadow);
2589
- }
2590
- .btn-check:checked:focus-visible + .btn {
2591
- box-shadow: var(--bs-btn-focus-box-shadow);
2592
- }
2593
- .btn:disabled, .btn.disabled, fieldset:disabled .btn {
2594
- color: var(--bs-btn-disabled-color);
2595
- pointer-events: none;
2596
- background-color: var(--bs-btn-disabled-bg);
2597
- border-color: var(--bs-btn-disabled-border-color);
2598
- opacity: var(--bs-btn-disabled-opacity);
2599
- }
2600
-
2601
- .btn-primary {
2602
- --bs-btn-color: #fff;
2603
- --bs-btn-bg: #0d6efd;
2604
- --bs-btn-border-color: #0d6efd;
2605
- --bs-btn-hover-color: #fff;
2606
- --bs-btn-hover-bg: rgb(4.3333333333%, 36.6666666667%, 84.3333333333%);
2607
- --bs-btn-hover-border-color: rgb(4.0784313725%, 34.5098039216%, 79.3725490196%);
2608
- --bs-btn-focus-shadow-rgb: 49, 132, 253;
2609
- --bs-btn-active-color: #fff;
2610
- --bs-btn-active-bg: rgb(4.0784313725%, 34.5098039216%, 79.3725490196%);
2611
- --bs-btn-active-border-color: rgb(3.8235294118%, 32.3529411765%, 74.4117647059%);
2612
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2613
- --bs-btn-disabled-color: #fff;
2614
- --bs-btn-disabled-bg: #0d6efd;
2615
- --bs-btn-disabled-border-color: #0d6efd;
2616
- }
2617
-
2618
- .btn-secondary {
2619
- --bs-btn-color: #fff;
2620
- --bs-btn-bg: #6c757d;
2621
- --bs-btn-border-color: #6c757d;
2622
- --bs-btn-hover-color: #fff;
2623
- --bs-btn-hover-bg: rgb(36%, 39%, 41.6666666667%);
2624
- --bs-btn-hover-border-color: rgb(33.8823529412%, 36.7058823529%, 39.2156862745%);
2625
- --bs-btn-focus-shadow-rgb: 130, 138, 145;
2626
- --bs-btn-active-color: #fff;
2627
- --bs-btn-active-bg: rgb(33.8823529412%, 36.7058823529%, 39.2156862745%);
2628
- --bs-btn-active-border-color: rgb(31.7647058824%, 34.4117647059%, 36.7647058824%);
2629
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2630
- --bs-btn-disabled-color: #fff;
2631
- --bs-btn-disabled-bg: #6c757d;
2632
- --bs-btn-disabled-border-color: #6c757d;
2633
- }
2634
-
2635
- .btn-success {
2636
- --bs-btn-color: #fff;
2637
- --bs-btn-bg: #198754;
2638
- --bs-btn-border-color: #198754;
2639
- --bs-btn-hover-color: #fff;
2640
- --bs-btn-hover-bg: rgb(8.3333333333%, 45%, 28%);
2641
- --bs-btn-hover-border-color: rgb(7.8431372549%, 42.3529411765%, 26.3529411765%);
2642
- --bs-btn-focus-shadow-rgb: 60, 153, 110;
2643
- --bs-btn-active-color: #fff;
2644
- --bs-btn-active-bg: rgb(7.8431372549%, 42.3529411765%, 26.3529411765%);
2645
- --bs-btn-active-border-color: rgb(7.3529411765%, 39.7058823529%, 24.7058823529%);
2646
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2647
- --bs-btn-disabled-color: #fff;
2648
- --bs-btn-disabled-bg: #198754;
2649
- --bs-btn-disabled-border-color: #198754;
2650
- }
2651
-
2652
- .btn-info {
2653
- --bs-btn-color: #000;
2654
- --bs-btn-bg: #0dcaf0;
2655
- --bs-btn-border-color: #0dcaf0;
2656
- --bs-btn-hover-color: #000;
2657
- --bs-btn-hover-bg: rgb(19.3333333333%, 82.3333333333%, 95%);
2658
- --bs-btn-hover-border-color: rgb(14.5882352941%, 81.2941176471%, 94.7058823529%);
2659
- --bs-btn-focus-shadow-rgb: 11, 172, 204;
2660
- --bs-btn-active-color: #000;
2661
- --bs-btn-active-bg: rgb(24.0784313725%, 83.3725490196%, 95.2941176471%);
2662
- --bs-btn-active-border-color: rgb(14.5882352941%, 81.2941176471%, 94.7058823529%);
2663
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2664
- --bs-btn-disabled-color: #000;
2665
- --bs-btn-disabled-bg: #0dcaf0;
2666
- --bs-btn-disabled-border-color: #0dcaf0;
2667
- }
2668
-
2669
- .btn-warning {
2670
- --bs-btn-color: #000;
2671
- --bs-btn-bg: #ffc107;
2672
- --bs-btn-border-color: #ffc107;
2673
- --bs-btn-hover-color: #000;
2674
- --bs-btn-hover-bg: rgb(100%, 79.3333333333%, 17.3333333333%);
2675
- --bs-btn-hover-border-color: rgb(100%, 78.1176470588%, 12.4705882353%);
2676
- --bs-btn-focus-shadow-rgb: 217, 164, 6;
2677
- --bs-btn-active-color: #000;
2678
- --bs-btn-active-bg: rgb(100%, 80.5490196078%, 22.1960784314%);
2679
- --bs-btn-active-border-color: rgb(100%, 78.1176470588%, 12.4705882353%);
2680
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2681
- --bs-btn-disabled-color: #000;
2682
- --bs-btn-disabled-bg: #ffc107;
2683
- --bs-btn-disabled-border-color: #ffc107;
2684
- }
2685
-
2686
- .btn-danger {
2687
- --bs-btn-color: #fff;
2688
- --bs-btn-bg: #dc3545;
2689
- --bs-btn-border-color: #dc3545;
2690
- --bs-btn-hover-color: #fff;
2691
- --bs-btn-hover-bg: rgb(73.3333333333%, 17.6666666667%, 23%);
2692
- --bs-btn-hover-border-color: rgb(69.0196078431%, 16.6274509804%, 21.6470588235%);
2693
- --bs-btn-focus-shadow-rgb: 225, 83, 97;
2694
- --bs-btn-active-color: #fff;
2695
- --bs-btn-active-bg: rgb(69.0196078431%, 16.6274509804%, 21.6470588235%);
2696
- --bs-btn-active-border-color: rgb(64.7058823529%, 15.5882352941%, 20.2941176471%);
2697
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2698
- --bs-btn-disabled-color: #fff;
2699
- --bs-btn-disabled-bg: #dc3545;
2700
- --bs-btn-disabled-border-color: #dc3545;
2701
- }
2702
-
2703
- .btn-light {
2704
- --bs-btn-color: #000;
2705
- --bs-btn-bg: #f8f9fa;
2706
- --bs-btn-border-color: #f8f9fa;
2707
- --bs-btn-hover-color: #000;
2708
- --bs-btn-hover-bg: rgb(82.6666666667%, 83%, 83.3333333333%);
2709
- --bs-btn-hover-border-color: rgb(77.8039215686%, 78.1176470588%, 78.431372549%);
2710
- --bs-btn-focus-shadow-rgb: 211, 212, 213;
2711
- --bs-btn-active-color: #000;
2712
- --bs-btn-active-bg: rgb(77.8039215686%, 78.1176470588%, 78.431372549%);
2713
- --bs-btn-active-border-color: rgb(72.9411764706%, 73.2352941176%, 73.5294117647%);
2714
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2715
- --bs-btn-disabled-color: #000;
2716
- --bs-btn-disabled-bg: #f8f9fa;
2717
- --bs-btn-disabled-border-color: #f8f9fa;
2718
- }
2719
-
2720
- .btn-dark {
2721
- --bs-btn-color: #fff;
2722
- --bs-btn-bg: #212529;
2723
- --bs-btn-border-color: #212529;
2724
- --bs-btn-hover-color: #fff;
2725
- --bs-btn-hover-bg: rgb(26%, 27.3333333333%, 28.6666666667%);
2726
- --bs-btn-hover-border-color: rgb(21.6470588235%, 23.0588235294%, 24.4705882353%);
2727
- --bs-btn-focus-shadow-rgb: 66, 70, 73;
2728
- --bs-btn-active-color: #fff;
2729
- --bs-btn-active-bg: rgb(30.3529411765%, 31.6078431373%, 32.862745098%);
2730
- --bs-btn-active-border-color: rgb(21.6470588235%, 23.0588235294%, 24.4705882353%);
2731
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2732
- --bs-btn-disabled-color: #fff;
2733
- --bs-btn-disabled-bg: #212529;
2734
- --bs-btn-disabled-border-color: #212529;
2735
- }
2736
-
2737
- .btn-outline-primary {
2738
- --bs-btn-color: #0d6efd;
2739
- --bs-btn-border-color: #0d6efd;
2740
- --bs-btn-hover-color: #fff;
2741
- --bs-btn-hover-bg: #0d6efd;
2742
- --bs-btn-hover-border-color: #0d6efd;
2743
- --bs-btn-focus-shadow-rgb: 13, 110, 253;
2744
- --bs-btn-active-color: #fff;
2745
- --bs-btn-active-bg: #0d6efd;
2746
- --bs-btn-active-border-color: #0d6efd;
2747
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2748
- --bs-btn-disabled-color: #0d6efd;
2749
- --bs-btn-disabled-bg: transparent;
2750
- --bs-btn-disabled-border-color: #0d6efd;
2751
- --bs-gradient: none;
2752
- }
2753
-
2754
- .btn-outline-secondary {
2755
- --bs-btn-color: #6c757d;
2756
- --bs-btn-border-color: #6c757d;
2757
- --bs-btn-hover-color: #fff;
2758
- --bs-btn-hover-bg: #6c757d;
2759
- --bs-btn-hover-border-color: #6c757d;
2760
- --bs-btn-focus-shadow-rgb: 108, 117, 125;
2761
- --bs-btn-active-color: #fff;
2762
- --bs-btn-active-bg: #6c757d;
2763
- --bs-btn-active-border-color: #6c757d;
2764
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2765
- --bs-btn-disabled-color: #6c757d;
2766
- --bs-btn-disabled-bg: transparent;
2767
- --bs-btn-disabled-border-color: #6c757d;
2768
- --bs-gradient: none;
2769
- }
2770
-
2771
- .btn-outline-success {
2772
- --bs-btn-color: #198754;
2773
- --bs-btn-border-color: #198754;
2774
- --bs-btn-hover-color: #fff;
2775
- --bs-btn-hover-bg: #198754;
2776
- --bs-btn-hover-border-color: #198754;
2777
- --bs-btn-focus-shadow-rgb: 25, 135, 84;
2778
- --bs-btn-active-color: #fff;
2779
- --bs-btn-active-bg: #198754;
2780
- --bs-btn-active-border-color: #198754;
2781
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2782
- --bs-btn-disabled-color: #198754;
2783
- --bs-btn-disabled-bg: transparent;
2784
- --bs-btn-disabled-border-color: #198754;
2785
- --bs-gradient: none;
2786
- }
2787
-
2788
- .btn-outline-info {
2789
- --bs-btn-color: #0dcaf0;
2790
- --bs-btn-border-color: #0dcaf0;
2791
- --bs-btn-hover-color: #000;
2792
- --bs-btn-hover-bg: #0dcaf0;
2793
- --bs-btn-hover-border-color: #0dcaf0;
2794
- --bs-btn-focus-shadow-rgb: 13, 202, 240;
2795
- --bs-btn-active-color: #000;
2796
- --bs-btn-active-bg: #0dcaf0;
2797
- --bs-btn-active-border-color: #0dcaf0;
2798
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2799
- --bs-btn-disabled-color: #0dcaf0;
2800
- --bs-btn-disabled-bg: transparent;
2801
- --bs-btn-disabled-border-color: #0dcaf0;
2802
- --bs-gradient: none;
2803
- }
2804
-
2805
- .btn-outline-warning {
2806
- --bs-btn-color: #ffc107;
2807
- --bs-btn-border-color: #ffc107;
2808
- --bs-btn-hover-color: #000;
2809
- --bs-btn-hover-bg: #ffc107;
2810
- --bs-btn-hover-border-color: #ffc107;
2811
- --bs-btn-focus-shadow-rgb: 255, 193, 7;
2812
- --bs-btn-active-color: #000;
2813
- --bs-btn-active-bg: #ffc107;
2814
- --bs-btn-active-border-color: #ffc107;
2815
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2816
- --bs-btn-disabled-color: #ffc107;
2817
- --bs-btn-disabled-bg: transparent;
2818
- --bs-btn-disabled-border-color: #ffc107;
2819
- --bs-gradient: none;
2820
- }
2821
-
2822
- .btn-outline-danger {
2823
- --bs-btn-color: #dc3545;
2824
- --bs-btn-border-color: #dc3545;
2825
- --bs-btn-hover-color: #fff;
2826
- --bs-btn-hover-bg: #dc3545;
2827
- --bs-btn-hover-border-color: #dc3545;
2828
- --bs-btn-focus-shadow-rgb: 220, 53, 69;
2829
- --bs-btn-active-color: #fff;
2830
- --bs-btn-active-bg: #dc3545;
2831
- --bs-btn-active-border-color: #dc3545;
2832
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2833
- --bs-btn-disabled-color: #dc3545;
2834
- --bs-btn-disabled-bg: transparent;
2835
- --bs-btn-disabled-border-color: #dc3545;
2836
- --bs-gradient: none;
2837
- }
2838
-
2839
- .btn-outline-light {
2840
- --bs-btn-color: #f8f9fa;
2841
- --bs-btn-border-color: #f8f9fa;
2842
- --bs-btn-hover-color: #000;
2843
- --bs-btn-hover-bg: #f8f9fa;
2844
- --bs-btn-hover-border-color: #f8f9fa;
2845
- --bs-btn-focus-shadow-rgb: 248, 249, 250;
2846
- --bs-btn-active-color: #000;
2847
- --bs-btn-active-bg: #f8f9fa;
2848
- --bs-btn-active-border-color: #f8f9fa;
2849
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2850
- --bs-btn-disabled-color: #f8f9fa;
2851
- --bs-btn-disabled-bg: transparent;
2852
- --bs-btn-disabled-border-color: #f8f9fa;
2853
- --bs-gradient: none;
2854
- }
2855
-
2856
- .btn-outline-dark {
2857
- --bs-btn-color: #212529;
2858
- --bs-btn-border-color: #212529;
2859
- --bs-btn-hover-color: #fff;
2860
- --bs-btn-hover-bg: #212529;
2861
- --bs-btn-hover-border-color: #212529;
2862
- --bs-btn-focus-shadow-rgb: 33, 37, 41;
2863
- --bs-btn-active-color: #fff;
2864
- --bs-btn-active-bg: #212529;
2865
- --bs-btn-active-border-color: #212529;
2866
- --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
2867
- --bs-btn-disabled-color: #212529;
2868
- --bs-btn-disabled-bg: transparent;
2869
- --bs-btn-disabled-border-color: #212529;
2870
- --bs-gradient: none;
2871
- }
2872
-
2873
- .btn-link {
2874
- --bs-btn-font-weight: 400;
2875
- --bs-btn-color: var(--bs-link-color);
2876
- --bs-btn-bg: transparent;
2877
- --bs-btn-border-color: transparent;
2878
- --bs-btn-hover-color: var(--bs-link-hover-color);
2879
- --bs-btn-hover-border-color: transparent;
2880
- --bs-btn-active-color: var(--bs-link-hover-color);
2881
- --bs-btn-active-border-color: transparent;
2882
- --bs-btn-disabled-color: #6c757d;
2883
- --bs-btn-disabled-border-color: transparent;
2884
- --bs-btn-box-shadow: 0 0 0 #000;
2885
- --bs-btn-focus-shadow-rgb: 49, 132, 253;
2886
- text-decoration: underline;
2887
- }
2888
- .btn-link:focus-visible {
2889
- color: var(--bs-btn-color);
2890
- }
2891
- .btn-link:hover {
2892
- color: var(--bs-btn-hover-color);
2893
- }
2894
-
2895
- .btn-lg {
2896
- --bs-btn-padding-y: 0.5rem;
2897
- --bs-btn-padding-x: 1rem;
2898
- --bs-btn-font-size: 1.25rem;
2899
- --bs-btn-border-radius: var(--bs-border-radius-lg);
2900
- }
2901
-
2902
- .btn-sm {
2903
- --bs-btn-padding-y: 0.25rem;
2904
- --bs-btn-padding-x: 0.5rem;
2905
- --bs-btn-font-size: 0.875rem;
2906
- --bs-btn-border-radius: var(--bs-border-radius-sm);
2907
- }
2908
-
2909
- .form-control {
2910
- display: block;
2911
- width: 100%;
2912
- padding: 0.375rem 0.75rem;
2913
- font-size: 1rem;
2914
- font-weight: 400;
2915
- line-height: 1.5;
2916
- color: var(--bs-body-color);
2917
- appearance: none;
2918
- background-color: var(--bs-body-bg);
2919
- background-clip: padding-box;
2920
- border: var(--bs-border-width) solid var(--bs-border-color);
2921
- border-radius: var(--bs-border-radius);
2922
- transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
1401
+ const O = P(
1402
+ Symbol("mp-query-builder.editorRegistry")
1403
+ ), S = P(
1404
+ Symbol("mp-query-builder.disabled")
1405
+ ), k = P(
1406
+ Symbol("mp-query-builder.messages")
1407
+ ), V = P(
1408
+ Symbol("mp-query-builder.maxDepth")
1409
+ );
1410
+ function R(o, e, t, r, n = {}) {
1411
+ const i = document.createElement("input");
1412
+ i.type = o, i.className = "form-control form-control-sm qb-editor-input", i.value = e, r && (i.disabled = !0);
1413
+ for (const [a, d] of Object.entries(n))
1414
+ d !== void 0 && i.setAttribute(a, d);
1415
+ const s = () => t(i.value);
1416
+ return i.addEventListener("input", s), i.addEventListener("change", s), i;
1417
+ }
1418
+ function oe(o, e) {
1419
+ return o == null ? "" : e === "date" && o instanceof Date ? o.toISOString().slice(0, 10) : e === "datetime" && o instanceof Date ? o.toISOString().slice(0, 16) : typeof o == "string" && (e === "date" || e === "datetime") ? e === "date" ? o.slice(0, 10) : o.slice(0, 16) : String(o);
2923
1420
  }
2924
- @media (prefers-reduced-motion: reduce) {
2925
- .form-control {
2926
- transition: none;
1421
+ function ne(o, e) {
1422
+ if (o === "") return null;
1423
+ switch (e) {
1424
+ case "number":
1425
+ return Number(o);
1426
+ case "integer":
1427
+ return Number.parseInt(o, 10);
1428
+ case "date":
1429
+ case "datetime":
1430
+ return o;
1431
+ // Keep as ISO string; backend parses.
1432
+ default:
1433
+ return o;
2927
1434
  }
2928
1435
  }
2929
- .form-control[type=file] {
2930
- overflow: hidden;
2931
- }
2932
- .form-control[type=file]:not(:disabled):not([readonly]) {
2933
- cursor: pointer;
2934
- }
2935
- .form-control:focus {
2936
- color: var(--bs-body-color);
2937
- background-color: var(--bs-body-bg);
2938
- border-color: rgb(52.5490196078%, 71.568627451%, 99.6078431373%);
2939
- outline: 0;
2940
- box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
1436
+ function _(o) {
1437
+ return (e) => {
1438
+ const t = o === "string" ? "text" : o === "date" ? "date" : o === "datetime" ? "datetime-local" : "number", r = {};
1439
+ o === "integer" && (r.step = "1"), o === "number" && (r.step = "any");
1440
+ const n = oe(e.value, o), i = R(
1441
+ t,
1442
+ n,
1443
+ (s) => e.onChange(ne(s, o)),
1444
+ e.disabled,
1445
+ r
1446
+ );
1447
+ return i.setAttribute("aria-label", e.field.label), { element: i };
1448
+ };
2941
1449
  }
2942
- .form-control::-webkit-date-and-time-value {
2943
- min-width: 85px;
2944
- height: 1.5em;
2945
- margin: 0;
1450
+ function X(o) {
1451
+ return (e) => {
1452
+ const t = document.createElement("span");
1453
+ t.className = "qb-editor-tuple";
1454
+ const [r, n] = Array.isArray(e.value) ? [e.value[0] ?? null, e.value[1] ?? null] : [null, null], i = (m, F) => {
1455
+ const U = Array.isArray(e.value) ? [e.value[0] ?? null, e.value[1] ?? null] : [null, null];
1456
+ U[m] = ne(F, o), e.onChange(U);
1457
+ }, s = (m) => oe(m, o), a = o === "date" ? "date" : o === "datetime" ? "datetime-local" : "number", d = {};
1458
+ o === "integer" && (d.step = "1"), o === "number" && (d.step = "any");
1459
+ const l = R(a, s(r), (m) => i(0, m), e.disabled, d), u = R(a, s(n), (m) => i(1, m), e.disabled, d);
1460
+ l.setAttribute("aria-label", `${e.field.label} (from)`), u.setAttribute("aria-label", `${e.field.label} (to)`);
1461
+ const p = document.createElement("span");
1462
+ return p.textContent = " … ", p.className = "qb-editor-tuple-sep", t.append(l, p, u), { element: t };
1463
+ };
2946
1464
  }
2947
- .form-control::-webkit-datetime-edit {
2948
- display: block;
2949
- padding: 0;
1465
+ function Fe() {
1466
+ return (o) => {
1467
+ const e = typeof o.value == "object" && o.value !== null ? String(o.value.n ?? 1) : "1", t = R(
1468
+ "number",
1469
+ e,
1470
+ (r) => {
1471
+ const n = Math.max(1, Number.parseInt(r, 10) || 1);
1472
+ o.onChange({ n });
1473
+ },
1474
+ o.disabled,
1475
+ { min: "1", step: "1" }
1476
+ );
1477
+ return t.classList.add("qb-editor-n-input"), t.setAttribute("aria-label", `${o.field.label} — number of days`), { element: t };
1478
+ };
2950
1479
  }
2951
- .form-control::placeholder {
2952
- color: var(--bs-secondary-color);
2953
- opacity: 1;
1480
+ function Ie(o) {
1481
+ return (e) => {
1482
+ const t = document.createElement("select");
1483
+ t.className = "form-select form-select-sm qb-editor-select", t.setAttribute("aria-label", e.field.label), e.disabled && (t.disabled = !0);
1484
+ const r = document.createElement("option");
1485
+ r.value = "", r.textContent = "—", t.appendChild(r);
1486
+ for (const n of o) {
1487
+ const i = document.createElement("option");
1488
+ i.value = String(n.value), i.textContent = n.label, e.value === n.value && (i.selected = !0), t.appendChild(i);
1489
+ }
1490
+ return t.addEventListener("change", () => {
1491
+ if (t.value === "") {
1492
+ e.onChange(null);
1493
+ return;
1494
+ }
1495
+ const n = o.find((i) => String(i.value) === t.value);
1496
+ e.onChange(n?.value ?? t.value);
1497
+ }), { element: t };
1498
+ };
2954
1499
  }
2955
- .form-control:disabled {
2956
- background-color: var(--bs-secondary-bg);
2957
- opacity: 1;
1500
+ function Ne(o) {
1501
+ return (e) => {
1502
+ const t = document.createElement("select");
1503
+ t.className = "form-select form-select-sm qb-editor-multiselect", t.multiple = !0, t.setAttribute("aria-label", e.field.label), e.disabled && (t.disabled = !0);
1504
+ const r = Array.isArray(e.value) ? e.value : [];
1505
+ for (const n of o) {
1506
+ const i = document.createElement("option");
1507
+ i.value = String(n.value), i.textContent = n.label, r.includes(n.value) && (i.selected = !0), t.appendChild(i);
1508
+ }
1509
+ return t.addEventListener("change", () => {
1510
+ const n = Array.from(t.selectedOptions).map((i) => o.find((a) => String(a.value) === i.value)?.value ?? i.value);
1511
+ e.onChange(n);
1512
+ }), { element: t };
1513
+ };
2958
1514
  }
2959
- .form-control::file-selector-button {
2960
- padding: 0.375rem 0.75rem;
2961
- margin: -0.375rem -0.75rem;
2962
- margin-inline-end: 0.75rem;
2963
- color: var(--bs-body-color);
2964
- background-color: var(--bs-tertiary-bg);
2965
- pointer-events: none;
2966
- border-color: inherit;
2967
- border-style: solid;
2968
- border-width: 0;
2969
- border-inline-end-width: var(--bs-border-width);
2970
- border-radius: 0;
2971
- transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
1515
+ function Y(o) {
1516
+ return (e) => {
1517
+ const t = document.createElement("span");
1518
+ return t.className = "qb-editor-chip-input", (() => {
1519
+ t.innerHTML = "";
1520
+ const n = Array.isArray(e.value) ? e.value : [];
1521
+ for (let s = 0; s < n.length; s++) {
1522
+ const a = n[s], d = document.createElement("span");
1523
+ d.className = "qb-editor-chip", d.textContent = String(a);
1524
+ const l = document.createElement("button");
1525
+ l.type = "button", l.className = "qb-editor-chip-remove", l.setAttribute("aria-label", `Remove ${String(a)}`), l.textContent = "×", e.disabled && (l.disabled = !0), l.addEventListener("click", () => {
1526
+ const u = (Array.isArray(e.value) ? e.value : []).filter((p, m) => m !== s);
1527
+ e.onChange(u);
1528
+ }), d.appendChild(l), t.appendChild(d);
1529
+ }
1530
+ const i = document.createElement("input");
1531
+ i.type = "text", i.className = "form-control form-control-sm qb-editor-chip-add", i.placeholder = "+ add", i.size = 8, i.setAttribute("aria-label", `${e.field.label} — add value`), e.disabled && (i.disabled = !0), i.addEventListener("keydown", (s) => {
1532
+ if (s.key === "Enter" && i.value.trim() !== "") {
1533
+ s.preventDefault();
1534
+ const a = o(i.value.trim()), d = [...Array.isArray(e.value) ? e.value : [], a];
1535
+ i.value = "", e.onChange(d);
1536
+ }
1537
+ }), t.appendChild(i);
1538
+ })(), {
1539
+ element: t,
1540
+ dispose: () => {
1541
+ }
1542
+ };
1543
+ };
2972
1544
  }
2973
- @media (prefers-reduced-motion: reduce) {
2974
- .form-control::file-selector-button {
2975
- transition: none;
1545
+ function ze(o, e) {
1546
+ const t = h(e);
1547
+ if (t === "null") return null;
1548
+ if (t === "n-input") return Fe();
1549
+ if (t === "tuple") {
1550
+ const r = o.type;
1551
+ return X(r === "number" || r === "integer" || r === "date" || r === "datetime" ? r : "number");
2976
1552
  }
1553
+ return t === "array" ? o.options && o.options.length > 0 ? Ne(o.options) : o.type === "number" || o.type === "integer" ? Y(
1554
+ (r) => o.type === "integer" ? Number.parseInt(r, 10) : Number(r)
1555
+ ) : Y((r) => r) : o.type === "enum" && o.options && o.options.length > 0 ? Ie(o.options) : o.type === "string" ? _("string") : o.type === "number" ? _("number") : o.type === "integer" ? _("integer") : o.type === "date" ? _("date") : o.type === "datetime" ? _("datetime") : null;
2977
1556
  }
2978
- .form-control:hover:not(:disabled):not([readonly])::file-selector-button {
2979
- background-color: var(--bs-secondary-bg);
2980
- }
2981
-
2982
- .form-control-plaintext {
2983
- display: block;
2984
- width: 100%;
2985
- padding: 0.375rem 0;
2986
- margin-bottom: 0;
2987
- line-height: 1.5;
2988
- color: var(--bs-body-color);
2989
- background-color: transparent;
2990
- border: solid transparent;
2991
- border-width: var(--bs-border-width) 0;
2992
- }
2993
- .form-control-plaintext:focus {
2994
- outline: 0;
2995
- }
2996
- .form-control-plaintext.form-control-sm, .form-control-plaintext.form-control-lg {
2997
- padding-right: 0;
2998
- padding-left: 0;
2999
- }
3000
-
3001
- .form-control-sm {
3002
- min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
3003
- padding: 0.25rem 0.5rem;
3004
- font-size: 0.875rem;
3005
- border-radius: var(--bs-border-radius-sm);
3006
- }
3007
- .form-control-sm::file-selector-button {
3008
- padding: 0.25rem 0.5rem;
3009
- margin: -0.25rem -0.5rem;
3010
- margin-inline-end: 0.5rem;
3011
- }
3012
-
3013
- .form-control-lg {
3014
- min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
3015
- padding: 0.5rem 1rem;
3016
- font-size: 1.25rem;
3017
- border-radius: var(--bs-border-radius-lg);
3018
- }
3019
- .form-control-lg::file-selector-button {
3020
- padding: 0.5rem 1rem;
3021
- margin: -0.5rem -1rem;
3022
- margin-inline-end: 1rem;
3023
- }
3024
-
3025
- textarea.form-control {
3026
- min-height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
3027
- }
3028
- textarea.form-control-sm {
3029
- min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
3030
- }
3031
- textarea.form-control-lg {
3032
- min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
3033
- }
3034
-
3035
- .form-control-color {
3036
- width: 3rem;
3037
- height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
3038
- padding: 0.375rem;
3039
- }
3040
- .form-control-color:not(:disabled):not([readonly]) {
3041
- cursor: pointer;
3042
- }
3043
- .form-control-color::-moz-color-swatch {
3044
- border: 0 !important;
3045
- border-radius: var(--bs-border-radius);
3046
- }
3047
- .form-control-color::-webkit-color-swatch {
3048
- border: 0 !important;
3049
- border-radius: var(--bs-border-radius);
3050
- }
3051
- .form-control-color.form-control-sm {
3052
- height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
3053
- }
3054
- .form-control-color.form-control-lg {
3055
- height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
3056
- }
3057
-
3058
- :host {
3059
- display: block;
3060
- font-family: var(--bs-body-font-family, system-ui);
3061
- font-size: var(--bs-body-font-size, 1rem);
3062
- color: var(--bs-body-color, currentColor);
3063
- }
3064
-
3065
- .qb-root {
3066
- border: 1px solid var(--bs-border-color, #dee2e6);
3067
- border-radius: var(--bs-border-radius, 0.375rem);
3068
- padding: 0.5rem;
3069
- background: var(--bs-body-bg, transparent);
3070
- }
3071
-
3072
- .qb-toolbar {
3073
- display: flex;
3074
- flex-wrap: wrap;
3075
- gap: 0.75rem;
3076
- align-items: center;
3077
- margin-bottom: 0.5rem;
3078
- padding: 0.5rem;
3079
- background: var(--bs-tertiary-bg, #f8f9fa);
3080
- border: 1px solid var(--bs-border-color, #dee2e6);
3081
- border-radius: var(--bs-border-radius-sm, 0.25rem);
3082
- }
3083
-
3084
- .qb-toolbar-label {
3085
- display: inline-flex;
3086
- align-items: center;
3087
- gap: 0.375rem;
3088
- font-size: 0.875rem;
3089
- font-weight: 500;
3090
- margin: 0;
3091
- }
3092
-
3093
- .qb-entity-picker {
3094
- width: auto;
3095
- min-width: 8rem;
3096
- }
3097
-
3098
- .qb-toolbar-section {
3099
- display: inline-flex;
3100
- flex-wrap: wrap;
3101
- gap: 0.5rem;
3102
- align-items: center;
3103
- }
3104
-
3105
- .qb-field-checkbox {
3106
- display: inline-flex;
3107
- align-items: center;
3108
- gap: 0.25rem;
3109
- font-size: 0.875rem;
3110
- font-weight: 400;
3111
- margin: 0;
3112
- cursor: pointer;
3113
- }
3114
- .qb-field-checkbox input[type=checkbox] {
3115
- margin: 0;
3116
- }
3117
-
3118
- .qb-sort-row {
3119
- display: inline-flex;
3120
- align-items: center;
3121
- gap: 0.25rem;
3122
- font-size: 0.875rem;
3123
- }
3124
- .qb-sort-row .qb-sort-field,
3125
- .qb-sort-row .qb-sort-direction {
3126
- width: auto;
3127
- }
3128
- .qb-sort-row .qb-sort-field {
3129
- min-width: 6rem;
3130
- }
3131
- .qb-sort-row .qb-sort-direction {
3132
- min-width: 4.5rem;
3133
- }
3134
- .qb-sort-row .qb-sort-remove {
3135
- padding: 0 0.375rem;
3136
- line-height: 1;
3137
- color: var(--bs-danger, #dc3545);
3138
- }
3139
-
3140
- .qb-sort-add {
3141
- --bs-btn-color: #646b72;
3142
- }
3143
-
3144
- .qb-too-deep {
3145
- padding: 0.5rem;
3146
- color: var(--bs-warning-text-emphasis, #997404);
3147
- background: var(--bs-warning-bg-subtle, #fff3cd);
3148
- border: 1px solid var(--bs-warning-border-subtle, #ffe69c);
3149
- border-radius: var(--bs-border-radius, 0.375rem);
3150
- font-style: italic;
3151
- }
3152
-
3153
- .qb-saved {
3154
- display: flex;
3155
- flex-wrap: wrap;
3156
- gap: 0.5rem;
3157
- align-items: center;
3158
- margin-bottom: 0.5rem;
3159
- padding: 0.5rem;
3160
- background: var(--bs-tertiary-bg, #f8f9fa);
3161
- border: 1px solid var(--bs-border-color, #dee2e6);
3162
- border-radius: var(--bs-border-radius-sm, 0.25rem);
3163
- }
3164
-
3165
- .qb-saved-list {
3166
- display: flex;
3167
- flex-wrap: wrap;
3168
- gap: 0.5rem;
3169
- }
3170
-
3171
- .qb-saved-row {
3172
- display: inline-flex;
3173
- align-items: center;
3174
- gap: 0.125rem;
1557
+ const q = M("query-condition");
1558
+ class Oe extends L {
1559
+ constructor() {
1560
+ super(...arguments), this.node = null, this.schema = [], this.currentEntity = "", this._messagesConsumer = new f(this, {
1561
+ context: k,
1562
+ subscribe: !0
1563
+ }), this._disabledConsumer = new f(this, {
1564
+ context: S,
1565
+ subscribe: !0
1566
+ }), this._registryConsumer = new f(this, {
1567
+ context: O,
1568
+ subscribe: !0
1569
+ }), this._editorMount = ie(), this._currentHandle = null, this._editorKey = "", this._registryTokens = /* @__PURE__ */ new WeakMap(), this._nextRegistryToken = 1, this._onFieldChange = (e) => {
1570
+ const t = e.target, r = this.node;
1571
+ r && this.dispatchEvent(new CustomEvent("condition-field-change", {
1572
+ detail: { id: r.id, field: t.value },
1573
+ bubbles: !0,
1574
+ composed: !0
1575
+ }));
1576
+ }, this._onOperatorChange = (e) => {
1577
+ const t = e.target, r = this.node;
1578
+ r && this.dispatchEvent(new CustomEvent("condition-operator-change", {
1579
+ detail: { id: r.id, operator: t.value },
1580
+ bubbles: !0,
1581
+ composed: !0
1582
+ }));
1583
+ }, this._onRemove = () => {
1584
+ const e = this.node;
1585
+ e && this.dispatchEvent(new CustomEvent("node-remove", {
1586
+ detail: { id: e.id },
1587
+ bubbles: !0,
1588
+ composed: !0
1589
+ }));
1590
+ }, this._onRowKeyDown = (e) => {
1591
+ if (!e.altKey || e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
1592
+ const t = this.node;
1593
+ if (!t || this.isDisabled()) return;
1594
+ const r = this.renderRoot?.querySelector(".qb-condition"), n = e.composedPath()[0], i = n instanceof HTMLElement && n.classList.contains("qb-drag-handle");
1595
+ n !== r && !i || (e.preventDefault(), this.dispatchEvent(new CustomEvent("qb-keyboard-move", {
1596
+ detail: { id: t.id, direction: e.key === "ArrowUp" ? "up" : "down" },
1597
+ bubbles: !0,
1598
+ composed: !0
1599
+ })));
1600
+ }, this._onDragPointerDown = (e) => {
1601
+ if (this.isDisabled()) return;
1602
+ const t = this.node;
1603
+ if (!t) return;
1604
+ const r = this.renderRoot?.querySelector(".qb-condition");
1605
+ r && this.dispatchEvent(new CustomEvent("qb-drag-start", {
1606
+ detail: {
1607
+ id: t.id,
1608
+ pointerId: e.pointerId,
1609
+ clientX: e.clientX,
1610
+ clientY: e.clientY,
1611
+ rowElement: r
1612
+ },
1613
+ bubbles: !0,
1614
+ composed: !0
1615
+ }));
1616
+ };
1617
+ }
1618
+ createRenderRoot() {
1619
+ return this;
1620
+ }
1621
+ static {
1622
+ this.properties = {
1623
+ node: { attribute: !1 },
1624
+ schema: { attribute: !1 },
1625
+ currentEntity: { attribute: !1 }
1626
+ };
1627
+ }
1628
+ _registryIdentityToken(e) {
1629
+ if (!e) return 0;
1630
+ const t = this._registryTokens.get(e);
1631
+ if (t !== void 0) return t;
1632
+ const r = this._nextRegistryToken++;
1633
+ return this._registryTokens.set(e, r), r;
1634
+ }
1635
+ disconnectedCallback() {
1636
+ super.disconnectedCallback(), this._disposeEditor();
1637
+ }
1638
+ _disposeEditor() {
1639
+ const e = this._currentHandle;
1640
+ if (e) {
1641
+ try {
1642
+ e.dispose?.();
1643
+ } catch {
1644
+ }
1645
+ e.element.remove(), this._currentHandle = null;
1646
+ }
1647
+ }
1648
+ resolveField(e) {
1649
+ return this.schema.find((t) => t.name === this.currentEntity)?.fields.find((t) => t.name === e);
1650
+ }
1651
+ messages() {
1652
+ const e = this._messagesConsumer.value ?? {};
1653
+ return {
1654
+ ...y,
1655
+ ...e,
1656
+ operators: { ...y.operators, ...e.operators ?? {} }
1657
+ };
1658
+ }
1659
+ isDisabled() {
1660
+ return this._disabledConsumer.value ?? !1;
1661
+ }
1662
+ updated(e) {
1663
+ this._refreshEditor();
1664
+ }
1665
+ _refreshEditor() {
1666
+ const e = this._editorMount.value;
1667
+ if (!e) return;
1668
+ const t = this.node;
1669
+ if (!t) {
1670
+ this._disposeEditor();
1671
+ return;
1672
+ }
1673
+ const r = this.resolveField(t.field);
1674
+ if (!r) {
1675
+ this._disposeEditor();
1676
+ return;
1677
+ }
1678
+ if (h(t.operator) === "null") {
1679
+ this._disposeEditor();
1680
+ return;
1681
+ }
1682
+ const i = this.isDisabled(), s = this._registryConsumer.value, a = s?.[r.name], d = a ? `r${this._registryIdentityToken(s)}` : "b", l = `${r.name}|${t.operator}|${i ? "1" : "0"}|${d}`;
1683
+ if (this._currentHandle && l === this._editorKey) return;
1684
+ this._disposeEditor();
1685
+ const u = a ?? ze(r, t.operator);
1686
+ if (!u) return;
1687
+ const p = {
1688
+ field: r,
1689
+ operator: t.operator,
1690
+ value: t.value,
1691
+ disabled: i,
1692
+ onChange: (F) => {
1693
+ this.dispatchEvent(new CustomEvent("condition-value-change", {
1694
+ detail: { id: t.id, value: F },
1695
+ bubbles: !0,
1696
+ composed: !0
1697
+ }));
1698
+ }
1699
+ }, m = u(p);
1700
+ e.appendChild(m.element), this._currentHandle = m, this._editorKey = l;
1701
+ }
1702
+ _availableFields() {
1703
+ return this.schema.find((e) => e.name === this.currentEntity)?.fields.filter((e) => e.type !== "relation") ?? [];
1704
+ }
1705
+ _availableOperators(e) {
1706
+ return e ? w(e.type) : [];
1707
+ }
1708
+ render() {
1709
+ const e = this.node;
1710
+ if (!e) return c;
1711
+ const t = this.resolveField(e.field), r = this.messages(), n = h(e.operator), i = this.isDisabled(), s = this._availableFields(), a = this._availableOperators(t);
1712
+ return q`
1713
+ <div
1714
+ class="qb-condition"
1715
+ tabindex="0"
1716
+ role="group"
1717
+ aria-label=${// The row is a tab stop (Alt+Up/Down reorder) — without a role and
1718
+ // name a blind user lands on silence. The name tracks the row's
1719
+ // current field + operator, re-derived every render (§11a).
1720
+ `${t?.label ?? e.field} ${r.operators[e.operator] ?? e.operator}`}
1721
+ data-row-id=${e.id}
1722
+ @keydown=${this._onRowKeyDown}
1723
+ >
1724
+ <button
1725
+ type="button"
1726
+ class="qb-drag-handle"
1727
+ ?disabled=${i}
1728
+ aria-label=${r.reorderHint}
1729
+ title=${r.reorderHint}
1730
+ @pointerdown=${this._onDragPointerDown}
1731
+ >⋮</button>
1732
+ <mp-select
1733
+ class="qb-field-select"
1734
+ size="sm"
1735
+ .value=${e.field}
1736
+ ?disabled=${i}
1737
+ @change=${this._onFieldChange}
1738
+ aria-label=${r.field}
1739
+ >
1740
+ ${s.map((d) => q`<option value=${d.name}>${d.label}</option>`)}
1741
+ ${t ? c : q`<option value=${e.field}>(${e.field})</option>`}
1742
+ </mp-select>
1743
+ <mp-select
1744
+ class="qb-operator-select"
1745
+ size="sm"
1746
+ .value=${e.operator}
1747
+ ?disabled=${i || !t}
1748
+ @change=${this._onOperatorChange}
1749
+ aria-label=${r.operator}
1750
+ >
1751
+ ${a.map((d) => q`
1752
+ <option value=${d}>${r.operators[d] ?? d}</option>
1753
+ `)}
1754
+ ${a.includes(e.operator) ? c : q`<option value=${e.operator}>${e.operator}</option>`}
1755
+ </mp-select>
1756
+ ${n === "null" ? c : q`<span class="qb-value" ${se(this._editorMount)}></span>`}
1757
+ <button
1758
+ type="button"
1759
+ class="btn btn-sm btn-link qb-remove"
1760
+ ?disabled=${i}
1761
+ @click=${this._onRemove}
1762
+ aria-label=${r.removeRow}
1763
+ title=${r.removeRow}
1764
+ >×</button>
1765
+ </div>
1766
+ `;
1767
+ }
3175
1768
  }
3176
-
3177
- .qb-saved-new {
3178
- display: inline-flex;
3179
- align-items: center;
3180
- gap: 0.25rem;
3181
- margin-left: auto;
1769
+ T("query-condition", Re);
1770
+ typeof customElements < "u" && !customElements.get("mp-query-condition") && customElements.define("mp-query-condition", Oe);
1771
+ const K = M("query-subquery");
1772
+ class Qe extends L {
1773
+ constructor() {
1774
+ super(...arguments), this.node = null, this.schema = [], this.currentEntity = "", this.depth = 0, this.qbRoot = "", this.isDragging = !1, this._messagesConsumer = new f(this, {
1775
+ context: k,
1776
+ subscribe: !0
1777
+ }), this._onHeaderKeyDown = (e) => {
1778
+ if (!e.altKey || e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
1779
+ const t = this.node;
1780
+ if (!t) return;
1781
+ const r = this.renderRoot?.querySelector(".qb-subquery-header");
1782
+ e.composedPath()[0] === r && (e.preventDefault(), this.dispatchEvent(new CustomEvent("qb-keyboard-move", {
1783
+ detail: { id: t.id, direction: e.key === "ArrowUp" ? "up" : "down" },
1784
+ bubbles: !0,
1785
+ composed: !0
1786
+ })));
1787
+ };
1788
+ }
1789
+ createRenderRoot() {
1790
+ return this;
1791
+ }
1792
+ static {
1793
+ this.properties = {
1794
+ node: { attribute: !1 },
1795
+ schema: { attribute: !1 },
1796
+ currentEntity: { attribute: !1 },
1797
+ depth: { attribute: !1 },
1798
+ qbRoot: { attribute: !1 },
1799
+ isDragging: { attribute: !1 }
1800
+ };
1801
+ }
1802
+ resolveField(e) {
1803
+ return this.schema.find((t) => t.name === this.currentEntity)?.fields.find((t) => t.name === e);
1804
+ }
1805
+ messages() {
1806
+ const e = this._messagesConsumer.value ?? {};
1807
+ return {
1808
+ ...y,
1809
+ ...e,
1810
+ operators: { ...y.operators, ...e.operators ?? {} }
1811
+ };
1812
+ }
1813
+ render() {
1814
+ const e = this.node;
1815
+ if (!e) return c;
1816
+ const t = this.resolveField(e.field), r = this.messages(), n = t?.label ?? e.field, i = r.operators[e.operator] ?? e.operator, s = t?.targetEntity ?? "";
1817
+ return K`
1818
+ <div class="qb-subquery" data-row-id=${e.id}>
1819
+ <div
1820
+ class="qb-subquery-header"
1821
+ tabindex="0"
1822
+ role="group"
1823
+ aria-label=${// Focusable reorder stop — role + a name mirroring the visible
1824
+ // field/operator/target text, re-derived every render (§11a).
1825
+ `${n} ${i}${s ? ` ${s}` : ""}`}
1826
+ @keydown=${this._onHeaderKeyDown}
1827
+ >
1828
+ <span class="qb-subquery-field">${n}</span>
1829
+ <span class="qb-subquery-operator">${i}</span>
1830
+ ${s ? K`<span class="qb-subquery-target">(${s})</span>` : c}
1831
+ </div>
1832
+ <mp-query-builder
1833
+ .query=${e.subQuery}
1834
+ .schema=${this.schema}
1835
+ .rootEntity=${s}
1836
+ .depth=${this.depth + 1}
1837
+ ></mp-query-builder>
1838
+ </div>
1839
+ `;
1840
+ }
3182
1841
  }
3183
-
3184
- .qb-saved-empty {
3185
- color: var(--bs-secondary-color, #6c757d);
3186
- font-style: italic;
3187
- font-size: 0.875rem;
1842
+ T("query-subquery", Le);
1843
+ typeof customElements < "u" && !customElements.get("mp-query-subquery") && customElements.define("mp-query-subquery", Qe);
1844
+ const g = M("query-group");
1845
+ class He extends L {
1846
+ constructor() {
1847
+ super(...arguments), this.node = null, this.schema = [], this.currentEntity = "", this.depth = 0, this.isRoot = !1, this.qbRoot = "", this.isDragging = !1, this._messagesConsumer = new f(this, {
1848
+ context: k,
1849
+ subscribe: !0
1850
+ }), this._disabledConsumer = new f(this, {
1851
+ context: S,
1852
+ subscribe: !0
1853
+ }), this._onLogicChange = (e) => {
1854
+ const t = this.node;
1855
+ !t || t.logic === e || this._emit("group-logic-change", { id: t.id, logic: e });
1856
+ }, this._onAddCondition = () => {
1857
+ this.node && this._emit("add-condition", { groupId: this.node.id });
1858
+ }, this._onAddGroup = () => {
1859
+ this.node && this._emit("add-group", { groupId: this.node.id });
1860
+ }, this._onAddSubquery = () => {
1861
+ this.node && this._emit("add-subquery", { groupId: this.node.id });
1862
+ }, this._onRemove = () => {
1863
+ this.node && this._emit("node-remove", { id: this.node.id });
1864
+ };
1865
+ }
1866
+ createRenderRoot() {
1867
+ return this;
1868
+ }
1869
+ static {
1870
+ this.properties = {
1871
+ node: { attribute: !1 },
1872
+ schema: { attribute: !1 },
1873
+ currentEntity: { attribute: !1 },
1874
+ depth: { attribute: !1 },
1875
+ isRoot: { attribute: !1 },
1876
+ qbRoot: { attribute: !1 },
1877
+ isDragging: { attribute: !1 }
1878
+ };
1879
+ }
1880
+ isDisabled() {
1881
+ return this._disabledConsumer.value ?? !1;
1882
+ }
1883
+ _hasRelation() {
1884
+ return (this.schema.find((e) => e.name === this.currentEntity)?.fields ?? []).some((e) => e.type === "relation" && !!e.targetEntity);
1885
+ }
1886
+ _emit(e, t) {
1887
+ this.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
1888
+ }
1889
+ messages() {
1890
+ const e = this._messagesConsumer.value ?? {};
1891
+ return {
1892
+ ...y,
1893
+ ...e,
1894
+ operators: { ...y.operators, ...e.operators ?? {} }
1895
+ };
1896
+ }
1897
+ renderChild(e) {
1898
+ switch (e.kind) {
1899
+ case "group":
1900
+ return g`<mp-query-group
1901
+ .node=${e}
1902
+ .schema=${this.schema}
1903
+ .currentEntity=${this.currentEntity}
1904
+ .depth=${this.depth + 1}
1905
+ .qbRoot=${this.qbRoot}
1906
+ .isDragging=${this.isDragging}
1907
+ ></mp-query-group>`;
1908
+ case "condition":
1909
+ return g`<mp-query-condition
1910
+ .node=${e}
1911
+ .schema=${this.schema}
1912
+ .currentEntity=${this.currentEntity}
1913
+ ></mp-query-condition>`;
1914
+ case "subquery":
1915
+ return g`<mp-query-subquery
1916
+ .node=${e}
1917
+ .schema=${this.schema}
1918
+ .currentEntity=${this.currentEntity}
1919
+ .depth=${this.depth + 1}
1920
+ .qbRoot=${this.qbRoot}
1921
+ .isDragging=${this.isDragging}
1922
+ ></mp-query-subquery>`;
1923
+ }
1924
+ }
1925
+ renderDropSlot(e) {
1926
+ return !this.isDragging || !this.node ? c : g`<div
1927
+ class="qb-drop-slot"
1928
+ data-drop-slot
1929
+ data-parent-id=${this.node.id}
1930
+ data-index=${String(e)}
1931
+ data-qb-root=${this.qbRoot}
1932
+ aria-hidden="true"
1933
+ ></div>`;
1934
+ }
1935
+ _renderChildrenWithSlots(e) {
1936
+ const t = [];
1937
+ this.isDragging && t.push(this.renderDropSlot(0));
1938
+ for (let r = 0; r < e.length; r++)
1939
+ t.push(this.renderChild(e[r])), this.isDragging && t.push(this.renderDropSlot(r + 1));
1940
+ return t;
1941
+ }
1942
+ _dropPlaceholder() {
1943
+ return g`<div
1944
+ class="qb-drop-slot qb-drop-slot-placeholder"
1945
+ data-drop-slot
1946
+ data-parent-id=${this.node?.id ?? ""}
1947
+ data-index="0"
1948
+ data-qb-root=${this.qbRoot}
1949
+ aria-hidden="true"
1950
+ >Drop here</div>`;
1951
+ }
1952
+ render() {
1953
+ const e = this.node;
1954
+ if (!e) return c;
1955
+ const t = this.messages(), r = this.isDisabled(), n = this._hasRelation();
1956
+ return g`
1957
+ <div
1958
+ class="qb-group"
1959
+ role="group"
1960
+ aria-label=${// Depth rides in the NAME: aria-level is not an allowed attribute
1961
+ // on role=group (axe aria-allowed-attr, serious) — it belongs to
1962
+ // treeitem/row/heading.
1963
+ `${e.logic === "and" ? "AND" : "OR"} group${this.depth > 0 ? `, level ${this.depth + 1}` : ""}`}
1964
+ >
1965
+ <div class="qb-group-header">
1966
+ <span class="qb-logic-toggle btn-group btn-group-sm" role="group" aria-label=${t.groupLogic}>
1967
+ <button
1968
+ type="button"
1969
+ class="btn ${e.logic === "and" ? "btn-primary" : "btn-outline-primary"} qb-logic-btn"
1970
+ ?disabled=${r}
1971
+ @click=${() => this._onLogicChange("and")}
1972
+ aria-pressed=${e.logic === "and"}
1973
+ >${t.logicAnd}</button>
1974
+ <button
1975
+ type="button"
1976
+ class="btn ${e.logic === "or" ? "btn-primary" : "btn-outline-primary"} qb-logic-btn"
1977
+ ?disabled=${r}
1978
+ @click=${() => this._onLogicChange("or")}
1979
+ aria-pressed=${e.logic === "or"}
1980
+ >${t.logicOr}</button>
1981
+ </span>
1982
+ <span class="qb-group-actions">
1983
+ <button
1984
+ type="button"
1985
+ class="btn btn-sm btn-outline-secondary qb-add-condition"
1986
+ ?disabled=${r}
1987
+ @click=${this._onAddCondition}
1988
+ >+ ${t.addCondition}</button>
1989
+ <button
1990
+ type="button"
1991
+ class="btn btn-sm btn-outline-secondary qb-add-group"
1992
+ ?disabled=${r}
1993
+ @click=${this._onAddGroup}
1994
+ >+ ${t.addGroup}</button>
1995
+ ${n ? g`<button
1996
+ type="button"
1997
+ class="btn btn-sm btn-outline-secondary qb-add-subquery"
1998
+ ?disabled=${r}
1999
+ @click=${this._onAddSubquery}
2000
+ >+ ${t.addSubquery}</button>` : c}
2001
+ ${this.isRoot ? c : g`<button
2002
+ type="button"
2003
+ class="btn btn-sm btn-link qb-remove-group"
2004
+ ?disabled=${r}
2005
+ @click=${this._onRemove}
2006
+ aria-label=${t.removeGroup}
2007
+ title=${t.removeGroup}
2008
+ >×</button>`}
2009
+ </span>
2010
+ </div>
2011
+ <div class="qb-children">
2012
+ ${e.children.length === 0 ? g`<div class="qb-empty">${this.isDragging ? this._dropPlaceholder() : t.emptyGroup}</div>` : this._renderChildrenWithSlots(e.children)}
2013
+ </div>
2014
+ </div>
2015
+ `;
2016
+ }
3188
2017
  }
3189
-
3190
- .qb-preview {
3191
- margin: 0 0 0.5rem;
3192
- padding: 0.5rem;
3193
- background: var(--bs-secondary-bg, #f8f9fa);
3194
- border: 1px solid var(--bs-border-color, #dee2e6);
3195
- border-radius: var(--bs-border-radius-sm, 0.25rem);
3196
- font-family: var(--bs-font-monospace, monospace);
3197
- font-size: 0.8125rem;
3198
- color: var(--bs-body-color, currentColor);
3199
- white-space: pre-wrap;
3200
- word-break: break-word;
3201
- }`), Le = 32;
3202
- class Ne extends R {
2018
+ T("query-group", Ae);
2019
+ typeof customElements < "u" && !customElements.get("mp-query-group") && customElements.define("mp-query-group", He);
2020
+ const b = M("query-builder"), Be = 32;
2021
+ class Ue extends L {
3203
2022
  constructor() {
3204
- super(...arguments), this.query = null, this.schema = [], this.rootEntity = "", this.multiEntityPickerEnabled = !1, this.selectedFields = [], this.sortBy = [], this.disabled = !1, this.editorRegistry = void 0, this.messages = void 0, this.maxDepth = Le, this.showPreview = !1, this.showSavedQueries = !1, this.savedQueries = [], this._saveDraftName = "", this.depth = 0, this._qbRootId = `qb-${Math.random().toString(36).slice(2, 10)}`, this._isDragging = !1, this._drag = new $e(), this._pointerMoveHandler = null, this._pointerUpHandler = null, this._pointerCancelHandler = null, this._registryConsumer = new p(this, {
3205
- context: F,
2023
+ super(...arguments), this.query = null, this.schema = [], this.rootEntity = "", this.multiEntityPickerEnabled = !1, this.selectedFields = [], this.sortBy = [], this.disabled = !1, this.editorRegistry = void 0, this.messages = void 0, this.maxDepth = Be, this.showPreview = !1, this.showSavedQueries = !1, this.savedQueries = [], this._saveDraftName = "", this.depth = 0, this._qbRootId = `qb-${Math.random().toString(36).slice(2, 10)}`, this._isDragging = !1, this._drag = new Te(), this._pointerMoveHandler = null, this._pointerUpHandler = null, this._pointerCancelHandler = null, this._registryConsumer = new f(this, {
2024
+ context: O,
3206
2025
  subscribe: !0
3207
- }), this._registryProvider = new k(this, {
3208
- context: F,
2026
+ }), this._registryProvider = new x(this, {
2027
+ context: O,
3209
2028
  initialValue: void 0
3210
- }), this._disabledConsumer = new p(this, {
3211
- context: C,
2029
+ }), this._disabledConsumer = new f(this, {
2030
+ context: S,
3212
2031
  subscribe: !0
3213
- }), this._disabledProvider = new k(this, {
3214
- context: C,
2032
+ }), this._disabledProvider = new x(this, {
2033
+ context: S,
3215
2034
  initialValue: void 0
3216
- }), this._messagesConsumer = new p(this, {
3217
- context: q,
2035
+ }), this._messagesConsumer = new f(this, {
2036
+ context: k,
3218
2037
  subscribe: !0
3219
- }), this._messagesProvider = new k(this, {
3220
- context: q,
2038
+ }), this._messagesProvider = new x(this, {
2039
+ context: k,
3221
2040
  initialValue: void 0
3222
- }), this._maxDepthConsumer = new p(this, {
3223
- context: B,
2041
+ }), this._maxDepthConsumer = new f(this, {
2042
+ context: V,
3224
2043
  subscribe: !0
3225
- }), this._maxDepthProvider = new k(this, {
3226
- context: B,
2044
+ }), this._maxDepthProvider = new x(this, {
2045
+ context: V,
3227
2046
  initialValue: void 0
3228
2047
  }), this._lastMessagesOwn = void 0, this._lastMessagesConsumed = void 0, this._lastEffMessages = void 0, this._onConditionFieldChange = (e) => {
3229
2048
  if (!this._handlesEvents()) return;
3230
2049
  e.stopPropagation();
3231
2050
  const { id: t, field: r } = e.detail, n = this.query;
3232
2051
  if (!n) return;
3233
- const b = this._resolveEntityForNode(t)?.fields.find((i) => i.name === r);
3234
- b && this._mutate(he(n, t, b));
2052
+ const s = this._resolveEntityForNode(t)?.fields.find((a) => a.name === r);
2053
+ s && this._mutate(ve(n, t, s));
3235
2054
  }, this._onConditionOperatorChange = (e) => {
3236
2055
  if (!this._handlesEvents()) return;
3237
2056
  e.stopPropagation();
3238
2057
  const { id: t, operator: r } = e.detail, n = this.query;
3239
- n && this._mutate(ge(n, t, r));
2058
+ n && this._mutate(qe(n, t, r));
3240
2059
  }, this._onConditionValueChange = (e) => {
3241
2060
  if (!this._handlesEvents()) return;
3242
2061
  e.stopPropagation();
3243
2062
  const { id: t, value: r } = e.detail, n = this.query;
3244
- n && this._mutate(fe(n, t, { value: r }));
2063
+ n && this._mutate(ge(n, t, { value: r }));
3245
2064
  }, this._onGroupLogicChange = (e) => {
3246
2065
  if (!this._handlesEvents()) return;
3247
2066
  e.stopPropagation();
3248
2067
  const { id: t, logic: r } = e.detail, n = this.query;
3249
- n && this._mutate(ue(n, t, r));
2068
+ n && this._mutate(ye(n, t, r));
3250
2069
  }, this._onAddCondition = (e) => {
3251
2070
  if (!this._handlesEvents()) return;
3252
2071
  e.stopPropagation();
3253
2072
  const { groupId: t } = e.detail, r = this.query;
3254
2073
  if (!r) return;
3255
2074
  const n = this._resolveEntityForNode(t);
3256
- n && this._mutate(de(r, t, n));
2075
+ n && this._mutate(be(r, t, n));
3257
2076
  }, this._onAddGroup = (e) => {
3258
2077
  if (!this._handlesEvents()) return;
3259
2078
  e.stopPropagation();
3260
2079
  const { groupId: t } = e.detail, r = this.query;
3261
- r && this._mutate(le(r, t, "and"));
2080
+ r && this._mutate(he(r, t, "and"));
3262
2081
  }, this._onAddSubquery = (e) => {
3263
2082
  if (!this._handlesEvents()) return;
3264
2083
  e.stopPropagation();
3265
2084
  const { groupId: t } = e.detail, r = this.query;
3266
2085
  if (!r) return;
3267
2086
  const n = this._resolveEntityForNode(t);
3268
- n && this._mutate(ce(r, t, n));
2087
+ n && this._mutate(fe(r, t, n));
3269
2088
  }, this._onNodeRemove = (e) => {
3270
2089
  if (!this._handlesEvents()) return;
3271
2090
  e.stopPropagation();
3272
2091
  const { id: t } = e.detail, r = this.query;
3273
2092
  if (!r || r.id === t) return;
3274
- const n = E(r, t);
3275
- this._pendingRefocusId = n?.parent.id ?? r.id, this._mutate(X(r, t));
2093
+ const n = D(r, t);
2094
+ this._pendingRefocusId = n?.parent.id ?? r.id, this._mutate(Z(r, t));
3276
2095
  }, this._pendingRefocusId = null, this._onKeyboardMove = (e) => {
3277
2096
  if (!this._handlesEvents()) return;
3278
2097
  e.stopPropagation();
3279
2098
  const { id: t, direction: r } = e.detail, n = this.query;
3280
2099
  if (!n) return;
3281
- const s = E(n, t);
3282
- if (!s) return;
3283
- const b = r === "up" ? s.index - 1 : s.index + 1;
3284
- b < 0 || b >= s.parent.children.length || (this._pendingRefocusId = t, this._mutate(H(n, t, s.parent.id, b)));
2100
+ const i = D(n, t);
2101
+ if (!i) return;
2102
+ const s = r === "up" ? i.index - 1 : i.index + 1;
2103
+ s < 0 || s >= i.parent.children.length || (this._pendingRefocusId = t, this._mutate(j(n, t, i.parent.id, s)));
3285
2104
  }, this._onDragStart = (e) => {
3286
2105
  if (!this._handlesEvents()) return;
3287
2106
  e.stopPropagation();
3288
2107
  const t = e.detail, r = this.query;
3289
2108
  if (!r) return;
3290
- const n = _(r, t.id);
2109
+ const n = E(r, t.id);
3291
2110
  if (!n) return;
3292
- const s = V(n);
2111
+ const i = J(n);
3293
2112
  this._drag.start(
3294
2113
  {
3295
2114
  id: t.id,
3296
- descendantIds: s,
2115
+ descendantIds: i,
3297
2116
  qbRoot: this._qbRootId,
3298
2117
  rowElement: t.rowElement
3299
2118
  },
3300
2119
  new PointerEvent("pointerdown", { pointerId: t.pointerId, clientX: t.clientX, clientY: t.clientY })
3301
- ), this._isDragging = !0, typeof window < "u" && (this._pointerMoveHandler = (b) => this._drag.move(b), this._pointerUpHandler = (b) => this._finishDrag(b), this._pointerCancelHandler = () => this._cancelDrag(), window.addEventListener("pointermove", this._pointerMoveHandler), window.addEventListener("pointerup", this._pointerUpHandler), window.addEventListener("pointercancel", this._pointerCancelHandler));
2120
+ ), this._isDragging = !0, typeof window < "u" && (this._pointerMoveHandler = (s) => this._drag.move(s), this._pointerUpHandler = (s) => this._finishDrag(s), this._pointerCancelHandler = () => this._cancelDrag(), window.addEventListener("pointermove", this._pointerMoveHandler), window.addEventListener("pointerup", this._pointerUpHandler), window.addEventListener("pointercancel", this._pointerCancelHandler));
3302
2121
  }, this._onSaveDraftInput = (e) => {
3303
2122
  this._saveDraftName = e.target.value;
3304
2123
  }, this._onSaveQuery = () => {
@@ -3328,8 +2147,8 @@ class Ne extends R {
3328
2147
  })));
3329
2148
  };
3330
2149
  }
3331
- static {
3332
- this.styles = [Ie];
2150
+ createRenderRoot() {
2151
+ return this;
3333
2152
  }
3334
2153
  static {
3335
2154
  this.properties = {
@@ -3356,11 +2175,11 @@ class Ne extends R {
3356
2175
  this._registryProvider.setValue(t);
3357
2176
  const r = (this._disabledConsumer.value ?? !1) || (this.disabled ?? !1);
3358
2177
  this._disabledProvider.setValue(r);
3359
- const n = this.messages, s = this._messagesConsumer.value;
3360
- let b;
3361
- this._lastEffMessages !== void 0 && this._lastMessagesOwn === n && this._lastMessagesConsumed === s ? b = this._lastEffMessages : (b = { ...s ?? {}, ...n ?? {} }, this._lastMessagesOwn = n, this._lastMessagesConsumed = s, this._lastEffMessages = b), this._messagesProvider.setValue(b);
3362
- const a = this._maxDepthConsumer.value ?? this.maxDepth;
3363
- this._maxDepthProvider.setValue(a);
2178
+ const n = this.messages, i = this._messagesConsumer.value;
2179
+ let s;
2180
+ this._lastEffMessages !== void 0 && this._lastMessagesOwn === n && this._lastMessagesConsumed === i ? s = this._lastEffMessages : (s = { ...i ?? {}, ...n ?? {} }, this._lastMessagesOwn = n, this._lastMessagesConsumed = i, this._lastEffMessages = s), this._messagesProvider.setValue(s);
2181
+ const d = this._maxDepthConsumer.value ?? this.maxDepth;
2182
+ this._maxDepthProvider.setValue(d);
3364
2183
  }
3365
2184
  updated(e) {
3366
2185
  if (this._pendingRefocusId === null) return;
@@ -3369,17 +2188,17 @@ class Ne extends R {
3369
2188
  }
3370
2189
  _focusRowById(e) {
3371
2190
  const t = (n) => {
3372
- const s = n.querySelector(`[data-row-id="${e}"]`);
3373
- if (s)
3374
- return s.querySelector(".qb-subquery-header") ?? s;
3375
- for (const b of Array.from(n.querySelectorAll("*")))
3376
- if (b.shadowRoot) {
3377
- const i = t(b.shadowRoot);
3378
- if (i) return i;
2191
+ const i = n.querySelector(`[data-row-id="${e}"]`);
2192
+ if (i)
2193
+ return i.querySelector(".qb-subquery-header") ?? i;
2194
+ for (const s of Array.from(n.querySelectorAll("*")))
2195
+ if (s.shadowRoot) {
2196
+ const a = t(s.shadowRoot);
2197
+ if (a) return a;
3379
2198
  }
3380
2199
  return null;
3381
2200
  };
3382
- (this.shadowRoot ? t(this.shadowRoot) : null)?.focus();
2201
+ t(this.renderRoot)?.focus();
3383
2202
  }
3384
2203
  /**
3385
2204
  * Effective max-depth used for the render check. The OUTER builder's
@@ -3399,19 +2218,19 @@ class Ne extends R {
3399
2218
  if (!t) return null;
3400
2219
  const r = this.query;
3401
2220
  if (!r) return t;
3402
- const n = { entity: t }, s = (b, i) => {
3403
- if (b.id === e)
3404
- return n.entity = i, !0;
3405
- if (b.kind === "group") {
3406
- for (const a of b.children)
3407
- if (s(a, i)) return !0;
3408
- } else if (b.kind === "subquery") {
3409
- const a = i.fields.find((c) => c.name === b.field), l = a?.targetEntity ? this.schema.find((c) => c.name === a.targetEntity) ?? i : i;
3410
- if (s(b.subQuery, l)) return !0;
2221
+ const n = { entity: t }, i = (s, a) => {
2222
+ if (s.id === e)
2223
+ return n.entity = a, !0;
2224
+ if (s.kind === "group") {
2225
+ for (const d of s.children)
2226
+ if (i(d, a)) return !0;
2227
+ } else if (s.kind === "subquery") {
2228
+ const d = a.fields.find((u) => u.name === s.field), l = d?.targetEntity ? this.schema.find((u) => u.name === d.targetEntity) ?? a : a;
2229
+ if (i(s.subQuery, l)) return !0;
3411
2230
  }
3412
2231
  return !1;
3413
2232
  };
3414
- return s(r, t), n.entity;
2233
+ return i(r, t), n.entity;
3415
2234
  }
3416
2235
  _mutate(e) {
3417
2236
  this.query = e, this.dispatchEvent(new CustomEvent("query-change", {
@@ -3440,36 +2259,36 @@ class Ne extends R {
3440
2259
  _applyDrop(e) {
3441
2260
  const t = this.query, r = this._drag.source();
3442
2261
  if (!t || !r) return;
3443
- const n = e.qbRoot !== r.qbRoot ? this._schemaForGroup(e.parentId) : void 0, s = H(t, r.id, e.parentId, e.index, n);
3444
- this._mutate(s);
2262
+ const n = e.qbRoot !== r.qbRoot ? this._schemaForGroup(e.parentId) : void 0, i = j(t, r.id, e.parentId, e.index, n);
2263
+ this._mutate(i);
3445
2264
  }
3446
2265
  _schemaForGroup(e) {
3447
2266
  const t = this.query;
3448
2267
  if (!t) return;
3449
2268
  const r = this._entitySchemaForCurrentRoot();
3450
2269
  if (!r) return;
3451
- const n = { schema: r }, s = (b, i) => {
3452
- if (b.id === e)
3453
- return n.schema = i, !0;
3454
- if (b.kind === "group") {
3455
- for (const a of b.children) if (s(a, i)) return !0;
3456
- } else if (b.kind === "subquery") {
3457
- const a = i.fields.find((c) => c.name === b.field), l = a?.targetEntity ? this.schema.find((c) => c.name === a.targetEntity) ?? i : i;
3458
- if (s(b.subQuery, l)) return !0;
2270
+ const n = { schema: r }, i = (s, a) => {
2271
+ if (s.id === e)
2272
+ return n.schema = a, !0;
2273
+ if (s.kind === "group") {
2274
+ for (const d of s.children) if (i(d, a)) return !0;
2275
+ } else if (s.kind === "subquery") {
2276
+ const d = a.fields.find((u) => u.name === s.field), l = d?.targetEntity ? this.schema.find((u) => u.name === d.targetEntity) ?? a : a;
2277
+ if (i(s.subQuery, l)) return !0;
3459
2278
  }
3460
2279
  return !1;
3461
2280
  };
3462
- return s(t, r), n.schema;
2281
+ return i(t, r), n.schema;
3463
2282
  }
3464
2283
  disconnectedCallback() {
3465
2284
  super.disconnectedCallback(), this._teardownDragListeners(), this._drag.cancel();
3466
2285
  }
3467
2286
  _renderSavedPicker(e) {
3468
- return d`
3469
- <div class="qb-saved" part="saved-picker">
3470
- <div class="qb-saved-list" part="saved-list">
3471
- ${this.savedQueries.length === 0 ? d`<span class="qb-saved-empty">No saved queries</span>` : this.savedQueries.map((t) => d`
3472
- <span class="qb-saved-row" part="saved-row" data-name=${t.name}>
2287
+ return b`
2288
+ <div class="qb-saved">
2289
+ <div class="qb-saved-list">
2290
+ ${this.savedQueries.length === 0 ? b`<span class="qb-saved-empty">No saved queries</span>` : this.savedQueries.map((t) => b`
2291
+ <span class="qb-saved-row" data-name=${t.name}>
3473
2292
  <button
3474
2293
  type="button"
3475
2294
  class="btn btn-sm btn-outline-primary qb-saved-load"
@@ -3484,7 +2303,7 @@ class Ne extends R {
3484
2303
  </span>
3485
2304
  `)}
3486
2305
  </div>
3487
- <span class="qb-saved-new" part="saved-new">
2306
+ <span class="qb-saved-new">
3488
2307
  <input
3489
2308
  type="text"
3490
2309
  class="form-control form-control-sm qb-saved-name"
@@ -3510,62 +2329,61 @@ class Ne extends R {
3510
2329
  * Phase-2 widgets (field projection, sort-by) hang off this same toolbar.
3511
2330
  */
3512
2331
  _renderToolbar() {
3513
- if (this.depth !== 0) return u;
3514
- if (!this.multiEntityPickerEnabled) return u;
3515
- if (this.schema.length < 2) return u;
2332
+ if (this.depth !== 0) return c;
2333
+ if (!this.multiEntityPickerEnabled) return c;
2334
+ if (this.schema.length < 2) return c;
3516
2335
  const t = this.schema.find((n) => n.name === this.rootEntity)?.fields.filter((n) => n.type !== "relation") ?? [], r = this._messages();
3517
- return d`
3518
- <div class="qb-toolbar" part="toolbar">
2336
+ return b`
2337
+ <div class="qb-toolbar">
3519
2338
  <label class="qb-toolbar-label">
3520
2339
  Entity:
3521
2340
  <mp-select
3522
2341
  class="qb-entity-picker"
3523
2342
  size="sm"
3524
- part="entity-picker"
3525
2343
  .value=${this.rootEntity}
3526
2344
  ?disabled=${this.disabled}
3527
2345
  @change=${this._onRootEntityChange}
3528
2346
  aria-label=${r.entity}
3529
2347
  >
3530
- ${this.schema.map((n) => d`<option value=${n.name}>${n.label}</option>`)}
2348
+ ${this.schema.map((n) => b`<option value=${n.name}>${n.label}</option>`)}
3531
2349
  </mp-select>
3532
2350
  </label>
3533
- ${t.length > 0 ? d`
3534
- <span class="qb-toolbar-section qb-field-projection" part="field-projection" role="group" aria-label=${r.columns}>
2351
+ ${t.length > 0 ? b`
2352
+ <span class="qb-toolbar-section qb-field-projection" role="group" aria-label=${r.columns}>
3535
2353
  <span class="qb-toolbar-label">${r.columns}:</span>
3536
- ${t.map((n) => d`
2354
+ ${t.map((n) => b`
3537
2355
  <mp-checkbox
3538
2356
  class="qb-field-checkbox"
3539
2357
  value=${n.name}
3540
2358
  ?checked=${this.selectedFields.includes(n.name)}
3541
2359
  ?disabled=${this.disabled}
3542
- @change=${(s) => this._onFieldProjectionToggle(n.name, s)}
2360
+ @change=${(i) => this._onFieldProjectionToggle(n.name, i)}
3543
2361
  aria-label=${n.label}
3544
2362
  >${n.label}</mp-checkbox>
3545
2363
  `)}
3546
2364
  </span>
3547
- ` : u}
3548
- ${t.length > 0 ? this._renderSortBy(t) : u}
2365
+ ` : c}
2366
+ ${t.length > 0 ? this._renderSortBy(t) : c}
3549
2367
  </div>
3550
2368
  `;
3551
2369
  }
3552
2370
  _renderSortBy(e) {
3553
2371
  const t = this._messages();
3554
- return d`
3555
- <span class="qb-toolbar-section qb-sort-by" part="sort-by" role="group" aria-label=${t.sortBy}>
2372
+ return b`
2373
+ <span class="qb-toolbar-section qb-sort-by" role="group" aria-label=${t.sortBy}>
3556
2374
  <span class="qb-toolbar-label">${t.sortBy}:</span>
3557
- ${this.sortBy.map((r, n) => d`
3558
- <span class="qb-sort-row" part="sort-row">
2375
+ ${this.sortBy.map((r, n) => b`
2376
+ <span class="qb-sort-row">
3559
2377
  <mp-select
3560
2378
  class="qb-sort-field"
3561
2379
  size="sm"
3562
2380
  .value=${r.field}
3563
2381
  ?disabled=${this.disabled}
3564
- @change=${(s) => this._onSortFieldChange(n, s)}
2382
+ @change=${(i) => this._onSortFieldChange(n, i)}
3565
2383
  aria-label=${`Sort ${n + 1} field`}
3566
2384
  >
3567
- ${e.map((s) => d`<option value=${s.name}>${s.label}</option>`)}
3568
- ${e.some((s) => s.name === r.field) ? u : d`
2385
+ ${e.map((i) => b`<option value=${i.name}>${i.label}</option>`)}
2386
+ ${e.some((i) => i.name === r.field) ? c : b`
3569
2387
  <option value=${r.field}>(${r.field})</option>
3570
2388
  `}
3571
2389
  </mp-select>
@@ -3574,7 +2392,7 @@ class Ne extends R {
3574
2392
  size="sm"
3575
2393
  .value=${r.direction}
3576
2394
  ?disabled=${this.disabled}
3577
- @change=${(s) => this._onSortDirectionChange(n, s)}
2395
+ @change=${(i) => this._onSortDirectionChange(n, i)}
3578
2396
  aria-label=${`Sort ${n + 1} direction`}
3579
2397
  >
3580
2398
  <option value="asc">Asc</option>
@@ -3593,7 +2411,6 @@ class Ne extends R {
3593
2411
  <button
3594
2412
  type="button"
3595
2413
  class="btn btn-sm btn-outline-secondary qb-sort-add"
3596
- part="sort-add"
3597
2414
  ?disabled=${this.disabled || e.length === 0}
3598
2415
  @click=${() => this._onSortAdd(e)}
3599
2416
  >+ Add sort</button>
@@ -3608,11 +2425,11 @@ class Ne extends R {
3608
2425
  }));
3609
2426
  }
3610
2427
  _onSortFieldChange(e, t) {
3611
- const r = t.target.value, n = this.sortBy.map((s, b) => b === e ? { ...s, field: r } : s);
2428
+ const r = t.target.value, n = this.sortBy.map((i, s) => s === e ? { ...i, field: r } : i);
3612
2429
  this._emitSortBy(n);
3613
2430
  }
3614
2431
  _onSortDirectionChange(e, t) {
3615
- const r = t.target.value, n = this.sortBy.map((s, b) => b === e ? { ...s, direction: r } : s);
2432
+ const r = t.target.value, n = this.sortBy.map((i, s) => s === e ? { ...i, direction: r } : i);
3616
2433
  this._emitSortBy(n);
3617
2434
  }
3618
2435
  _onSortRemove(e) {
@@ -3622,27 +2439,26 @@ class Ne extends R {
3622
2439
  _onSortAdd(e) {
3623
2440
  const t = e[0];
3624
2441
  if (!t) return;
3625
- const r = new Set(this.sortBy.map((s) => s.field)), n = e.find((s) => !r.has(s.name)) ?? t;
2442
+ const r = new Set(this.sortBy.map((i) => i.field)), n = e.find((i) => !r.has(i.name)) ?? t;
3626
2443
  this._emitSortBy([...this.sortBy, { field: n.name, direction: "asc" }]);
3627
2444
  }
3628
2445
  _onFieldProjectionToggle(e, t) {
3629
2446
  const r = t.target.checked, n = new Set(this.selectedFields);
3630
2447
  r ? n.add(e) : n.delete(e);
3631
- const s = Array.from(n);
3632
- this.selectedFields = s, this.dispatchEvent(new CustomEvent("selected-fields-change", {
3633
- detail: { selectedFields: s },
2448
+ const i = Array.from(n);
2449
+ this.selectedFields = i, this.dispatchEvent(new CustomEvent("selected-fields-change", {
2450
+ detail: { selectedFields: i },
3634
2451
  bubbles: !1,
3635
2452
  composed: !1
3636
2453
  }));
3637
2454
  }
3638
2455
  render() {
3639
2456
  if (this.depth > this.effectiveMaxDepth())
3640
- return d`<div class="qb-too-deep" role="alert">Tree too deep</div>`;
2457
+ return b`<div class="qb-too-deep" role="alert">Tree too deep</div>`;
3641
2458
  const e = this.query;
3642
- return e ? d`
2459
+ return e ? b`
3643
2460
  <div
3644
2461
  class="qb-root"
3645
- part="root"
3646
2462
  data-qb-root=${this._qbRootId}
3647
2463
  @condition-field-change=${this._onConditionFieldChange}
3648
2464
  @condition-operator-change=${this._onConditionOperatorChange}
@@ -3656,20 +2472,20 @@ class Ne extends R {
3656
2472
  @qb-keyboard-move=${this._onKeyboardMove}
3657
2473
  >
3658
2474
  ${this._renderToolbar()}
3659
- ${this.showSavedQueries && this.depth === 0 ? this._renderSavedPicker(this._messages()) : u}
3660
- ${this.showPreview && this.depth === 0 ? d`<pre class="qb-preview" part="preview">${this._renderPreview(e)}</pre>` : u}
2475
+ ${this.showSavedQueries && this.depth === 0 ? this._renderSavedPicker(this._messages()) : c}
2476
+ ${this.showPreview && this.depth === 0 ? b`<pre class="qb-preview">${this._renderPreview(e)}</pre>` : c}
3661
2477
  ${this.renderTreeRoot(e)}
3662
2478
  </div>
3663
- ` : u;
2479
+ ` : c;
3664
2480
  }
3665
2481
  _messages() {
3666
2482
  const e = this._messagesConsumer.value ?? {};
3667
2483
  return {
3668
- ...m,
2484
+ ...y,
3669
2485
  ...e,
3670
2486
  ...this.messages ?? {},
3671
2487
  operators: {
3672
- ...m.operators,
2488
+ ...y.operators,
3673
2489
  ...e.operators ?? {},
3674
2490
  ...this.messages?.operators ?? {}
3675
2491
  }
@@ -3681,7 +2497,7 @@ class Ne extends R {
3681
2497
  ...this._messagesConsumer.value ?? {},
3682
2498
  ...this.messages ?? {}
3683
2499
  };
3684
- return ve(e, this.schema, {
2500
+ return $e(e, this.schema, {
3685
2501
  messages: t,
3686
2502
  rootEntity: this.rootEntity,
3687
2503
  maxDepth: this.effectiveMaxDepth()
@@ -3691,7 +2507,7 @@ class Ne extends R {
3691
2507
  }
3692
2508
  }
3693
2509
  renderTreeRoot(e) {
3694
- return e.kind === "group" ? d`<mp-query-group
2510
+ return e.kind === "group" ? b`<mp-query-group
3695
2511
  .node=${e}
3696
2512
  .schema=${this.schema}
3697
2513
  .currentEntity=${this.rootEntity}
@@ -3699,7 +2515,7 @@ class Ne extends R {
3699
2515
  .isRoot=${!0}
3700
2516
  .qbRoot=${this._qbRootId}
3701
2517
  .isDragging=${this._isDragging}
3702
- ></mp-query-group>` : d`<mp-query-group
2518
+ ></mp-query-group>` : b`<mp-query-group
3703
2519
  .node=${{
3704
2520
  kind: "group",
3705
2521
  id: "synthetic-root",
@@ -3715,40 +2531,45 @@ class Ne extends R {
3715
2531
  ></mp-query-group>`;
3716
2532
  }
3717
2533
  }
3718
- typeof customElements < "u" && !customElements.get("mp-query-builder") && customElements.define("mp-query-builder", Ne);
2534
+ T("query-builder", Se);
2535
+ typeof customElements < "u" && !customElements.get("mp-query-builder") && customElements.define("mp-query-builder", Ue);
3719
2536
  export {
3720
- m as DEFAULT_MESSAGES,
3721
- j as DEFAULT_OPERATOR_CATALOG,
3722
- K as MaxDepthExceededError,
3723
- Ne as MpQueryBuilderElement,
3724
- ze as MpQueryConditionElement,
3725
- Fe as MpQueryGroupElement,
3726
- Te as MpQuerySubqueryElement,
3727
- L as addChild,
3728
- de as addEmptyConditionTo,
3729
- le as addEmptyGroupTo,
3730
- ce as addEmptySubqueryTo,
3731
- he as changeConditionField,
3732
- ge as changeConditionOperator,
3733
- Q as cloneTree,
3734
- V as collectDescendantIds,
3735
- x as defaultValueFor,
3736
- C as disabledContext,
3737
- F as editorRegistryContext,
3738
- ie as emptyCondition,
3739
- I as emptyGroup,
3740
- ae as emptySubquery,
3741
- _ as findNodeById,
2537
+ y as DEFAULT_MESSAGES,
2538
+ W as DEFAULT_OPERATOR_CATALOG,
2539
+ te as MaxDepthExceededError,
2540
+ Ue as MpQueryBuilderElement,
2541
+ Oe as MpQueryConditionElement,
2542
+ He as MpQueryGroupElement,
2543
+ Qe as MpQuerySubqueryElement,
2544
+ H as addChild,
2545
+ be as addEmptyConditionTo,
2546
+ he as addEmptyGroupTo,
2547
+ fe as addEmptySubqueryTo,
2548
+ ve as changeConditionField,
2549
+ qe as changeConditionOperator,
2550
+ G as cloneTree,
2551
+ J as collectDescendantIds,
2552
+ $ as defaultValueFor,
2553
+ S as disabledContext,
2554
+ O as editorRegistryContext,
2555
+ me as emptyCondition,
2556
+ Q as emptyGroup,
2557
+ pe as emptySubquery,
2558
+ E as findNodeById,
3742
2559
  v as mapTree,
3743
- q as messagesContext,
3744
- H as moveNode,
3745
- $ as newId,
3746
- y as operatorsForType,
3747
- X as removeNode,
3748
- ve as renderExpression,
3749
- ue as setGroupLogic,
3750
- fe as updateCondition,
3751
- Ge as validateOperatorOverrides,
3752
- g as valueShapeFor,
3753
- je as visitTree
2560
+ k as messagesContext,
2561
+ j as moveNode,
2562
+ C as newId,
2563
+ w as operatorsForType,
2564
+ Se as queryBuilderLightStyles,
2565
+ Re as queryConditionLightStyles,
2566
+ Ae as queryGroupLightStyles,
2567
+ Le as querySubqueryLightStyles,
2568
+ Z as removeNode,
2569
+ $e as renderExpression,
2570
+ ye as setGroupLogic,
2571
+ ge as updateCondition,
2572
+ We as validateOperatorOverrides,
2573
+ h as valueShapeFor,
2574
+ Je as visitTree
3754
2575
  };