@superbright/indexeddb-orm 0.1.3 → 0.1.5

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 at 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 it 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 F = 1, S = n.object({
14
+ uuid: n.string().uuid(),
15
+ // stored as ISO string; include to match ensureUser()
16
+ createdAt: n.string().datetime().optional()
17
+ }), st = n.object({
18
+ isFavorite: n.boolean().optional(),
19
+ viewedDate: n.string().optional()
20
+ }), ot = st, R = n.union([
21
+ n.string(),
22
+ n.number(),
23
+ n.boolean(),
24
+ n.record(n.unknown())
25
+ ]), lt = n.union([
26
+ R,
27
+ n.array(R)
28
+ ]), D = n.object({
29
+ availability: lt.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
+ }), q = 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
+ }), J = n.enum(["all", "bestFit", "closestMatch", "favorites", "loading"]), G = n.enum(["relevance", "newest", "priceLowToHigh", "priceHighToLow"]), Tt = n.object({
41
+ data: n.record(ot),
42
+ filters: D,
43
+ tempFilters: D,
44
+ apiFilters: q,
45
+ resultsMode: J,
46
+ propertySlug: n.string().nullable(),
47
+ resolvedQuestionnaireValues: n.record(n.array(n.string())),
48
+ sortBy: G
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
+ }), ut = n.object({
121
+ unitId: n.string(),
122
+ viewedDate: n.string()
123
+ }), ct = n.object({
124
+ timezone: n.string().optional(),
125
+ favouriteUnits: n.array(n.coerce.string()).optional(),
126
+ preferences: n.record(n.unknown()).optional()
127
+ }), A = 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(ut),
133
+ questionnaireResults: n.unknown().nullable().optional(),
134
+ tourContactData: ct.nullable().optional(),
135
+ // Full property payload persisted alongside per-property state
136
+ data: v.optional()
137
+ }), C = n.object({
138
+ data: n.record(A),
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
+ }), j = 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
+ }), O = n.object({
152
+ // Property-related data
153
+ properties: n.record(A),
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: D,
160
+ tempFilters: D,
161
+ apiFilters: q,
162
+ resultsMode: J,
163
+ resolvedQuestionnaireValues: n.record(n.array(n.string())),
164
+ sortBy: G
165
+ });
166
+ class N extends nt {
14
167
  constructor(t = "inresi-orm") {
15
- super(t), this.version(b).stores({
168
+ super(t), this.version(F).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", I;
175
+ function dt(r) {
176
+ r.mode && (_ = r.mode), I = 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 w(r, t, e) {
179
+ const a = r.safeParse(t);
180
+ if (a.success) return a.data;
181
+ const s = a.error.flatten();
182
+ if (I == null || I(e, s), _ === "strict")
183
+ throw new at(`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 pt = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, T = "manifest", yt = n.object({ schemaVersion: n.number().int() });
187
+ let h = null, m = null;
188
+ const Q = Symbol("validationInstalled");
189
+ function M(r, t) {
190
+ const e = r;
191
+ if (e[Q]) return;
192
+ if (e[Q] = !0, ((i, o, l) => {
193
+ i.hook("creating", (u, c) => {
194
+ const y = w(o, c, `${l}.creating`);
195
+ if (!y) throw new Error(`Rejected invalid ${l} on create`);
196
+ return y;
197
+ }), i.hook("updating", (u, c, y) => {
198
+ const p = { ...y, ...u };
199
+ return w(o, p, `${l}.updating`) ? u : {};
47
200
  });
48
- })(a.users, f, "users"), (t == null ? void 0 : t.validateReads) ?? !0) {
201
+ })(r.users, S, "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, c) => {
204
+ l.hook("reading", (y) => {
205
+ const p = w(u, y, `${c}.reading`);
206
+ return p || (i ? void 0 : y);
54
207
  });
55
- })(a.users, f, "users");
208
+ })(r.users, S, "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" && pt)
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 = {}) {
224
+ async function g(r = {}) {
72
225
  if (h) return h;
73
- if (S) return S;
74
- const t = a.dbName ?? "inresi-orm";
75
- return S = (async () => {
76
- var e, r, s, i;
226
+ if (m) return m;
227
+ const t = r.dbName ?? "inresi-orm";
228
+ return m = (async () => {
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
+ dt({
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 N(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(T), c = (u == null ? void 0 : u.value) ?? null;
249
+ if (!c)
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: T,
253
+ value: { schemaVersion: F }
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
+ }), M(l, r.validation), h = l, l;
256
+ const y = yt.safeParse(c);
257
+ if (!y.success || y.data.schemaVersion !== F) {
105
258
  await l.delete();
106
- const d = new C(t);
107
- return d.on("versionchange", () => {
108
- var g;
259
+ const p = new N(t);
260
+ return p.on("versionchange", () => {
261
+ var f;
109
262
  try {
110
- d.close();
263
+ p.close();
111
264
  } finally {
112
- (g = a.onReset) == null || g.call(a, "versionchange");
265
+ (f = r.onReset) == null || f.call(r, "versionchange");
113
266
  }
114
- }), d.on("blocked", () => {
115
- 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;
267
+ }), p.on("blocked", () => {
268
+ var f;
269
+ (f = r.onReset) == null || f.call(r, "blocked");
270
+ }), await p.open(), await p.kv.put({
271
+ key: T,
272
+ value: { schemaVersion: F }
273
+ }), M(p, r.validation), (s = r.onReset) == null || s.call(r, "incompatible"), h = p, p;
121
274
  }
122
- return D(l, a.validation), h = l, l;
275
+ return M(l, r.validation), h = 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 it("Failed to open IndexedDB", o);
125
278
  } finally {
126
- S = null;
279
+ m = null;
127
280
  }
128
- })(), S;
281
+ })(), m;
129
282
  }
130
- async function pt(a) {
131
- const t = a ?? "inresi-orm";
283
+ async function Vt(r) {
284
+ const t = r ?? "inresi-orm";
132
285
  if (h)
133
286
  try {
134
287
  await h.close();
135
288
  } catch {
136
289
  }
137
- await new C(t).delete(), h = null;
290
+ await new N(t).delete(), h = null;
291
+ }
292
+ const P = "user", gt = () => {
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
+ }, E = (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 B(r = gt) {
306
+ const t = await g(), e = E(await t.kv.get(P));
307
+ if (e) {
308
+ const a = await t.users.get(e);
309
+ if (a) return S.parse(a);
310
+ }
311
+ try {
312
+ return await t.transaction("rw", t.kv, t.users, async () => {
313
+ const a = E(await t.kv.get(P));
314
+ if (a) {
315
+ const o = await t.users.get(a);
316
+ if (o) return S.parse(o);
317
+ }
318
+ const s = r();
319
+ await t.kv.add({ key: P, value: { useruuid: s } });
320
+ const i = S.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 = E(await t.kv.get(P));
329
+ if (s) {
330
+ const i = await t.users.get(s);
331
+ if (i) return S.parse(i);
332
+ }
333
+ }
334
+ throw a;
335
+ }
336
+ }
337
+ const $t = async (r) => (await B(r)).uuid;
338
+ async function wt() {
339
+ const r = await g(), t = {};
340
+ for (const e of r.tables)
341
+ t[e.name] = await e.toArray();
342
+ return t;
138
343
  }
139
- async function j(a) {
140
- const e = await (await w()).kv.get(a);
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 K(r) {
351
+ const e = await (await g()).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 W(r, t) {
355
+ await (await g()).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 g()).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 _t(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 g()).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 g()).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 g()).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,60 +393,62 @@ 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 Y = (r, t) => `favorites:${r}:${t}`;
397
+ async function z(r) {
398
+ const t = await g(), { uuid: e } = await B(), a = Y(e, String(r)), s = await t.kv.get(a), i = s ? j.safeParse(s.value) : null;
399
+ return i != null && i.success ? i.data.unitIds : [];
400
+ }
401
+ async function Z(r, t, e) {
402
+ const a = await g(), { uuid: s } = await B(), i = Y(s, String(r));
403
+ return a.transaction("rw", a.kv, async () => {
404
+ const o = await a.kv.get(i), l = o && j.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 c = {
407
+ unitIds: [...u],
408
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
409
+ }, y = j.parse(c);
410
+ return await a.kv.put({ key: i, value: y }), y.unitIds;
411
+ });
412
+ }
413
+ async function ht(r, t) {
414
+ const a = !(await z(r)).includes(t);
415
+ return Z(r, t, a);
416
+ }
417
+ async function St(r, t) {
418
+ return (await z(r)).includes(t);
419
+ }
420
+ const V = {
207
421
  data: {},
208
422
  propertySlug: null,
209
423
  propertyId: null,
210
424
  hasPreviouslySearched: []
211
425
  };
212
- class Z {
426
+ class mt {
213
427
  async getState() {
214
- return await j("property") ?? Y;
215
- }
216
- async setState(t) {
217
- const e = await this.getState(), r = t(e);
218
- await E("property", r);
219
- }
220
- // Basic state operations
221
- async setData(t) {
222
- await this.setState((e) => ({ ...e, data: t }));
223
- }
224
- async setPropertySlug(t) {
225
- await this.setState((e) => ({ ...e, propertySlug: t }));
226
- }
227
- async setPropertyId(t) {
228
- await this.setState((e) => ({ ...e, propertyId: t }));
229
- }
230
- async removeData(t) {
231
- await this.setState((e) => ({
428
+ const t = await K("property");
429
+ if (!t) return V;
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 = C.safeParse(e);
436
+ if (a.success) return a.data;
437
+ const s = Object.entries(e.data ?? {}).reduce((l, [u, c]) => {
438
+ const y = A.safeParse(c);
439
+ return y.success && (l[u] = y.data), l;
440
+ }, {}), i = {
441
+ ...V,
232
442
  ...e,
233
- data: Object.entries(e.data).filter(([r]) => r !== t).reduce((r, [s, i]) => ({ ...r, [s]: i }), {})
234
- }));
443
+ data: s
444
+ }, o = C.safeParse(i);
445
+ return o.success ? o.data : V;
235
446
  }
236
- async clearData() {
237
- await this.setState((t) => ({ ...t, data: {} }));
447
+ async setState(t) {
448
+ const e = await this.getState(), a = t(e), s = C.parse(a);
449
+ await W("property", s);
238
450
  }
451
+ // Basic state operations (legacy direct setters removed in vNext)
239
452
  async setHasPreviouslySearched(t) {
240
453
  await this.setState((e) => ({
241
454
  ...e,
@@ -249,13 +462,13 @@ class Z {
249
462
  await this.setState((t) => {
250
463
  const e = t.propertyId;
251
464
  if (!e) return t;
252
- const r = t.data[e];
253
- return r ? {
465
+ const a = t.data[e];
466
+ return a ? {
254
467
  ...t,
255
468
  data: {
256
469
  ...t.data,
257
470
  [e]: {
258
- ...r,
471
+ ...a,
259
472
  tourContactedOn: (/* @__PURE__ */ new Date()).toISOString()
260
473
  }
261
474
  }
@@ -263,20 +476,20 @@ class Z {
263
476
  });
264
477
  }
265
478
  async getTourContactedOn() {
266
- var r;
479
+ var a;
267
480
  const t = await this.getState(), e = t.propertyId;
268
- return e ? ((r = t.data[e]) == null ? void 0 : r.tourContactedOn) ?? null : null;
481
+ return e ? ((a = t.data[e]) == null ? void 0 : a.tourContactedOn) ?? null : null;
269
482
  }
270
483
  async setQuestionnaireResults(t) {
271
484
  await this.setState((e) => {
272
- const r = e.propertyId;
273
- if (!r) return e;
274
- const s = e.data[r];
485
+ const a = e.propertyId;
486
+ if (!a) return e;
487
+ const s = e.data[a];
275
488
  return s ? {
276
489
  ...e,
277
490
  data: {
278
491
  ...e.data,
279
- [r]: {
492
+ [a]: {
280
493
  ...s,
281
494
  questionnaireResults: t
282
495
  }
@@ -286,14 +499,14 @@ class Z {
286
499
  }
287
500
  async setTourContactData(t) {
288
501
  await this.setState((e) => {
289
- const r = e.propertyId;
290
- if (!r) return e;
291
- const s = e.data[r];
502
+ const a = e.propertyId;
503
+ if (!a) return e;
504
+ const s = e.data[a];
292
505
  return s ? {
293
506
  ...e,
294
507
  data: {
295
508
  ...e.data,
296
- [r]: {
509
+ [a]: {
297
510
  ...s,
298
511
  tourContactData: t
299
512
  }
@@ -303,16 +516,16 @@ class Z {
303
516
  }
304
517
  async toggleFavorite(t) {
305
518
  await this.setState((e) => {
306
- const r = e.propertyId;
307
- if (!r) return e;
308
- const s = e.data[r];
519
+ const a = e.propertyId;
520
+ if (!a) return e;
521
+ const s = e.data[a];
309
522
  if (!s) return e;
310
523
  const o = s.favoritedUnits.includes(t) ? s.favoritedUnits.filter((l) => l !== t) : [...s.favoritedUnits, t];
311
524
  return {
312
525
  ...e,
313
526
  data: {
314
527
  ...e.data,
315
- [r]: {
528
+ [a]: {
316
529
  ...s,
317
530
  favoritedUnits: o
318
531
  }
@@ -321,10 +534,10 @@ class Z {
321
534
  });
322
535
  }
323
536
  async markUnitAsViewed(t, e) {
324
- const r = /* @__PURE__ */ new Date(), s = `${String(r.getMonth() + 1).padStart(
537
+ const a = /* @__PURE__ */ new Date(), s = `${String(a.getMonth() + 1).padStart(
325
538
  2,
326
539
  "0"
327
- )}/${String(r.getDate()).padStart(2, "0")}`;
540
+ )}/${String(a.getDate()).padStart(2, "0")}`;
328
541
  await this.setState((i) => {
329
542
  const o = i.propertyId;
330
543
  if (!o) return i;
@@ -332,7 +545,7 @@ class Z {
332
545
  if (!l) return i;
333
546
  const u = [
334
547
  // Remove existing entry if it exists
335
- ...l.viewedUnits.filter((y) => y.unitId !== t),
548
+ ...l.viewedUnits.filter((c) => c.unitId !== t),
336
549
  // Add updated one
337
550
  {
338
551
  unitId: t,
@@ -354,15 +567,15 @@ class Z {
354
567
  // Utility methods for getting specific data
355
568
  async getUnitState(t) {
356
569
  var s;
357
- const e = await this.getState(), r = e.propertyId ? e.data[e.propertyId] : null;
570
+ const e = await this.getState(), a = e.propertyId ? e.data[e.propertyId] : null;
358
571
  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) ?? ""
572
+ isFavorite: (a == null ? void 0 : a.favoritedUnits.includes(t)) ?? !1,
573
+ viewedDate: ((s = a == null ? void 0 : a.viewedUnits.find((i) => i.unitId === t)) == null ? void 0 : s.viewedDate) ?? ""
361
574
  };
362
575
  }
363
576
  async getPropertyData(t) {
364
- const e = await this.getState(), r = t ?? e.propertyId;
365
- return r ? e.data[r] ?? null : null;
577
+ const e = await this.getState(), a = t == null ? e.propertyId : String(t);
578
+ return a ? e.data[a] ?? null : null;
366
579
  }
367
580
  async getCurrentProperty() {
368
581
  const t = await this.getState();
@@ -373,14 +586,15 @@ class Z {
373
586
  }
374
587
  // Initialize property if it doesn't exist
375
588
  async initializeProperty(t, e) {
376
- await this.setState((r) => r.data[t] ? { ...r, propertyId: t, propertySlug: e } : {
377
- ...r,
378
- propertyId: t,
589
+ const a = String(t);
590
+ await this.setState((s) => s.data[a] ? { ...s, propertyId: a, propertySlug: e } : {
591
+ ...s,
592
+ propertyId: a,
379
593
  propertySlug: e,
380
594
  data: {
381
- ...r.data,
382
- [t]: {
383
- id: t,
595
+ ...s.data,
596
+ [a]: {
597
+ id: a,
384
598
  slug: e,
385
599
  favoritedUnits: [],
386
600
  tourContactedOn: null,
@@ -392,78 +606,7 @@ class Z {
392
606
  });
393
607
  }
394
608
  }
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 = {
609
+ const xt = new mt(), x = {
467
610
  availability: void 0,
468
611
  bedrooms: void 0,
469
612
  cost: void 0,
@@ -475,44 +618,83 @@ const tt = n.object({
475
618
  currentPropertySlug: null,
476
619
  hasPreviouslySearched: [],
477
620
  // App data
478
- filters: T,
479
- tempFilters: T,
621
+ unitResults: [],
622
+ filters: x,
623
+ tempFilters: x,
480
624
  apiFilters: {
481
625
  limit: 10,
482
626
  page: 1
483
627
  },
484
628
  resultsMode: "all",
485
629
  resolvedQuestionnaireValues: {},
486
- sortBy: "relevance",
487
- filtersLoaded: !1
630
+ sortBy: "relevance"
631
+ }, vt = (r) => r == null ? [] : Array.isArray(r) ? r : [r], X = (r) => vt(r).flatMap((t) => {
632
+ if (t == null) return [];
633
+ if (Array.isArray(t)) return t;
634
+ if (typeof t == "object" && "value" in t) {
635
+ const e = t.value;
636
+ return Array.isArray(e) ? e : e != null ? [e] : [];
637
+ }
638
+ return [t];
639
+ }), H = (r) => X(r).flatMap((t) => Array.isArray(t) ? t : [t]).map((t) => String(t)).map((t) => t.trim()).filter((t) => t.length > 0), bt = (r) => X(r).map((t) => {
640
+ if (typeof t == "number" && Number.isFinite(t)) return t;
641
+ const e = Number(t);
642
+ return Number.isFinite(e) ? e : null;
643
+ }).filter((t) => t !== null), tt = (r) => {
644
+ if (r == null) return null;
645
+ if (typeof r == "number") return Number.isFinite(r) ? r : null;
646
+ if (typeof r == "object" && "value" in r)
647
+ return tt(r.value);
648
+ const t = Number(r);
649
+ return Number.isFinite(t) ? t : null;
488
650
  };
489
- class it {
651
+ class Pt {
490
652
  async getState() {
491
- const t = await j("app");
492
- return t ? {
653
+ const t = await K("app");
654
+ if (!t)
655
+ return U;
656
+ const e = {
493
657
  ...U,
494
658
  ...t,
495
- properties: t.properties ?? {}
496
- } : U;
659
+ properties: t.properties ?? {},
660
+ unitResults: t.unitResults ?? [],
661
+ currentPropertyId: t.currentPropertyId == null ? null : String(t.currentPropertyId),
662
+ currentPropertySlug: t.currentPropertySlug ?? null,
663
+ hasPreviouslySearched: Array.isArray(t.hasPreviouslySearched) ? t.hasPreviouslySearched.map(String) : []
664
+ }, a = O.safeParse(e);
665
+ if (a.success) return a.data;
666
+ const s = Object.entries(e.properties ?? {}).reduce((c, [y, p]) => {
667
+ const f = A.safeParse(p);
668
+ return f.success && (c[y] = f.data), c;
669
+ }, {}), o = (Array.isArray(e.unitResults) ? e.unitResults : e.unitResults && typeof e.unitResults == "object" ? Object.values(e.unitResults) : []).reduce((c, y) => {
670
+ const p = b.safeParse(y);
671
+ return p.success && c.push(p.data), c;
672
+ }, []), l = {
673
+ ...e,
674
+ properties: s,
675
+ unitResults: o
676
+ }, u = O.safeParse(l);
677
+ return u.success ? u.data : U;
497
678
  }
498
679
  async setState(t) {
499
- const e = await this.getState(), r = t(e);
500
- await E("app", r);
680
+ const e = await this.getState(), a = t(e), s = O.parse(a);
681
+ await W("app", s);
501
682
  }
502
683
  // === PROPERTY OPERATIONS ===
503
684
  async initializeProperty(t, e) {
504
- await this.setState((r) => r.properties && r.properties[t] ? {
505
- ...r,
506
- currentPropertyId: t,
685
+ const a = String(t);
686
+ await this.setState((s) => s.properties && s.properties[a] ? {
687
+ ...s,
688
+ currentPropertyId: a,
507
689
  currentPropertySlug: e
508
690
  } : {
509
- ...r,
510
- currentPropertyId: t,
691
+ ...s,
692
+ currentPropertyId: a,
511
693
  currentPropertySlug: e,
512
694
  properties: {
513
- ...r.properties,
514
- [t]: {
515
- id: t,
695
+ ...s.properties,
696
+ [a]: {
697
+ id: a,
516
698
  slug: e,
517
699
  favoritedUnits: [],
518
700
  tourContactedOn: null,
@@ -523,11 +705,121 @@ class it {
523
705
  }
524
706
  });
525
707
  }
708
+ // === UNIT RESULTS CACHE ===
709
+ async setUnitResults(t, e) {
710
+ const a = e ?? b, s = [];
711
+ (Array.isArray(t) ? t : t && typeof t == "object" ? Object.values(t) : []).forEach((o, l) => {
712
+ const u = w(a, o, `unitResults[${l}]`);
713
+ u && s.push(u);
714
+ }), await this.setState((o) => ({
715
+ ...o,
716
+ unitResults: s
717
+ }));
718
+ }
719
+ async clearUnitResults() {
720
+ await this.setState((t) => ({
721
+ ...t,
722
+ unitResults: []
723
+ }));
724
+ }
725
+ // === PROPERTY DATA BAG (full property payloads & custom data) ===
726
+ async setPropertyData(t, e, a) {
727
+ const s = String(t), i = a ?? v;
728
+ await this.setState((o) => {
729
+ const l = o.properties[s];
730
+ if (!l) return o;
731
+ const u = w(i, e, `properties.${s}.data`);
732
+ return u ? {
733
+ ...o,
734
+ properties: {
735
+ ...o.properties,
736
+ [s]: {
737
+ ...l,
738
+ data: u
739
+ }
740
+ }
741
+ } : o;
742
+ });
743
+ }
744
+ async mergePropertyData(t, e, a) {
745
+ const s = String(t), i = a ?? v;
746
+ await this.setState((o) => {
747
+ const l = o.properties[s];
748
+ if (!l) return o;
749
+ const u = l.data;
750
+ if (!u) {
751
+ const f = w(i, e, `properties.${s}.data`);
752
+ return f ? {
753
+ ...o,
754
+ properties: {
755
+ ...o.properties,
756
+ [s]: {
757
+ ...l,
758
+ data: f
759
+ }
760
+ }
761
+ } : o;
762
+ }
763
+ const c = i.partial(), y = w(
764
+ c,
765
+ e,
766
+ `properties.${s}.data.partial`
767
+ );
768
+ if (!y) return o;
769
+ const p = w(
770
+ i,
771
+ { ...u, ...y },
772
+ `properties.${s}.data`
773
+ );
774
+ return p ? {
775
+ ...o,
776
+ properties: {
777
+ ...o.properties,
778
+ [s]: {
779
+ ...l,
780
+ data: p
781
+ }
782
+ }
783
+ } : o;
784
+ });
785
+ }
786
+ // Accepts a full API property object, validates, and stores it into the
787
+ // per-property `data` bag. Ensures the property entry exists/updated.
788
+ async upsertPropertyFromApi(t, e) {
789
+ const s = (e ?? v).parse(t), i = s.id ?? s.propertyId;
790
+ if (i == null)
791
+ throw new Error("upsertPropertyFromApi: property id is required");
792
+ const o = String(i), l = s.slug ?? void 0;
793
+ await this.setState((u) => {
794
+ const c = u.properties[o], y = c ? {
795
+ ...c,
796
+ ...l ? { slug: l } : {},
797
+ data: s
798
+ } : {
799
+ id: o,
800
+ slug: l ?? "",
801
+ favoritedUnits: [],
802
+ tourContactedOn: null,
803
+ viewedUnits: [],
804
+ questionnaireResults: null,
805
+ tourContactData: null,
806
+ data: s
807
+ };
808
+ return {
809
+ ...u,
810
+ properties: {
811
+ ...u.properties,
812
+ [o]: y
813
+ }
814
+ };
815
+ });
816
+ }
526
817
  async setCurrentProperty(t, e) {
527
- await this.setState((r) => ({
528
- ...r,
529
- currentPropertyId: t,
530
- currentPropertySlug: e || r.currentPropertySlug
818
+ const a = String(t);
819
+ await this.setState((s) => ({
820
+ ...s,
821
+ currentPropertyId: a,
822
+ currentPropertySlug: e || s.currentPropertySlug
531
823
  }));
532
824
  }
533
825
  async setCurrentPropertySlug(t) {
@@ -546,16 +838,16 @@ class it {
546
838
  }
547
839
  async toggleFavorite(t) {
548
840
  await this.setState((e) => {
549
- const r = e.currentPropertyId;
550
- if (!r) return e;
551
- const s = e.properties[r];
841
+ const a = e.currentPropertyId;
842
+ if (!a) return e;
843
+ const s = e.properties[a];
552
844
  if (!s) return e;
553
845
  const o = s.favoritedUnits.includes(t) ? s.favoritedUnits.filter((l) => l !== t) : [...s.favoritedUnits, t];
554
846
  return {
555
847
  ...e,
556
848
  properties: {
557
849
  ...e.properties,
558
- [r]: {
850
+ [a]: {
559
851
  ...s,
560
852
  favoritedUnits: o
561
853
  }
@@ -564,17 +856,17 @@ class it {
564
856
  });
565
857
  }
566
858
  async markUnitAsViewed(t, e) {
567
- const r = /* @__PURE__ */ new Date(), s = `${String(r.getMonth() + 1).padStart(
859
+ const a = /* @__PURE__ */ new Date(), s = `${String(a.getMonth() + 1).padStart(
568
860
  2,
569
861
  "0"
570
- )}/${String(r.getDate()).padStart(2, "0")}`;
862
+ )}/${String(a.getDate()).padStart(2, "0")}`;
571
863
  await this.setState((i) => {
572
864
  const o = i.currentPropertyId;
573
865
  if (!o) return i;
574
866
  const l = i.properties[o];
575
867
  if (!l) return i;
576
868
  const u = [
577
- ...l.viewedUnits.filter((y) => y.unitId !== t),
869
+ ...l.viewedUnits.filter((c) => c.unitId !== t),
578
870
  { unitId: t, viewedDate: s }
579
871
  ];
580
872
  return {
@@ -593,13 +885,13 @@ class it {
593
885
  await this.setState((t) => {
594
886
  const e = t.currentPropertyId;
595
887
  if (!e) return t;
596
- const r = t.properties[e];
597
- return r ? {
888
+ const a = t.properties[e];
889
+ return a ? {
598
890
  ...t,
599
891
  properties: {
600
892
  ...t.properties,
601
893
  [e]: {
602
- ...r,
894
+ ...a,
603
895
  tourContactedOn: (/* @__PURE__ */ new Date()).toISOString()
604
896
  }
605
897
  }
@@ -607,20 +899,20 @@ class it {
607
899
  });
608
900
  }
609
901
  async getTourContactedOn() {
610
- var r;
902
+ var a;
611
903
  const t = await this.getState(), e = t.currentPropertyId;
612
- return e ? ((r = t.properties[e]) == null ? void 0 : r.tourContactedOn) ?? null : null;
904
+ return e ? ((a = t.properties[e]) == null ? void 0 : a.tourContactedOn) ?? null : null;
613
905
  }
614
906
  async setQuestionnaireResults(t) {
615
907
  await this.setState((e) => {
616
- const r = e.currentPropertyId;
617
- if (!r) return e;
618
- const s = e.properties[r];
908
+ const a = e.currentPropertyId;
909
+ if (!a) return e;
910
+ const s = e.properties[a];
619
911
  return s ? {
620
912
  ...e,
621
913
  properties: {
622
914
  ...e.properties,
623
- [r]: {
915
+ [a]: {
624
916
  ...s,
625
917
  questionnaireResults: t
626
918
  }
@@ -630,14 +922,14 @@ class it {
630
922
  }
631
923
  async setTourContactData(t) {
632
924
  await this.setState((e) => {
633
- const r = e.currentPropertyId;
634
- if (!r) return e;
635
- const s = e.properties[r];
925
+ const a = e.currentPropertyId;
926
+ if (!a) return e;
927
+ const s = e.properties[a];
636
928
  return s ? {
637
929
  ...e,
638
930
  properties: {
639
931
  ...e.properties,
640
- [r]: {
932
+ [a]: {
641
933
  ...s,
642
934
  tourContactData: t
643
935
  }
@@ -659,7 +951,7 @@ class it {
659
951
  }));
660
952
  }
661
953
  async setFiltersToDefault() {
662
- await this.setState((t) => ({ ...t, filters: T }));
954
+ await this.setState((t) => ({ ...t, filters: x }));
663
955
  }
664
956
  async setApiFilters(t) {
665
957
  await this.setState((e) => ({
@@ -668,42 +960,19 @@ class it {
668
960
  }));
669
961
  }
670
962
  async handleTempFilterChange(t, e) {
671
- await this.setState((r) => ({
672
- ...r,
673
- tempFilters: { ...r.tempFilters, [t]: e }
963
+ await this.setState((a) => ({
964
+ ...a,
965
+ tempFilters: { ...a.tempFilters, [t]: e }
674
966
  }));
675
967
  }
676
- async commitTempFilterChange(t, e) {
677
- const s = (await this.getState()).tempFilters[t] ?? e;
678
- await this.handleTempFilterChange(t, s), await this.submitFilterUpdate();
679
- }
680
- async handleFilterCommitIndexDB(t) {
681
- await this.setState((e) => {
682
- const r = {
683
- ...e.apiFilters,
684
- availability: t.availability || [],
685
- bedrooms: t.bedrooms || [],
686
- cost: t.cost || null,
687
- highlights: t.highlights || []
688
- };
689
- return {
690
- ...e,
691
- filters: { ...e.filters, ...t },
692
- apiFilters: r
693
- };
694
- });
695
- }
696
- async commitAvailabilityChange() {
697
- await this.submitFilterUpdate();
698
- }
699
968
  async submitFilterUpdate() {
700
969
  await this.setState((t) => {
701
970
  const e = {
702
971
  ...t.apiFilters,
703
- availability: t.filters.availability || [],
704
- bedrooms: t.filters.bedrooms || [],
705
- cost: t.filters.cost || null,
706
- highlights: t.filters.highlights || []
972
+ availability: H(t.filters.availability),
973
+ bedrooms: bt(t.filters.bedrooms),
974
+ cost: tt(t.filters.cost),
975
+ highlights: H(t.filters.highlights)
707
976
  };
708
977
  return {
709
978
  ...t,
@@ -720,10 +989,10 @@ class it {
720
989
  }
721
990
  // === QUESTIONNAIRE ===
722
991
  async setResolvedQuestionnaireValues(t, e) {
723
- await this.setState((r) => ({
724
- ...r,
992
+ await this.setState((a) => ({
993
+ ...a,
725
994
  resolvedQuestionnaireValues: {
726
- ...r.resolvedQuestionnaireValues,
995
+ ...a.resolvedQuestionnaireValues,
727
996
  [t]: e
728
997
  }
729
998
  }));
@@ -731,10 +1000,10 @@ class it {
731
1000
  // === UTILITY METHODS ===
732
1001
  async getUnitState(t) {
733
1002
  var s;
734
- const e = await this.getState(), r = e.currentPropertyId ? e.properties[e.currentPropertyId] : null;
1003
+ const e = await this.getState(), a = e.currentPropertyId ? e.properties[e.currentPropertyId] : null;
735
1004
  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) ?? ""
1005
+ isFavorite: (a == null ? void 0 : a.favoritedUnits.includes(t)) ?? !1,
1006
+ viewedDate: ((s = a == null ? void 0 : a.viewedUnits.find((i) => i.unitId === t)) == null ? void 0 : s.viewedDate) ?? ""
738
1007
  };
739
1008
  }
740
1009
  async getResultsUrl() {
@@ -746,152 +1015,38 @@ class it {
746
1015
  return t.currentPropertyId ? t.properties[t.currentPropertyId] ?? null : null;
747
1016
  }
748
1017
  async getPropertyData(t) {
749
- const e = await this.getState(), r = t ?? e.currentPropertyId;
750
- return r ? e.properties[r] ?? null : null;
1018
+ const e = await this.getState(), a = t == null ? e.currentPropertyId : String(t);
1019
+ return a ? e.properties[a] ?? null : null;
751
1020
  }
752
1021
  async getFullState() {
753
1022
  return this.getState();
754
1023
  }
755
1024
  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
- }));
762
- }
763
- async loadPersistedFilters() {
764
- await this.setState((t) => ({ ...t, filtersLoaded: !0 }));
765
- }
766
- // === LEGACY COMPATIBILITY METHODS ===
767
- // Property store compatibility
768
- async setData(t) {
769
- await this.setState((e) => ({ ...e, properties: t }));
770
- }
771
- async setPropertySlug(t) {
772
- await this.setCurrentPropertySlug(t);
773
- }
774
- async setPropertyId(t) {
775
- await this.setCurrentProperty(t);
776
- }
777
- async removeData(t) {
778
- await this.setState((e) => {
779
- const { [t]: r, ...s } = e.properties;
780
- return { ...e, properties: s };
781
- });
782
- }
783
- async clearData() {
784
- await this.setState((t) => ({ ...t, properties: {} }));
1025
+ await this.setState((t) => ({ ...U, ...t }));
785
1026
  }
786
1027
  }
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) {
1028
+ const d = new Pt();
1029
+ function Ut(r) {
875
1030
  return (t, e) => {
876
- const r = async () => {
877
- const i = await c.getFullState();
1031
+ const a = async () => {
1032
+ const i = await d.getFullState();
878
1033
  t({
879
1034
  properties: i.properties,
880
1035
  currentPropertyId: i.currentPropertyId,
881
1036
  currentPropertySlug: i.currentPropertySlug,
882
1037
  hasPreviouslySearched: i.hasPreviouslySearched,
1038
+ unitResults: i.unitResults,
883
1039
  filters: i.filters,
884
1040
  tempFilters: i.tempFilters,
885
1041
  apiFilters: i.apiFilters,
886
1042
  resultsMode: i.resultsMode,
887
1043
  resolvedQuestionnaireValues: i.resolvedQuestionnaireValues,
888
- sortBy: i.sortBy,
889
- filtersLoaded: i.filtersLoaded
1044
+ sortBy: i.sortBy
890
1045
  });
891
1046
  }, s = async () => {
892
- if (a != null && a.onFilterUpdate) {
893
- const i = (await c.getFullState()).apiFilters;
894
- a.onFilterUpdate(i);
1047
+ if (r != null && r.onFilterUpdate) {
1048
+ const i = (await d.getFullState()).apiFilters;
1049
+ r.onFilterUpdate(i);
895
1050
  }
896
1051
  };
897
1052
  return {
@@ -900,7 +1055,7 @@ function ct(a) {
900
1055
  currentPropertyId: null,
901
1056
  currentPropertySlug: null,
902
1057
  hasPreviouslySearched: [],
903
- units: {},
1058
+ unitResults: [],
904
1059
  filters: {
905
1060
  availability: void 0,
906
1061
  bedrooms: void 0,
@@ -923,49 +1078,55 @@ function ct(a) {
923
1078
  filtersLoaded: !1,
924
1079
  // === PROPERTY OPERATIONS ===
925
1080
  async initializeProperty(i, o) {
926
- await c.initializeProperty(i, o), await r();
1081
+ await d.initializeProperty(i, o), await a();
927
1082
  },
928
1083
  async setCurrentProperty(i, o) {
929
- await c.setCurrentProperty(i, o), t({
1084
+ await d.setCurrentProperty(i, o), t({
930
1085
  currentPropertyId: i,
931
1086
  ...o && { currentPropertySlug: o }
932
1087
  });
933
1088
  },
934
1089
  async setCurrentPropertySlug(i) {
935
- await c.setCurrentPropertySlug(i), t({ currentPropertySlug: i });
1090
+ await d.setCurrentPropertySlug(i), t({ currentPropertySlug: i });
936
1091
  },
937
1092
  async setHasPreviouslySearched(i) {
938
- await c.setHasPreviouslySearched(i), await r();
1093
+ await d.setHasPreviouslySearched(i), await a();
939
1094
  },
940
1095
  async toggleFavorite(i) {
941
- await c.toggleFavorite(i), await r();
1096
+ await d.toggleFavorite(i), await a();
942
1097
  },
943
1098
  async markUnitAsViewed(i, o) {
944
- await c.markUnitAsViewed(i, o), await r();
1099
+ await d.markUnitAsViewed(i, o), await a();
945
1100
  },
946
1101
  async setTourContactedOn() {
947
- await c.setTourContactedOn(), await r();
1102
+ await d.setTourContactedOn(), await a();
948
1103
  },
949
- getTourContactedOn: c.getTourContactedOn.bind(c),
1104
+ getTourContactedOn: d.getTourContactedOn.bind(d),
950
1105
  async setQuestionnaireResults(i) {
951
- await c.setQuestionnaireResults(i), await r();
1106
+ await d.setQuestionnaireResults(i), await a();
952
1107
  },
953
1108
  async setTourContactData(i) {
954
- await c.setTourContactData(i), await r();
1109
+ await d.setTourContactData(i), await a();
1110
+ },
1111
+ async setUnitResults(i) {
1112
+ await d.setUnitResults(i), await a();
1113
+ },
1114
+ async clearUnitResults() {
1115
+ await d.clearUnitResults(), await a();
955
1116
  },
956
1117
  // === FILTER OPERATIONS ===
957
1118
  async setFilters(i) {
958
- await c.setFilters(i);
1119
+ await d.setFilters(i);
959
1120
  const o = e();
960
1121
  t({ filters: { ...o.filters, ...i } });
961
1122
  },
962
1123
  async setTempFilters(i) {
963
- await c.setTempFilters(i);
1124
+ await d.setTempFilters(i);
964
1125
  const o = e();
965
1126
  t({ tempFilters: { ...o.tempFilters, ...i } });
966
1127
  },
967
1128
  async setFiltersToDefault() {
968
- await c.setFiltersToDefault(), t({ filters: {
1129
+ await d.setFiltersToDefault(), t({ filters: {
969
1130
  availability: void 0,
970
1131
  bedrooms: void 0,
971
1132
  cost: void 0,
@@ -973,37 +1134,28 @@ function ct(a) {
973
1134
  } });
974
1135
  },
975
1136
  async setApiFilters(i) {
976
- await c.setApiFilters(i);
1137
+ await d.setApiFilters(i);
977
1138
  const o = e();
978
1139
  t({ apiFilters: { ...o.apiFilters, ...i } });
979
1140
  },
980
1141
  async handleTempFilterChange(i, o) {
981
- await c.handleTempFilterChange(i, o);
1142
+ await d.handleTempFilterChange(i, o);
982
1143
  const l = e();
983
1144
  t({ tempFilters: { ...l.tempFilters, [i]: o } });
984
1145
  },
985
- async commitTempFilterChange(i, o) {
986
- await c.commitTempFilterChange(i, o), await r(), await s();
987
- },
988
- async handleFilterCommitIndexDB(i) {
989
- await c.handleFilterCommitIndexDB(i), await r(), await s();
990
- },
991
- async commitAvailabilityChange() {
992
- await c.commitAvailabilityChange(), await r(), await s();
993
- },
994
1146
  async submitFilterUpdate() {
995
- await c.submitFilterUpdate(), await r(), await s();
1147
+ await d.submitFilterUpdate(), await a(), await s();
996
1148
  },
997
1149
  // === RESULTS AND SORTING ===
998
1150
  async setResultsMode(i) {
999
- await c.setResultsMode(i), t({ resultsMode: i });
1151
+ await d.setResultsMode(i), t({ resultsMode: i });
1000
1152
  },
1001
1153
  async setSortBy(i) {
1002
- await c.setSortBy(i), t({ sortBy: i });
1154
+ await d.setSortBy(i), t({ sortBy: i });
1003
1155
  },
1004
1156
  // === QUESTIONNAIRE ===
1005
1157
  async setResolvedQuestionnaireValues(i, o) {
1006
- await c.setResolvedQuestionnaireValues(i, o);
1158
+ await d.setResolvedQuestionnaireValues(i, o);
1007
1159
  const l = e();
1008
1160
  t({
1009
1161
  resolvedQuestionnaireValues: {
@@ -1018,137 +1170,195 @@ function ct(a) {
1018
1170
  const o = e(), l = o.currentPropertyId ? o.properties[o.currentPropertyId] : null;
1019
1171
  return {
1020
1172
  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) ?? ""
1173
+ viewedDate: ((u = l == null ? void 0 : l.viewedUnits.find((c) => c.unitId === i)) == null ? void 0 : u.viewedDate) ?? ""
1022
1174
  };
1023
1175
  },
1024
- getResultsUrl: c.getResultsUrl.bind(c),
1025
- getCurrentProperty: c.getCurrentProperty.bind(c),
1026
- getPropertyData: c.getPropertyData.bind(c),
1027
- // === LEGACY COMPATIBILITY ===
1028
- async setData(i) {
1029
- await c.setData(i), t({ properties: i });
1030
- },
1031
- async setPropertySlug(i) {
1032
- await c.setPropertySlug(i), t({ currentPropertySlug: i });
1033
- },
1034
- async setPropertyId(i) {
1035
- await c.setPropertyId(i), t({ currentPropertyId: i });
1036
- },
1037
- async removeData(i) {
1038
- await c.removeData(i), await r();
1039
- },
1040
- async clearData() {
1041
- await c.clearData(), t({ properties: {} });
1042
- },
1043
- async loadPersistedFilters() {
1044
- await c.loadPersistedFilters(), t({ filtersLoaded: !0 });
1045
- },
1176
+ getResultsUrl: d.getResultsUrl.bind(d),
1177
+ getCurrentProperty: d.getCurrentProperty.bind(d),
1178
+ getPropertyData: d.getPropertyData.bind(d),
1046
1179
  // === INTERNAL ===
1047
1180
  async _hydrate() {
1048
- await r();
1181
+ await a();
1049
1182
  },
1050
1183
  async _initialize() {
1051
- await c.initialize(), await r();
1184
+ await d.initialize(), await a(), t({ filtersLoaded: !0 });
1052
1185
  }
1053
1186
  };
1054
1187
  };
1055
1188
  }
1056
- function Pt() {
1057
- return (a) => (t) => a((e) => e.getUnitState(t));
1189
+ function Bt() {
1190
+ return (r) => (t) => r((e) => e.getUnitState(t));
1058
1191
  }
1059
- function ut(a) {
1192
+ function Ft(r, t) {
1060
1193
  return {
1061
1194
  property: {
1062
1195
  unit: {
1063
1196
  favorites: {
1064
- toggle: a.toggleFavorite.bind(a)
1197
+ toggle: r.toggleFavorite.bind(r)
1065
1198
  },
1066
1199
  viewed: {
1067
- mark: a.markUnitAsViewed.bind(a)
1200
+ mark: r.markUnitAsViewed.bind(r)
1068
1201
  }
1069
1202
  },
1070
1203
  questionnaire: {
1071
- setResults: a.setQuestionnaireResults.bind(a)
1204
+ setResults: r.setQuestionnaireResults.bind(r)
1072
1205
  },
1073
1206
  tour: {
1074
- setContactedOn: a.setTourContactedOn.bind(a),
1075
- getContactedOn: a.getTourContactedOn.bind(a),
1076
- setContactData: a.setTourContactData.bind(a)
1207
+ setContactedOn: r.setTourContactedOn.bind(r),
1208
+ getContactedOn: r.getTourContactedOn.bind(r),
1209
+ setContactData: r.setTourContactData.bind(r)
1077
1210
  }
1078
1211
  },
1079
1212
  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)
1213
+ set: r.setFilters.bind(r),
1214
+ setTemp: r.setTempFilters.bind(r),
1215
+ setToDefault: r.setFiltersToDefault.bind(r),
1216
+ commitTemp: async (e, a) => {
1217
+ const i = (t ? t() : r).tempFilters[e] ?? a;
1218
+ await r.handleTempFilterChange(e, i), await r.submitFilterUpdate();
1219
+ },
1220
+ commitAvailability: async () => {
1221
+ await r.submitFilterUpdate();
1222
+ },
1223
+ submit: r.submitFilterUpdate.bind(r)
1086
1224
  }
1087
1225
  };
1088
1226
  }
1089
- function Ft(a) {
1227
+ function zt(r) {
1090
1228
  return (t, e) => {
1091
- const r = ct(a)(t, e), s = ut(r);
1229
+ const a = Ut(r)(t, e), s = Ft(a, e);
1092
1230
  return {
1093
- ...r,
1231
+ ...a,
1094
1232
  ...s
1095
1233
  };
1096
1234
  };
1097
1235
  }
1098
- const Dt = {
1099
- async isFavorite(a, t) {
1100
- return lt(a, t);
1236
+ const Lt = {
1237
+ async isFavorite(r, t) {
1238
+ return St(r, t);
1101
1239
  },
1102
- async toggle(a, t) {
1103
- return ot(a, t);
1240
+ async toggle(r, t) {
1241
+ return ht(r, t);
1104
1242
  },
1105
- async set(a, t, e) {
1106
- return Q(a, t, e);
1243
+ async set(r, t, e) {
1244
+ return Z(r, t, e);
1107
1245
  },
1108
- async getAll(a) {
1109
- return V(a);
1246
+ async getAll(r) {
1247
+ return z(r);
1110
1248
  }
1111
- };
1249
+ }, et = "//web.inresiapp.com", rt = "/placeholder.jpg", It = (r) => r ? r.startsWith("?") ? r : `?${r}` : "", kt = (r, t, e = et) => `${e}/${t}/unit/${r}/explore`, $ = (r, t = rt) => !(r != null && r.CFURL) || !(r != null && r.name) || !(r != null && r.signature) ? t : `${r.CFURL}${r.name}${It(r.signature)}`;
1250
+ function Qt(r) {
1251
+ return { data: r };
1252
+ }
1253
+ function Ht(r, t, e) {
1254
+ var o, l;
1255
+ const a = (e == null ? void 0 : e.origin) ?? et, s = (e == null ? void 0 : e.placeholderImage) ?? rt, i = ((o = r.hits) == null ? void 0 : o.map((u) => {
1256
+ var f, L;
1257
+ const c = u._source ?? {}, y = typeof c.name == "string" ? c.name : typeof c.title == "string" ? c.title : "";
1258
+ return {
1259
+ ...c,
1260
+ title: y,
1261
+ slug: kt(String(c.slug ?? ""), t, a),
1262
+ imageUrl: $(c.image, s),
1263
+ secondaryImageUrl: $((f = c.additionalImages) == null ? void 0 : f[0], s),
1264
+ tertiaryImageUrl: $((L = c.additionalImages) == null ? void 0 : L[1], s)
1265
+ };
1266
+ })) ?? [];
1267
+ return {
1268
+ total: ((l = r.total) == null ? void 0 : l.value) ?? i.length,
1269
+ maxScore: r.max_score ?? null,
1270
+ type: r.type ?? "units",
1271
+ hits: i
1272
+ };
1273
+ }
1274
+ const Rt = {
1275
+ asap: "ASAP",
1276
+ next_month: "Next Month",
1277
+ "2_3_months": "2-3 Months",
1278
+ all: "Just Browsing"
1279
+ }, k = {
1280
+ 0: "Studio",
1281
+ 1: "1 Bed",
1282
+ 2: "2 Bed",
1283
+ 3: "3+ Bed"
1284
+ }, Dt = new Set(Object.values(k)), At = (r) => {
1285
+ if (!r || r.length === 0) return;
1286
+ const t = /* @__PURE__ */ new Set();
1287
+ for (const e of r) {
1288
+ if (typeof e == "number") {
1289
+ const s = k[e];
1290
+ s && t.add(s);
1291
+ continue;
1292
+ }
1293
+ const a = e.split(",").map((s) => s.trim());
1294
+ for (const s of a) {
1295
+ const i = Number.parseInt(s, 10);
1296
+ !Number.isNaN(i) && k[i] ? t.add(k[i]) : Dt.has(s) && t.add(s);
1297
+ }
1298
+ }
1299
+ return t.size > 0 ? Array.from(t) : void 0;
1300
+ }, qt = (r) => ({
1301
+ availability: r.availability && r.availability.length > 0 ? r.availability.map(
1302
+ (e) => Rt[e] ?? e
1303
+ ) : void 0,
1304
+ bedrooms: At(r.bedrooms),
1305
+ cost: r.cost ?? void 0,
1306
+ highlights: r.highlights ?? []
1307
+ });
1112
1308
  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,
1151
- c as store,
1152
- ot as toggleFavoriteUnit
1309
+ Mt as ApiUserSchema,
1310
+ Tt as AppStoreDataSchema,
1311
+ rt as DEFAULT_PLACEHOLDER_IMAGE,
1312
+ et as DEFAULT_WEB_ORIGIN,
1313
+ j as FavoritesSchema,
1314
+ D as FiltersSchema,
1315
+ it as OpenDBError,
1316
+ v as PropertySchema,
1317
+ mt as PropertyStore,
1318
+ C as PropertyStoreDataSchema,
1319
+ q as QueryParamsSchema,
1320
+ J as ResultsModeEnum,
1321
+ F as SCHEMA_VERSION,
1322
+ at as SchemaMismatchError,
1323
+ G as SortByEnum,
1324
+ Pt as Store,
1325
+ ct as TourContactDataSchema,
1326
+ Pt as UnifiedStore,
1327
+ O as UnifiedStoreDataSchema,
1328
+ ot as UnitDataSchema,
1329
+ Et as UnitFavoriteSchema,
1330
+ b as UnitSchema,
1331
+ A as UserPropertyStateSchema,
1332
+ S as UserSchema,
1333
+ st as UserUnitDataSchema,
1334
+ ut as ViewedUnitSchema,
1335
+ kt as buildExploreUrl,
1336
+ $ as buildImageUrl,
1337
+ dt as configureValidation,
1338
+ _t as createORMStringStorage,
1339
+ zt as createStructuredStore,
1340
+ Ft as createStructuredStoreActions,
1341
+ Bt as createUseUnitState,
1342
+ Ut as createZustandUnifiedStore,
1343
+ wt as debugDump,
1344
+ gt as defaultIdGenerator,
1345
+ B as ensureUser,
1346
+ jt as exportJSON,
1347
+ Lt as favorites,
1348
+ g as getDB,
1349
+ z as getFavoritedUnitsForProperty,
1350
+ $t as getUserUUID,
1351
+ St as isUnitFavorited,
1352
+ K as kvGet,
1353
+ Nt as kvRemove,
1354
+ W as kvSet,
1355
+ xt as propertyStore,
1356
+ Vt as resetDB,
1357
+ Z as setFavoriteUnit,
1358
+ d as store,
1359
+ ht as toggleFavoriteUnit,
1360
+ Qt as transformUnitsApiResponse,
1361
+ Ht as transformUnitsApiResponseToClient,
1362
+ qt as transformUnitsApiResponseToClientFilters
1153
1363
  };
1154
1364
  //# sourceMappingURL=index.mjs.map