@statezero/core 0.2.51 → 0.2.53

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 (177) hide show
  1. package/dist/adaptors/vue/components/StateZeroDebugPanel.js +586 -559
  2. package/dist/adaptors/vue/composables.d.ts +1 -1
  3. package/dist/adaptors/vue/composables.js +8 -2
  4. package/dist/adaptors/vue/reactivity.d.ts +1 -0
  5. package/dist/adaptors/vue/reactivity.js +20 -8
  6. package/dist/cli/commands/syncActions.js +33 -1
  7. package/dist/cli/commands/syncModels.js +44 -3
  8. package/dist/filtering/localFiltering.js +3 -2
  9. package/dist/flavours/django/errors.d.ts +12 -0
  10. package/dist/flavours/django/errors.js +20 -0
  11. package/dist/flavours/django/f.js +16 -15
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.js +2 -2
  14. package/dist/models/backend1/django_app/author.d.ts +284 -0
  15. package/dist/models/backend1/django_app/author.js +69 -0
  16. package/dist/models/backend1/django_app/author.schema.json +281 -0
  17. package/dist/models/backend1/django_app/book.d.ts +262 -0
  18. package/dist/models/backend1/django_app/book.js +71 -0
  19. package/dist/models/backend1/django_app/book.schema.json +254 -0
  20. package/dist/models/backend1/django_app/composeditem.d.ts +140 -0
  21. package/dist/models/backend1/django_app/composeditem.js +69 -0
  22. package/dist/models/backend1/django_app/composeditem.schema.json +122 -0
  23. package/dist/models/backend1/django_app/comprehensivemodel.schema.json +3 -3
  24. package/dist/models/backend1/django_app/dailyrate.schema.json +7 -7
  25. package/dist/models/backend1/django_app/deepmodellevel1.schema.json +1 -1
  26. package/dist/models/backend1/django_app/dummymodel.schema.json +3 -3
  27. package/dist/models/backend1/django_app/errortestcompoundunique.d.ts +124 -0
  28. package/dist/models/backend1/django_app/errortestcompoundunique.js +69 -0
  29. package/dist/models/backend1/django_app/errortestcompoundunique.schema.json +106 -0
  30. package/dist/models/backend1/django_app/errortestonetoonemodel.d.ts +118 -0
  31. package/dist/models/backend1/django_app/errortestonetoonemodel.js +71 -0
  32. package/dist/models/backend1/django_app/errortestonetoonemodel.schema.json +90 -0
  33. package/dist/models/backend1/django_app/errortestparent.d.ts +92 -0
  34. package/dist/models/backend1/django_app/errortestparent.js +69 -0
  35. package/dist/models/backend1/django_app/errortestparent.schema.json +70 -0
  36. package/dist/models/backend1/django_app/errortestprotectedchild.d.ts +118 -0
  37. package/dist/models/backend1/django_app/errortestprotectedchild.js +71 -0
  38. package/dist/models/backend1/django_app/errortestprotectedchild.schema.json +94 -0
  39. package/dist/models/backend1/django_app/errortestuniquemodel.d.ts +108 -0
  40. package/dist/models/backend1/django_app/errortestuniquemodel.js +69 -0
  41. package/dist/models/backend1/django_app/errortestuniquemodel.schema.json +88 -0
  42. package/dist/models/backend1/django_app/excludeditem.d.ts +124 -0
  43. package/dist/models/backend1/django_app/excludeditem.js +69 -0
  44. package/dist/models/backend1/django_app/excludeditem.schema.json +105 -0
  45. package/dist/models/backend1/django_app/hfchild.d.ts +118 -0
  46. package/dist/models/backend1/django_app/hfchild.js +71 -0
  47. package/dist/models/backend1/django_app/hfchild.schema.json +94 -0
  48. package/dist/models/backend1/django_app/hfparent.d.ts +124 -0
  49. package/dist/models/backend1/django_app/hfparent.js +69 -0
  50. package/dist/models/backend1/django_app/hfparent.schema.json +105 -0
  51. package/dist/models/backend1/django_app/index.js +19 -0
  52. package/dist/models/backend1/django_app/m2mdepthtestlevel1.schema.json +3 -3
  53. package/dist/models/backend1/django_app/m2mdepthtestlevel2.schema.json +3 -3
  54. package/dist/models/backend1/django_app/m2mdepthtestlevel3.schema.json +5 -5
  55. package/dist/models/backend1/django_app/modelwithrestrictedfields.schema.json +2 -2
  56. package/dist/models/backend1/django_app/nodeleteitem.d.ts +124 -0
  57. package/dist/models/backend1/django_app/nodeleteitem.js +69 -0
  58. package/dist/models/backend1/django_app/nodeleteitem.schema.json +105 -0
  59. package/dist/models/backend1/django_app/objectlevelitem.d.ts +124 -0
  60. package/dist/models/backend1/django_app/objectlevelitem.js +69 -0
  61. package/dist/models/backend1/django_app/objectlevelitem.schema.json +105 -0
  62. package/dist/models/backend1/django_app/order.schema.json +7 -7
  63. package/dist/models/backend1/django_app/orderitem.schema.json +5 -5
  64. package/dist/models/backend1/django_app/product.schema.json +11 -11
  65. package/dist/models/backend1/django_app/productcategory.schema.json +2 -2
  66. package/dist/models/backend1/django_app/rateplan.schema.json +2 -2
  67. package/dist/models/backend1/django_app/readonlyitem.d.ts +124 -0
  68. package/dist/models/backend1/django_app/readonlyitem.js +69 -0
  69. package/dist/models/backend1/django_app/readonlyitem.schema.json +105 -0
  70. package/dist/models/backend1/django_app/restrictedcreateitem.d.ts +124 -0
  71. package/dist/models/backend1/django_app/restrictedcreateitem.js +69 -0
  72. package/dist/models/backend1/django_app/restrictedcreateitem.schema.json +105 -0
  73. package/dist/models/backend1/django_app/restrictededititem.d.ts +124 -0
  74. package/dist/models/backend1/django_app/restrictededititem.js +69 -0
  75. package/dist/models/backend1/django_app/restrictededititem.schema.json +105 -0
  76. package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.schema.json +1 -1
  77. package/dist/models/backend1/django_app/rowfiltereditem.d.ts +124 -0
  78. package/dist/models/backend1/django_app/rowfiltereditem.js +69 -0
  79. package/dist/models/backend1/django_app/rowfiltereditem.schema.json +105 -0
  80. package/dist/models/backend1/django_app/tag.d.ts +554 -0
  81. package/dist/models/backend1/django_app/tag.js +71 -0
  82. package/dist/models/backend1/django_app/tag.schema.json +541 -0
  83. package/dist/models/backend1/django_app/updateonlyitem.d.ts +108 -0
  84. package/dist/models/backend1/django_app/updateonlyitem.js +69 -0
  85. package/dist/models/backend1/django_app/updateonlyitem.schema.json +88 -0
  86. package/dist/models/default/django_app/author.d.ts +284 -0
  87. package/dist/models/default/django_app/author.js +69 -0
  88. package/dist/models/default/django_app/author.schema.json +281 -0
  89. package/dist/models/default/django_app/book.d.ts +262 -0
  90. package/dist/models/default/django_app/book.js +71 -0
  91. package/dist/models/default/django_app/book.schema.json +254 -0
  92. package/dist/models/default/django_app/composeditem.d.ts +140 -0
  93. package/dist/models/default/django_app/composeditem.js +69 -0
  94. package/dist/models/default/django_app/composeditem.schema.json +122 -0
  95. package/dist/models/default/django_app/comprehensivemodel.schema.json +3 -3
  96. package/dist/models/default/django_app/dailyrate.schema.json +7 -7
  97. package/dist/models/default/django_app/deepmodellevel1.d.ts +1 -13
  98. package/dist/models/default/django_app/deepmodellevel1.schema.json +2 -14
  99. package/dist/models/default/django_app/deepmodellevel2.d.ts +1 -13
  100. package/dist/models/default/django_app/deepmodellevel2.schema.json +1 -13
  101. package/dist/models/default/django_app/deepmodellevel3.d.ts +1 -13
  102. package/dist/models/default/django_app/deepmodellevel3.schema.json +1 -13
  103. package/dist/models/default/django_app/dummymodel.d.ts +1 -13
  104. package/dist/models/default/django_app/dummymodel.schema.json +4 -16
  105. package/dist/models/default/django_app/dummyrelatedmodel.d.ts +1 -13
  106. package/dist/models/default/django_app/dummyrelatedmodel.schema.json +1 -13
  107. package/dist/models/default/django_app/errortestcompoundunique.d.ts +124 -0
  108. package/dist/models/default/django_app/errortestcompoundunique.js +69 -0
  109. package/dist/models/default/django_app/errortestcompoundunique.schema.json +106 -0
  110. package/dist/models/default/django_app/errortestonetoonemodel.d.ts +118 -0
  111. package/dist/models/default/django_app/errortestonetoonemodel.js +71 -0
  112. package/dist/models/default/django_app/errortestonetoonemodel.schema.json +90 -0
  113. package/dist/models/default/django_app/errortestparent.d.ts +92 -0
  114. package/dist/models/default/django_app/errortestparent.js +69 -0
  115. package/dist/models/default/django_app/errortestparent.schema.json +70 -0
  116. package/dist/models/default/django_app/errortestprotectedchild.d.ts +118 -0
  117. package/dist/models/default/django_app/errortestprotectedchild.js +71 -0
  118. package/dist/models/default/django_app/errortestprotectedchild.schema.json +94 -0
  119. package/dist/models/default/django_app/errortestuniquemodel.d.ts +108 -0
  120. package/dist/models/default/django_app/errortestuniquemodel.js +69 -0
  121. package/dist/models/default/django_app/errortestuniquemodel.schema.json +88 -0
  122. package/dist/models/default/django_app/excludeditem.d.ts +124 -0
  123. package/dist/models/default/django_app/excludeditem.js +69 -0
  124. package/dist/models/default/django_app/excludeditem.schema.json +105 -0
  125. package/dist/models/default/django_app/filetest.d.ts +1 -13
  126. package/dist/models/default/django_app/filetest.schema.json +1 -13
  127. package/dist/models/default/django_app/hfchild.d.ts +118 -0
  128. package/dist/models/default/django_app/hfchild.js +71 -0
  129. package/dist/models/default/django_app/hfchild.schema.json +94 -0
  130. package/dist/models/default/django_app/hfparent.d.ts +124 -0
  131. package/dist/models/default/django_app/hfparent.js +69 -0
  132. package/dist/models/default/django_app/hfparent.schema.json +105 -0
  133. package/dist/models/default/django_app/index.js +19 -0
  134. package/dist/models/default/django_app/m2mdepthtestlevel1.schema.json +3 -3
  135. package/dist/models/default/django_app/m2mdepthtestlevel2.schema.json +3 -3
  136. package/dist/models/default/django_app/m2mdepthtestlevel3.schema.json +5 -5
  137. package/dist/models/default/django_app/modelwithrestrictedfields.schema.json +2 -2
  138. package/dist/models/default/django_app/nodeleteitem.d.ts +124 -0
  139. package/dist/models/default/django_app/nodeleteitem.js +69 -0
  140. package/dist/models/default/django_app/nodeleteitem.schema.json +105 -0
  141. package/dist/models/default/django_app/objectlevelitem.d.ts +124 -0
  142. package/dist/models/default/django_app/objectlevelitem.js +69 -0
  143. package/dist/models/default/django_app/objectlevelitem.schema.json +105 -0
  144. package/dist/models/default/django_app/order.schema.json +7 -7
  145. package/dist/models/default/django_app/orderitem.schema.json +5 -5
  146. package/dist/models/default/django_app/product.schema.json +11 -11
  147. package/dist/models/default/django_app/productcategory.schema.json +2 -2
  148. package/dist/models/default/django_app/rateplan.schema.json +2 -2
  149. package/dist/models/default/django_app/readonlyitem.d.ts +124 -0
  150. package/dist/models/default/django_app/readonlyitem.js +69 -0
  151. package/dist/models/default/django_app/readonlyitem.schema.json +105 -0
  152. package/dist/models/default/django_app/restrictedcreateitem.d.ts +124 -0
  153. package/dist/models/default/django_app/restrictedcreateitem.js +69 -0
  154. package/dist/models/default/django_app/restrictedcreateitem.schema.json +105 -0
  155. package/dist/models/default/django_app/restrictededititem.d.ts +124 -0
  156. package/dist/models/default/django_app/restrictededititem.js +69 -0
  157. package/dist/models/default/django_app/restrictededititem.schema.json +105 -0
  158. package/dist/models/default/django_app/restrictedfieldrelatedmodel.schema.json +1 -1
  159. package/dist/models/default/django_app/rowfiltereditem.d.ts +124 -0
  160. package/dist/models/default/django_app/rowfiltereditem.js +69 -0
  161. package/dist/models/default/django_app/rowfiltereditem.schema.json +105 -0
  162. package/dist/models/default/django_app/tag.d.ts +554 -0
  163. package/dist/models/default/django_app/tag.js +71 -0
  164. package/dist/models/default/django_app/tag.schema.json +541 -0
  165. package/dist/models/default/django_app/updateonlyitem.d.ts +108 -0
  166. package/dist/models/default/django_app/updateonlyitem.js +69 -0
  167. package/dist/models/default/django_app/updateonlyitem.schema.json +88 -0
  168. package/dist/schemaIntegrity.d.ts +14 -0
  169. package/dist/schemaIntegrity.js +29 -0
  170. package/dist/setup.js +6 -0
  171. package/dist/syncEngine/cache/cache.d.ts +1 -1
  172. package/dist/syncEngine/cache/cache.js +8 -1
  173. package/dist/syncEngine/registries/metricRegistry.d.ts +14 -3
  174. package/dist/syncEngine/registries/metricRegistry.js +20 -6
  175. package/dist/syncEngine/stores/operationEventHandlers.js +10 -8
  176. package/dist/syncEngine/stores/querysetStore.js +27 -6
  177. package/package.json +1 -1
@@ -1,23 +1,23 @@
1
- import { ref as J, computed as R, onMounted as us, onBeforeUnmount as hs, watch as it, createElementBlock as $, openBlock as A, createElementVNode as h, createVNode as Tt, toDisplayString as S, createCommentVNode as V, Fragment as W, renderList as ce, normalizeClass as Mt, normalizeStyle as at, withDirectives as Ue, createTextVNode as Qe, vModelCheckbox as $t, vModelSelect as At, Transition as Ot, withCtx as Pt } from "vue";
1
+ import { ref as J, computed as R, onMounted as fs, onBeforeUnmount as ps, watch as it, createElementBlock as $, openBlock as A, createElementVNode as h, createVNode as Mt, toDisplayString as S, createCommentVNode as V, Fragment as W, renderList as ce, normalizeClass as $t, normalizeStyle as at, withDirectives as Qe, createTextVNode as Ve, vModelCheckbox as At, vModelSelect as Ot, Transition as Pt, withCtx as Ft } from "vue";
2
2
  import { v7 as G } from "uuid";
3
- import { isNil as E, isEmpty as Ce, trim as dt, isEqual as qe } from "lodash-es";
3
+ import { isNil as E, isEmpty as ve, trim as ut, isEqual as qe } from "lodash-es";
4
4
  import Ae from "mitt";
5
- import Ft from "handlebars";
5
+ import It from "handlebars";
6
6
  import Dt from "superjson";
7
- import fs from "p-queue";
8
- import ps from "axios";
7
+ import ms from "p-queue";
8
+ import ys from "axios";
9
9
  import { z as P } from "zod";
10
- import ms from "pusher-js";
11
- import Wt, { createEqualsOperation as ee } from "sift";
12
- import { DateTime as ge } from "luxon";
13
- import { parse as ys, format as gs } from "date-fns";
14
- import { Graph as It } from "graphlib";
10
+ import gs from "pusher-js";
11
+ import Yt, { createEqualsOperation as ee } from "sift";
12
+ import { DateTime as _e } from "luxon";
13
+ import { parse as _s, format as ws } from "date-fns";
14
+ import { Graph as zt } from "graphlib";
15
15
  import Le from "object-hash";
