@superbright/indexeddb-orm 0.1.2 → 0.1.4

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.
package/dist/index.mjs CHANGED
@@ -1,63 +1,216 @@
1
1
  import { z as n } from "zod";
2
- import _ from "dexie";
3
- class x extends Error {
2
+ import nt from "dexie";
3
+ class it extends Error {
4
4
  constructor(t, e) {
5
5
  super(t), this.detail = e, this.name = "SchemaMismatchError";
6
6
  }
7
7
  }
8
- class B extends Error {
8
+ class st extends Error {
9
9
  constructor(t, e) {
10
10
  super(t), this.detail = e, this.name = "OpenDBError";
11
11
  }
12
12
  }
13
- class C extends _ {
13
+ const I = 1, m = n.object({
14
+ uuid: n.string().uuid(),
15
+ // stored as ISO string; include to match ensureUser()
16
+ createdAt: n.string().datetime().optional()
17
+ }), ot = n.object({
18
+ isFavorite: n.boolean().optional(),
19
+ viewedDate: n.string().optional()
20
+ }), lt = ot, R = n.union([
21
+ n.string(),
22
+ n.number(),
23
+ n.boolean(),
24
+ n.record(n.unknown())
25
+ ]), ut = n.union([
26
+ R,
27
+ n.array(R)
28
+ ]), A = n.object({
29
+ availability: ut.nullable().optional(),
30
+ bedrooms: n.union([n.array(R), n.null()]).optional(),
31
+ cost: n.number().nullable().optional(),
32
+ highlights: n.array(R).optional()
33
+ }), G = n.object({
34
+ limit: n.number().default(10),
35
+ page: n.number().default(1),
36
+ availability: n.array(n.string()).optional(),
37
+ bedrooms: n.array(n.number()).optional(),
38
+ cost: n.number().nullable().optional(),
39
+ highlights: n.array(n.string()).optional()
40
+ }), K = n.enum(["all", "bestFit", "closestMatch", "favorites", "loading"]), Z = n.enum(["relevance", "newest", "priceLowToHigh", "priceHighToLow"]), Tt = n.object({
41
+ data: n.record(lt),
42
+ filters: A,
43
+ tempFilters: A,
44
+ apiFilters: G,
45
+ resultsMode: K,
46
+ propertySlug: n.string().nullable(),
47
+ resolvedQuestionnaireValues: n.record(n.array(n.string())),
48
+ sortBy: Z
49
+ }), b = n.object({
50
+ id: n.union([n.number().int(), n.string()]).optional(),
51
+ title: n.string(),
52
+ slug: n.string().nullable().optional(),
53
+ bedrooms: n.coerce.number().nullable().optional(),
54
+ bathrooms: n.coerce.number().nullable().optional(),
55
+ cost: n.coerce.number().nullable().optional(),
56
+ totalSqFt: n.coerce.number().nullable().optional(),
57
+ propertyId: n.union([n.number().int(), n.string()]).optional(),
58
+ isAvailable: n.boolean().optional(),
59
+ createdAt: n.string().datetime().optional(),
60
+ updatedAt: n.string().datetime().optional(),
61
+ availability: n.string().datetime().nullable().optional(),
62
+ unitSetAvailableOn: n.string().datetime().nullable().optional(),
63
+ floorPlanId: n.union([n.number().int(), n.string()]).nullable().optional(),
64
+ // Relations and nested structures kept loose to avoid coupling
65
+ property: n.unknown().optional(),
66
+ amenities: n.array(n.unknown()).optional(),
67
+ highlights: n.array(n.unknown()).optional(),
68
+ floorPlan: n.unknown().nullable().optional(),
69
+ renderedStyle: n.array(n.unknown()).optional(),
70
+ video: n.unknown().nullable().optional(),
71
+ videoThumbnail: n.unknown().nullable().optional(),
72
+ embedGif: n.unknown().nullable().optional(),
73
+ userId: n.union([n.number().int(), n.string()]).optional(),
74
+ user: n.unknown().optional(),
75
+ status: n.string().optional(),
76
+ externalId: n.string().nullable().optional(),
77
+ unitRenderedStyles: n.array(n.unknown()).optional()
78
+ }), v = n.object({
79
+ id: n.union([n.number().int(), n.string()]),
80
+ createdAt: n.string().datetime(),
81
+ updatedAt: n.string().datetime(),
82
+ title: n.string(),
83
+ slug: n.string().nullable().optional(),
84
+ description: n.string(),
85
+ contactName: n.string().nullable().optional(),
86
+ contactEmail: n.string().optional(),
87
+ contactPhone: n.string().nullable().optional(),
88
+ notificationEmail: n.string().nullable().optional(),
89
+ logo: n.unknown().nullable().optional(),
90
+ leadMedia: n.unknown().nullable().optional(),
91
+ overviewImages: n.array(n.unknown()).optional(),
92
+ amenityImages: n.array(n.unknown()).optional(),
93
+ street: n.string().optional(),
94
+ city: n.string().optional(),
95
+ state: n.string().nullable().optional(),
96
+ ingestionFileName: n.string().nullable().optional(),
97
+ zip: n.string().optional(),
98
+ country: n.string().optional(),
99
+ units: n.array(b).optional(),
100
+ amenities: n.array(n.unknown()).optional(),
101
+ highlights: n.array(n.unknown()).optional(),
102
+ externalServices: n.array(n.unknown()).optional(),
103
+ userId: n.union([n.number().int(), n.string()]).optional(),
104
+ user: n.unknown().optional(),
105
+ status: n.string().optional(),
106
+ floorPlans: n.array(n.unknown()).optional()
107
+ }), Mt = n.object({
108
+ id: n.union([n.number().int(), n.string()]).optional(),
109
+ email: n.string().email().optional(),
110
+ firstName: n.string().optional(),
111
+ lastName: n.string().optional(),
112
+ password: n.string().optional(),
113
+ salt: n.string().optional(),
114
+ role: n.string().optional(),
115
+ Property: n.array(v).optional(),
116
+ Unit: n.array(b).optional(),
117
+ floorPlans: n.array(n.unknown()).optional(),
118
+ createdAt: n.string().datetime().optional(),
119
+ updatedAt: n.string().datetime().optional()
120
+ }), ct = n.object({
121
+ unitId: n.string(),
122
+ viewedDate: n.string()
123
+ }), dt = n.object({
124
+ timezone: n.string().optional(),
125
+ favouriteUnits: n.array(n.coerce.string()).optional(),
126
+ preferences: n.record(n.unknown()).optional()
127
+ }), C = n.object({
128
+ id: n.coerce.string(),
129
+ slug: n.string(),
130
+ favoritedUnits: n.array(n.string()),
131
+ tourContactedOn: n.string().nullable(),
132
+ viewedUnits: n.array(ct),
133
+ questionnaireResults: n.unknown().nullable().optional(),
134
+ tourContactData: dt.nullable().optional(),
135
+ // Full property payload persisted alongside per-property state
136
+ data: v.optional()
137
+ }), O = n.object({
138
+ data: n.record(C),
139
+ propertySlug: n.string().nullable(),
140
+ propertyId: n.string().nullable(),
141
+ hasPreviouslySearched: n.array(n.string())
142
+ }), Et = n.object({
143
+ id: n.number().int(),
144
+ userId: n.number().int(),
145
+ unitId: n.number().int(),
146
+ createdAt: n.string().datetime()
147
+ }), N = n.object({
148
+ // per-property favorites are stored under a KV key, so propertyId is implicit
149
+ unitIds: n.array(n.string()),
150
+ updatedAt: n.string().datetime()
151
+ }), T = n.object({
152
+ // Property-related data
153
+ properties: n.record(C),
154
+ currentPropertyId: n.string().nullable(),
155
+ currentPropertySlug: n.string().nullable(),
156
+ hasPreviouslySearched: n.array(n.string()),
157
+ // App-level data
158
+ unitResults: n.array(b),
159
+ filters: A,
160
+ tempFilters: A,
161
+ apiFilters: G,
162
+ resultsMode: K,
163
+ resolvedQuestionnaireValues: n.record(n.array(n.string())),
164
+ sortBy: Z
165
+ });
166
+ class x extends nt {
14
167
  constructor(t = "inresi-orm") {
15
- super(t), this.version(b).stores({
168
+ super(t), this.version(I).stores({
16
169
  users: "uuid",
17
170
  kv: "key"
18
171
  }), this.users = this.table("users"), this.kv = this.table("kv");
19
172
  }
20
173
  }
21
- let k = "strict", v;
22
- function H(a) {
23
- a.mode && (k = a.mode), v = a.onIssue;
174
+ let _ = "strict", D;
175
+ function pt(r) {
176
+ r.mode && (_ = r.mode), D = r.onIssue;
24
177
  }
25
- function P(a, t, e) {
26
- const r = a.safeParse(t);
27
- if (r.success) return r.data;
28
- const s = r.error.flatten();
29
- if (v == null || v(e, s), k === "strict")
30
- throw new x(`ORM schema mismatch in ${e}`, s);
31
- return k === "warn" && console.warn(`ORM schema mismatch in ${e}`, s), null;
178
+ function h(r, t, e) {
179
+ const a = r.safeParse(t);
180
+ if (a.success) return a.data;
181
+ const s = a.error.flatten();
182
+ if (D == null || D(e, s), _ === "strict")
183
+ throw new it(`ORM schema mismatch in ${e}`, s);
184
+ return _ === "warn" && console.warn(`ORM schema mismatch in ${e}`, s), null;
32
185
  }
33
- const N = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, F = "manifest", z = n.object({ schemaVersion: n.number().int() });
34
- let h = null, S = null;
35
- const A = Symbol("validationInstalled");
36
- function D(a, t) {
37
- const e = a;
38
- if (e[A]) return;
39
- if (e[A] = !0, ((i, o, l) => {
40
- i.hook("creating", (u, y) => {
41
- const p = P(o, y, `${l}.creating`);
42
- if (!p) throw new Error(`Rejected invalid ${l} on create`);
43
- return p;
44
- }), i.hook("updating", (u, y, p) => {
45
- const d = { ...p, ...u };
46
- return P(o, d, `${l}.updating`) ? u : {};
186
+ const yt = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, M = "manifest", gt = n.object({ schemaVersion: n.number().int() });
187
+ let w = null, S = null;
188
+ const q = Symbol("validationInstalled");
189
+ function E(r, t) {
190
+ const e = r;
191
+ if (e[q]) return;
192
+ if (e[q] = !0, ((i, o, l) => {
193
+ i.hook("creating", (u, d) => {
194
+ const y = h(o, d, `${l}.creating`);
195
+ if (!y) throw new Error(`Rejected invalid ${l} on create`);
196
+ return y;
197
+ }), i.hook("updating", (u, d, y) => {
198
+ const p = { ...y, ...u };
199
+ return h(o, p, `${l}.updating`) ? u : {};
47
200
  });
48
- })(a.users, f, "users"), (t == null ? void 0 : t.validateReads) ?? !0) {
201
+ })(r.users, m, "users"), (t == null ? void 0 : t.validateReads) ?? !0) {
49
202
  const i = (t == null ? void 0 : t.dropInvalidOnRead) ?? !0;
50
- ((l, u, y) => {
51
- l.hook("reading", (p) => {
52
- const d = P(u, p, `${y}.reading`);
53
- return d || (i ? void 0 : p);
203
+ ((l, u, d) => {
204
+ l.hook("reading", (y) => {
205
+ const p = h(u, y, `${d}.reading`);
206
+ return p || (i ? void 0 : y);
54
207
  });
55
- })(a.users, f, "users");
208
+ })(r.users, m, "users");
56
209
  }
57
210
  }
58
- function q() {
211
+ function ft() {
59
212
  try {
60
- if (typeof import.meta < "u" && N)
213
+ if (typeof import.meta < "u" && yt)
61
214
  return !1;
62
215
  } catch {
63
216
  }
@@ -68,102 +221,160 @@ function q() {
68
221
  }
69
222
  return !1;
70
223
  }
71
- async function w(a = {}) {
72
- if (h) return h;
224
+ async function f(r = {}) {
225
+ if (w) return w;
73
226
  if (S) return S;
74
- const t = a.dbName ?? "inresi-orm";
227
+ const t = r.dbName ?? "inresi-orm";
75
228
  return S = (async () => {
76
- var e, r, s, i;
229
+ var e, a, s, i;
77
230
  try {
78
- const o = q() ? "warn" : "strict";
79
- H({
80
- mode: ((e = a.validation) == null ? void 0 : e.mode) ?? o,
81
- onIssue: (r = a.validation) == null ? void 0 : r.onIssue
231
+ const o = ft() ? "warn" : "strict";
232
+ pt({
233
+ mode: ((e = r.validation) == null ? void 0 : e.mode) ?? o,
234
+ onIssue: (a = r.validation) == null ? void 0 : a.onIssue
82
235
  });
83
- const l = new C(t);
236
+ const l = new x(t);
84
237
  l.on("versionchange", () => {
85
- var d;
238
+ var p;
86
239
  try {
87
240
  l.close();
88
241
  } finally {
89
- (d = a.onReset) == null || d.call(a, "versionchange");
242
+ (p = r.onReset) == null || p.call(r, "versionchange");
90
243
  }
91
244
  }), l.on("blocked", () => {
92
- var d;
93
- (d = a.onReset) == null || d.call(a, "blocked");
245
+ var p;
246
+ (p = r.onReset) == null || p.call(r, "blocked");
94
247
  }), await l.open();
95
- const u = await l.kv.get(F), y = (u == null ? void 0 : u.value) ?? null;
96
- if (!y)
248
+ const u = await l.kv.get(M), d = (u == null ? void 0 : u.value) ?? null;
249
+ if (!d)
97
250
  return await l.transaction("rw", l.kv, async () => {
98
251
  await l.kv.put({
99
- key: F,
100
- value: { schemaVersion: b }
252
+ key: M,
253
+ value: { schemaVersion: I }
101
254
  });
102
- }), D(l, a.validation), h = l, l;
103
- const p = z.safeParse(y);
104
- if (!p.success || p.data.schemaVersion !== b) {
255
+ }), E(l, r.validation), w = l, l;
256
+ const y = gt.safeParse(d);
257
+ if (!y.success || y.data.schemaVersion !== I) {
105
258
  await l.delete();
106
- const d = new C(t);
107
- return d.on("versionchange", () => {
259
+ const p = new x(t);
260
+ return p.on("versionchange", () => {
108
261
  var g;
109
262
  try {
110
- d.close();
263
+ p.close();
111
264
  } finally {
112
- (g = a.onReset) == null || g.call(a, "versionchange");
265
+ (g = r.onReset) == null || g.call(r, "versionchange");
113
266
  }
114
- }), d.on("blocked", () => {
267
+ }), p.on("blocked", () => {
115
268
  var g;
116
- (g = a.onReset) == null || g.call(a, "blocked");
117
- }), await d.open(), await d.kv.put({
118
- key: F,
119
- value: { schemaVersion: b }
120
- }), D(d, a.validation), (s = a.onReset) == null || s.call(a, "incompatible"), h = d, d;
269
+ (g = r.onReset) == null || g.call(r, "blocked");
270
+ }), await p.open(), await p.kv.put({
271
+ key: M,
272
+ value: { schemaVersion: I }
273
+ }), E(p, r.validation), (s = r.onReset) == null || s.call(r, "incompatible"), w = p, p;
121
274
  }
122
- return D(l, a.validation), h = l, l;
275
+ return E(l, r.validation), w = l, l;
123
276
  } catch (o) {
124
- throw (i = a.onError) == null || i.call(a, o), new B("Failed to open IndexedDB", o);
277
+ throw (i = r.onError) == null || i.call(r, o), new st("Failed to open IndexedDB", o);
125
278
  } finally {
126
279
  S = null;
127
280
  }
128
281
  })(), S;
129
282
  }
130
- async function pt(a) {
131
- const t = a ?? "inresi-orm";
132
- if (h)
283
+ async function Vt(r) {
284
+ const t = r ?? "inresi-orm";
285
+ if (w)
133
286
  try {
134
- await h.close();
287
+ await w.close();
135
288
  } catch {
136
289
  }
137
- await new C(t).delete(), h = null;
290
+ await new x(t).delete(), w = null;
138
291
  }
139
- async function j(a) {
140
- const e = await (await w()).kv.get(a);
292
+ const P = "user", ht = () => {
293
+ var r;
294
+ return typeof ((r = globalThis.crypto) == null ? void 0 : r.randomUUID) == "function" ? globalThis.crypto.randomUUID() : (() => {
295
+ var a, s;
296
+ const t = ((s = (a = globalThis.crypto) == null ? void 0 : a.getRandomValues) == null ? void 0 : s.call(a, new Uint8Array(16))) ?? Uint8Array.from({ length: 16 }, () => Math.random() * 256 | 0);
297
+ t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
298
+ const e = [...t].map((i) => i.toString(16).padStart(2, "0")).join("");
299
+ return `${e.slice(0, 8)}-${e.slice(8, 12)}-${e.slice(12, 16)}-${e.slice(16, 20)}-${e.slice(20)}`;
300
+ })();
301
+ }, V = (r) => {
302
+ var t, e;
303
+ return ((t = r == null ? void 0 : r.value) == null ? void 0 : t.useruuid) ?? ((e = r == null ? void 0 : r.value) == null ? void 0 : e.uuid);
304
+ };
305
+ async function z(r = ht) {
306
+ const t = await f(), e = V(await t.kv.get(P));
307
+ if (e) {
308
+ const a = await t.users.get(e);
309
+ if (a) return m.parse(a);
310
+ }
311
+ try {
312
+ return await t.transaction("rw", t.kv, t.users, async () => {
313
+ const a = V(await t.kv.get(P));
314
+ if (a) {
315
+ const o = await t.users.get(a);
316
+ if (o) return m.parse(o);
317
+ }
318
+ const s = r();
319
+ await t.kv.add({ key: P, value: { useruuid: s } });
320
+ const i = m.parse({
321
+ uuid: s,
322
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
323
+ });
324
+ return await t.users.add(i), i;
325
+ });
326
+ } catch (a) {
327
+ if ((a == null ? void 0 : a.name) === "ConstraintError") {
328
+ const s = V(await t.kv.get(P));
329
+ if (s) {
330
+ const i = await t.users.get(s);
331
+ if (i) return m.parse(i);
332
+ }
333
+ }
334
+ throw a;
335
+ }
336
+ }
337
+ const $t = async (r) => (await z(r)).uuid;
338
+ async function wt() {
339
+ const r = await f(), t = {};
340
+ for (const e of r.tables)
341
+ t[e.name] = await e.toArray();
342
+ return t;
343
+ }
344
+ async function jt(r = "inresi-orm-export.json") {
345
+ if (typeof window > "u" || typeof document > "u")
346
+ throw new Error("exportJSON can only run in a browser.");
347
+ const t = await wt(), e = new Blob([JSON.stringify(t, null, 2)], { type: "application/json" }), a = document.createElement("a");
348
+ a.href = URL.createObjectURL(e), a.download = r, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(a.href);
349
+ }
350
+ async function W(r) {
351
+ const e = await (await f()).kv.get(r);
141
352
  return (e == null ? void 0 : e.value) ?? null;
142
353
  }
143
- async function E(a, t) {
144
- await (await w()).kv.put({ key: a, value: t });
354
+ async function Y(r, t) {
355
+ await (await f()).kv.put({ key: r, value: t });
145
356
  }
146
- async function wt(a) {
147
- await (await w()).kv.delete(a);
357
+ async function Nt(r) {
358
+ await (await f()).kv.delete(r);
148
359
  }
149
- function ht(a) {
150
- const t = /* @__PURE__ */ new Map(), e = (a == null ? void 0 : a.prefix) ?? "", r = (s) => `${e}${s}`;
360
+ function xt(r) {
361
+ const t = /* @__PURE__ */ new Map(), e = (r == null ? void 0 : r.prefix) ?? "", a = (s) => `${e}${s}`;
151
362
  return {
152
363
  async getItem(s) {
153
364
  try {
154
- const o = await (await w()).kv.get(r(s));
365
+ const o = await (await f()).kv.get(a(s));
155
366
  return o ? JSON.stringify(o.value) : null;
156
367
  } catch (i) {
157
- if (a != null && a.fallbackToMemory) return t.get(r(s)) ?? null;
368
+ if (r != null && r.fallbackToMemory) return t.get(a(s)) ?? null;
158
369
  throw i;
159
370
  }
160
371
  },
161
372
  async setItem(s, i) {
162
373
  try {
163
- await (await w()).kv.put({ key: r(s), value: JSON.parse(i) });
374
+ await (await f()).kv.put({ key: a(s), value: JSON.parse(i) });
164
375
  } catch (o) {
165
- if (a != null && a.fallbackToMemory) {
166
- t.set(r(s), i);
376
+ if (r != null && r.fallbackToMemory) {
377
+ t.set(a(s), i);
167
378
  return;
168
379
  }
169
380
  throw o;
@@ -171,10 +382,10 @@ function ht(a) {
171
382
  },
172
383
  async removeItem(s) {
173
384
  try {
174
- await (await w()).kv.delete(r(s));
385
+ await (await f()).kv.delete(a(s));
175
386
  } catch (i) {
176
- if (a != null && a.fallbackToMemory) {
177
- t.delete(r(s));
387
+ if (r != null && r.fallbackToMemory) {
388
+ t.delete(a(s));
178
389
  return;
179
390
  }
180
391
  throw i;
@@ -182,40 +393,60 @@ function ht(a) {
182
393
  }
183
394
  };
184
395
  }
185
- const J = n.object({
186
- unitId: n.string(),
187
- viewedDate: n.string()
188
- }), K = n.object({
189
- timezone: n.string(),
190
- favouriteUnits: n.array(n.string()).optional(),
191
- preferences: n.record(n.unknown())
192
- }), G = n.object({
193
- id: n.string(),
194
- slug: n.string(),
195
- favoritedUnits: n.array(n.string()),
196
- tourContactedOn: n.string().nullable(),
197
- viewedUnits: n.array(J),
198
- questionnaireResults: n.unknown().nullable().optional(),
199
- // Generic for IFilters
200
- tourContactData: K.nullable().optional()
201
- }), gt = n.object({
202
- data: n.record(G),
203
- propertySlug: n.string().nullable(),
204
- propertyId: n.string().nullable(),
205
- hasPreviouslySearched: n.array(n.string())
206
- }), Y = {
396
+ const X = (r, t) => `favorites:${r}:${t}`;
397
+ async function Q(r) {
398
+ const t = await f(), { uuid: e } = await z(), a = X(e, String(r)), s = await t.kv.get(a), i = s ? N.safeParse(s.value) : null;
399
+ return i != null && i.success ? i.data.unitIds : [];
400
+ }
401
+ async function tt(r, t, e) {
402
+ const a = await f(), { uuid: s } = await z(), i = X(s, String(r));
403
+ return a.transaction("rw", a.kv, async () => {
404
+ const o = await a.kv.get(i), l = o && N.safeParse(o.value).success ? o.value : { unitIds: [], updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, u = new Set(l.unitIds);
405
+ e ? u.add(t) : u.delete(t);
406
+ const d = {
407
+ unitIds: [...u],
408
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
409
+ }, y = N.parse(d);
410
+ return await a.kv.put({ key: i, value: y }), y.unitIds;
411
+ });
412
+ }
413
+ async function mt(r, t) {
414
+ const a = !(await Q(r)).includes(t);
415
+ return tt(r, t, a);
416
+ }
417
+ async function St(r, t) {
418
+ return (await Q(r)).includes(t);
419
+ }
420
+ const $ = {
207
421
  data: {},
208
422
  propertySlug: null,
209
423
  propertyId: null,
210
424
  hasPreviouslySearched: []
211
425
  };
212
- class Z {
426
+ class vt {
213
427
  async getState() {
214
- return await j("property") ?? Y;
428
+ const t = await W("property");
429
+ if (!t) return $;
430
+ const e = {
431
+ ...t,
432
+ propertyId: t.propertyId == null ? null : String(t.propertyId),
433
+ propertySlug: t.propertySlug ?? null,
434
+ hasPreviouslySearched: Array.isArray(t.hasPreviouslySearched) ? t.hasPreviouslySearched.map(String) : []
435
+ }, a = O.safeParse(e);
436
+ if (a.success) return a.data;
437
+ const s = Object.entries(e.data ?? {}).reduce((l, [u, d]) => {
438
+ const y = C.safeParse(d);
439
+ return y.success && (l[u] = y.data), l;
440
+ }, {}), i = {
441
+ ...$,
442
+ ...e,
443
+ data: s
444
+ }, o = O.safeParse(i);
445
+ return o.success ? o.data : $;
215
446
  }
216
447
  async setState(t) {
217
- const e = await this.getState(), r = t(e);
218
- await E("property", r);
448
+ const e = await this.getState(), a = t(e), s = O.parse(a);
449
+ await Y("property", s);
219
450
  }
220
451
  // Basic state operations
221
452
  async setData(t) {
@@ -225,12 +456,13 @@ class Z {
225
456
  await this.setState((e) => ({ ...e, propertySlug: t }));
226
457
  }
227
458
  async setPropertyId(t) {
228
- await this.setState((e) => ({ ...e, propertyId: t }));
459
+ await this.setState((e) => ({ ...e, propertyId: String(t) }));
229
460
  }
230
461
  async removeData(t) {
231
- await this.setState((e) => ({
232
- ...e,
233
- data: Object.entries(e.data).filter(([r]) => r !== t).reduce((r, [s, i]) => ({ ...r, [s]: i }), {})
462
+ const e = String(t);
463
+ await this.setState((a) => ({
464
+ ...a,
465
+ data: Object.entries(a.data).filter(([s]) => s !== e).reduce((s, [i, o]) => ({ ...s, [i]: o }), {})
234
466
  }));
235
467
  }
236
468
  async clearData() {
@@ -249,13 +481,13 @@ class Z {
249
481
  await this.setState((t) => {
250
482
  const e = t.propertyId;
251
483
  if (!e) return t;
252
- const r = t.data[e];
253
- return r ? {
484
+ const a = t.data[e];
485
+ return a ? {
254
486
  ...t,
255
487
  data: {
256
488
  ...t.data,
257
489
  [e]: {
258
- ...r,
490
+ ...a,
259
491
  tourContactedOn: (/* @__PURE__ */ new Date()).toISOString()
260
492
  }
261
493
  }
@@ -263,20 +495,20 @@ class Z {
263
495
  });
264
496
  }
265
497
  async getTourContactedOn() {
266
- var r;
498
+ var a;
267
499
  const t = await this.getState(), e = t.propertyId;
268
- return e ? ((r = t.data[e]) == null ? void 0 : r.tourContactedOn) ?? null : null;
500
+ return e ? ((a = t.data[e]) == null ? void 0 : a.tourContactedOn) ?? null : null;
269
501
  }
270
502
  async setQuestionnaireResults(t) {
271
503
  await this.setState((e) => {
272
- const r = e.propertyId;
273
- if (!r) return e;
274
- const s = e.data[r];
504
+ const a = e.propertyId;
505
+ if (!a) return e;
506
+ const s = e.data[a];
275
507
  return s ? {
276
508
  ...e,
277
509
  data: {
278
510
  ...e.data,
279
- [r]: {
511
+ [a]: {
280
512
  ...s,
281
513
  questionnaireResults: t
282
514
  }
@@ -286,14 +518,14 @@ class Z {
286
518
  }
287
519
  async setTourContactData(t) {
288
520
  await this.setState((e) => {
289
- const r = e.propertyId;
290
- if (!r) return e;
291
- const s = e.data[r];
521
+ const a = e.propertyId;
522
+ if (!a) return e;
523
+ const s = e.data[a];
292
524
  return s ? {
293
525
  ...e,
294
526
  data: {
295
527
  ...e.data,
296
- [r]: {
528
+ [a]: {
297
529
  ...s,
298
530
  tourContactData: t
299
531
  }
@@ -303,16 +535,16 @@ class Z {
303
535
  }
304
536
  async toggleFavorite(t) {
305
537
  await this.setState((e) => {
306
- const r = e.propertyId;
307
- if (!r) return e;
308
- const s = e.data[r];
538
+ const a = e.propertyId;
539
+ if (!a) return e;
540
+ const s = e.data[a];
309
541
  if (!s) return e;
310
542
  const o = s.favoritedUnits.includes(t) ? s.favoritedUnits.filter((l) => l !== t) : [...s.favoritedUnits, t];
311
543
  return {
312
544
  ...e,
313
545
  data: {
314
546
  ...e.data,
315
- [r]: {
547
+ [a]: {
316
548
  ...s,
317
549
  favoritedUnits: o
318
550
  }
@@ -321,10 +553,10 @@ class Z {
321
553
  });
322
554
  }
323
555
  async markUnitAsViewed(t, e) {
324
- const r = /* @__PURE__ */ new Date(), s = `${String(r.getMonth() + 1).padStart(
556
+ const a = /* @__PURE__ */ new Date(), s = `${String(a.getMonth() + 1).padStart(
325
557
  2,
326
558
  "0"
327
- )}/${String(r.getDate()).padStart(2, "0")}`;
559
+ )}/${String(a.getDate()).padStart(2, "0")}`;
328
560
  await this.setState((i) => {
329
561
  const o = i.propertyId;
330
562
  if (!o) return i;
@@ -332,7 +564,7 @@ class Z {
332
564
  if (!l) return i;
333
565
  const u = [
334
566
  // Remove existing entry if it exists
335
- ...l.viewedUnits.filter((y) => y.unitId !== t),
567
+ ...l.viewedUnits.filter((d) => d.unitId !== t),
336
568
  // Add updated one
337
569
  {
338
570
  unitId: t,
@@ -354,15 +586,15 @@ class Z {
354
586
  // Utility methods for getting specific data
355
587
  async getUnitState(t) {
356
588
  var s;
357
- const e = await this.getState(), r = e.propertyId ? e.data[e.propertyId] : null;
589
+ const e = await this.getState(), a = e.propertyId ? e.data[e.propertyId] : null;
358
590
  return {
359
- isFavorite: (r == null ? void 0 : r.favoritedUnits.includes(t)) ?? !1,
360
- viewedDate: ((s = r == null ? void 0 : r.viewedUnits.find((i) => i.unitId === t)) == null ? void 0 : s.viewedDate) ?? ""
591
+ isFavorite: (a == null ? void 0 : a.favoritedUnits.includes(t)) ?? !1,
592
+ viewedDate: ((s = a == null ? void 0 : a.viewedUnits.find((i) => i.unitId === t)) == null ? void 0 : s.viewedDate) ?? ""
361
593
  };
362
594
  }
363
595
  async getPropertyData(t) {
364
- const e = await this.getState(), r = t ?? e.propertyId;
365
- return r ? e.data[r] ?? null : null;
596
+ const e = await this.getState(), a = t == null ? e.propertyId : String(t);
597
+ return a ? e.data[a] ?? null : null;
366
598
  }
367
599
  async getCurrentProperty() {
368
600
  const t = await this.getState();
@@ -373,14 +605,15 @@ class Z {
373
605
  }
374
606
  // Initialize property if it doesn't exist
375
607
  async initializeProperty(t, e) {
376
- await this.setState((r) => r.data[t] ? { ...r, propertyId: t, propertySlug: e } : {
377
- ...r,
378
- propertyId: t,
608
+ const a = String(t);
609
+ await this.setState((s) => s.data[a] ? { ...s, propertyId: a, propertySlug: e } : {
610
+ ...s,
611
+ propertyId: a,
379
612
  propertySlug: e,
380
613
  data: {
381
- ...r.data,
382
- [t]: {
383
- id: t,
614
+ ...s.data,
615
+ [a]: {
616
+ id: a,
384
617
  slug: e,
385
618
  favoritedUnits: [],
386
619
  tourContactedOn: null,
@@ -392,127 +625,95 @@ class Z {
392
625
  });
393
626
  }
394
627
  }
395
- const ft = new Z(), W = n.object({
396
- isFavorite: n.boolean().optional(),
397
- viewedDate: n.string().optional()
398
- }), M = n.object({
399
- availability: n.union([n.string(), n.array(n.string())]).nullable().optional(),
400
- bedrooms: n.array(n.number()).nullable().optional(),
401
- cost: n.number().nullable().optional(),
402
- highlights: n.array(n.string()).optional()
403
- }), X = n.object({
404
- limit: n.number().default(10),
405
- page: n.number().default(1),
406
- availability: n.array(n.string()).optional(),
407
- bedrooms: n.array(n.number()).optional(),
408
- cost: n.number().nullable().optional(),
409
- highlights: n.array(n.string()).optional()
410
- }), St = n.object({
411
- data: n.record(W),
412
- filters: M,
413
- tempFilters: M,
414
- apiFilters: X,
415
- resultsMode: n.enum(["all", "bestFit", "closestMatch", "favorites"]),
416
- propertySlug: n.string().nullable(),
417
- resolvedQuestionnaireValues: n.record(n.array(n.string())),
418
- sortBy: n.enum(["relevance", "newest", "priceLowToHigh", "priceHighToLow"]),
419
- filtersLoaded: n.boolean()
420
- });
421
- n.object({
422
- isFavorite: n.boolean().optional(),
423
- viewedDate: n.string().optional()
424
- });
425
- const tt = n.object({
426
- unitId: n.string(),
427
- viewedDate: n.string()
428
- }), et = n.object({
429
- timezone: n.string(),
430
- favouriteUnits: n.array(n.string()).optional(),
431
- preferences: n.record(n.unknown())
432
- }), rt = n.object({
433
- id: n.string(),
434
- slug: n.string(),
435
- favoritedUnits: n.array(n.string()),
436
- tourContactedOn: n.string().nullable(),
437
- viewedUnits: n.array(tt),
438
- questionnaireResults: n.unknown().nullable().optional(),
439
- tourContactData: et.nullable().optional()
440
- }), $ = n.object({
441
- availability: n.union([n.string(), n.array(n.string())]).nullable().optional(),
442
- bedrooms: n.array(n.number()).nullable().optional(),
443
- cost: n.number().nullable().optional(),
444
- highlights: n.array(n.string()).optional()
445
- }), at = n.object({
446
- limit: n.number().default(10),
447
- page: n.number().default(1),
448
- availability: n.array(n.string()).optional(),
449
- bedrooms: n.array(n.number()).optional(),
450
- cost: n.number().nullable().optional(),
451
- highlights: n.array(n.string()).optional()
452
- }), mt = n.object({
453
- // Property-related data
454
- properties: n.record(rt),
455
- currentPropertyId: n.string().nullable(),
456
- currentPropertySlug: n.string().nullable(),
457
- hasPreviouslySearched: n.array(n.string()),
458
- // App-level data
459
- filters: $,
460
- tempFilters: $,
461
- apiFilters: at,
462
- resultsMode: n.enum(["all", "bestFit", "closestMatch", "favorites"]),
463
- resolvedQuestionnaireValues: n.record(n.array(n.string())),
464
- sortBy: n.enum(["relevance", "newest", "priceLowToHigh", "priceHighToLow"]),
465
- filtersLoaded: n.boolean()
466
- }), T = {
628
+ const _t = new vt(), B = {
467
629
  availability: void 0,
468
630
  bedrooms: void 0,
469
631
  cost: void 0,
470
632
  highlights: void 0
471
- }, U = {
633
+ }, F = {
472
634
  // Property data
473
635
  properties: {},
474
636
  currentPropertyId: null,
475
637
  currentPropertySlug: null,
476
638
  hasPreviouslySearched: [],
477
639
  // App data
478
- filters: T,
479
- tempFilters: T,
640
+ unitResults: [],
641
+ filters: B,
642
+ tempFilters: B,
480
643
  apiFilters: {
481
644
  limit: 10,
482
645
  page: 1
483
646
  },
484
647
  resultsMode: "all",
485
648
  resolvedQuestionnaireValues: {},
486
- sortBy: "relevance",
487
- filtersLoaded: !1
649
+ sortBy: "relevance"
650
+ }, bt = (r) => r == null ? [] : Array.isArray(r) ? r : [r], et = (r) => bt(r).flatMap((t) => {
651
+ if (t == null) return [];
652
+ if (Array.isArray(t)) return t;
653
+ if (typeof t == "object" && "value" in t) {
654
+ const e = t.value;
655
+ return Array.isArray(e) ? e : e != null ? [e] : [];
656
+ }
657
+ return [t];
658
+ }), U = (r) => et(r).flatMap((t) => Array.isArray(t) ? t : [t]).map((t) => String(t)).map((t) => t.trim()).filter((t) => t.length > 0), J = (r) => et(r).map((t) => {
659
+ if (typeof t == "number" && Number.isFinite(t)) return t;
660
+ const e = Number(t);
661
+ return Number.isFinite(e) ? e : null;
662
+ }).filter((t) => t !== null), L = (r) => {
663
+ if (r == null) return null;
664
+ if (typeof r == "number") return Number.isFinite(r) ? r : null;
665
+ if (typeof r == "object" && "value" in r)
666
+ return L(r.value);
667
+ const t = Number(r);
668
+ return Number.isFinite(t) ? t : null;
488
669
  };
489
- class it {
670
+ class Pt {
490
671
  async getState() {
491
- const t = await j("app");
492
- return t ? {
493
- ...U,
672
+ const t = await W("app");
673
+ if (!t)
674
+ return F;
675
+ const e = {
676
+ ...F,
494
677
  ...t,
495
- properties: t.properties ?? {}
496
- } : U;
678
+ properties: t.properties ?? {},
679
+ unitResults: t.unitResults ?? [],
680
+ currentPropertyId: t.currentPropertyId == null ? null : String(t.currentPropertyId),
681
+ currentPropertySlug: t.currentPropertySlug ?? null,
682
+ hasPreviouslySearched: Array.isArray(t.hasPreviouslySearched) ? t.hasPreviouslySearched.map(String) : []
683
+ }, a = T.safeParse(e);
684
+ if (a.success) return a.data;
685
+ const s = Object.entries(e.properties ?? {}).reduce((d, [y, p]) => {
686
+ const g = C.safeParse(p);
687
+ return g.success && (d[y] = g.data), d;
688
+ }, {}), o = (Array.isArray(e.unitResults) ? e.unitResults : e.unitResults && typeof e.unitResults == "object" ? Object.values(e.unitResults) : []).reduce((d, y) => {
689
+ const p = b.safeParse(y);
690
+ return p.success && d.push(p.data), d;
691
+ }, []), l = {
692
+ ...e,
693
+ properties: s,
694
+ unitResults: o
695
+ }, u = T.safeParse(l);
696
+ return u.success ? u.data : F;
497
697
  }
498
698
  async setState(t) {
499
- const e = await this.getState(), r = t(e);
500
- await E("app", r);
699
+ const e = await this.getState(), a = t(e), s = T.parse(a);
700
+ await Y("app", s);
501
701
  }
502
702
  // === PROPERTY OPERATIONS ===
503
703
  async initializeProperty(t, e) {
504
- await this.setState((r) => r.properties && r.properties[t] ? {
505
- ...r,
506
- currentPropertyId: t,
704
+ const a = String(t);
705
+ await this.setState((s) => s.properties && s.properties[a] ? {
706
+ ...s,
707
+ currentPropertyId: a,
507
708
  currentPropertySlug: e
508
709
  } : {
509
- ...r,
510
- currentPropertyId: t,
710
+ ...s,
711
+ currentPropertyId: a,
511
712
  currentPropertySlug: e,
512
713
  properties: {
513
- ...r.properties,
514
- [t]: {
515
- id: t,
714
+ ...s.properties,
715
+ [a]: {
716
+ id: a,
516
717
  slug: e,
517
718
  favoritedUnits: [],
518
719
  tourContactedOn: null,
@@ -523,11 +724,122 @@ class it {
523
724
  }
524
725
  });
525
726
  }
727
+ // === UNIT RESULTS CACHE ===
728
+ async setUnitResults(t, e) {
729
+ console.log(t);
730
+ const a = e ?? b, s = [];
731
+ (Array.isArray(t) ? t : t && typeof t == "object" ? Object.values(t) : []).forEach((o, l) => {
732
+ const u = h(a, o, `unitResults[${l}]`);
733
+ u && s.push(u);
734
+ }), await this.setState((o) => ({
735
+ ...o,
736
+ unitResults: s
737
+ }));
738
+ }
739
+ async clearUnitResults() {
740
+ await this.setState((t) => ({
741
+ ...t,
742
+ unitResults: []
743
+ }));
744
+ }
745
+ // === PROPERTY DATA BAG (full property payloads & custom data) ===
746
+ async setPropertyData(t, e, a) {
747
+ const s = String(t), i = a ?? v;
748
+ await this.setState((o) => {
749
+ const l = o.properties[s];
750
+ if (!l) return o;
751
+ const u = h(i, e, `properties.${s}.data`);
752
+ return u ? {
753
+ ...o,
754
+ properties: {
755
+ ...o.properties,
756
+ [s]: {
757
+ ...l,
758
+ data: u
759
+ }
760
+ }
761
+ } : o;
762
+ });
763
+ }
764
+ async mergePropertyData(t, e, a) {
765
+ const s = String(t), i = a ?? v;
766
+ await this.setState((o) => {
767
+ const l = o.properties[s];
768
+ if (!l) return o;
769
+ const u = l.data;
770
+ if (!u) {
771
+ const g = h(i, e, `properties.${s}.data`);
772
+ return g ? {
773
+ ...o,
774
+ properties: {
775
+ ...o.properties,
776
+ [s]: {
777
+ ...l,
778
+ data: g
779
+ }
780
+ }
781
+ } : o;
782
+ }
783
+ const d = i.partial(), y = h(
784
+ d,
785
+ e,
786
+ `properties.${s}.data.partial`
787
+ );
788
+ if (!y) return o;
789
+ const p = h(
790
+ i,
791
+ { ...u, ...y },
792
+ `properties.${s}.data`
793
+ );
794
+ return p ? {
795
+ ...o,
796
+ properties: {
797
+ ...o.properties,
798
+ [s]: {
799
+ ...l,
800
+ data: p
801
+ }
802
+ }
803
+ } : o;
804
+ });
805
+ }
806
+ // Accepts a full API property object, validates, and stores it into the
807
+ // per-property `data` bag. Ensures the property entry exists/updated.
808
+ async upsertPropertyFromApi(t, e) {
809
+ const s = (e ?? v).parse(t), i = s.id ?? s.propertyId;
810
+ if (i == null)
811
+ throw new Error("upsertPropertyFromApi: property id is required");
812
+ const o = String(i), l = s.slug ?? void 0;
813
+ await this.setState((u) => {
814
+ const d = u.properties[o], y = d ? {
815
+ ...d,
816
+ ...l ? { slug: l } : {},
817
+ data: s
818
+ } : {
819
+ id: o,
820
+ slug: l ?? "",
821
+ favoritedUnits: [],
822
+ tourContactedOn: null,
823
+ viewedUnits: [],
824
+ questionnaireResults: null,
825
+ tourContactData: null,
826
+ data: s
827
+ };
828
+ return {
829
+ ...u,
830
+ properties: {
831
+ ...u.properties,
832
+ [o]: y
833
+ }
834
+ };
835
+ });
836
+ }
526
837
  async setCurrentProperty(t, e) {
527
- await this.setState((r) => ({
528
- ...r,
529
- currentPropertyId: t,
530
- currentPropertySlug: e || r.currentPropertySlug
838
+ const a = String(t);
839
+ await this.setState((s) => ({
840
+ ...s,
841
+ currentPropertyId: a,
842
+ currentPropertySlug: e || s.currentPropertySlug
531
843
  }));
532
844
  }
533
845
  async setCurrentPropertySlug(t) {
@@ -546,16 +858,16 @@ class it {
546
858
  }
547
859
  async toggleFavorite(t) {
548
860
  await this.setState((e) => {
549
- const r = e.currentPropertyId;
550
- if (!r) return e;
551
- const s = e.properties[r];
861
+ const a = e.currentPropertyId;
862
+ if (!a) return e;
863
+ const s = e.properties[a];
552
864
  if (!s) return e;
553
865
  const o = s.favoritedUnits.includes(t) ? s.favoritedUnits.filter((l) => l !== t) : [...s.favoritedUnits, t];
554
866
  return {
555
867
  ...e,
556
868
  properties: {
557
869
  ...e.properties,
558
- [r]: {
870
+ [a]: {
559
871
  ...s,
560
872
  favoritedUnits: o
561
873
  }
@@ -564,17 +876,17 @@ class it {
564
876
  });
565
877
  }
566
878
  async markUnitAsViewed(t, e) {
567
- const r = /* @__PURE__ */ new Date(), s = `${String(r.getMonth() + 1).padStart(
879
+ const a = /* @__PURE__ */ new Date(), s = `${String(a.getMonth() + 1).padStart(
568
880
  2,
569
881
  "0"
570
- )}/${String(r.getDate()).padStart(2, "0")}`;
882
+ )}/${String(a.getDate()).padStart(2, "0")}`;
571
883
  await this.setState((i) => {
572
884
  const o = i.currentPropertyId;
573
885
  if (!o) return i;
574
886
  const l = i.properties[o];
575
887
  if (!l) return i;
576
888
  const u = [
577
- ...l.viewedUnits.filter((y) => y.unitId !== t),
889
+ ...l.viewedUnits.filter((d) => d.unitId !== t),
578
890
  { unitId: t, viewedDate: s }
579
891
  ];
580
892
  return {
@@ -593,13 +905,13 @@ class it {
593
905
  await this.setState((t) => {
594
906
  const e = t.currentPropertyId;
595
907
  if (!e) return t;
596
- const r = t.properties[e];
597
- return r ? {
908
+ const a = t.properties[e];
909
+ return a ? {
598
910
  ...t,
599
911
  properties: {
600
912
  ...t.properties,
601
913
  [e]: {
602
- ...r,
914
+ ...a,
603
915
  tourContactedOn: (/* @__PURE__ */ new Date()).toISOString()
604
916
  }
605
917
  }
@@ -607,20 +919,20 @@ class it {
607
919
  });
608
920
  }
609
921
  async getTourContactedOn() {
610
- var r;
922
+ var a;
611
923
  const t = await this.getState(), e = t.currentPropertyId;
612
- return e ? ((r = t.properties[e]) == null ? void 0 : r.tourContactedOn) ?? null : null;
924
+ return e ? ((a = t.properties[e]) == null ? void 0 : a.tourContactedOn) ?? null : null;
613
925
  }
614
926
  async setQuestionnaireResults(t) {
615
927
  await this.setState((e) => {
616
- const r = e.currentPropertyId;
617
- if (!r) return e;
618
- const s = e.properties[r];
928
+ const a = e.currentPropertyId;
929
+ if (!a) return e;
930
+ const s = e.properties[a];
619
931
  return s ? {
620
932
  ...e,
621
933
  properties: {
622
934
  ...e.properties,
623
- [r]: {
935
+ [a]: {
624
936
  ...s,
625
937
  questionnaireResults: t
626
938
  }
@@ -630,14 +942,14 @@ class it {
630
942
  }
631
943
  async setTourContactData(t) {
632
944
  await this.setState((e) => {
633
- const r = e.currentPropertyId;
634
- if (!r) return e;
635
- const s = e.properties[r];
945
+ const a = e.currentPropertyId;
946
+ if (!a) return e;
947
+ const s = e.properties[a];
636
948
  return s ? {
637
949
  ...e,
638
950
  properties: {
639
951
  ...e.properties,
640
- [r]: {
952
+ [a]: {
641
953
  ...s,
642
954
  tourContactData: t
643
955
  }
@@ -659,7 +971,7 @@ class it {
659
971
  }));
660
972
  }
661
973
  async setFiltersToDefault() {
662
- await this.setState((t) => ({ ...t, filters: T }));
974
+ await this.setState((t) => ({ ...t, filters: B }));
663
975
  }
664
976
  async setApiFilters(t) {
665
977
  await this.setState((e) => ({
@@ -668,9 +980,9 @@ class it {
668
980
  }));
669
981
  }
670
982
  async handleTempFilterChange(t, e) {
671
- await this.setState((r) => ({
672
- ...r,
673
- tempFilters: { ...r.tempFilters, [t]: e }
983
+ await this.setState((a) => ({
984
+ ...a,
985
+ tempFilters: { ...a.tempFilters, [t]: e }
674
986
  }));
675
987
  }
676
988
  async commitTempFilterChange(t, e) {
@@ -679,17 +991,17 @@ class it {
679
991
  }
680
992
  async handleFilterCommitIndexDB(t) {
681
993
  await this.setState((e) => {
682
- const r = {
994
+ const a = {
683
995
  ...e.apiFilters,
684
- availability: t.availability || [],
685
- bedrooms: t.bedrooms || [],
686
- cost: t.cost || null,
687
- highlights: t.highlights || []
996
+ availability: U(t.availability),
997
+ bedrooms: J(t.bedrooms),
998
+ cost: L(t.cost),
999
+ highlights: U(t.highlights)
688
1000
  };
689
1001
  return {
690
1002
  ...e,
691
1003
  filters: { ...e.filters, ...t },
692
- apiFilters: r
1004
+ apiFilters: a
693
1005
  };
694
1006
  });
695
1007
  }
@@ -700,10 +1012,10 @@ class it {
700
1012
  await this.setState((t) => {
701
1013
  const e = {
702
1014
  ...t.apiFilters,
703
- availability: t.filters.availability || [],
704
- bedrooms: t.filters.bedrooms || [],
705
- cost: t.filters.cost || null,
706
- highlights: t.filters.highlights || []
1015
+ availability: U(t.filters.availability),
1016
+ bedrooms: J(t.filters.bedrooms),
1017
+ cost: L(t.filters.cost),
1018
+ highlights: U(t.filters.highlights)
707
1019
  };
708
1020
  return {
709
1021
  ...t,
@@ -720,10 +1032,10 @@ class it {
720
1032
  }
721
1033
  // === QUESTIONNAIRE ===
722
1034
  async setResolvedQuestionnaireValues(t, e) {
723
- await this.setState((r) => ({
724
- ...r,
1035
+ await this.setState((a) => ({
1036
+ ...a,
725
1037
  resolvedQuestionnaireValues: {
726
- ...r.resolvedQuestionnaireValues,
1038
+ ...a.resolvedQuestionnaireValues,
727
1039
  [t]: e
728
1040
  }
729
1041
  }));
@@ -731,10 +1043,10 @@ class it {
731
1043
  // === UTILITY METHODS ===
732
1044
  async getUnitState(t) {
733
1045
  var s;
734
- const e = await this.getState(), r = e.currentPropertyId ? e.properties[e.currentPropertyId] : null;
1046
+ const e = await this.getState(), a = e.currentPropertyId ? e.properties[e.currentPropertyId] : null;
735
1047
  return {
736
- isFavorite: (r == null ? void 0 : r.favoritedUnits.includes(t)) ?? !1,
737
- viewedDate: ((s = r == null ? void 0 : r.viewedUnits.find((i) => i.unitId === t)) == null ? void 0 : s.viewedDate) ?? ""
1048
+ isFavorite: (a == null ? void 0 : a.favoritedUnits.includes(t)) ?? !1,
1049
+ viewedDate: ((s = a == null ? void 0 : a.viewedUnits.find((i) => i.unitId === t)) == null ? void 0 : s.viewedDate) ?? ""
738
1050
  };
739
1051
  }
740
1052
  async getResultsUrl() {
@@ -746,22 +1058,16 @@ class it {
746
1058
  return t.currentPropertyId ? t.properties[t.currentPropertyId] ?? null : null;
747
1059
  }
748
1060
  async getPropertyData(t) {
749
- const e = await this.getState(), r = t ?? e.currentPropertyId;
750
- return r ? e.properties[r] ?? null : null;
1061
+ const e = await this.getState(), a = t == null ? e.currentPropertyId : String(t);
1062
+ return a ? e.properties[a] ?? null : null;
751
1063
  }
752
1064
  async getFullState() {
753
1065
  return this.getState();
754
1066
  }
755
1067
  async initialize() {
756
- const t = await this.getState();
757
- Object.keys(t.properties).length === 0 && !t.filtersLoaded && await this.setState((e) => ({
758
- ...U,
759
- ...e,
760
- filtersLoaded: !0
761
- }));
1068
+ await this.setState((t) => ({ ...F, ...t }));
762
1069
  }
763
1070
  async loadPersistedFilters() {
764
- await this.setState((t) => ({ ...t, filtersLoaded: !0 }));
765
1071
  }
766
1072
  // === LEGACY COMPATIBILITY METHODS ===
767
1073
  // Property store compatibility
@@ -775,123 +1081,38 @@ class it {
775
1081
  await this.setCurrentProperty(t);
776
1082
  }
777
1083
  async removeData(t) {
778
- await this.setState((e) => {
779
- const { [t]: r, ...s } = e.properties;
780
- return { ...e, properties: s };
1084
+ const e = String(t);
1085
+ await this.setState((a) => {
1086
+ const { [e]: s, ...i } = a.properties;
1087
+ return { ...a, properties: i };
781
1088
  });
782
1089
  }
783
1090
  async clearData() {
784
1091
  await this.setState((t) => ({ ...t, properties: {} }));
785
1092
  }
786
1093
  }
787
- const c = new it(), b = 1, f = n.object({
788
- uuid: n.string().uuid()
789
- }), O = n.object({
790
- propertyId: n.string() || n.number(),
791
- unitIds: n.array(n.string())
792
- }), m = "user", nt = () => {
793
- var a;
794
- return typeof ((a = globalThis.crypto) == null ? void 0 : a.randomUUID) == "function" ? globalThis.crypto.randomUUID() : (() => {
795
- var r, s;
796
- const t = ((s = (r = globalThis.crypto) == null ? void 0 : r.getRandomValues) == null ? void 0 : s.call(r, new Uint8Array(16))) ?? Uint8Array.from({ length: 16 }, () => Math.random() * 256 | 0);
797
- t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
798
- const e = [...t].map((i) => i.toString(16).padStart(2, "0")).join("");
799
- return `${e.slice(0, 8)}-${e.slice(8, 12)}-${e.slice(12, 16)}-${e.slice(16, 20)}-${e.slice(20)}`;
800
- })();
801
- }, I = (a) => {
802
- var t, e;
803
- return ((t = a == null ? void 0 : a.value) == null ? void 0 : t.useruuid) ?? ((e = a == null ? void 0 : a.value) == null ? void 0 : e.uuid);
804
- };
805
- async function R(a = nt) {
806
- const t = await w(), e = I(await t.kv.get(m));
807
- if (e) {
808
- const r = await t.users.get(e);
809
- if (r) return f.parse(r);
810
- }
811
- try {
812
- return await t.transaction("rw", t.kv, t.users, async () => {
813
- const r = I(await t.kv.get(m));
814
- if (r) {
815
- const o = await t.users.get(r);
816
- if (o) return f.parse(o);
817
- }
818
- const s = a();
819
- await t.kv.add({ key: m, value: { useruuid: s } });
820
- const i = f.parse({
821
- uuid: s,
822
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
823
- });
824
- return await t.users.add(i), i;
825
- });
826
- } catch (r) {
827
- if ((r == null ? void 0 : r.name) === "ConstraintError") {
828
- const s = I(await t.kv.get(m));
829
- if (s) {
830
- const i = await t.users.get(s);
831
- if (i) return f.parse(i);
832
- }
833
- }
834
- throw r;
835
- }
836
- }
837
- const vt = async (a) => (await R(a)).uuid;
838
- async function st() {
839
- const a = await w(), t = {};
840
- for (const e of a.tables)
841
- t[e.name] = await e.toArray();
842
- return t;
843
- }
844
- async function bt(a = "inresi-orm-export.json") {
845
- if (typeof window > "u" || typeof document > "u")
846
- throw new Error("exportJSON can only run in a browser.");
847
- const t = await st(), e = new Blob([JSON.stringify(t, null, 2)], { type: "application/json" }), r = document.createElement("a");
848
- r.href = URL.createObjectURL(e), r.download = a, document.body.appendChild(r), r.click(), r.remove(), URL.revokeObjectURL(r.href);
849
- }
850
- const L = (a, t) => `favorites:${a}:${t}`;
851
- async function V(a) {
852
- const t = await w(), { uuid: e } = await R(), r = L(e, String(a)), s = await t.kv.get(r), i = s ? O.safeParse(s.value) : null;
853
- return i != null && i.success ? i.data.unitIds : [];
854
- }
855
- async function Q(a, t, e) {
856
- const r = await w(), { uuid: s } = await R(), i = L(s, String(a));
857
- return r.transaction("rw", r.kv, async () => {
858
- const o = await r.kv.get(i), l = o && O.safeParse(o.value).success ? o.value : { unitIds: [], updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, u = new Set(l.unitIds);
859
- e ? u.add(t) : u.delete(t);
860
- const y = {
861
- unitIds: [...u],
862
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
863
- }, p = O.parse(y);
864
- return await r.kv.put({ key: i, value: p }), p.unitIds;
865
- });
866
- }
867
- async function ot(a, t) {
868
- const r = !(await V(a)).includes(t);
869
- return Q(a, t, r);
870
- }
871
- async function lt(a, t) {
872
- return (await V(a)).includes(t);
873
- }
874
- function ct(a) {
1094
+ const c = new Pt();
1095
+ function Ft(r) {
875
1096
  return (t, e) => {
876
- const r = async () => {
1097
+ const a = async () => {
877
1098
  const i = await c.getFullState();
878
1099
  t({
879
1100
  properties: i.properties,
880
1101
  currentPropertyId: i.currentPropertyId,
881
1102
  currentPropertySlug: i.currentPropertySlug,
882
1103
  hasPreviouslySearched: i.hasPreviouslySearched,
1104
+ unitResults: i.unitResults,
883
1105
  filters: i.filters,
884
1106
  tempFilters: i.tempFilters,
885
1107
  apiFilters: i.apiFilters,
886
1108
  resultsMode: i.resultsMode,
887
1109
  resolvedQuestionnaireValues: i.resolvedQuestionnaireValues,
888
- sortBy: i.sortBy,
889
- filtersLoaded: i.filtersLoaded
1110
+ sortBy: i.sortBy
890
1111
  });
891
1112
  }, s = async () => {
892
- if (a != null && a.onFilterUpdate) {
1113
+ if (r != null && r.onFilterUpdate) {
893
1114
  const i = (await c.getFullState()).apiFilters;
894
- a.onFilterUpdate(i);
1115
+ r.onFilterUpdate(i);
895
1116
  }
896
1117
  };
897
1118
  return {
@@ -900,7 +1121,7 @@ function ct(a) {
900
1121
  currentPropertyId: null,
901
1122
  currentPropertySlug: null,
902
1123
  hasPreviouslySearched: [],
903
- units: {},
1124
+ unitResults: [],
904
1125
  filters: {
905
1126
  availability: void 0,
906
1127
  bedrooms: void 0,
@@ -923,7 +1144,7 @@ function ct(a) {
923
1144
  filtersLoaded: !1,
924
1145
  // === PROPERTY OPERATIONS ===
925
1146
  async initializeProperty(i, o) {
926
- await c.initializeProperty(i, o), await r();
1147
+ await c.initializeProperty(i, o), await a();
927
1148
  },
928
1149
  async setCurrentProperty(i, o) {
929
1150
  await c.setCurrentProperty(i, o), t({
@@ -935,23 +1156,29 @@ function ct(a) {
935
1156
  await c.setCurrentPropertySlug(i), t({ currentPropertySlug: i });
936
1157
  },
937
1158
  async setHasPreviouslySearched(i) {
938
- await c.setHasPreviouslySearched(i), await r();
1159
+ await c.setHasPreviouslySearched(i), await a();
939
1160
  },
940
1161
  async toggleFavorite(i) {
941
- await c.toggleFavorite(i), await r();
1162
+ await c.toggleFavorite(i), await a();
942
1163
  },
943
1164
  async markUnitAsViewed(i, o) {
944
- await c.markUnitAsViewed(i, o), await r();
1165
+ await c.markUnitAsViewed(i, o), await a();
945
1166
  },
946
1167
  async setTourContactedOn() {
947
- await c.setTourContactedOn(), await r();
1168
+ await c.setTourContactedOn(), await a();
948
1169
  },
949
1170
  getTourContactedOn: c.getTourContactedOn.bind(c),
950
1171
  async setQuestionnaireResults(i) {
951
- await c.setQuestionnaireResults(i), await r();
1172
+ await c.setQuestionnaireResults(i), await a();
952
1173
  },
953
1174
  async setTourContactData(i) {
954
- await c.setTourContactData(i), await r();
1175
+ await c.setTourContactData(i), await a();
1176
+ },
1177
+ async setUnitResults(i) {
1178
+ await c.setUnitResults(i), await a();
1179
+ },
1180
+ async clearUnitResults() {
1181
+ await c.clearUnitResults(), await a();
955
1182
  },
956
1183
  // === FILTER OPERATIONS ===
957
1184
  async setFilters(i) {
@@ -983,16 +1210,16 @@ function ct(a) {
983
1210
  t({ tempFilters: { ...l.tempFilters, [i]: o } });
984
1211
  },
985
1212
  async commitTempFilterChange(i, o) {
986
- await c.commitTempFilterChange(i, o), await r(), await s();
1213
+ await c.commitTempFilterChange(i, o), await a(), await s();
987
1214
  },
988
1215
  async handleFilterCommitIndexDB(i) {
989
- await c.handleFilterCommitIndexDB(i), await r(), await s();
1216
+ await c.handleFilterCommitIndexDB(i), await a(), await s();
990
1217
  },
991
1218
  async commitAvailabilityChange() {
992
- await c.commitAvailabilityChange(), await r(), await s();
1219
+ await c.commitAvailabilityChange(), await a(), await s();
993
1220
  },
994
1221
  async submitFilterUpdate() {
995
- await c.submitFilterUpdate(), await r(), await s();
1222
+ await c.submitFilterUpdate(), await a(), await s();
996
1223
  },
997
1224
  // === RESULTS AND SORTING ===
998
1225
  async setResultsMode(i) {
@@ -1018,7 +1245,7 @@ function ct(a) {
1018
1245
  const o = e(), l = o.currentPropertyId ? o.properties[o.currentPropertyId] : null;
1019
1246
  return {
1020
1247
  isFavorite: (l == null ? void 0 : l.favoritedUnits.includes(i)) ?? !1,
1021
- viewedDate: ((u = l == null ? void 0 : l.viewedUnits.find((y) => y.unitId === i)) == null ? void 0 : u.viewedDate) ?? ""
1248
+ viewedDate: ((u = l == null ? void 0 : l.viewedUnits.find((d) => d.unitId === i)) == null ? void 0 : u.viewedDate) ?? ""
1022
1249
  };
1023
1250
  },
1024
1251
  getResultsUrl: c.getResultsUrl.bind(c),
@@ -1035,7 +1262,7 @@ function ct(a) {
1035
1262
  await c.setPropertyId(i), t({ currentPropertyId: i });
1036
1263
  },
1037
1264
  async removeData(i) {
1038
- await c.removeData(i), await r();
1265
+ await c.removeData(i), await a();
1039
1266
  },
1040
1267
  async clearData() {
1041
1268
  await c.clearData(), t({ properties: {} });
@@ -1045,110 +1272,184 @@ function ct(a) {
1045
1272
  },
1046
1273
  // === INTERNAL ===
1047
1274
  async _hydrate() {
1048
- await r();
1275
+ await a();
1049
1276
  },
1050
1277
  async _initialize() {
1051
- await c.initialize(), await r();
1278
+ await c.initialize(), await a(), t({ filtersLoaded: !0 });
1052
1279
  }
1053
1280
  };
1054
1281
  };
1055
1282
  }
1056
- function Pt() {
1057
- return (a) => (t) => a((e) => e.getUnitState(t));
1283
+ function Bt() {
1284
+ return (r) => (t) => r((e) => e.getUnitState(t));
1058
1285
  }
1059
- function ut(a) {
1286
+ function Ut(r) {
1060
1287
  return {
1061
1288
  property: {
1062
1289
  unit: {
1063
1290
  favorites: {
1064
- toggle: a.toggleFavorite.bind(a)
1291
+ toggle: r.toggleFavorite.bind(r)
1065
1292
  },
1066
1293
  viewed: {
1067
- mark: a.markUnitAsViewed.bind(a)
1294
+ mark: r.markUnitAsViewed.bind(r)
1068
1295
  }
1069
1296
  },
1070
1297
  questionnaire: {
1071
- setResults: a.setQuestionnaireResults.bind(a)
1298
+ setResults: r.setQuestionnaireResults.bind(r)
1072
1299
  },
1073
1300
  tour: {
1074
- setContactedOn: a.setTourContactedOn.bind(a),
1075
- getContactedOn: a.getTourContactedOn.bind(a),
1076
- setContactData: a.setTourContactData.bind(a)
1301
+ setContactedOn: r.setTourContactedOn.bind(r),
1302
+ getContactedOn: r.getTourContactedOn.bind(r),
1303
+ setContactData: r.setTourContactData.bind(r)
1077
1304
  }
1078
1305
  },
1079
1306
  filters: {
1080
- set: a.setFilters.bind(a),
1081
- setTemp: a.setTempFilters.bind(a),
1082
- setToDefault: a.setFiltersToDefault.bind(a),
1083
- commitTemp: a.commitTempFilterChange.bind(a),
1084
- commitAvailability: a.commitAvailabilityChange.bind(a),
1085
- submit: a.submitFilterUpdate.bind(a)
1307
+ set: r.setFilters.bind(r),
1308
+ setTemp: r.setTempFilters.bind(r),
1309
+ setToDefault: r.setFiltersToDefault.bind(r),
1310
+ commitTemp: r.commitTempFilterChange.bind(r),
1311
+ commitAvailability: r.commitAvailabilityChange.bind(r),
1312
+ submit: r.submitFilterUpdate.bind(r)
1086
1313
  }
1087
1314
  };
1088
1315
  }
1089
- function Ft(a) {
1316
+ function Lt(r) {
1090
1317
  return (t, e) => {
1091
- const r = ct(a)(t, e), s = ut(r);
1318
+ const a = Ft(r)(t, e), s = Ut(a);
1092
1319
  return {
1093
- ...r,
1320
+ ...a,
1094
1321
  ...s
1095
1322
  };
1096
1323
  };
1097
1324
  }
1098
- const Dt = {
1099
- async isFavorite(a, t) {
1100
- return lt(a, t);
1325
+ const zt = {
1326
+ async isFavorite(r, t) {
1327
+ return St(r, t);
1101
1328
  },
1102
- async toggle(a, t) {
1103
- return ot(a, t);
1329
+ async toggle(r, t) {
1330
+ return mt(r, t);
1104
1331
  },
1105
- async set(a, t, e) {
1106
- return Q(a, t, e);
1332
+ async set(r, t, e) {
1333
+ return tt(r, t, e);
1107
1334
  },
1108
- async getAll(a) {
1109
- return V(a);
1335
+ async getAll(r) {
1336
+ return Q(r);
1110
1337
  }
1111
- };
1338
+ }, rt = "https://web.inresiapp.com", at = "/placeholder.jpg", It = (r) => r ? r.startsWith("?") ? r : `?${r}` : "", Dt = (r, t, e = rt) => `${e}/${t}/unit/${r}/explore`, j = (r, t = at) => !(r != null && r.CFURL) || !(r != null && r.name) || !(r != null && r.signature) ? t : `${r.CFURL}${r.name}${It(r.signature)}`;
1339
+ function Qt(r) {
1340
+ return { data: r };
1341
+ }
1342
+ function Ht(r, t, e) {
1343
+ var o, l;
1344
+ const a = (e == null ? void 0 : e.origin) ?? rt, s = (e == null ? void 0 : e.placeholderImage) ?? at, i = ((o = r.hits) == null ? void 0 : o.map((u) => {
1345
+ var g, H;
1346
+ const d = u._source ?? {}, y = typeof d.name == "string" ? d.name : typeof d.title == "string" ? d.title : "";
1347
+ return {
1348
+ ...d,
1349
+ title: y,
1350
+ slug: Dt(String(d.slug ?? ""), t, a),
1351
+ imageUrl: j(d.image, s),
1352
+ secondaryImageUrl: j((g = d.additionalImages) == null ? void 0 : g[0], s),
1353
+ tertiaryImageUrl: j((H = d.additionalImages) == null ? void 0 : H[1], s)
1354
+ };
1355
+ })) ?? [];
1356
+ return {
1357
+ total: ((l = r.total) == null ? void 0 : l.value) ?? i.length,
1358
+ maxScore: r.max_score ?? null,
1359
+ type: r.type ?? "units",
1360
+ hits: i
1361
+ };
1362
+ }
1363
+ const kt = {
1364
+ asap: "ASAP",
1365
+ next_month: "Next Month",
1366
+ "2_3_months": "2-3 Months",
1367
+ all: "Just Browsing"
1368
+ }, k = {
1369
+ 0: "Studio",
1370
+ 1: "1 Bed",
1371
+ 2: "2 Bed",
1372
+ 3: "3+ Bed"
1373
+ }, Rt = new Set(Object.values(k)), At = (r) => {
1374
+ if (!r || r.length === 0) return;
1375
+ const t = /* @__PURE__ */ new Set();
1376
+ for (const e of r) {
1377
+ if (typeof e == "number") {
1378
+ const s = k[e];
1379
+ s && t.add(s);
1380
+ continue;
1381
+ }
1382
+ const a = e.split(",").map((s) => s.trim());
1383
+ for (const s of a) {
1384
+ const i = Number.parseInt(s, 10);
1385
+ !Number.isNaN(i) && k[i] ? t.add(k[i]) : Rt.has(s) && t.add(s);
1386
+ }
1387
+ }
1388
+ return t.size > 0 ? Array.from(t) : void 0;
1389
+ }, qt = (r) => ({
1390
+ availability: r.availability && r.availability.length > 0 ? r.availability.map(
1391
+ (e) => kt[e] ?? e
1392
+ ) : void 0,
1393
+ bedrooms: At(r.bedrooms),
1394
+ cost: r.cost ?? void 0,
1395
+ highlights: r.highlights ?? []
1396
+ });
1112
1397
  export {
1113
- St as AppStoreDataSchema,
1114
- O as FavoritesSchema,
1115
- M as FiltersSchema,
1116
- B as OpenDBError,
1117
- G as PropertyDataSchema,
1118
- Z as PropertyStore,
1119
- gt as PropertyStoreDataSchema,
1120
- X as QueryParamsSchema,
1121
- b as SCHEMA_VERSION,
1122
- x as SchemaMismatchError,
1123
- K as TourContactDataSchema,
1124
- it as UnifiedStore,
1125
- mt as UnifiedStoreDataSchema,
1126
- W as UnitDataSchema,
1127
- f as UserSchema,
1128
- J as ViewedUnitSchema,
1129
- H as configureValidation,
1130
- ht as createORMStringStorage,
1131
- Ft as createStructuredStore,
1132
- ut as createStructuredStoreActions,
1133
- Pt as createUseUnitState,
1134
- ct as createZustandPropertyStore,
1135
- ct as createZustandUnifiedStore,
1136
- st as debugDump,
1137
- nt as defaultIdGenerator,
1138
- R as ensureUser,
1139
- bt as exportJSON,
1140
- Dt as favorites,
1141
- w as getDB,
1142
- V as getFavoritedUnitsForProperty,
1143
- vt as getUserUUID,
1144
- lt as isUnitFavorited,
1145
- j as kvGet,
1146
- wt as kvRemove,
1147
- E as kvSet,
1148
- ft as propertyStore,
1149
- pt as resetDB,
1150
- Q as setFavoriteUnit,
1398
+ Mt as ApiUserSchema,
1399
+ Tt as AppStoreDataSchema,
1400
+ at as DEFAULT_PLACEHOLDER_IMAGE,
1401
+ rt as DEFAULT_WEB_ORIGIN,
1402
+ N as FavoritesSchema,
1403
+ A as FiltersSchema,
1404
+ st as OpenDBError,
1405
+ v as PropertySchema,
1406
+ vt as PropertyStore,
1407
+ O as PropertyStoreDataSchema,
1408
+ G as QueryParamsSchema,
1409
+ K as ResultsModeEnum,
1410
+ I as SCHEMA_VERSION,
1411
+ it as SchemaMismatchError,
1412
+ Z as SortByEnum,
1413
+ Pt as Store,
1414
+ dt as TourContactDataSchema,
1415
+ Pt as UnifiedStore,
1416
+ T as UnifiedStoreDataSchema,
1417
+ lt as UnitDataSchema,
1418
+ Et as UnitFavoriteSchema,
1419
+ b as UnitSchema,
1420
+ C as UserPropertyStateSchema,
1421
+ m as UserSchema,
1422
+ ot as UserUnitDataSchema,
1423
+ ct as ViewedUnitSchema,
1424
+ Dt as buildExploreUrl,
1425
+ j as buildImageUrl,
1426
+ pt as configureValidation,
1427
+ xt as createORMStringStorage,
1428
+ Lt as createStructuredStore,
1429
+ Ut as createStructuredStoreActions,
1430
+ Bt as createUseUnitState,
1431
+ Ft as createZustandPropertyStore,
1432
+ Ft as createZustandStore,
1433
+ Ft as createZustandUnifiedStore,
1434
+ wt as debugDump,
1435
+ ht as defaultIdGenerator,
1436
+ z as ensureUser,
1437
+ jt as exportJSON,
1438
+ zt as favorites,
1439
+ f as getDB,
1440
+ Q as getFavoritedUnitsForProperty,
1441
+ $t as getUserUUID,
1442
+ St as isUnitFavorited,
1443
+ W as kvGet,
1444
+ Nt as kvRemove,
1445
+ Y as kvSet,
1446
+ _t as propertyStore,
1447
+ Vt as resetDB,
1448
+ tt as setFavoriteUnit,
1151
1449
  c as store,
1152
- ot as toggleFavoriteUnit
1450
+ mt as toggleFavoriteUnit,
1451
+ Qt as transformUnitsApiResponse,
1452
+ Ht as transformUnitsApiResponseToClient,
1453
+ qt as transformUnitsApiResponseToClientFilters
1153
1454
  };
1154
1455
  //# sourceMappingURL=index.mjs.map