@superwall/studio 1.2.0 → 1.3.0-beta.3

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 (71) hide show
  1. package/README.md +27 -14
  2. package/dist/assets/index-DyLb5fiB.js +11 -0
  3. package/dist/index.html +1 -1
  4. package/dist/lib/StudioApp.d.ts +2 -3
  5. package/dist/lib/components/PaywallToasts.d.ts +3 -0
  6. package/dist/lib/components/SurfaceCard.d.ts +4 -2
  7. package/dist/lib/components/icons.d.ts +0 -2
  8. package/dist/lib/components/{ActionMenu.d.ts → menus/ActionMenu.d.ts} +2 -1
  9. package/dist/lib/components/{CompareMenu.d.ts → menus/CompareMenu.d.ts} +1 -1
  10. package/dist/lib/components/{VariablesPanel.d.ts → panels/VariablesPanel.d.ts} +3 -3
  11. package/dist/lib/components/{DeviceChrome.d.ts → preview/DeviceChrome.d.ts} +1 -1
  12. package/dist/lib/components/{DeviceFrame.d.ts → preview/DeviceFrame.d.ts} +5 -2
  13. package/dist/lib/components/preview/HostedIframe.d.ts +7 -0
  14. package/dist/lib/index.d.ts +12 -6
  15. package/dist/lib/index.js +1467 -945
  16. package/dist/lib/lib/actions.d.ts +1 -1
  17. package/dist/lib/lib/contract.d.ts +33 -0
  18. package/dist/lib/lib/devices.d.ts +1 -1
  19. package/dist/lib/lib/host.d.ts +15 -0
  20. package/dist/lib/lib/notices.d.ts +9 -0
  21. package/dist/lib/lib/preview.d.ts +2 -4
  22. package/dist/lib/lib/project.d.ts +2 -1
  23. package/dist/lib/lib/steps.d.ts +5 -0
  24. package/dist/lib/lib/surfaces.d.ts +35 -0
  25. package/dist/lib/lib/variables.d.ts +12 -0
  26. package/dist/lib/products.js +26 -12
  27. package/dist/lib/screens/SurfaceEditor.d.ts +1 -1
  28. package/dist/lib/screens/SurfaceList.d.ts +1 -1
  29. package/package.json +5 -1
  30. package/src/StudioApp.tsx +6 -10
  31. package/src/components/PaywallToasts.tsx +162 -86
  32. package/src/components/SurfaceCard.tsx +9 -2
  33. package/src/components/icons.tsx +0 -13
  34. package/src/components/{ActionMenu.tsx → menus/ActionMenu.tsx} +3 -3
  35. package/src/components/{CompareMenu.tsx → menus/CompareMenu.tsx} +2 -2
  36. package/src/components/{SidePanel.tsx → panels/SidePanel.tsx} +1 -1
  37. package/src/components/{VariablesPanel.tsx → panels/VariablesPanel.tsx} +4 -4
  38. package/src/components/{DeviceChrome.tsx → preview/DeviceChrome.tsx} +1 -1
  39. package/src/components/{DeviceFrame.tsx → preview/DeviceFrame.tsx} +14 -55
  40. package/src/components/preview/HostedIframe.tsx +46 -0
  41. package/src/index.ts +24 -12
  42. package/src/lib/actions.ts +1 -1
  43. package/src/lib/contract.ts +30 -0
  44. package/src/lib/devices.ts +5 -4
  45. package/src/lib/host.ts +80 -0
  46. package/src/lib/notices.ts +63 -0
  47. package/src/lib/preview.ts +8 -40
  48. package/src/lib/products.ts +20 -1
  49. package/src/lib/project.ts +2 -1
  50. package/src/lib/steps.ts +20 -0
  51. package/src/lib/surfaces.ts +41 -0
  52. package/src/lib/time.ts +1 -2
  53. package/src/lib/variables.ts +13 -0
  54. package/src/main.tsx +3 -3
  55. package/src/screens/SurfaceEditor.tsx +77 -66
  56. package/src/screens/SurfaceList.tsx +17 -7
  57. package/src/vite-env.d.ts +1 -0
  58. package/dist/assets/index-CVKQ82YR.js +0 -11
  59. package/dist/lib/lib/events.d.ts +0 -27
  60. package/dist/lib/lib/types.d.ts +0 -77
  61. package/src/lib/events.ts +0 -86
  62. package/src/lib/types.ts +0 -87
  63. /package/dist/lib/components/{StudioShell.d.ts → chrome/StudioShell.d.ts} +0 -0
  64. /package/dist/lib/components/{Toolbar.d.ts → chrome/Toolbar.d.ts} +0 -0
  65. /package/dist/lib/components/{TopBar.d.ts → chrome/TopBar.d.ts} +0 -0
  66. /package/dist/lib/components/{MissingProducts.d.ts → panels/MissingProducts.d.ts} +0 -0
  67. /package/dist/lib/components/{SidePanel.d.ts → panels/SidePanel.d.ts} +0 -0
  68. /package/src/components/{StudioShell.tsx → chrome/StudioShell.tsx} +0 -0
  69. /package/src/components/{Toolbar.tsx → chrome/Toolbar.tsx} +0 -0
  70. /package/src/components/{TopBar.tsx → chrome/TopBar.tsx} +0 -0
  71. /package/src/components/{MissingProducts.tsx → panels/MissingProducts.tsx} +0 -0
