your-ai-workflow-firebase-os 1.14.33 → 1.14.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/AddressField-CB1Fcjky.js +375 -0
  2. package/dist/AddressField-D6DDopAb.cjs +1 -0
  3. package/dist/ContactPopup-4BtLVjGR.cjs +12 -0
  4. package/dist/{ContactPopup-1WCSslWq.js → ContactPopup-B5REUbFQ.js} +3098 -3059
  5. package/dist/{PhoneInputField-CP17hM3V.cjs → PhoneInputField--czzDLvs.cjs} +1 -1
  6. package/dist/PhoneInputField-CDBg3Fnp.cjs +1 -0
  7. package/dist/PhoneInputField-CocVRoFq.js +2 -0
  8. package/dist/PhoneInputField-Rr4l-ycT.js +137 -0
  9. package/dist/address-COc6hg_p.cjs +1 -0
  10. package/dist/address-D6MYmA1-.js +653 -0
  11. package/dist/{bake-CF9BCoRK.cjs → bake-CoE6YF6b.cjs} +1 -1
  12. package/dist/{bake-BWgMK1wa.js → bake-nQ50yqgR.js} +1 -1
  13. package/dist/{PhoneInputField-Bll7PF7n.js → dist-C4ycpl2h.js} +280 -414
  14. package/dist/dist-CNztuGOG.cjs +1 -0
  15. package/dist/{fileBytes-CBsYdEIq.cjs → fileBytes-D14HGwff.cjs} +1 -1
  16. package/dist/{fileBytes-DEBKo1DE.js → fileBytes-DlijrLH3.js} +1 -1
  17. package/dist/lib/AuthContext.d.ts +1 -1
  18. package/dist/{lucide-react-D9Skn8EM.js → lucide-react-COexEoX9.js} +5876 -5876
  19. package/dist/lucide-react-DKUgoIFa.cjs +1 -0
  20. package/dist/renderer.cjs.js +1 -1
  21. package/dist/renderer.es.js +1 -1
  22. package/dist/server.cjs.js +1 -1
  23. package/dist/server.es.js +1 -1
  24. package/dist/vite.cjs.js +1 -1
  25. package/dist/vite.es.js +152 -140
  26. package/dist/your-ai-workflow-firebase-os.cjs.js +39 -38
  27. package/dist/your-ai-workflow-firebase-os.css +1 -1
  28. package/dist/your-ai-workflow-firebase-os.es.js +7749 -7346
  29. package/package.json +1 -1
  30. package/dist/ContactPopup-HiACSnxJ.cjs +0 -12
  31. package/dist/PhoneInputField-CrNTYSUD.js +0 -2
  32. package/dist/PhoneInputField-GOziIc5M.cjs +0 -1
  33. package/dist/lucide-react-DCNbQTK3.cjs +0 -1
  34. /package/dist/{aiModels-DkIALQ-X.cjs → aiModels-B-0sMw1p.cjs} +0 -0
  35. /package/dist/{aiModels-CvJ_xBO6.js → aiModels-BglD2xN5.js} +0 -0
  36. /package/dist/{pdf-Er1Vwxg3.cjs → pdf-BzpovRy7.cjs} +0 -0
  37. /package/dist/{pdf-CHY5b66t.js → pdf-DCVJgrkU.js} +0 -0
  38. /package/dist/{pdf.worker.min-CDfj1q2P.js → pdf.worker.min-C1w16YEr.js} +0 -0
  39. /package/dist/{pdf.worker.min-C8Ic-DXr.cjs → pdf.worker.min-DA-qak4Y.cjs} +0 -0