16
- import * as Zt from "mathjs";
17
- import _s from "rfdc";
18
- const se = /* @__PURE__ */ new Map(), ut = /* @__PURE__ */ new Set();
19
- function ws(n) {
20
- return ut.add(n), () => ut.delete(n);
16
+ import * as Xt from "mathjs";
17
+ import Cs from "rfdc";
18
+ const se = /* @__PURE__ */ new Map(), ht = /* @__PURE__ */ new Set();
19
+ function vs(n) {
20
+ return ht.add(n), () => ht.delete(n);
21
21
  }
22
22
  function Je(n) {
23
23
  return typeof n == "string" && /\{\{\s*TempPK_[^}\s]+\s*\}\}/.test(n);
@@ -25,17 +25,17 @@ function Je(n) {
25
25
  function Kt(n) {
26
26
  return `{{TempPK_${n}}}`;
27
27
  }
28
- function zt(n, e) {
28
+ function Rt(n, e) {
29
29
  const t = `{{TempPK_${n}}}`, s = `"TempPK_${n}"`, r = typeof e == "string" ? `"${e}"` : String(e);
30
30
  se.set(s, r);
31
- for (const o of ut)
31
+ for (const o of ht)
32
32
  try {
33
33
  o(t, e);
34
34
  } catch (i) {
35
35
  console.warn("[tempPk] onResolve callback error:", i);
36
36
  }
37
37
  }
38
- function Cs(n) {
38
+ function Es(n) {
39
39
  if (!Je(String(n))) return n;
40
40
  const e = String(n).match(/\{\{\s*TempPK_([^}\s]+)\s*\}\}/);
41
41
  if (!e) return n;
@@ -47,15 +47,15 @@ function We(n) {
47
47
  const e = Object.fromEntries(se);
48
48
  try {
49
49
  if (typeof n == "string")
50
- return Ft.compile(n, { noEscape: !0 })(e);
51
- const t = Dt.stringify(n), r = Ft.compile(t, { noEscape: !0 })(e);
50
+ return It.compile(n, { noEscape: !0 })(e);
51
+ const t = Dt.stringify(n), r = It.compile(t, { noEscape: !0 })(e);
52
52
  return Dt.parse(r);
53
53
  } catch {
54
54
  return n;
55
55
  }
56
56
  }
57
- const vs = Ae(), Es = Ae(), Rt = Ae();
58
- class bs {
57
+ const bs = Ae(), ks = Ae(), Nt = Ae(), lt = /* @__PURE__ */ new Map();
58
+ class Ss {
59
59
  constructor(e, t = {}) {
60
60
  this.dbName = e, this.storeName = t.storeName || "keyval-store", this.batchDelay = t.batchDelay || 50, this.version = t.version || 5, this.resetOnErrors = t.resetOnErrors || [
61
61
  "VersionError",
@@ -236,9 +236,9 @@ class bs {
236
236
  }
237
237
  }
238
238
  }
239
- class vt {
239
+ class Et {
240
240
  constructor(e, t = {}, s = null) {
241
- this.store = new bs(e, t), this.localMap = /* @__PURE__ */ new Map(), this.hydrate().then((r) => {
241
+ lt.has(e) ? this.store = lt.get(e) : (this.store = new Ss(e, t), lt.set(e, this.store)), this.localMap = /* @__PURE__ */ new Map(), this.hydrate().then((r) => {
242
242
  typeof s == "function" && s(r);
243
243
  }).catch((r) => {
244
244
  console.error(`Cache hydration failed for "${e}":`, r);
@@ -285,7 +285,7 @@ class vt {
285
285
  });
286
286
  }
287
287
  }
288
- const ye = (n, e) => {
288
+ const ge = (n, e) => {
289
289
  if (!e || !e.pks || e.pks.length === 0) return;
290
290
  const t = e.pks.map((r) => n._lastRenderedData.get(r) ?? null), s = n.render(e.pks, !0, !1);
291
291
  if (!qe(s, t)) {
@@ -294,7 +294,7 @@ const ye = (n, e) => {
294
294
  o && o[r] != null && n._lastRenderedData.set(o[r], o);
295
295
  for (const o of e.pks)
296
296
  s.some((i) => i && i[r] === o) || n._lastRenderedData.set(o, null);
297
- vs.emit(
297
+ bs.emit(
298
298
  `${n.modelClass.configKey}::${n.modelClass.modelName}::render`,
299
299
  e
300
300
  ), n.renderCallbacks.forEach((o) => {
@@ -340,14 +340,14 @@ class Y {
340
340
  return r.size > 0 ? new Y(t, Array.from(r)) : null;
341
341
  }
342
342
  }
343
- class ks {
343
+ class Ts {
344
344
  modelClass;
345
345
  fetchFn;
346
346
  groundTruthArray;
347
347
  operationsMap;
348
348
  isSyncing;
349
349
  constructor(e, t, s = null, r = null, o = {}) {
350
- this.modelClass = e, this.fetchFn = t, this.isSyncing = !1, this.pruneThreshold = o.pruneThreshold || 10, this.groundTruthArray = s || [], this.operationsMap = /* @__PURE__ */ new Map(), r && r.length > 0 && this._loadOperations(r), this.modelCache = new vt("model-cache", {}, this.onHydrated.bind(this)), this._lastRenderedData = /* @__PURE__ */ new Map(), this.renderCallbacks = /* @__PURE__ */ new Set(), this._unsubscribeTempPk = ws((i, l) => {
350
+ this.modelClass = e, this.fetchFn = t, this.isSyncing = !1, this.pruneThreshold = o.pruneThreshold || 10, this.groundTruthArray = s || [], this.operationsMap = /* @__PURE__ */ new Map(), r && r.length > 0 && this._loadOperations(r), this.modelCache = new Et("model-cache", {}, this.onHydrated.bind(this)), this._lastRenderedData = /* @__PURE__ */ new Map(), this.renderCallbacks = /* @__PURE__ */ new Set(), this._unsubscribeTempPk = vs((i, l) => {
351
351
  if (this._lastRenderedData.has(i)) {
352
352
  const a = this._lastRenderedData.get(i);
353
353
  a && typeof a == "object" && (a[this.pkField] = l), this._lastRenderedData.set(l, a), this._lastRenderedData.delete(i);
@@ -363,7 +363,7 @@ class ks {
363
363
  */
364
364
  _loadOperations(e) {
365
365
  e.forEach((t) => {
366
- const s = Oe.get(t.operationId);
366
+ const s = Pe.get(t.operationId);
367
367
  s ? this.operationsMap.set(s.operationId, s) : this.operationsMap.set(t.operationId, new q(t, !0));
368
368
  });
369
369
  }
@@ -374,7 +374,7 @@ class ks {
374
374
  onHydrated() {
375
375
  if (this.groundTruthArray.length === 0 && this.operationsMap.size === 0) {
376
376
  let e = this.modelCache.get(this.cacheKey);
377
- !E(e) && !Ce(e) && this.setGroundTruth(e);
377
+ !E(e) && !ve(e) && this.setGroundTruth(e);
378
378
  }
379
379
  }
380
380
  setCache(e) {
@@ -382,7 +382,7 @@ class ks {
382
382
  let s = [];
383
383
  e.forEach((r) => {
384
384
  let o = r[t];
385
- if (!(typeof o == "string" && Je(o) && (o = We(r[t]), E(o) || Ce(dt(o)))))
385
+ if (!(typeof o == "string" && Je(o) && (o = We(r[t]), E(o) || ve(ut(o)))))
386
386
  if (r && typeof r.serialize == "function") {
387
387
  const i = r.serialize(!0);
388
388
  i[t] = o, s.push(i);
@@ -398,7 +398,7 @@ class ks {
398
398
  let r = [];
399
399
  if (e.forEach((c) => {
400
400
  let f = c[s];
401
- typeof f == "string" && Je(f) && (f = We(c[s]), E(f) || Ce(dt(f))) || (c[s] = f, r.push(c));
401
+ typeof f == "string" && Je(f) && (f = We(c[s]), E(f) || ve(ut(f))) || (c[s] = f, r.push(c));
402
402
  }), t === null) {
403
403
  this.setCache(r);
404
404
  return;
@@ -422,16 +422,16 @@ class ks {
422
422
  }
423
423
  // Commit optimistic updates
424
424
  addOperation(e) {
425
- this.operationsMap.set(e.operationId, e), this.operationsMap.size > this.pruneThreshold && this.prune(), ye(this, Y.fromOperation(e));
425
+ this.operationsMap.set(e.operationId, e), this.operationsMap.size > this.pruneThreshold && this.prune(), ge(this, Y.fromOperation(e));
426
426
  }
427
427
  updateOperation(e) {
428
- return this.operationsMap.has(e.operationId) ? (this.operationsMap.set(e.operationId, e), ye(this, Y.fromOperation(e)), !0) : !1;
428
+ return this.operationsMap.has(e.operationId) ? (this.operationsMap.set(e.operationId, e), ge(this, Y.fromOperation(e)), !0) : !1;
429
429
  }
430
430
  confirm(e) {
431
- this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), ye(this, Y.fromOperation(e)));
431
+ this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), ge(this, Y.fromOperation(e)));
432
432
  }
433
433
  reject(e) {
434
- this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), ye(this, Y.fromOperation(e)));
434
+ this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), ge(this, Y.fromOperation(e)));
435
435
  }
436
436
  setOperations(e = []) {
437
437
  const t = this.operations;
@@ -439,14 +439,14 @@ class ks {
439
439
  this.operationsMap.set(r.operationId, r);
440
440
  });
441
441
  const s = [...t, ...this.operations];
442
- ye(this, Y.fromOperations(s));
442
+ ge(this, Y.fromOperations(s));
443
443
  }
444
444
  // Ground truth data methods
445
445
  setGroundTruth(e) {
446
446
  let t = this.groundTruthArray;
447
447
  this.groundTruthArray = Array.isArray(e) ? e : [];
448
448
  const s = [...t, ...this.groundTruthArray];
449
- ye(this, Y.fromInstances(s, this.modelClass));
449
+ ge(this, Y.fromInstances(s, this.modelClass));
450
450
  }
451
451
  getGroundTruth() {
452
452
  return this.groundTruthArray;
@@ -491,7 +491,7 @@ class ks {
491
491
  l
492
492
  );
493
493
  }
494
- ye(
494
+ ge(
495
495
  this,
496
496
  Y.fromInstances(
497
497
  [...i, ...Array.from(s.values())],
@@ -600,7 +600,7 @@ class ks {
600
600
  // Render methods
601
601
  render(e = null, t = !0, s = !0) {
602
602
  if (s && e !== null) {
603
- const o = (Array.isArray(e) ? e : [e]).map((a) => Cs(a)), i = [];
603
+ const o = (Array.isArray(e) ? e : [e]).map((a) => Es(a)), i = [];
604
604
  for (const a of o)
605
605
  this._lastRenderedData.has(a) || i.push(a);
606
606
  if (i.length === 0)
@@ -688,7 +688,7 @@ class Ge {
688
688
  const t = async ({ pks: s, modelClass: r }) => await r.objects.filter({
689
689
  [`${r.primaryKeyField}__in`]: s
690
690
  }).fetch().serialize();
691
- this._stores.set(e, new ks(e, t, null, null)), this.syncManager.followModel(this, e);
691
+ this._stores.set(e, new Ts(e, t, null, null)), this.syncManager.followModel(this, e);
692
692
  }
693
693
  return this._stores.get(e);
694
694
  }
@@ -751,7 +751,7 @@ class q {
751
751
  throw new Error(`All operation instances must be objects with the '${o}' field`);
752
752
  this.#e = r;
753
753
  const i = r.map((a) => a[o]);
754
- Q.getStore(s).render(i, !0, !1), this.#t = r.map((a) => s.fromPk(a[o]).serialize()), this.timestamp = e.timestamp || Date.now(), !t && (Oe.register(this), ie.emit(C.CREATED, this));
754
+ Q.getStore(s).render(i, !0, !1), this.#t = r.map((a) => s.fromPk(a[o]).serialize()), this.timestamp = e.timestamp || Date.now(), !t && (Pe.register(this), ie.emit(C.CREATED, this));
755
755
  }
756
756
  /**
757
757
  * Getter for instances that replaces any temporary PKs with real PKs
@@ -818,7 +818,7 @@ class q {
818
818
  return e.instances && !Array.isArray(e.instances) && (e.instances = [e.instances]), Object.assign(this, e), this.timestamp = Date.now(), ie.emit(C.MUTATED, this), this;
819
819
  }
820
820
  }
821
- class Ss {
821
+ class Ms {
822
822
  constructor() {
823
823
  this._operations = /* @__PURE__ */ new Map(), this._querysetStates = /* @__PURE__ */ new Map();
824
824
  }
@@ -903,11 +903,11 @@ class Ss {
903
903
  return t.length > 0 ? t[t.length - 1] : void 0;
904
904
  }
905
905
  }
906
- const Oe = new Ss(), Ts = Ae();
907
- function Ms(n) {
908
- Ts.emit("error", n);
906
+ const Pe = new Ms(), $s = Ae();
907
+ function As(n) {
908
+ $s.emit("error", n);
909
909
  }
910
- class ve extends Error {
910
+ class fe extends Error {
911
911
  /**
912
912
  * Creates a new StateZeroError.
913
913
  *
@@ -917,7 +917,7 @@ class ve extends Error {
917
917
  * @param {number} status - The HTTP status code.
918
918
  */
919
919
  constructor(e, t, s, r) {
920
- super(e), this.name = "StateZeroError", this.code = t, this.detail = s, this.status = r, Object.setPrototypeOf(this, new.target.prototype), Ms(this);
920
+ super(e), this.name = "StateZeroError", this.code = t, this.detail = s, this.status = r, Object.setPrototypeOf(this, new.target.prototype), As(this);
921
921
  }
922
922
  /**
923
923
  * Returns a full error message including the detail.
@@ -939,7 +939,7 @@ class ve extends Error {
939
939
  return this.message;
940
940
  }
941
941
  }
942
- class Ve extends ve {
942
+ class Oe extends fe {
943
943
  /**
944
944
  * Creates a new ValidationError.
945
945
  *
@@ -950,7 +950,7 @@ class Ve extends ve {
950
950
  super("Validation error", "validation_error", e, t), this.name = "ValidationError";
951
951
  }
952
952
  }
953
- class Nt extends ve {
953
+ class xt extends fe {
954
954
  /**
955
955
  * Creates a new DoesNotExist error.
956
956
  *
@@ -961,7 +961,7 @@ class Nt extends ve {
961
961
  super("DoesNotExist", "does_not_exist", e, t), this.name = "DoesNotExist";
962
962
  }
963
963
  }
964
- class lt extends ve {
964
+ class ct extends fe {
965
965
  /**
966
966
  * Creates a new PermissionDenied error.
967
967
  *
@@ -972,7 +972,7 @@ class lt extends ve {
972
972
  super("Permission denied", "permission_denied", e, t), this.name = "PermissionDenied";
973
973
  }
974
974
  }
975
- class $s extends ve {
975
+ class Os extends fe {
976
976
  /**
977
977
  * Creates a new MultipleObjectsReturned error.
978
978
  *
@@ -983,7 +983,18 @@ class $s extends ve {
983
983
  super("Multiple objects returned", "multiple_objects_returned", e, t), this.name = "MultipleObjectsReturned";
984
984
  }
985
985
  }
986
- class As extends ve {
986
+ class jt extends fe {
987
+ /**
988
+ * Creates a new ConflictError.
989
+ *
990
+ * @param {IErrorDetail|Object|string} [detail="A database conflict occurred."] - The error details.
991
+ * @param {number} [status=409] - The HTTP status code.
992
+ */
993
+ constructor(e = "A database conflict occurred.", t = 409) {
994
+ super("Conflict", "conflict", e, t), this.name = "ConflictError";
995
+ }
996
+ }
997
+ class Ps extends fe {
987
998
  /**
988
999
  * Creates a new ASTValidationError.
989
1000
  *
@@ -994,7 +1005,7 @@ class As extends ve {
994
1005
  super("Query syntax error", "ast_validation_error", e, t), this.name = "ASTValidationError";
995
1006
  }
996
1007
  }
997
- class x extends ve {
1008
+ class x extends fe {
998
1009
  /**
999
1010
  * Creates a new ConfigError.
1000
1011
  *
@@ -1005,34 +1016,36 @@ class x extends ve {
1005
1016
  super("Configuration error", "config_error", e, t), this.name = "ConfigError";
1006
1017
  }
1007
1018
  }
1008
- function Os(n) {
1019
+ function Fs(n) {
1009
1020
  const { status: e, type: t, detail: s } = n;
1010
1021
  if (t === void 0 && s === "Invalid token.")
1011
- return new lt(s, 403);
1022
+ return new ct(s, 403);
1012
1023
  switch (t) {
1013
1024
  // Direct mappings
1014
1025
  case "ValidationError":
1015
- return new Ve(s, e);
1026
+ return new Oe(s, e);
1016
1027
  case "NotFound":
1017
- return new Nt(s, e);
1028
+ return new xt(s, e);
1018
1029
  case "MultipleObjectsReturned":
1019
- return new $s(s, e);
1030
+ return new Os(s, e);
1020
1031
  case "PermissionDenied":
1021
- return new lt(s, e);
1032
+ return new ct(s, e);
1033
+ case "ConflictError":
1034
+ return new jt(s, e);
1022
1035
  case "ASTValidationError":
1023
- return new As(s, e);
1036
+ return new Ps(s, e);
1024
1037
  case "ConfigError":
1025
1038
  return new x(s, e);
1026
1039
  // Django error types that map to our error classes
1027
1040
  case "FieldError":
1028
- return new Ve(s, e);
1041
+ return new Oe(s, e);
1029
1042
  case "ValueError":
1030
- return new Ve(s, e);
1043
+ return new Oe(s, e);
1031
1044
  default:
1032
- return e === 400 ? new Ve(s, e) : e === 403 ? new lt(s, e) : e === 404 ? new Nt(s, e) : new ve("Unknown error", "unknown", s, e);
1045
+ return e === 400 ? new Oe(s, e) : e === 403 ? new ct(s, e) : e === 404 ? new xt(s, e) : e === 409 ? new jt(s, e) : new fe("Unknown error", "unknown", s, e);
1033
1046
  }
1034
1047
  }
1035
- const xt = {
1048
+ const Ut = {
1036
1049
  CREATE: "create",
1037
1050
  UPDATE: "update",
1038
1051
  DELETE: "delete",
@@ -1040,7 +1053,7 @@ const xt = {
1040
1053
  BULK_UPDATE: "bulk_update",
1041
1054
  BULK_DELETE: "bulk_delete"
1042
1055
  };
1043
- class Ps {
1056
+ class Is {
1044
1057
  /**
1045
1058
  * @param {PusherReceiverOptions} options
1046
1059
  * @param {string} configKey - The backend configuration key
@@ -1050,7 +1063,7 @@ class Ps {
1050
1063
  this.configKey = t, this.connectionTimeoutId = null, s.appKey && /^\d+$/.test(s.appKey) && s.appKey.length < 15 && console.warn(
1051
1064
  `%c[Pusher Warning] The provided appKey ("${s.appKey}") looks like a numeric app_id. Pusher requires the alphanumeric key, not the ID. Please verify your configuration for backend: "${this.configKey}".`,
1052
1065
  "color: orange; font-weight: bold; font-size: 14px;"
1053
- ), this.pusherClient = new ms(s.appKey, {
1066
+ ), this.pusherClient = new gs(s.appKey, {
1054
1067
  cluster: s.cluster,
1055
1068
  forceTLS: s.forceTLS ?? !0,
1056
1069
  authEndpoint: s.authEndpoint,
@@ -1130,7 +1143,7 @@ Common causes:
1130
1143
  `%cAuthentication failed for channel ${t}. Check your authEndpoint and server-side permissions.`,
1131
1144
  "color: orange; font-weight: bold;"
1132
1145
  );
1133
- }), Object.values(xt).forEach((r) => {
1146
+ }), Object.values(Ut).forEach((r) => {
1134
1147
  s.bind(r, (o) => {
1135
1148
  const i = {
1136
1149
  ...o,
@@ -1145,7 +1158,7 @@ Common causes:
1145
1158
  unsubscribe(e) {
1146
1159
  const t = this.channels.get(e);
1147
1160
  if (!t) return;
1148
- Object.values(xt).forEach((r) => {
1161
+ Object.values(Ut).forEach((r) => {
1149
1162
  t.unbind(r);
1150
1163
  });
1151
1164
  const s = e.startsWith("private-") ? e : this.formatChannelName(e);
@@ -1188,20 +1201,20 @@ Common causes:
1188
1201
  }
1189
1202
  }
1190
1203
  const Ze = /* @__PURE__ */ new Map();
1191
- function Fs(n, e) {
1204
+ function Ds(n, e) {
1192
1205
  const t = Ze.get(n);
1193
1206
  t && t.disconnect(), Ze.set(n, e), e.connect();
1194
1207
  }
1195
- function jt(n = "default") {
1208
+ function Qt(n = "default") {
1196
1209
  return Ze.get(n);
1197
1210
  }
1198
- function Ds() {
1211
+ function zs() {
1199
1212
  return Ze;
1200
1213
  }
1201
- let Ut = {
1214
+ let Vt = {
1202
1215
  backendConfigs: {}
1203
1216
  };
1204
- const Is = P.object({
1217
+ const Ks = P.object({
1205
1218
  clientOptions: P.object({
1206
1219
  appKey: P.string({ required_error: "Pusher appKey is required" }),
1207
1220
  cluster: P.string({ required_error: "Pusher cluster is required" }),
@@ -1212,10 +1225,10 @@ const Is = P.object({
1212
1225
  "getAuthHeaders must be a function if provided"
1213
1226
  )
1214
1227
  })
1215
- }), Ks = P.object({
1228
+ }), Rs = P.object({
1216
1229
  type: P.enum(["websocket", "pusher", "none"]),
1217
1230
  websocketUrl: P.string().url().optional(),
1218
- pusher: Is.optional(),
1231
+ pusher: Ks.optional(),
1219
1232
  hotpaths: P.array(P.string()).default(["default"])
1220
1233
  }).superRefine((n, e) => {
1221
1234
  n.type === "websocket" && (n.websocketUrl || e.addIssue({
@@ -1245,8 +1258,8 @@ const Is = P.object({
1245
1258
  (n) => n === void 0 || typeof n == "function",
1246
1259
  "eventInterceptor must be a function if provided"
1247
1260
  ),
1248
- events: P.lazy(() => Ks.optional())
1249
- }), zs = P.object({
1261
+ events: P.lazy(() => Rs.optional())
1262
+ }), Ns = P.object({
1250
1263
  backendConfigs: P.record(P.string(), Be).refine(
1251
1264
  (n) => {
1252
1265
  for (const [e, t] of Object.entries(n))
@@ -1268,22 +1281,22 @@ const Is = P.object({
1268
1281
  ),
1269
1282
  periodicSyncIntervalSeconds: P.number().min(5).nullable().optional().default(null)
1270
1283
  });
1271
- let ht = null;
1272
- function Rs(n) {
1273
- Ut = n;
1274
- const e = zs.safeParse(Ut);
1284
+ let ft = null;
1285
+ function xs(n) {
1286
+ Vt = n;
1287
+ const e = Ns.safeParse(Vt);
1275
1288
  if (!e.success) {
1276
1289
  const t = e.error.errors.map((s) => s.message);
1277
1290
  throw new x(`Error setting configuration: ${t.join(", ")}`);
1278
1291
  }
1279
- ht = e.data;
1292
+ ft = e.data;
1280
1293
  }
1281
1294
  function he() {
1282
- if (!ht)
1295
+ if (!ft)
1283
1296
  throw new x("Configuration not set. Please call setConfig() with a valid configuration.");
1284
- return ht;
1297
+ return ft;
1285
1298
  }
1286
- function Ns(n, e) {
1299
+ function js(n, e) {
1287
1300
  try {
1288
1301
  const t = he();
1289
1302
  if (!t.backendConfigs[n])
@@ -1298,7 +1311,7 @@ function Ns(n, e) {
1298
1311
  throw t instanceof x ? t : new x(t.message || "Invalid backend configuration");
1299
1312
  }
1300
1313
  }
1301
- function Yt(n = "default") {
1314
+ function es(n = "default") {
1302
1315
  try {
1303
1316
  const e = he();
1304
1317
  if (!e.backendConfigs[n])
@@ -1320,24 +1333,24 @@ function Yt(n = "default") {
1320
1333
  ...t.events.pusher.clientOptions,
1321
1334
  getAuthHeaders: i
1322
1335
  };
1323
- s = new Ps({ clientOptions: l }, n);
1336
+ s = new Is({ clientOptions: l }, n);
1324
1337
  break;
1325
1338
  case "none":
1326
1339
  return null;
1327
1340
  default:
1328
1341
  throw new x(`Unknown event receiver type: ${t.events.type}`);
1329
1342
  }
1330
- return s && Fs(n, s), s;
1343
+ return s && Ds(n, s), s;
1331
1344
  } catch (e) {
1332
1345
  throw e instanceof x ? e : new x(`Failed to initialize event receiver: ${e.message}`);
1333
1346
  }
1334
1347
  }
1335
- function xs() {
1348
+ function Us() {
1336
1349
  try {
1337
1350
  const n = he(), e = {};
1338
1351
  return Object.keys(n.backendConfigs).forEach((t) => {
1339
1352
  try {
1340
- e[t] = Yt(t);
1353
+ e[t] = es(t);
1341
1354
  } catch (s) {
1342
1355
  console.warn(`Failed to initialize event receiver for backend "${t}": ${s.message}`);
1343
1356
  }
@@ -1346,13 +1359,13 @@ function xs() {
1346
1359
  throw new x(`Failed to initialize event receivers: ${n.message}`);
1347
1360
  }
1348
1361
  }
1349
- let ft = null;
1350
- function js(n) {
1362
+ let pt = null;
1363
+ function Qs(n) {
1351
1364
  if (typeof n != "function")
1352
1365
  throw new x("Provided model getter must be a function.");
1353
- ft = n;
1366
+ pt = n;
1354
1367
  }
1355
- function Us(n, e = "default") {
1368
+ function Vs(n, e = "default") {
1356
1369
  if (n && n.startsWith("http"))
1357
1370
  return n;
1358
1371
  const s = he().backendConfigs[e];
@@ -1360,20 +1373,20 @@ function Us(n, e = "default") {
1360
1373
  throw new x(`Backend "${e}" not found in configuration.`);
1361
1374
  return s.fileRootURL ? s.fileRootURL.replace(/\/$/, "") + n : n;
1362
1375
  }
1363
- function Xt(n, e) {
1364
- if (!ft)
1376
+ function ts(n, e) {
1377
+ if (!pt)
1365
1378
  throw new x("Model registry not registered. Please call registerModelGetter() with the function from model-registry.js during app initialization.");
1366
- return ft(n, e);
1379
+ return pt(n, e);
1367
1380
  }
1368
- const Fe = {
1369
- setConfig: Rs,
1381
+ const Ie = {
1382
+ setConfig: xs,
1370
1383
  getConfig: he,
1371
- setBackendConfig: Ns,
1372
- initializeEventReceiver: Yt,
1373
- registerModelGetter: js,
1374
- getModelClass: Xt,
1375
- buildFileUrl: Us
1376
- }, es = "__STATEZERO_DEBUG__", X = globalThis[es] || {
1384
+ setBackendConfig: js,
1385
+ initializeEventReceiver: es,
1386
+ registerModelGetter: Qs,
1387
+ getModelClass: ts,
1388
+ buildFileUrl: Vs
1389
+ }, ss = "__STATEZERO_DEBUG__", X = globalThis[ss] || {
1377
1390
  emitter: Ae(),
1378
1391
  buffer: [],
1379
1392
  enabled: !0,
@@ -1381,7 +1394,7 @@ const Fe = {
1381
1394
  maxEntries: 500,
1382
1395
  nextId: 1
1383
1396
  };
1384
- globalThis[es] = X;
1397
+ globalThis[ss] = X;
1385
1398
  const Me = X.emitter, ue = X.buffer;
1386
1399
  function Te(n) {
1387
1400
  if (!X.enabled) return;
@@ -1395,23 +1408,23 @@ function Te(n) {
1395
1408
  function B(n) {
1396
1409
  Te(n);
1397
1410
  }
1398
- function Qs(n) {
1411
+ function Ls(n) {
1399
1412
  return Me.on("record", n), () => Me.off("record", n);
1400
1413
  }
1401
- function Vs(n) {
1414
+ function Gs(n) {
1402
1415
  return Me.on("clear", n), () => Me.off("clear", n);
1403
1416
  }
1404
- function Qt() {
1417
+ function Lt() {
1405
1418
  return ue.slice();
1406
1419
  }
1407
- function Ls() {
1420
+ function Bs() {
1408
1421
  ue.length = 0, Me.emit("clear");
1409
1422
  }
1410
- function Vt(n) {
1423
+ function Gt(n) {
1411
1424
  const e = Number(n);
1412
1425
  !Number.isFinite(e) || e <= 0 || (X.maxEntries = Math.floor(e), ue.length > X.maxEntries && ue.splice(0, ue.length - X.maxEntries));
1413
1426
  }
1414
- function Gs() {
1427
+ function Hs() {
1415
1428
  X.started || (X.started = !0, ie.on(C.CREATED, (n) => {
1416
1429
  Te({
1417
1430
  type: "operation",
@@ -1464,11 +1477,11 @@ function Gs() {
1464
1477
  Te({ type: "operation", subtype: C.CLEAR });
1465
1478
  }));
1466
1479
  }
1467
- const ct = /* @__PURE__ */ new Map();
1468
- function Bs(n = "default") {
1469
- return ct.has(n) || ct.set(n, new fs({ concurrency: 1 })), ct.get(n);
1480
+ const dt = /* @__PURE__ */ new Map();
1481
+ function qs(n = "default") {
1482
+ return dt.has(n) || dt.set(n, new ms({ concurrency: 1 })), dt.get(n);
1470
1483
  }
1471
- function Hs(n, e = 3e4) {
1484
+ function Js(n, e = 3e4) {
1472
1485
  return Promise.race([
1473
1486
  n,
1474
1487
  new Promise(
@@ -1476,14 +1489,14 @@ function Hs(n, e = 3e4) {
1476
1489
  )
1477
1490
  ]);
1478
1491
  }
1479
- function _e(n, e, t, s = null) {
1492
+ function we(n, e, t, s = null) {
1480
1493
  if (!e) return;
1481
1494
  const r = t.configKey;
1482
1495
  let o = null;
1483
1496
  s && (o = j.getStore(s));
1484
1497
  try {
1485
1498
  for (const [i, l] of Object.entries(e)) {
1486
- const a = Fe.getModelClass(i, r);
1499
+ const a = Ie.getModelClass(i, r);
1487
1500
  if (!a)
1488
1501
  throw console.error(
1489
1502
  `Model class not found for ${i} in config ${r}`
@@ -1505,7 +1518,7 @@ function _e(n, e, t, s = null) {
1505
1518
  }
1506
1519
  }
1507
1520
  async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
1508
- const { namespace: l = "default", timeout: a } = i, c = n.ModelClass, p = Fe.getConfig().backendConfigs[c.configKey];
1521
+ const { namespace: l = "default", timeout: a } = i, c = n.ModelClass, p = Ie.getConfig().backendConfigs[c.configKey];
1509
1522
  if (!p)
1510
1523
  throw new Error(
1511
1524
  `No backend configuration found for key: ${c.configKey}`
@@ -1551,19 +1564,19 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
1551
1564
  payload: w,
1552
1565
  namespace: l
1553
1566
  });
1554
- let I = await ps.post(U, We(w), { headers: N });
1555
- typeof r == "function" && I?.data && await r(I.data);
1556
- const D = I?.data?.data, z = I?.data?.included, pe = Array.isArray(D) ? D.length : D != null ? 1 : 0, Ye = z ? Object.keys(z).length : 0, me = 100, Ke = Array.isArray(D) && D.length > me ? D.slice(0, me) : D, Xe = Array.isArray(D) && D.length > me;
1557
- let ze = z, Ee = !1;
1558
- if (z && typeof z == "object") {
1559
- const Re = {};
1567
+ let D = await ys.post(U, We(w), { headers: N });
1568
+ typeof r == "function" && D?.data && await r(D.data);
1569
+ const I = D?.data?.data, K = D?.data?.included, me = Array.isArray(I) ? I.length : I != null ? 1 : 0, Ye = K ? Object.keys(K).length : 0, ye = 100, Ke = Array.isArray(I) && I.length > ye ? I.slice(0, ye) : I, Xe = Array.isArray(I) && I.length > ye;
1570
+ let Re = K, Ee = !1;
1571
+ if (K && typeof K == "object") {
1572
+ const Ne = {};
1560
1573
  let ne = 0;
1561
- for (const [Ne, xe] of Object.entries(z))
1562
- if (Re[Ne] = xe, ne += 1, ne >= me) {
1574
+ for (const [xe, je] of Object.entries(K))
1575
+ if (Ne[xe] = je, ne += 1, ne >= ye) {
1563
1576
  Ee = !0;
1564
1577
  break;
1565
1578
  }
1566
- ze = Ee ? Re : z;
1579
+ Re = Ee ? Ne : K;
1567
1580
  }
1568
1581
  return B({
1569
1582
  type: "response",
@@ -1574,15 +1587,15 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
1574
1587
  operationId: s,
1575
1588
  canonicalId: o,
1576
1589
  url: U,
1577
- status: I.status,
1578
- dataCount: pe,
1590
+ status: D.status,
1591
+ dataCount: me,
1579
1592
  includedCount: Ye,
1580
1593
  data: Ke,
1581
- included: ze,
1594
+ included: Re,
1582
1595
  dataTruncated: Xe,
1583
1596
  includedTruncated: Ee
1584
- }), I.data;
1585
- } catch (I) {
1597
+ }), D.data;
1598
+ } catch (D) {
1586
1599
  if (B({
1587
1600
  type: "error",
1588
1601
  modelName: c.modelName,
@@ -1592,22 +1605,22 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
1592
1605
  operationId: s,
1593
1606
  canonicalId: o,
1594
1607
  url: U,
1595
- status: I?.response?.status,
1596
- message: I?.message
1597
- }), I?.code === "ECONNREFUSED") {
1598
- const D = "Connection refused. If you're running tests, start the test server with `python manage.py statezero_testserver`.";
1599
- throw new Error(`${D} (${U})`);
1608
+ status: D?.response?.status,
1609
+ message: D?.message
1610
+ }), D?.code === "ECONNREFUSED") {
1611
+ const I = "Connection refused. If you're running tests, start the test server with `python manage.py statezero_testserver`.";
1612
+ throw new Error(`${I} (${U})`);
1600
1613
  }
1601
- if (I.response && I.response.data) {
1602
- const D = Os(I.response.data);
1603
- throw Error.captureStackTrace && Error.captureStackTrace(D, L), D;
1614
+ if (D.response && D.response.data) {
1615
+ const I = Fs(D.response.data);
1616
+ throw Error.captureStackTrace && Error.captureStackTrace(I, L), I;
1604
1617
  }
1605
- throw new Error(`API call failed: ${I.message}`);
1618
+ throw new Error(`API call failed: ${D.message}`);
1606
1619
  }
1607
- }, fe = Bs(l), ae = b ? fe.add(re) : re();
1608
- return a ? Hs(ae, a) : ae;
1620
+ }, pe = qs(l), ae = b ? pe.add(re) : re();
1621
+ return a ? Js(ae, a) : ae;
1609
1622
  }
1610
- class Lt {
1623
+ class Bt {
1611
1624
  // Supported Django strftime formats and their date-fns equivalents
1612
1625
  static SUPPORTED_FORMATS = {
1613
1626
  "iso-8601": null,
@@ -1657,11 +1670,11 @@ class Lt {
1657
1670
  );
1658
1671
  try {
1659
1672
  if (!l || l === "iso-8601") {
1660
- const c = ge.fromISO(e, { zone: r });
1673
+ const c = _e.fromISO(e, { zone: r });
1661
1674
  return c.isValid ? c.toJSDate() : (console.error(`Failed to parse ISO date "${e}":`, c.invalidReason), null);
1662
1675
  }
1663
1676
  const a = this.SUPPORTED_FORMATS[l];
1664
- return ys(e, a, /* @__PURE__ */ new Date());
1677
+ return _s(e, a, /* @__PURE__ */ new Date());
1665
1678
  } catch (a) {
1666
1679
  return console.error(`Failed to parse date "${e}" with format "${l}"`, a), null;
1667
1680
  }
@@ -1693,19 +1706,19 @@ class Lt {
1693
1706
  if (!i || i === "iso-8601")
1694
1707
  return r === "date" ? e.toISOString().slice(0, 10) : e.toISOString();
1695
1708
  const l = this.SUPPORTED_FORMATS[i];
1696
- return gs(e, l);
1709
+ return ws(e, l);
1697
1710
  } catch (l) {
1698
1711
  return console.error(`Failed to format date with format "${i}"`, l), e.toISOString();
1699
1712
  }
1700
1713
  }
1701
1714
  }
1702
- function qs(n) {
1715
+ function Ws(n) {
1703
1716
  if (!n || !n.configKey)
1704
1717
  return "UTC";
1705
- const e = Fe.getConfig();
1718
+ const e = Ie.getConfig();
1706
1719
  return (e.backendConfigs[n.configKey] || e.backendConfigs.default).BACKEND_TZ || "UTC";
1707
1720
  }
1708
- const Gt = {
1721
+ const Ht = {
1709
1722
  // Store backend snake_case format internally for consistency with API
1710
1723
  toInternal: (n, e = {}) => {
1711
1724
  if (typeof n == "string")
@@ -1725,7 +1738,7 @@ const Gt = {
1725
1738
  // Return object with both formats for maximum compatibility
1726
1739
  toLive: (n, e = {}) => {
1727
1740
  if (!n || typeof n != "object") return n;
1728
- const t = e.model?.constructor?.configKey || "default", s = n.file_url ? Fe.buildFileUrl(n.file_url, t) : null;
1741
+ const t = e.model?.constructor?.configKey || "default", s = n.file_url ? Ie.buildFileUrl(n.file_url, t) : null;
1729
1742
  return {
1730
1743
  // snake_case (backend format)
1731
1744
  file_path: n.file_path,
@@ -1742,14 +1755,14 @@ const Gt = {
1742
1755
  mimeType: n.mime_type
1743
1756
  };
1744
1757
  }
1745
- }, Bt = {
1758
+ }, qt = {
1746
1759
  toInternal: (n, e = {}) => {
1747
1760
  if (E(n) || typeof n == "string") return n;
1748
1761
  if (n instanceof Date) {
1749
1762
  const { model: t, field: s, fieldSchema: r } = e, o = t?.schema || r?.format && {
1750
1763
  properties: { [s]: { format: r.format } }
1751
1764
  };
1752
- return o ? Lt.serializeDate(n, s, o) : n.toISOString();
1765
+ return o ? Bt.serializeDate(n, s, o) : n.toISOString();
1753
1766
  }
1754
1767
  throw new Error(`expected string or Date, got ${typeof n}`);
1755
1768
  },
@@ -1757,8 +1770,8 @@ const Gt = {
1757
1770
  if (E(n) || typeof n != "string") return n;
1758
1771
  const { model: t, field: s } = e;
1759
1772
  if (t?.schema) {
1760
- const r = qs(t);
1761
- return Lt.parseDate(n, s, t.schema, r);
1773
+ const r = Ws(t);
1774
+ return Bt.parseDate(n, s, t.schema, r);
1762
1775
  }
1763
1776
  try {
1764
1777
  return new Date(n);
@@ -1781,7 +1794,7 @@ const Gt = {
1781
1794
  const { model: t, field: s } = e;
1782
1795
  return t.relationshipFields.has(s) && n ? t.relationshipFields.get(s).ModelClass().fromPk(n) : n;
1783
1796
  }
1784
- }, Js = {
1797
+ }, Zs = {
1785
1798
  toInternal: (n, e = {}) => {
1786
1799
  if (E(n)) return n;
1787
1800
  if (!Array.isArray(n)) throw new Error(`expected array, got ${typeof n}`);
@@ -1809,10 +1822,10 @@ const Gt = {
1809
1822
  }
1810
1823
  }, Se = {
1811
1824
  string: {
1812
- "file-path": Gt,
1813
- "image-path": Gt,
1814
- date: Bt,
1815
- "date-time": Bt,
1825
+ "file-path": Ht,
1826
+ "image-path": Ht,
1827
+ date: qt,
1828
+ "date-time": qt,
1816
1829
  "foreign-key": ke,
1817
1830
  "one-to-one": ke
1818
1831
  },
@@ -1826,10 +1839,10 @@ const Gt = {
1826
1839
  "one-to-one": ke
1827
1840
  },
1828
1841
  array: {
1829
- "many-to-many": Js
1842
+ "many-to-many": Zs
1830
1843
  }
1831
1844
  };
1832
- class ts {
1845
+ class rs {
1833
1846
  constructor(e) {
1834
1847
  this.modelClass = e;
1835
1848
  }
@@ -1884,15 +1897,15 @@ class ts {
1884
1897
  return t;
1885
1898
  }
1886
1899
  }
1887
- function Ws(n) {
1900
+ function Ys(n) {
1888
1901
  if (!n || !n.configKey)
1889
1902
  return "UTC";
1890
- const e = Fe.getConfig();
1903
+ const e = Ie.getConfig();
1891
1904
  return (e.backendConfigs[n.configKey] || e.backendConfigs.default).BACKEND_TZ || "UTC";
1892
1905
  }
1893
- function Zs(n, e, t) {
1906
+ function Xs(n, e, t) {
1894
1907
  if (!t?.schema || !n) return e;
1895
- const s = new ts(t);
1908
+ const s = new rs(t);
1896
1909
  return Array.isArray(e) ? e.map((r) => s.toLiveField(n, r)) : s.toLiveField(n, e);
1897
1910
  }
1898
1911
  function De(n, e, t, s = {}) {
@@ -1911,8 +1924,6 @@ function De(n, e, t, s = {}) {
1911
1924
  "lt",
1912
1925
  "lte",
1913
1926
  "isnull",
1914
- "regex",
1915
- "iregex",
1916
1927
  "year",
1917
1928
  "month",
1918
1929
  "day",
@@ -1940,12 +1951,12 @@ function De(n, e, t, s = {}) {
1940
1951
  if (!U && re === "many-to-many") {
1941
1952
  let ae = c.slice(b + 1).join("__");
1942
1953
  a.length > 0 ? ae += "__" + a.join("__") : f && (ae += "__" + f);
1943
- const I = De(ae, e, F, s), D = m.length > 0 ? m.join(".") + "." + k : k, z = I.requiredPath || I.field, pe = `${D}.${z}`;
1954
+ const D = De(ae, e, F, s), I = m.length > 0 ? m.join(".") + "." + k : k, K = D.requiredPath || D.field, me = `${I}.${K}`;
1944
1955
  return {
1945
- field: D,
1946
- operator: { $elemMatch: { [I.field]: I.operator } },
1956
+ field: I,
1957
+ operator: { $elemMatch: { [D.field]: D.operator } },
1947
1958
  isM2M: !0,
1948
- requiredPath: pe
1959
+ requiredPath: me
1949
1960
  // Full path for data picking
1950
1961
  };
1951
1962
  }
@@ -1955,8 +1966,8 @@ function De(n, e, t, s = {}) {
1955
1966
  if (y = !0, re === "many-to-many")
1956
1967
  _ = !0, w = k;
1957
1968
  else {
1958
- const fe = F.primaryKeyField || "id";
1959
- m.push(fe), w = fe;
1969
+ const pe = F.primaryKeyField || "id";
1970
+ m.push(pe), w = pe;
1960
1971
  }
1961
1972
  p = F;
1962
1973
  }
@@ -1973,26 +1984,26 @@ function De(n, e, t, s = {}) {
1973
1984
  } else
1974
1985
  throw new Error(`Field '${k}' in '${n}' not found in model ${p.modelName}.`);
1975
1986
  }
1976
- const v = m.join("."), T = i.includes(f) || a.length === 2 && i.includes(a[0]) ? e : Zs(w, e, p);
1987
+ const v = m.join("."), T = i.includes(f) || a.length === 2 && i.includes(a[0]) ? e : Xs(w, e, p);
1977
1988
  if (a.length === 2) {
1978
1989
  const [b, k] = a;
1979
- return Ys(v, b, k, T, y);
1990
+ return er(v, b, k, T, y);
1980
1991
  }
1981
1992
  if (f)
1982
- return Xs(v, f, T, y, p, w, _);
1993
+ return tr(v, f, T, y, p, w, _);
1983
1994
  if (y) {
1984
1995
  let b = T;
1985
1996
  return T && typeof T == "object" && "pk" in T && (b = T.pk), _ ? { field: v, operator: { $elemMatch: { pk: { $eq: b } } }, isM2M: !0 } : { field: v, operator: { $eq: b } };
1986
1997
  }
1987
1998
  return { field: v, operator: { $eq: T } };
1988
1999
  }
1989
- function Ys(n, e, t, s, r) {
2000
+ function er(n, e, t, s, r) {
1990
2001
  return r ? (console.warn(`Date part comparison on relationship fields may not work as expected: ${n}`), { field: n, operator: { $eq: s } }) : {
1991
2002
  field: n,
1992
2003
  operator: { [`$${e}_${t}`]: s }
1993
2004
  };
1994
2005
  }
1995
- function Xs(n, e, t, s, r, o, i = !1) {
2006
+ function tr(n, e, t, s, r, o, i = !1) {
1996
2007
  function l(a) {
1997
2008
  return a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1998
2009
  }
@@ -2047,12 +2058,12 @@ function Xs(n, e, t, s, r, o, i = !1) {
2047
2058
  operator: { $regex: new RegExp(`${l(t)}$`, "i") }
2048
2059
  } : e === "in" ? { field: n, operator: { $in: t } } : e === "gt" ? { field: n, operator: { $nin: [null, void 0], $gt: t } } : e === "gte" ? { field: n, operator: { $nin: [null, void 0], $gte: t } } : e === "lt" ? { field: n, operator: { $nin: [null, void 0], $lt: t } } : e === "lte" ? { field: n, operator: { $nin: [null, void 0], $lte: t } } : { field: n, operator: { $eq: t } };
2049
2060
  }
2050
- function er(n = "UTC", e = null) {
2051
- const t = e ? new ts(e) : null, s = (a, c = null) => a ? a instanceof Date ? a : t && c && typeof a == "string" ? t.toLiveField(c, a) : (console.warn("Date conversion without serializer context:", a), null) : null, r = (a, c, f = null) => {
2061
+ function sr(n = "UTC", e = null) {
2062
+ const t = e ? new rs(e) : null, s = (a, c = null) => a ? a instanceof Date ? a : t && c && typeof a == "string" ? t.toLiveField(c, a) : (console.warn("Date conversion without serializer context:", a), null) : null, r = (a, c, f = null) => {
2052
2063
  const p = s(a, f);
2053
2064
  if (!p || !(p instanceof Date) || isNaN(p.getTime()))
2054
2065
  return null;
2055
- const m = ge.fromJSDate(p).setZone(n);
2066
+ const m = _e.fromJSDate(p).setZone(n);
2056
2067
  return c(m);
2057
2068
  }, o = {
2058
2069
  // Year - same in both
@@ -2148,7 +2159,7 @@ function er(n = "UTC", e = null) {
2148
2159
  return !1;
2149
2160
  const _ = s(a, m);
2150
2161
  if (!_ || isNaN(_.getTime())) return !1;
2151
- const w = ge.fromJSDate(y).setZone(n), v = ge.fromJSDate(_).setZone(n);
2162
+ const w = _e.fromJSDate(y).setZone(n), v = _e.fromJSDate(_).setZone(n);
2152
2163
  return w.year === v.year && w.month === v.month && w.day === v.day;
2153
2164
  },
2154
2165
  c,
@@ -2162,7 +2173,7 @@ function er(n = "UTC", e = null) {
2162
2173
  const y = s(p, m);
2163
2174
  if (!y || !(y instanceof Date) || isNaN(y.getTime()))
2164
2175
  return !1;
2165
- const _ = ge.fromJSDate(y).setZone(n);
2176
+ const _ = _e.fromJSDate(y).setZone(n);
2166
2177
  let w, v, O;
2167
2178
  if (typeof a == "string") {
2168
2179
  const T = a.split(":");
@@ -2170,7 +2181,7 @@ function er(n = "UTC", e = null) {
2170
2181
  } else {
2171
2182
  const T = s(a, m);
2172
2183
  if (!T) return !1;
2173
- const b = ge.fromJSDate(T).setZone(n);
2184
+ const b = _e.fromJSDate(T).setZone(n);
2174
2185
  w = b.hour, v = b.minute, O = b.second;
2175
2186
  }
2176
2187
  return _.hour === w && _.minute === v && _.second === O;
@@ -2200,7 +2211,7 @@ function er(n = "UTC", e = null) {
2200
2211
  const v = s(_, w);
2201
2212
  if (!v || !(v instanceof Date) || isNaN(v.getTime()))
2202
2213
  return !1;
2203
- const O = ge.fromJSDate(v).setZone(n), T = c(O), b = a === "date" ? p : typeof p == "string" ? Number(p) : p;
2214
+ const O = _e.fromJSDate(v).setZone(n), T = c(O), b = a === "date" ? p : typeof p == "string" ? Number(p) : p;
2204
2215
  switch (f) {
2205
2216
  case "gt":
2206
2217
  return T > b;
@@ -2222,20 +2233,20 @@ function er(n = "UTC", e = null) {
2222
2233
  });
2223
2234
  }), o;
2224
2235
  }
2225
- function tr(n, e) {
2226
- const t = Ws(e);
2227
- return Wt(n, {
2228
- operations: er(t, e)
2236
+ function rr(n, e) {
2237
+ const t = Ys(e);
2238
+ return Yt(n, {
2239
+ operations: sr(t, e)
2229
2240
  });
2230
2241
  }
2231
- function pt(n, e) {
2242
+ function mt(n, e) {
2232
2243
  const t = {}, s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
2233
2244
  for (const [o, i] of Object.entries(n))
2234
2245
  try {
2235
2246
  const l = De(o, i, e), { field: a, operator: c, isDatePart: f, isM2M: p } = l;
2236
2247
  f ? (s.has(a) || s.set(a, []), s.get(a).push({ [a]: c })) : p && c.$elemMatch ? (r.has(a) || r.set(a, []), r.get(a).push(c.$elemMatch)) : t[a] ? t[a] = { ...t[a], ...c } : t[a] = c;
2237
2248
  } catch (l) {
2238
- throw new Error(`Failed to process field '${o}': ${l.message}`);
2249
+ throw new Oe(`Failed to process field '${o}': ${l.message}`);
2239
2250
  }
2240
2251
  for (const [o, i] of r.entries())
2241
2252
  i.length === 1 ? t[o] = { $elemMatch: i[0] } : t[o] = { $elemMatch: { $and: i } };
@@ -2256,9 +2267,9 @@ function pt(n, e) {
2256
2267
  }
2257
2268
  return t;
2258
2269
  }
2259
- function sr(n, e) {
2270
+ function nr(n, e) {
2260
2271
  return !n || !n.length ? null : {
2261
- $or: n.map((t) => "operator" in t && "conditions" in t ? { [t.operator === "AND" ? "$and" : "$or"]: t.conditions.map((r) => pt(r, e)) } : pt(t, e))
2272
+ $or: n.map((t) => "operator" in t && "conditions" in t ? { [t.operator === "AND" ? "$and" : "$or"]: t.conditions.map((r) => mt(r, e)) } : mt(t, e))
2262
2273
  };
2263
2274
  }
2264
2275
  function He(n, e) {
@@ -2266,8 +2277,8 @@ function He(n, e) {
2266
2277
  if (n.type === "filter") {
2267
2278
  const { conditions: t, Q: s } = n;
2268
2279
  let r = {};
2269
- if (t && Object.keys(t).length > 0 && (r = pt(t, e)), s && s.length > 0) {
2270
- const o = sr(s, e);
2280
+ if (t && Object.keys(t).length > 0 && (r = mt(t, e)), s && s.length > 0) {
2281
+ const o = nr(s, e);
2271
2282
  if (o)
2272
2283
  return Object.keys(r).length > 0 ? { $and: [r, o] } : o;
2273
2284
  }
@@ -2287,7 +2298,7 @@ function He(n, e) {
2287
2298
  }
2288
2299
  return null;
2289
2300
  }
2290
- function rr(n, e, t) {
2301
+ function or(n, e, t) {
2291
2302
  if (!e || !e.searchQuery) return n;
2292
2303
  const s = e.searchFields || (n[0] ? Object.keys(n[0]).filter((i) => typeof n[0][i] == "string") : []);
2293
2304
  if (!s.length) return n;
@@ -2310,9 +2321,9 @@ function rr(n, e, t) {
2310
2321
  };
2311
2322
  }
2312
2323
  });
2313
- return n.filter(Wt({ $or: o }));
2324
+ return n.filter(Yt({ $or: o }));
2314
2325
  }
2315
- function Ht(n, e) {
2326
+ function Jt(n, e) {
2316
2327
  const t = e.split(".");
2317
2328
  let s = n;
2318
2329
  for (const r of t) {
@@ -2322,7 +2333,7 @@ function Ht(n, e) {
2322
2333
  }
2323
2334
  return s;
2324
2335
  }
2325
- function nr(n, e) {
2336
+ function ir(n, e) {
2326
2337
  return n.map((t) => {
2327
2338
  const s = t.startsWith("-"), r = s ? t.substring(1) : t;
2328
2339
  try {
@@ -2339,12 +2350,12 @@ function nr(n, e) {
2339
2350
  }
2340
2351
  });
2341
2352
  }
2342
- function or(n, e, t) {
2353
+ function ar(n, e, t) {
2343
2354
  if (!e || !e.length) return [...n];
2344
- const s = nr(e, t);
2355
+ const s = ir(e, t);
2345
2356
  return [...n].sort((r, o) => {
2346
2357
  for (const { field: i, desc: l } of s) {
2347
- const a = Ht(r, i), c = Ht(o, i);
2358
+ const a = Jt(r, i), c = Jt(o, i);
2348
2359
  if (a !== c) {
2349
2360
  if (a === null && c !== null) return l ? -1 : 1;
2350
2361
  if (a !== null && c === null) return l ? 1 : -1;
@@ -2357,7 +2368,7 @@ function or(n, e, t) {
2357
2368
  return 0;
2358
2369
  });
2359
2370
  }
2360
- function mt(n, e, t) {
2371
+ function yt(n, e, t) {
2361
2372
  if (!Array.isArray(n) || n.length === 0)
2362
2373
  return [];
2363
2374
  if (!t)
@@ -2366,11 +2377,11 @@ function mt(n, e, t) {
2366
2377
  let r = [...n];
2367
2378
  if (e.filter) {
2368
2379
  const o = He(e.filter, t);
2369
- o && Object.keys(o).length && (r = r.filter(tr(o, t)));
2380
+ o && Object.keys(o).length && (r = r.filter(rr(o, t)));
2370
2381
  }
2371
- return e.search && e.search.searchQuery && (r = rr(r, e.search, t)), Array.isArray(e.orderBy) && e.orderBy.length && (r = or(r, e.orderBy, t)), r.map((o) => o[s]);
2382
+ return e.search && e.search.searchQuery && (r = or(r, e.search, t)), Array.isArray(e.orderBy) && e.orderBy.length && (r = ar(r, e.orderBy, t)), r.map((o) => o[s]);
2372
2383
  }
2373
- function yt(n, e) {
2384
+ function gt(n, e) {
2374
2385
  const t = /* @__PURE__ */ new Set(), s = e.primaryKeyField;
2375
2386
  t.add(s);
2376
2387
  function r(i) {
@@ -2403,36 +2414,36 @@ function yt(n, e) {
2403
2414
  r(i.replace(/^-/, ""));
2404
2415
  }), Array.from(t);
2405
2416
  }
2406
- function gt(n, e, t) {
2417
+ function _t(n, e, t) {
2407
2418
  if (e == null || t.length === 0)
2408
2419
  return;
2409
2420
  const [s, ...r] = t, o = e[s];
2410
2421
  o !== void 0 && (r.length === 0 ? n[s] = o : Array.isArray(o) ? (s in n || (n[s] = []), o.forEach((i, l) => {
2411
- n[s][l] === void 0 && (n[s][l] = {}), gt(n[s][l], i, r);
2412
- })) : typeof o == "object" && (s in n || (n[s] = {}), gt(n[s], o, r)));
2422
+ n[s][l] === void 0 && (n[s][l] = {}), _t(n[s][l], i, r);
2423
+ })) : typeof o == "object" && (s in n || (n[s] = {}), _t(n[s], o, r)));
2413
2424
  }
2414
- function _t(n, e) {
2425
+ function wt(n, e) {
2415
2426
  const t = {};
2416
2427
  return n.forEach((s) => {
2417
2428
  const r = s.split(".");
2418
- gt(t, e, r);
2429
+ _t(t, e, r);
2419
2430
  }), t;
2420
2431
  }
2421
- function wt(n, e, t, s = !1) {
2432
+ function Ct(n, e, t, s = !1) {
2422
2433
  if (!Array.isArray(n) || n.length === 0)
2423
2434
  return [];
2424
2435
  if (!t)
2425
2436
  throw new Error("ModelClass is required for proper relationship traversal");
2426
2437
  const r = t.primaryKeyField || "id";
2427
- let o = yt(e, t), i = n.map((a) => _t(o, a));
2428
- const l = mt(i, e, t);
2438
+ let o = gt(e, t), i = n.map((a) => wt(o, a));
2439
+ const l = yt(i, e, t);
2429
2440
  if (s) {
2430
2441
  const a = new Map(n.map((c) => [c[r], c]));
2431
2442
  return l.map((c) => a.get(c));
2432
2443
  }
2433
2444
  return l;
2434
2445
  }
2435
- class ir {
2446
+ class lr {
2436
2447
  modelClass;
2437
2448
  fetchFn;
2438
2449
  queryset;
@@ -2443,10 +2454,10 @@ class ir {
2443
2454
  constructor(e, t, s, r = null, o = null, i = {}) {
2444
2455
  if (this.modelClass = e, this.fetchFn = t, this.queryset = s, this.isSyncing = !1, this.lastSync = null, this.isTemp = i.isTemp || !1, this.pruneThreshold = i.pruneThreshold || 10, this.groundTruthPks = r || [], this.operationsMap = /* @__PURE__ */ new Map(), this.includedPks = /* @__PURE__ */ new Map(), Array.isArray(o))
2445
2456
  for (const l of o) {
2446
- const c = Oe.get(l.operationId) || new q(l, !0);
2457
+ const c = Pe.get(l.operationId) || new q(l, !0);
2447
2458
  this.operationsMap.set(c.operationId, c);
2448
2459
  }
2449
- if (this.qsCache = new vt("queryset-cache", {}, this.onHydrated.bind(this)), this._lastRenderedPks = null, this.renderCallbacks = /* @__PURE__ */ new Set(), !this.isTemp) {
2460
+ if (this.qsCache = new Et("queryset-cache", {}, this.onHydrated.bind(this)), this._lastRenderedPks = null, this.renderCallbacks = /* @__PURE__ */ new Set(), !this.isTemp) {
2450
2461
  const l = Q.getStore(this.modelClass);
2451
2462
  this._modelStoreUnregister = l.registerRenderCallback(() => {
2452
2463
  this._emitRenderEvent();
@@ -2458,15 +2469,14 @@ class ir {
2458
2469
  return this.queryset.semanticKey;
2459
2470
  }
2460
2471
  onHydrated(e) {
2461
- if (this.groundTruthPks.length === 0 && this.operationsMap.size === 0) {
2462
- const t = this.qsCache.get(this.cacheKey);
2463
- !E(t) && !Ce(t) && this.setGroundTruth(t);
2464
- }
2472
+ if (this.lastSync !== null || this.groundTruthPks.length > 0 || this.operationsMap.size > 0) return;
2473
+ const t = this.qsCache.get(this.cacheKey);
2474
+ !E(t) && !ve(t) && (this.groundTruthPks = Array.isArray(t) ? t : [], this._emitRenderEvent());
2465
2475
  }
2466
2476
  setCache(e) {
2467
2477
  let t = [];
2468
2478
  e.forEach((s) => {
2469
- typeof s == "string" && Je(s) && (s = We(s), E(s) || Ce(dt(s))) || t.push(s);
2479
+ typeof s == "string" && Je(s) && (s = We(s), E(s) || ve(ut(s))) || t.push(s);
2470
2480
  }), this.qsCache.set(this.cacheKey, t);
2471
2481
  }
2472
2482
  clearCache() {
@@ -2490,7 +2500,7 @@ class ir {
2490
2500
  } catch (s) {
2491
2501
  console.warn("Error in render callback:", s);
2492
2502
  }
2493
- }), qe(e, this._lastRenderedPks) || (this._lastRenderedPks = e, Es.emit(
2503
+ }), qe(e, this._lastRenderedPks) || (this._lastRenderedPks = e, ks.emit(
2494
2504
  `${this.modelClass.configKey}::${this.modelClass.modelName}::queryset::render`,
2495
2505
  { ast: this.queryset.build(), ModelClass: this.modelClass }
2496
2506
  ));
@@ -2509,7 +2519,13 @@ class ir {
2509
2519
  this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), this._emitRenderEvent());
2510
2520
  }
2511
2521
  async setGroundTruth(e) {
2512
- this.groundTruthPks = Array.isArray(e) ? e : [], this.lastSync = Date.now(), this._emitRenderEvent();
2522
+ if (this.groundTruthPks = Array.isArray(e) ? e : [], this.groundTruthPks.length > 500) {
2523
+ const t = this.queryset?._serializerOptions?.limit;
2524
+ console.warn(
2525
+ `[statezero] ⚠️ ${this.modelClass.modelName} (${this.queryset.semanticKey}) received ${this.groundTruthPks.length} items${t ? ` (limit: ${t})` : " with NO limit"}. Live querysets re-render on every change — at this size, this WILL cause UI freezes on mobile. Add .fetch({ limit }) or use narrower filters.`
2526
+ );
2527
+ }
2528
+ this.lastSync = Date.now(), this._emitRenderEvent();
2513
2529
  }
2514
2530
  async setOperations(e) {
2515
2531
  if (this.operationsMap.clear(), Array.isArray(e))
@@ -2553,12 +2569,12 @@ class ir {
2553
2569
  const t = Array.from(e).map((o) => this.modelClass.fromPk(o, this.queryset)).filter(
2554
2570
  (o) => Q.getEntity(this.modelClass, o.pk) !== null
2555
2571
  ), s = this.queryset.build();
2556
- return wt(t, s, this.modelClass, !1);
2572
+ return Ct(t, s, this.modelClass, !1);
2557
2573
  }
2558
2574
  render(e = !0, t = !1) {
2559
2575
  if (t) {
2560
- const l = this.qsCache.get(this.cacheKey);
2561
- if (Array.isArray(l))
2576
+ const c = this.qsCache.get(this.cacheKey);
2577
+ if (Array.isArray(c))
2562
2578
  return B({
2563
2579
  type: "render",
2564
2580
  source: "cache",
@@ -2568,13 +2584,13 @@ class ir {
2568
2584
  optimistic: e,
2569
2585
  groundTruthCount: this.groundTruthPks.length,
2570
2586
  operationsCount: this.operationsMap.size,
2571
- resultCount: l.length
2572
- }), l;
2587
+ resultCount: c.length
2588
+ }), c;
2573
2589
  }
2574
- const s = this.groundTruthPks.length === 0 && this.lastSync === null ? this.renderFromModelStore() : this.renderFromData(e);
2575
- let r = this._getValidatedAndFilteredPks(s);
2576
- const o = r.length, i = this.queryset.build().serializerOptions?.limit;
2577
- return i && (r = r.slice(0, i)), this.setCache(r), B({
2590
+ const s = this.queryset.build().serializerOptions?.offset, o = this.groundTruthPks.length === 0 && this.lastSync === null && !(s != null && s > 0) ? this.renderFromModelStore() : this.renderFromData(e);
2591
+ let i = this._getValidatedAndFilteredPks(o);
2592
+ const l = i.length, a = this.queryset.build().serializerOptions?.limit;
2593
+ return a && (i = i.slice(0, a)), this.setCache(i), B({
2578
2594
  type: "render",
2579
2595
  source: this.groundTruthPks.length === 0 && this.lastSync === null ? "modelStore" : "groundTruth",
2580
2596
  semanticKey: this.queryset.semanticKey,
@@ -2583,11 +2599,11 @@ class ir {
2583
2599
  optimistic: e,
2584
2600
  groundTruthCount: this.groundTruthPks.length,
2585
2601
  operationsCount: this.operationsMap.size,
2586
- rawCount: Array.isArray(s) ? s.length : 0,
2587
- filteredCount: o,
2588
- resultCount: r.length,
2589
- limit: i
2590
- }), r;
2602
+ rawCount: Array.isArray(o) ? o.length : 0,
2603
+ filteredCount: l,
2604
+ resultCount: i.length,
2605
+ limit: a
2606
+ }), i;
2591
2607
  }
2592
2608
  renderFromData(e = !0) {
2593
2609
  const t = this.groundTruthSet;
@@ -2601,7 +2617,7 @@ class ir {
2601
2617
  */
2602
2618
  renderFromModelStore() {
2603
2619
  const s = Q.getStore(this.modelClass).groundTruthPks.map((o) => this.modelClass.fromPk(o, this.queryset)), r = this.queryset.build();
2604
- return wt(s, r, this.modelClass, !1);
2620
+ return Ct(s, r, this.modelClass, !1);
2605
2621
  }
2606
2622
  applyOperation(e, t) {
2607
2623
  const s = this.pkField;
@@ -2619,8 +2635,10 @@ class ir {
2619
2635
  t.add(o);
2620
2636
  break;
2621
2637
  case M.CHECKPOINT:
2638
+ break;
2622
2639
  case M.UPDATE:
2623
2640
  case M.UPDATE_INSTANCE:
2641
+ t.add(o);
2624
2642
  break;
2625
2643
  case M.DELETE:
2626
2644
  case M.DELETE_INSTANCE:
@@ -2658,7 +2676,7 @@ class ir {
2658
2676
  modelClass: this.modelClass,
2659
2677
  canonical_id: e
2660
2678
  }), { data: r, included: o } = s;
2661
- E(r) || (this.includedPks.clear(), _e(Q, o, this.modelClass, this.queryset), this.setGroundTruth(r)), this.setOperations(this.getInflightOperations()), this.lastSync = Date.now(), B({
2679
+ E(r) || (this.includedPks.clear(), we(Q, o, this.modelClass, this.queryset), this.setGroundTruth(r)), this.setOperations(this.getInflightOperations()), this.lastSync = Date.now(), B({
2662
2680
  type: "sync",
2663
2681
  phase: "success",
2664
2682
  semanticKey: this.queryset.semanticKey,
@@ -2683,9 +2701,9 @@ class ir {
2683
2701
  }
2684
2702
  }
2685
2703
  }
2686
- class ar {
2704
+ class cr {
2687
2705
  constructor() {
2688
- this.graph = new It({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
2706
+ this.graph = new zt({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
2689
2707
  }
2690
2708
  /**
2691
2709
  * Add a queryset and its parent relationship to the graph
@@ -2771,10 +2789,10 @@ class ar {
2771
2789
  return !e && !t ? !0 : !e || !t || e.length !== t.length ? !1 : e.every((s, r) => s === t[r]);
2772
2790
  }
2773
2791
  clear() {
2774
- this.graph = new It({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
2792
+ this.graph = new zt({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
2775
2793
  }
2776
2794
  }
2777
- class lr {
2795
+ class dr {
2778
2796
  #e;
2779
2797
  #t;
2780
2798
  #s;
@@ -2814,11 +2832,11 @@ class lr {
2814
2832
  return j.getStore(this.#e).render().map((r) => (this.#t.primaryKeyField, this.#t.fromPk(r, this.#e)));
2815
2833
  }
2816
2834
  }
2817
- class we {
2835
+ class Ce {
2818
2836
  constructor() {
2819
2837
  this._stores = /* @__PURE__ */ new Map(), this._tempStores = /* @__PURE__ */ new WeakMap(), this.followingQuerysets = /* @__PURE__ */ new Map(), this.syncManager = () => {
2820
2838
  console.warn("SyncManager not set for QuerysetStoreRegistry");
2821
- }, this.querysetStoreGraph = new ar(), this._groupSyncCache = /* @__PURE__ */ new Map();
2839
+ }, this.querysetStoreGraph = new cr(), this._groupSyncCache = /* @__PURE__ */ new Map();
2822
2840
  }
2823
2841
  clear() {
2824
2842
  this._stores.forEach((e) => {
@@ -2866,7 +2884,7 @@ class we {
2866
2884
  { namespace: "sync", timeout: 3e4 }
2867
2885
  // Sync ops on separate queue
2868
2886
  )).data;
2869
- }, o = new ir(
2887
+ }, o = new lr(
2870
2888
  e.ModelClass,
2871
2889
  r,
2872
2890
  e,
@@ -2890,7 +2908,7 @@ class we {
2890
2908
  this.addFollowingQueryset(s, e);
2891
2909
  let r;
2892
2910
  this._tempStores.has(e) ? (r = this._tempStores.get(e), r.isTemp = !1, r.registerWithModelStore(), this._stores.set(s, r), this.syncManager.followModel(this, e.ModelClass)) : this._stores.has(s) ? r = this._stores.get(s) : (r = this.getStore(e), r.isTemp = !1, r.registerWithModelStore(), this._stores.set(s, r), this.syncManager.followModel(this, e.ModelClass));
2893
- const o = new lr(e);
2911
+ const o = new dr(e);
2894
2912
  return t && r.sync(), o;
2895
2913
  }
2896
2914
  /**
@@ -2994,7 +3012,7 @@ class we {
2994
3012
  });
2995
3013
  return;
2996
3014
  }
2997
- const v = p.pks.map((b) => i.fromPk(b, e)), O = e.build(), T = wt(v, O, i, !1);
3015
+ const v = p.pks.map((b) => i.fromPk(b, e)), O = e.build(), T = Ct(v, O, i, !1);
2998
3016
  m.setGroundTruth(T), m.setOperations(m.getInflightOperations()), m.lastSync = Date.now(), B({
2999
3017
  type: "groupSync",
3000
3018
  phase: "filteredFromRoot",
@@ -3008,8 +3026,8 @@ class we {
3008
3026
  }
3009
3027
  }
3010
3028
  }
3011
- const j = new we();
3012
- class Ie {
3029
+ const j = new Ce();
3030
+ class ze {
3013
3031
  /**
3014
3032
  * Calculate metric based on ground truth and operations
3015
3033
  */
@@ -3054,7 +3072,7 @@ class Ie {
3054
3072
  return isNaN(r) ? 0 : r;
3055
3073
  }
3056
3074
  }
3057
- class cr extends Ie {
3075
+ class ur extends ze {
3058
3076
  reduceOperation(e, t, s) {
3059
3077
  if (t.status === C.REJECTED)
3060
3078
  return e;
@@ -3062,7 +3080,7 @@ class cr extends Ie {
3062
3080
  return r === M.CREATE ? e + 1 : [M.DELETE, M.DELETE_INSTANCE].includes(r) ? Math.max(0, e - 1) : e;
3063
3081
  }
3064
3082
  }
3065
- class dr extends Ie {
3083
+ class hr extends ze {
3066
3084
  reduceOperation(e, t, s) {
3067
3085
  if (t.status === C.REJECTED)
3068
3086
  return e;
@@ -3087,7 +3105,7 @@ class dr extends Ie {
3087
3105
  }
3088
3106
  }
3089
3107
  }
3090
- class ur extends Ie {
3108
+ class fr extends ze {
3091
3109
  getInitialValue() {
3092
3110
  return 1 / 0;
3093
3111
  }
@@ -3110,7 +3128,7 @@ class ur extends Ie {
3110
3128
  return e;
3111
3129
  }
3112
3130
  }
3113
- class hr extends Ie {
3131
+ class pr extends ze {
3114
3132
  getInitialValue() {
3115
3133
  return -1 / 0;
3116
3134
  }
@@ -3133,15 +3151,15 @@ class hr extends Ie {
3133
3151
  return e;
3134
3152
  }
3135
3153
  }
3136
- class fr {
3154
+ class mr {
3137
3155
  // Collection of custom strategy overrides
3138
3156
  static #e = /* @__PURE__ */ new Map();
3139
3157
  // Default strategy map
3140
3158
  static #t = /* @__PURE__ */ new Map([
3141
- ["count", () => new cr()],
3142
- ["sum", () => new dr()],
3143
- ["min", () => new ur()],
3144
- ["max", () => new hr()]
3159
+ ["count", () => new ur()],
3160
+ ["sum", () => new hr()],
3161
+ ["min", () => new fr()],
3162
+ ["max", () => new pr()]
3145
3163
  ]);
3146
3164
  /**
3147
3165
  * Clear all custom strategy overrides
@@ -3168,7 +3186,7 @@ class fr {
3168
3186
  static overrideStrategy(e, t, s) {
3169
3187
  if (!e || !s)
3170
3188
  throw new Error("overrideStrategy requires metricType and strategy");
3171
- if (!(s instanceof Ie))
3189
+ if (!(s instanceof ze))
3172
3190
  throw new Error("strategy must be an instance of MetricCalculationStrategy");
3173
3191
  let r;
3174
3192
  t ? r = this.#s(e, t) : r = `${e}::*::*`, this.#e.set(r, s);
@@ -3187,9 +3205,9 @@ class fr {
3187
3205
  return this.#e.has(o) ? this.#e.get(o) : (this.#t.get(s) || this.#t.get("count"))();
3188
3206
  }
3189
3207
  }
3190
- class pr {
3208
+ class yr {
3191
3209
  constructor(e, t, s, r = null, o = null, i) {
3192
- this.metricType = e, this.modelClass = t, this.queryset = s, this.field = r, this.ast = o, this.fetchFn = i, this.groundTruthValue = null, this.isSyncing = !1, this.strategy = fr.getStrategy(e, t), this.operations = [], this.confirmedOps = /* @__PURE__ */ new Set(), this.metricCache = new vt(
3210
+ this.metricType = e, this.modelClass = t, this.queryset = s, this.field = r, this.ast = o, this.fetchFn = i, this.groundTruthValue = null, this.isSyncing = !1, this.strategy = mr.getStrategy(e, t), this.operations = [], this.confirmedOps = /* @__PURE__ */ new Set(), this.metricCache = new Et(
3193
3211
  "metric-store-cache",
3194
3212
  {},
3195
3213
  this.onHydrated.bind(this)
@@ -3249,7 +3267,7 @@ class pr {
3249
3267
  onHydrated() {
3250
3268
  if (this.groundTruthValue === null) {
3251
3269
  const e = this.metricCache.get(this.cacheKey);
3252
- !E(e) && !Ce(e) && this.setGroundTruth(e?.value);
3270
+ !E(e) && !ve(e) && this.setGroundTruth(e?.value);
3253
3271
  }
3254
3272
  }
3255
3273
  setCache() {
@@ -3263,7 +3281,7 @@ class pr {
3263
3281
  }
3264
3282
  setGroundTruth(e) {
3265
3283
  const t = !qe(this.groundTruthValue, e);
3266
- this.groundTruthValue = e, this.setCache(), t && Rt.emit("metric::render", {
3284
+ this.groundTruthValue = e, this.setCache(), t && Nt.emit("metric::render", {
3267
3285
  metricType: this.metricType,
3268
3286
  ModelClass: this.modelClass,
3269
3287
  field: this.field,
@@ -3284,7 +3302,7 @@ class pr {
3284
3302
  this.field,
3285
3303
  this.modelClass
3286
3304
  );
3287
- return qe(this._lastCalculatedValue, e) || (this._lastCalculatedValue = e, Rt.emit("metric::render", {
3305
+ return qe(this._lastCalculatedValue, e) || (this._lastCalculatedValue = e, Nt.emit("metric::render", {
3288
3306
  metricType: this.metricType,
3289
3307
  ModelClass: this.modelClass,
3290
3308
  field: this.field,
@@ -3329,13 +3347,13 @@ function te(n, e) {
3329
3347
  function Z(n) {
3330
3348
  return delete n.isOptimistic, delete n.then, delete n.catch, n;
3331
3349
  }
3332
- _s();
3333
- Zt.create();
3334
- function mr(n, e) {
3350
+ Cs();
3351
+ Xt.create();
3352
+ function gr(n, e) {
3335
3353
  if (!n || !n.__f_expr)
3336
3354
  return n;
3337
3355
  try {
3338
- return Zt.evaluate(n.original_expr, e);
3356
+ return Xt.evaluate(n.original_expr, e);
3339
3357
  } catch (t) {
3340
3358
  return console.warn(`Error evaluating F expression: ${t.message}`), null;
3341
3359
  }
@@ -3394,7 +3412,7 @@ class de {
3394
3412
  y[i] = p;
3395
3413
  for (const [_, w] of Object.entries(t))
3396
3414
  if (w && typeof w == "object" && w.__f_expr) {
3397
- const v = mr(w, m);
3415
+ const v = gr(w, m);
3398
3416
  v !== null ? y[_] = v : y[_] = m[_];
3399
3417
  } else
3400
3418
  y[_] = w;
@@ -3471,9 +3489,9 @@ class de {
3471
3489
  * @returns {Operation} The created operation
3472
3490
  */
3473
3491
  static createGetOrCreateOperation(e, t = {}, s = {}, r = null) {
3474
- const o = e.ModelClass, i = o.primaryKeyField, l = r || `${G()}`, c = Q.getStore(o).render(), f = { ...t }, m = new e.constructor(o).filter(f).build(), y = yt(m, o), _ = c.map(
3475
- (k) => _t(y, o.fromPk(k[i], e))
3476
- ), w = mt(_, m, o), v = c.filter(
3492
+ const o = e.ModelClass, i = o.primaryKeyField, l = r || `${G()}`, c = Q.getStore(o).render(), f = { ...t }, m = new e.constructor(o).filter(f).build(), y = gt(m, o), _ = c.map(
3493
+ (k) => wt(y, o.fromPk(k[i], e))
3494
+ ), w = yt(_, m, o), v = c.filter(
3477
3495
  (k) => w.includes(k[i])
3478
3496
  ), O = v.length === 0, T = O ? M.CREATE : M.UPDATE, b = O ? { ...t, ...s, [i]: l } : v[0];
3479
3497
  return new q({
@@ -3494,9 +3512,9 @@ class de {
3494
3512
  * @returns {Operation} The created operation
3495
3513
  */
3496
3514
  static createUpdateOrCreateOperation(e, t = {}, s = {}, r = null) {
3497
- const o = e.ModelClass, i = o.primaryKeyField, l = r || `${G()}`, c = Q.getStore(o).render(), f = { ...t }, m = new e.constructor(o).filter(f).build(), y = yt(m, o), _ = c.map(
3498
- (k) => _t(y, o.fromPk(k[i], e))
3499
- ), w = mt(_, m, o), v = c.filter(
3515
+ const o = e.ModelClass, i = o.primaryKeyField, l = r || `${G()}`, c = Q.getStore(o).render(), f = { ...t }, m = new e.constructor(o).filter(f).build(), y = gt(m, o), _ = c.map(
3516
+ (k) => wt(y, o.fromPk(k[i], e))
3517
+ ), w = yt(_, m, o), v = c.filter(
3500
3518
  (k) => w.includes(k[i])
3501
3519
  ), O = v.length === 0, T = O ? M.CREATE : M.UPDATE, b = O ? { ...t, ...s, [i]: l } : { ...v[0], ...s };
3502
3520
  return new q({
@@ -3509,7 +3527,7 @@ class de {
3509
3527
  });
3510
3528
  }
3511
3529
  }
3512
- class qt extends Array {
3530
+ class Wt extends Array {
3513
3531
  /**
3514
3532
  * Creates a new ResultTuple.
3515
3533
  *
@@ -3520,7 +3538,7 @@ class qt extends Array {
3520
3538
  super(2), this[0] = e, this[1] = t, this.instance = e, this.created = t;
3521
3539
  }
3522
3540
  }
3523
- class yr {
3541
+ class _r {
3524
3542
  /**
3525
3543
  * Executes a get operation (get, first, last) with the QuerySet.
3526
3544
  *
@@ -3535,7 +3553,7 @@ class yr {
3535
3553
  const { data: p, included: m, model_name: y } = f.data;
3536
3554
  if (E(p) || Array.isArray(p) && p.length === 0)
3537
3555
  return null;
3538
- _e(Q, m, r, e);
3556
+ we(Q, m, r, e);
3539
3557
  const _ = Array.isArray(p) ? p[0] : p;
3540
3558
  return a.pk = _, Z(a), a;
3541
3559
  }
@@ -3560,7 +3578,7 @@ class yr {
3560
3578
  static executeList(e, t = "list", s = {}) {
3561
3579
  const r = j.getEntity(e), o = L(e, t, s).then((i) => {
3562
3580
  const { data: l, included: a } = i.data;
3563
- _e(Q, a, e.ModelClass, e);
3581
+ we(Q, a, e.ModelClass, e);
3564
3582
  const c = Array.isArray(l) ? l : [];
3565
3583
  return j.setEntity(e, c), Z(r), r;
3566
3584
  });
@@ -3579,7 +3597,7 @@ class yr {
3579
3597
  lookup: s.lookup || {},
3580
3598
  defaults: s.defaults || {}
3581
3599
  }, l = t === "get_or_create" ? de.createGetOrCreateOperation(e, i.lookup, i.defaults) : de.createUpdateOrCreateOperation(e, i.lookup, i.defaults), a = l.type === "create", c = r.fromPk(l.instances[0][o], e);
3582
- let f = new qt(c, a);
3600
+ let f = new Wt(c, a);
3583
3601
  if (l.localOnly)
3584
3602
  return l.updateStatus(C.CONFIRMED, l.instances), f;
3585
3603
  const p = L(
@@ -3589,14 +3607,14 @@ class yr {
3589
3607
  l.operationId
3590
3608
  ).then((m) => {
3591
3609
  const { data: y, included: _, model_name: w } = m.data, v = m.metadata.created;
3592
- _e(Q, _, r, e);
3610
+ we(Q, _, r, e);
3593
3611
  const O = Array.isArray(y) ? y[0] : y;
3594
3612
  a && (c.pk = O);
3595
3613
  const b = (_[w] || {})[O];
3596
3614
  return b && l.mutate({
3597
3615
  instances: [b],
3598
3616
  status: C.CONFIRMED
3599
- }), f = new qt(c, v), Z(f), f;
3617
+ }), f = new Wt(c, v), Z(f), f;
3600
3618
  }).catch((m) => {
3601
3619
  throw l.updateStatus(C.REJECTED), m;
3602
3620
  });
@@ -3616,7 +3634,7 @@ class yr {
3616
3634
  throw new Error(
3617
3635
  `Field parameter is required for ${t} operation`
3618
3636
  );
3619
- const i = Pe.getEntity(t, e, o), l = {};
3637
+ const i = Fe.getEntity(t, e, o), l = {};
3620
3638
  t !== "exists" && (l.field = o);
3621
3639
  const a = L(
3622
3640
  e,
@@ -3624,7 +3642,7 @@ class yr {
3624
3642
  l
3625
3643
  ).then((c) => {
3626
3644
  const f = c.data, p = j.getEntity(e);
3627
- return Pe.setEntity(t, e, o, f, p), Z(i), f;
3645
+ return Fe.setEntity(t, e, o, f, p), Z(i), f;
3628
3646
  });
3629
3647
  return te(i, a);
3630
3648
  }
@@ -3726,11 +3744,11 @@ class yr {
3726
3744
  o,
3727
3745
  async (p) => {
3728
3746
  const { data: m } = p.data, y = Array.isArray(m) ? m[0] : m;
3729
- zt(o, y);
3747
+ Rt(o, y);
3730
3748
  }
3731
3749
  ).then((p) => {
3732
3750
  const { data: m, included: y, model_name: _ } = p.data;
3733
- _e(Q, y, r, e);
3751
+ we(Q, y, r, e);
3734
3752
  const w = Array.isArray(m) ? m[0] : m;
3735
3753
  c.pk = w;
3736
3754
  const O = (y[_] || {})[w];
@@ -3776,12 +3794,12 @@ class yr {
3776
3794
  const { data: m } = p.data;
3777
3795
  (Array.isArray(m) ? m : []).forEach((_, w) => {
3778
3796
  const v = `${o}_${w}`;
3779
- zt(v, _);
3797
+ Rt(v, _);
3780
3798
  });
3781
3799
  }
3782
3800
  ).then((p) => {
3783
3801
  const { data: m, included: y, model_name: _ } = p.data;
3784
- _e(Q, y, r, e);
3802
+ we(Q, y, r, e);
3785
3803
  const w = Array.isArray(m) ? m : [];
3786
3804
  w.forEach((T, b) => {
3787
3805
  c[b] && (c[b].pk = T);
@@ -3817,7 +3835,7 @@ class yr {
3817
3835
  a.operationId
3818
3836
  ).then((m) => {
3819
3837
  const { data: y, included: _, model_name: w } = m.data;
3820
- _e(Q, _, r, e);
3838
+ we(Q, _, r, e);
3821
3839
  const v = Array.isArray(y) ? y[0] : y;
3822
3840
  f.pk = v;
3823
3841
  const T = (_[w] || {})[v];
@@ -3918,7 +3936,7 @@ class yr {
3918
3936
  return L(e, t, s);
3919
3937
  }
3920
3938
  }
3921
- class gr {
3939
+ class wr {
3922
3940
  constructor(e, t, s = null) {
3923
3941
  this.queryset = e, this.metricType = t, this.field = s;
3924
3942
  }
@@ -3930,25 +3948,34 @@ class gr {
3930
3948
  * Delegates to the underlying store's sync method
3931
3949
  */
3932
3950
  refreshFromDb() {
3933
- return Pe.getStore(
3951
+ return Fe.getStore(
3934
3952
  this.metricType,
3935
3953
  this.queryset,
3936
3954
  this.field
3937
3955
  ).sync(!0);
3938
3956
  }
3939
3957
  /**
3940
- * Getter that always returns the current value from the store
3958
+ * Returns the current metric value from the store.
3959
+ * Called implicitly by JS when coercing to a primitive (arithmetic, template literals, etc.)
3941
3960
  */
3942
- get value() {
3943
- const e = Pe.getStore(
3961
+ valueOf() {
3962
+ const e = Fe.getStore(
3944
3963
  this.metricType,
3945
3964
  this.queryset,
3946
3965
  this.field
3947
3966
  );
3948
3967
  return e ? e.render() : null;
3949
3968
  }
3969
+ toString() {
3970
+ const e = this.valueOf();
3971
+ return e === null ? "" : String(e);
3972
+ }
3973
+ /** @deprecated Use valueOf() coercion instead (e.g. +metric, `${metric}`, metric + 0) */
3974
+ get value() {
3975
+ return this.valueOf();
3976
+ }
3950
3977
  }
3951
- class Ct {
3978
+ class vt {
3952
3979
  constructor() {
3953
3980
  this._stores = /* @__PURE__ */ new Map(), this.syncManager = null;
3954
3981
  }
@@ -3989,8 +4016,8 @@ class Ct {
3989
4016
  if (!this._stores.has(i)) {
3990
4017
  const l = async ({ metricType: c, modelClass: f, field: p, ast: m }) => {
3991
4018
  const y = t.clone();
3992
- return await yr.executeAgg(y, c, { field: p });
3993
- }, a = new pr(
4019
+ return await _r.executeAgg(y, c, { field: p });
4020
+ }, a = new yr(
3994
4021
  e,
3995
4022
  r,
3996
4023
  t,
@@ -4013,7 +4040,7 @@ class Ct {
4013
4040
  if (E(e) || E(t) || E(t.ModelClass))
4014
4041
  return null;
4015
4042
  this.getStore(e, t, s);
4016
- const r = new gr(t, e, s);
4043
+ const r = new wr(t, e, s);
4017
4044
  return r;
4018
4045
  }
4019
4046
  /**
@@ -4023,7 +4050,7 @@ class Ct {
4023
4050
  if (E(e) || E(t) || E(t.ModelClass))
4024
4051
  return null;
4025
4052
  const o = this.getStore(e, t, s);
4026
- return o ? ((!E(o.groundTruthValue) || !Ce(o.operations)) && o.reset(), o.setGroundTruth(r), r) : null;
4053
+ return o ? ((!E(o.groundTruthValue) || !ve(o.operations)) && o.reset(), o.setGroundTruth(r), r) : null;
4027
4054
  }
4028
4055
  /**
4029
4056
  * Sync a specific metric with the server
@@ -4040,8 +4067,8 @@ class Ct {
4040
4067
  return this._stores.has(e) ? this._stores.get(e).queryset : null;
4041
4068
  }
4042
4069
  }
4043
- const Pe = new Ct();
4044
- class _r {
4070
+ const Fe = new vt();
4071
+ class Cr {
4045
4072
  constructor(e) {
4046
4073
  this.event = e.event, this.model = e.model, this.operation_id = e.operation_id, this.pk_field_name = e.pk_field_name, this.configKey = e.configKey, this.canonical_id = e.canonical_id || null, this.server_ts_ms = e.server_ts_ms || null, this.instances = e.instances?.map((t) => t && this.pk_field_name && t[this.pk_field_name] != null ? {
4047
4074
  ...t,
@@ -4049,7 +4076,7 @@ class _r {
4049
4076
  } : t) || e.instances, this._cachedInstances = null;
4050
4077
  }
4051
4078
  get modelClass() {
4052
- return Xt(this.model, this.configKey);
4079
+ return ts(this.model, this.configKey);
4053
4080
  }
4054
4081
  async getFullInstances() {
4055
4082
  if (this.event === "delete")
@@ -4063,7 +4090,7 @@ class _r {
4063
4090
  }).fetch()), this._cachedInstances;
4064
4091
  }
4065
4092
  }
4066
- class wr {
4093
+ class vr {
4067
4094
  constructor() {
4068
4095
  this.registries = /* @__PURE__ */ new Map(), this.followedModels = /* @__PURE__ */ new Map(), this.followAllQuerysets = !0, this.followedQuerysets = /* @__PURE__ */ new Map(), this.periodicSyncTimer = null, this.eventBatch = /* @__PURE__ */ new Map(), this.debounceTimer = null, this.maxWaitTimer = null, this.debounceMs = 100, this.maxWaitMs = 2e3, this.batchStartTime = null;
4069
4096
  }
@@ -4086,7 +4113,7 @@ class wr {
4086
4113
  * Initialize event handlers for all event receivers
4087
4114
  */
4088
4115
  initialize() {
4089
- xs(), Ds().forEach((t, s) => {
4116
+ Us(), zs().forEach((t, s) => {
4090
4117
  t && t.addModelEventHandler(this.handleEvent.bind(this));
4091
4118
  }), this.startPeriodicSync();
4092
4119
  }
@@ -4104,7 +4131,7 @@ class wr {
4104
4131
  }
4105
4132
  }
4106
4133
  async syncStaleQuerysets() {
4107
- const e = this.registries.get(we);
4134
+ const e = this.registries.get(Ce);
4108
4135
  if (!e) return;
4109
4136
  const t = `periodic-sync-${G()}`, s = new Set(
4110
4137
  [...this.followedQuerysets].map((o) => o.semanticKey).filter((o) => e._stores.has(o))
@@ -4120,7 +4147,7 @@ class wr {
4120
4147
  ), this.pruneUnreferencedModels();
4121
4148
  }
4122
4149
  pruneUnreferencedModels() {
4123
- const e = this.registries.get(Ge), t = this.registries.get(we);
4150
+ const e = this.registries.get(Ge), t = this.registries.get(Ce);
4124
4151
  if (!(!e || !t))
4125
4152
  for (const [s, r] of e._stores.entries())
4126
4153
  r.pruneUnreferencedInstances(t);
@@ -4138,7 +4165,7 @@ class wr {
4138
4165
  const r = [...this.followedModels.values()].some(
4139
4166
  (o) => o.has(t)
4140
4167
  );
4141
- s.add(t), r || jt(t.configKey)?.subscribe(
4168
+ s.add(t), r || Qt(t.configKey)?.subscribe(
4142
4169
  t.modelName,
4143
4170
  this.handleEvent
4144
4171
  );
@@ -4148,7 +4175,7 @@ class wr {
4148
4175
  if (!s) return;
4149
4176
  s.delete(t), [...this.followedModels.values()].some(
4150
4177
  (o) => o.has(t)
4151
- ) || jt(t.configKey)?.unsubscribe(
4178
+ ) || Qt(t.configKey)?.unsubscribe(
4152
4179
  t.modelName,
4153
4180
  this.handleEvent
4154
4181
  );
@@ -4165,9 +4192,9 @@ class wr {
4165
4192
  * Checks the `verify` flag on membership state to determine which querysets need syncing.
4166
4193
  */
4167
4194
  syncQuerysetsNeedingVerification(e) {
4168
- const t = Oe.getQuerysetStates(e);
4195
+ const t = Pe.getQuerysetStates(e);
4169
4196
  if (!t) return;
4170
- const s = this.registries.get(we);
4197
+ const s = this.registries.get(Ce);
4171
4198
  if (!s) return;
4172
4199
  const r = [];
4173
4200
  for (const [l, a] of t.entries())
@@ -4196,8 +4223,8 @@ class wr {
4196
4223
  operationId: e.operation_id,
4197
4224
  socketId: e.socket_id
4198
4225
  });
4199
- let t = new _r(e), s = Oe.has(t.operation_id);
4200
- if (this.registries.has(Ct) && this.processMetrics(t), s) {
4226
+ let t = new Cr(e), s = Pe.has(t.operation_id);
4227
+ if (this.registries.has(vt) && this.processMetrics(t), s) {
4201
4228
  this.syncQuerysetsNeedingVerification(t.operation_id);
4202
4229
  return;
4203
4230
  }
@@ -4224,7 +4251,7 @@ class wr {
4224
4251
  s.has(o) || s.set(o, []), s.get(o).push(r);
4225
4252
  }), s.forEach((r, o) => {
4226
4253
  const i = r[0];
4227
- this.registries.has(we) && this.processQuerysetsBatch(i, r), this.registries.has(Ge) && this.processModels(i);
4254
+ this.registries.has(Ce) && this.processQuerysetsBatch(i, r), this.registries.has(Ge) && this.processModels(i);
4228
4255
  });
4229
4256
  }
4230
4257
  isQuerysetFollowed(e) {
@@ -4240,7 +4267,7 @@ class wr {
4240
4267
  return !1;
4241
4268
  }
4242
4269
  processQuerysetsBatch(e, t) {
4243
- const s = this.registries.get(we), r = [];
4270
+ const s = this.registries.get(Ce), r = [];
4244
4271
  for (const [c, f] of s._stores.entries())
4245
4272
  if (f.modelClass.modelName === e.model && f.modelClass.configKey === e.configKey) {
4246
4273
  if (this.followAllQuerysets) {
@@ -4264,7 +4291,7 @@ class wr {
4264
4291
  );
4265
4292
  }
4266
4293
  processMetrics(e) {
4267
- const t = this.registries.get(Ct);
4294
+ const t = this.registries.get(vt);
4268
4295
  for (const [s, r] of t._stores.entries())
4269
4296
  if (r.queryset && r.queryset.modelClass.modelName === e.model && r.queryset.modelClass.configKey === e.configKey) {
4270
4297
  if (this.followAllQuerysets) {
@@ -4283,7 +4310,7 @@ class wr {
4283
4310
  (e.instances || []).filter((c) => c && c[e.pk_field_name] != null).map((c) => c[e.pk_field_name])
4284
4311
  );
4285
4312
  if (r.size === 0) return;
4286
- const o = new Set(s.groundTruthPks), i = this.registries.get(we), l = /* @__PURE__ */ new Set();
4313
+ const o = new Set(s.groundTruthPks), i = this.registries.get(Ce), l = /* @__PURE__ */ new Set();
4287
4314
  if (i)
4288
4315
  for (const [c, f] of i._stores.entries())
4289
4316
  f.modelClass.modelName === e.model && f.modelClass.configKey === e.configKey && f.groundTruthPks.forEach((p) => l.add(p));
@@ -4293,97 +4320,97 @@ class wr {
4293
4320
  }), a.length > 0 && s.sync(a);
4294
4321
  }
4295
4322
  }
4296
- const $e = new wr();
4323
+ const $e = new vr();
4297
4324
  $e.manageRegistry(j);
4298
4325
  $e.manageRegistry(Q);
4299
- $e.manageRegistry(Pe);
4300
- const Cr = /* @__PURE__ */ new Set();
4301
- function vr(n) {
4302
- typeof n == "function" && Cr.add(n);
4326
+ $e.manageRegistry(Fe);
4327
+ const Er = /* @__PURE__ */ new Set();
4328
+ function br(n) {
4329
+ typeof n == "function" && Er.add(n);
4303
4330
  }
4304
4331
  $e.followAllQuerysets = !1;
4305
- const ss = /* @__PURE__ */ new Map();
4306
- vr(() => {
4307
- ss.clear(), $e.followAllQuerysets = !0, $e.followedQuerysets.clear();
4332
+ const ns = /* @__PURE__ */ new Map();
4333
+ br(() => {
4334
+ ns.clear(), $e.followAllQuerysets = !0, $e.followedQuerysets.clear();
4308
4335
  });
4309
- const Er = (n, e) => {
4336
+ const kr = (n, e) => {
4310
4337
  const t = n.__vccOpts || n;
4311
4338
  for (const [s, r] of e)
4312
4339
  t[s] = r;
4313
4340
  return t;
4314
- }, br = { class: "szd" }, kr = { class: "szd-header" }, Sr = { class: "szd-header__top" }, Tr = { class: "szd-header__left" }, Mr = {
4341
+ }, Sr = { class: "szd" }, Tr = { class: "szd-header" }, Mr = { class: "szd-header__top" }, $r = { class: "szd-header__left" }, Ar = {
4315
4342
  key: 0,
4316
4343
  class: "szd-header__model"
4317
- }, $r = {
4344
+ }, Or = {
4318
4345
  key: 1,
4319
4346
  class: "szd-header__model szd-header__model--empty"
4320
- }, Ar = { class: "szd-header__right" }, Or = {
4347
+ }, Pr = { class: "szd-header__right" }, Fr = {
4321
4348
  key: 0,
4322
4349
  class: "szd-header__badge szd-header__badge--syncing"
4323
- }, Pr = {
4350
+ }, Ir = {
4324
4351
  key: 1,
4325
4352
  class: "szd-header__badge"
4326
- }, Fr = { class: "szd-header__badge" }, Dr = { class: "szd-tabs" }, Ir = ["onClick"], Kr = { class: "szd-content" }, zr = {
4353
+ }, Dr = { class: "szd-header__badge" }, zr = { class: "szd-tabs" }, Kr = ["onClick"], Rr = { class: "szd-content" }, Nr = {
4327
4354
  key: 0,
4328
4355
  class: "szd-panel"
4329
- }, Rr = { class: "szd-panel__section" }, Nr = { class: "szd-kv" }, xr = { class: "szd-kv__row" }, jr = { class: "szd-kv__value" }, Ur = { class: "szd-kv__row" }, Qr = { class: "szd-kv__value" }, Vr = { class: "szd-kv__row" }, Lr = { class: "szd-kv__value" }, Gr = { class: "szd-kv__row" }, Br = { class: "szd-kv__value" }, Hr = { class: "szd-panel__section" }, qr = { class: "szd-stats" }, Jr = { class: "szd-stat" }, Wr = { class: "szd-stat__value" }, Zr = { class: "szd-stat" }, Yr = { class: "szd-stat__value" }, Xr = { class: "szd-stat" }, en = { class: "szd-stat__value" }, tn = { class: "szd-stat" }, sn = { class: "szd-stat__value" }, rn = {
4356
+ }, xr = { class: "szd-panel__section" }, jr = { class: "szd-kv" }, Ur = { class: "szd-kv__row" }, Qr = { class: "szd-kv__value" }, Vr = { class: "szd-kv__row" }, Lr = { class: "szd-kv__value" }, Gr = { class: "szd-kv__row" }, Br = { class: "szd-kv__value" }, Hr = { class: "szd-kv__row" }, qr = { class: "szd-kv__value" }, Jr = { class: "szd-panel__section" }, Wr = { class: "szd-stats" }, Zr = { class: "szd-stat" }, Yr = { class: "szd-stat__value" }, Xr = { class: "szd-stat" }, en = { class: "szd-stat__value" }, tn = { class: "szd-stat" }, sn = { class: "szd-stat__value" }, rn = { class: "szd-stat" }, nn = { class: "szd-stat__value" }, on = {
4330
4357
  class: "szd-kv",
4331
4358
  style: { "margin-top": "12px" }
4332
- }, nn = { class: "szd-kv__row" }, on = { class: "szd-kv__value" }, an = {
4359
+ }, an = { class: "szd-kv__row" }, ln = { class: "szd-kv__value" }, cn = {
4333
4360
  key: 0,
4334
4361
  class: "szd-panel__section"
4335
- }, ln = { class: "szd-event-preview__text" }, cn = { class: "szd-event-preview__time" }, dn = {
4362
+ }, dn = { class: "szd-event-preview__text" }, un = { class: "szd-event-preview__time" }, hn = {
4336
4363
  key: 1,
4337
4364
  class: "szd-panel"
4338
- }, un = { class: "szd-timeline-filters" }, hn = ["onUpdate:modelValue"], fn = { class: "szd-timeline" }, pn = ["onClick"], mn = { class: "szd-timeline__time" }, yn = { class: "szd-timeline__text" }, gn = {
4365
+ }, fn = { class: "szd-timeline-filters" }, pn = ["onUpdate:modelValue"], mn = { class: "szd-timeline" }, yn = ["onClick"], gn = { class: "szd-timeline__time" }, _n = { class: "szd-timeline__text" }, wn = {
4339
4366
  key: 0,
4340
4367
  class: "szd-empty"
4341
- }, _n = {
4368
+ }, Cn = {
4342
4369
  key: 2,
4343
4370
  class: "szd-panel"
4344
- }, wn = { class: "szd-pipeline" }, Cn = ["onClick"], vn = { class: "szd-pipeline__label" }, En = { class: "szd-pipeline__count" }, bn = {
4371
+ }, vn = { class: "szd-pipeline" }, En = ["onClick"], bn = { class: "szd-pipeline__label" }, kn = { class: "szd-pipeline__count" }, Sn = {
4345
4372
  key: 0,
4346
4373
  class: "szd-pipeline__arrow"
4347
- }, kn = {
4374
+ }, Tn = {
4348
4375
  class: "szd-panel__section",
4349
4376
  style: { "margin-top": "20px" }
4350
- }, Sn = { class: "szd-preview-header" }, Tn = ["value"], Mn = {
4377
+ }, Mn = { class: "szd-preview-header" }, $n = ["value"], An = {
4351
4378
  key: 0,
4352
4379
  class: "szd-data-grid"
4353
- }, $n = { class: "szd-data-card__header" }, An = {
4380
+ }, On = { class: "szd-data-card__header" }, Pn = {
4354
4381
  key: 0,
4355
4382
  class: "szd-data-card__badge"
4356
- }, On = {
4383
+ }, Fn = {
4357
4384
  key: 1,
4358
4385
  class: "szd-data-card__badge szd-data-card__badge--absent"
4359
- }, Pn = { class: "szd-data-card__content" }, Fn = {
4386
+ }, In = { class: "szd-data-card__content" }, Dn = {
4360
4387
  key: 1,
4361
4388
  class: "szd-empty"
4362
- }, Dn = {
4389
+ }, zn = {
4363
4390
  key: 3,
4364
4391
  class: "szd-panel"
4365
- }, In = {
4392
+ }, Kn = {
4366
4393
  class: "szd-kv",
4367
4394
  style: { "margin-bottom": "16px" }
4368
- }, Kn = { class: "szd-kv__row" }, zn = { class: "szd-kv__value szd-kv__value--mono" }, Rn = { class: "szd-ast" }, Nn = {
4395
+ }, Rn = { class: "szd-kv__row" }, Nn = { class: "szd-kv__value szd-kv__value--mono" }, xn = { class: "szd-ast" }, jn = {
4369
4396
  key: 0,
4370
4397
  class: "szd-detail"
4371
- }, xn = { class: "szd-detail__panel szd-detail__panel--sm" }, jn = { class: "szd-detail__header" }, Un = { class: "szd-detail__body" }, Qn = { class: "szd-settings-section" }, Vn = ["value"], Ln = {
4398
+ }, Un = { class: "szd-detail__panel szd-detail__panel--sm" }, Qn = { class: "szd-detail__header" }, Vn = { class: "szd-detail__body" }, Ln = { class: "szd-settings-section" }, Gn = ["value"], Bn = {
4372
4399
  key: 0,
4373
4400
  class: "szd-settings-section"
4374
- }, Gn = { class: "szd-settings-row" }, Bn = { class: "szd-settings-code" }, Hn = { class: "szd-settings-section" }, qn = { class: "szd-settings-actions" }, Jn = ["disabled"], Wn = { class: "szd-settings-section" }, Zn = { class: "szd-toggle" }, Yn = {
4401
+ }, Hn = { class: "szd-settings-row" }, qn = { class: "szd-settings-code" }, Jn = { class: "szd-settings-section" }, Wn = { class: "szd-settings-actions" }, Zn = ["disabled"], Yn = { class: "szd-settings-section" }, Xn = { class: "szd-toggle" }, eo = {
4375
4402
  key: 1,
4376
4403
  class: "szd-settings-section"
4377
- }, Xn = { class: "szd-kv" }, eo = { class: "szd-kv__row" }, to = { class: "szd-kv__value" }, so = { class: "szd-kv__row" }, ro = { class: "szd-kv__value" }, no = { class: "szd-kv__row" }, oo = { class: "szd-kv__value" }, io = { class: "szd-kv__row" }, ao = { class: "szd-kv__value" }, lo = { class: "szd-kv__row" }, co = { class: "szd-kv__value" }, uo = {
4404
+ }, to = { class: "szd-kv" }, so = { class: "szd-kv__row" }, ro = { class: "szd-kv__value" }, no = { class: "szd-kv__row" }, oo = { class: "szd-kv__value" }, io = { class: "szd-kv__row" }, ao = { class: "szd-kv__value" }, lo = { class: "szd-kv__row" }, co = { class: "szd-kv__value" }, uo = { class: "szd-kv__row" }, ho = { class: "szd-kv__value" }, fo = {
4378
4405
  key: 0,
4379
4406
  class: "szd-detail"
4380
- }, ho = { class: "szd-detail__panel" }, fo = { class: "szd-detail__header" }, po = { class: "szd-detail__title" }, mo = { class: "szd-detail__body" }, yo = { class: "szd-kv" }, go = { class: "szd-kv__key" }, _o = { class: "szd-kv__value" }, wo = { class: "szd-ast" }, Co = {
4407
+ }, po = { class: "szd-detail__panel" }, mo = { class: "szd-detail__header" }, yo = { class: "szd-detail__title" }, go = { class: "szd-detail__body" }, _o = { class: "szd-kv" }, wo = { class: "szd-kv__key" }, Co = { class: "szd-kv__value" }, vo = { class: "szd-ast" }, Eo = {
4381
4408
  class: "szd-kv",
4382
4409
  style: { "margin-bottom": "16px" }
4383
- }, vo = { class: "szd-kv__row" }, Eo = { class: "szd-kv__value" }, bo = { class: "szd-kv__row" }, ko = { class: "szd-kv__value" }, So = {
4410
+ }, bo = { class: "szd-kv__row" }, ko = { class: "szd-kv__value" }, So = { class: "szd-kv__row" }, To = { class: "szd-kv__value" }, Mo = {
4384
4411
  key: 0,
4385
4412
  class: "szd-kv__note"
4386
- }, To = { class: "szd-ast" }, Jt = 100, Mo = {
4413
+ }, $o = { class: "szd-ast" }, Zt = 100, Ao = {
4387
4414
  __name: "StateZeroDebugPanel",
4388
4415
  props: {
4389
4416
  queryset: { type: [Object, String], default: null },
@@ -4397,7 +4424,7 @@ const Er = (n, e) => {
4397
4424
  { id: "timeline", label: "Timeline" },
4398
4425
  { id: "data", label: "Data" },
4399
4426
  { id: "ast", label: "AST" }
4400
- ], r = J(""), o = J(e.useQueryset), i = J(!0), l = J(Qt()), a = J(0), c = J(!1), f = J(null), p = J(!1), m = J(null), y = J({
4427
+ ], r = J(""), o = J(e.useQueryset), i = J(!0), l = J(Lt()), a = J(0), c = J(!1), f = J(null), p = J(!1), m = J(null), y = J({
4401
4428
  request: !0,
4402
4429
  response: !0,
4403
4430
  render: !0,
@@ -4418,7 +4445,7 @@ const Er = (n, e) => {
4418
4445
  ), v = R(() => {
4419
4446
  a.value;
4420
4447
  const u = [];
4421
- return ss.forEach((d) => {
4448
+ return ns.forEach((d) => {
4422
4449
  d?.semanticKey && u.push({
4423
4450
  semanticKey: d.semanticKey,
4424
4451
  modelName: d.ModelClass?.modelName,
@@ -4455,19 +4482,19 @@ const Er = (n, e) => {
4455
4482
  return k.value && j._stores.get(k.value) || null;
4456
4483
  }), F = R(() => {
4457
4484
  a.value;
4458
- const u = N.value, d = U.value, g = u?.modelClass?.modelName || d?.ModelClass?.modelName, K = u?.modelClass?.configKey || d?.ModelClass?.configKey, H = u?.groundTruthPks?.length ?? 0, oe = u?.operationsMap?.size ?? 0, le = u?.getInflightOperations?.() || [], be = u?.isSyncing ?? !1, je = u?.lastSync ? new Date(u.lastSync).toLocaleString() : "—", ot = u && Array.isArray(u._lastRenderedPks) ? u._lastRenderedPks.length : null, ls = u?.groundTruthPks?.length ?? 0, cs = u ? u.lastSync === null ? "model store" : "ground truth" : "—", ds = be ? "Sync in progress — results may change." : oe > 0 ? "Optimistic operations are applied to results." : u?.lastSync === null ? "No ground truth yet — rendering from model store." : "Using ground truth + local filters.";
4485
+ const u = N.value, d = U.value, g = u?.modelClass?.modelName || d?.ModelClass?.modelName, z = u?.modelClass?.configKey || d?.ModelClass?.configKey, H = u?.groundTruthPks?.length ?? 0, oe = u?.operationsMap?.size ?? 0, le = u?.getInflightOperations?.() || [], be = u?.isSyncing ?? !1, Ue = u?.lastSync ? new Date(u.lastSync).toLocaleString() : "—", ot = u && Array.isArray(u._lastRenderedPks) ? u._lastRenderedPks.length : null, ds = u?.groundTruthPks?.length ?? 0, us = u ? u.lastSync === null ? "model store" : "ground truth" : "—", hs = be ? "Sync in progress — results may change." : oe > 0 ? "Optimistic operations are applied to results." : u?.lastSync === null ? "No ground truth yet — rendering from model store." : "Using ground truth + local filters.";
4459
4486
  return {
4460
4487
  modelName: g,
4461
- configKey: K,
4488
+ configKey: z,
4462
4489
  groundTruthCount: H,
4463
4490
  opsCount: oe,
4464
4491
  inFlightCount: le.length,
4465
4492
  isSyncing: be,
4466
- lastSync: je,
4493
+ lastSync: Ue,
4467
4494
  optimisticCount: ot,
4468
- confirmedCount: ls,
4469
- source: cs,
4470
- reason: ds
4495
+ confirmedCount: ds,
4496
+ source: us,
4497
+ reason: hs
4471
4498
  };
4472
4499
  }), re = R(() => {
4473
4500
  a.value;
@@ -4477,27 +4504,27 @@ const Er = (n, e) => {
4477
4504
  return { error: u?.message || "Failed to build AST" };
4478
4505
  }
4479
4506
  });
4480
- function fe(u) {
4507
+ function pe(u) {
4481
4508
  if (!u?.filter?.conditions) return "—";
4482
4509
  const d = u.filter.conditions;
4483
- return typeof d != "object" ? String(d) : Object.entries(d).map(([K, H]) => H === null ? `${K}: null` : typeof H == "object" ? `${K}: ${JSON.stringify(H)}` : `${K}: ${H}`).join(", ");
4510
+ return typeof d != "object" ? String(d) : Object.entries(d).map(([z, H]) => H === null ? `${z}: null` : typeof H == "object" ? `${z}: ${JSON.stringify(H)}` : `${z}: ${H}`).join(", ");
4484
4511
  }
4485
4512
  function ae(u) {
4486
4513
  const d = u?.orderBy;
4487
4514
  return !d || Array.isArray(d) && d.length === 0 ? "—" : Array.isArray(d) ? d.join(", ") : String(d);
4488
4515
  }
4489
- const I = R(() => {
4516
+ const D = R(() => {
4490
4517
  const u = re.value;
4491
4518
  return {
4492
- filter: fe(u),
4519
+ filter: pe(u),
4493
4520
  orderBy: ae(u),
4494
4521
  limit: u?.serializerOptions?.limit ?? "—"
4495
4522
  };
4496
4523
  });
4497
- function D(u, d, g, K) {
4524
+ function I(u, d, g, z) {
4498
4525
  if (!u || !Array.isArray(g)) return [];
4499
4526
  const H = [];
4500
- for (const oe of g.slice(0, K))
4527
+ for (const oe of g.slice(0, z))
4501
4528
  try {
4502
4529
  const le = u.fromPk(oe, d);
4503
4530
  le && H.push(le.serialize());
@@ -4505,7 +4532,7 @@ const Er = (n, e) => {
4505
4532
  }
4506
4533
  return H;
4507
4534
  }
4508
- const z = R(() => {
4535
+ const K = R(() => {
4509
4536
  a.value;
4510
4537
  const u = N.value, d = U.value;
4511
4538
  if (!u || !d)
@@ -4522,7 +4549,7 @@ const Er = (n, e) => {
4522
4549
  finalSample: [],
4523
4550
  limit: null
4524
4551
  };
4525
- const g = Array.isArray(u.groundTruthPks) ? [...u.groundTruthPks] : [], K = u.renderFromData(!0), H = u.renderFromData(!1), oe = u._getValidatedAndFilteredPks(K), le = u.lastSync === null ? u.renderFromModelStore() : [], be = d.build()?.serializerOptions?.limit ?? null, je = be ? oe.slice(0, be) : oe, ot = le.length > 0 ? D(
4552
+ const g = Array.isArray(u.groundTruthPks) ? [...u.groundTruthPks] : [], z = u.renderFromData(!0), H = u.renderFromData(!1), oe = u._getValidatedAndFilteredPks(z), le = u.lastSync === null ? u.renderFromModelStore() : [], be = d.build()?.serializerOptions?.limit ?? null, Ue = be ? oe.slice(0, be) : oe, ot = le.length > 0 ? I(
4526
4553
  u.modelClass,
4527
4554
  d,
4528
4555
  le,
@@ -4531,66 +4558,66 @@ const Er = (n, e) => {
4531
4558
  return {
4532
4559
  modelStoreFiltered: le,
4533
4560
  groundTruth: g,
4534
- optimistic: K,
4561
+ optimistic: z,
4535
4562
  filtered: oe,
4536
- final: je,
4563
+ final: Ue,
4537
4564
  modelStoreSample: ot,
4538
- groundTruthSample: D(
4565
+ groundTruthSample: I(
4539
4566
  u.modelClass,
4540
4567
  d,
4541
4568
  g,
4542
4569
  e.sampleSize
4543
4570
  ),
4544
- optimisticSample: D(
4571
+ optimisticSample: I(
4545
4572
  u.modelClass,
4546
4573
  d,
4547
- K,
4574
+ z,
4548
4575
  e.sampleSize
4549
4576
  ),
4550
- filteredSample: D(
4577
+ filteredSample: I(
4551
4578
  u.modelClass,
4552
4579
  d,
4553
4580
  oe,
4554
4581
  e.sampleSize
4555
4582
  ),
4556
- finalSample: D(
4583
+ finalSample: I(
4557
4584
  u.modelClass,
4558
4585
  d,
4559
- je,
4586
+ Ue,
4560
4587
  e.sampleSize
4561
4588
  ),
4562
4589
  limit: be,
4563
4590
  confirmed: H
4564
4591
  };
4565
- }), pe = R(() => [
4566
- { id: "model-store", label: "Model Store", count: z.value.modelStoreFiltered.length, pks: z.value.modelStoreFiltered },
4567
- { id: "ground-truth", label: "Ground Truth", count: z.value.groundTruth.length, pks: z.value.groundTruth },
4568
- { id: "optimistic", label: "Optimistic", count: z.value.optimistic.length, pks: z.value.optimistic },
4569
- { id: "filtered", label: "Filtered", count: z.value.filtered.length, pks: z.value.filtered },
4570
- { id: "final", label: "Final", count: z.value.final.length, pks: z.value.final }
4571
- ]), Ye = R(() => z.value.final || []);
4572
- function me(u) {
4592
+ }), me = R(() => [
4593
+ { id: "model-store", label: "Model Store", count: K.value.modelStoreFiltered.length, pks: K.value.modelStoreFiltered },
4594
+ { id: "ground-truth", label: "Ground Truth", count: K.value.groundTruth.length, pks: K.value.groundTruth },
4595
+ { id: "optimistic", label: "Optimistic", count: K.value.optimistic.length, pks: K.value.optimistic },
4596
+ { id: "filtered", label: "Filtered", count: K.value.filtered.length, pks: K.value.filtered },
4597
+ { id: "final", label: "Final", count: K.value.final.length, pks: K.value.final }
4598
+ ]), Ye = R(() => K.value.final || []);
4599
+ function ye(u) {
4573
4600
  const d = N.value, g = U.value;
4574
4601
  if (!d || !g || u == null) return null;
4575
4602
  try {
4576
- const K = d.modelClass.fromPk(u, g);
4577
- return K ? K.serialize() : null;
4603
+ const z = d.modelClass.fromPk(u, g);
4604
+ return z ? z.serialize() : null;
4578
4605
  } catch {
4579
4606
  return null;
4580
4607
  }
4581
4608
  }
4582
- R(() => m.value == null ? null : me(m.value));
4609
+ R(() => m.value == null ? null : ye(m.value));
4583
4610
  const Ke = R(() => {
4584
4611
  if (!f.value || f.value.type !== "snapshot") return [];
4585
4612
  const u = f.value.data, d = N.value, g = U.value;
4586
- return !d || !g || !u.pks ? [] : D(d.modelClass, g, u.pks, Jt);
4587
- }), Xe = R(() => !f.value || f.value.type !== "snapshot" ? !1 : f.value.data.count > Jt), ze = R(() => {
4613
+ return !d || !g || !u.pks ? [] : I(d.modelClass, g, u.pks, Zt);
4614
+ }), Xe = R(() => !f.value || f.value.type !== "snapshot" ? !1 : f.value.data.count > Zt), Re = R(() => {
4588
4615
  if (!k.value) return l.value;
4589
4616
  const u = N.value;
4590
4617
  return l.value.filter((d) => d.semanticKey === k.value ? !0 : u ? d.modelName === u.modelClass?.modelName && d.configKey === u.modelClass?.configKey : !1);
4591
- }), Ee = R(() => ze.value.filter((u) => y.value[u.type])), Re = R(() => l.value.length), ne = R(
4618
+ }), Ee = R(() => Re.value.filter((u) => y.value[u.type])), Ne = R(() => l.value.length), ne = R(
4592
4619
  () => l.value.length ? l.value[l.value.length - 1] : null
4593
- ), Ne = [
4620
+ ), xe = [
4594
4621
  { id: "request", label: "Requests", color: "#3b82f6" },
4595
4622
  { id: "response", label: "Responses", color: "#22c55e" },
4596
4623
  { id: "render", label: "Renders", color: "#a855f7" },
@@ -4601,8 +4628,8 @@ const Er = (n, e) => {
4601
4628
  { id: "groupSync", label: "Group Sync", color: "#8b5cf6" },
4602
4629
  { id: "error", label: "Errors", color: "#ef4444" }
4603
4630
  ];
4604
- function xe(u) {
4605
- return Ne.find((d) => d.id === u)?.color || "#6b7280";
4631
+ function je(u) {
4632
+ return xe.find((d) => d.id === u)?.color || "#6b7280";
4606
4633
  }
4607
4634
  function et(u) {
4608
4635
  if (!u) return "";
@@ -4612,7 +4639,7 @@ const Er = (n, e) => {
4612
4639
  return "";
4613
4640
  }
4614
4641
  }
4615
- function Et(u) {
4642
+ function bt(u) {
4616
4643
  if (!u) return "";
4617
4644
  switch (u.type) {
4618
4645
  case "request":
@@ -4637,7 +4664,7 @@ const Er = (n, e) => {
4637
4664
  return u.type;
4638
4665
  }
4639
4666
  }
4640
- function rs(u) {
4667
+ function os(u) {
4641
4668
  if (!u) return null;
4642
4669
  const d = {
4643
4670
  type: u.type,
@@ -4669,13 +4696,13 @@ const Er = (n, e) => {
4669
4696
  return d;
4670
4697
  }
4671
4698
  }
4672
- function ns() {
4673
- Ls(), l.value = [];
4699
+ function is() {
4700
+ Bs(), l.value = [];
4674
4701
  }
4675
- function os() {
4702
+ function as() {
4676
4703
  !k.value || !navigator?.clipboard || navigator.clipboard.writeText(k.value);
4677
4704
  }
4678
- async function is() {
4705
+ async function ls() {
4679
4706
  if (!(!N.value || c.value)) {
4680
4707
  c.value = !0;
4681
4708
  try {
@@ -4686,36 +4713,36 @@ const Er = (n, e) => {
4686
4713
  }
4687
4714
  }
4688
4715
  }
4689
- function bt(u) {
4716
+ function kt(u) {
4690
4717
  f.value = { type: "entry", data: u };
4691
4718
  }
4692
- function as(u) {
4719
+ function cs(u) {
4693
4720
  f.value = { type: "snapshot", data: u };
4694
4721
  }
4695
- function kt() {
4722
+ function St() {
4696
4723
  f.value = null;
4697
4724
  }
4698
- function St(u) {
4725
+ function Tt(u) {
4699
4726
  Object.keys(y.value).forEach((d) => {
4700
4727
  y.value[d] = u;
4701
4728
  });
4702
4729
  }
4703
4730
  let tt = null, st = null, rt = null, nt = null;
4704
- return us(() => {
4705
- Gs(), Vt(e.maxEntries), tt = Qs((u) => {
4731
+ return fs(() => {
4732
+ Hs(), Gt(e.maxEntries), tt = Ls((u) => {
4706
4733
  i.value && (l.value = [...l.value, u], l.value.length > e.maxEntries && (l.value = l.value.slice(-e.maxEntries)));
4707
- }), st = Vs(() => {
4734
+ }), st = Gs(() => {
4708
4735
  l.value = [];
4709
4736
  }), rt = setInterval(() => {
4710
4737
  a.value += 1;
4711
4738
  }, 2e3), nt = setInterval(() => {
4712
- l.value = Qt();
4739
+ l.value = Lt();
4713
4740
  }, 1e3);
4714
- }), hs(() => {
4741
+ }), ps(() => {
4715
4742
  tt && tt(), st && st(), rt && clearInterval(rt), nt && clearInterval(nt);
4716
4743
  }), it(
4717
4744
  () => e.maxEntries,
4718
- (u) => Vt(u)
4745
+ (u) => Gt(u)
4719
4746
  ), it(
4720
4747
  () => e.useQueryset,
4721
4748
  (u) => {
@@ -4723,17 +4750,17 @@ const Er = (n, e) => {
4723
4750
  }
4724
4751
  ), it(k, () => {
4725
4752
  m.value = null;
4726
- }), (u, d) => (A(), $("section", br, [
4727
- h("header", kr, [
4728
- h("div", Sr, [
4729
- h("div", Tr, [
4753
+ }), (u, d) => (A(), $("section", Sr, [
4754
+ h("header", Tr, [
4755
+ h("div", Mr, [
4756
+ h("div", $r, [
4730
4757
  d[9] || (d[9] = h("div", { class: "szd-header__title" }, "StateZero", -1)),
4731
- k.value ? (A(), $("span", Mr, S(F.value.modelName || "?"), 1)) : (A(), $("span", $r, "No queryset"))
4758
+ k.value ? (A(), $("span", Ar, S(F.value.modelName || "?"), 1)) : (A(), $("span", Or, "No queryset"))
4732
4759
  ]),
4733
- h("div", Ar, [
4734
- F.value.isSyncing ? (A(), $("span", Or, "Syncing")) : V("", !0),
4735
- F.value.opsCount > 0 ? (A(), $("span", Pr, S(F.value.opsCount) + " ops", 1)) : V("", !0),
4736
- h("span", Fr, S(Re.value) + " events", 1),
4760
+ h("div", Pr, [
4761
+ F.value.isSyncing ? (A(), $("span", Fr, "Syncing")) : V("", !0),
4762
+ F.value.opsCount > 0 ? (A(), $("span", Ir, S(F.value.opsCount) + " ops", 1)) : V("", !0),
4763
+ h("span", Dr, S(Ne.value) + " events", 1),
4737
4764
  h("button", {
4738
4765
  class: "szd-btn szd-btn--icon",
4739
4766
  onClick: d[0] || (d[0] = (g) => p.value = !0),
@@ -4757,140 +4784,140 @@ const Er = (n, e) => {
4757
4784
  ])])
4758
4785
  ])
4759
4786
  ]),
4760
- h("nav", Dr, [
4787
+ h("nav", zr, [
4761
4788
  (A(), $(W, null, ce(s, (g) => h("button", {
4762
4789
  key: g.id,
4763
- class: Mt(["szd-tabs__tab", { "szd-tabs__tab--active": t.value === g.id }]),
4764
- onClick: (K) => t.value = g.id
4765
- }, S(g.label), 11, Ir)), 64))
4790
+ class: $t(["szd-tabs__tab", { "szd-tabs__tab--active": t.value === g.id }]),
4791
+ onClick: (z) => t.value = g.id
4792
+ }, S(g.label), 11, Kr)), 64))
4766
4793
  ])
4767
4794
  ]),
4768
- h("main", Kr, [
4769
- t.value === "overview" ? (A(), $("div", zr, [
4770
- h("div", Rr, [
4795
+ h("main", Rr, [
4796
+ t.value === "overview" ? (A(), $("div", Nr, [
4797
+ h("div", xr, [
4771
4798
  d[15] || (d[15] = h("h3", { class: "szd-panel__heading" }, "Why This View?", -1)),
4772
- h("div", Nr, [
4773
- h("div", xr, [
4799
+ h("div", jr, [
4800
+ h("div", Ur, [
4774
4801
  d[11] || (d[11] = h("span", { class: "szd-kv__key" }, "Filter:", -1)),
4775
- h("span", jr, S(I.value.filter), 1)
4802
+ h("span", Qr, S(D.value.filter), 1)
4776
4803
  ]),
4777
- h("div", Ur, [
4804
+ h("div", Vr, [
4778
4805
  d[12] || (d[12] = h("span", { class: "szd-kv__key" }, "Order:", -1)),
4779
- h("span", Qr, S(I.value.orderBy), 1)
4806
+ h("span", Lr, S(D.value.orderBy), 1)
4780
4807
  ]),
4781
- h("div", Vr, [
4808
+ h("div", Gr, [
4782
4809
  d[13] || (d[13] = h("span", { class: "szd-kv__key" }, "Limit:", -1)),
4783
- h("span", Lr, S(I.value.limit), 1)
4810
+ h("span", Br, S(D.value.limit), 1)
4784
4811
  ]),
4785
- h("div", Gr, [
4812
+ h("div", Hr, [
4786
4813
  d[14] || (d[14] = h("span", { class: "szd-kv__key" }, "Reason:", -1)),
4787
- h("span", Br, S(F.value.reason), 1)
4814
+ h("span", qr, S(F.value.reason), 1)
4788
4815
  ])
4789
4816
  ])
4790
4817
  ]),
4791
- h("div", Hr, [
4818
+ h("div", Jr, [
4792
4819
  d[21] || (d[21] = h("h3", { class: "szd-panel__heading" }, "Current State", -1)),
4793
- h("div", qr, [
4794
- h("div", Jr, [
4795
- h("div", Wr, S(F.value.optimisticCount ?? "—"), 1),
4820
+ h("div", Wr, [
4821
+ h("div", Zr, [
4822
+ h("div", Yr, S(F.value.optimisticCount ?? "—"), 1),
4796
4823
  d[16] || (d[16] = h("div", { class: "szd-stat__label" }, "Optimistic", -1))
4797
4824
  ]),
4798
- h("div", Zr, [
4799
- h("div", Yr, S(F.value.confirmedCount), 1),
4825
+ h("div", Xr, [
4826
+ h("div", en, S(F.value.confirmedCount), 1),
4800
4827
  d[17] || (d[17] = h("div", { class: "szd-stat__label" }, "Confirmed", -1))
4801
4828
  ]),
4802
- h("div", Xr, [
4803
- h("div", en, S(F.value.groundTruthCount), 1),
4829
+ h("div", tn, [
4830
+ h("div", sn, S(F.value.groundTruthCount), 1),
4804
4831
  d[18] || (d[18] = h("div", { class: "szd-stat__label" }, "Ground Truth", -1))
4805
4832
  ]),
4806
- h("div", tn, [
4807
- h("div", sn, S(F.value.inFlightCount), 1),
4833
+ h("div", rn, [
4834
+ h("div", nn, S(F.value.inFlightCount), 1),
4808
4835
  d[19] || (d[19] = h("div", { class: "szd-stat__label" }, "In-Flight", -1))
4809
4836
  ])
4810
4837
  ]),
4811
- h("div", rn, [
4812
- h("div", nn, [
4838
+ h("div", on, [
4839
+ h("div", an, [
4813
4840
  d[20] || (d[20] = h("span", { class: "szd-kv__key" }, "Last Sync:", -1)),
4814
- h("span", on, S(F.value.lastSync), 1)
4841
+ h("span", ln, S(F.value.lastSync), 1)
4815
4842
  ])
4816
4843
  ])
4817
4844
  ]),
4818
- ne.value ? (A(), $("div", an, [
4845
+ ne.value ? (A(), $("div", cn, [
4819
4846
  d[22] || (d[22] = h("h3", { class: "szd-panel__heading" }, "Last Event", -1)),
4820
4847
  h("button", {
4821
4848
  class: "szd-event-preview",
4822
- onClick: d[1] || (d[1] = (g) => bt(ne.value))
4849
+ onClick: d[1] || (d[1] = (g) => kt(ne.value))
4823
4850
  }, [
4824
4851
  h("span", {
4825
4852
  class: "szd-event-preview__badge",
4826
- style: at({ background: xe(ne.value.type) })
4853
+ style: at({ background: je(ne.value.type) })
4827
4854
  }, S(ne.value.type), 5),
4828
- h("span", ln, S(Et(ne.value)), 1),
4829
- h("span", cn, S(et(ne.value.ts)), 1)
4855
+ h("span", dn, S(bt(ne.value)), 1),
4856
+ h("span", un, S(et(ne.value.ts)), 1)
4830
4857
  ])
4831
4858
  ])) : V("", !0)
4832
4859
  ])) : V("", !0),
4833
- t.value === "timeline" ? (A(), $("div", dn, [
4834
- h("div", un, [
4860
+ t.value === "timeline" ? (A(), $("div", hn, [
4861
+ h("div", fn, [
4835
4862
  h("button", {
4836
4863
  class: "szd-btn szd-btn--sm",
4837
- onClick: d[2] || (d[2] = (g) => St(!0))
4864
+ onClick: d[2] || (d[2] = (g) => Tt(!0))
4838
4865
  }, "All"),
4839
4866
  h("button", {
4840
4867
  class: "szd-btn szd-btn--sm",
4841
- onClick: d[3] || (d[3] = (g) => St(!1))
4868
+ onClick: d[3] || (d[3] = (g) => Tt(!1))
4842
4869
  }, "None"),
4843
- (A(), $(W, null, ce(Ne, (g) => h("label", {
4870
+ (A(), $(W, null, ce(xe, (g) => h("label", {
4844
4871
  key: g.id,
4845
- class: Mt(["szd-filter-chip", { "szd-filter-chip--active": y.value[g.id] }]),
4872
+ class: $t(["szd-filter-chip", { "szd-filter-chip--active": y.value[g.id] }]),
4846
4873
  style: at(y.value[g.id] ? { background: g.color, borderColor: g.color } : {})
4847
4874
  }, [
4848
- Ue(h("input", {
4875
+ Qe(h("input", {
4849
4876
  type: "checkbox",
4850
- "onUpdate:modelValue": (K) => y.value[g.id] = K,
4877
+ "onUpdate:modelValue": (z) => y.value[g.id] = z,
4851
4878
  class: "szd-filter-chip__input"
4852
- }, null, 8, hn), [
4853
- [$t, y.value[g.id]]
4879
+ }, null, 8, pn), [
4880
+ [At, y.value[g.id]]
4854
4881
  ]),
4855
- Qe(" " + S(g.label), 1)
4882
+ Ve(" " + S(g.label), 1)
4856
4883
  ], 6)), 64))
4857
4884
  ]),
4858
- h("div", fn, [
4885
+ h("div", mn, [
4859
4886
  (A(!0), $(W, null, ce(Ee.value, (g) => (A(), $("div", {
4860
4887
  key: g.id,
4861
4888
  class: "szd-timeline__item",
4862
- onClick: (K) => bt(g)
4889
+ onClick: (z) => kt(g)
4863
4890
  }, [
4864
- h("span", mn, S(et(g.ts)), 1),
4891
+ h("span", gn, S(et(g.ts)), 1),
4865
4892
  h("span", {
4866
4893
  class: "szd-timeline__badge",
4867
- style: at({ background: xe(g.type) })
4894
+ style: at({ background: je(g.type) })
4868
4895
  }, S(g.type), 5),
4869
- h("span", yn, S(Et(g)), 1)
4870
- ], 8, pn))), 128)),
4871
- Ee.value.length ? V("", !0) : (A(), $("div", gn, " No events match current filters "))
4896
+ h("span", _n, S(bt(g)), 1)
4897
+ ], 8, yn))), 128)),
4898
+ Ee.value.length ? V("", !0) : (A(), $("div", wn, " No events match current filters "))
4872
4899
  ])
4873
4900
  ])) : V("", !0),
4874
- t.value === "data" ? (A(), $("div", _n, [
4901
+ t.value === "data" ? (A(), $("div", Cn, [
4875
4902
  d[25] || (d[25] = h("h3", { class: "szd-panel__heading" }, "Data Pipeline", -1)),
4876
- h("div", wn, [
4877
- (A(!0), $(W, null, ce(pe.value, (g, K) => (A(), $(W, {
4903
+ h("div", vn, [
4904
+ (A(!0), $(W, null, ce(me.value, (g, z) => (A(), $(W, {
4878
4905
  key: g.id
4879
4906
  }, [
4880
4907
  h("div", {
4881
4908
  class: "szd-pipeline__stage",
4882
- onClick: (H) => as(g)
4909
+ onClick: (H) => cs(g)
4883
4910
  }, [
4884
- h("div", vn, S(g.label), 1),
4885
- h("div", En, S(g.count), 1)
4886
- ], 8, Cn),
4887
- K < pe.value.length - 1 ? (A(), $("div", bn, "→")) : V("", !0)
4911
+ h("div", bn, S(g.label), 1),
4912
+ h("div", kn, S(g.count), 1)
4913
+ ], 8, En),
4914
+ z < me.value.length - 1 ? (A(), $("div", Sn, "→")) : V("", !0)
4888
4915
  ], 64))), 128))
4889
4916
  ]),
4890
- h("div", kn, [
4891
- h("div", Sn, [
4917
+ h("div", Tn, [
4918
+ h("div", Mn, [
4892
4919
  d[24] || (d[24] = h("h3", { class: "szd-panel__heading" }, "Instance Preview", -1)),
4893
- Ue(h("select", {
4920
+ Qe(h("select", {
4894
4921
  "onUpdate:modelValue": d[4] || (d[4] = (g) => m.value = g),
4895
4922
  class: "szd-select"
4896
4923
  }, [
@@ -4898,55 +4925,55 @@ const Er = (n, e) => {
4898
4925
  (A(!0), $(W, null, ce(Ye.value, (g) => (A(), $("option", {
4899
4926
  key: g,
4900
4927
  value: g
4901
- }, S(g), 9, Tn))), 128))
4928
+ }, S(g), 9, $n))), 128))
4902
4929
  ], 512), [
4903
- [At, m.value]
4930
+ [Ot, m.value]
4904
4931
  ])
4905
4932
  ]),
4906
- m.value != null ? (A(), $("div", Mn, [
4907
- (A(!0), $(W, null, ce(pe.value, (g) => (A(), $("div", {
4933
+ m.value != null ? (A(), $("div", An, [
4934
+ (A(!0), $(W, null, ce(me.value, (g) => (A(), $("div", {
4908
4935
  key: g.id,
4909
4936
  class: "szd-data-card"
4910
4937
  }, [
4911
- h("div", $n, [
4912
- Qe(S(g.label) + " ", 1),
4913
- g.pks.includes(m.value) ? (A(), $("span", An, "Present")) : (A(), $("span", On, "Absent"))
4938
+ h("div", On, [
4939
+ Ve(S(g.label) + " ", 1),
4940
+ g.pks.includes(m.value) ? (A(), $("span", Pn, "Present")) : (A(), $("span", Fn, "Absent"))
4914
4941
  ]),
4915
- h("pre", Pn, S(g.pks.includes(m.value) ? JSON.stringify(me(m.value), null, 2) : "—"), 1)
4942
+ h("pre", In, S(g.pks.includes(m.value) ? JSON.stringify(ye(m.value), null, 2) : "—"), 1)
4916
4943
  ]))), 128))
4917
- ])) : (A(), $("div", Fn, "Select an instance to preview"))
4944
+ ])) : (A(), $("div", Dn, "Select an instance to preview"))
4918
4945
  ])
4919
4946
  ])) : V("", !0),
4920
- t.value === "ast" ? (A(), $("div", Dn, [
4947
+ t.value === "ast" ? (A(), $("div", zn, [
4921
4948
  d[27] || (d[27] = h("h3", { class: "szd-panel__heading" }, "Query AST", -1)),
4922
- h("div", In, [
4923
- h("div", Kn, [
4949
+ h("div", Kn, [
4950
+ h("div", Rn, [
4924
4951
  d[26] || (d[26] = h("span", { class: "szd-kv__key" }, "Semantic Key:", -1)),
4925
- h("code", zn, S(k.value || "—"), 1)
4952
+ h("code", Nn, S(k.value || "—"), 1)
4926
4953
  ])
4927
4954
  ]),
4928
- h("pre", Rn, S(re.value ? JSON.stringify(re.value, null, 2) : "Select a queryset to view AST"), 1)
4955
+ h("pre", xn, S(re.value ? JSON.stringify(re.value, null, 2) : "Select a queryset to view AST"), 1)
4929
4956
  ])) : V("", !0)
4930
4957
  ]),
4931
- Tt(Ot, { name: "szd-slide" }, {
4932
- default: Pt(() => [
4933
- p.value ? (A(), $("div", Nn, [
4958
+ Mt(Pt, { name: "szd-slide" }, {
4959
+ default: Ft(() => [
4960
+ p.value ? (A(), $("div", jn, [
4934
4961
  h("div", {
4935
4962
  class: "szd-detail__backdrop",
4936
4963
  onClick: d[5] || (d[5] = (g) => p.value = !1)
4937
4964
  }),
4938
- h("div", xn, [
4939
- h("div", jn, [
4965
+ h("div", Un, [
4966
+ h("div", Qn, [
4940
4967
  d[28] || (d[28] = h("h3", { class: "szd-detail__title" }, "Debug Settings", -1)),
4941
4968
  h("button", {
4942
4969
  class: "szd-btn",
4943
4970
  onClick: d[6] || (d[6] = (g) => p.value = !1)
4944
4971
  }, "Close")
4945
4972
  ]),
4946
- h("div", Un, [
4947
- h("div", Qn, [
4973
+ h("div", Vn, [
4974
+ h("div", Ln, [
4948
4975
  d[30] || (d[30] = h("label", { class: "szd-settings-label" }, "Queryset", -1)),
4949
- Ue(h("select", {
4976
+ Qe(h("select", {
4950
4977
  "onUpdate:modelValue": d[7] || (d[7] = (g) => r.value = g),
4951
4978
  class: "szd-select szd-select--full"
4952
4979
  }, [
@@ -4954,69 +4981,69 @@ const Er = (n, e) => {
4954
4981
  (A(!0), $(W, null, ce(b.value, (g) => (A(), $("option", {
4955
4982
  key: g.semanticKey,
4956
4983
  value: g.semanticKey
4957
- }, S(g.modelName || "?") + " · " + S(g.semanticKey), 9, Vn))), 128))
4984
+ }, S(g.modelName || "?") + " · " + S(g.semanticKey), 9, Gn))), 128))
4958
4985
  ], 512), [
4959
- [At, r.value]
4986
+ [Ot, r.value]
4960
4987
  ])
4961
4988
  ]),
4962
- k.value ? (A(), $("div", Ln, [
4989
+ k.value ? (A(), $("div", Bn, [
4963
4990
  d[31] || (d[31] = h("label", { class: "szd-settings-label" }, "Semantic Key", -1)),
4964
- h("div", Gn, [
4965
- h("code", Bn, S(k.value), 1),
4991
+ h("div", Hn, [
4992
+ h("code", qn, S(k.value), 1),
4966
4993
  h("button", {
4967
4994
  class: "szd-btn szd-btn--sm",
4968
- onClick: os
4995
+ onClick: as
4969
4996
  }, "Copy")
4970
4997
  ])
4971
4998
  ])) : V("", !0),
4972
- h("div", Hn, [
4999
+ h("div", Jn, [
4973
5000
  d[32] || (d[32] = h("label", { class: "szd-settings-label" }, "Actions", -1)),
4974
- h("div", qn, [
5001
+ h("div", Wn, [
4975
5002
  h("button", {
4976
5003
  class: "szd-btn",
4977
- onClick: is,
5004
+ onClick: ls,
4978
5005
  disabled: !N.value || c.value
4979
- }, S(c.value ? "Syncing..." : "Sync Now"), 9, Jn),
5006
+ }, S(c.value ? "Syncing..." : "Sync Now"), 9, Zn),
4980
5007
  h("button", {
4981
5008
  class: "szd-btn",
4982
- onClick: ns
5009
+ onClick: is
4983
5010
  }, "Clear Events")
4984
5011
  ])
4985
5012
  ]),
4986
- h("div", Wn, [
5013
+ h("div", Yn, [
4987
5014
  d[34] || (d[34] = h("label", { class: "szd-settings-label" }, "Options", -1)),
4988
- h("label", Zn, [
4989
- Ue(h("input", {
5015
+ h("label", Xn, [
5016
+ Qe(h("input", {
4990
5017
  type: "checkbox",
4991
5018
  "onUpdate:modelValue": d[8] || (d[8] = (g) => i.value = g)
4992
5019
  }, null, 512), [
4993
- [$t, i.value]
5020
+ [At, i.value]
4994
5021
  ]),
4995
- d[33] || (d[33] = Qe(" Live updates ", -1))
5022
+ d[33] || (d[33] = Ve(" Live updates ", -1))
4996
5023
  ])
4997
5024
  ]),
4998
- k.value ? (A(), $("div", Yn, [
5025
+ k.value ? (A(), $("div", eo, [
4999
5026
  d[40] || (d[40] = h("label", { class: "szd-settings-label" }, "Current State", -1)),
5000
- h("div", Xn, [
5001
- h("div", eo, [
5027
+ h("div", to, [
5028
+ h("div", so, [
5002
5029
  d[35] || (d[35] = h("span", { class: "szd-kv__key" }, "Model:", -1)),
5003
- h("span", to, S(F.value.modelName || "—"), 1)
5030
+ h("span", ro, S(F.value.modelName || "—"), 1)
5004
5031
  ]),
5005
- h("div", so, [
5032
+ h("div", no, [
5006
5033
  d[36] || (d[36] = h("span", { class: "szd-kv__key" }, "Source:", -1)),
5007
- h("span", ro, S(F.value.source), 1)
5034
+ h("span", oo, S(F.value.source), 1)
5008
5035
  ]),
5009
- h("div", no, [
5036
+ h("div", io, [
5010
5037
  d[37] || (d[37] = h("span", { class: "szd-kv__key" }, "Syncing:", -1)),
5011
- h("span", oo, S(F.value.isSyncing ? "Yes" : "No"), 1)
5038
+ h("span", ao, S(F.value.isSyncing ? "Yes" : "No"), 1)
5012
5039
  ]),
5013
- h("div", io, [
5040
+ h("div", lo, [
5014
5041
  d[38] || (d[38] = h("span", { class: "szd-kv__key" }, "Operations:", -1)),
5015
- h("span", ao, S(F.value.opsCount), 1)
5042
+ h("span", co, S(F.value.opsCount), 1)
5016
5043
  ]),
5017
- h("div", lo, [
5044
+ h("div", uo, [
5018
5045
  d[39] || (d[39] = h("span", { class: "szd-kv__key" }, "Last Sync:", -1)),
5019
- h("span", co, S(F.value.lastSync), 1)
5046
+ h("span", ho, S(F.value.lastSync), 1)
5020
5047
  ])
5021
5048
  ])
5022
5049
  ])) : V("", !0)
@@ -5026,50 +5053,50 @@ const Er = (n, e) => {
5026
5053
  ]),
5027
5054
  _: 1
5028
5055
  }),
5029
- Tt(Ot, { name: "szd-slide" }, {
5030
- default: Pt(() => [
5031
- f.value ? (A(), $("div", uo, [
5056
+ Mt(Pt, { name: "szd-slide" }, {
5057
+ default: Ft(() => [
5058
+ f.value ? (A(), $("div", fo, [
5032
5059
  h("div", {
5033
5060
  class: "szd-detail__backdrop",
5034
- onClick: kt
5061
+ onClick: St
5035
5062
  }),
5036
- h("div", ho, [
5037
- h("div", fo, [
5038
- h("h3", po, S(f.value.type === "entry" ? "Event Detail" : "Snapshot: " + f.value.data.label), 1),
5063
+ h("div", po, [
5064
+ h("div", mo, [
5065
+ h("h3", yo, S(f.value.type === "entry" ? "Event Detail" : "Snapshot: " + f.value.data.label), 1),
5039
5066
  h("button", {
5040
5067
  class: "szd-btn",
5041
- onClick: kt
5068
+ onClick: St
5042
5069
  }, "Close")
5043
5070
  ]),
5044
- h("div", mo, [
5071
+ h("div", go, [
5045
5072
  f.value.type === "entry" ? (A(), $(W, { key: 0 }, [
5046
- h("div", yo, [
5047
- (A(!0), $(W, null, ce(rs(f.value.data), (g, K) => (A(), $("div", {
5048
- key: K,
5073
+ h("div", _o, [
5074
+ (A(!0), $(W, null, ce(os(f.value.data), (g, z) => (A(), $("div", {
5075
+ key: z,
5049
5076
  class: "szd-kv__row"
5050
5077
  }, [
5051
- h("span", go, S(K) + ":", 1),
5052
- h("span", _o, S(g ?? "—"), 1)
5078
+ h("span", wo, S(z) + ":", 1),
5079
+ h("span", Co, S(g ?? "—"), 1)
5053
5080
  ]))), 128))
5054
5081
  ]),
5055
5082
  d[41] || (d[41] = h("h4", { style: { margin: "16px 0 8px" } }, "Raw JSON", -1)),
5056
- h("pre", wo, S(JSON.stringify(f.value.data, null, 2)), 1)
5083
+ h("pre", vo, S(JSON.stringify(f.value.data, null, 2)), 1)
5057
5084
  ], 64)) : (A(), $(W, { key: 1 }, [
5058
- h("div", Co, [
5059
- h("div", vo, [
5085
+ h("div", Eo, [
5086
+ h("div", bo, [
5060
5087
  d[42] || (d[42] = h("span", { class: "szd-kv__key" }, "Total Count:", -1)),
5061
- h("span", Eo, S(f.value.data.count), 1)
5088
+ h("span", ko, S(f.value.data.count), 1)
5062
5089
  ]),
5063
- h("div", bo, [
5090
+ h("div", So, [
5064
5091
  d[43] || (d[43] = h("span", { class: "szd-kv__key" }, "Showing:", -1)),
5065
- h("span", ko, [
5066
- Qe(S(Ke.value.length) + " items ", 1),
5067
- Xe.value ? (A(), $("span", So, "(limited to first 100)")) : V("", !0)
5092
+ h("span", To, [
5093
+ Ve(S(Ke.value.length) + " items ", 1),
5094
+ Xe.value ? (A(), $("span", Mo, "(limited to first 100)")) : V("", !0)
5068
5095
  ])
5069
5096
  ])
5070
5097
  ]),
5071
5098
  d[44] || (d[44] = h("h4", { style: { margin: "0 0 8px" } }, "Data", -1)),
5072
- h("pre", To, S(JSON.stringify(Ke.value, null, 2)), 1)
5099
+ h("pre", $o, S(JSON.stringify(Ke.value, null, 2)), 1)
5073
5100
  ], 64))
5074
5101
  ])
5075
5102
  ])
@@ -5079,7 +5106,7 @@ const Er = (n, e) => {
5079
5106
  })
5080
5107
  ]));
5081
5108
  }
5082
- }, Lo = /* @__PURE__ */ Er(Mo, [["__scopeId", "data-v-6d80920c"]]);
5109
+ }, Bo = /* @__PURE__ */ kr(Ao, [["__scopeId", "data-v-6d80920c"]]);
5083
5110
  export {
5084
- Lo as default
5111
+ Bo as default
5085
5112
  };