package/dist/lib/index.js CHANGED
@@ -1,221 +1,631 @@
1
- import { jsx as t, jsxs as o, Fragment as U } from "react/jsx-runtime";
2
- import * as d from "react";
3
- import { toast as D, Toaster as Xe } from "sonner";
4
- const et = ({
1
+ import { jsx as n, jsxs as c, Fragment as Z } from "react/jsx-runtime";
2
+ import * as p from "react";
3
+ import { toast as U, Toaster as _t } from "sonner";
4
+ const kt = ({
5
5
  children: e,
6
- position: n = "fixed"
7
- }) => /* @__PURE__ */ t(
6
+ position: t = "fixed"
7
+ }) => /* @__PURE__ */ n(
8
8
  "div",
9
9
  {
10
- className: `sw-studio bg-ink text-cream ${n} inset-0 flex flex-col font-sans text-[0.9375rem] tracking-[-0.01em] antialiased`,
10
+ className: `sw-studio bg-ink text-cream ${t} inset-0 flex flex-col font-sans text-[0.9375rem] tracking-[-0.01em] antialiased`,
11
11
  children: e
12
12
  }
13
- ), y = ({ children: e }) => /* @__PURE__ */ t("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: e }), Ie = () => /* @__PURE__ */ o(y, { children: [
14
- /* @__PURE__ */ t("path", { d: "M21 12a9 9 0 1 1-2.64-6.36" }),
15
- /* @__PURE__ */ t("path", { d: "M21 3v6h-6" })
16
- ] }), Z = () => /* @__PURE__ */ o(y, { children: [
17
- /* @__PURE__ */ t("path", { d: "M15 3h6v6" }),
18
- /* @__PURE__ */ t("path", { d: "M10 14 21 3" }),
19
- /* @__PURE__ */ t("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
20
- ] }), tt = () => /* @__PURE__ */ o(y, { children: [
21
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "4" }),
22
- /* @__PURE__ */ t("path", { d: "M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" })
23
- ] }), nt = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) }), st = () => /* @__PURE__ */ o(y, { children: [
24
- /* @__PURE__ */ t("path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3" }),
25
- /* @__PURE__ */ t("path", { d: "M14 2v4M8 10v4M16 18v4" })
26
- ] }), Oe = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "M18 6 6 18M6 6l12 12" }) }), Re = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "m6 9 6 6 6-6" }) }), at = () => /* @__PURE__ */ o(y, { children: [
27
- /* @__PURE__ */ t("rect", { x: "3", y: "4", width: "18", height: "16" }),
28
- /* @__PURE__ */ t("path", { d: "M12 4v16" })
29
- ] }), we = () => /* @__PURE__ */ o(y, { children: [
30
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "9" }),
31
- /* @__PURE__ */ t("path", { d: "m8.5 12 2.5 2.5 4.5-5" })
32
- ] }), ve = () => /* @__PURE__ */ o(y, { children: [
33
- /* @__PURE__ */ t("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
34
- /* @__PURE__ */ t("path", { d: "M12 9v4" }),
35
- /* @__PURE__ */ t("path", { d: "M12 17h.01" })
36
- ] }), rt = () => /* @__PURE__ */ o(y, { children: [
37
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "9" }),
38
- /* @__PURE__ */ t("path", { d: "M12 11v5" }),
39
- /* @__PURE__ */ t("path", { d: "M12 8h.01" })
40
- ] }), K = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "M13 2 4.5 13H11l-1 9 8.5-11H12l1-9Z" }) }), re = () => /* @__PURE__ */ o(y, { children: [
41
- /* @__PURE__ */ t("circle", { cx: "9", cy: "20", r: "1" }),
42
- /* @__PURE__ */ t("circle", { cx: "18", cy: "20", r: "1" }),
43
- /* @__PURE__ */ t("path", { d: "M2 3h2.5l2.2 11.2a2 2 0 0 0 2 1.6h8.4a2 2 0 0 0 2-1.6L21 7H5.4" })
44
- ] }), it = () => /* @__PURE__ */ o(y, { children: [
45
- /* @__PURE__ */ t("path", { d: "M18 8a6 6 0 1 0-12 0c0 6-2 8-2 8h16s-2-2-2-8" }),
46
- /* @__PURE__ */ t("path", { d: "M13.7 21a2 2 0 0 1-3.4 0" })
47
- ] }), lt = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1-5.4-2.9-5.4 2.9 1-6.1L3.2 9.5l6.1-.9L12 3Z" }) }), ot = () => /* @__PURE__ */ o(y, { children: [
48
- /* @__PURE__ */ t("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
49
- /* @__PURE__ */ t("circle", { cx: "12", cy: "7", r: "4" })
50
- ] }), ct = () => /* @__PURE__ */ o(y, { children: [
51
- /* @__PURE__ */ t("rect", { x: "4", y: "2", width: "10", height: "16", rx: "2" }),
52
- /* @__PURE__ */ t("path", { d: "M17 12a5 5 0 0 1-5 9H9" }),
53
- /* @__PURE__ */ t("path", { d: "m11 19-2 2 2 2" })
54
- ] }), Q = {
13
+ ), It = { experimentId: "0", variantId: "0", campaignId: "0" }, T = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)), Ge = (e = {}) => ({
14
+ paywallId: e.paywallId ?? "0",
15
+ paywallIdentifier: e.paywallIdentifier ?? "paywall",
16
+ device: T(e.device ?? {}),
17
+ user: T(e.user ?? {}),
18
+ params: T(e.params ?? {}),
19
+ products: e.products ?? [],
20
+ experiment: e.experiment ?? It,
21
+ ...e.introductoryOfferEligible === void 0 ? {} : { introductoryOfferEligible: e.introductoryOfferEligible }
22
+ }), Me = (e, t) => {
23
+ const r = {
24
+ ...e,
25
+ paywallId: t.paywallId ?? e.paywallId,
26
+ paywallIdentifier: t.paywallIdentifier ?? e.paywallIdentifier,
27
+ device: t.device ? T({ ...e.device, ...t.device }) : e.device,
28
+ user: t.user ? T({ ...e.user, ...t.user }) : e.user,
29
+ params: t.params ? T({ ...e.params, ...t.params }) : e.params,
30
+ products: t.products ?? e.products,
31
+ experiment: t.experiment ?? e.experiment
32
+ };
33
+ return "introductoryOfferEligible" in t && (t.introductoryOfferEligible === void 0 ? delete r.introductoryOfferEligible : r.introductoryOfferEligible = t.introductoryOfferEligible), r;
34
+ }, ye = (e, t) => JSON.stringify(e) === JSON.stringify(t), ce = (e, t) => {
35
+ const r = {};
36
+ let a = !1;
37
+ for (const s of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]))
38
+ s in t ? ye(e[s], t[s]) || (r[s] = t[s], a = !0) : (r[s] = void 0, a = !0);
39
+ return a ? r : void 0;
40
+ }, Pt = (e, t) => {
41
+ const r = {}, a = ce(e.device, t.device);
42
+ a && (r.device = a);
43
+ const s = ce(e.user, t.user);
44
+ s && (r.user = s);
45
+ const i = ce(e.params, t.params);
46
+ return i && (r.params = i), ye(e.products, t.products) || (r.products = t.products), e.introductoryOfferEligible !== t.introductoryOfferEligible && (r.introductoryOfferEligible = t.introductoryOfferEligible), e.paywallId !== t.paywallId && (r.paywallId = t.paywallId), e.paywallIdentifier !== t.paywallIdentifier && (r.paywallIdentifier = t.paywallIdentifier), ye(e.experiment, t.experiment) || (r.experiment = t.experiment), r;
47
+ }, Ye = (e) => {
48
+ const t = e.variables.trialPeriodDays, r = typeof t == "number" ? t : typeof t == "string" ? Number(t) : 0;
49
+ return Number.isFinite(r) ? r : 0;
50
+ }, F = (e) => e.introductoryOfferEligible ?? e.products.some((t) => Ye(t) > 0), Ze = (e) => ({
51
+ event_name: "template_variables",
52
+ variables: {
53
+ device: e.device,
54
+ user: e.user,
55
+ params: e.params,
56
+ ...e.products.length > 0 ? { products: e.products.map((t) => ({ [t.reference]: t.variables })) } : {}
57
+ }
58
+ }), Xe = (e) => ({
59
+ event_name: "experiment",
60
+ experimentId: e.experiment.experimentId,
61
+ variantId: e.experiment.variantId,
62
+ campaignId: e.experiment.campaignId
63
+ }), Qe = (e) => ({
64
+ event_name: "products",
65
+ products: e.products.map((t) => ({
66
+ product: t.reference,
67
+ productId: t.productId
68
+ }))
69
+ }), et = (e) => ({
70
+ event_name: "template_substitutions_prefix",
71
+ prefix: F(e) ? "freeTrial" : "default"
72
+ }), Et = (e) => ({
73
+ event_name: "paywall_open",
74
+ paywall_id: e.paywallId,
75
+ paywall_identifier: e.paywallIdentifier
76
+ }), Ct = (e) => ({
77
+ event_name: "paywall_close",
78
+ paywall_id: e.paywallId,
79
+ paywall_identifier: e.paywallIdentifier
80
+ }), $t = (e) => [
81
+ Ze(e),
82
+ Xe(e),
83
+ Qe(e),
84
+ et(e),
85
+ Et(e)
86
+ ], ee = (e) => ({
87
+ product: e.reference,
88
+ product_identifier: e.productId
89
+ }), Ot = (e) => ({
90
+ event_name: "transaction_start",
91
+ ...ee(e)
92
+ }), Mt = (e) => ({
93
+ event_name: "transaction_complete",
94
+ ...ee(e)
95
+ }), Tt = (e) => ({
96
+ event_name: "transaction_abandon",
97
+ ...ee(e)
98
+ }), Te = (e) => ({
99
+ event_name: "transaction_fail",
100
+ ...ee(e)
101
+ }), Dt = () => ({
102
+ event_name: "transaction_restore"
103
+ }), At = (e, t) => ({
104
+ event_name: "freeTrial_start",
105
+ product_identifier: e.productId,
106
+ trial_end_date: t
107
+ }), Rt = () => ({ event_name: "restore_start" }), Lt = () => ({
108
+ event_name: "restore_complete"
109
+ }), De = () => ({ event_name: "restore_fail" }), jt = (e) => ({
110
+ event_name: "permission_result",
111
+ permission_type: e.permissionType,
112
+ request_id: e.requestId,
113
+ status: e.status
114
+ }), Ut = (e) => ({
115
+ event_name: "callback_result",
116
+ request_id: e.requestId,
117
+ name: e.name,
118
+ status: e.status,
119
+ ...e.data === void 0 ? {} : { data: e.data }
120
+ }), Ft = () => ({
121
+ event: () => {
122
+ },
123
+ purchase: () => "completed",
124
+ restore: () => "restored",
125
+ close: () => {
126
+ },
127
+ openUrl: () => {
128
+ },
129
+ custom: () => {
130
+ },
131
+ customPlacement: () => {
132
+ },
133
+ permission: () => "granted",
134
+ callback: () => ({ status: "success" })
135
+ }), Bt = 1440 * 60 * 1e3, te = (e, t, r) => {
136
+ new Promise((a) => a(e())).then(t, r);
137
+ }, ne = (e, t) => {
138
+ console.error(`[superwall host] ${e}`, t);
139
+ }, Ht = (e, t, r) => e.products.find((a) => a.reference === t) ?? e.products.find((a) => a.productId === r) ?? {
140
+ reference: t,
141
+ productId: r ?? t,
142
+ variables: {}
143
+ }, Vt = (e, t) => {
144
+ const { delegate: r, send: a, now: s } = e, i = Ht(e.state(), t.product, t.product_identifier);
145
+ a([Ot(i)]), te(
146
+ () => r.purchase(i),
147
+ (o) => {
148
+ if (o === "completed") {
149
+ const u = Ye(i), l = [Mt(i)];
150
+ F(e.state()) && u > 0 && l.push(At(i, s() + u * Bt)), a(l);
151
+ } else a(o === "abandoned" ? [Tt(i)] : [Te(i)]);
152
+ },
153
+ (o) => {
154
+ ne("purchase delegate threw", o), a([Te(i)]);
155
+ }
156
+ );
157
+ }, Wt = (e) => {
158
+ const { delegate: t, send: r } = e;
159
+ r([Rt()]), te(
160
+ () => t.restore(),
161
+ (a) => {
162
+ r(a === "restored" ? [Dt(), Lt()] : [De()]);
163
+ },
164
+ (a) => {
165
+ ne("restore delegate threw", a), r([De()]);
166
+ }
167
+ );
168
+ }, zt = (e, t) => {
169
+ const { delegate: r, send: a } = e, s = (i) => a([
170
+ jt({
171
+ permissionType: t.permission_type,
172
+ requestId: t.request_id,
173
+ status: i
174
+ })
175
+ ]);
176
+ te(
177
+ () => r.permission(t.permission_type),
178
+ s,
179
+ (i) => {
180
+ ne("permission delegate threw", i), s("denied");
181
+ }
182
+ );
183
+ }, qt = (e, t) => {
184
+ const { delegate: r, send: a } = e, s = (i) => a([
185
+ Ut({
186
+ requestId: t.request_id,
187
+ name: t.name,
188
+ status: i.status,
189
+ ...i.data === void 0 ? {} : { data: i.data }
190
+ })
191
+ ]);
192
+ te(
193
+ () => r.callback(t.name, t.variables ?? {}),
194
+ s,
195
+ (i) => {
196
+ ne("callback delegate threw", i), s({ status: "failure" });
197
+ }
198
+ );
199
+ }, Ae = (e) => JSON.stringify([
200
+ e.device,
201
+ e.user,
202
+ e.params,
203
+ e.products.map((t) => [t.reference, t.variables])
204
+ ]), Re = (e) => JSON.stringify(e.products.map((t) => [t.reference, t.productId])), Le = (e) => JSON.stringify(e.experiment), Kt = (e) => {
205
+ let t = Ge(e.state);
206
+ const { delegate: r, send: a } = e, s = {
207
+ state: () => t,
208
+ delegate: r,
209
+ send: a,
210
+ now: e.now ?? Date.now
211
+ }, i = (l) => {
212
+ switch (l.event_name) {
213
+ case "ping":
214
+ a($t(t));
215
+ return;
216
+ case "purchase":
217
+ Vt(s, l);
218
+ return;
219
+ case "restore":
220
+ Wt(s);
221
+ return;
222
+ case "close":
223
+ r.close(), a([Ct(t)]);
224
+ return;
225
+ case "open_url":
226
+ r.openUrl(
227
+ l.url,
228
+ l.browser_type === "payment_sheet" ? "payment_sheet" : "in_app"
229
+ );
230
+ return;
231
+ case "open_url_external":
232
+ r.openUrl(l.url, "external");
233
+ return;
234
+ case "open_deep_link":
235
+ r.openUrl(l.link, "deep_link");
236
+ return;
237
+ case "custom":
238
+ r.custom(l.data);
239
+ return;
240
+ case "custom_placement":
241
+ r.customPlacement(l.name, l.params);
242
+ return;
243
+ case "user_attribute_updated":
244
+ t = Me(t, {
245
+ user: Object.fromEntries(l.attributes.map((m) => [m.key, m.value]))
246
+ });
247
+ return;
248
+ case "request_permission":
249
+ zt(s, l);
250
+ return;
251
+ case "request_callback":
252
+ qt(s, l);
253
+ return;
254
+ default:
255
+ return;
256
+ }
257
+ };
258
+ return {
259
+ get state() {
260
+ return t;
261
+ },
262
+ receive: (l) => {
263
+ for (const m of l)
264
+ r.event(m), i(m);
265
+ },
266
+ update: (l) => {
267
+ const m = t;
268
+ t = Me(t, l);
269
+ const d = [];
270
+ Ae(m) !== Ae(t) && d.push(Ze(t)), Le(m) !== Le(t) && d.push(Xe(t)), Re(m) !== Re(t) && d.push(Qe(t)), F(m) !== F(t) && d.push(et(t)), d.length > 0 && a(d);
271
+ },
272
+ send: a
273
+ };
274
+ }, Jt = () => typeof localStorage < "u" && localStorage.getItem("SW_DEBUG_TRANSPORT") === "true", Gt = {
275
+ WebKit: "#9C27B0",
276
+ Android: "#4CAF50",
277
+ Editor: "#2196F3",
278
+ Transport: "#FF9800"
279
+ }, Yt = (e) => {
280
+ const t = Gt[e], r = (a, s, ...i) => {
281
+ if (!Jt() && a === "debug") return;
282
+ const o = `%c[${e}]%c ${s}`, u = [`color: ${t}; font-weight: bold`, "color: inherit"];
283
+ switch (a) {
284
+ case "error":
285
+ console.error(o, ...u, ...i);
286
+ break;
287
+ case "warn":
288
+ console.warn(o, ...u, ...i);
289
+ break;
290
+ case "info":
291
+ console.info(o, ...u, ...i);
292
+ break;
293
+ default:
294
+ console.log(o, ...u, ...i);
295
+ }
296
+ };
297
+ return {
298
+ debug: (a, ...s) => r("debug", a, ...s),
299
+ info: (a, ...s) => r("info", a, ...s),
300
+ warn: (a, ...s) => r("warn", a, ...s),
301
+ error: (a, ...s) => r("error", a, ...s)
302
+ };
303
+ };
304
+ var Se = /* @__PURE__ */ ((e) => (e.ToPaywall = "to_paywall", e.FromPaywall = "from_paywall", e.ToPaywallUi = "to_paywall_ui", e.FromPaywallUi = "from_paywall_ui", e))(Se || {});
305
+ const Zt = (e, t) => {
306
+ const r = {
307
+ direction: t,
308
+ version: 1,
309
+ payload: { events: Array.isArray(e) ? e : [e] }
310
+ };
311
+ return JSON.stringify(r);
312
+ }, Xt = () => ({
313
+ parse: (e) => e
314
+ }), Qt = Yt("Transport"), en = (e, t, r = Xt()) => {
315
+ try {
316
+ const a = r.parse(JSON.parse(e));
317
+ if (a.direction !== t)
318
+ throw new Error("Message direction incorrect");
319
+ return a.payload.events;
320
+ } catch (a) {
321
+ return Qt.error("Failed to parse incoming message", { message: e, error: a }), [];
322
+ }
323
+ }, tn = (e) => (t) => {
324
+ e.postMessage(Zt([...t], Se.ToPaywall), "*");
325
+ }, nn = (e, t, r = {}) => {
326
+ const a = r.listen ?? window, s = (i) => {
327
+ if (i.source !== t || typeof i.data != "string") return;
328
+ const o = en(i.data, Se.FromPaywall);
329
+ o.length > 0 && e.receive(o);
330
+ };
331
+ return a.addEventListener("message", s), () => a.removeEventListener("message", s);
332
+ }, rn = (e) => {
333
+ const { target: t, listen: r, ...a } = e, s = Kt({ ...a, send: tn(t) }), i = nn(s, t, r ? { listen: r } : {});
334
+ return { host: s, detach: i };
335
+ }, de = 1440 * 60 * 1e3, pe = 60 * 1e3, tt = -18e3, ge = {
336
+ publicApiKey: "pk_8d21d5122bb23839a2de6c8c76975e74f85b43ab4476c039",
337
+ platform: "iOS",
338
+ appUserId: "44dd573cd1e849a6997a5eaf98298e47",
339
+ aliases: ["$SuperwallAlias:00EB5C40-68A7-4778-B634-F3714D2010B9"],
340
+ vendorId: "86A1F395-D3A3-4A1C-914A-5912EF0363E2",
341
+ appVersion: "8.4",
342
+ osVersion: "15.5.0",
343
+ deviceLocale: "en_US",
344
+ deviceModel: "iPhone10",
345
+ deviceLanguageCode: "en",
346
+ deviceCurrencyCode: "USD",
347
+ deviceCurrencySymbol: "$",
348
+ timezoneOffset: tt,
349
+ radioType: "Wifi",
350
+ interfaceStyle: "Dark",
351
+ isLowPowerModeEnabled: 0,
352
+ bundleId: "com.jakemor.fitnessai",
353
+ isMac: 0,
354
+ totalPaywallViews: 0,
355
+ interfaceType: "iphone"
356
+ }, L = (e) => String(e).padStart(2, "0"), je = (e) => {
357
+ const t = `${e.getUTCFullYear()}-${L(e.getUTCMonth() + 1)}-${L(e.getUTCDate())}`, r = `${L(e.getUTCHours())}:${L(e.getUTCMinutes())}:${L(e.getUTCSeconds())}`;
358
+ return { date: t, time: r, dateTime: `${t}T${r}` };
359
+ }, an = (e, t = tt) => {
360
+ const r = e - 5 * de, a = e - 360 * pe, s = je(new Date(e)), i = je(new Date(e + t * 1e3));
361
+ return {
362
+ daysSinceInstall: Math.floor((e - r) / de),
363
+ minutesSinceInstall: Math.floor((e - r) / pe),
364
+ appInstallDate: new Date(r).toISOString(),
365
+ daysSinceLastPaywallView: Math.floor((e - a) / de),
366
+ minutesSinceLastPaywallView: Math.floor((e - a) / pe),
367
+ utcDate: s.date,
368
+ localDate: i.date,
369
+ utcTime: s.time,
370
+ localTime: i.time,
371
+ utcDateTime: s.dateTime,
372
+ localDateTime: i.dateTime
373
+ };
374
+ }, sn = (e = Date.now()) => ({
375
+ ...ge,
376
+ ...an(e, ge.timezoneOffset)
377
+ }), on = {
378
+ appUserId: ge.appUserId,
379
+ email: "preview@example.com",
380
+ firstName: "John",
381
+ lastName: "Doe",
382
+ country: "US",
383
+ language: "en"
384
+ }, ln = {
385
+ $event_name: "campaign_trigger",
386
+ event_name: "campaign_trigger",
387
+ $is_standard_event: !1,
388
+ $is_feature_gatable: !1
389
+ }, nt = {
390
+ currencyCode: "USD",
391
+ currencySymbol: "$",
392
+ dailyPrice: "$0.25",
393
+ languageCode: "en",
394
+ locale: "en_US@currency=USD",
395
+ monthlyPrice: "$7.50",
396
+ period: "year",
397
+ periodAlt: "1 yr",
398
+ periodDays: 365,
399
+ periodly: "yearly",
400
+ periodMonths: 12,
401
+ periodWeeks: 52,
402
+ periodYears: 1,
403
+ localizedPeriod: "year",
404
+ price: "$89.99",
405
+ rawPrice: 89.99,
406
+ trialPeriodDays: 7,
407
+ trialPeriodMonths: 0,
408
+ trialPeriodText: "7-day",
409
+ trialPeriodWeeks: 1,
410
+ trialPeriodYears: 0,
411
+ rawTrialPeriodPrice: 0,
412
+ trialPeriodPrice: "$0.00",
413
+ trialPeriodDailyPrice: "$0.00",
414
+ trialPeriodWeeklyPrice: "$0.00",
415
+ trialPeriodMonthlyPrice: "$0.00",
416
+ trialPeriodYearlyPrice: "$0.00",
417
+ weeklyPrice: "$1.73",
418
+ yearlyPrice: "$89.99"
419
+ }, cn = (e) => Object.fromEntries(
420
+ Object.entries(e).filter(([t]) => !t.toLowerCase().includes("trial"))
421
+ );
422
+ cn(nt);
423
+ const y = ({ children: e }) => /* @__PURE__ */ n("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: e }), rt = () => /* @__PURE__ */ c(y, { children: [
424
+ /* @__PURE__ */ n("path", { d: "M21 12a9 9 0 1 1-2.64-6.36" }),
425
+ /* @__PURE__ */ n("path", { d: "M21 3v6h-6" })
426
+ ] }), G = () => /* @__PURE__ */ c(y, { children: [
427
+ /* @__PURE__ */ n("path", { d: "M15 3h6v6" }),
428
+ /* @__PURE__ */ n("path", { d: "M10 14 21 3" }),
429
+ /* @__PURE__ */ n("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
430
+ ] }), dn = () => /* @__PURE__ */ c(y, { children: [
431
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
432
+ /* @__PURE__ */ n("path", { d: "M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" })
433
+ ] }), pn = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) }), un = () => /* @__PURE__ */ c(y, { children: [
434
+ /* @__PURE__ */ n("path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3" }),
435
+ /* @__PURE__ */ n("path", { d: "M14 2v4M8 10v4M16 18v4" })
436
+ ] }), at = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M18 6 6 18M6 6l12 12" }) }), st = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) }), mn = () => /* @__PURE__ */ c(y, { children: [
437
+ /* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "16" }),
438
+ /* @__PURE__ */ n("path", { d: "M12 4v16" })
439
+ ] }), ue = () => /* @__PURE__ */ c(y, { children: [
440
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
441
+ /* @__PURE__ */ n("path", { d: "m8.5 12 2.5 2.5 4.5-5" })
442
+ ] }), me = () => /* @__PURE__ */ c(y, { children: [
443
+ /* @__PURE__ */ n("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
444
+ /* @__PURE__ */ n("path", { d: "M12 9v4" }),
445
+ /* @__PURE__ */ n("path", { d: "M12 17h.01" })
446
+ ] }), hn = () => /* @__PURE__ */ c(y, { children: [
447
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
448
+ /* @__PURE__ */ n("path", { d: "M12 11v5" }),
449
+ /* @__PURE__ */ n("path", { d: "M12 8h.01" })
450
+ ] }), q = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M13 2 4.5 13H11l-1 9 8.5-11H12l1-9Z" }) }), he = () => /* @__PURE__ */ c(y, { children: [
451
+ /* @__PURE__ */ n("circle", { cx: "9", cy: "20", r: "1" }),
452
+ /* @__PURE__ */ n("circle", { cx: "18", cy: "20", r: "1" }),
453
+ /* @__PURE__ */ n("path", { d: "M2 3h2.5l2.2 11.2a2 2 0 0 0 2 1.6h8.4a2 2 0 0 0 2-1.6L21 7H5.4" })
454
+ ] }), fn = () => /* @__PURE__ */ c(y, { children: [
455
+ /* @__PURE__ */ n("path", { d: "M18 8a6 6 0 1 0-12 0c0 6-2 8-2 8h16s-2-2-2-8" }),
456
+ /* @__PURE__ */ n("path", { d: "M13.7 21a2 2 0 0 1-3.4 0" })
457
+ ] }), bn = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1-5.4-2.9-5.4 2.9 1-6.1L3.2 9.5l6.1-.9L12 3Z" }) }), wn = () => /* @__PURE__ */ c(y, { children: [
458
+ /* @__PURE__ */ n("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
459
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "7", r: "4" })
460
+ ] }), vn = () => /* @__PURE__ */ c(y, { children: [
461
+ /* @__PURE__ */ n("rect", { x: "4", y: "2", width: "10", height: "16", rx: "2" }),
462
+ /* @__PURE__ */ n("path", { d: "M17 12a5 5 0 0 1-5 9H9" }),
463
+ /* @__PURE__ */ n("path", { d: "m11 19-2 2 2 2" })
464
+ ] }), X = {
55
465
  push: ["link", "build", "assets", "push", "source"],
56
466
  publish: ["link", "build", "assets", "push", "source", "promote"],
57
467
  promote: ["link", "promote"]
58
- }, dt = {
468
+ }, yn = {
59
469
  link: "Find paywall",
60
470
  build: "Build snapshot",
61
471
  assets: "Sync assets",
62
472
  push: "Push version",
63
473
  source: "Push source",
64
474
  promote: "Promote to live"
65
- }, je = [
475
+ }, it = [
66
476
  { name: "push", label: "Push", hint: "New version, nothing live changes" },
67
477
  { name: "publish", label: "Publish", hint: "Push and make it live" },
68
478
  { name: "promote", label: "Promote", hint: "Make the latest push live" }
69
- ], de = (e) => je.find((n) => n.name === e)?.label ?? e, Le = {
479
+ ], xe = (e) => it.find((t) => t.name === e)?.label ?? e, ot = {
70
480
  push: "Pushing…",
71
481
  publish: "Publishing…",
72
482
  promote: "Promoting…"
73
- }, pt = ({ state: e }) => e === "active" ? /* @__PURE__ */ t("span", { className: "bg-accent h-2 w-2 animate-pulse" }) : e === "done" ? /* @__PURE__ */ t("span", { className: "bg-accent h-2 w-2" }) : e === "failed" ? /* @__PURE__ */ t("span", { className: "bg-red h-2 w-2" }) : /* @__PURE__ */ t("span", { className: "bg-cream/55 h-2 w-2" }), ht = ({ progress: e }) => {
74
- const n = Q[e.action], s = n.filter((r) => e.steps[r] === "done").length, a = e.error !== void 0;
75
- return /* @__PURE__ */ o("div", { className: "w-64", children: [
76
- /* @__PURE__ */ o("div", { className: "border-b border-cream/10 px-3 py-2.5", children: [
77
- /* @__PURE__ */ t("div", { className: "text-[0.8125rem] font-medium", children: a ? `${de(e.action)} failed` : s === n.length ? `${de(e.action)} complete` : Le[e.action] }),
78
- /* @__PURE__ */ t("div", { className: "mt-2 h-0.5 w-full bg-cream/10", children: /* @__PURE__ */ t(
483
+ }, gn = ({ state: e }) => e === "active" ? /* @__PURE__ */ n("span", { className: "bg-accent h-2 w-2 animate-pulse" }) : e === "done" ? /* @__PURE__ */ n("span", { className: "bg-accent h-2 w-2" }) : e === "failed" ? /* @__PURE__ */ n("span", { className: "bg-red h-2 w-2" }) : /* @__PURE__ */ n("span", { className: "bg-cream/55 h-2 w-2" }), xn = ({ progress: e }) => {
484
+ const t = X[e.action], r = t.filter((s) => e.steps[s] === "done").length, a = e.error !== void 0;
485
+ return /* @__PURE__ */ c("div", { className: "w-64", children: [
486
+ /* @__PURE__ */ c("div", { className: "border-b border-cream/10 px-3 py-2.5", children: [
487
+ /* @__PURE__ */ n("div", { className: "text-[0.8125rem] font-medium", children: a ? `${xe(e.action)} failed` : r === t.length ? `${xe(e.action)} complete` : ot[e.action] }),
488
+ /* @__PURE__ */ n("div", { className: "mt-2 h-0.5 w-full bg-cream/10", children: /* @__PURE__ */ n(
79
489
  "div",
80
490
  {
81
491
  className: `h-full transition-[width] duration-300 ease-out ${a ? "bg-red" : "bg-accent"}`,
82
- style: { width: `${s / n.length * 100}%` }
492
+ style: { width: `${r / t.length * 100}%` }
83
493
  }
84
494
  ) })
85
495
  ] }),
86
- /* @__PURE__ */ t("ul", { className: "m-0 list-none px-3 py-2", children: n.map((r, i) => {
87
- const c = e.steps[r] ?? "pending";
88
- return /* @__PURE__ */ o("li", { className: "flex items-center gap-2.5 py-1.5", children: [
89
- /* @__PURE__ */ t(
496
+ /* @__PURE__ */ n("ul", { className: "m-0 list-none px-3 py-2", children: t.map((s, i) => {
497
+ const o = e.steps[s] ?? "pending";
498
+ return /* @__PURE__ */ c("li", { className: "flex items-center gap-2.5 py-1.5", children: [
499
+ /* @__PURE__ */ n(
90
500
  "span",
91
501
  {
92
- className: `w-4 font-mono text-[0.625rem] tabular-nums ${c === "pending" ? "text-cream/25" : "text-cream/55"}`,
502
+ className: `w-4 font-mono text-[0.625rem] tabular-nums ${o === "pending" ? "text-cream/25" : "text-cream/55"}`,
93
503
  children: String(i + 1).padStart(2, "0")
94
504
  }
95
505
  ),
96
- /* @__PURE__ */ t(
506
+ /* @__PURE__ */ n(
97
507
  "span",
98
508
  {
99
- className: `flex-1 text-[0.8125rem] ${c === "pending" ? "text-cream/40" : "text-cream"}`,
100
- children: dt[r]
509
+ className: `flex-1 text-[0.8125rem] ${o === "pending" ? "text-cream/40" : "text-cream"}`,
510
+ children: yn[s]
101
511
  }
102
512
  ),
103
- /* @__PURE__ */ t(pt, { state: c })
104
- ] }, r);
513
+ /* @__PURE__ */ n(gn, { state: o })
514
+ ] }, s);
105
515
  }) }),
106
- e.error && /* @__PURE__ */ t("div", { className: "text-red border-t border-cream/10 px-3 py-2.5 text-xs whitespace-pre-wrap", children: e.error })
516
+ e.error && /* @__PURE__ */ n("div", { className: "text-red border-t border-cream/10 px-3 py-2.5 text-xs whitespace-pre-wrap", children: e.error })
107
517
  ] });
108
- }, mt = ({
518
+ }, Nn = ({
109
519
  progress: e,
110
- blocked: n,
111
- onRun: s,
520
+ blocked: t,
521
+ onRun: r,
112
522
  onBlocked: a
113
523
  }) => {
114
- const [r, i] = d.useState("push"), [c, f] = d.useState(!1), u = d.useRef(null), l = n !== void 0, h = e !== void 0 && e.error === void 0 && Q[e.action].some((b) => e.steps[b] !== "done"), w = e !== void 0;
115
- return d.useEffect(() => {
116
- if (!c) return;
117
- const b = (m) => {
118
- u.current && !m.composedPath().includes(u.current) && f(!1);
524
+ const [s, i] = p.useState("push"), [o, u] = p.useState(!1), l = p.useRef(null), m = t !== void 0, d = e !== void 0 && e.error === void 0 && X[e.action].some((w) => e.steps[w] !== "done"), b = e !== void 0;
525
+ return p.useEffect(() => {
526
+ if (!o) return;
527
+ const w = (f) => {
528
+ l.current && !f.composedPath().includes(l.current) && u(!1);
119
529
  };
120
- return window.addEventListener("mousedown", b), () => window.removeEventListener("mousedown", b);
121
- }, [c]), /* @__PURE__ */ o("div", { className: "relative flex", ref: u, children: [
122
- /* @__PURE__ */ t(
530
+ return window.addEventListener("mousedown", w), () => window.removeEventListener("mousedown", w);
531
+ }, [o]), /* @__PURE__ */ c("div", { className: "relative flex", ref: l, children: [
532
+ /* @__PURE__ */ n(
123
533
  "button",
124
534
  {
125
535
  type: "button",
126
536
  className: "sw-btn sw-btn--primary disabled:cursor-not-allowed disabled:opacity-40",
127
- disabled: h,
128
- title: n,
129
- onClick: () => l ? a?.() : s(r),
130
- children: h ? Le[e.action] : de(r)
537
+ disabled: d,
538
+ title: t,
539
+ onClick: () => m ? a?.() : r(s),
540
+ children: d ? ot[e.action] : xe(s)
131
541
  }
132
542
  ),
133
- /* @__PURE__ */ t(
543
+ /* @__PURE__ */ n(
134
544
  "button",
135
545
  {
136
546
  type: "button",
137
547
  className: "sw-btn sw-btn--primary -ml-px w-6 !px-0 disabled:cursor-not-allowed disabled:opacity-40",
138
548
  "aria-label": "Choose action",
139
- "aria-expanded": c,
140
- title: n,
141
- disabled: h,
142
- onClick: () => f((b) => !b),
143
- children: /* @__PURE__ */ t(Re, {})
549
+ "aria-expanded": o,
550
+ title: t,
551
+ disabled: d,
552
+ onClick: () => u((w) => !w),
553
+ children: /* @__PURE__ */ n(st, {})
144
554
  }
145
555
  ),
146
- (w || c) && /* @__PURE__ */ t("div", { className: "bg-bar absolute top-full right-0 z-20 mt-1 border border-cream/20", children: w ? /* @__PURE__ */ t(ht, { progress: e }) : /* @__PURE__ */ t("div", { className: "w-64", children: je.map((b) => /* @__PURE__ */ o(
556
+ (b || o) && /* @__PURE__ */ n("div", { className: "bg-bar absolute top-full right-0 z-20 mt-1 border border-cream/20", children: b ? /* @__PURE__ */ n(xn, { progress: e }) : /* @__PURE__ */ n("div", { className: "w-64", children: it.map((w) => /* @__PURE__ */ c(
147
557
  "button",
148
558
  {
149
559
  type: "button",
150
560
  className: "flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-cream/5",
151
561
  onClick: () => {
152
- i(b.name), f(!1);
562
+ i(w.name), u(!1);
153
563
  },
154
564
  children: [
155
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] font-medium", children: b.label }),
156
- /* @__PURE__ */ t("span", { className: "text-xs text-cream/55", children: b.hint })
565
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium", children: w.label }),
566
+ /* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: w.hint })
157
567
  ]
158
568
  },
159
- b.name
569
+ w.name
160
570
  )) }) })
161
571
  ] });
162
- }, ie = ({
572
+ }, fe = ({
163
573
  label: e,
164
- hint: n,
165
- selected: s,
574
+ hint: t,
575
+ selected: r,
166
576
  onSelect: a
167
- }) => /* @__PURE__ */ o(
577
+ }) => /* @__PURE__ */ c(
168
578
  "button",
169
579
  {
170
580
  type: "button",
171
581
  className: "flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-cream/5",
172
- "aria-current": s || void 0,
582
+ "aria-current": r || void 0,
173
583
  onClick: a,
174
584
  children: [
175
- /* @__PURE__ */ o("span", { className: "flex max-w-full items-center gap-1.5 text-[0.8125rem] font-medium", children: [
176
- /* @__PURE__ */ t("span", { className: "truncate", children: e }),
177
- s && /* @__PURE__ */ t("span", { className: "bg-accent size-[5px] shrink-0 rounded-full", "aria-hidden": "true" })
585
+ /* @__PURE__ */ c("span", { className: "flex max-w-full items-center gap-1.5 text-[0.8125rem] font-medium", children: [
586
+ /* @__PURE__ */ n("span", { className: "truncate", children: e }),
587
+ r && /* @__PURE__ */ n("span", { className: "bg-accent size-[5px] shrink-0 rounded-full", "aria-hidden": "true" })
178
588
  ] }),
179
- /* @__PURE__ */ t("span", { className: "max-w-full truncate text-xs text-cream/55", children: n })
589
+ /* @__PURE__ */ n("span", { className: "max-w-full truncate text-xs text-cream/55", children: t })
180
590
  ]
181
591
  }
182
- ), ut = ({
592
+ ), Sn = ({
183
593
  active: e,
184
- options: n,
185
- onSelect: s
594
+ options: t,
595
+ onSelect: r
186
596
  }) => {
187
- const [a, r] = d.useState(!1), [i, c] = d.useState(""), f = d.useRef(null);
188
- d.useEffect(() => {
597
+ const [a, s] = p.useState(!1), [i, o] = p.useState(""), u = p.useRef(null);
598
+ p.useEffect(() => {
189
599
  if (!a) return;
190
- const m = (E) => {
191
- f.current && !E.composedPath().includes(f.current) && r(!1);
600
+ const f = (S) => {
601
+ u.current && !S.composedPath().includes(u.current) && s(!1);
192
602
  };
193
- return window.addEventListener("mousedown", m), () => window.removeEventListener("mousedown", m);
194
- }, [a]), d.useEffect(() => {
195
- a || c("");
603
+ return window.addEventListener("mousedown", f), () => window.removeEventListener("mousedown", f);
604
+ }, [a]), p.useEffect(() => {
605
+ a || o("");
196
606
  }, [a]);
197
- const u = e && (e.type === "live" ? "live" : `surface:${e.surface.kind}/${e.surface.id}`), l = (m) => {
198
- r(!1), s(m);
199
- }, h = i.trim().toLowerCase(), w = n.filter((m) => m.key === "live"), b = n.filter((m) => m.key !== "live").filter(
200
- (m) => h === "" || `${m.label} ${m.hint}`.toLowerCase().includes(h)
607
+ const l = e && (e.type === "live" ? "live" : `surface:${e.surface.kind}/${e.surface.id}`), m = (f) => {
608
+ s(!1), r(f);
609
+ }, d = i.trim().toLowerCase(), b = t.filter((f) => f.key === "live"), w = t.filter((f) => f.key !== "live").filter(
610
+ (f) => d === "" || `${f.label} ${f.hint}`.toLowerCase().includes(d)
201
611
  );
202
- return /* @__PURE__ */ o("div", { className: "relative flex", ref: f, children: [
203
- /* @__PURE__ */ o(
612
+ return /* @__PURE__ */ c("div", { className: "relative flex", ref: u, children: [
613
+ /* @__PURE__ */ c(
204
614
  "button",
205
615
  {
206
616
  type: "button",
207
617
  className: "sw-btn",
208
618
  "aria-pressed": e !== void 0,
209
619
  "aria-expanded": a,
210
- onClick: () => r((m) => !m),
620
+ onClick: () => s((f) => !f),
211
621
  children: [
212
- /* @__PURE__ */ t(at, {}),
622
+ /* @__PURE__ */ n(mn, {}),
213
623
  "Compare"
214
624
  ]
215
625
  }
216
626
  ),
217
- a && /* @__PURE__ */ o("div", { className: "bg-bar absolute bottom-full left-0 z-20 mb-1 flex w-72 flex-col border border-cream/20", children: [
218
- /* @__PURE__ */ t("div", { className: "p-2", children: /* @__PURE__ */ t(
627
+ a && /* @__PURE__ */ c("div", { className: "bg-bar absolute bottom-full left-0 z-20 mb-1 flex w-72 flex-col border border-cream/20", children: [
628
+ /* @__PURE__ */ n("div", { className: "p-2", children: /* @__PURE__ */ n(
219
629
  "input",
220
630
  {
221
631
  className: "sw-input",
@@ -223,49 +633,49 @@ const et = ({
223
633
  value: i,
224
634
  placeholder: "Search paywalls",
225
635
  "aria-label": "Search paywalls",
226
- onChange: (m) => c(m.target.value)
636
+ onChange: (f) => o(f.target.value)
227
637
  }
228
638
  ) }),
229
- /* @__PURE__ */ t("div", { className: "max-h-64 overflow-y-auto", children: b.length === 0 ? /* @__PURE__ */ t("span", { className: "block px-3 pt-2 pb-4 text-[0.8125rem] text-cream/45", children: h === "" ? "No other paywalls here." : `Nothing matches “${i.trim()}”.` }) : b.map((m) => /* @__PURE__ */ t(
230
- ie,
639
+ /* @__PURE__ */ n("div", { className: "max-h-64 overflow-y-auto", children: w.length === 0 ? /* @__PURE__ */ n("span", { className: "block px-3 pt-2 pb-4 text-[0.8125rem] text-cream/45", children: d === "" ? "No other paywalls here." : `Nothing matches “${i.trim()}”.` }) : w.map((f) => /* @__PURE__ */ n(
640
+ fe,
231
641
  {
232
- label: m.label,
233
- hint: m.hint,
234
- selected: m.key === u,
235
- onSelect: () => l(m.target)
642
+ label: f.label,
643
+ hint: f.hint,
644
+ selected: f.key === l,
645
+ onSelect: () => m(f.target)
236
646
  },
237
- m.key
647
+ f.key
238
648
  )) }),
239
- /* @__PURE__ */ o("div", { className: "flex flex-col border-t border-cream/10", children: [
240
- w.map((m) => /* @__PURE__ */ t(
241
- ie,
649
+ /* @__PURE__ */ c("div", { className: "flex flex-col border-t border-cream/10", children: [
650
+ b.map((f) => /* @__PURE__ */ n(
651
+ fe,
242
652
  {
243
- label: m.label,
244
- hint: m.hint,
245
- selected: m.key === u,
246
- onSelect: () => l(m.target)
653
+ label: f.label,
654
+ hint: f.hint,
655
+ selected: f.key === l,
656
+ onSelect: () => m(f.target)
247
657
  },
248
- m.key
658
+ f.key
249
659
  )),
250
- /* @__PURE__ */ t(
251
- ie,
660
+ /* @__PURE__ */ n(
661
+ fe,
252
662
  {
253
663
  label: "Off",
254
664
  hint: "A single preview",
255
665
  selected: e === void 0,
256
- onSelect: () => l(void 0)
666
+ onSelect: () => m(void 0)
257
667
  }
258
668
  )
259
669
  ] })
260
670
  ] })
261
671
  ] });
262
- }, ft = () => /* @__PURE__ */ o("svg", { width: "19", height: "12", viewBox: "0 0 19 12", fill: "currentColor", "aria-hidden": "true", children: [
263
- /* @__PURE__ */ t("rect", { x: "0", y: "7.5", width: "3.5", height: "4.5", rx: "1" }),
264
- /* @__PURE__ */ t("rect", { x: "5", y: "5", width: "3.5", height: "7", rx: "1" }),
265
- /* @__PURE__ */ t("rect", { x: "10", y: "2.5", width: "3.5", height: "9.5", rx: "1" }),
266
- /* @__PURE__ */ t("rect", { x: "15", y: "0", width: "3.5", height: "12", rx: "1" })
267
- ] }), bt = () => /* @__PURE__ */ o("svg", { width: "27", height: "13", viewBox: "0 0 27 13", "aria-hidden": "true", children: [
268
- /* @__PURE__ */ t(
672
+ }, _n = () => /* @__PURE__ */ c("svg", { width: "19", height: "12", viewBox: "0 0 19 12", fill: "currentColor", "aria-hidden": "true", children: [
673
+ /* @__PURE__ */ n("rect", { x: "0", y: "7.5", width: "3.5", height: "4.5", rx: "1" }),
674
+ /* @__PURE__ */ n("rect", { x: "5", y: "5", width: "3.5", height: "7", rx: "1" }),
675
+ /* @__PURE__ */ n("rect", { x: "10", y: "2.5", width: "3.5", height: "9.5", rx: "1" }),
676
+ /* @__PURE__ */ n("rect", { x: "15", y: "0", width: "3.5", height: "12", rx: "1" })
677
+ ] }), kn = () => /* @__PURE__ */ c("svg", { width: "27", height: "13", viewBox: "0 0 27 13", "aria-hidden": "true", children: [
678
+ /* @__PURE__ */ n(
269
679
  "rect",
270
680
  {
271
681
  x: "0.5",
@@ -278,78 +688,78 @@ const et = ({
278
688
  strokeOpacity: "0.35"
279
689
  }
280
690
  ),
281
- /* @__PURE__ */ t("path", { d: "M25 4.5v4a2.17 2.17 0 0 0 0-4Z", fill: "currentColor", fillOpacity: "0.4" }),
282
- /* @__PURE__ */ t("rect", { x: "2", y: "2", width: "20", height: "9", rx: "2.5", fill: "currentColor" })
283
- ] }), wt = () => /* @__PURE__ */ o("span", { className: "flex items-center gap-[7px]", children: [
284
- /* @__PURE__ */ t(ft, {}),
285
- /* @__PURE__ */ t("span", { style: { fontSize: 12.5, fontWeight: 700, letterSpacing: "0.02em" }, children: "SW" }),
286
- /* @__PURE__ */ t(bt, {})
287
- ] }), vt = ({
691
+ /* @__PURE__ */ n("path", { d: "M25 4.5v4a2.17 2.17 0 0 0 0-4Z", fill: "currentColor", fillOpacity: "0.4" }),
692
+ /* @__PURE__ */ n("rect", { x: "2", y: "2", width: "20", height: "9", rx: "2.5", fill: "currentColor" })
693
+ ] }), In = () => /* @__PURE__ */ c("span", { className: "flex items-center gap-[7px]", children: [
694
+ /* @__PURE__ */ n(_n, {}),
695
+ /* @__PURE__ */ n("span", { style: { fontSize: 12.5, fontWeight: 700, letterSpacing: "0.02em" }, children: "SW" }),
696
+ /* @__PURE__ */ n(kn, {})
697
+ ] }), Pn = ({
288
698
  spec: e,
289
- width: n,
290
- height: s,
699
+ width: t,
700
+ height: r,
291
701
  landscape: a,
292
- theme: r
702
+ theme: s
293
703
  }) => {
294
- const i = r === "dark" ? "rgba(255,255,255,0.95)" : "rgba(0,0,0,0.95)", c = Math.max(28, e.radius * 0.6);
295
- return /* @__PURE__ */ o(
704
+ const i = s === "dark" ? "rgba(255,255,255,0.95)" : "rgba(0,0,0,0.95)", o = Math.max(28, e.radius * 0.6);
705
+ return /* @__PURE__ */ c(
296
706
  "div",
297
707
  {
298
708
  className: "pointer-events-none absolute inset-0 select-none",
299
- style: { width: n, height: s, color: i },
709
+ style: { width: t, height: r, color: i },
300
710
  "data-testid": "device-chrome",
301
711
  children: [
302
- !a && /* @__PURE__ */ o(
712
+ !a && /* @__PURE__ */ c(
303
713
  "div",
304
714
  {
305
715
  className: "absolute inset-x-0 top-0 flex items-center justify-between",
306
716
  style: {
307
717
  height: e.statusBarHeight,
308
- paddingLeft: c,
309
- paddingRight: c,
718
+ paddingLeft: o,
719
+ paddingRight: o,
310
720
  fontFamily: '-apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif',
311
721
  fontSize: 15,
312
722
  fontWeight: 600,
313
723
  letterSpacing: "-0.2px"
314
724
  },
315
725
  children: [
316
- /* @__PURE__ */ t("span", { children: "9:41" }),
317
- /* @__PURE__ */ t(wt, {})
726
+ /* @__PURE__ */ n("span", { children: "9:41" }),
727
+ /* @__PURE__ */ n(In, {})
318
728
  ]
319
729
  }
320
730
  ),
321
- e.cutout === "island" && (a ? /* @__PURE__ */ t(
731
+ e.cutout === "island" && (a ? /* @__PURE__ */ n(
322
732
  "div",
323
733
  {
324
734
  className: "absolute rounded-full bg-black",
325
- style: { left: 12, top: (s - 124) / 2, width: 36, height: 124 }
735
+ style: { left: 12, top: (r - 124) / 2, width: 36, height: 124 }
326
736
  }
327
- ) : /* @__PURE__ */ t(
737
+ ) : /* @__PURE__ */ n(
328
738
  "div",
329
739
  {
330
740
  className: "absolute rounded-full bg-black",
331
- style: { left: (n - 124) / 2, top: 12, width: 124, height: 36 }
741
+ style: { left: (t - 124) / 2, top: 12, width: 124, height: 36 }
332
742
  }
333
743
  )),
334
- e.cutout === "punch" && (a ? /* @__PURE__ */ t(
744
+ e.cutout === "punch" && (a ? /* @__PURE__ */ n(
335
745
  "div",
336
746
  {
337
747
  className: "absolute rounded-full bg-black",
338
- style: { left: 16, top: (s - 13) / 2, width: 13, height: 13 }
748
+ style: { left: 16, top: (r - 13) / 2, width: 13, height: 13 }
339
749
  }
340
- ) : /* @__PURE__ */ t(
750
+ ) : /* @__PURE__ */ n(
341
751
  "div",
342
752
  {
343
753
  className: "absolute rounded-full bg-black",
344
- style: { left: (n - 13) / 2, top: 15, width: 13, height: 13 }
754
+ style: { left: (t - 13) / 2, top: 15, width: 13, height: 13 }
345
755
  }
346
756
  )),
347
- e.homeIndicator && /* @__PURE__ */ t(
757
+ e.homeIndicator && /* @__PURE__ */ n(
348
758
  "div",
349
759
  {
350
760
  className: "absolute rounded-full",
351
761
  style: {
352
- width: Math.round(Math.min(n, s) * 0.36),
762
+ width: Math.round(Math.min(t, r) * 0.36),
353
763
  height: 5,
354
764
  left: "50%",
355
765
  transform: "translateX(-50%)",
@@ -362,133 +772,119 @@ const et = ({
362
772
  ]
363
773
  }
364
774
  );
365
- }, ge = 96, gt = 250, Te = (e, n, s) => {
366
- const [a, r] = d.useState(1);
367
- return d.useLayoutEffect(() => {
775
+ }, En = (e, t) => {
776
+ const r = p.useRef(void 0), a = p.useRef({ hostState: e, delegate: t }), s = p.useCallback((i) => {
777
+ if (r.current?.detach(), r.current = void 0, !i?.contentWindow) return;
778
+ const { host: o, detach: u } = rn({
779
+ target: i.contentWindow,
780
+ state: a.current.hostState,
781
+ delegate: a.current.delegate
782
+ });
783
+ r.current = { host: o, detach: u, sent: a.current.hostState };
784
+ }, []);
785
+ return p.useEffect(() => {
786
+ a.current = { hostState: e, delegate: t };
787
+ const i = r.current;
788
+ i && (i.host.update(Pt(i.sent, e)), i.sent = e);
789
+ }, [e, t]), s;
790
+ }, lt = ({ hostState: e, delegate: t, ...r }) => /* @__PURE__ */ n("iframe", { ...r, ref: En(e, t) }), Ue = 96, Cn = 250, ct = (e, t, r) => {
791
+ const [a, s] = p.useState(1);
792
+ return p.useLayoutEffect(() => {
368
793
  const i = e.current;
369
794
  if (!i) return;
370
- const c = () => {
371
- const u = i.getBoundingClientRect(), l = Math.min(
795
+ const o = () => {
796
+ const l = i.getBoundingClientRect(), m = Math.min(
372
797
  1,
373
- (u.width - ge) / n,
374
- (u.height - ge) / s
798
+ (l.width - Ue) / t,
799
+ (l.height - Ue) / r
375
800
  );
376
- r(Math.max(0.1, l));
801
+ s(Math.max(0.1, m));
377
802
  };
378
- if (c(), typeof ResizeObserver > "u") return;
379
- const f = new ResizeObserver(c);
380
- return f.observe(i), () => f.disconnect();
381
- }, [e, n, s]), a;
382
- }, xt = ({
803
+ if (o(), typeof ResizeObserver > "u") return;
804
+ const u = new ResizeObserver(o);
805
+ return u.observe(i), () => u.disconnect();
806
+ }, [e, t, r]), a;
807
+ }, $n = ({
383
808
  width: e,
384
- height: n,
385
- stageRef: s,
809
+ height: t,
810
+ stageRef: r,
386
811
  children: a
387
812
  }) => {
388
- const r = Te(s, e, n);
389
- return /* @__PURE__ */ t(
813
+ const s = ct(r, e, t);
814
+ return /* @__PURE__ */ n(
390
815
  "div",
391
816
  {
392
817
  className: "flex flex-none items-center justify-center overflow-hidden border border-dashed border-cream/20 p-6 text-center text-sm text-cream/55",
393
818
  "data-testid": "device-placeholder",
394
- style: { width: e * r, height: n * r },
819
+ style: { width: e * s, height: t * s },
395
820
  children: a
396
821
  }
397
822
  );
398
- }, yt = (e, n, s) => {
399
- try {
400
- const a = window.location.origin, r = new URL(n, a), i = new URL(s, a);
401
- if (r.origin !== i.origin || r.pathname !== i.pathname) return !1;
402
- const c = e?.contentWindow?.__swPreviewApply;
403
- return typeof c != "function" ? !1 : (c(i.search), !0);
404
- } catch {
405
- return !1;
406
- }
407
- }, Nt = ({
823
+ }, On = ({
408
824
  width: e,
409
- height: n,
410
- title: s,
825
+ height: t,
826
+ title: r,
411
827
  src: a,
412
- stageRef: r,
413
- reloadKey: i = 0,
414
- chrome: c,
415
- landscape: f = !1,
416
- theme: u = "light"
828
+ hostState: s,
829
+ delegate: i,
830
+ stageRef: o,
831
+ reloadKey: u = 0,
832
+ chrome: l,
833
+ landscape: m = !1,
834
+ theme: d = "light"
417
835
  }) => {
418
- const l = Te(r, e, n), h = d.useRef(0), [w, b] = d.useState([
419
- { mountSrc: a, currentSrc: a, generation: 0, ready: !0 }
420
- ]), m = d.useRef(w);
421
- m.current = w;
422
- const E = d.useRef(/* @__PURE__ */ new Map()), j = d.useRef(!1), L = d.useRef(i);
423
- d.useEffect(() => {
424
- if (!j.current) {
425
- j.current = !0;
836
+ const b = ct(o, e, t), w = p.useRef(0), [f, S] = p.useState([{ src: a, generation: 0, ready: !0 }]), D = p.useRef(!1);
837
+ p.useEffect(() => {
838
+ if (!D.current) {
839
+ D.current = !0;
426
840
  return;
427
841
  }
428
- const g = i !== L.current;
429
- if (L.current = i, !g) {
430
- const x = m.current.findLast((O) => O.ready), M = x ? E.current.get(x.generation) : void 0;
431
- if (x && yt(M, x.currentSrc, a)) {
432
- b(
433
- (O) => O.map(
434
- (T) => T.generation === x.generation ? { ...T, currentSrc: a } : T
435
- )
436
- );
437
- return;
438
- }
439
- }
440
- h.current += 1;
441
- const S = {
442
- mountSrc: a,
443
- currentSrc: a,
444
- generation: h.current,
445
- ready: !1
446
- };
447
- b((x) => [...x.filter((M) => M.ready).slice(-1), S]);
448
- }, [a, i]);
449
- const C = (g) => {
842
+ w.current += 1;
843
+ const g = { src: a, generation: w.current, ready: !1 };
844
+ S((C) => [...C.filter((x) => x.ready).slice(-1), g]);
845
+ }, [a, u]);
846
+ const H = (g) => {
450
847
  window.setTimeout(() => {
451
- b((S) => S.some((x) => x.generation === g) ? S.map((x) => x.generation === g ? { ...x, ready: !0 } : x).filter((x) => x.generation >= g) : S);
452
- }, gt);
453
- }, X = w.findLast((g) => g.ready), F = c ? c.radius * l : 0;
454
- return /* @__PURE__ */ o(
848
+ S((C) => C.some((x) => x.generation === g) ? C.map((x) => x.generation === g ? { ...x, ready: !0 } : x).filter((x) => x.generation >= g) : C);
849
+ }, Cn);
850
+ }, P = f.findLast((g) => g.ready), re = l ? l.radius * b : 0;
851
+ return /* @__PURE__ */ c(
455
852
  "div",
456
853
  {
457
- className: `bg-panel relative flex-none overflow-hidden ${c ? "shadow-[0_0_0_1px] shadow-cream/25" : "border border-cream/20"}`,
854
+ className: `bg-panel relative flex-none overflow-hidden ${l ? "shadow-[0_0_0_1px] shadow-cream/25" : "border border-cream/20"}`,
458
855
  "data-testid": "device-frame",
459
- style: { width: e * l, height: n * l, borderRadius: F },
856
+ style: { width: e * b, height: t * b, borderRadius: re },
460
857
  children: [
461
- w.map((g) => /* @__PURE__ */ t(
462
- "iframe",
858
+ f.map((g) => /* @__PURE__ */ n(
859
+ lt,
463
860
  {
464
- ref: (S) => {
465
- S ? E.current.set(g.generation, S) : E.current.delete(g.generation);
466
- },
467
- className: `absolute inset-0 origin-top-left border-0 bg-white transition-opacity duration-150 ${g === X ? "opacity-100" : "opacity-0"}`,
468
- title: s,
469
- src: g.mountSrc,
861
+ hostState: s,
862
+ delegate: i,
863
+ className: `absolute inset-0 origin-top-left border-0 bg-white transition-opacity duration-150 ${g === P ? "opacity-100" : "opacity-0"}`,
864
+ title: r,
865
+ src: g.src,
470
866
  width: e,
471
- height: n,
472
- style: { transform: `scale(${l})` },
867
+ height: t,
868
+ style: { transform: `scale(${b})` },
473
869
  onLoad: () => {
474
- g.ready || C(g.generation);
870
+ g.ready || H(g.generation);
475
871
  }
476
872
  },
477
873
  g.generation
478
874
  )),
479
- c && /* @__PURE__ */ t(
875
+ l && /* @__PURE__ */ n(
480
876
  "div",
481
877
  {
482
878
  className: "pointer-events-none absolute inset-0 origin-top-left",
483
- style: { width: e, height: n, transform: `scale(${l})` },
484
- children: /* @__PURE__ */ t(
485
- vt,
879
+ style: { width: e, height: t, transform: `scale(${b})` },
880
+ children: /* @__PURE__ */ n(
881
+ Pn,
486
882
  {
487
- spec: c,
883
+ spec: l,
488
884
  width: e,
489
- height: n,
490
- landscape: f,
491
- theme: u
885
+ height: t,
886
+ landscape: m,
887
+ theme: d
492
888
  }
493
889
  )
494
890
  }
@@ -496,448 +892,500 @@ const et = ({
496
892
  ]
497
893
  }
498
894
  );
499
- }, St = ({
895
+ }, Mn = ({
500
896
  paywall: e,
501
- missing: n,
502
- onDismiss: s
503
- }) => /* @__PURE__ */ t(
897
+ missing: t,
898
+ onDismiss: r
899
+ }) => /* @__PURE__ */ n(
504
900
  "div",
505
901
  {
506
902
  className: "fixed inset-0 z-50 flex items-center justify-center bg-ink/70 p-6",
507
903
  role: "dialog",
508
904
  "aria-modal": "true",
509
905
  "aria-labelledby": "sw-missing-products",
510
- children: /* @__PURE__ */ o("div", { className: "bg-panel flex w-full max-w-md flex-col gap-4 border border-cream/20 p-5", children: [
511
- /* @__PURE__ */ o("div", { className: "flex flex-col gap-1.5", children: [
512
- /* @__PURE__ */ t("span", { id: "sw-missing-products", className: "text-[0.9375rem] font-medium text-cream", children: n.length === 1 ? "A product is missing" : `${n.length} products are missing` }),
513
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] leading-relaxed text-cream/60", children: `${e} declares ${n.length === 1 ? "a product" : "products"} Superwall has no record of. Every variable on ${n.length === 1 ? "it" : "them"} will be undefined here and on device.` })
906
+ children: /* @__PURE__ */ c("div", { className: "bg-panel flex w-full max-w-md flex-col gap-4 border border-cream/20 p-5", children: [
907
+ /* @__PURE__ */ c("div", { className: "flex flex-col gap-1.5", children: [
908
+ /* @__PURE__ */ n("span", { id: "sw-missing-products", className: "text-[0.9375rem] font-medium text-cream", children: t.length === 1 ? "A product is missing" : `${t.length} products are missing` }),
909
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] leading-relaxed text-cream/60", children: `${e} declares ${t.length === 1 ? "a product" : "products"} Superwall has no record of. Every variable on ${t.length === 1 ? "it" : "them"} will be undefined here and on device.` })
514
910
  ] }),
515
- /* @__PURE__ */ t("ul", { className: "flex flex-col gap-1.5 border-y border-cream/10 py-3", children: n.map((a) => /* @__PURE__ */ o("li", { className: "flex items-baseline justify-between gap-3", children: [
516
- /* @__PURE__ */ t("span", { className: "font-mono text-[11px] text-cream/70", children: a.reference }),
517
- /* @__PURE__ */ t("span", { className: "truncate font-mono text-[11px] text-cream/40", children: a.identifier })
911
+ /* @__PURE__ */ n("ul", { className: "flex flex-col gap-1.5 border-y border-cream/10 py-3", children: t.map((a) => /* @__PURE__ */ c("li", { className: "flex items-baseline justify-between gap-3", children: [
912
+ /* @__PURE__ */ n("span", { className: "font-mono text-[11px] text-cream/70", children: a.reference }),
913
+ /* @__PURE__ */ n("span", { className: "truncate font-mono text-[11px] text-cream/40", children: a.identifier })
518
914
  ] }, a.reference)) }),
519
- /* @__PURE__ */ o("span", { className: "text-xs text-cream/45", children: [
915
+ /* @__PURE__ */ c("span", { className: "text-xs text-cream/45", children: [
520
916
  "Add ",
521
- n.length === 1 ? "it" : "them",
917
+ t.length === 1 ? "it" : "them",
522
918
  " in the Superwall dashboard, or point the config at",
523
- n.length === 1 ? " a product" : " products",
919
+ t.length === 1 ? " a product" : " products",
524
920
  " that exists. Pushing is refused until then."
525
921
  ] }),
526
- /* @__PURE__ */ t("button", { type: "button", className: "sw-btn sw-btn--primary self-end", onClick: s, children: "View anyway" })
922
+ /* @__PURE__ */ n("button", { type: "button", className: "sw-btn sw-btn--primary self-end", onClick: r, children: "View anyway" })
527
923
  ] })
528
924
  }
529
- ), Ae = "superwall-studio", kt = /* @__PURE__ */ new Set([
925
+ ), Tn = /* @__PURE__ */ new Set([
530
926
  "ping",
531
927
  "page_view",
532
928
  "page_styles",
533
929
  "has_set_dom",
534
930
  "haptic_feedback",
535
931
  "var_click",
536
- "template_variables",
537
- "template_substitutions_prefix",
538
- "products",
539
- "paywall_open",
540
- "experiment",
541
- "purchase"
542
- ]), _t = {
932
+ "purchase",
933
+ "restore"
934
+ ]), Dn = {
543
935
  open_url: ["url"],
544
936
  open_url_external: ["url"],
545
- open_deep_link: ["link", "url"],
546
- custom_placement: ["name", "placementName"],
937
+ open_deep_link: ["link"],
938
+ custom_placement: ["name"],
547
939
  custom: ["name", "data"],
548
- request_permission: ["permissionType"],
940
+ request_permission: ["permission_type"],
549
941
  request_callback: ["name"],
550
- schedule_notification: ["title"]
551
- }, Pt = /* @__PURE__ */ new Set(["close", "transaction_abandon", "transaction_fail"]), Et = /* @__PURE__ */ new Set(["transaction_complete", "freeTrial_start"]), Ct = (e) => {
552
- for (const n of _t[e.event_name] ?? []) {
553
- const s = e[n];
554
- if (typeof s == "string" && s.length > 0) return s;
942
+ schedule_notification: ["title"],
943
+ discount_redemption_result: ["code"]
944
+ }, An = /* @__PURE__ */ new Set(["close"]), Rn = /* @__PURE__ */ new Set([
945
+ "stripe_checkout_complete",
946
+ "post_checkout_complete"
947
+ ]), Ln = (e) => {
948
+ for (const t of Dn[e.event_name] ?? []) {
949
+ const r = Reflect.get(e, t);
950
+ if (typeof r == "string" && r.length > 0) return r;
555
951
  }
556
- }, Mt = (e) => {
557
- if (!kt.has(e.event_name))
952
+ }, jn = (e) => {
953
+ if (!Tn.has(e.event_name))
558
954
  return {
559
955
  action: e.event_name,
560
- subject: Ct(e),
561
- tone: Pt.has(e.event_name) ? "warning" : Et.has(e.event_name) ? "success" : "info"
956
+ subject: Ln(e),
957
+ tone: An.has(e.event_name) ? "warning" : Rn.has(e.event_name) ? "success" : "info"
562
958
  };
563
- }, De = (e) => typeof e == "object" && e !== null && Reflect.get(e, "channel") === Ae && ["hello", "event", "ask"].includes(String(Reflect.get(e, "type"))), $t = (e) => Array.isArray(e) && e.every((n) => typeof n == "string"), It = (e) => De(e) && e.type === "hello" && $t(e.locales) ? e.locales : void 0, Ot = {
959
+ }, Un = {
564
960
  info: "text-cream/45",
565
961
  success: "text-accent",
566
962
  warning: "text-red"
567
- }, Rt = {
568
- purchase: re,
569
- transaction_complete: we,
570
- freeTrial_start: we,
571
- transaction_abandon: ve,
572
- transaction_fail: ve,
573
- close: Oe,
574
- restore: Ie,
575
- open_url: Z,
576
- open_url_external: Z,
577
- open_deep_link: Z,
578
- initiate_web_checkout: re,
579
- open_payment_sheet: re,
580
- custom_placement: K,
581
- custom: K,
582
- request_permission: K,
583
- request_callback: K,
584
- schedule_notification: it,
585
- request_store_review: lt,
586
- user_attribute_updated: ot
587
- }, H = ({ children: e }) => /* @__PURE__ */ t("span", { className: "bg-accent/15 text-accent px-1.5 py-px font-mono text-xs whitespace-nowrap", children: e }), he = ({
963
+ }, Fn = {
964
+ purchase: he,
965
+ transaction_complete: ue,
966
+ freeTrial_start: ue,
967
+ transaction_abandon: me,
968
+ transaction_fail: me,
969
+ close: at,
970
+ restore: rt,
971
+ restore_complete: ue,
972
+ restore_fail: me,
973
+ open_url: G,
974
+ open_url_external: G,
975
+ open_deep_link: G,
976
+ initiate_web_checkout: he,
977
+ open_payment_sheet: he,
978
+ custom_placement: q,
979
+ custom: q,
980
+ request_permission: q,
981
+ request_callback: q,
982
+ schedule_notification: fn,
983
+ request_store_review: bn,
984
+ user_attribute_updated: wn
985
+ }, B = ({ children: e }) => /* @__PURE__ */ n("span", { className: "bg-accent/15 text-accent px-1.5 py-px font-mono text-xs whitespace-nowrap", children: e }), _e = ({
588
986
  action: e,
589
- tone: n,
590
- children: s,
987
+ tone: t,
988
+ children: r,
591
989
  actions: a
592
990
  }) => {
593
- const r = Rt[e] ?? rt;
594
- return /* @__PURE__ */ t("div", { className: "bg-panel font-sans w-[344px] border border-cream/15 p-3 shadow-[0_8px_24px_-8px] shadow-black/60", children: /* @__PURE__ */ o("div", { className: "grid grid-cols-[14px_1fr] items-start gap-x-2.5", children: [
595
- /* @__PURE__ */ t("span", { className: `flex h-5 items-center justify-center ${Ot[n]}`, children: /* @__PURE__ */ t(r, {}) }),
596
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] leading-5 font-medium text-cream", children: s }),
597
- a && /* @__PURE__ */ t("div", { className: "col-start-2 mt-2.5 flex justify-end gap-2", children: a })
991
+ const s = Fn[e] ?? hn;
992
+ return /* @__PURE__ */ n("div", { className: "bg-panel font-sans w-[344px] border border-cream/15 p-3 shadow-[0_8px_24px_-8px] shadow-black/60", children: /* @__PURE__ */ c("div", { className: "grid grid-cols-[14px_1fr] items-start gap-x-2.5", children: [
993
+ /* @__PURE__ */ n("span", { className: `flex h-5 items-center justify-center ${Un[t]}`, children: /* @__PURE__ */ n(s, {}) }),
994
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] leading-5 font-medium text-cream", children: r }),
995
+ a && /* @__PURE__ */ n("div", { className: "col-start-2 mt-2.5 flex justify-end gap-2", children: a })
598
996
  ] }) });
599
- }, jt = ({ notice: e }) => /* @__PURE__ */ o(he, { action: e.action, tone: e.tone, children: [
997
+ }, Bn = ({ notice: e }) => /* @__PURE__ */ c(_e, { action: e.action, tone: e.tone, children: [
600
998
  "Tap triggered a ",
601
- /* @__PURE__ */ t(H, { children: e.action }),
602
- e.subject ? /* @__PURE__ */ o(U, { children: [
999
+ /* @__PURE__ */ n(B, { children: e.action }),
1000
+ e.subject ? /* @__PURE__ */ c(Z, { children: [
603
1001
  " for ",
604
- /* @__PURE__ */ t(H, { children: e.subject })
1002
+ /* @__PURE__ */ n(B, { children: e.subject })
605
1003
  ] }) : " action",
606
1004
  "."
607
- ] }), xe = {
608
- completed: { action: "transaction_complete", tone: "success", label: "purchase completed." },
609
- abandoned: { action: "transaction_abandon", tone: "warning", label: "purchase abandoned." },
610
- granted: { action: "request_permission", tone: "success", label: "granted." },
611
- denied: { action: "request_permission", tone: "warning", label: "denied." },
612
- success: { action: "request_callback", tone: "success", label: "succeeded." },
613
- failure: { action: "request_callback", tone: "warning", label: "failed." }
614
- }, Lt = ({ outcome: e, subject: n }) => {
615
- const s = xe[e] ?? xe.completed;
616
- return /* @__PURE__ */ o(he, { action: s?.action ?? "purchase", tone: s?.tone ?? "info", children: [
617
- /* @__PURE__ */ t(H, { children: n }),
618
- " ",
619
- s?.label
620
- ] });
621
- }, ye = {
622
- purchase: { action: "purchase", verb: "purchase", no: "Abandon", yes: "Complete" },
623
- permission: { action: "request_permission", verb: "permission", no: "Deny", yes: "Grant" },
624
- callback: { action: "request_callback", verb: "callback", no: "Fail", yes: "Succeed" }
625
- }, Tt = {
626
- purchase: ["abandoned", "completed"],
627
- permission: ["denied", "granted"],
628
- callback: ["failure", "success"]
629
- }, At = ({
630
- kind: e,
631
- subject: n,
1005
+ ] }), Hn = ({ choice: e, subject: t }) => /* @__PURE__ */ c(_e, { action: e.action, tone: e.tone, children: [
1006
+ /* @__PURE__ */ n(B, { children: t }),
1007
+ " ",
1008
+ e.done
1009
+ ] }), Vn = ({
1010
+ action: e,
1011
+ verb: t,
1012
+ subject: r,
1013
+ choices: a,
632
1014
  onAnswer: s
633
- }) => {
634
- const a = ye[e] ?? ye.purchase, [r, i] = Tt[e] ?? ["abandoned", "completed"];
635
- return /* @__PURE__ */ o(
636
- he,
637
- {
638
- action: a?.action ?? "purchase",
639
- tone: "info",
640
- actions: /* @__PURE__ */ o(U, { children: [
641
- /* @__PURE__ */ t("button", { type: "button", className: "sw-btn", onClick: () => s(r), children: a?.no }),
642
- /* @__PURE__ */ t("button", { type: "button", className: "sw-btn sw-btn--primary", onClick: () => s(i), children: a?.yes })
643
- ] }),
644
- children: [
645
- "Tap triggered a ",
646
- /* @__PURE__ */ t(H, { children: a?.verb }),
647
- " for ",
648
- /* @__PURE__ */ t(H, { children: n }),
649
- "."
650
- ]
651
- }
1015
+ }) => /* @__PURE__ */ c(
1016
+ _e,
1017
+ {
1018
+ action: e,
1019
+ tone: "info",
1020
+ actions: a.map((i) => /* @__PURE__ */ n(
1021
+ "button",
1022
+ {
1023
+ type: "button",
1024
+ className: i.primary ? "sw-btn sw-btn--primary" : "sw-btn",
1025
+ onClick: () => s(i),
1026
+ children: i.label
1027
+ },
1028
+ i.label
1029
+ )),
1030
+ children: [
1031
+ "Tap triggered a ",
1032
+ /* @__PURE__ */ n(B, { children: t }),
1033
+ " for ",
1034
+ /* @__PURE__ */ n(B, { children: r }),
1035
+ "."
1036
+ ]
1037
+ }
1038
+ ), Wn = [
1039
+ {
1040
+ label: "Abandon",
1041
+ value: "abandoned",
1042
+ action: "transaction_abandon",
1043
+ tone: "warning",
1044
+ done: "purchase abandoned."
1045
+ },
1046
+ {
1047
+ label: "Fail",
1048
+ value: "failed",
1049
+ action: "transaction_fail",
1050
+ tone: "warning",
1051
+ done: "purchase failed."
1052
+ },
1053
+ {
1054
+ label: "Complete",
1055
+ value: "completed",
1056
+ primary: !0,
1057
+ action: "transaction_complete",
1058
+ tone: "success",
1059
+ done: "purchase completed."
1060
+ }
1061
+ ], zn = [
1062
+ {
1063
+ label: "Nothing",
1064
+ value: "failed",
1065
+ action: "restore_fail",
1066
+ tone: "warning",
1067
+ done: "nothing to restore."
1068
+ },
1069
+ {
1070
+ label: "Restore",
1071
+ value: "restored",
1072
+ primary: !0,
1073
+ action: "restore_complete",
1074
+ tone: "success",
1075
+ done: "restored."
1076
+ }
1077
+ ], qn = [
1078
+ {
1079
+ label: "Deny",
1080
+ value: "denied",
1081
+ action: "request_permission",
1082
+ tone: "warning",
1083
+ done: "denied."
1084
+ },
1085
+ {
1086
+ label: "Grant",
1087
+ value: "granted",
1088
+ primary: !0,
1089
+ action: "request_permission",
1090
+ tone: "success",
1091
+ done: "granted."
1092
+ }
1093
+ ], Kn = [
1094
+ { label: "Fail", value: "failure", action: "request_callback", tone: "warning", done: "failed." },
1095
+ {
1096
+ label: "Succeed",
1097
+ value: "success",
1098
+ primary: !0,
1099
+ action: "request_callback",
1100
+ tone: "success",
1101
+ done: "succeeded."
1102
+ }
1103
+ ];
1104
+ let Jn = 0;
1105
+ const K = (e, t, r, a) => new Promise((s) => {
1106
+ const i = `${e}-${Jn += 1}`;
1107
+ U.custom(
1108
+ () => /* @__PURE__ */ n(
1109
+ Vn,
1110
+ {
1111
+ action: e,
1112
+ verb: t,
1113
+ subject: r,
1114
+ choices: a,
1115
+ onAnswer: (o) => {
1116
+ U.dismiss(i), U.custom(() => /* @__PURE__ */ n(Hn, { choice: o, subject: r })), s(o.value);
1117
+ }
1118
+ }
1119
+ ),
1120
+ { id: i, duration: Number.POSITIVE_INFINITY }
652
1121
  );
653
- }, Dt = ({
1122
+ }), Gn = () => ({
1123
+ event: (e) => {
1124
+ const t = jn(e);
1125
+ t && U.custom(() => /* @__PURE__ */ n(Bn, { notice: t }));
1126
+ },
1127
+ purchase: (e) => K("purchase", "purchase", e.reference, Wn),
1128
+ restore: () => K("restore", "restore", "purchases", zn),
1129
+ close: () => {
1130
+ },
1131
+ openUrl: () => {
1132
+ },
1133
+ custom: () => {
1134
+ },
1135
+ customPlacement: () => {
1136
+ },
1137
+ permission: (e) => K("request_permission", "permission", e, qn),
1138
+ callback: (e) => K("request_callback", "callback", e, Kn).then((t) => ({ status: t }))
1139
+ }), Yn = () => p.useMemo(Gn, []), Zn = ({
654
1140
  surfaceKey: e,
655
- raised: n = !1
656
- }) => (d.useEffect(() => {
657
- D.dismiss();
658
- }, [e]), d.useEffect(() => {
659
- const s = (a) => {
660
- if (!De(a.data)) return;
661
- if (a.data.type === "ask") {
662
- const { id: i, kind: c, subject: f } = a.data, u = (l) => {
663
- a.source?.postMessage(
664
- { channel: Ae, type: "answer", id: i, outcome: l },
665
- "*"
666
- ), D.dismiss(i), D.custom(() => /* @__PURE__ */ t(Lt, { outcome: l, subject: f }));
667
- };
668
- D.custom(() => /* @__PURE__ */ t(At, { kind: c, subject: f, onAnswer: u }), {
669
- id: i,
670
- duration: Number.POSITIVE_INFINITY
671
- });
672
- return;
673
- }
674
- if (a.data.type !== "event") return;
675
- const r = Mt(a.data.message);
676
- r && D.custom(() => /* @__PURE__ */ t(jt, { notice: r }));
677
- };
678
- return window.addEventListener("message", s), () => window.removeEventListener("message", s);
679
- }, []), /* @__PURE__ */ t(
680
- Xe,
1141
+ raised: t = !1
1142
+ }) => (p.useEffect(() => {
1143
+ U.dismiss();
1144
+ }, [e]), /* @__PURE__ */ n(
1145
+ _t,
681
1146
  {
682
1147
  position: "top-center",
683
1148
  swipeDirections: ["top"],
684
- offset: n ? 84 : 52,
1149
+ offset: t ? 84 : 52,
685
1150
  gap: 8,
686
1151
  visibleToasts: 3,
687
1152
  style: { zIndex: 5 },
688
1153
  toastOptions: { unstyled: !0, classNames: { toast: "w-full" } }
689
1154
  }
690
- )), Bt = ({
1155
+ )), Xn = ({
691
1156
  value: e,
692
- options: n,
693
- onChange: s,
1157
+ options: t,
1158
+ onChange: r,
694
1159
  label: a
695
- }) => /* @__PURE__ */ t("div", { className: "sw-segmented", role: "group", "aria-label": a, children: n.map((r) => /* @__PURE__ */ t(
1160
+ }) => /* @__PURE__ */ n("div", { className: "sw-segmented", role: "group", "aria-label": a, children: t.map((s) => /* @__PURE__ */ n(
696
1161
  "button",
697
1162
  {
698
1163
  type: "button",
699
- "aria-pressed": r.value === e,
700
- onClick: () => s(r.value),
701
- children: r.label
1164
+ "aria-pressed": s.value === e,
1165
+ onClick: () => r(s.value),
1166
+ children: s.label
702
1167
  },
703
- r.value
704
- )) }), Ne = ({
1168
+ s.value
1169
+ )) }), Fe = ({
705
1170
  value: e,
706
- options: n,
707
- onChange: s,
1171
+ options: t,
1172
+ onChange: r,
708
1173
  label: a
709
- }) => /* @__PURE__ */ t(
1174
+ }) => /* @__PURE__ */ n(
710
1175
  "select",
711
1176
  {
712
1177
  className: "sw-select",
713
1178
  "aria-label": a,
714
1179
  value: e,
715
- onChange: (r) => s(r.target.value),
716
- children: n.map((r) => /* @__PURE__ */ t("option", { value: r.value, children: r.label }, r.value))
1180
+ onChange: (s) => r(s.target.value),
1181
+ children: t.map((s) => /* @__PURE__ */ n("option", { value: s.value, children: s.label }, s.value))
717
1182
  }
718
- ), Ut = ({
1183
+ ), Qn = ({
719
1184
  checked: e,
720
- onChange: n,
721
- label: s
722
- }) => /* @__PURE__ */ t(
1185
+ onChange: t,
1186
+ label: r
1187
+ }) => /* @__PURE__ */ n(
723
1188
  "button",
724
1189
  {
725
1190
  type: "button",
726
1191
  role: "switch",
727
1192
  "aria-checked": e,
728
- "aria-label": s,
1193
+ "aria-label": r,
729
1194
  className: "sw-switch",
730
- onClick: () => n(!e)
1195
+ onClick: () => t(!e)
731
1196
  }
732
- ), Ht = ({
1197
+ ), er = ({
733
1198
  open: e,
734
- title: n,
735
- onClose: s,
1199
+ title: t,
1200
+ onClose: r,
736
1201
  children: a
737
- }) => /* @__PURE__ */ t(
1202
+ }) => /* @__PURE__ */ n(
738
1203
  "aside",
739
1204
  {
740
1205
  className: `flex-none overflow-hidden transition-[width] duration-200 ease-out motion-reduce:transition-none ${e ? "w-72" : "w-0"}`,
741
1206
  "aria-hidden": !e,
742
1207
  inert: !e,
743
- children: /* @__PURE__ */ o("div", { className: "bg-bar flex h-full w-72 flex-col border-l border-cream/10", children: [
744
- /* @__PURE__ */ o("div", { className: "flex h-11 flex-none items-center justify-between border-b border-cream/10 px-3", children: [
745
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] font-medium text-cream", children: n }),
746
- /* @__PURE__ */ t(
1208
+ children: /* @__PURE__ */ c("div", { className: "bg-bar flex h-full w-72 flex-col border-l border-cream/10", children: [
1209
+ /* @__PURE__ */ c("div", { className: "flex h-11 flex-none items-center justify-between border-b border-cream/10 px-3", children: [
1210
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium text-cream", children: t }),
1211
+ /* @__PURE__ */ n(
747
1212
  "button",
748
1213
  {
749
1214
  type: "button",
750
1215
  className: "sw-btn sw-btn--icon border-transparent",
751
- "aria-label": `Close ${n.toLowerCase()}`,
752
- onClick: s,
753
- children: /* @__PURE__ */ t(Oe, {})
1216
+ "aria-label": `Close ${t.toLowerCase()}`,
1217
+ onClick: r,
1218
+ children: /* @__PURE__ */ n(at, {})
754
1219
  }
755
1220
  )
756
1221
  ] }),
757
- /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto px-4 py-2", children: a })
1222
+ /* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto px-4 py-2", children: a })
758
1223
  ] })
759
1224
  }
760
- ), Ft = ({ children: e }) => /* @__PURE__ */ t("div", { className: "bg-bar z-10 flex min-h-14 flex-none flex-wrap items-center justify-center gap-3 border-t border-cream/10 px-4 py-2.5", children: e }), G = ({ label: e, children: n }) => /* @__PURE__ */ o("div", { className: "flex items-center gap-2.5", children: [
761
- /* @__PURE__ */ t("span", { className: "sw-tool-label", children: e }),
762
- n
763
- ] }), Se = () => /* @__PURE__ */ t("span", { className: "h-6 w-px bg-cream/10" }), Be = ({
1225
+ ), tr = ({ children: e }) => /* @__PURE__ */ n("div", { className: "bg-bar z-10 flex min-h-14 flex-none flex-wrap items-center justify-center gap-3 border-t border-cream/10 px-4 py-2.5", children: e }), J = ({ label: e, children: t }) => /* @__PURE__ */ c("div", { className: "flex items-center gap-2.5", children: [
1226
+ /* @__PURE__ */ n("span", { className: "sw-tool-label", children: e }),
1227
+ t
1228
+ ] }), Be = () => /* @__PURE__ */ n("span", { className: "h-6 w-px bg-cream/10" }), dt = ({
764
1229
  title: e,
765
- onHome: n,
766
- actions: s,
1230
+ onHome: t,
1231
+ actions: r,
767
1232
  inset: a = !1,
768
- label: r = "Studio"
769
- }) => /* @__PURE__ */ t("header", { className: "relative z-10 flex h-11 flex-none items-center border-b border-cream/10 bg-ink", children: /* @__PURE__ */ o(
1233
+ label: s = "Studio"
1234
+ }) => /* @__PURE__ */ n("header", { className: "relative z-10 flex h-11 flex-none items-center border-b border-cream/10 bg-ink", children: /* @__PURE__ */ c(
770
1235
  "div",
771
1236
  {
772
1237
  className: `flex h-full w-full items-center px-3 ${a ? "mx-auto max-w-[1080px] sm:px-0" : ""}`,
773
1238
  children: [
774
- /* @__PURE__ */ o(
1239
+ /* @__PURE__ */ c(
775
1240
  "a",
776
1241
  {
777
1242
  className: "flex items-center gap-3 text-[0.9375rem] font-semibold tracking-[0.01em]",
778
1243
  href: "/",
779
1244
  onClick: (i) => {
780
- i.metaKey || i.ctrlKey || (i.preventDefault(), n());
1245
+ i.metaKey || i.ctrlKey || (i.preventDefault(), t());
781
1246
  },
782
1247
  children: [
783
- /* @__PURE__ */ o("span", { className: "whitespace-nowrap", children: [
784
- /* @__PURE__ */ t("em", { className: "text-accent not-italic", children: "$UPER" }),
1248
+ /* @__PURE__ */ c("span", { className: "whitespace-nowrap", children: [
1249
+ /* @__PURE__ */ n("em", { className: "text-accent not-italic", children: "$UPER" }),
785
1250
  "WALL"
786
1251
  ] }),
787
- /* @__PURE__ */ t("span", { className: "h-4 w-px bg-cream/20" }),
788
- /* @__PURE__ */ t("span", { className: "font-normal", children: r })
1252
+ /* @__PURE__ */ n("span", { className: "h-4 w-px bg-cream/20" }),
1253
+ /* @__PURE__ */ n("span", { className: "font-normal", children: s })
789
1254
  ]
790
1255
  }
791
1256
  ),
792
- /* @__PURE__ */ t("span", { className: "absolute left-1/2 hidden -translate-x-1/2 text-sm font-medium whitespace-nowrap sm:block", children: e }),
793
- /* @__PURE__ */ t("div", { className: "ml-auto flex items-center gap-2", children: s })
1257
+ /* @__PURE__ */ n("span", { className: "absolute left-1/2 hidden -translate-x-1/2 text-sm font-medium whitespace-nowrap sm:block", children: e }),
1258
+ /* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-2", children: r })
794
1259
  ]
795
1260
  }
796
- ) }), zt = [
1261
+ ) }), nr = [
797
1262
  { key: "user", label: "User", blurb: "Attributes your app sets" },
798
1263
  { key: "device", label: "Device", blurb: "Platform, locale, OS — the SDK fills these in" },
799
1264
  { key: "params", label: "Params", blurb: "Passed in at the placement" },
800
1265
  { key: "products", label: "Products", blurb: "Store data for this paywall's products" }
801
- ], ke = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), Vt = (e) => e === "true" ? !0 : e === "false" ? !1 : e.trim() !== "" && Number.isFinite(Number(e)) ? Number(e) : e, le = (e) => e.slice(e.indexOf(".") + 1), qt = ({
1266
+ ], He = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), rr = (e) => e === "true" ? !0 : e === "false" ? !1 : e.trim() !== "" && Number.isFinite(Number(e)) ? Number(e) : e, be = (e) => e.slice(e.indexOf(".") + 1), ar = ({
802
1267
  row: e,
803
- override: n,
804
- onChange: s
1268
+ override: t,
1269
+ onChange: r
805
1270
  }) => {
806
- const a = n !== void 0, r = a ? n : e.value;
807
- return /* @__PURE__ */ o("div", { className: "flex flex-col gap-1 py-1.5", children: [
808
- /* @__PURE__ */ o("div", { className: "flex items-baseline justify-between gap-2", children: [
809
- /* @__PURE__ */ t("span", { className: "truncate font-mono text-[11px] text-cream/70", children: e.path }),
810
- a && /* @__PURE__ */ t(
1271
+ const a = t !== void 0, s = a ? t : e.value;
1272
+ return /* @__PURE__ */ c("div", { className: "flex flex-col gap-1 py-1.5", children: [
1273
+ /* @__PURE__ */ c("div", { className: "flex items-baseline justify-between gap-2", children: [
1274
+ /* @__PURE__ */ n("span", { className: "truncate font-mono text-[11px] text-cream/70", children: e.path }),
1275
+ a && /* @__PURE__ */ n(
811
1276
  "button",
812
1277
  {
813
1278
  type: "button",
814
1279
  className: "shrink-0 text-[11px] text-cream/40 hover:text-cream",
815
1280
  "aria-label": `Reset ${e.path}`,
816
- onClick: () => s(void 0),
1281
+ onClick: () => r(void 0),
817
1282
  children: "Reset"
818
1283
  }
819
1284
  )
820
1285
  ] }),
821
- typeof r == "boolean" ? /* @__PURE__ */ t("span", { className: "flex h-7 items-center", children: /* @__PURE__ */ t(
1286
+ typeof s == "boolean" ? /* @__PURE__ */ n("span", { className: "flex h-7 items-center", children: /* @__PURE__ */ n(
822
1287
  "button",
823
1288
  {
824
1289
  type: "button",
825
1290
  className: "sw-switch",
826
1291
  role: "switch",
827
- "aria-checked": r,
1292
+ "aria-checked": s,
828
1293
  "aria-label": e.path,
829
- onClick: () => s(!r)
1294
+ onClick: () => r(!s)
830
1295
  }
831
- ) }) : /* @__PURE__ */ t(
1296
+ ) }) : /* @__PURE__ */ n(
832
1297
  "input",
833
1298
  {
834
1299
  className: "sw-input w-full",
835
1300
  "aria-label": e.path,
836
- value: ke(r),
837
- placeholder: ke(e.value),
1301
+ value: He(s),
1302
+ placeholder: He(e.value),
838
1303
  onChange: (i) => {
839
- const c = i.target.value;
840
- s(c === "" ? void 0 : Vt(c));
1304
+ const o = i.target.value;
1305
+ r(o === "" ? void 0 : rr(o));
841
1306
  }
842
1307
  }
843
1308
  )
844
1309
  ] });
845
- }, Wt = ({
1310
+ }, sr = ({
846
1311
  label: e,
847
- blurb: n,
848
- rows: s,
1312
+ blurb: t,
1313
+ rows: r,
849
1314
  overrideOf: a,
850
- onChange: r
1315
+ onChange: s
851
1316
  }) => {
852
- const [i, c] = d.useState(!1), f = s.filter((u) => a(u.path) !== void 0).length;
853
- return /* @__PURE__ */ o("section", { className: "border-b border-cream/10 last:border-b-0", children: [
854
- /* @__PURE__ */ o(
1317
+ const [i, o] = p.useState(!1), u = r.filter((l) => a(l.path) !== void 0).length;
1318
+ return /* @__PURE__ */ c("section", { className: "border-b border-cream/10 last:border-b-0", children: [
1319
+ /* @__PURE__ */ c(
855
1320
  "button",
856
1321
  {
857
1322
  type: "button",
858
1323
  className: "flex w-full items-center gap-2 py-3 text-left",
859
1324
  "aria-expanded": i,
860
- onClick: () => c((u) => !u),
1325
+ onClick: () => o((l) => !l),
861
1326
  children: [
862
- /* @__PURE__ */ o("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
863
- /* @__PURE__ */ o("span", { className: "flex items-baseline gap-2", children: [
864
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] font-medium text-cream", children: e }),
865
- /* @__PURE__ */ t("span", { className: "text-xs text-cream/40", children: f > 0 ? /* @__PURE__ */ t("span", { className: "text-accent", children: `${f} set` }) : s.length || null })
1327
+ /* @__PURE__ */ c("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
1328
+ /* @__PURE__ */ c("span", { className: "flex items-baseline gap-2", children: [
1329
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium text-cream", children: e }),
1330
+ /* @__PURE__ */ n("span", { className: "text-xs text-cream/40", children: u > 0 ? /* @__PURE__ */ n("span", { className: "text-accent", children: `${u} set` }) : r.length || null })
866
1331
  ] }),
867
- /* @__PURE__ */ t("span", { className: "truncate text-xs text-cream/55", children: n })
1332
+ /* @__PURE__ */ n("span", { className: "truncate text-xs text-cream/55", children: t })
868
1333
  ] }),
869
- /* @__PURE__ */ t(
1334
+ /* @__PURE__ */ n(
870
1335
  "span",
871
1336
  {
872
1337
  className: `ml-auto shrink-0 text-cream/40 transition-transform ${i ? "" : "-rotate-90"}`,
873
1338
  "aria-hidden": "true",
874
- children: /* @__PURE__ */ t(Re, {})
1339
+ children: /* @__PURE__ */ n(st, {})
875
1340
  }
876
1341
  )
877
1342
  ]
878
1343
  }
879
1344
  ),
880
- i && (s.length === 0 ? /* @__PURE__ */ t("span", { className: "block pb-3 text-xs text-cream/35", children: "Nothing here for this paywall." }) : /* @__PURE__ */ t("div", { className: "flex flex-col pb-2", children: s.map((u) => /* @__PURE__ */ t(
881
- qt,
1345
+ i && (r.length === 0 ? /* @__PURE__ */ n("span", { className: "block pb-3 text-xs text-cream/35", children: "Nothing here for this paywall." }) : /* @__PURE__ */ n("div", { className: "flex flex-col pb-2", children: r.map((l) => /* @__PURE__ */ n(
1346
+ ar,
882
1347
  {
883
- row: u,
884
- override: a(u.path),
885
- onChange: (l) => r(u.path, l)
1348
+ row: l,
1349
+ override: a(l.path),
1350
+ onChange: (m) => s(l.path, m)
886
1351
  },
887
- u.path
1352
+ l.path
888
1353
  )) }))
889
1354
  ] });
890
- }, Kt = ({
1355
+ }, ir = ({
891
1356
  overrides: e,
892
- groups: n,
893
- onChange: s
1357
+ groups: t,
1358
+ onChange: r
894
1359
  }) => {
895
- const a = (r, i, c) => {
896
- if (r !== "products") {
897
- const w = { ...e[r] };
898
- c === void 0 ? delete w[le(i)] : w[le(i)] = c, s({ ...e, [r]: w });
1360
+ const a = (s, i, o) => {
1361
+ if (s !== "products") {
1362
+ const b = { ...e[s] };
1363
+ o === void 0 ? delete b[be(i)] : b[be(i)] = o, r({ ...e, [s]: b });
899
1364
  return;
900
1365
  }
901
- const [, f = "", u = ""] = i.split("."), l = { ...e.products?.[f] };
902
- c === void 0 ? delete l[u] : l[u] = c;
903
- const h = { ...e.products, [f]: l };
904
- Object.keys(l).length === 0 && delete h[f], s({ ...e, products: h });
1366
+ const [, u = "", l = ""] = i.split("."), m = { ...e.products?.[u] };
1367
+ o === void 0 ? delete m[l] : m[l] = o;
1368
+ const d = { ...e.products, [u]: m };
1369
+ Object.keys(m).length === 0 && delete d[u], r({ ...e, products: d });
905
1370
  };
906
- return /* @__PURE__ */ t("div", { className: "flex flex-col", children: zt.map((r) => /* @__PURE__ */ t(
907
- Wt,
1371
+ return /* @__PURE__ */ n("div", { className: "flex flex-col", children: nr.map((s) => /* @__PURE__ */ n(
1372
+ sr,
908
1373
  {
909
- label: r.label,
910
- blurb: r.blurb,
911
- rows: n[r.key] ?? [],
912
- overrideOf: (i) => r.key === "products" ? e.products?.[i.split(".")[1] ?? ""]?.[i.split(".")[2] ?? ""] : e[r.key]?.[le(i)],
913
- onChange: (i, c) => a(r.key, i, c)
1374
+ label: s.label,
1375
+ blurb: s.blurb,
1376
+ rows: t[s.key] ?? [],
1377
+ overrideOf: (i) => s.key === "products" ? e.products?.[i.split(".")[1] ?? ""]?.[i.split(".")[2] ?? ""] : e[s.key]?.[be(i)],
1378
+ onChange: (i, o) => a(s.key, i, o)
914
1379
  },
915
- r.key
1380
+ s.key
916
1381
  )) });
917
- }, Ue = (e) => {
918
- const n = new URLSearchParams();
919
- e.theme && n.set("theme", e.theme), e.locale && n.set("locale", e.locale);
920
- for (const [s, a] of [
921
- ["sw_device", e.device],
922
- ["sw_user", e.user],
923
- ["sw_params", e.params],
924
- ["sw_products", e.products]
925
- ])
926
- a && Object.keys(a).length > 0 && n.set(s, JSON.stringify(a));
927
- return e.trialEligible !== void 0 && n.set("sw_trial", e.trialEligible ? "1" : "0"), n;
928
- }, $ = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`, He = (e) => `/preview${$(e)}?sw_preview=1`, bn = (e, n) => {
929
- const s = Ue(n).toString();
930
- return `/preview${$(e)}${s ? `?${s}` : ""}`;
931
- }, Fe = (e, n) => {
932
- const s = Ue(n).toString();
933
- return s ? `${e}${e.includes("?") ? "&" : "?"}${s}` : e;
934
- }, Gt = (e) => /[?&]sw_preview=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}sw_preview=1`, wn = (e) => (n, s) => Fe(Gt(e(n)), s), Zt = async (e, n, s) => {
1382
+ }, E = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`, ke = (e) => /[?&]transport=editor(?:&|$)/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}transport=editor`, Er = (e) => ke(`/preview${E(e)}`), Cr = (e) => (t) => ke(e(t)), or = async (e, t, r) => {
935
1383
  try {
936
1384
  const a = await fetch("/__studio/action", {
937
1385
  method: "POST",
938
1386
  headers: { "Content-Type": "application/json" },
939
1387
  body: JSON.stringify({
940
- action: n,
1388
+ action: t,
941
1389
  kind: e.kind,
942
1390
  id: e.id,
943
1391
  project: e.project
@@ -945,45 +1393,45 @@ const et = ({
945
1393
  });
946
1394
  if (!a.body)
947
1395
  return await a.json();
948
- const r = a.body.getReader(), i = new TextDecoder();
949
- let c = "", f;
950
- const u = (l) => {
951
- if (!l.trim()) return;
952
- const h = JSON.parse(l);
953
- h.result ? f = h.result : h.step && h.state && s?.(h.step, h.state);
1396
+ const s = a.body.getReader(), i = new TextDecoder();
1397
+ let o = "", u;
1398
+ const l = (m) => {
1399
+ if (!m.trim()) return;
1400
+ const d = JSON.parse(m);
1401
+ d.result ? u = d.result : d.step && d.state && r?.(d.step, d.state);
954
1402
  };
955
1403
  for (; ; ) {
956
- const { done: l, value: h } = await r.read();
957
- if (l) break;
958
- c += i.decode(h, { stream: !0 });
959
- const w = c.split(`
1404
+ const { done: m, value: d } = await s.read();
1405
+ if (m) break;
1406
+ o += i.decode(d, { stream: !0 });
1407
+ const b = o.split(`
960
1408
  `);
961
- c = w.pop() ?? "";
962
- for (const b of w) u(b);
1409
+ o = b.pop() ?? "";
1410
+ for (const w of b) l(w);
963
1411
  }
964
- return u(c), f ?? { ok: !1, error: "The dev server closed without a result." };
1412
+ return l(o), u ?? { ok: !1, error: "The dev server closed without a result." };
965
1413
  } catch (a) {
966
1414
  return { ok: !1, error: a instanceof Error ? a.message : String(a) };
967
1415
  }
968
- }, pe = async (e) => {
1416
+ }, Ne = async (e) => {
969
1417
  try {
970
- return await (await fetch(`/__studio/status${$(e)}`)).json();
971
- } catch (n) {
972
- return { unreachable: n instanceof Error ? n.message : String(n) };
1418
+ return await (await fetch(`/__studio/status${E(e)}`)).json();
1419
+ } catch (t) {
1420
+ return { unreachable: t instanceof Error ? t.message : String(t) };
973
1421
  }
974
- }, Jt = async () => {
1422
+ }, lr = async () => {
975
1423
  try {
976
- const n = await (await fetch("/__studio/samples.json")).json();
977
- return typeof n == "object" && n !== null ? n : {};
1424
+ const t = await (await fetch("/__studio/samples.json")).json();
1425
+ return typeof t == "object" && t !== null ? t : {};
978
1426
  } catch (e) {
979
1427
  return { unreachable: e instanceof Error ? e.message : String(e) };
980
1428
  }
981
- }, oe = {
1429
+ }, we = {
982
1430
  radius: 54,
983
1431
  cutout: "island",
984
1432
  statusBarHeight: 64,
985
1433
  homeIndicator: !0
986
- }, J = [
1434
+ }, Q = [
987
1435
  {
988
1436
  id: "iphone-se",
989
1437
  name: "iPhone SE",
@@ -998,7 +1446,7 @@ const et = ({
998
1446
  width: 402,
999
1447
  height: 874,
1000
1448
  device: { platform: "iOS", deviceModel: "iPhone18,3", osVersion: "26.0" },
1001
- chrome: oe
1449
+ chrome: we
1002
1450
  },
1003
1451
  {
1004
1452
  id: "iphone-air",
@@ -1006,7 +1454,7 @@ const et = ({
1006
1454
  width: 420,
1007
1455
  height: 912,
1008
1456
  device: { platform: "iOS", deviceModel: "iPhone18,4", osVersion: "26.0" },
1009
- chrome: oe
1457
+ chrome: we
1010
1458
  },
1011
1459
  {
1012
1460
  id: "iphone-17-pro-max",
@@ -1014,7 +1462,7 @@ const et = ({
1014
1462
  width: 440,
1015
1463
  height: 956,
1016
1464
  device: { platform: "iOS", deviceModel: "iPhone18,2", osVersion: "26.0" },
1017
- chrome: oe
1465
+ chrome: we
1018
1466
  },
1019
1467
  {
1020
1468
  id: "pixel-10",
@@ -1054,135 +1502,184 @@ const et = ({
1054
1502
  width: 1440,
1055
1503
  height: 900
1056
1504
  }
1057
- ], ze = "iphone-17", _e = "responsive", Yt = { width: 393, height: 852 }, Qt = (e) => J.find((n) => n.id === e) ?? J.find((n) => n.id === ze) ?? J[0], Xt = (e, n) => Number.isFinite(e) ? Math.min(3e3, Math.max(200, Math.round(e))) : n, Pe = ({
1505
+ ], pt = "iphone-17", Ve = "responsive", cr = { width: 393, height: 852 }, dr = Q.find((e) => e.id === pt) ?? Q[0], pr = (e) => Q.find((t) => t.id === e) ?? dr, ut = () => ({
1506
+ device: sn(),
1507
+ user: on,
1508
+ params: ln
1509
+ }), mt = ({
1510
+ surface: e,
1511
+ defaults: t,
1512
+ sourceSamples: r,
1513
+ samples: a,
1514
+ frame: s,
1515
+ theme: i,
1516
+ locale: o,
1517
+ edited: u
1518
+ }) => {
1519
+ const l = {
1520
+ ...t.device,
1521
+ ...r?.device,
1522
+ ...a.device,
1523
+ ...s,
1524
+ interfaceStyle: i === "dark" ? "Dark" : "Light",
1525
+ ...o ? { deviceLocale: o, deviceLanguageCode: o.split(/[-_]/)[0] } : {},
1526
+ ...u.device
1527
+ }, m = {
1528
+ ...t.user,
1529
+ ...r?.user,
1530
+ ...a.user,
1531
+ ...u.user
1532
+ }, d = {
1533
+ ...t.params,
1534
+ ...r?.params,
1535
+ ...u.params
1536
+ }, b = Object.entries(e.products ?? {}).map(
1537
+ ([w, f]) => ({
1538
+ reference: w,
1539
+ productId: f,
1540
+ variables: {
1541
+ ...a.products?.[f] ?? nt,
1542
+ ...u.products?.[w]
1543
+ }
1544
+ })
1545
+ );
1546
+ return Ge({
1547
+ paywallId: e.paywallId ?? "0",
1548
+ paywallIdentifier: e.paywallIdentifier ?? e.id,
1549
+ device: l,
1550
+ user: m,
1551
+ params: d,
1552
+ products: b,
1553
+ introductoryOfferEligible: u.introductoryOfferEligible
1554
+ });
1555
+ }, ur = (e, t) => Number.isFinite(e) ? Math.min(3e3, Math.max(200, Math.round(e))) : t, We = ({
1058
1556
  label: e,
1059
- value: n,
1060
- onCommit: s
1557
+ value: t,
1558
+ onCommit: r
1061
1559
  }) => {
1062
- const [a, r] = d.useState(String(n));
1063
- return d.useEffect(() => {
1064
- r(String(n));
1065
- }, [n]), /* @__PURE__ */ t(
1560
+ const [a, s] = p.useState(String(t));
1561
+ return p.useEffect(() => {
1562
+ s(String(t));
1563
+ }, [t]), /* @__PURE__ */ n(
1066
1564
  "input",
1067
1565
  {
1068
1566
  className: "sw-input w-16 text-center",
1069
1567
  type: "number",
1070
1568
  "aria-label": e,
1071
1569
  value: a,
1072
- onChange: (c) => r(c.target.value),
1570
+ onChange: (o) => s(o.target.value),
1073
1571
  onBlur: () => {
1074
- const c = Xt(Number(a), n);
1075
- r(String(c)), s(c);
1572
+ const o = ur(Number(a), t);
1573
+ s(String(o)), r(o);
1076
1574
  },
1077
- onKeyDown: (c) => {
1078
- c.key === "Enter" && c.target.blur();
1575
+ onKeyDown: (o) => {
1576
+ o.key === "Enter" && o.target.blur();
1079
1577
  }
1080
1578
  }
1081
1579
  );
1082
- }, Ee = ({
1580
+ }, ze = ({
1083
1581
  label: e,
1084
- width: n,
1085
- height: s,
1582
+ width: t,
1583
+ height: r,
1086
1584
  title: a,
1087
- src: r,
1088
- reloadKey: i,
1089
- empty: c,
1090
- chrome: f,
1091
- landscape: u,
1092
- theme: l
1585
+ src: s,
1586
+ hostState: i,
1587
+ delegate: o,
1588
+ reloadKey: u,
1589
+ empty: l,
1590
+ chrome: m,
1591
+ landscape: d,
1592
+ theme: b
1093
1593
  }) => {
1094
- const h = d.useRef(null);
1095
- return /* @__PURE__ */ t("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center", ref: h, children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
1096
- e && /* @__PURE__ */ t("span", { className: "text-xs text-cream/55", children: e }),
1097
- r ? /* @__PURE__ */ t(
1098
- Nt,
1594
+ const w = p.useRef(null);
1595
+ return /* @__PURE__ */ n("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center", ref: w, children: /* @__PURE__ */ c("div", { className: "flex flex-col gap-2", children: [
1596
+ e && /* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: e }),
1597
+ s ? /* @__PURE__ */ n(
1598
+ On,
1099
1599
  {
1100
- width: n,
1101
- height: s,
1600
+ width: t,
1601
+ height: r,
1102
1602
  title: a,
1103
- src: r,
1104
- stageRef: h,
1105
- reloadKey: i,
1106
- chrome: f,
1107
- landscape: u,
1108
- theme: l
1603
+ src: s,
1604
+ hostState: i,
1605
+ delegate: o,
1606
+ stageRef: w,
1607
+ reloadKey: u,
1608
+ chrome: m,
1609
+ landscape: d,
1610
+ theme: b
1109
1611
  }
1110
- ) : /* @__PURE__ */ t(xt, { width: n, height: s, stageRef: h, children: c ?? "Nothing live yet — publish to compare against production." })
1612
+ ) : /* @__PURE__ */ n($n, { width: t, height: r, stageRef: w, children: l ?? "Nothing live yet — publish to compare against production." })
1111
1613
  ] }) });
1112
- }, ce = (e) => e.label ?? `${e.kind}/${e.id}`, en = ({
1614
+ }, ve = (e) => e.label ?? `${e.kind}/${e.id}`, mr = ({
1113
1615
  source: e,
1114
- surface: n,
1115
- samples: s,
1616
+ surface: t,
1617
+ samples: r,
1116
1618
  onBack: a,
1117
- actions: r
1619
+ actions: s
1118
1620
  }) => {
1119
- const [i, c] = d.useState(ze), [f, u] = d.useState(Yt), [l, h] = d.useState("light"), [w, b] = d.useState(void 0), [m, E] = d.useState({}), [j, L] = d.useState(!1), [C, X] = d.useState(void 0), [F, g] = d.useState(0), [S, x] = d.useState(!1), [M, O] = d.useState({}), [T, A] = d.useState(void 0), ee = d.useRef(void 0);
1120
- d.useEffect(() => () => window.clearTimeout(ee.current), []);
1121
- const z = e.capabilities?.actions === !0, [qe, We] = d.useState([]);
1122
- d.useEffect(() => {
1123
- const p = (v) => {
1124
- const N = It(v.data);
1125
- N && We(N);
1126
- };
1127
- return window.addEventListener("message", p), () => window.removeEventListener("message", p);
1128
- }, []);
1129
- const me = n.locales.length > 0 ? n.locales : qe;
1130
- d.useEffect(() => {
1131
- if (!z) return;
1132
- let p = !1;
1133
- return pe(n).then((v) => {
1134
- p || O(v);
1621
+ const [i, o] = p.useState(pt), [u, l] = p.useState(cr), [m, d] = p.useState("light"), [b, w] = p.useState(void 0), [f, S] = p.useState({}), [D, H] = p.useState(!1), [P, re] = p.useState(void 0), [g, C] = p.useState(0), [x, ft] = p.useState(!1), [V, Ie] = p.useState({}), [bt, A] = p.useState(void 0), ae = p.useRef(void 0);
1622
+ p.useEffect(() => () => window.clearTimeout(ae.current), []);
1623
+ const W = e.capabilities?.actions === !0, Pe = Yn(), M = p.useMemo(ut, [t]), Ee = t.locales;
1624
+ p.useEffect(() => {
1625
+ if (!W) return;
1626
+ let h = !1;
1627
+ return Ne(t).then((v) => {
1628
+ h || Ie(v);
1135
1629
  }), () => {
1136
- p = !0;
1630
+ h = !0;
1137
1631
  };
1138
- }, [z, n]);
1139
- const Ke = async (p) => {
1140
- window.clearTimeout(ee.current), A({ action: p, steps: {} });
1141
- const v = await Zt(n, p, (N, _) => {
1632
+ }, [W, t]);
1633
+ const wt = async (h) => {
1634
+ window.clearTimeout(ae.current), A({ action: h, steps: {} });
1635
+ const v = await or(t, h, (N, _) => {
1142
1636
  A(
1143
- (P) => P?.action === p ? {
1144
- ...P,
1145
- steps: { ...P.steps, [N]: _ === "start" ? "active" : "done" }
1146
- } : P
1637
+ (I) => I?.action === h ? {
1638
+ ...I,
1639
+ steps: { ...I.steps, [N]: _ === "start" ? "active" : "done" }
1640
+ } : I
1147
1641
  );
1148
1642
  });
1149
1643
  if (v.ok) {
1150
1644
  const N = Object.fromEntries(
1151
- Q[p].map((_) => [_, "done"])
1645
+ X[h].map((_) => [_, "done"])
1152
1646
  );
1153
- A({ action: p, steps: N }), O(await pe(n)), ee.current = window.setTimeout(() => A(void 0), 1600);
1647
+ A({ action: h, steps: N }), Ie(await Ne(t)), ae.current = window.setTimeout(() => A(void 0), 1600);
1154
1648
  } else
1155
1649
  A((N) => {
1156
1650
  if (!N) return N;
1157
1651
  const _ = { ...N.steps };
1158
- for (const P of Q[p])
1159
- _[P] === "active" && (_[P] = "failed");
1652
+ for (const I of X[h])
1653
+ _[I] === "active" && (_[I] = "failed");
1160
1654
  return { ...N, steps: _, error: v.error };
1161
1655
  });
1162
- }, Ge = () => {
1656
+ }, R = i === Ve, $ = pr(i), se = R ? u : { width: $.width, height: $.height }, k = x ? { width: se.height, height: se.width } : se, vt = () => {
1657
+ const h = e.standaloneUrl?.(t);
1658
+ if (h === void 0) return;
1163
1659
  if (k.width > 768) {
1164
- window.open(q, "_blank");
1660
+ window.open(h, "_blank");
1165
1661
  return;
1166
1662
  }
1167
- const p = Math.max(0, window.screen.width / 2 - k.width / 2), v = Math.max(0, window.screen.height / 2 - k.height / 2);
1663
+ const v = Math.max(0, window.screen.width / 2 - k.width / 2), N = Math.max(0, window.screen.height / 2 - k.height / 2);
1168
1664
  window.open(
1169
- q,
1665
+ h,
1170
1666
  "superwall-preview",
1171
- `toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${k.width},height=${k.height},top=${v},left=${p}`
1172
- ) || window.open(q, "_blank");
1173
- }, V = i === _e, R = Qt(i), te = V ? f : { width: R.width, height: R.height }, k = S ? { width: te.height, height: te.width } : te, ne = {
1174
- theme: l,
1175
- locale: w,
1176
- user: m.user,
1177
- params: m.params,
1178
- products: m.products,
1179
- trialEligible: m.trialEligible,
1180
- device: {
1181
- ...V ? {} : R.device,
1182
- ...m.device
1183
- }
1184
- }, ue = V ? void 0 : R.chrome, q = e.previewUrl(n, ne), Ze = M.liveUrl ? Fe(M.liveUrl, ne) : void 0, fe = [
1185
- ...z ? [
1667
+ `toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${k.width},height=${k.height},top=${N},left=${v}`
1668
+ ) || window.open(h, "_blank");
1669
+ }, ie = p.useMemo(
1670
+ () => mt({
1671
+ surface: t,
1672
+ defaults: M,
1673
+ sourceSamples: e.samples,
1674
+ samples: r,
1675
+ frame: R ? void 0 : $.device,
1676
+ theme: m,
1677
+ locale: b,
1678
+ edited: f
1679
+ }),
1680
+ [t, M, e.samples, r, R, $.device, m, b, f]
1681
+ ), Ce = R ? void 0 : $.chrome, yt = e.previewUrl(t), gt = V.liveUrl ? ke(V.liveUrl) : void 0, $e = [
1682
+ ...W ? [
1186
1683
  {
1187
1684
  key: "live",
1188
1685
  label: "Live version",
@@ -1190,557 +1687,582 @@ const et = ({
1190
1687
  target: { type: "live" }
1191
1688
  }
1192
1689
  ] : [],
1193
- ...e.surfaces.map((p, v) => ({
1690
+ ...e.surfaces.map((h, v) => ({
1194
1691
  key: `surface:${v}`,
1195
- label: ce(p),
1692
+ label: ve(h),
1196
1693
  hint: e.compareHint ?? "Local preview",
1197
- target: { type: "surface", surface: p }
1198
- })).filter((p) => p.target.surface !== n)
1199
- ], I = C && (C.type === "live" ? {
1694
+ target: { type: "surface", surface: h }
1695
+ })).filter((h) => h.target.surface !== t)
1696
+ ], O = P && (P.type === "live" ? {
1200
1697
  label: "Live",
1201
- src: Ze,
1202
- title: `${n.id} live`,
1203
- empty: M.unreachable ? `Couldn't read the live version — ${M.unreachable}` : void 0
1698
+ src: gt,
1699
+ title: `${t.id} live`,
1700
+ empty: V.unreachable ? `Couldn't read the live version — ${V.unreachable}` : void 0
1204
1701
  } : {
1205
- label: ce(C.surface),
1206
- src: e.previewUrl(C.surface, ne),
1207
- title: `${ce(C.surface)} preview`
1208
- }), Je = d.useMemo(() => {
1209
- const p = (v, N) => Object.entries(N ?? {}).map(([_, P]) => ({ path: `${v}.${_}`, value: P })).toSorted((_, P) => _.path.localeCompare(P.path));
1702
+ label: ve(P.surface),
1703
+ src: e.previewUrl(P.surface),
1704
+ title: `${ve(P.surface)} preview`
1705
+ }), xt = p.useMemo(() => {
1706
+ const h = (v, N) => Object.entries(N ?? {}).map(([_, I]) => ({ path: `${v}.${_}`, value: I })).toSorted((_, I) => _.path.localeCompare(I.path));
1210
1707
  return {
1211
- user: p("user", { ...e.samples?.user, ...s.user }),
1212
- device: p("device", {
1708
+ user: h("user", { ...M.user, ...e.samples?.user, ...r.user }),
1709
+ device: h("device", {
1710
+ ...M.device,
1213
1711
  ...e.samples?.device,
1214
- ...s.device,
1215
- ...R.device
1712
+ ...r.device,
1713
+ ...$.device
1216
1714
  }),
1217
- params: p("params", e.samples?.params),
1218
- products: Object.entries(n.products ?? {}).flatMap(
1219
- ([v, N]) => p(`products.${v}`, s.products?.[N])
1715
+ params: h("params", { ...M.params, ...e.samples?.params }),
1716
+ products: Object.entries(t.products ?? {}).flatMap(
1717
+ ([v, N]) => h(`products.${v}`, r.products?.[N])
1220
1718
  )
1221
1719
  };
1222
- }, [e.samples, s, R.device, n.products]), W = d.useMemo(() => s.products ? Object.entries(n.products ?? {}).filter(([, p]) => s.products?.[p] === void 0).map(([p, v]) => ({ reference: p, identifier: v })) : [], [s.products, n.products]), [Ye, se] = d.useState(!1);
1223
- d.useEffect(() => se(!1), [n]);
1224
- const ae = s.unreachable, Qe = W.length === 0, be = Object.keys(m.user ?? {}).length + Object.keys(m.params ?? {}).length + Object.keys(m.device ?? {}).length;
1225
- return /* @__PURE__ */ o(U, { children: [
1226
- /* @__PURE__ */ t(
1227
- Dt,
1720
+ }, [M, e.samples, r, $.device, t.products]), z = p.useMemo(() => r.products ? Object.entries(t.products ?? {}).filter(([, h]) => r.products?.[h] === void 0).map(([h, v]) => ({ reference: h, identifier: v })) : [], [r.products, t.products]), [Nt, oe] = p.useState(!1);
1721
+ p.useEffect(() => oe(!1), [t]);
1722
+ const le = r.unreachable, St = z.length === 0, Oe = Object.keys(f.user ?? {}).length + Object.keys(f.params ?? {}).length + Object.keys(f.device ?? {}).length;
1723
+ return /* @__PURE__ */ c(Z, { children: [
1724
+ /* @__PURE__ */ n(
1725
+ Zn,
1228
1726
  {
1229
- surfaceKey: `${n.project ?? ""}/${n.id}`,
1230
- raised: !!ae
1727
+ surfaceKey: `${t.project ?? ""}/${t.id}`,
1728
+ raised: !!le
1231
1729
  }
1232
1730
  ),
1233
- W.length > 0 && !Ye && /* @__PURE__ */ t(
1234
- St,
1731
+ z.length > 0 && !Nt && /* @__PURE__ */ n(
1732
+ Mn,
1235
1733
  {
1236
- paywall: n.id,
1237
- missing: W,
1238
- onDismiss: () => se(!0)
1734
+ paywall: t.id,
1735
+ missing: z,
1736
+ onDismiss: () => oe(!0)
1239
1737
  }
1240
1738
  ),
1241
- ae && /* @__PURE__ */ o("div", { className: "border-b border-cream/10 bg-red/10 px-4 py-1.5 text-[0.8125rem] text-cream/75", children: [
1739
+ le && /* @__PURE__ */ c("div", { className: "border-b border-cream/10 bg-red/10 px-4 py-1.5 text-[0.8125rem] text-cream/75", children: [
1242
1740
  "Couldn't check this paywall's products — ",
1243
- ae
1741
+ le
1244
1742
  ] }),
1245
- /* @__PURE__ */ t(
1246
- Be,
1743
+ /* @__PURE__ */ n(
1744
+ dt,
1247
1745
  {
1248
- title: `${n.project ?? e.title} / ${n.id}${n.label ? ` · ${n.label}` : ""}`,
1746
+ title: `${t.project ?? e.title} / ${t.id}${t.label ? ` · ${t.label}` : ""}`,
1249
1747
  onHome: a,
1250
- actions: /* @__PURE__ */ o(U, { children: [
1251
- r,
1252
- /* @__PURE__ */ t(
1748
+ actions: /* @__PURE__ */ c(Z, { children: [
1749
+ s,
1750
+ /* @__PURE__ */ n(
1253
1751
  "button",
1254
1752
  {
1255
1753
  type: "button",
1256
1754
  className: "sw-btn sw-btn--icon",
1257
1755
  "aria-label": "Reload preview",
1258
- onClick: () => g((p) => p + 1),
1259
- children: /* @__PURE__ */ t(Ie, {})
1756
+ onClick: () => C((h) => h + 1),
1757
+ children: /* @__PURE__ */ n(rt, {})
1260
1758
  }
1261
1759
  ),
1262
- /* @__PURE__ */ t(
1760
+ e.standaloneUrl && /* @__PURE__ */ n(
1263
1761
  "button",
1264
1762
  {
1265
1763
  type: "button",
1266
1764
  className: "sw-btn sw-btn--icon",
1267
1765
  "aria-label": "Open preview",
1268
- onClick: Ge,
1269
- children: /* @__PURE__ */ t(Z, {})
1766
+ onClick: vt,
1767
+ children: /* @__PURE__ */ n(G, {})
1270
1768
  }
1271
1769
  ),
1272
- z && /* @__PURE__ */ t(
1273
- mt,
1770
+ W && /* @__PURE__ */ n(
1771
+ Nn,
1274
1772
  {
1275
- progress: T,
1276
- blocked: Qe ? void 0 : `Superwall has no product for ${W.map((p) => p.reference).join(", ")}`,
1277
- onRun: Ke,
1278
- onBlocked: () => se(!1)
1773
+ progress: bt,
1774
+ blocked: St ? void 0 : `Superwall has no product for ${z.map((h) => h.reference).join(", ")}`,
1775
+ onRun: wt,
1776
+ onBlocked: () => oe(!1)
1279
1777
  }
1280
1778
  )
1281
1779
  ] })
1282
1780
  }
1283
1781
  ),
1284
- /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1", children: [
1285
- /* @__PURE__ */ o("div", { className: "flex min-w-0 flex-1", children: [
1286
- I && /* @__PURE__ */ t(
1287
- Ee,
1782
+ /* @__PURE__ */ c("div", { className: "flex min-h-0 flex-1", children: [
1783
+ /* @__PURE__ */ c("div", { className: "flex min-w-0 flex-1", children: [
1784
+ O && /* @__PURE__ */ n(
1785
+ ze,
1288
1786
  {
1289
- label: I.label,
1787
+ label: O.label,
1290
1788
  width: k.width,
1291
1789
  height: k.height,
1292
- title: I.title,
1293
- src: I.src,
1294
- reloadKey: F,
1295
- empty: "empty" in I ? I.empty : void 0,
1296
- chrome: ue,
1297
- landscape: S,
1298
- theme: l
1790
+ title: O.title,
1791
+ src: O.src,
1792
+ hostState: ie,
1793
+ delegate: Pe,
1794
+ reloadKey: g,
1795
+ empty: "empty" in O ? O.empty : void 0,
1796
+ chrome: Ce,
1797
+ landscape: x,
1798
+ theme: m
1299
1799
  }
1300
1800
  ),
1301
- /* @__PURE__ */ t(
1302
- Ee,
1801
+ /* @__PURE__ */ n(
1802
+ ze,
1303
1803
  {
1304
- label: I ? n.label ?? "Local" : void 0,
1804
+ label: O ? t.label ?? "Local" : void 0,
1305
1805
  width: k.width,
1306
1806
  height: k.height,
1307
- title: `${n.id} preview`,
1308
- src: q,
1309
- reloadKey: F,
1310
- chrome: ue,
1311
- landscape: S,
1312
- theme: l
1807
+ title: `${t.id} preview`,
1808
+ src: yt,
1809
+ hostState: ie,
1810
+ delegate: Pe,
1811
+ reloadKey: g,
1812
+ chrome: Ce,
1813
+ landscape: x,
1814
+ theme: m
1313
1815
  }
1314
1816
  )
1315
1817
  ] }),
1316
- /* @__PURE__ */ t(Ht, { open: j, title: "Variables", onClose: () => L(!1), children: /* @__PURE__ */ t(Kt, { overrides: m, groups: Je, onChange: E }) })
1818
+ /* @__PURE__ */ n(er, { open: D, title: "Variables", onClose: () => H(!1), children: /* @__PURE__ */ n(ir, { overrides: f, groups: xt, onChange: S }) })
1317
1819
  ] }),
1318
- /* @__PURE__ */ o(Ft, { children: [
1319
- /* @__PURE__ */ t(G, { label: "Trial", children: /* @__PURE__ */ t(
1320
- Ut,
1820
+ /* @__PURE__ */ c(tr, { children: [
1821
+ /* @__PURE__ */ n(J, { label: "Intro offer", children: /* @__PURE__ */ n(
1822
+ Qn,
1321
1823
  {
1322
- label: "Trial eligibility",
1323
- checked: m.trialEligible ?? !1,
1324
- onChange: (p) => E((v) => ({ ...v, trialEligible: p }))
1824
+ label: "Introductory offer",
1825
+ checked: F(ie),
1826
+ onChange: (h) => S((v) => ({ ...v, introductoryOfferEligible: h }))
1325
1827
  }
1326
1828
  ) }),
1327
- /* @__PURE__ */ o(G, { label: "Theme", children: [
1328
- /* @__PURE__ */ t(
1329
- Bt,
1829
+ /* @__PURE__ */ c(J, { label: "Theme", children: [
1830
+ /* @__PURE__ */ n(
1831
+ Xn,
1330
1832
  {
1331
1833
  label: "Theme",
1332
- value: l,
1834
+ value: m,
1333
1835
  options: [
1334
- { value: "light", label: /* @__PURE__ */ t(tt, {}) },
1335
- { value: "dark", label: /* @__PURE__ */ t(nt, {}) }
1836
+ { value: "light", label: /* @__PURE__ */ n(dn, {}) },
1837
+ { value: "dark", label: /* @__PURE__ */ n(pn, {}) }
1336
1838
  ],
1337
- onChange: h
1839
+ onChange: d
1338
1840
  }
1339
1841
  ),
1340
- /* @__PURE__ */ t(
1842
+ /* @__PURE__ */ n(
1341
1843
  "button",
1342
1844
  {
1343
1845
  type: "button",
1344
1846
  className: "sw-btn sw-btn--icon",
1345
1847
  "aria-label": "Rotate device",
1346
- "aria-pressed": S,
1347
- title: S ? "Back to portrait" : "Rotate to landscape",
1348
- onClick: () => x((p) => !p),
1349
- children: /* @__PURE__ */ t(
1848
+ "aria-pressed": x,
1849
+ title: x ? "Back to portrait" : "Rotate to landscape",
1850
+ onClick: () => ft((h) => !h),
1851
+ children: /* @__PURE__ */ n(
1350
1852
  "span",
1351
1853
  {
1352
- className: `flex transition-transform duration-200 ${S ? "-rotate-90" : ""}`,
1353
- children: /* @__PURE__ */ t(ct, {})
1854
+ className: `flex transition-transform duration-200 ${x ? "-rotate-90" : ""}`,
1855
+ children: /* @__PURE__ */ n(vn, {})
1354
1856
  }
1355
1857
  )
1356
1858
  }
1357
1859
  )
1358
1860
  ] }),
1359
- /* @__PURE__ */ t(Se, {}),
1360
- /* @__PURE__ */ o(G, { label: "Device", children: [
1361
- /* @__PURE__ */ t(
1362
- Ne,
1861
+ /* @__PURE__ */ n(Be, {}),
1862
+ /* @__PURE__ */ c(J, { label: "Device", children: [
1863
+ /* @__PURE__ */ n(
1864
+ Fe,
1363
1865
  {
1364
1866
  label: "Device",
1365
1867
  value: i,
1366
1868
  options: [
1367
- ...J.map((p) => ({ value: p.id, label: p.name })),
1368
- { value: _e, label: "Responsive" }
1869
+ ...Q.map((h) => ({ value: h.id, label: h.name })),
1870
+ { value: Ve, label: "Responsive" }
1369
1871
  ],
1370
- onChange: c
1872
+ onChange: o
1371
1873
  }
1372
1874
  ),
1373
- V && /* @__PURE__ */ o("span", { className: "flex items-center gap-1.5", children: [
1374
- /* @__PURE__ */ t(
1375
- Pe,
1875
+ R && /* @__PURE__ */ c("span", { className: "flex items-center gap-1.5", children: [
1876
+ /* @__PURE__ */ n(
1877
+ We,
1376
1878
  {
1377
1879
  label: "Preview width",
1378
1880
  value: k.width,
1379
- onCommit: (p) => u((v) => ({ ...v, width: p }))
1881
+ onCommit: (h) => l((v) => ({ ...v, width: h }))
1380
1882
  }
1381
1883
  ),
1382
- /* @__PURE__ */ t("span", { className: "text-cream/55", children: "×" }),
1383
- /* @__PURE__ */ t(
1384
- Pe,
1884
+ /* @__PURE__ */ n("span", { className: "text-cream/55", children: "×" }),
1885
+ /* @__PURE__ */ n(
1886
+ We,
1385
1887
  {
1386
1888
  label: "Preview height",
1387
1889
  value: k.height,
1388
- onCommit: (p) => u((v) => ({ ...v, height: p }))
1890
+ onCommit: (h) => l((v) => ({ ...v, height: h }))
1389
1891
  }
1390
1892
  )
1391
1893
  ] })
1392
1894
  ] }),
1393
- me.length > 1 && /* @__PURE__ */ t(G, { label: "Locale", children: /* @__PURE__ */ t(
1394
- Ne,
1895
+ Ee.length > 1 && /* @__PURE__ */ n(J, { label: "Locale", children: /* @__PURE__ */ n(
1896
+ Fe,
1395
1897
  {
1396
1898
  label: "Locale",
1397
- value: w ?? "default",
1899
+ value: b ?? "default",
1398
1900
  options: [
1399
1901
  { value: "default", label: "Device" },
1400
- ...me.map((p) => ({ value: p, label: p }))
1902
+ ...Ee.map((h) => ({ value: h, label: h }))
1401
1903
  ],
1402
- onChange: (p) => b(p === "default" ? void 0 : p)
1904
+ onChange: (h) => w(h === "default" ? void 0 : h)
1403
1905
  }
1404
1906
  ) }),
1405
- /* @__PURE__ */ t(Se, {}),
1406
- fe.length > 0 && /* @__PURE__ */ t(ut, { active: C, options: fe, onSelect: X }),
1407
- /* @__PURE__ */ o(
1907
+ /* @__PURE__ */ n(Be, {}),
1908
+ $e.length > 0 && /* @__PURE__ */ n(Sn, { active: P, options: $e, onSelect: re }),
1909
+ /* @__PURE__ */ c(
1408
1910
  "button",
1409
1911
  {
1410
1912
  type: "button",
1411
1913
  className: "sw-btn",
1412
- "aria-expanded": j,
1413
- onClick: () => L((p) => !p),
1914
+ "aria-expanded": D,
1915
+ onClick: () => H((h) => !h),
1414
1916
  children: [
1415
- /* @__PURE__ */ t(st, {}),
1917
+ /* @__PURE__ */ n(un, {}),
1416
1918
  "Variables",
1417
- be > 0 && /* @__PURE__ */ t("span", { className: "text-accent", children: be })
1919
+ Oe > 0 && /* @__PURE__ */ n("span", { className: "text-accent", children: Oe })
1418
1920
  ]
1419
1921
  }
1420
1922
  )
1421
1923
  ] })
1422
1924
  ] });
1423
- }, Ve = "superwall-device-scheme", tn = () => {
1925
+ }, ht = "superwall-device-scheme", hr = () => {
1424
1926
  try {
1425
- return window.localStorage.getItem(Ve) ?? void 0;
1927
+ return window.localStorage.getItem(ht) ?? void 0;
1426
1928
  } catch {
1427
1929
  return;
1428
1930
  }
1429
- }, nn = (e) => {
1931
+ }, fr = (e) => {
1430
1932
  try {
1431
- window.localStorage.setItem(Ve, e);
1933
+ window.localStorage.setItem(ht, e);
1432
1934
  } catch {
1433
1935
  }
1434
- }, Ce = (e, n) => `${e}://?superwall_dev=${encodeURIComponent(n)}`, sn = ({ origin: e, scheme: n }) => {
1435
- const [s, a] = d.useState(tn), r = s ?? n, i = (f) => {
1436
- const l = window.prompt("Your app's URL scheme, so this can open it:", f)?.trim();
1437
- if (!(l === void 0 || l === ""))
1438
- return a(l), nn(l), l;
1439
- }, c = (f) => {
1440
- if (r !== void 0) return;
1441
- f.preventDefault();
1442
- const u = i("");
1443
- u !== void 0 && window.location.assign(Ce(u, e));
1936
+ }, qe = (e, t) => `${e}://?superwall_dev=${encodeURIComponent(t)}`, br = ({ origin: e, scheme: t }) => {
1937
+ const [r, a] = p.useState(hr), s = r ?? t, i = (u) => {
1938
+ const m = window.prompt("Your app's URL scheme, so this can open it:", u)?.trim();
1939
+ if (!(m === void 0 || m === ""))
1940
+ return a(m), fr(m), m;
1941
+ }, o = (u) => {
1942
+ if (s !== void 0) return;
1943
+ u.preventDefault();
1944
+ const l = i("");
1945
+ l !== void 0 && window.location.assign(qe(l, e));
1444
1946
  };
1445
- return /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
1446
- r !== void 0 && /* @__PURE__ */ t(
1947
+ return /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1948
+ s !== void 0 && /* @__PURE__ */ n(
1447
1949
  "button",
1448
1950
  {
1449
1951
  className: "sw-btn sw-btn--icon",
1450
1952
  type: "button",
1451
1953
  "aria-label": "Edit app URL scheme",
1452
- onClick: () => i(r),
1453
- children: /* @__PURE__ */ o("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
1454
- /* @__PURE__ */ t("path", { d: "M12 20h9" }),
1455
- /* @__PURE__ */ t("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z" })
1954
+ onClick: () => i(s),
1955
+ children: /* @__PURE__ */ c("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
1956
+ /* @__PURE__ */ n("path", { d: "M12 20h9" }),
1957
+ /* @__PURE__ */ n("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z" })
1456
1958
  ] })
1457
1959
  }
1458
1960
  ),
1459
- /* @__PURE__ */ t(
1961
+ /* @__PURE__ */ n(
1460
1962
  "a",
1461
1963
  {
1462
1964
  className: "sw-btn sw-btn--primary",
1463
- href: r === void 0 ? "#" : Ce(r, e),
1464
- onClick: c,
1965
+ href: s === void 0 ? "#" : qe(s, e),
1966
+ onClick: o,
1465
1967
  children: "Open In App"
1466
1968
  }
1467
1969
  )
1468
1970
  ] });
1469
- }, an = [
1971
+ }, wr = [
1470
1972
  [60, "second"],
1471
1973
  [60, "minute"],
1472
1974
  [24, "hour"],
1473
1975
  [7, "day"],
1474
1976
  [4.348, "week"],
1475
- [12, "month"],
1476
- [Number.POSITIVE_INFINITY, "year"]
1477
- ], rn = (e, n = Date.now()) => {
1478
- const s = Date.parse(e);
1479
- if (Number.isNaN(s)) return;
1480
- let a = Math.max(0, (n - s) / 1e3);
1481
- const r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
1482
- for (const [i, c] of an) {
1483
- if (a < i) return r.format(-Math.round(a), c);
1977
+ [12, "month"]
1978
+ ], vr = (e, t = Date.now()) => {
1979
+ const r = Date.parse(e);
1980
+ if (Number.isNaN(r)) return;
1981
+ let a = Math.max(0, (t - r) / 1e3);
1982
+ const s = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
1983
+ for (const [i, o] of wr) {
1984
+ if (a < i) return s.format(-Math.round(a), o);
1484
1985
  a /= i;
1485
1986
  }
1486
- }, Me = 390, ln = 844, on = (e) => {
1487
- const [n, s] = d.useState(0);
1488
- return d.useLayoutEffect(() => {
1987
+ return s.format(-Math.round(a), "year");
1988
+ }, Ke = 390, yr = 844, gr = (e) => {
1989
+ const [t, r] = p.useState(0);
1990
+ return p.useLayoutEffect(() => {
1489
1991
  const a = e.current;
1490
1992
  if (!a) return;
1491
- const r = () => s(a.getBoundingClientRect().width);
1492
- if (r(), typeof ResizeObserver > "u") return;
1493
- const i = new ResizeObserver(r);
1993
+ const s = () => r(a.getBoundingClientRect().width);
1994
+ if (s(), typeof ResizeObserver > "u") return;
1995
+ const i = new ResizeObserver(s);
1494
1996
  return i.observe(a), () => i.disconnect();
1495
- }, [e]), n;
1496
- }, cn = ({
1997
+ }, [e]), t;
1998
+ }, xr = ({
1497
1999
  surface: e,
1498
- status: n,
1499
- previewSrc: s,
1500
- onOpen: a,
1501
- href: r
2000
+ status: t,
2001
+ previewSrc: r,
2002
+ hostState: a,
2003
+ onOpen: s,
2004
+ href: i
1502
2005
  }) => {
1503
- const i = d.useRef(null), c = on(i), f = c > 0 ? c / Me : 0;
1504
- return /* @__PURE__ */ o(
2006
+ const o = p.useRef(null), u = gr(o), l = u > 0 ? u / Ke : 0, m = p.useMemo(Ft, []);
2007
+ return /* @__PURE__ */ c(
1505
2008
  "a",
1506
2009
  {
1507
2010
  className: "group block",
1508
- href: r ?? $(e),
1509
- onClick: (u) => {
1510
- u.metaKey || u.ctrlKey || (u.preventDefault(), a());
2011
+ href: i ?? E(e),
2012
+ onClick: (d) => {
2013
+ d.metaKey || d.ctrlKey || (d.preventDefault(), s());
1511
2014
  },
1512
2015
  children: [
1513
- /* @__PURE__ */ t(
2016
+ /* @__PURE__ */ n(
1514
2017
  "div",
1515
2018
  {
1516
2019
  className: "bg-panel relative aspect-[390/844] overflow-hidden border border-cream/20 transition-colors group-hover:border-cream/35",
1517
- ref: i,
1518
- children: f > 0 && /* @__PURE__ */ t(
1519
- "iframe",
2020
+ ref: o,
2021
+ children: l > 0 && /* @__PURE__ */ n(
2022
+ lt,
1520
2023
  {
2024
+ hostState: a,
2025
+ delegate: m,
1521
2026
  className: "pointer-events-none block origin-top-left border-0 bg-white",
1522
2027
  title: `${e.project ? `${e.project}/` : ""}${e.id} preview`,
1523
- src: s,
2028
+ src: r,
1524
2029
  loading: "lazy",
1525
2030
  tabIndex: -1,
1526
- width: Me,
1527
- height: ln,
1528
- style: { transform: `scale(${f})` }
2031
+ width: Ke,
2032
+ height: yr,
2033
+ style: { transform: `scale(${l})` }
1529
2034
  }
1530
2035
  )
1531
2036
  }
1532
2037
  ),
1533
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2 pt-2.5", children: [
1534
- /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
1535
- /* @__PURE__ */ o("span", { className: "text-sm font-medium", children: [
1536
- e.project && /* @__PURE__ */ o("span", { className: "text-cream/45", children: [
2038
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2 pt-2.5", children: [
2039
+ /* @__PURE__ */ c("div", { className: "flex flex-col gap-0.5", children: [
2040
+ /* @__PURE__ */ c("span", { className: "text-sm font-medium", children: [
2041
+ e.project && /* @__PURE__ */ c("span", { className: "text-cream/45", children: [
1537
2042
  e.project,
1538
2043
  "/"
1539
2044
  ] }),
1540
2045
  e.id,
1541
- e.platforms && e.platforms.length > 0 && /* @__PURE__ */ o("span", { className: "text-cream/45", children: [
2046
+ e.platforms && e.platforms.length > 0 && /* @__PURE__ */ c("span", { className: "text-cream/45", children: [
1542
2047
  " · ",
1543
2048
  e.platforms.join(" · ")
1544
2049
  ] })
1545
2050
  ] }),
1546
- n && /* @__PURE__ */ t("span", { className: "text-xs text-cream/55", children: n.updatedAt ? `Edited ${rn(n.updatedAt)}` : "Not published" })
2051
+ t && /* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: t.updatedAt ? `Edited ${vr(t.updatedAt)}` : "Not published" })
1547
2052
  ] }),
1548
- n?.paywallId && /* @__PURE__ */ t("span", { className: `text-xs ${n.active ? "text-accent" : "text-cream/55"}`, children: n.active ? "Active" : "Inactive" })
2053
+ t?.paywallId && /* @__PURE__ */ n("span", { className: `text-xs ${t.active ? "text-accent" : "text-cream/55"}`, children: t.active ? "Active" : "Inactive" })
1549
2054
  ] })
1550
2055
  ]
1551
2056
  }
1552
2057
  );
1553
2058
  };
1554
- let $e = 0;
1555
- const dn = ({
2059
+ let Je = 0;
2060
+ const Nr = ({
1556
2061
  source: e,
1557
- onOpen: n,
1558
- device: s = !1
2062
+ onOpen: t,
2063
+ device: r = !1
1559
2064
  }) => {
1560
- const [a, r] = d.useState({});
1561
- d.useEffect(() => {
2065
+ const [a, s] = p.useState({}), i = p.useMemo(ut, [e]);
2066
+ p.useEffect(() => {
1562
2067
  if (e.capabilities?.actions !== !0) return;
1563
- let l = !1;
1564
- for (const h of e.surfaces)
1565
- pe(h).then((w) => {
1566
- l || r((b) => ({ ...b, [$(h)]: w }));
2068
+ let d = !1;
2069
+ for (const b of e.surfaces)
2070
+ Ne(b).then((w) => {
2071
+ d || s((f) => ({ ...f, [E(b)]: w }));
1567
2072
  });
1568
2073
  return () => {
1569
- l = !0;
2074
+ d = !0;
1570
2075
  };
1571
2076
  }, [e]);
1572
- const [i, c] = d.useState({}), f = d.useRef(null);
1573
- d.useLayoutEffect(() => {
1574
- const l = f.current;
1575
- if (!l) return;
1576
- l.scrollTop = $e;
1577
- const h = () => {
1578
- $e = l.scrollTop;
2077
+ const [o, u] = p.useState({}), l = p.useRef(null);
2078
+ p.useLayoutEffect(() => {
2079
+ const d = l.current;
2080
+ if (!d) return;
2081
+ d.scrollTop = Je;
2082
+ const b = () => {
2083
+ Je = d.scrollTop;
1579
2084
  };
1580
- return l.addEventListener("scroll", h, { passive: !0 }), () => {
1581
- h(), l.removeEventListener("scroll", h);
2085
+ return d.addEventListener("scroll", b, { passive: !0 }), () => {
2086
+ b(), d.removeEventListener("scroll", b);
1582
2087
  };
1583
2088
  }, []);
1584
- const u = [
2089
+ const m = [
1585
2090
  ["Paywalls", "paywall"],
1586
2091
  ["Funnels", "funnel"]
1587
- ].map(([l, h]) => {
1588
- const w = e.surfaces.filter((m) => m.kind === h), b = (i[h] ?? "").trim().toLowerCase();
2092
+ ].map(([d, b]) => {
2093
+ const w = e.surfaces.filter((S) => S.kind === b), f = (o[b] ?? "").trim().toLowerCase();
1589
2094
  return {
1590
- label: l,
1591
- kind: h,
2095
+ label: d,
2096
+ kind: b,
1592
2097
  all: w,
1593
- needle: b,
2098
+ needle: f,
1594
2099
  surfaces: w.filter(
1595
- (m) => b === "" || `${m.project ?? ""} ${m.id}`.toLowerCase().includes(b)
2100
+ (S) => f === "" || `${S.project ?? ""} ${S.id}`.toLowerCase().includes(f)
1596
2101
  )
1597
2102
  };
1598
- }).filter((l) => l.all.length > 0);
1599
- return /* @__PURE__ */ o(U, { children: [
1600
- /* @__PURE__ */ t(
1601
- Be,
2103
+ }).filter((d) => d.all.length > 0);
2104
+ return /* @__PURE__ */ c(Z, { children: [
2105
+ /* @__PURE__ */ n(
2106
+ dt,
1602
2107
  {
1603
2108
  title: e.title,
1604
2109
  onHome: () => {
1605
2110
  },
1606
2111
  inset: !0,
1607
- label: s ? "Preview" : void 0,
1608
- actions: s ? /* @__PURE__ */ t(sn, { origin: window.location.origin, scheme: e.scheme }) : void 0
2112
+ label: r ? "Preview" : void 0,
2113
+ actions: r ? /* @__PURE__ */ n(br, { origin: window.location.origin, scheme: e.scheme }) : void 0
1609
2114
  }
1610
2115
  ),
1611
- /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto px-3 pt-6 pb-16 sm:px-6 sm:pt-10", ref: f, children: /* @__PURE__ */ o("div", { className: "mx-auto max-w-[1080px]", children: [
1612
- e.diagnostics && e.diagnostics.length > 0 && /* @__PURE__ */ t("div", { className: "border-red bg-red/10 mb-6 border-l-2 px-4 py-3 text-[0.8125rem] whitespace-pre-wrap", children: e.diagnostics.join(`
2116
+ /* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto px-3 pt-6 pb-16 sm:px-6 sm:pt-10", ref: l, children: /* @__PURE__ */ c("div", { className: "mx-auto max-w-[1080px]", children: [
2117
+ e.diagnostics && e.diagnostics.length > 0 && /* @__PURE__ */ n("div", { className: "border-red bg-red/10 mb-6 border-l-2 px-4 py-3 text-[0.8125rem] whitespace-pre-wrap", children: e.diagnostics.join(`
1613
2118
  `) }),
1614
- u.map((l) => /* @__PURE__ */ o("section", { className: "mt-10 first:mt-0", children: [
1615
- /* @__PURE__ */ o("div", { className: "mb-4 flex items-center gap-2", children: [
1616
- /* @__PURE__ */ t("span", { className: "text-[1.0625rem] font-medium", children: l.label }),
1617
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] text-cream/55 tabular-nums", children: l.surfaces.length }),
1618
- l.all.length > 1 && /* @__PURE__ */ t(
2119
+ m.map((d) => /* @__PURE__ */ c("section", { className: "mt-10 first:mt-0", children: [
2120
+ /* @__PURE__ */ c("div", { className: "mb-4 flex items-center gap-2", children: [
2121
+ /* @__PURE__ */ n("span", { className: "text-[1.0625rem] font-medium", children: d.label }),
2122
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] text-cream/55 tabular-nums", children: d.surfaces.length }),
2123
+ d.all.length > 1 && /* @__PURE__ */ n(
1619
2124
  "input",
1620
2125
  {
1621
2126
  className: "sw-input ml-auto w-48",
1622
2127
  type: "search",
1623
- value: i[l.kind] ?? "",
1624
- placeholder: `Search ${l.label.toLowerCase()}`,
1625
- "aria-label": `Search ${l.label.toLowerCase()}`,
1626
- onChange: (h) => c((w) => ({ ...w, [l.kind]: h.target.value }))
2128
+ value: o[d.kind] ?? "",
2129
+ placeholder: `Search ${d.label.toLowerCase()}`,
2130
+ "aria-label": `Search ${d.label.toLowerCase()}`,
2131
+ onChange: (b) => u((w) => ({ ...w, [d.kind]: b.target.value }))
1627
2132
  }
1628
2133
  )
1629
2134
  ] }),
1630
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-[repeat(auto-fill,minmax(200px,1fr))] sm:gap-6", children: l.surfaces.map((h) => /* @__PURE__ */ t(
1631
- cn,
2135
+ /* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-[repeat(auto-fill,minmax(200px,1fr))] sm:gap-6", children: d.surfaces.map((b) => /* @__PURE__ */ n(
2136
+ xr,
1632
2137
  {
1633
- surface: h,
1634
- status: a[$(h)],
1635
- previewSrc: e.previewUrl(h, {}),
1636
- onOpen: () => n(h),
1637
- href: s ? He(h) : void 0
2138
+ surface: b,
2139
+ status: a[E(b)],
2140
+ previewSrc: e.previewUrl(b),
2141
+ hostState: mt({
2142
+ surface: b,
2143
+ defaults: i,
2144
+ sourceSamples: e.samples,
2145
+ samples: {},
2146
+ theme: "light",
2147
+ edited: {}
2148
+ }),
2149
+ onOpen: () => t(b),
2150
+ href: r ? E(b) : void 0
1638
2151
  },
1639
- $(h)
2152
+ E(b)
1640
2153
  )) }),
1641
- l.surfaces.length === 0 && /* @__PURE__ */ t("span", { className: "block text-[0.8125rem] text-cream/45", children: `Nothing matches “${(i[l.kind] ?? "").trim()}”.` })
1642
- ] }, l.kind)),
1643
- e.surfaces.length === 0 && /* @__PURE__ */ o("div", { className: "border border-dashed border-cream/20 p-12 text-center text-cream/55", children: [
2154
+ d.surfaces.length === 0 && /* @__PURE__ */ n("span", { className: "block text-[0.8125rem] text-cream/45", children: `Nothing matches “${(o[d.kind] ?? "").trim()}”.` })
2155
+ ] }, d.kind)),
2156
+ e.surfaces.length === 0 && /* @__PURE__ */ c("div", { className: "border border-dashed border-cream/20 p-12 text-center text-cream/55", children: [
1644
2157
  "No paywalls yet — create",
1645
2158
  " ",
1646
- /* @__PURE__ */ t("code", { className: "font-mono text-[0.8125rem] text-cream", children: "superwall/paywalls/<id>/app/page.tsx" }),
2159
+ /* @__PURE__ */ n("code", { className: "font-mono text-[0.8125rem] text-cream", children: "superwall/paywalls/<id>/app/page.tsx" }),
1647
2160
  " ",
1648
2161
  "and it appears here."
1649
2162
  ] })
1650
2163
  ] }) }),
1651
- !s && /* @__PURE__ */ t("footer", { className: "bg-bar flex h-11 flex-none items-center justify-center border-t border-cream/10 text-xs text-cream/55", children: "Previews run against the simulated SDK host. Edit files under superwall/ and they update live." })
2164
+ !r && /* @__PURE__ */ n("footer", { className: "bg-bar flex h-11 flex-none items-center justify-center border-t border-cream/10 text-xs text-cream/55", children: "Previews run against a real SDK host — you choose the outcomes. Edit files under superwall/ and they update live." })
1652
2165
  ] });
1653
- }, pn = (e, n) => {
1654
- const s = n.match(/^\/(?:([a-z0-9-]+)\/)?(paywall|funnel)\/([a-z0-9-]+)\/?$/);
1655
- if (s)
2166
+ }, Sr = (e, t) => {
2167
+ const r = t.match(/^\/(?:([a-z0-9-]+)\/)?(paywall|funnel)\/([a-z0-9-]+)\/?$/);
2168
+ if (r)
1656
2169
  return e.find(
1657
- (a) => a.kind === s[2] && a.id === s[3] && (s[1] === void 0 || a.project === s[1])
2170
+ (a) => a.kind === r[2] && a.id === r[3] && (r[1] === void 0 || a.project === r[1])
1658
2171
  );
1659
- }, vn = ({
2172
+ }, $r = ({
1660
2173
  source: e,
1661
- device: n = !1,
1662
- openPreview: s = (a) => window.location.assign(a)
2174
+ device: t = !1
1663
2175
  }) => {
1664
- const [a, r] = d.useState(() => window.location.pathname), [i, c] = d.useState({});
1665
- d.useEffect(() => {
1666
- const l = () => r(window.location.pathname);
2176
+ const [r, a] = p.useState(() => window.location.pathname), [s, i] = p.useState({});
2177
+ p.useEffect(() => {
2178
+ const l = () => a(window.location.pathname);
1667
2179
  return window.addEventListener("popstate", l), () => window.removeEventListener("popstate", l);
1668
- }, []), d.useEffect(() => {
2180
+ }, []), p.useEffect(() => {
1669
2181
  if (e.capabilities?.actions !== !0) return;
1670
2182
  let l = !1;
1671
- return Jt().then((h) => {
1672
- l || c(h);
2183
+ return lr().then((m) => {
2184
+ l || i(m);
1673
2185
  }), () => {
1674
2186
  l = !0;
1675
2187
  };
1676
2188
  }, [e.capabilities?.actions]);
1677
- const f = (l) => {
1678
- window.history.pushState(null, "", l), r(l);
1679
- }, u = n ? void 0 : pn(e.surfaces, a);
1680
- return /* @__PURE__ */ t(et, { children: u ? /* @__PURE__ */ t(
1681
- en,
2189
+ const o = (l) => {
2190
+ window.history.pushState(null, "", l), a(l);
2191
+ }, u = Sr(e.surfaces, r);
2192
+ return /* @__PURE__ */ n(kt, { children: u ? /* @__PURE__ */ n(
2193
+ mr,
1682
2194
  {
1683
2195
  source: e,
1684
2196
  surface: u,
1685
- samples: i,
1686
- onBack: () => f("/")
2197
+ samples: s,
2198
+ onBack: () => o(t ? "/device" : "/")
1687
2199
  }
1688
- ) : /* @__PURE__ */ t(
1689
- dn,
2200
+ ) : /* @__PURE__ */ n(
2201
+ Nr,
1690
2202
  {
1691
2203
  source: e,
1692
- device: n,
1693
- onOpen: (l) => n ? s(He(l)) : f($(l))
2204
+ device: t,
2205
+ onOpen: (l) => o(E(l))
1694
2206
  }
1695
2207
  ) });
1696
- }, hn = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && Object.values(e).every((n) => typeof n == "string"), B = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Y = (e) => Array.isArray(e) && e.every((n) => typeof n == "string"), mn = (e) => {
1697
- if (!B(e)) return;
1698
- const n = e.kind === "paywall" || e.kind === "funnel" ? e.kind : void 0;
1699
- if (!(!n || typeof e.id != "string"))
2208
+ }, _r = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && Object.values(e).every((t) => typeof t == "string"), j = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Y = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), kr = (e) => {
2209
+ if (!j(e)) return;
2210
+ const t = e.kind === "paywall" || e.kind === "funnel" ? e.kind : void 0;
2211
+ if (!(!t || typeof e.id != "string"))
1700
2212
  return {
1701
- kind: n,
2213
+ kind: t,
1702
2214
  id: e.id,
1703
2215
  ...typeof e.project == "string" ? { project: e.project } : {},
1704
2216
  routes: Y(e.routes) ? e.routes : [],
1705
- products: hn(e.products) ? e.products : {},
2217
+ products: _r(e.products) ? e.products : {},
1706
2218
  locales: Y(e.locales) ? e.locales : [],
1707
2219
  ...Y(e.platforms) ? { platforms: e.platforms } : {},
1708
2220
  paywallId: typeof e.paywallId == "string" ? e.paywallId : void 0
1709
2221
  };
1710
- }, gn = (e) => {
1711
- if (!B(e))
2222
+ }, Or = (e) => {
2223
+ if (!j(e))
1712
2224
  throw new Error("project payload is not an object");
1713
- const n = Array.isArray(e.surfaces) ? e.surfaces.map(mn).filter((i) => i !== void 0) : [], s = B(e.capabilities) ? e.capabilities : {}, a = B(e.samples) ? e.samples : {}, r = (i) => B(a[i]) ? a[i] : {};
2225
+ const t = Array.isArray(e.surfaces) ? e.surfaces.map(kr).filter((i) => i !== void 0) : [], r = j(e.capabilities) ? e.capabilities : {}, a = j(e.samples) ? e.samples : {}, s = (i) => j(a[i]) ? a[i] : {};
1714
2226
  return {
1715
2227
  title: typeof e.title == "string" ? e.title : "superwall",
1716
2228
  scheme: typeof e.scheme == "string" ? e.scheme : void 0,
1717
- surfaces: n,
2229
+ surfaces: t,
1718
2230
  diagnostics: Y(e.diagnostics) ? e.diagnostics : [],
1719
2231
  samples: {
1720
- device: r("device"),
1721
- user: r("user"),
1722
- params: r("params")
2232
+ device: s("device"),
2233
+ user: s("user"),
2234
+ params: s("params")
1723
2235
  },
1724
- capabilities: { actions: s.actions === !0 }
2236
+ capabilities: { actions: r.actions === !0 }
1725
2237
  };
1726
2238
  };
1727
2239
  export {
1728
- ze as DEFAULT_DEVICE_ID,
1729
- Nt as DeviceFrame,
1730
- J as STUDIO_DEVICES,
1731
- Bt as Segmented,
1732
- Ne as Select,
1733
- vn as StudioApp,
1734
- et as StudioShell,
1735
- en as SurfaceEditor,
1736
- dn as SurfaceList,
1737
- Ut as Switch,
1738
- Be as TopBar,
1739
- Kt as VariablesPanel,
1740
- bn as buildPreviewPath,
1741
- Qt as deviceById,
1742
- gn as parseProjectPayload,
1743
- wn as snapshotPreviewUrl,
1744
- Fe as withOverrides,
1745
- Gt as withPreviewOptIn
2240
+ pt as DEFAULT_DEVICE_ID,
2241
+ On as DeviceFrame,
2242
+ lt as HostedIframe,
2243
+ Zn as PaywallToasts,
2244
+ Q as STUDIO_DEVICES,
2245
+ Xn as Segmented,
2246
+ Fe as Select,
2247
+ $r as StudioApp,
2248
+ kt as StudioShell,
2249
+ mr as SurfaceEditor,
2250
+ Nr as SurfaceList,
2251
+ Qn as Switch,
2252
+ dt as TopBar,
2253
+ ir as VariablesPanel,
2254
+ Er as buildPreviewPath,
2255
+ Ge as createHostState,
2256
+ Gn as createStudioDelegate,
2257
+ pr as deviceById,
2258
+ Pt as diffHostState,
2259
+ F as hasIntroductoryOffer,
2260
+ mt as hostStateFor,
2261
+ ke as hostedUrl,
2262
+ Or as parseProjectPayload,
2263
+ Ft as silentDelegate,
2264
+ Cr as snapshotPreviewUrl,
2265
+ ut as studioDefaults,
2266
+ E as surfacePath,
2267
+ Yn as useStudioDelegate
1746
2268
  };