@@ -0,0 +1,375 @@
1
+ import { F as e, a as t, ct as n, ht as r, on as i } from "./lucide-react-COexEoX9.js";
2
+ import { i as a, t as o } from "./address-D6MYmA1-.js";
3
+ import { n as s, t as c } from "./dist-C4ycpl2h.js";
4
+ import { useEffect as l, useRef as u, useState as d } from "react";
5
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
6
+ //#region src/lib/countryList.ts
7
+ var m = null;
8
+ function h() {
9
+ return m || (m = c.map((e) => {
10
+ let t = s(e);
11
+ return {
12
+ iso2: t.iso2,
13
+ name: t.name
14
+ };
15
+ }).sort((e, t) => e.name.localeCompare(t.name)), m);
16
+ }
17
+ var g = (e) => h().find((t) => t.iso2 === String(e || "").toLowerCase())?.name || "", _ = {
18
+ "united states of america": "us",
19
+ usa: "us",
20
+ "u.s.": "us",
21
+ "u.s.a.": "us",
22
+ uk: "gb",
23
+ "great britain": "gb",
24
+ england: "gb",
25
+ scotland: "gb",
26
+ wales: "gb",
27
+ "northern ireland": "gb",
28
+ "russian federation": "ru",
29
+ deutschland: "de",
30
+ españa: "es",
31
+ italia: "it",
32
+ brasil: "br",
33
+ "south korea": "kr",
34
+ "republic of korea": "kr",
35
+ "north korea": "kp",
36
+ czechia: "cz",
37
+ "czech republic": "cz",
38
+ "viet nam": "vn",
39
+ türkiye: "tr",
40
+ "the netherlands": "nl",
41
+ holland: "nl",
42
+ uae: "ae",
43
+ "united arab emirates": "ae",
44
+ "hong kong sar": "hk",
45
+ macau: "mo",
46
+ "ivory coast": "ci",
47
+ "côte d'ivoire": "ci",
48
+ eswatini: "sz",
49
+ "myanmar (burma)": "mm",
50
+ burma: "mm"
51
+ };
52
+ function v(e) {
53
+ let t = String(e || "").trim().toLowerCase();
54
+ if (!t) return "";
55
+ if (/^[a-z]{2}$/.test(t) && h().some((e) => e.iso2 === t)) return t;
56
+ if (_[t]) return _[t];
57
+ let n = h().find((e) => e.name.toLowerCase() === t);
58
+ return n ? n.iso2 : h().find((e) => t.startsWith(e.name.toLowerCase()) || e.name.toLowerCase().startsWith(t))?.iso2 || "";
59
+ }
60
+ function y(e) {
61
+ let t = v(e);
62
+ return t ? g(t) : String(e || "").trim();
63
+ }
64
+ //#endregion
65
+ //#region src/lib/addressLookup.ts
66
+ var b = "https://photon.komoot.io/api/";
67
+ function x(e) {
68
+ let t = (e.street || "").trim(), n = (e.housenumber || "").trim();
69
+ return t ? n ? `${n} ${t}` : t : (e.name || "").trim();
70
+ }
71
+ var S = (e) => (e.city || e.town || e.village || e.district || e.county || "").trim();
72
+ function C(e, t) {
73
+ let n = e.properties;
74
+ if (!n) return null;
75
+ let r = x(n), i = S(n);
76
+ if (!r && !i) return null;
77
+ let a = (n.state || "").trim(), o = (n.postcode || "").trim(), s = (n.country || "").trim(), c = [a, o].filter(Boolean).join(" ");
78
+ return {
79
+ id: `${n.osm_type || "x"}${n.osm_id ?? t}-${t}`,
80
+ label: [
81
+ r,
82
+ i,
83
+ c,
84
+ s
85
+ ].filter(Boolean).join(", "),
86
+ street: r,
87
+ city: i,
88
+ region: a,
89
+ postcode: o,
90
+ country: s,
91
+ countryCode: (n.countrycode || "").trim().toLowerCase()
92
+ };
93
+ }
94
+ function w(e) {
95
+ let t = /* @__PURE__ */ new Set();
96
+ return e.filter((e) => {
97
+ let n = e.label.toLowerCase();
98
+ return t.has(n) ? !1 : (t.add(n), !0);
99
+ });
100
+ }
101
+ async function T(e, t = {}) {
102
+ let n = String(e || "").trim();
103
+ if (n.length < 3) return [];
104
+ let r = `${b}?q=${encodeURIComponent(n)}&limit=${t.limit ?? 6}`;
105
+ try {
106
+ let e = await fetch(r, { signal: t.signal });
107
+ if (!e.ok) return [];
108
+ let n = await e.json();
109
+ return w((Array.isArray(n?.features) ? n.features : []).map(C).filter((e) => e !== null));
110
+ } catch {
111
+ return [];
112
+ }
113
+ }
114
+ //#endregion
115
+ //#region src/components/AddressField.tsx
116
+ var E = "text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1", D = { borderRadius: "var(--input-radius, 0.75rem)" }, O = "flex items-center h-12 w-full px-4 text-[15px] text-foreground transition-all duration-300 glass-panel", k = "block h-12 w-full px-4 py-2 text-[15px] text-foreground transition-all duration-300 placeholder:text-foreground/40 focus:outline-none focus:border-accent glow-focus disabled:cursor-not-allowed disabled:opacity-50 glass-panel", A = "flex-1 min-w-0 bg-transparent border-none outline-none shadow-none p-0 text-[15px] text-foreground placeholder:text-foreground/40 no-glow";
117
+ function j(e) {
118
+ let [t, n] = d(!1), [r, i] = d(!1), [a, o] = d([]), [s, c] = d(-1), f = u(!1), p = u(!1), m = u(null);
119
+ return l(() => {
120
+ if (f.current) {
121
+ f.current = !1;
122
+ return;
123
+ }
124
+ if (!p.current) {
125
+ o([]), i(!1), n(!1);
126
+ return;
127
+ }
128
+ let t = e.trim();
129
+ if (t.length < 3) {
130
+ o([]), i(!1), n(!1);
131
+ return;
132
+ }
133
+ let r = new AbortController();
134
+ i(!0);
135
+ let a = setTimeout(async () => {
136
+ let e = await T(t, { signal: r.signal });
137
+ r.signal.aborted || (o(e), c(-1), i(!1), n(e.length > 0));
138
+ }, 250);
139
+ return () => {
140
+ r.abort(), clearTimeout(a);
141
+ };
142
+ }, [e]), l(() => {
143
+ if (!t) return;
144
+ let e = (e) => {
145
+ m.current?.contains(e.target) || n(!1);
146
+ };
147
+ return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
148
+ }, [t]), {
149
+ open: t,
150
+ setOpen: n,
151
+ busy: r,
152
+ rows: a,
153
+ active: s,
154
+ setActive: c,
155
+ boxRef: m,
156
+ typed: p,
157
+ take: (e) => {
158
+ f.current = !0, e(), n(!1), o([]), c(-1);
159
+ },
160
+ onKeyDown: (e, r) => {
161
+ if (e.key === "Escape" && t) {
162
+ e.stopPropagation(), n(!1);
163
+ return;
164
+ }
165
+ !t || !a.length || (e.key === "ArrowDown" ? (e.preventDefault(), c((e) => (e + 1) % a.length)) : e.key === "ArrowUp" ? (e.preventDefault(), c((e) => (e <= 0 ? a.length : e) - 1)) : e.key === "Enter" && s >= 0 && (e.preventDefault(), r(a[s])));
166
+ }
167
+ };
168
+ }
169
+ function M({ label: n, value: r, disabled: a, onPick: o }) {
170
+ let [s, c] = d(!1), [m, g] = d(""), _ = u(null), y = u(null);
171
+ l(() => {
172
+ if (!s) {
173
+ g("");
174
+ return;
175
+ }
176
+ y.current?.focus();
177
+ let e = (e) => {
178
+ _.current?.contains(e.target) || c(!1);
179
+ };
180
+ return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
181
+ }, [s]);
182
+ let b = m.trim().toLowerCase(), x = b ? h().filter((e) => e.name.toLowerCase().includes(b)) : h(), S = v(r);
183
+ return /* @__PURE__ */ p("div", {
184
+ className: "relative w-full",
185
+ ref: _,
186
+ children: [/* @__PURE__ */ p("button", {
187
+ type: "button",
188
+ disabled: a,
189
+ onClick: () => c((e) => !e),
190
+ "aria-haspopup": "listbox",
191
+ "aria-expanded": s,
192
+ "aria-label": n,
193
+ className: `${O} justify-between gap-2 text-left cursor-pointer hover:border-accent/40 disabled:cursor-not-allowed disabled:opacity-50`,
194
+ style: D,
195
+ children: [/* @__PURE__ */ f("span", {
196
+ className: `truncate ${r ? "text-foreground" : "text-foreground/40"}`,
197
+ children: r || "Country"
198
+ }), /* @__PURE__ */ f(i, { className: `w-3.5 h-3.5 shrink-0 text-foreground/50 transition-transform duration-300 ${s ? "rotate-180" : ""}` })]
199
+ }), s && /* @__PURE__ */ p("div", {
200
+ role: "listbox",
201
+ "aria-label": n,
202
+ className: "absolute z-[999999] top-[calc(100%+8px)] left-0 w-full glass-popover overflow-hidden",
203
+ style: D,
204
+ children: [/* @__PURE__ */ p("div", {
205
+ className: "flex items-center gap-2 px-3 h-11 border-b border-[var(--panel-border)]/50",
206
+ children: [/* @__PURE__ */ f(e, { className: "w-3.5 h-3.5 shrink-0 text-foreground/35" }), /* @__PURE__ */ f("input", {
207
+ ref: y,
208
+ value: m,
209
+ onChange: (e) => g(e.target.value),
210
+ onKeyDown: (e) => {
211
+ if (e.key === "Escape") {
212
+ e.stopPropagation(), c(!1);
213
+ return;
214
+ }
215
+ e.key === "Enter" && (e.preventDefault(), x[0] && (o(x[0].name), c(!1)));
216
+ },
217
+ placeholder: "Search countries",
218
+ "aria-label": "Search countries",
219
+ autoComplete: "off",
220
+ className: `${A} text-[14px]`
221
+ })]
222
+ }), /* @__PURE__ */ p("div", {
223
+ className: "max-h-56 overflow-y-auto no-scrollbar p-1",
224
+ children: [
225
+ r && !b && /* @__PURE__ */ p("div", {
226
+ role: "option",
227
+ "aria-selected": !1,
228
+ onClick: () => {
229
+ o(""), c(!1);
230
+ },
231
+ className: "flex items-center gap-2.5 px-3 py-2.5 text-[13px] font-medium text-foreground/60 hover:bg-foreground/5 cursor-pointer",
232
+ style: { borderRadius: "calc(var(--input-radius, 0.75rem) - 0.25rem)" },
233
+ children: [/* @__PURE__ */ f(t, { className: "w-3.5 h-3.5 shrink-0 text-foreground/35" }), /* @__PURE__ */ f("span", {
234
+ className: "truncate",
235
+ children: "No country"
236
+ })]
237
+ }),
238
+ x.map((e) => /* @__PURE__ */ f("div", {
239
+ role: "option",
240
+ "aria-selected": e.iso2 === S,
241
+ onClick: () => {
242
+ o(e.name), c(!1);
243
+ },
244
+ className: `flex items-center px-3 py-2.5 transition-colors font-medium text-[13px] cursor-pointer ${e.iso2 === S ? "bg-accent/10 text-accent font-bold" : "text-foreground/80 hover:bg-foreground/5 hover:text-foreground"}`,
245
+ style: { borderRadius: "calc(var(--input-radius, 0.75rem) - 0.25rem)" },
246
+ children: /* @__PURE__ */ f("span", {
247
+ className: "truncate",
248
+ children: e.name
249
+ })
250
+ }, e.iso2)),
251
+ x.length === 0 && /* @__PURE__ */ f("div", {
252
+ className: "px-3 py-2.5 text-[13px] text-foreground/40",
253
+ children: "No match"
254
+ })
255
+ ]
256
+ })]
257
+ })]
258
+ });
259
+ }
260
+ function N({ id: e, label: t, value: i, onChange: s, required: c = !1, disabled: l = !1, placeholder: u, error: d }) {
261
+ let m = j(i.street), h = a(v(i.country)), g = (e) => s({
262
+ ...i,
263
+ ...e
264
+ }), _ = (e) => m.take(() => s({
265
+ street: e.street,
266
+ city: e.city,
267
+ region: e.region,
268
+ postcode: e.postcode,
269
+ country: y(e.countryCode || e.country) || i.country
270
+ })), b = (e, n, r, a, o) => /* @__PURE__ */ f("div", {
271
+ className: a,
272
+ children: /* @__PURE__ */ f("input", {
273
+ type: "text",
274
+ disabled: l,
275
+ value: i[e],
276
+ onChange: (t) => g({ [e]: t.target.value }),
277
+ placeholder: r,
278
+ "aria-label": `${t} — ${n}`,
279
+ autoComplete: o,
280
+ className: k,
281
+ style: D
282
+ })
283
+ }, e), x = h.postal ? "col-span-1" : "col-span-2", S = h.region ? "col-span-1" : "col-span-2", C = !!(i.country || i.city || i.region || i.postcode);
284
+ return /* @__PURE__ */ p("div", {
285
+ className: "flex flex-col w-full",
286
+ ref: m.boxRef,
287
+ children: [
288
+ /* @__PURE__ */ p("label", {
289
+ className: E,
290
+ htmlFor: e,
291
+ children: [
292
+ t,
293
+ " ",
294
+ c && /* @__PURE__ */ f("span", {
295
+ className: "text-red-500",
296
+ children: "*"
297
+ })
298
+ ]
299
+ }),
300
+ /* @__PURE__ */ p("div", {
301
+ className: "relative w-full",
302
+ children: [/* @__PURE__ */ p("div", {
303
+ className: `${O} gap-2.5 focus-within:border-accent glow-focus ${d ? "border-red-500/50" : ""}`,
304
+ style: D,
305
+ children: [
306
+ /* @__PURE__ */ f(n, { className: "w-4 h-4 shrink-0 text-foreground/40" }),
307
+ /* @__PURE__ */ f("input", {
308
+ id: e,
309
+ type: "text",
310
+ required: c,
311
+ disabled: l,
312
+ value: i.street,
313
+ onChange: (e) => {
314
+ m.typed.current = !0, g({ street: e.target.value });
315
+ },
316
+ onFocus: () => {
317
+ m.rows.length && m.setOpen(!0);
318
+ },
319
+ onKeyDown: (e) => m.onKeyDown(e, _),
320
+ role: "combobox",
321
+ "aria-expanded": m.open,
322
+ "aria-autocomplete": "list",
323
+ "aria-controls": `${e}-list`,
324
+ placeholder: u || "Start typing your address",
325
+ autoComplete: "address-line1",
326
+ className: A
327
+ }),
328
+ m.busy && /* @__PURE__ */ f(r, { className: "w-3.5 h-3.5 shrink-0 text-foreground/30 animate-spin" })
329
+ ]
330
+ }), m.open && /* @__PURE__ */ f("div", {
331
+ id: `${e}-list`,
332
+ role: "listbox",
333
+ "aria-label": t,
334
+ className: "absolute z-[999999] top-[calc(100%+8px)] left-0 w-full glass-popover overflow-hidden p-1",
335
+ style: D,
336
+ children: m.rows.map((e, t) => /* @__PURE__ */ p("div", {
337
+ role: "option",
338
+ "aria-selected": t === m.active,
339
+ onMouseEnter: () => m.setActive(t),
340
+ onClick: () => _(e),
341
+ className: `flex items-center gap-2.5 px-3 py-2.5 transition-colors text-[13px] font-medium cursor-pointer ${t === m.active ? "bg-accent/10 text-accent" : "text-foreground/80 hover:bg-foreground/5"}`,
342
+ style: { borderRadius: "calc(var(--input-radius, 0.75rem) - 0.25rem)" },
343
+ children: [/* @__PURE__ */ f(n, { className: "w-3.5 h-3.5 shrink-0 text-foreground/35" }), /* @__PURE__ */ f("span", {
344
+ className: "truncate",
345
+ children: e.label
346
+ })]
347
+ }, e.id))
348
+ })]
349
+ }),
350
+ /* @__PURE__ */ f("div", {
351
+ className: "mt-2.5",
352
+ children: /* @__PURE__ */ f(M, {
353
+ label: `${t} — country`,
354
+ value: i.country,
355
+ disabled: l,
356
+ onPick: (e) => g({ country: e })
357
+ })
358
+ }),
359
+ C && /* @__PURE__ */ p("div", {
360
+ className: "grid grid-cols-2 gap-2.5 mt-2.5",
361
+ children: [
362
+ b("city", "city", o[h.locality], "col-span-2", "address-level2"),
363
+ h.region && b("region", "region", o[h.region], x, "address-level1"),
364
+ h.postal && b("postcode", "postcode", o[h.postal], S, "postal-code")
365
+ ]
366
+ }),
367
+ d && /* @__PURE__ */ f("p", {
368
+ className: "text-xs text-red-500 font-medium mt-1.5 ml-1",
369
+ children: d
370
+ })
371
+ ]
372
+ });
373
+ }
374
+ //#endregion
375
+ export { N as AddressField, N as default };
@@ -0,0 +1 @@
1
+ require(`./chunk-CiTBaPhY.cjs`);const e=require(`./lucide-react-DKUgoIFa.cjs`),t=require(`./address-COc6hg_p.cjs`),n=require(`./dist-CNztuGOG.cjs`);let r=require(`react`),i=require(`react/jsx-runtime`);var a=null;function o(){return a||(a=n.t.map(e=>{let t=n.n(e);return{iso2:t.iso2,name:t.name}}).sort((e,t)=>e.name.localeCompare(t.name)),a)}var s=e=>o().find(t=>t.iso2===String(e||``).toLowerCase())?.name||``,c={"united states of america":`us`,usa:`us`,"u.s.":`us`,"u.s.a.":`us`,uk:`gb`,"great britain":`gb`,england:`gb`,scotland:`gb`,wales:`gb`,"northern ireland":`gb`,"russian federation":`ru`,deutschland:`de`,españa:`es`,italia:`it`,brasil:`br`,"south korea":`kr`,"republic of korea":`kr`,"north korea":`kp`,czechia:`cz`,"czech republic":`cz`,"viet nam":`vn`,türkiye:`tr`,"the netherlands":`nl`,holland:`nl`,uae:`ae`,"united arab emirates":`ae`,"hong kong sar":`hk`,macau:`mo`,"ivory coast":`ci`,"côte d'ivoire":`ci`,eswatini:`sz`,"myanmar (burma)":`mm`,burma:`mm`};function l(e){let t=String(e||``).trim().toLowerCase();if(!t)return``;if(/^[a-z]{2}$/.test(t)&&o().some(e=>e.iso2===t))return t;if(c[t])return c[t];let n=o().find(e=>e.name.toLowerCase()===t);return n?n.iso2:o().find(e=>t.startsWith(e.name.toLowerCase())||e.name.toLowerCase().startsWith(t))?.iso2||``}function u(e){let t=l(e);return t?s(t):String(e||``).trim()}var d=`https://photon.komoot.io/api/`;function f(e){let t=(e.street||``).trim(),n=(e.housenumber||``).trim();return t?n?`${n} ${t}`:t:(e.name||``).trim()}var p=e=>(e.city||e.town||e.village||e.district||e.county||``).trim();function m(e,t){let n=e.properties;if(!n)return null;let r=f(n),i=p(n);if(!r&&!i)return null;let a=(n.state||``).trim(),o=(n.postcode||``).trim(),s=(n.country||``).trim(),c=[a,o].filter(Boolean).join(` `);return{id:`${n.osm_type||`x`}${n.osm_id??t}-${t}`,label:[r,i,c,s].filter(Boolean).join(`, `),street:r,city:i,region:a,postcode:o,country:s,countryCode:(n.countrycode||``).trim().toLowerCase()}}function h(e){let t=new Set;return e.filter(e=>{let n=e.label.toLowerCase();return t.has(n)?!1:(t.add(n),!0)})}async function g(e,t={}){let n=String(e||``).trim();if(n.length<3)return[];let r=`${d}?q=${encodeURIComponent(n)}&limit=${t.limit??6}`;try{let e=await fetch(r,{signal:t.signal});if(!e.ok)return[];let n=await e.json();return h((Array.isArray(n?.features)?n.features:[]).map(m).filter(e=>e!==null))}catch{return[]}}var _=`text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1`,v={borderRadius:`var(--input-radius, 0.75rem)`},y=`flex items-center h-12 w-full px-4 text-[15px] text-foreground transition-all duration-300 glass-panel`,b=`block h-12 w-full px-4 py-2 text-[15px] text-foreground transition-all duration-300 placeholder:text-foreground/40 focus:outline-none focus:border-accent glow-focus disabled:cursor-not-allowed disabled:opacity-50 glass-panel`,x=`flex-1 min-w-0 bg-transparent border-none outline-none shadow-none p-0 text-[15px] text-foreground placeholder:text-foreground/40 no-glow`;function S(e){let[t,n]=(0,r.useState)(!1),[i,a]=(0,r.useState)(!1),[o,s]=(0,r.useState)([]),[c,l]=(0,r.useState)(-1),u=(0,r.useRef)(!1),d=(0,r.useRef)(!1),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(u.current){u.current=!1;return}if(!d.current){s([]),a(!1),n(!1);return}let t=e.trim();if(t.length<3){s([]),a(!1),n(!1);return}let r=new AbortController;a(!0);let i=setTimeout(async()=>{let e=await g(t,{signal:r.signal});r.signal.aborted||(s(e),l(-1),a(!1),n(e.length>0))},250);return()=>{r.abort(),clearTimeout(i)}},[e]),(0,r.useEffect)(()=>{if(!t)return;let e=e=>{f.current?.contains(e.target)||n(!1)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[t]),{open:t,setOpen:n,busy:i,rows:o,active:c,setActive:l,boxRef:f,typed:d,take:e=>{u.current=!0,e(),n(!1),s([]),l(-1)},onKeyDown:(e,r)=>{if(e.key===`Escape`&&t){e.stopPropagation(),n(!1);return}!t||!o.length||(e.key===`ArrowDown`?(e.preventDefault(),l(e=>(e+1)%o.length)):e.key===`ArrowUp`?(e.preventDefault(),l(e=>(e<=0?o.length:e)-1)):e.key===`Enter`&&c>=0&&(e.preventDefault(),r(o[c])))}}}function C({label:t,value:n,disabled:a,onPick:s}){let[c,u]=(0,r.useState)(!1),[d,f]=(0,r.useState)(``),p=(0,r.useRef)(null),m=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!c){f(``);return}m.current?.focus();let e=e=>{p.current?.contains(e.target)||u(!1)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[c]);let h=d.trim().toLowerCase(),g=h?o().filter(e=>e.name.toLowerCase().includes(h)):o(),_=l(n);return(0,i.jsxs)(`div`,{className:`relative w-full`,ref:p,children:[(0,i.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>u(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":c,"aria-label":t,className:`${y} justify-between gap-2 text-left cursor-pointer hover:border-accent/40 disabled:cursor-not-allowed disabled:opacity-50`,style:v,children:[(0,i.jsx)(`span`,{className:`truncate ${n?`text-foreground`:`text-foreground/40`}`,children:n||`Country`}),(0,i.jsx)(e.on,{className:`w-3.5 h-3.5 shrink-0 text-foreground/50 transition-transform duration-300 ${c?`rotate-180`:``}`})]}),c&&(0,i.jsxs)(`div`,{role:`listbox`,"aria-label":t,className:`absolute z-[999999] top-[calc(100%+8px)] left-0 w-full glass-popover overflow-hidden`,style:v,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 px-3 h-11 border-b border-[var(--panel-border)]/50`,children:[(0,i.jsx)(e.F,{className:`w-3.5 h-3.5 shrink-0 text-foreground/35`}),(0,i.jsx)(`input`,{ref:m,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){e.stopPropagation(),u(!1);return}e.key===`Enter`&&(e.preventDefault(),g[0]&&(s(g[0].name),u(!1)))},placeholder:`Search countries`,"aria-label":`Search countries`,autoComplete:`off`,className:`${x} text-[14px]`})]}),(0,i.jsxs)(`div`,{className:`max-h-56 overflow-y-auto no-scrollbar p-1`,children:[n&&!h&&(0,i.jsxs)(`div`,{role:`option`,"aria-selected":!1,onClick:()=>{s(``),u(!1)},className:`flex items-center gap-2.5 px-3 py-2.5 text-[13px] font-medium text-foreground/60 hover:bg-foreground/5 cursor-pointer`,style:{borderRadius:`calc(var(--input-radius, 0.75rem) - 0.25rem)`},children:[(0,i.jsx)(e.a,{className:`w-3.5 h-3.5 shrink-0 text-foreground/35`}),(0,i.jsx)(`span`,{className:`truncate`,children:`No country`})]}),g.map(e=>(0,i.jsx)(`div`,{role:`option`,"aria-selected":e.iso2===_,onClick:()=>{s(e.name),u(!1)},className:`flex items-center px-3 py-2.5 transition-colors font-medium text-[13px] cursor-pointer ${e.iso2===_?`bg-accent/10 text-accent font-bold`:`text-foreground/80 hover:bg-foreground/5 hover:text-foreground`}`,style:{borderRadius:`calc(var(--input-radius, 0.75rem) - 0.25rem)`},children:(0,i.jsx)(`span`,{className:`truncate`,children:e.name})},e.iso2)),g.length===0&&(0,i.jsx)(`div`,{className:`px-3 py-2.5 text-[13px] text-foreground/40`,children:`No match`})]})]})]})}function w({id:n,label:r,value:a,onChange:o,required:s=!1,disabled:c=!1,placeholder:d,error:f}){let p=S(a.street),m=t.i(l(a.country)),h=e=>o({...a,...e}),g=e=>p.take(()=>o({street:e.street,city:e.city,region:e.region,postcode:e.postcode,country:u(e.countryCode||e.country)||a.country})),w=(e,t,n,o,s)=>(0,i.jsx)(`div`,{className:o,children:(0,i.jsx)(`input`,{type:`text`,disabled:c,value:a[e],onChange:t=>h({[e]:t.target.value}),placeholder:n,"aria-label":`${r} — ${t}`,autoComplete:s,className:b,style:v})},e),T=m.postal?`col-span-1`:`col-span-2`,E=m.region?`col-span-1`:`col-span-2`,D=!!(a.country||a.city||a.region||a.postcode);return(0,i.jsxs)(`div`,{className:`flex flex-col w-full`,ref:p.boxRef,children:[(0,i.jsxs)(`label`,{className:_,htmlFor:n,children:[r,` `,s&&(0,i.jsx)(`span`,{className:`text-red-500`,children:`*`})]}),(0,i.jsxs)(`div`,{className:`relative w-full`,children:[(0,i.jsxs)(`div`,{className:`${y} gap-2.5 focus-within:border-accent glow-focus ${f?`border-red-500/50`:``}`,style:v,children:[(0,i.jsx)(e.ct,{className:`w-4 h-4 shrink-0 text-foreground/40`}),(0,i.jsx)(`input`,{id:n,type:`text`,required:s,disabled:c,value:a.street,onChange:e=>{p.typed.current=!0,h({street:e.target.value})},onFocus:()=>{p.rows.length&&p.setOpen(!0)},onKeyDown:e=>p.onKeyDown(e,g),role:`combobox`,"aria-expanded":p.open,"aria-autocomplete":`list`,"aria-controls":`${n}-list`,placeholder:d||`Start typing your address`,autoComplete:`address-line1`,className:x}),p.busy&&(0,i.jsx)(e.ht,{className:`w-3.5 h-3.5 shrink-0 text-foreground/30 animate-spin`})]}),p.open&&(0,i.jsx)(`div`,{id:`${n}-list`,role:`listbox`,"aria-label":r,className:`absolute z-[999999] top-[calc(100%+8px)] left-0 w-full glass-popover overflow-hidden p-1`,style:v,children:p.rows.map((t,n)=>(0,i.jsxs)(`div`,{role:`option`,"aria-selected":n===p.active,onMouseEnter:()=>p.setActive(n),onClick:()=>g(t),className:`flex items-center gap-2.5 px-3 py-2.5 transition-colors text-[13px] font-medium cursor-pointer ${n===p.active?`bg-accent/10 text-accent`:`text-foreground/80 hover:bg-foreground/5`}`,style:{borderRadius:`calc(var(--input-radius, 0.75rem) - 0.25rem)`},children:[(0,i.jsx)(e.ct,{className:`w-3.5 h-3.5 shrink-0 text-foreground/35`}),(0,i.jsx)(`span`,{className:`truncate`,children:t.label})]},t.id))})]}),(0,i.jsx)(`div`,{className:`mt-2.5`,children:(0,i.jsx)(C,{label:`${r} — country`,value:a.country,disabled:c,onPick:e=>h({country:e})})}),D&&(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-2.5 mt-2.5`,children:[w(`city`,`city`,t.t[m.locality],`col-span-2`,`address-level2`),m.region&&w(`region`,`region`,t.t[m.region],T,`address-level1`),m.postal&&w(`postcode`,`postcode`,t.t[m.postal],E,`postal-code`)]}),f&&(0,i.jsx)(`p`,{className:`text-xs text-red-500 font-medium mt-1.5 ml-1`,children:f})]})}exports.AddressField=w,exports.default=w;