@monetize.software/sdk 3.0.0-alpha.9 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/PaywallUI-CCwYgagL.js +26 -0
- package/dist/chunks/PaywallUI-CCwYgagL.js.map +1 -0
- package/dist/chunks/PaywallUI-CDlJL5Em.js +3599 -0
- package/dist/chunks/PaywallUI-CDlJL5Em.js.map +1 -0
- package/dist/chunks/ar-CViBaj16.js +2 -0
- package/dist/chunks/ar-CViBaj16.js.map +1 -0
- package/dist/chunks/{ar-B2Wg_IrC.js → ar-ClwBmll7.js} +5 -1
- package/dist/chunks/ar-ClwBmll7.js.map +1 -0
- package/dist/chunks/{cs-BNo9Dx0Q.js → cs-Cc_D0W4S.js} +5 -1
- package/dist/chunks/cs-Cc_D0W4S.js.map +1 -0
- package/dist/chunks/cs-DQJWP65K.js +2 -0
- package/dist/chunks/cs-DQJWP65K.js.map +1 -0
- package/dist/chunks/{da-Do9Lq6En.js → da-BtKcMSxH.js} +5 -1
- package/dist/chunks/da-BtKcMSxH.js.map +1 -0
- package/dist/chunks/da-Cyr_IXhb.js +2 -0
- package/dist/chunks/da-Cyr_IXhb.js.map +1 -0
- package/dist/chunks/de-BOCUj1pF.js +2 -0
- package/dist/chunks/de-BOCUj1pF.js.map +1 -0
- package/dist/chunks/{de-C8pDZNvx.js → de-iwQW5eYl.js} +5 -1
- package/dist/chunks/de-iwQW5eYl.js.map +1 -0
- package/dist/chunks/{el-DzMNX-_P.js → el-BoH65CeJ.js} +5 -1
- package/dist/chunks/el-BoH65CeJ.js.map +1 -0
- package/dist/chunks/el-C6jLHiEF.js +2 -0
- package/dist/chunks/el-C6jLHiEF.js.map +1 -0
- package/dist/chunks/es-CARHLxHR.js +2 -0
- package/dist/chunks/es-CARHLxHR.js.map +1 -0
- package/dist/chunks/{es-YrKt-q4w.js → es-CkP16_8K.js} +5 -1
- package/dist/chunks/es-CkP16_8K.js.map +1 -0
- package/dist/chunks/fi-B8OhRbwY.js +2 -0
- package/dist/chunks/fi-B8OhRbwY.js.map +1 -0
- package/dist/chunks/{fi-Bh44pwZ4.js → fi-yUXSmK1E.js} +5 -1
- package/dist/chunks/fi-yUXSmK1E.js.map +1 -0
- package/dist/chunks/{fr-BhYf-iKk.js → fr-CoM18zzM.js} +2 -2
- package/dist/chunks/fr-CoM18zzM.js.map +1 -0
- package/dist/chunks/{fr-Bc0pw4ws.js → fr-DSZRGsxI.js} +5 -1
- package/dist/chunks/fr-DSZRGsxI.js.map +1 -0
- package/dist/chunks/he-DTDVc3lA.js +2 -0
- package/dist/chunks/he-DTDVc3lA.js.map +1 -0
- package/dist/chunks/{he-Bfm-bhe3.js → he-ZUo7cQjk.js} +7 -3
- package/dist/chunks/he-ZUo7cQjk.js.map +1 -0
- package/dist/chunks/hi-BjnS9UeE.js +2 -0
- package/dist/chunks/hi-BjnS9UeE.js.map +1 -0
- package/dist/chunks/{hi-D-O-B9Dn.js → hi-CEutBKiG.js} +5 -1
- package/dist/chunks/hi-CEutBKiG.js.map +1 -0
- package/dist/chunks/hu-CN06FMhV.js +2 -0
- package/dist/chunks/hu-CN06FMhV.js.map +1 -0
- package/dist/chunks/{hu-CmIuAbLL.js → hu-DvEAWGS7.js} +5 -1
- package/dist/chunks/hu-DvEAWGS7.js.map +1 -0
- package/dist/chunks/id-BITgaBxq.js +2 -0
- package/dist/chunks/id-BITgaBxq.js.map +1 -0
- package/dist/chunks/{id-DN7IES-A.js → id-_eEMrYMW.js} +5 -1
- package/dist/chunks/id-_eEMrYMW.js.map +1 -0
- package/dist/chunks/index-CLB1AgLg.js +2074 -0
- package/dist/chunks/index-CLB1AgLg.js.map +1 -0
- package/dist/chunks/index-CzDSBl4d.js +2 -0
- package/dist/chunks/index-CzDSBl4d.js.map +1 -0
- package/dist/chunks/{it-Cz5Nmqx5.js → it-BAmsQbIl.js} +5 -1
- package/dist/chunks/it-BAmsQbIl.js.map +1 -0
- package/dist/chunks/it-DVcsq015.js +2 -0
- package/dist/chunks/it-DVcsq015.js.map +1 -0
- package/dist/chunks/ja-Bim7Ok2e.js +2 -0
- package/dist/chunks/ja-Bim7Ok2e.js.map +1 -0
- package/dist/chunks/{ja-BH9BlBh2.js → ja-BqCZWVKK.js} +7 -3
- package/dist/chunks/ja-BqCZWVKK.js.map +1 -0
- package/dist/chunks/{ko-CYV9QuYs.js → ko-CkIzeOzb.js} +7 -3
- package/dist/chunks/ko-CkIzeOzb.js.map +1 -0
- package/dist/chunks/ko-DqEfcVCB.js +2 -0
- package/dist/chunks/ko-DqEfcVCB.js.map +1 -0
- package/dist/chunks/nl-DSNuJWIo.js +2 -0
- package/dist/chunks/nl-DSNuJWIo.js.map +1 -0
- package/dist/chunks/{nl-BvkB900D.js → nl-Mu_KNzli.js} +5 -1
- package/dist/chunks/nl-Mu_KNzli.js.map +1 -0
- package/dist/chunks/{no-3s9_ormb.js → no-9HMjljBs.js} +5 -1
- package/dist/chunks/no-9HMjljBs.js.map +1 -0
- package/dist/chunks/no-B5HY_A8_.js +2 -0
- package/dist/chunks/no-B5HY_A8_.js.map +1 -0
- package/dist/chunks/{pl-C9WTGQtb.js → pl-Cbr2qDwv.js} +5 -1
- package/dist/chunks/pl-Cbr2qDwv.js.map +1 -0
- package/dist/chunks/pl-ChGLn9Sy.js +2 -0
- package/dist/chunks/pl-ChGLn9Sy.js.map +1 -0
- package/dist/chunks/pt-CDLEktT9.js +2 -0
- package/dist/chunks/pt-CDLEktT9.js.map +1 -0
- package/dist/chunks/{pt-uFVUv_Op.js → pt-_jirA6IR.js} +5 -1
- package/dist/chunks/pt-_jirA6IR.js.map +1 -0
- package/dist/chunks/ro-BHCHiXY3.js +2 -0
- package/dist/chunks/ro-BHCHiXY3.js.map +1 -0
- package/dist/chunks/{ro-BrqQ8Au-.js → ro-oZLxhwHc.js} +5 -1
- package/dist/chunks/ro-oZLxhwHc.js.map +1 -0
- package/dist/chunks/ru-B6HgmINj.js +2 -0
- package/dist/chunks/ru-B6HgmINj.js.map +1 -0
- package/dist/chunks/{ru-DK594dA8.js → ru-C2-sqY7B.js} +5 -1
- package/dist/chunks/ru-C2-sqY7B.js.map +1 -0
- package/dist/chunks/sv-DoSs4a9n.js +2 -0
- package/dist/chunks/sv-DoSs4a9n.js.map +1 -0
- package/dist/chunks/{sv-CHNH8-mq.js → sv-y385MWVy.js} +5 -1
- package/dist/chunks/sv-y385MWVy.js.map +1 -0
- package/dist/chunks/{th-l24Pm5q-.js → th-Bjbv4M1s.js} +5 -1
- package/dist/chunks/th-Bjbv4M1s.js.map +1 -0
- package/dist/chunks/th-UeweOhwg.js +2 -0
- package/dist/chunks/th-UeweOhwg.js.map +1 -0
- package/dist/chunks/tr-BbBr5tyB.js +2 -0
- package/dist/chunks/tr-BbBr5tyB.js.map +1 -0
- package/dist/chunks/{tr-ADpigSY5.js → tr-DmHo9F8i.js} +7 -3
- package/dist/chunks/tr-DmHo9F8i.js.map +1 -0
- package/dist/chunks/uk-CJTA1SJK.js +2 -0
- package/dist/chunks/uk-CJTA1SJK.js.map +1 -0
- package/dist/chunks/{uk-CGqo4jek.js → uk-DwvAoTe5.js} +5 -1
- package/dist/chunks/uk-DwvAoTe5.js.map +1 -0
- package/dist/chunks/{vi-Dk9bTu6f.js → vi-BEpwsVLR.js} +5 -1
- package/dist/chunks/vi-BEpwsVLR.js.map +1 -0
- package/dist/chunks/vi-ZvBo7PbB.js +2 -0
- package/dist/chunks/vi-ZvBo7PbB.js.map +1 -0
- package/dist/chunks/zh-CPZBEb3d.js +2 -0
- package/dist/chunks/zh-CPZBEb3d.js.map +1 -0
- package/dist/chunks/{zh-LDkEV2D9.js → zh-DrG18oGe.js} +7 -3
- package/dist/chunks/zh-DrG18oGe.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +89 -4
- package/dist/core.js +17 -2004
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +188 -5
- package/dist/index.js +17 -13
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +153 -4
- package/dist/ui.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/PaywallUI-BhQpWSWN.js +0 -3224
- package/dist/chunks/PaywallUI-BhQpWSWN.js.map +0 -1
- package/dist/chunks/PaywallUI-C7Wp2TiR.js +0 -26
- package/dist/chunks/PaywallUI-C7Wp2TiR.js.map +0 -1
- package/dist/chunks/ar-7cgIM-Vl.js +0 -2
- package/dist/chunks/ar-7cgIM-Vl.js.map +0 -1
- package/dist/chunks/ar-B2Wg_IrC.js.map +0 -1
- package/dist/chunks/cs-BNo9Dx0Q.js.map +0 -1
- package/dist/chunks/cs-S05PC5AC.js +0 -2
- package/dist/chunks/cs-S05PC5AC.js.map +0 -1
- package/dist/chunks/da-Bi4zBG14.js +0 -2
- package/dist/chunks/da-Bi4zBG14.js.map +0 -1
- package/dist/chunks/da-Do9Lq6En.js.map +0 -1
- package/dist/chunks/de-C8pDZNvx.js.map +0 -1
- package/dist/chunks/de-nCDB6D2W.js +0 -2
- package/dist/chunks/de-nCDB6D2W.js.map +0 -1
- package/dist/chunks/el-BrKaa978.js +0 -2
- package/dist/chunks/el-BrKaa978.js.map +0 -1
- package/dist/chunks/el-DzMNX-_P.js.map +0 -1
- package/dist/chunks/es-B-Wtyzrl.js +0 -2
- package/dist/chunks/es-B-Wtyzrl.js.map +0 -1
- package/dist/chunks/es-YrKt-q4w.js.map +0 -1
- package/dist/chunks/fi-Bh44pwZ4.js.map +0 -1
- package/dist/chunks/fi-D1SGXjnO.js +0 -2
- package/dist/chunks/fi-D1SGXjnO.js.map +0 -1
- package/dist/chunks/fr-Bc0pw4ws.js.map +0 -1
- package/dist/chunks/fr-BhYf-iKk.js.map +0 -1
- package/dist/chunks/he-BXAaFv6Y.js +0 -2
- package/dist/chunks/he-BXAaFv6Y.js.map +0 -1
- package/dist/chunks/he-Bfm-bhe3.js.map +0 -1
- package/dist/chunks/hi-D-O-B9Dn.js.map +0 -1
- package/dist/chunks/hi-xblDO0O7.js +0 -2
- package/dist/chunks/hi-xblDO0O7.js.map +0 -1
- package/dist/chunks/hu-CmIuAbLL.js.map +0 -1
- package/dist/chunks/hu-Wa46p0y4.js +0 -2
- package/dist/chunks/hu-Wa46p0y4.js.map +0 -1
- package/dist/chunks/id-CQEo5X94.js +0 -2
- package/dist/chunks/id-CQEo5X94.js.map +0 -1
- package/dist/chunks/id-DN7IES-A.js.map +0 -1
- package/dist/chunks/it-8AYCm0xz.js +0 -2
- package/dist/chunks/it-8AYCm0xz.js.map +0 -1
- package/dist/chunks/it-Cz5Nmqx5.js.map +0 -1
- package/dist/chunks/ja-BH9BlBh2.js.map +0 -1
- package/dist/chunks/ja-q-COVayn.js +0 -2
- package/dist/chunks/ja-q-COVayn.js.map +0 -1
- package/dist/chunks/ko-B6HRCscZ.js +0 -2
- package/dist/chunks/ko-B6HRCscZ.js.map +0 -1
- package/dist/chunks/ko-CYV9QuYs.js.map +0 -1
- package/dist/chunks/nl-BvkB900D.js.map +0 -1
- package/dist/chunks/nl-CAd6_xlm.js +0 -2
- package/dist/chunks/nl-CAd6_xlm.js.map +0 -1
- package/dist/chunks/no-3s9_ormb.js.map +0 -1
- package/dist/chunks/no-CAmz6bz6.js +0 -2
- package/dist/chunks/no-CAmz6bz6.js.map +0 -1
- package/dist/chunks/pl-C9WTGQtb.js.map +0 -1
- package/dist/chunks/pl-DqUSTCaF.js +0 -2
- package/dist/chunks/pl-DqUSTCaF.js.map +0 -1
- package/dist/chunks/pt-8ARZnH0_.js +0 -2
- package/dist/chunks/pt-8ARZnH0_.js.map +0 -1
- package/dist/chunks/pt-uFVUv_Op.js.map +0 -1
- package/dist/chunks/ro-BrqQ8Au-.js.map +0 -1
- package/dist/chunks/ro-D-NMbp2F.js +0 -2
- package/dist/chunks/ro-D-NMbp2F.js.map +0 -1
- package/dist/chunks/ru-8gbHPh0g.js +0 -2
- package/dist/chunks/ru-8gbHPh0g.js.map +0 -1
- package/dist/chunks/ru-DK594dA8.js.map +0 -1
- package/dist/chunks/sv-CHNH8-mq.js.map +0 -1
- package/dist/chunks/sv-D8a8hmx9.js +0 -2
- package/dist/chunks/sv-D8a8hmx9.js.map +0 -1
- package/dist/chunks/th-DfjUK0Y7.js +0 -2
- package/dist/chunks/th-DfjUK0Y7.js.map +0 -1
- package/dist/chunks/th-l24Pm5q-.js.map +0 -1
- package/dist/chunks/tr-ADpigSY5.js.map +0 -1
- package/dist/chunks/tr-BdBpz4tL.js +0 -2
- package/dist/chunks/tr-BdBpz4tL.js.map +0 -1
- package/dist/chunks/uk-CGqo4jek.js.map +0 -1
- package/dist/chunks/uk-Cx1zv1ao.js +0 -2
- package/dist/chunks/uk-Cx1zv1ao.js.map +0 -1
- package/dist/chunks/vi-Dk9bTu6f.js.map +0 -1
- package/dist/chunks/vi-oe2dW21I.js +0 -2
- package/dist/chunks/vi-oe2dW21I.js.map +0 -1
- package/dist/chunks/zh-CwczPMPp.js +0 -2
- package/dist/chunks/zh-CwczPMPp.js.map +0 -1
- package/dist/chunks/zh-LDkEV2D9.js.map +0 -1
|
@@ -0,0 +1,3599 @@
|
|
|
1
|
+
import { P as L, g as $, r as N, B as Ne, E as Ve, f as He, i as $e, b as ue } from "./index-CLB1AgLg.js";
|
|
2
|
+
import { render as J, h as pe, createContext as qe } from "preact";
|
|
3
|
+
import { jsx as i, jsxs as d, Fragment as le } from "preact/jsx-runtime";
|
|
4
|
+
import { useContext as Ge, useState as v, useEffect as j, useRef as O, useMemo as We, useLayoutEffect as Ze } from "preact/hooks";
|
|
5
|
+
const he = 3600 * 1e3;
|
|
6
|
+
function Q(t) {
|
|
7
|
+
return `paywall-${t}-trial-time-first-open`;
|
|
8
|
+
}
|
|
9
|
+
function ee(t) {
|
|
10
|
+
return `paywall-${t}-skip-times`;
|
|
11
|
+
}
|
|
12
|
+
class Ae {
|
|
13
|
+
constructor(e, r, n) {
|
|
14
|
+
this.storage = e, this.paywallId = r, this.config = n;
|
|
15
|
+
}
|
|
16
|
+
async check() {
|
|
17
|
+
return this.config.mode === "time" ? this.checkTime() : this.checkOpens();
|
|
18
|
+
}
|
|
19
|
+
async recordBlock() {
|
|
20
|
+
return this.config.mode === "time" ? this.recordTime() : this.recordOpens();
|
|
21
|
+
}
|
|
22
|
+
async reset() {
|
|
23
|
+
await this.storage.removeItem(this.config.mode === "time" ? Q(this.paywallId) : ee(this.paywallId));
|
|
24
|
+
}
|
|
25
|
+
async checkTime() {
|
|
26
|
+
const e = this.config.payload * he, r = await this.storage.getItem(Q(this.paywallId)), n = r ? Number(r) : null;
|
|
27
|
+
if (!n || !Number.isFinite(n))
|
|
28
|
+
return {
|
|
29
|
+
mode: "time",
|
|
30
|
+
blocked: !0,
|
|
31
|
+
startedAt: null,
|
|
32
|
+
expiresAt: null,
|
|
33
|
+
remainingMs: e,
|
|
34
|
+
totalMs: e
|
|
35
|
+
};
|
|
36
|
+
const a = n + e, s = Math.max(0, a - Date.now());
|
|
37
|
+
return {
|
|
38
|
+
mode: "time",
|
|
39
|
+
blocked: s > 0,
|
|
40
|
+
startedAt: n,
|
|
41
|
+
expiresAt: a,
|
|
42
|
+
remainingMs: s,
|
|
43
|
+
totalMs: e
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async checkOpens() {
|
|
47
|
+
const e = this.config.payload, r = await this.storage.getItem(ee(this.paywallId)), n = r ? Number(r) : 0, a = Number.isFinite(n) ? n : 0, s = a < e, o = Math.max(0, e - a);
|
|
48
|
+
return {
|
|
49
|
+
mode: "opens",
|
|
50
|
+
blocked: s,
|
|
51
|
+
remainingActions: o,
|
|
52
|
+
totalActions: e
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async recordTime() {
|
|
56
|
+
const e = this.config.payload * he, r = Q(this.paywallId), n = await this.storage.getItem(r);
|
|
57
|
+
let a = n ? Number(n) : null;
|
|
58
|
+
(!a || !Number.isFinite(a)) && (a = Date.now(), await this.storage.setItem(r, String(a)));
|
|
59
|
+
const s = a + e, o = Math.max(0, s - Date.now());
|
|
60
|
+
return {
|
|
61
|
+
mode: "time",
|
|
62
|
+
blocked: o > 0,
|
|
63
|
+
startedAt: a,
|
|
64
|
+
expiresAt: s,
|
|
65
|
+
remainingMs: o,
|
|
66
|
+
totalMs: e
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async recordOpens() {
|
|
70
|
+
const e = this.config.payload, r = ee(this.paywallId), n = await this.storage.getItem(r), a = n ? Number(n) : 0, s = Number.isFinite(a) ? a : 0, o = Math.min(e, s + 1);
|
|
71
|
+
await this.storage.setItem(r, String(o));
|
|
72
|
+
const c = Math.max(0, e - o);
|
|
73
|
+
return {
|
|
74
|
+
mode: "opens",
|
|
75
|
+
blocked: o < e,
|
|
76
|
+
remainingActions: c,
|
|
77
|
+
totalActions: e
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
let ge = !1;
|
|
82
|
+
class Ke {
|
|
83
|
+
constructor(e, r, n) {
|
|
84
|
+
ge || (ge = !0, console.warn(
|
|
85
|
+
'[paywall] trial.storage="server" is not implemented yet — falling back to client storage. State lives in localStorage; users can reset trial by clearing site data.'
|
|
86
|
+
)), this.fallback = new Ae(e, r, n);
|
|
87
|
+
}
|
|
88
|
+
check() {
|
|
89
|
+
return this.fallback.check();
|
|
90
|
+
}
|
|
91
|
+
recordBlock() {
|
|
92
|
+
return this.fallback.recordBlock();
|
|
93
|
+
}
|
|
94
|
+
reset() {
|
|
95
|
+
return this.fallback.reset();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function Ye(t, e, r) {
|
|
99
|
+
return r.storage === "server" ? new Ke(t, e, r) : new Ae(t, e, r);
|
|
100
|
+
}
|
|
101
|
+
const Me = '/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-600:oklch(57.7% .245 27.325);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-700:oklch(50.8% .118 165.612);--color-slate-950:oklch(12.9% .042 264.695);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:.375rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--blur-sm:8px;--blur-md:12px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:host{all:initial;color-scheme:light;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizelegibility;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}*,:before,:after{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}button{cursor:pointer;font-family:inherit}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.-top-2{top:calc(var(--spacing) * -2)}.-top-\\[9px\\]{top:-9px}.-top-\\[10px\\]{top:-10px}.top-1\\/2{top:50%}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.-right-\\[6px\\]{right:-6px}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.left-1\\/2{left:50%}.z-10{z-index:10}.z-\\[1\\]{z-index:1}.z-\\[2147483647\\]{z-index:2147483647}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.-mt-3{margin-top:calc(var(--spacing) * -3)}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.-mb-2{margin-bottom:calc(var(--spacing) * -2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.-ml-1{margin-left:calc(var(--spacing) * -1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-1{height:calc(var(--spacing) * 1)}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.h-6\\.5{height:calc(var(--spacing) * 6.5)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-\\[22px\\]{height:22px}.h-full{height:100%}.h-px{height:1px}.max-h-\\[calc\\(100dvh-1rem\\)\\]{max-height:calc(100dvh - 1rem)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-12{min-height:calc(var(--spacing) * 12)}.min-h-\\[2\\.4em\\]{min-height:2.4em}.min-h-\\[120px\\]{min-height:120px}.w-1{width:calc(var(--spacing) * 1)}.w-4{width:calc(var(--spacing) * 4)}.w-6{width:calc(var(--spacing) * 6)}.w-6\\.5{width:calc(var(--spacing) * 6.5)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-11{width:calc(var(--spacing) * 11)}.w-14{width:calc(var(--spacing) * 14)}.w-full{width:100%}.max-w-\\[20rem\\]{max-width:20rem}.max-w-\\[22rem\\]{max-width:22rem}.max-w-\\[75\\%\\]{max-width:75%}.max-w-\\[320px\\]{max-width:320px}.max-w-\\[360px\\]{max-width:360px}.max-w-\\[400px\\]{max-width:400px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.-translate-x-1\\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\\[pw-fade-in_180ms_ease-out\\]{animation:.18s ease-out pw-fade-in}.animate-\\[pw-scale-in_220ms_cubic-bezier\\(0\\.16\\,1\\,0\\.3\\,1\\)\\]{animation:.22s cubic-bezier(.16,1,.3,1) pw-scale-in}.animate-ping{animation:var(--animate-ping)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-x-1\\.5{column-gap:calc(var(--spacing) * 1.5)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.self-center{align-self:center}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\\[9px\\]{border-radius:9px}.rounded-\\[11px\\]{border-radius:11px}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-xl{border-top-left-radius:var(--radius-xl);border-top-right-radius:var(--radius-xl)}.rounded-tl-xl{border-top-left-radius:var(--radius-xl)}.rounded-tr-xl{border-top-right-radius:var(--radius-xl)}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.border,.border-1{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\\[2\\.5px\\]{border-style:var(--tw-border-style);border-width:2.5px}.border-\\[3px\\]{border-style:var(--tw-border-style);border-width:3px}.border-\\[5px\\]{border-style:var(--tw-border-style);border-width:5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b,.border-b-1{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\\[var\\(--pw-accent\\)\\]{border-color:var(--pw-accent)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-white{border-color:var(--color-white)}.border-white\\/40{border-color:#fff6}@supports (color:color-mix(in lab,red,red)){.border-white\\/40{border-color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.border-t-\\[var\\(--pw-accent\\)\\]{border-top-color:var(--pw-accent)}.border-t-gray-700{border-top-color:var(--color-gray-700)}.border-t-white{border-top-color:var(--color-white)}.bg-\\[color-mix\\(in_srgb\\,var\\(--pw-accent\\)_6\\%\\,white\\)\\]{background-color:var(--pw-accent)}@supports (color:color-mix(in lab,red,red)){.bg-\\[color-mix\\(in_srgb\\,var\\(--pw-accent\\)_6\\%\\,white\\)\\]{background-color:color-mix(in srgb,var(--pw-accent) 6%,white)}}.bg-black\\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-50\\/60{background-color:#f9fafb99}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\\/60{background-color:color-mix(in oklab,var(--color-gray-50) 60%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-red-50{background-color:var(--color-red-50)}.bg-slate-950\\/50{background-color:#02061880}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\\/50{background-color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.p-2{padding:calc(var(--spacing) * 2)}.p-3\\.5{padding:calc(var(--spacing) * 3.5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\\.5{padding-block:calc(var(--spacing) * 3.5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-3\\.5{padding-top:calc(var(--spacing) * 3.5)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pr-12{padding-right:calc(var(--spacing) * 12)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-3\\.5{padding-bottom:calc(var(--spacing) * 3.5)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[0\\.9375rem\\]{font-size:.9375rem}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[15px\\]{font-size:15px}.text-\\[22px\\]{font-size:22px}.text-\\[26px\\]{font-size:26px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-balance{text-wrap:balance}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-700{color:var(--color-emerald-700)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-800\\/70{color:#1e2939b3}@supports (color:color-mix(in lab,red,red)){.text-gray-800\\/70{color:color-mix(in oklab,var(--color-gray-800) 70%,transparent)}}.text-gray-900{color:var(--color-gray-900)}.text-red-600{color:var(--color-red-600)}.text-transparent{color:#0000}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.decoration-gray-400{-webkit-text-decoration-color:var(--color-gray-400);text-decoration-color:var(--color-gray-400)}.decoration-\\[1\\.5px\\]{text-decoration-thickness:1.5px}.underline-offset-2{text-underline-offset:2px}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0_0_2px_rgba\\(239\\,68\\,68\\,0\\.5\\)\\]{--tw-shadow:0 0 0 2px var(--tw-shadow-color,#ef444480);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.\\!filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.placeholder\\:text-gray-500::placeholder{color:var(--color-gray-500)}@media(hover:hover){.hover\\:-translate-y-px:hover{--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\\:border-gray-400:hover{border-color:var(--color-gray-400)}.hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\\:bg-gray-50\\/60:hover{background-color:#f9fafb99}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-50\\/60:hover{background-color:color-mix(in oklab,var(--color-gray-50) 60%,transparent)}}.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-gray-200\\/60:hover{background-color:#e5e7eb99}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-200\\/60:hover{background-color:color-mix(in oklab,var(--color-gray-200) 60%,transparent)}}.hover\\:bg-white:hover{background-color:var(--color-white)}.hover\\:text-gray-700:hover{color:var(--color-gray-700)}.hover\\:text-gray-900:hover{color:var(--color-gray-900)}.hover\\:text-red-600:hover{color:var(--color-red-600)}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-80:hover{opacity:.8}.hover\\:brightness-105:hover{--tw-brightness:brightness(105%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\\:bg-gray-200\\/60:focus{background-color:#e5e7eb99}@supports (color:color-mix(in lab,red,red)){.focus\\:bg-gray-200\\/60:focus{background-color:color-mix(in oklab,var(--color-gray-200) 60%,transparent)}}.focus\\:shadow-\\[0_0_0_2px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_30\\%\\,transparent\\)\\]:focus{--tw-shadow:0 0 0 2px var(--tw-shadow-color,var(--pw-accent))}@supports (color:color-mix(in lab,red,red)){.focus\\:shadow-\\[0_0_0_2px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_30\\%\\,transparent\\)\\]:focus{--tw-shadow:0 0 0 2px var(--tw-shadow-color,color-mix(in srgb,var(--pw-accent) 30%,transparent))}}.focus\\:shadow-\\[0_0_0_2px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_30\\%\\,transparent\\)\\]:focus{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:opacity-80:focus-visible{opacity:.8}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-\\[var\\(--pw-accent\\)\\]:focus-visible{--tw-ring-color:var(--pw-accent)}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\\:ring-inset:focus-visible{--tw-ring-inset:inset}.active\\:scale-\\[0\\.98\\]:active{scale:.98}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-60:disabled{opacity:.6}@media(hover:hover){.disabled\\:hover\\:translate-y-0:disabled:hover{--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.disabled\\:hover\\:brightness-100:disabled:hover{--tw-brightness:brightness(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}@media(min-width:40rem){.sm\\:max-h-\\[calc\\(100dvh-2rem\\)\\]{max-height:calc(100dvh - 2rem)}.sm\\:p-4{padding:calc(var(--spacing) * 4)}.sm\\:p-8{padding:calc(var(--spacing) * 8)}.sm\\:px-8{padding-inline:calc(var(--spacing) * 8)}.sm\\:pt-5{padding-top:calc(var(--spacing) * 5)}.sm\\:pt-8{padding-top:calc(var(--spacing) * 8)}.sm\\:pb-4{padding-bottom:calc(var(--spacing) * 4)}.sm\\:pb-8{padding-bottom:calc(var(--spacing) * 8)}.sm\\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}}}.pw-cta-shimmer:before{content:"";z-index:1;background:linear-gradient(90deg,#0000,#ffffff59 50%,#0000);width:100%;height:100%;animation:3s infinite pw-cta-shimmer;position:absolute;top:0;left:-100%}@keyframes pw-cta-shimmer{0%{left:-100%}to{left:100%}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}';
|
|
102
|
+
let fe = !1;
|
|
103
|
+
function Xe() {
|
|
104
|
+
if (fe || (fe = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
|
|
105
|
+
let t;
|
|
106
|
+
try {
|
|
107
|
+
const e = new CSSStyleSheet();
|
|
108
|
+
e.replaceSync(Me), t = e.cssRules;
|
|
109
|
+
} catch {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
for (const e of t) {
|
|
113
|
+
if (e.constructor.name !== "CSSPropertyRule") continue;
|
|
114
|
+
const r = e;
|
|
115
|
+
try {
|
|
116
|
+
CSS.registerProperty({
|
|
117
|
+
name: r.name,
|
|
118
|
+
syntax: r.syntax,
|
|
119
|
+
inherits: r.inherits,
|
|
120
|
+
...r.initialValue != null ? { initialValue: r.initialValue } : {}
|
|
121
|
+
});
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function Je(t, e, r = {}) {
|
|
127
|
+
if (typeof document > "u")
|
|
128
|
+
throw new Error("mountShadow called in non-DOM environment");
|
|
129
|
+
Xe();
|
|
130
|
+
const n = r.host ?? document.createElement("div");
|
|
131
|
+
n.setAttribute("data-paywall-host", ""), n.style.cssText = r.inline ? "all: initial; position: absolute; inset: 0; z-index: 1; pointer-events: none;" : "all: initial; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;", !n.isConnected && !r.inline && document.body.appendChild(n);
|
|
132
|
+
const a = n.attachShadow({ mode: r.shadowMode ?? "closed" }), s = `
|
|
133
|
+
:host {
|
|
134
|
+
all: initial !important;
|
|
135
|
+
display: block !important;
|
|
136
|
+
color: #111827 !important;
|
|
137
|
+
font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif !important;
|
|
138
|
+
font-size: 16px !important;
|
|
139
|
+
font-weight: 400 !important;
|
|
140
|
+
font-style: normal !important;
|
|
141
|
+
line-height: 1.5 !important;
|
|
142
|
+
letter-spacing: normal !important;
|
|
143
|
+
text-transform: none !important;
|
|
144
|
+
text-decoration: none !important;
|
|
145
|
+
text-align: left !important;
|
|
146
|
+
direction: ltr !important;
|
|
147
|
+
cursor: auto !important;
|
|
148
|
+
visibility: visible !important;
|
|
149
|
+
}
|
|
150
|
+
`, o = document.createElement("style");
|
|
151
|
+
o.textContent = s + Me + (r.injectCss ?? ""), a.appendChild(o);
|
|
152
|
+
const c = document.createElement("div");
|
|
153
|
+
c.style.pointerEvents = "auto", a.appendChild(c);
|
|
154
|
+
let l = e;
|
|
155
|
+
return J(pe(t, l), c), {
|
|
156
|
+
shadowRoot: a,
|
|
157
|
+
update(p) {
|
|
158
|
+
l = { ...l, ...p }, J(pe(t, l), c);
|
|
159
|
+
},
|
|
160
|
+
unmount() {
|
|
161
|
+
J(null, c), n.remove();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const Qe = (t, e, r) => {
|
|
166
|
+
const n = t[e];
|
|
167
|
+
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((a, s) => {
|
|
168
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
169
|
+
s.bind(
|
|
170
|
+
null,
|
|
171
|
+
new Error(
|
|
172
|
+
"Unknown variable dynamic import: " + e + (e.split("/").length !== r ? ". Note that variables only represent file names one level deep." : "")
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
});
|
|
177
|
+
}, et = [
|
|
178
|
+
"ru",
|
|
179
|
+
"uk",
|
|
180
|
+
"de",
|
|
181
|
+
"es",
|
|
182
|
+
"fr",
|
|
183
|
+
"it",
|
|
184
|
+
"pt",
|
|
185
|
+
"pl",
|
|
186
|
+
"cs",
|
|
187
|
+
"hu",
|
|
188
|
+
"ro",
|
|
189
|
+
"nl",
|
|
190
|
+
"sv",
|
|
191
|
+
"da",
|
|
192
|
+
"no",
|
|
193
|
+
"fi",
|
|
194
|
+
"el",
|
|
195
|
+
"tr",
|
|
196
|
+
"id",
|
|
197
|
+
"ar",
|
|
198
|
+
"ja",
|
|
199
|
+
"ko",
|
|
200
|
+
"zh",
|
|
201
|
+
"hi",
|
|
202
|
+
"th",
|
|
203
|
+
"vi",
|
|
204
|
+
"he"
|
|
205
|
+
], Le = (t, e, r) => Pe(e, r), Te = qe({ t: Le, locale: "en" });
|
|
206
|
+
function Pe(t, e) {
|
|
207
|
+
if (!e) return t;
|
|
208
|
+
let r = t;
|
|
209
|
+
for (const [n, a] of Object.entries(e))
|
|
210
|
+
r = r.split(`{${n}}`).join(String(a));
|
|
211
|
+
return r;
|
|
212
|
+
}
|
|
213
|
+
const te = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Map();
|
|
214
|
+
function Ee(t) {
|
|
215
|
+
return et.includes(t);
|
|
216
|
+
}
|
|
217
|
+
function tt(t) {
|
|
218
|
+
const e = [];
|
|
219
|
+
if (typeof navigator < "u" && navigator.language) {
|
|
220
|
+
e.push(navigator.language);
|
|
221
|
+
const n = navigator.language.split("-")[0];
|
|
222
|
+
n && n !== navigator.language && e.push(n);
|
|
223
|
+
}
|
|
224
|
+
const r = t.settings.locale_default;
|
|
225
|
+
if (r) {
|
|
226
|
+
e.push(r);
|
|
227
|
+
const n = r.split("-")[0];
|
|
228
|
+
n && n !== r && e.push(n);
|
|
229
|
+
}
|
|
230
|
+
for (const n of e)
|
|
231
|
+
if (Ee(n)) return n;
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
function rt(t, e) {
|
|
235
|
+
return !!t.locales && t.locales[e] !== void 0;
|
|
236
|
+
}
|
|
237
|
+
async function it(t) {
|
|
238
|
+
const e = te.get(t);
|
|
239
|
+
if (e) return e;
|
|
240
|
+
const r = re.get(t);
|
|
241
|
+
if (r) return r;
|
|
242
|
+
const n = Qe(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./ar-ClwBmll7.js"), "./locales/cs.ts": () => import("./cs-Cc_D0W4S.js"), "./locales/da.ts": () => import("./da-BtKcMSxH.js"), "./locales/de.ts": () => import("./de-iwQW5eYl.js"), "./locales/el.ts": () => import("./el-BoH65CeJ.js"), "./locales/es.ts": () => import("./es-CkP16_8K.js"), "./locales/fi.ts": () => import("./fi-yUXSmK1E.js"), "./locales/fr.ts": () => import("./fr-DSZRGsxI.js"), "./locales/he.ts": () => import("./he-ZUo7cQjk.js"), "./locales/hi.ts": () => import("./hi-CEutBKiG.js"), "./locales/hu.ts": () => import("./hu-DvEAWGS7.js"), "./locales/id.ts": () => import("./id-_eEMrYMW.js"), "./locales/it.ts": () => import("./it-BAmsQbIl.js"), "./locales/ja.ts": () => import("./ja-BqCZWVKK.js"), "./locales/ko.ts": () => import("./ko-CkIzeOzb.js"), "./locales/nl.ts": () => import("./nl-Mu_KNzli.js"), "./locales/no.ts": () => import("./no-9HMjljBs.js"), "./locales/pl.ts": () => import("./pl-Cbr2qDwv.js"), "./locales/pt.ts": () => import("./pt-_jirA6IR.js"), "./locales/ro.ts": () => import("./ro-oZLxhwHc.js"), "./locales/ru.ts": () => import("./ru-C2-sqY7B.js"), "./locales/sv.ts": () => import("./sv-y385MWVy.js"), "./locales/th.ts": () => import("./th-Bjbv4M1s.js"), "./locales/tr.ts": () => import("./tr-DmHo9F8i.js"), "./locales/uk.ts": () => import("./uk-DwvAoTe5.js"), "./locales/vi.ts": () => import("./vi-BEpwsVLR.js"), "./locales/zh.ts": () => import("./zh-DrG18oGe.js") }), `./locales/${t}.ts`, 3).then((a) => {
|
|
243
|
+
const s = a.default ?? {};
|
|
244
|
+
return te.set(t, s), s;
|
|
245
|
+
}).catch((a) => {
|
|
246
|
+
console.warn(`[paywall] failed to load locale chunk "${t}"`, a);
|
|
247
|
+
const s = {};
|
|
248
|
+
return te.set(t, s), s;
|
|
249
|
+
}).finally(() => {
|
|
250
|
+
re.delete(t);
|
|
251
|
+
});
|
|
252
|
+
return re.set(t, n), n;
|
|
253
|
+
}
|
|
254
|
+
function nt({ bootstrap: t, forceLocale: e, children: r }) {
|
|
255
|
+
const [n, a] = v("en"), [s, o] = v(null);
|
|
256
|
+
j(() => {
|
|
257
|
+
const p = (e && Ee(e) ? e : null) ?? (() => {
|
|
258
|
+
if (!t) return null;
|
|
259
|
+
const f = tt(t);
|
|
260
|
+
return !f || !rt(t, f) ? null : f;
|
|
261
|
+
})();
|
|
262
|
+
if (!p) {
|
|
263
|
+
(s !== null || n !== "en") && (a("en"), o(null));
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (p === n && s) return;
|
|
267
|
+
let u = !1;
|
|
268
|
+
return it(p).then((f) => {
|
|
269
|
+
u || (a(p), o(f));
|
|
270
|
+
}), () => {
|
|
271
|
+
u = !0;
|
|
272
|
+
};
|
|
273
|
+
}, [t, e]);
|
|
274
|
+
const c = {
|
|
275
|
+
locale: n,
|
|
276
|
+
t: s ? (l, p, u) => Pe(s[l] ?? p, u) : Le
|
|
277
|
+
};
|
|
278
|
+
return /* @__PURE__ */ i(Te.Provider, { value: c, children: r });
|
|
279
|
+
}
|
|
280
|
+
function S() {
|
|
281
|
+
return Ge(Te);
|
|
282
|
+
}
|
|
283
|
+
const me = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
284
|
+
function at({
|
|
285
|
+
open: t,
|
|
286
|
+
onClose: e,
|
|
287
|
+
labelledBy: r,
|
|
288
|
+
brandColor: n,
|
|
289
|
+
topBanner: a,
|
|
290
|
+
allowClose: s = !0,
|
|
291
|
+
hideCloseButton: o = !1,
|
|
292
|
+
inline: c = !1,
|
|
293
|
+
children: l
|
|
294
|
+
}) {
|
|
295
|
+
const { t: p } = S(), u = O(null), f = O(null);
|
|
296
|
+
return j(() => {
|
|
297
|
+
if (!t) return;
|
|
298
|
+
f.current = document.activeElement ?? null;
|
|
299
|
+
const m = u.current;
|
|
300
|
+
m && (m.querySelector(me) ?? m).focus({ preventScroll: !0 });
|
|
301
|
+
const A = (w) => {
|
|
302
|
+
if (w.key === "Escape") {
|
|
303
|
+
if (!s) return;
|
|
304
|
+
w.stopPropagation(), e();
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (w.key !== "Tab" || !u.current) return;
|
|
308
|
+
const C = Array.from(
|
|
309
|
+
u.current.querySelectorAll(me)
|
|
310
|
+
).filter((F) => !F.hasAttribute("disabled") && F.tabIndex !== -1);
|
|
311
|
+
if (C.length === 0) {
|
|
312
|
+
w.preventDefault();
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const I = C[0], z = C[C.length - 1], M = document.activeElement;
|
|
316
|
+
w.shiftKey && M === I ? (w.preventDefault(), z.focus()) : !w.shiftKey && M === z && (w.preventDefault(), I.focus());
|
|
317
|
+
};
|
|
318
|
+
document.addEventListener("keydown", A, !0);
|
|
319
|
+
const b = document.body.style.overflow;
|
|
320
|
+
return c || (document.body.style.overflow = "hidden"), () => {
|
|
321
|
+
document.removeEventListener("keydown", A, !0), c || (document.body.style.overflow = b), f.current?.focus?.({ preventScroll: !0 });
|
|
322
|
+
};
|
|
323
|
+
}, [t, e, s, c]), t ? /* @__PURE__ */ d(
|
|
324
|
+
"div",
|
|
325
|
+
{
|
|
326
|
+
class: `${c ? "absolute z-[1]" : "fixed z-[2147483647]"} inset-0 flex items-center justify-center bg-slate-950/50 p-2 sm:p-4 backdrop-blur-md animate-[pw-fade-in_180ms_ease-out]`,
|
|
327
|
+
onClick: (m) => {
|
|
328
|
+
s && m.target === m.currentTarget && e();
|
|
329
|
+
},
|
|
330
|
+
"data-pw-root": !0,
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ d(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
class: "relative flex w-full max-w-[400px] flex-col animate-[pw-scale-in_220ms_cubic-bezier(0.16,1,0.3,1)]",
|
|
336
|
+
style: { "--pw-accent": n ?? "#3b82f6" },
|
|
337
|
+
children: [
|
|
338
|
+
a,
|
|
339
|
+
/* @__PURE__ */ d(
|
|
340
|
+
"div",
|
|
341
|
+
{
|
|
342
|
+
ref: u,
|
|
343
|
+
role: "dialog",
|
|
344
|
+
"aria-modal": "true",
|
|
345
|
+
"aria-labelledby": r,
|
|
346
|
+
tabIndex: -1,
|
|
347
|
+
class: "relative flex max-h-[calc(100dvh-1rem)] sm:max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-xl bg-white outline-none",
|
|
348
|
+
style: {
|
|
349
|
+
boxShadow: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
|
|
350
|
+
},
|
|
351
|
+
children: [
|
|
352
|
+
l,
|
|
353
|
+
s && !o ? /* @__PURE__ */ i(
|
|
354
|
+
"button",
|
|
355
|
+
{
|
|
356
|
+
type: "button",
|
|
357
|
+
onClick: e,
|
|
358
|
+
"aria-label": p("modal.close_aria", "Close"),
|
|
359
|
+
class: "absolute right-3 top-3 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white/80 text-gray-500 backdrop-blur-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
360
|
+
children: /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ i(
|
|
361
|
+
"path",
|
|
362
|
+
{
|
|
363
|
+
d: "M3 3l10 10M13 3L3 13",
|
|
364
|
+
stroke: "currentColor",
|
|
365
|
+
"stroke-width": "1.75",
|
|
366
|
+
"stroke-linecap": "round"
|
|
367
|
+
}
|
|
368
|
+
) })
|
|
369
|
+
}
|
|
370
|
+
) : null
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
/* @__PURE__ */ i("style", { children: `
|
|
378
|
+
@keyframes pw-fade-in { from { opacity: 0 } to { opacity: 1 } }
|
|
379
|
+
@keyframes pw-scale-in {
|
|
380
|
+
from { opacity: 0; transform: translateY(12px) scale(0.96) }
|
|
381
|
+
to { opacity: 1; transform: none }
|
|
382
|
+
}
|
|
383
|
+
` })
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
) : null;
|
|
387
|
+
}
|
|
388
|
+
function ot(t, e) {
|
|
389
|
+
switch (t) {
|
|
390
|
+
case "google":
|
|
391
|
+
return e("auth.continue_with_google", "Continue with Google");
|
|
392
|
+
case "apple":
|
|
393
|
+
return e("auth.continue_with_apple", "Continue with Apple");
|
|
394
|
+
case "github":
|
|
395
|
+
return e("auth.continue_with_github", "Continue with GitHub");
|
|
396
|
+
case "facebook":
|
|
397
|
+
return e("auth.continue_with_facebook", "Continue with Facebook");
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function we(t, e, r) {
|
|
401
|
+
const n = e === "signup" ? r("auth.signup_failed", "Sign-up failed") : r("auth.signin_failed", "Sign-in failed");
|
|
402
|
+
if (!(t instanceof L)) return n;
|
|
403
|
+
switch (t.code) {
|
|
404
|
+
case "invalid_credentials":
|
|
405
|
+
return r("auth.invalid_credentials", "Invalid email or password");
|
|
406
|
+
case "email_not_confirmed":
|
|
407
|
+
return r("auth.email_not_confirmed", "Please confirm your email before signing in.");
|
|
408
|
+
case "email_exists":
|
|
409
|
+
case "user_already_exists":
|
|
410
|
+
return r("auth.email_exists", "An account with this email already exists.");
|
|
411
|
+
case "weak_password":
|
|
412
|
+
return r("auth.weak_password", "Password is too weak.");
|
|
413
|
+
case "invalid_otp":
|
|
414
|
+
case "otp_expired":
|
|
415
|
+
case "token_expired":
|
|
416
|
+
return r("auth.invalid_otp", "The code is invalid or has expired.");
|
|
417
|
+
case "over_email_send_rate_limit":
|
|
418
|
+
case "over_request_rate_limit":
|
|
419
|
+
case "rate_limited":
|
|
420
|
+
case "http_429":
|
|
421
|
+
return r("auth.rate_limited", "Too many requests. Please try again later.");
|
|
422
|
+
case "network_error":
|
|
423
|
+
return r("auth.network_error", "Network error. Please check your connection and try again.");
|
|
424
|
+
case "upstream":
|
|
425
|
+
case "upstream_error":
|
|
426
|
+
case "http_502":
|
|
427
|
+
case "http_503":
|
|
428
|
+
case "http_504":
|
|
429
|
+
return r("auth.service_unavailable", "Service is temporarily unavailable. Please try again.");
|
|
430
|
+
default:
|
|
431
|
+
return n;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function je({ block: t, ctx: e }) {
|
|
435
|
+
const r = e.auth, n = e.authSession, a = t.allow_signup !== !1, s = t.allow_password_reset !== !1, o = t.hide_when_authenticated !== !1;
|
|
436
|
+
if (!r)
|
|
437
|
+
return typeof console < "u" && console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"), null;
|
|
438
|
+
const c = n && !n.user.is_anonymous ? n : null;
|
|
439
|
+
return c && o ? null : c ? /* @__PURE__ */ i(st, { email: c.user.email ?? "", onSignOut: () => r.signOut().catch(() => {
|
|
440
|
+
}) }) : /* @__PURE__ */ i(
|
|
441
|
+
lt,
|
|
442
|
+
{
|
|
443
|
+
block: t,
|
|
444
|
+
allowSignup: a,
|
|
445
|
+
allowReset: s,
|
|
446
|
+
ctx: e
|
|
447
|
+
}
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
function st({ email: t, onSignOut: e }) {
|
|
451
|
+
const { t: r } = S();
|
|
452
|
+
return /* @__PURE__ */ d("div", { class: "flex items-center justify-between gap-3 rounded-2xl bg-gray-100 px-4 py-3", children: [
|
|
453
|
+
/* @__PURE__ */ d("div", { class: "flex flex-col", children: [
|
|
454
|
+
/* @__PURE__ */ i("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: r("auth.signed_in", "Signed in") }),
|
|
455
|
+
/* @__PURE__ */ i("span", { class: "text-sm font-medium text-gray-900", children: t })
|
|
456
|
+
] }),
|
|
457
|
+
/* @__PURE__ */ i(
|
|
458
|
+
"button",
|
|
459
|
+
{
|
|
460
|
+
type: "button",
|
|
461
|
+
onClick: e,
|
|
462
|
+
class: "rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-600 transition-colors hover:bg-white hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
463
|
+
children: r("auth.sign_out", "Sign out")
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
] });
|
|
467
|
+
}
|
|
468
|
+
function lt({ block: t, allowSignup: e, allowReset: r, ctx: n }) {
|
|
469
|
+
const { t: a } = S(), s = n.auth, o = t.providers ?? [], c = n.initialAuthMode === "signup" && e ? "signup" : "signin", [l, p] = v(c), [u, f] = v(""), [_, h] = v(""), [k, m] = v(""), [A, b] = v(""), [w, C] = v(null), I = O(!1), [z, M] = v(null), [F, D] = v(null), [R, P] = v(!1), [T, U] = v(null);
|
|
470
|
+
j(() => {
|
|
471
|
+
if (typeof s.getLastLogin != "function") return;
|
|
472
|
+
let g = !1;
|
|
473
|
+
return s.getLastLogin().then(
|
|
474
|
+
(y) => {
|
|
475
|
+
g || !y || (U(y), y.email && f((E) => E === "" ? y.email : E));
|
|
476
|
+
},
|
|
477
|
+
() => {
|
|
478
|
+
}
|
|
479
|
+
), () => {
|
|
480
|
+
g = !0;
|
|
481
|
+
};
|
|
482
|
+
}, [s]);
|
|
483
|
+
const B = (g) => {
|
|
484
|
+
p(g), M(null), D(null), P(!1);
|
|
485
|
+
}, K = async (g) => {
|
|
486
|
+
if (g.preventDefault(), !(I.current || w)) {
|
|
487
|
+
I.current = !0;
|
|
488
|
+
try {
|
|
489
|
+
if (M(null), D(null), l === "signup" && !R) {
|
|
490
|
+
if (!u.trim()) return;
|
|
491
|
+
P(!0);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
if (l === "signup" && _ !== k) {
|
|
495
|
+
M(a("auth.passwords_mismatch", "Passwords don't match"));
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
C("email");
|
|
499
|
+
try {
|
|
500
|
+
l === "signin" ? await s.signInWithEmail({ email: u, password: _ }) : l === "signup" ? (await s.signUp({ email: u, password: _ })).kind === "confirmation_required" && (h(""), p("signup_sent")) : l === "forgot" ? (await s.requestPasswordReset({ email: u }), p("reset_sent")) : l === "reset_verify" && (await s.verifyOtp({
|
|
501
|
+
email: u,
|
|
502
|
+
token: A,
|
|
503
|
+
type: _ ? "recovery" : "email"
|
|
504
|
+
}), _ && await s.updatePassword({ password: _ }));
|
|
505
|
+
} catch (y) {
|
|
506
|
+
M(we(y, l === "signup" ? "signup" : l === "reset_verify" ? "otp" : l === "forgot" ? "reset" : "signin", a));
|
|
507
|
+
} finally {
|
|
508
|
+
C(null);
|
|
509
|
+
}
|
|
510
|
+
} finally {
|
|
511
|
+
I.current = !1;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}, q = async (g) => {
|
|
515
|
+
if (!(I.current || w)) {
|
|
516
|
+
I.current = !0, C(g), M(null), D(null);
|
|
517
|
+
try {
|
|
518
|
+
await s.signInWithOAuth({
|
|
519
|
+
provider: g,
|
|
520
|
+
onPopupOpened: () => C(null)
|
|
521
|
+
});
|
|
522
|
+
} catch (y) {
|
|
523
|
+
if (y instanceof L && (y.code === "oauth_cancelled" || y.code === "oauth_timeout"))
|
|
524
|
+
return;
|
|
525
|
+
M(we(y, "signin", a));
|
|
526
|
+
} finally {
|
|
527
|
+
I.current = !1, C(null);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}, Y = o.length > 0 && (l === "signin" || l === "signup"), X = l === "signin" || l === "signup" || l === "forgot", x = l === "signin" || l === "signup" && R;
|
|
531
|
+
return l === "reset_sent" ? /* @__PURE__ */ i(vt, { email: u, onBack: () => B("signin"), t: a }) : l === "signup_sent" ? /* @__PURE__ */ i(yt, { email: u, onBack: () => B("signin"), t: a }) : /* @__PURE__ */ d("div", { class: "flex flex-col gap-5", children: [
|
|
532
|
+
/* @__PURE__ */ i(ct, { mode: l, customHeading: t.heading, customSubheading: t.subheading }),
|
|
533
|
+
Y ? /* @__PURE__ */ d("div", { class: "flex flex-col gap-2.5", children: [
|
|
534
|
+
o.map((g) => /* @__PURE__ */ d("div", { class: "relative", children: [
|
|
535
|
+
/* @__PURE__ */ d(
|
|
536
|
+
"button",
|
|
537
|
+
{
|
|
538
|
+
type: "button",
|
|
539
|
+
onClick: () => q(g),
|
|
540
|
+
disabled: w !== null,
|
|
541
|
+
class: "flex h-12 w-full items-center justify-center gap-2.5 rounded-full border-1 border-gray-200 bg-white px-5 text-base font-medium text-gray-900 transition-all hover:border-gray-300 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
542
|
+
children: [
|
|
543
|
+
w === g ? /* @__PURE__ */ i("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" }) : /* @__PURE__ */ i(xt, { provider: g }),
|
|
544
|
+
/* @__PURE__ */ i("span", { children: ot(g, a) })
|
|
545
|
+
]
|
|
546
|
+
}
|
|
547
|
+
),
|
|
548
|
+
T?.method === g ? /* @__PURE__ */ i(mt, { email: T.email }) : null
|
|
549
|
+
] }, g)),
|
|
550
|
+
/* @__PURE__ */ i(bt, {})
|
|
551
|
+
] }) : null,
|
|
552
|
+
/* @__PURE__ */ d("form", { onSubmit: K, class: "flex flex-col gap-3", children: [
|
|
553
|
+
X && /* @__PURE__ */ i(
|
|
554
|
+
be,
|
|
555
|
+
{
|
|
556
|
+
type: "email",
|
|
557
|
+
placeholder: a("auth.email", "Email address"),
|
|
558
|
+
value: u,
|
|
559
|
+
onInput: f,
|
|
560
|
+
autocomplete: "email",
|
|
561
|
+
required: !0
|
|
562
|
+
}
|
|
563
|
+
),
|
|
564
|
+
x && /* @__PURE__ */ i(
|
|
565
|
+
ie,
|
|
566
|
+
{
|
|
567
|
+
placeholder: a("auth.password", "Password"),
|
|
568
|
+
value: _,
|
|
569
|
+
onInput: h,
|
|
570
|
+
autocomplete: l === "signin" ? "current-password" : "new-password",
|
|
571
|
+
required: !0
|
|
572
|
+
}
|
|
573
|
+
),
|
|
574
|
+
l === "signup" && R && /* @__PURE__ */ i(
|
|
575
|
+
ie,
|
|
576
|
+
{
|
|
577
|
+
placeholder: a("auth.repeat_password", "Repeat password"),
|
|
578
|
+
value: k,
|
|
579
|
+
onInput: m,
|
|
580
|
+
autocomplete: "new-password",
|
|
581
|
+
required: !0
|
|
582
|
+
}
|
|
583
|
+
),
|
|
584
|
+
l === "reset_verify" && /* @__PURE__ */ i(
|
|
585
|
+
be,
|
|
586
|
+
{
|
|
587
|
+
type: "text",
|
|
588
|
+
placeholder: a("auth.confirmation_code", "Confirmation code"),
|
|
589
|
+
value: A,
|
|
590
|
+
onInput: b,
|
|
591
|
+
autocomplete: "one-time-code",
|
|
592
|
+
inputMode: "numeric",
|
|
593
|
+
required: !0
|
|
594
|
+
}
|
|
595
|
+
),
|
|
596
|
+
l === "reset_verify" && /* @__PURE__ */ i(
|
|
597
|
+
ie,
|
|
598
|
+
{
|
|
599
|
+
placeholder: a(
|
|
600
|
+
"auth.new_password_optional",
|
|
601
|
+
"New password (optional — only for password reset)"
|
|
602
|
+
),
|
|
603
|
+
value: _,
|
|
604
|
+
onInput: h,
|
|
605
|
+
autocomplete: "new-password"
|
|
606
|
+
}
|
|
607
|
+
),
|
|
608
|
+
l === "signin" && r && /* @__PURE__ */ i("div", { class: "flex justify-end text-sm", children: /* @__PURE__ */ i(Z, { onClick: () => B("forgot"), children: a("auth.forgot_password", "Forgot password?") }) }),
|
|
609
|
+
z && /* @__PURE__ */ i("p", { class: "text-sm text-red-600", children: z }),
|
|
610
|
+
F && /* @__PURE__ */ i("p", { class: "text-sm text-gray-500", children: F }),
|
|
611
|
+
/* @__PURE__ */ i(
|
|
612
|
+
ht,
|
|
613
|
+
{
|
|
614
|
+
busy: w === "email",
|
|
615
|
+
label: ut(l, R, t.submit_label ?? t.heading, a)
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
] }),
|
|
619
|
+
/* @__PURE__ */ i(
|
|
620
|
+
pt,
|
|
621
|
+
{
|
|
622
|
+
mode: l,
|
|
623
|
+
allowSignup: e,
|
|
624
|
+
onSwitch: B
|
|
625
|
+
}
|
|
626
|
+
)
|
|
627
|
+
] });
|
|
628
|
+
}
|
|
629
|
+
function ct({
|
|
630
|
+
mode: t,
|
|
631
|
+
customHeading: e,
|
|
632
|
+
customSubheading: r
|
|
633
|
+
}) {
|
|
634
|
+
const { t: n } = S(), a = dt(t, n), s = t === "signin" || t === "signup", o = s && e ? e : a.title, c = s && r !== void 0 ? r || null : a.subtitle;
|
|
635
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col gap-2", children: [
|
|
636
|
+
/* @__PURE__ */ i("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: o }),
|
|
637
|
+
c ? /* @__PURE__ */ i("p", { class: "text-base leading-relaxed text-gray-600", children: c }) : null
|
|
638
|
+
] });
|
|
639
|
+
}
|
|
640
|
+
function dt(t, e) {
|
|
641
|
+
switch (t) {
|
|
642
|
+
case "signin":
|
|
643
|
+
return {
|
|
644
|
+
title: e("auth.welcome", "Welcome back!"),
|
|
645
|
+
subtitle: e("auth.default_subtitle", "Sign in to access all features and sync your data.")
|
|
646
|
+
};
|
|
647
|
+
case "signup":
|
|
648
|
+
return {
|
|
649
|
+
title: e("auth.welcome_signup", "Welcome!"),
|
|
650
|
+
subtitle: e("auth.default_subtitle", "Sign in to access all features and sync your data.")
|
|
651
|
+
};
|
|
652
|
+
case "forgot":
|
|
653
|
+
return {
|
|
654
|
+
title: e("auth.forgot_password_title", "Forgot password?"),
|
|
655
|
+
subtitle: e(
|
|
656
|
+
"auth.forgot_subtitle",
|
|
657
|
+
"Enter your email and we'll send you a password reset link."
|
|
658
|
+
)
|
|
659
|
+
};
|
|
660
|
+
case "reset_sent":
|
|
661
|
+
case "signup_sent":
|
|
662
|
+
return {
|
|
663
|
+
title: e("auth.check_email_title", "Check your email"),
|
|
664
|
+
subtitle: null
|
|
665
|
+
};
|
|
666
|
+
case "reset_verify":
|
|
667
|
+
return {
|
|
668
|
+
title: e("auth.reset_password_title", "Reset password"),
|
|
669
|
+
subtitle: e(
|
|
670
|
+
"auth.reset_password_subtitle",
|
|
671
|
+
"Enter the code from your email and a new password."
|
|
672
|
+
)
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
function ut(t, e, r, n) {
|
|
677
|
+
if (t === "signin" && r) return r;
|
|
678
|
+
switch (t) {
|
|
679
|
+
case "signin":
|
|
680
|
+
return n("auth.log_in", "Sign In");
|
|
681
|
+
case "signup":
|
|
682
|
+
return e ? n("auth.create_account", "Create Account") : n("auth.sign_up", "Sign Up");
|
|
683
|
+
case "forgot":
|
|
684
|
+
return n("auth.send_reset", "Send Reset Email");
|
|
685
|
+
case "reset_verify":
|
|
686
|
+
return n("auth.verify", "Verify");
|
|
687
|
+
default:
|
|
688
|
+
return n("cta.continue", "Continue");
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
function pt({
|
|
692
|
+
mode: t,
|
|
693
|
+
allowSignup: e,
|
|
694
|
+
onSwitch: r
|
|
695
|
+
}) {
|
|
696
|
+
const { t: n } = S();
|
|
697
|
+
return t === "signin" && e ? /* @__PURE__ */ d("p", { class: "text-center text-sm text-gray-600", children: [
|
|
698
|
+
n("auth.no_account", "Don't have an account?"),
|
|
699
|
+
" ",
|
|
700
|
+
/* @__PURE__ */ i(Z, { onClick: () => r("signup"), children: n("auth.sign_up_link", "Sign Up") })
|
|
701
|
+
] }) : t === "signup" ? /* @__PURE__ */ d("p", { class: "text-center text-sm text-gray-600", children: [
|
|
702
|
+
n("auth.have_account", "Already have an account?"),
|
|
703
|
+
" ",
|
|
704
|
+
/* @__PURE__ */ i(Z, { onClick: () => r("signin"), children: n("auth.log_in_link", "Log In") })
|
|
705
|
+
] }) : t === "forgot" || t === "reset_sent" || t === "reset_verify" ? /* @__PURE__ */ d("p", { class: "text-center text-sm text-gray-600", children: [
|
|
706
|
+
n("auth.no_account", "Don't have an account?"),
|
|
707
|
+
" ",
|
|
708
|
+
/* @__PURE__ */ i(Z, { onClick: () => r("signup"), children: n("auth.sign_up_link", "Sign Up") })
|
|
709
|
+
] }) : null;
|
|
710
|
+
}
|
|
711
|
+
function Z({
|
|
712
|
+
onClick: t,
|
|
713
|
+
children: e
|
|
714
|
+
}) {
|
|
715
|
+
return /* @__PURE__ */ i(
|
|
716
|
+
"button",
|
|
717
|
+
{
|
|
718
|
+
type: "button",
|
|
719
|
+
onClick: t,
|
|
720
|
+
class: "font-semibold transition-opacity hover:opacity-80 focus:outline-none focus-visible:opacity-80",
|
|
721
|
+
style: { color: "var(--pw-accent)" },
|
|
722
|
+
children: e
|
|
723
|
+
}
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
function ht({ busy: t, label: e }) {
|
|
727
|
+
return /* @__PURE__ */ i(
|
|
728
|
+
"button",
|
|
729
|
+
{
|
|
730
|
+
type: "submit",
|
|
731
|
+
disabled: t,
|
|
732
|
+
class: "pw-cta-shimmer relative mt-1 flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
733
|
+
style: {
|
|
734
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
|
|
735
|
+
boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
|
|
736
|
+
},
|
|
737
|
+
children: t ? /* @__PURE__ */ i("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ i("span", { class: "relative z-10", children: e })
|
|
738
|
+
}
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
function be({ type: t, placeholder: e, value: r, onInput: n, autocomplete: a, inputMode: s, required: o }) {
|
|
742
|
+
return /* @__PURE__ */ i(
|
|
743
|
+
"input",
|
|
744
|
+
{
|
|
745
|
+
type: t,
|
|
746
|
+
value: r,
|
|
747
|
+
placeholder: e,
|
|
748
|
+
onInput: (c) => n(c.target.value),
|
|
749
|
+
autocomplete: a,
|
|
750
|
+
inputMode: s,
|
|
751
|
+
required: o,
|
|
752
|
+
class: "h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
function ie({ placeholder: t, value: e, onInput: r, autocomplete: n, required: a }) {
|
|
757
|
+
const { t: s } = S(), [o, c] = v(!1), l = O(null);
|
|
758
|
+
j(() => {
|
|
759
|
+
const f = l.current;
|
|
760
|
+
f && f.value !== e && (f.value = e);
|
|
761
|
+
}, [o, e]);
|
|
762
|
+
const p = s("auth.show_password", "Show password"), u = s("auth.hide_password", "Hide password");
|
|
763
|
+
return /* @__PURE__ */ d("div", { class: "relative", children: [
|
|
764
|
+
/* @__PURE__ */ i(
|
|
765
|
+
"input",
|
|
766
|
+
{
|
|
767
|
+
ref: l,
|
|
768
|
+
type: o ? "text" : "password",
|
|
769
|
+
value: e,
|
|
770
|
+
placeholder: t,
|
|
771
|
+
onInput: (f) => r(f.target.value),
|
|
772
|
+
autocomplete: n,
|
|
773
|
+
required: a,
|
|
774
|
+
class: "h-14 w-full rounded-2xl bg-gray-100 pl-5 pr-12 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"
|
|
775
|
+
}
|
|
776
|
+
),
|
|
777
|
+
/* @__PURE__ */ i(
|
|
778
|
+
"button",
|
|
779
|
+
{
|
|
780
|
+
type: "button",
|
|
781
|
+
onClick: () => c((f) => !f),
|
|
782
|
+
"aria-label": o ? u : p,
|
|
783
|
+
tabIndex: -1,
|
|
784
|
+
class: "absolute right-4 top-1/2 -translate-y-1/2 flex h-6 w-6 items-center justify-center rounded text-gray-500 transition-colors hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
785
|
+
children: o ? /* @__PURE__ */ i(ft, {}) : /* @__PURE__ */ i(gt, {})
|
|
786
|
+
}
|
|
787
|
+
)
|
|
788
|
+
] });
|
|
789
|
+
}
|
|
790
|
+
function gt() {
|
|
791
|
+
return /* @__PURE__ */ d("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
792
|
+
/* @__PURE__ */ i(
|
|
793
|
+
"path",
|
|
794
|
+
{
|
|
795
|
+
d: "M1.667 10S4.583 4.167 10 4.167 18.333 10 18.333 10 15.417 15.833 10 15.833 1.667 10 1.667 10Z",
|
|
796
|
+
stroke: "currentColor",
|
|
797
|
+
"stroke-width": "1.5",
|
|
798
|
+
"stroke-linecap": "round",
|
|
799
|
+
"stroke-linejoin": "round"
|
|
800
|
+
}
|
|
801
|
+
),
|
|
802
|
+
/* @__PURE__ */ i("circle", { cx: "10", cy: "10", r: "2.5", stroke: "currentColor", "stroke-width": "1.5" })
|
|
803
|
+
] });
|
|
804
|
+
}
|
|
805
|
+
function ft() {
|
|
806
|
+
return /* @__PURE__ */ d("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
807
|
+
/* @__PURE__ */ i(
|
|
808
|
+
"path",
|
|
809
|
+
{
|
|
810
|
+
d: "M8.236 4.293A6.96 6.96 0 0 1 10 4.167C15.417 4.167 18.333 10 18.333 10a13.5 13.5 0 0 1-1.92 2.755M11.768 11.768A2.5 2.5 0 0 1 8.233 8.233",
|
|
811
|
+
stroke: "currentColor",
|
|
812
|
+
"stroke-width": "1.5",
|
|
813
|
+
"stroke-linecap": "round",
|
|
814
|
+
"stroke-linejoin": "round"
|
|
815
|
+
}
|
|
816
|
+
),
|
|
817
|
+
/* @__PURE__ */ i(
|
|
818
|
+
"path",
|
|
819
|
+
{
|
|
820
|
+
d: "M14.953 14.953A8.84 8.84 0 0 1 10 15.833C4.583 15.833 1.667 10 1.667 10a13.5 13.5 0 0 1 3.38-3.953M1.667 1.667l16.666 16.666",
|
|
821
|
+
stroke: "currentColor",
|
|
822
|
+
"stroke-width": "1.5",
|
|
823
|
+
"stroke-linecap": "round",
|
|
824
|
+
"stroke-linejoin": "round"
|
|
825
|
+
}
|
|
826
|
+
)
|
|
827
|
+
] });
|
|
828
|
+
}
|
|
829
|
+
function mt({ email: t }) {
|
|
830
|
+
const { t: e } = S(), r = t ? e("auth.last_used", "Last · {email}", { email: wt(t) }) : e("auth.last_used_no_email", "Last");
|
|
831
|
+
return /* @__PURE__ */ i("span", { class: "pointer-events-none absolute -top-2 right-3 max-w-[75%] truncate rounded-full bg-gray-900 px-2 py-0.5 text-[10px] font-semibold tracking-wide text-white shadow-sm", children: r });
|
|
832
|
+
}
|
|
833
|
+
function wt(t) {
|
|
834
|
+
const [e, r] = t.split("@");
|
|
835
|
+
return r ? `${e.slice(0, 3)}*****@${r}` : t;
|
|
836
|
+
}
|
|
837
|
+
function bt() {
|
|
838
|
+
const { t } = S();
|
|
839
|
+
return /* @__PURE__ */ d("div", { class: "flex items-center gap-3 py-1 text-sm text-gray-400", children: [
|
|
840
|
+
/* @__PURE__ */ i("div", { class: "h-px flex-1 bg-gray-200" }),
|
|
841
|
+
/* @__PURE__ */ i("span", { children: t("auth.or", "or") }),
|
|
842
|
+
/* @__PURE__ */ i("div", { class: "h-px flex-1 bg-gray-200" })
|
|
843
|
+
] });
|
|
844
|
+
}
|
|
845
|
+
function xt({ provider: t }) {
|
|
846
|
+
return t === "google" ? /* @__PURE__ */ d("svg", { width: "20", height: "20", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
|
|
847
|
+
/* @__PURE__ */ i("path", { fill: "#4285F4", d: "M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.49h4.84a4.14 4.14 0 0 1-1.79 2.71v2.26h2.9c1.7-1.56 2.69-3.87 2.69-6.62Z" }),
|
|
848
|
+
/* @__PURE__ */ i("path", { fill: "#34A853", d: "M9 18c2.43 0 4.47-.8 5.96-2.18l-2.9-2.26c-.8.54-1.83.86-3.06.86-2.36 0-4.36-1.59-5.07-3.74H.92v2.33A9 9 0 0 0 9 18Z" }),
|
|
849
|
+
/* @__PURE__ */ i("path", { fill: "#FBBC05", d: "M3.93 10.68a5.4 5.4 0 0 1 0-3.36V4.99H.92a9 9 0 0 0 0 8.02l3-2.33Z" }),
|
|
850
|
+
/* @__PURE__ */ i("path", { fill: "#EA4335", d: "M9 3.58c1.32 0 2.5.45 3.44 1.34l2.58-2.58A9 9 0 0 0 .92 4.99l3.01 2.33C4.64 5.17 6.64 3.58 9 3.58Z" })
|
|
851
|
+
] }) : t === "apple" ? (
|
|
852
|
+
// viewBox 0 0 24 24 даёт воздух сверху/снизу пути, поэтому визуально
|
|
853
|
+
// Apple-яблоко выглядит меньше Google. Компенсируем увеличенным
|
|
854
|
+
// width/height — 26×26 даёт примерно equal optical size с Google 20×20.
|
|
855
|
+
/* @__PURE__ */ i("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ i("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) })
|
|
856
|
+
) : t === "github" ? /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ i("path", { d: "M8 0C3.6 0 0 3.6 0 8a8 8 0 0 0 5.5 7.6c.4.1.5-.2.5-.4v-1.5c-2.2.5-2.7-1-2.7-1-.4-.9-.9-1.2-.9-1.2-.7-.5.1-.5.1-.5.8.1 1.2.8 1.2.8.7 1.2 1.9.9 2.4.7 0-.5.3-.9.5-1.1-1.8-.2-3.6-.9-3.6-4 0-.9.3-1.6.8-2.1-.1-.2-.4-1 .1-2.1 0 0 .7-.2 2.2.8a7.6 7.6 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.4 1.1.2 1.9.1 2.1.5.5.8 1.2.8 2.1 0 3.1-1.9 3.7-3.6 3.9.3.3.6.8.6 1.6V15c0 .2.1.5.6.4A8 8 0 0 0 16 8c0-4.4-3.6-8-8-8Z" }) }) : /* @__PURE__ */ i("svg", { width: "18", height: "20", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ i("path", { d: "M14 2.7C14 1.2 12.8 0 11.3 0H2.7C1.2 0 0 1.2 0 2.7v10.6C0 14.8 1.2 16 2.7 16h4V9.8H4.7v-2H6.7V6.4c0-2 1.2-3.1 3-3.1.9 0 1.7.1 2 .2V5h-1.4c-.8 0-1 .4-1 1v1.5h2.4l-.3 2H9.3V16h2c1.5 0 2.7-1.2 2.7-2.7V2.7Z" }) });
|
|
857
|
+
}
|
|
858
|
+
function yt({
|
|
859
|
+
email: t,
|
|
860
|
+
onBack: e,
|
|
861
|
+
t: r
|
|
862
|
+
}) {
|
|
863
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-4 py-2 text-center", children: [
|
|
864
|
+
/* @__PURE__ */ i(
|
|
865
|
+
"div",
|
|
866
|
+
{
|
|
867
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
868
|
+
style: {
|
|
869
|
+
background: "linear-gradient(135deg, #4ade80, #16a34a)",
|
|
870
|
+
color: "#fff",
|
|
871
|
+
boxShadow: "0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"
|
|
872
|
+
},
|
|
873
|
+
"aria-hidden": "true",
|
|
874
|
+
children: /* @__PURE__ */ i("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ i(
|
|
875
|
+
"path",
|
|
876
|
+
{
|
|
877
|
+
d: "M5 13l4 4L19 7",
|
|
878
|
+
stroke: "currentColor",
|
|
879
|
+
"stroke-width": "2.5",
|
|
880
|
+
"stroke-linecap": "round",
|
|
881
|
+
"stroke-linejoin": "round"
|
|
882
|
+
}
|
|
883
|
+
) })
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ i("h2", { class: "mt-1 text-3xl font-bold tracking-tight text-gray-900", children: r("auth.check_email_title", "Check your email") }),
|
|
887
|
+
/* @__PURE__ */ i("p", { class: "text-base leading-relaxed text-gray-600", children: r(
|
|
888
|
+
"auth.signup_sent_subtitle",
|
|
889
|
+
"We sent a confirmation link to your email. Click it to activate your account, then sign in."
|
|
890
|
+
) }),
|
|
891
|
+
t ? /* @__PURE__ */ i("p", { class: "break-all text-base font-semibold text-gray-900", children: t }) : null,
|
|
892
|
+
/* @__PURE__ */ i(
|
|
893
|
+
"button",
|
|
894
|
+
{
|
|
895
|
+
type: "button",
|
|
896
|
+
onClick: e,
|
|
897
|
+
class: "pw-cta-shimmer relative mt-2 flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
898
|
+
style: {
|
|
899
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
|
|
900
|
+
boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
|
|
901
|
+
},
|
|
902
|
+
children: /* @__PURE__ */ i("span", { class: "relative z-10", children: r("auth.back_to_login", "Back to Login") })
|
|
903
|
+
}
|
|
904
|
+
)
|
|
905
|
+
] });
|
|
906
|
+
}
|
|
907
|
+
function vt({
|
|
908
|
+
email: t,
|
|
909
|
+
onBack: e,
|
|
910
|
+
t: r
|
|
911
|
+
}) {
|
|
912
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-4 py-2 text-center", children: [
|
|
913
|
+
/* @__PURE__ */ i(
|
|
914
|
+
"div",
|
|
915
|
+
{
|
|
916
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
917
|
+
style: {
|
|
918
|
+
background: "linear-gradient(135deg, #4ade80, #16a34a)",
|
|
919
|
+
color: "#fff",
|
|
920
|
+
boxShadow: "0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"
|
|
921
|
+
},
|
|
922
|
+
"aria-hidden": "true",
|
|
923
|
+
children: /* @__PURE__ */ i("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ i(
|
|
924
|
+
"path",
|
|
925
|
+
{
|
|
926
|
+
d: "M5 13l4 4L19 7",
|
|
927
|
+
stroke: "currentColor",
|
|
928
|
+
"stroke-width": "2.5",
|
|
929
|
+
"stroke-linecap": "round",
|
|
930
|
+
"stroke-linejoin": "round"
|
|
931
|
+
}
|
|
932
|
+
) })
|
|
933
|
+
}
|
|
934
|
+
),
|
|
935
|
+
/* @__PURE__ */ i("h2", { class: "mt-1 text-3xl font-bold tracking-tight text-gray-900", children: r("auth.check_email_title", "Check your email") }),
|
|
936
|
+
/* @__PURE__ */ i("p", { class: "text-base leading-relaxed text-gray-600", children: r(
|
|
937
|
+
"auth.reset_sent_subtitle",
|
|
938
|
+
"We sent a password reset link. Follow the instructions in the email to reset your password."
|
|
939
|
+
) }),
|
|
940
|
+
t ? /* @__PURE__ */ i("p", { class: "break-all text-base font-semibold text-gray-900", children: t }) : null,
|
|
941
|
+
/* @__PURE__ */ i("p", { class: "text-sm text-gray-500", children: r("auth.reset_link_valid", "The link is valid for 1 hour.") }),
|
|
942
|
+
/* @__PURE__ */ i(
|
|
943
|
+
"button",
|
|
944
|
+
{
|
|
945
|
+
type: "button",
|
|
946
|
+
onClick: e,
|
|
947
|
+
class: "pw-cta-shimmer relative mt-2 flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
948
|
+
style: {
|
|
949
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
|
|
950
|
+
boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
|
|
951
|
+
},
|
|
952
|
+
children: /* @__PURE__ */ i("span", { class: "relative z-10", children: r("auth.back_to_login", "Back to Login") })
|
|
953
|
+
}
|
|
954
|
+
)
|
|
955
|
+
] });
|
|
956
|
+
}
|
|
957
|
+
function kt({
|
|
958
|
+
block: t,
|
|
959
|
+
bootstrap: e,
|
|
960
|
+
auth: r,
|
|
961
|
+
authSession: n,
|
|
962
|
+
onBack: a,
|
|
963
|
+
showBack: s = !0,
|
|
964
|
+
intent: o = "preauth",
|
|
965
|
+
initialMode: c
|
|
966
|
+
}) {
|
|
967
|
+
const { t: l } = S(), p = {
|
|
968
|
+
bootstrap: e,
|
|
969
|
+
selectedPriceId: null,
|
|
970
|
+
setSelectedPriceId: () => {
|
|
971
|
+
},
|
|
972
|
+
onAction: () => {
|
|
973
|
+
},
|
|
974
|
+
auth: r,
|
|
975
|
+
authSession: n,
|
|
976
|
+
initialAuthMode: c
|
|
977
|
+
}, u = o === "restore" ? {
|
|
978
|
+
...t,
|
|
979
|
+
heading: l("auth.restore_purchases_heading", "Restore Purchases"),
|
|
980
|
+
subheading: l(
|
|
981
|
+
"auth.restore_purchases_subheading",
|
|
982
|
+
"Please sign in to restore your purchases."
|
|
983
|
+
)
|
|
984
|
+
} : o === "preauth" ? {
|
|
985
|
+
...t,
|
|
986
|
+
heading: l("auth.login_continue_purchase", "Log in to continue your purchase"),
|
|
987
|
+
subheading: l(
|
|
988
|
+
"auth.link_purchase_subheading",
|
|
989
|
+
"We'll link the purchase to your account to keep access."
|
|
990
|
+
),
|
|
991
|
+
// Preauth heading — descriptive sentence ("Log in to continue your
|
|
992
|
+
// purchase"), а не action verb. Длинные локализации (RU: "Войдите,
|
|
993
|
+
// чтобы продолжить покупку") в pill-кнопку h-12 не помещаются и
|
|
994
|
+
// переносятся на 2 строки. Явный короткий submit_label решает.
|
|
995
|
+
submit_label: l("auth.log_in", "Sign In")
|
|
996
|
+
} : t;
|
|
997
|
+
return /* @__PURE__ */ d("div", { class: "relative flex-1 min-h-0 overflow-y-auto p-6 sm:p-8", children: [
|
|
998
|
+
s ? /* @__PURE__ */ i(_t, { onClick: a, ariaLabel: l("nav.back_aria", "Back") }) : null,
|
|
999
|
+
/* @__PURE__ */ i(je, { block: u, ctx: p })
|
|
1000
|
+
] });
|
|
1001
|
+
}
|
|
1002
|
+
function _t({ onClick: t, ariaLabel: e }) {
|
|
1003
|
+
return /* @__PURE__ */ i(
|
|
1004
|
+
"button",
|
|
1005
|
+
{
|
|
1006
|
+
type: "button",
|
|
1007
|
+
onClick: t,
|
|
1008
|
+
"aria-label": e,
|
|
1009
|
+
class: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1010
|
+
children: /* @__PURE__ */ d("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1011
|
+
/* @__PURE__ */ i(
|
|
1012
|
+
"path",
|
|
1013
|
+
{
|
|
1014
|
+
d: "M5 8h8a4 4 0 0 1 0 8H9",
|
|
1015
|
+
stroke: "currentColor",
|
|
1016
|
+
"stroke-width": "1.75",
|
|
1017
|
+
"stroke-linecap": "round",
|
|
1018
|
+
"stroke-linejoin": "round"
|
|
1019
|
+
}
|
|
1020
|
+
),
|
|
1021
|
+
/* @__PURE__ */ i(
|
|
1022
|
+
"path",
|
|
1023
|
+
{
|
|
1024
|
+
d: "M8 4 4 8l4 4",
|
|
1025
|
+
stroke: "currentColor",
|
|
1026
|
+
"stroke-width": "1.75",
|
|
1027
|
+
"stroke-linecap": "round",
|
|
1028
|
+
"stroke-linejoin": "round"
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
] })
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
const St = (t) => `pw-offer-${t}-start`;
|
|
1036
|
+
function ne(t) {
|
|
1037
|
+
const e = t - Date.now();
|
|
1038
|
+
return e <= 0 ? { days: 0, hours: 0, minutes: 0, seconds: 0, expired: !0 } : {
|
|
1039
|
+
days: Math.floor(e / (1e3 * 60 * 60 * 24)),
|
|
1040
|
+
hours: Math.floor(e % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)),
|
|
1041
|
+
minutes: Math.floor(e % (1e3 * 60 * 60) / (1e3 * 60)),
|
|
1042
|
+
seconds: Math.floor(e % (1e3 * 60) / 1e3),
|
|
1043
|
+
expired: !1
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
function Ct(t) {
|
|
1047
|
+
if (t.expires_at) {
|
|
1048
|
+
const e = Date.parse(t.expires_at);
|
|
1049
|
+
return Number.isFinite(e) ? e : null;
|
|
1050
|
+
}
|
|
1051
|
+
if (t.duration_minutes && t.duration_minutes > 0) {
|
|
1052
|
+
if (typeof window > "u") return null;
|
|
1053
|
+
try {
|
|
1054
|
+
const e = St(t.id);
|
|
1055
|
+
let r = window.localStorage.getItem(e);
|
|
1056
|
+
return r || (r = (/* @__PURE__ */ new Date()).toISOString(), window.localStorage.setItem(e, r)), Date.parse(r) + t.duration_minutes * 6e4;
|
|
1057
|
+
} catch {
|
|
1058
|
+
return null;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
return null;
|
|
1062
|
+
}
|
|
1063
|
+
function Be(t, e) {
|
|
1064
|
+
if (!t || t.length === 0) return null;
|
|
1065
|
+
if (e) {
|
|
1066
|
+
const r = t.find((n) => n.id === e);
|
|
1067
|
+
if (r) return r;
|
|
1068
|
+
}
|
|
1069
|
+
return t.find((r) => r.expires_at || r.duration_minutes) ?? null;
|
|
1070
|
+
}
|
|
1071
|
+
function ze(t) {
|
|
1072
|
+
const e = t ? Ct(t) : null, [r, n] = v(
|
|
1073
|
+
() => e !== null ? ne(e) : null
|
|
1074
|
+
), a = O(e);
|
|
1075
|
+
return a.current = e, j(() => {
|
|
1076
|
+
if (e === null) {
|
|
1077
|
+
n(null);
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
n(ne(e));
|
|
1081
|
+
const s = setInterval(() => {
|
|
1082
|
+
const o = ne(a.current ?? 0);
|
|
1083
|
+
n(o), o.expired && clearInterval(s);
|
|
1084
|
+
}, 1e3);
|
|
1085
|
+
return () => clearInterval(s);
|
|
1086
|
+
}, [e, t?.duration_minutes, t?.id]), r;
|
|
1087
|
+
}
|
|
1088
|
+
function It({ block: t, ctx: e }) {
|
|
1089
|
+
const { t: r } = S(), n = Be(e.bootstrap.offers, t.offer_id), a = ze(n);
|
|
1090
|
+
if (!n || a === null || a.expired && !t.force) return null;
|
|
1091
|
+
const s = t.title ?? n.label ?? r("offer.limited_time", "Limited-time offer"), o = n.discount_percent ? `${s} ${n.discount_percent}%` : s;
|
|
1092
|
+
return /* @__PURE__ */ d(
|
|
1093
|
+
"div",
|
|
1094
|
+
{
|
|
1095
|
+
class: "flex flex-wrap items-center justify-center gap-2 rounded-2xl px-4 py-3 text-[15px] font-semibold leading-tight text-white",
|
|
1096
|
+
style: {
|
|
1097
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)",
|
|
1098
|
+
textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
|
|
1099
|
+
},
|
|
1100
|
+
role: "status",
|
|
1101
|
+
children: [
|
|
1102
|
+
/* @__PURE__ */ i(Fe, {}),
|
|
1103
|
+
/* @__PURE__ */ i("span", { children: o }),
|
|
1104
|
+
/* @__PURE__ */ i(Oe, { value: a, t: r })
|
|
1105
|
+
]
|
|
1106
|
+
}
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
function Oe({ value: t, t: e }) {
|
|
1110
|
+
return /* @__PURE__ */ d("div", { class: "flex items-center gap-1 font-mono text-sm", children: [
|
|
1111
|
+
t.days > 0 ? /* @__PURE__ */ d(le, { children: [
|
|
1112
|
+
/* @__PURE__ */ i(G, { children: String(t.days) }),
|
|
1113
|
+
/* @__PURE__ */ i("span", { class: "text-xs", children: e("countdown.d", "d") })
|
|
1114
|
+
] }) : null,
|
|
1115
|
+
/* @__PURE__ */ i(G, { children: String(t.hours).padStart(2, "0") }),
|
|
1116
|
+
/* @__PURE__ */ i("span", { class: "text-xs", children: e("countdown.h", "h") }),
|
|
1117
|
+
/* @__PURE__ */ i(G, { children: String(t.minutes).padStart(2, "0") }),
|
|
1118
|
+
/* @__PURE__ */ i("span", { class: "text-xs", children: e("countdown.m", "m") }),
|
|
1119
|
+
/* @__PURE__ */ i(G, { children: String(t.seconds).padStart(2, "0") }),
|
|
1120
|
+
/* @__PURE__ */ i("span", { class: "text-xs", children: e("countdown.s", "s") })
|
|
1121
|
+
] });
|
|
1122
|
+
}
|
|
1123
|
+
function G({ children: t }) {
|
|
1124
|
+
return /* @__PURE__ */ i("span", { class: "rounded bg-black/20 px-1.5 py-0.5 text-xs font-bold", children: t });
|
|
1125
|
+
}
|
|
1126
|
+
function At({ offer: t }) {
|
|
1127
|
+
const { t: e } = S(), r = ze(t);
|
|
1128
|
+
if (r === null || r.expired) return null;
|
|
1129
|
+
const n = t.label ?? e("offer.limited_time", "Limited-time offer"), a = t.discount_percent ? `${n} ${t.discount_percent}%` : n;
|
|
1130
|
+
return /* @__PURE__ */ d(
|
|
1131
|
+
"div",
|
|
1132
|
+
{
|
|
1133
|
+
class: "-mb-2 flex flex-wrap items-center justify-center gap-2 rounded-t-xl px-4 pb-5 pt-3 text-[15px] font-semibold leading-tight text-white",
|
|
1134
|
+
style: {
|
|
1135
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)",
|
|
1136
|
+
textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
|
|
1137
|
+
},
|
|
1138
|
+
role: "status",
|
|
1139
|
+
children: [
|
|
1140
|
+
/* @__PURE__ */ i(Fe, {}),
|
|
1141
|
+
/* @__PURE__ */ i("span", { children: a }),
|
|
1142
|
+
/* @__PURE__ */ i(Oe, { value: r, t: e })
|
|
1143
|
+
]
|
|
1144
|
+
}
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
function Fe() {
|
|
1148
|
+
return /* @__PURE__ */ i(
|
|
1149
|
+
"svg",
|
|
1150
|
+
{
|
|
1151
|
+
width: "16",
|
|
1152
|
+
height: "16",
|
|
1153
|
+
viewBox: "0 0 12 12",
|
|
1154
|
+
fill: "none",
|
|
1155
|
+
"aria-hidden": "true",
|
|
1156
|
+
children: /* @__PURE__ */ i(
|
|
1157
|
+
"path",
|
|
1158
|
+
{
|
|
1159
|
+
fill: "currentColor",
|
|
1160
|
+
d: "m9.44 5.359-2.394-.895.61-3.036c.062-.31-.345-.531-.57-.291L2.434 6.105a.336.336 0 0 0 .126.537l2.395.894-.61 3.037c-.062.31.345.53.57.29l4.653-4.968a.336.336 0 0 0-.126-.536Z"
|
|
1161
|
+
}
|
|
1162
|
+
)
|
|
1163
|
+
}
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
const xe = 3, ye = 200, ve = 5e3, ae = 5, Mt = 10 * 1024 * 1024, ke = ["image/jpeg", "image/png", "image/webp"], Lt = /.+@.+\..+/;
|
|
1167
|
+
function Tt({ client: t, authSession: e, origin: r, onBack: n }) {
|
|
1168
|
+
const { t: a } = S(), s = e?.user.email ?? "", o = s || null, [c, l] = v(s), [p, u] = v(""), [f, _] = v(""), [h, k] = v([]), [m, A] = v(!1), [b, w] = v(null), [C, I] = v({}), z = () => {
|
|
1169
|
+
const P = {}, T = (o ?? c).trim(), U = p.trim(), B = f.trim();
|
|
1170
|
+
return T ? Lt.test(T.toLowerCase()) || (P.email = a("support.invalid_email", "Invalid email")) : P.email = a("support.required", "Required"), (U.length < xe || U.length > ye) && (P.subject = a("support.subject_length", "{min}–{max} characters", {
|
|
1171
|
+
min: xe,
|
|
1172
|
+
max: ye
|
|
1173
|
+
})), (B.length < 1 || B.length > ve) && (P.message = a("support.message_length", "{min}–{max} characters", {
|
|
1174
|
+
min: 1,
|
|
1175
|
+
max: ve
|
|
1176
|
+
})), I(P), Object.keys(P).length === 0;
|
|
1177
|
+
}, M = async (P) => {
|
|
1178
|
+
if (P.preventDefault(), !m && z()) {
|
|
1179
|
+
A(!0), I((T) => ({ ...T, submit: void 0 }));
|
|
1180
|
+
try {
|
|
1181
|
+
const T = (o ?? c).trim();
|
|
1182
|
+
await t.createSupportTicket({
|
|
1183
|
+
subject: p.trim(),
|
|
1184
|
+
content: f.trim(),
|
|
1185
|
+
email: T || void 0,
|
|
1186
|
+
files: h.length > 0 ? h : void 0
|
|
1187
|
+
}), w(T);
|
|
1188
|
+
} catch (T) {
|
|
1189
|
+
const U = T instanceof L && T.message || "Failed to send. Please try again.";
|
|
1190
|
+
I((B) => ({ ...B, submit: U }));
|
|
1191
|
+
} finally {
|
|
1192
|
+
A(!1);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
}, F = () => {
|
|
1196
|
+
u(""), _(""), k([]), I({}), w(null);
|
|
1197
|
+
}, D = "flex flex-col gap-3 bg-white px-6 pb-6 pt-3 sm:px-8", R = { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" };
|
|
1198
|
+
return b ? /* @__PURE__ */ d("div", { class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1199
|
+
/* @__PURE__ */ d("div", { class: "flex-1 min-h-0 overflow-y-auto flex flex-col items-center gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8 text-center", children: [
|
|
1200
|
+
/* @__PURE__ */ i(
|
|
1201
|
+
"div",
|
|
1202
|
+
{
|
|
1203
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
1204
|
+
style: {
|
|
1205
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",
|
|
1206
|
+
color: "#fff",
|
|
1207
|
+
boxShadow: "0 0 0 8px color-mix(in srgb, var(--pw-accent) 12%, transparent), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 45%, transparent)"
|
|
1208
|
+
},
|
|
1209
|
+
"aria-hidden": "true",
|
|
1210
|
+
children: /* @__PURE__ */ i("svg", { viewBox: "0 0 24 24", class: "h-7 w-7", children: /* @__PURE__ */ i(
|
|
1211
|
+
"path",
|
|
1212
|
+
{
|
|
1213
|
+
fill: "currentColor",
|
|
1214
|
+
d: "M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24Zm6.93 8.2-6.85 9.29a1.01 1.01 0 0 1-1.43.19L5.76 13.77a1 1 0 1 1 1.25-1.56l4.08 3.26 6.23-8.45a1 1 0 1 1 1.61 1.18Z"
|
|
1215
|
+
}
|
|
1216
|
+
) })
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
/* @__PURE__ */ i("div", { class: "text-lg font-semibold tracking-tight text-gray-900", children: a("support.success_heading", "Request submitted") }),
|
|
1220
|
+
/* @__PURE__ */ d("div", { class: "max-w-[320px] text-sm leading-relaxed text-gray-500", children: [
|
|
1221
|
+
a(
|
|
1222
|
+
"support.success_message_prefix",
|
|
1223
|
+
"We've received your message and will respond to"
|
|
1224
|
+
),
|
|
1225
|
+
" ",
|
|
1226
|
+
/* @__PURE__ */ i("b", { class: "text-gray-700", children: b }),
|
|
1227
|
+
"."
|
|
1228
|
+
] })
|
|
1229
|
+
] }),
|
|
1230
|
+
/* @__PURE__ */ i("div", { class: D, style: R, children: /* @__PURE__ */ d("div", { class: "flex items-center justify-center gap-3", children: [
|
|
1231
|
+
/* @__PURE__ */ i(
|
|
1232
|
+
"button",
|
|
1233
|
+
{
|
|
1234
|
+
type: "button",
|
|
1235
|
+
onClick: n,
|
|
1236
|
+
class: "rounded-xl px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1237
|
+
children: r === "standalone" ? a("support.done_button", "Done") : a("nav.back_aria", "Back")
|
|
1238
|
+
}
|
|
1239
|
+
),
|
|
1240
|
+
/* @__PURE__ */ i(
|
|
1241
|
+
"button",
|
|
1242
|
+
{
|
|
1243
|
+
type: "button",
|
|
1244
|
+
onClick: F,
|
|
1245
|
+
class: "flex h-10 items-center justify-center rounded-xl px-4 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1246
|
+
style: {
|
|
1247
|
+
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
1248
|
+
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
1249
|
+
},
|
|
1250
|
+
children: a("support.send_another", "Send another request")
|
|
1251
|
+
}
|
|
1252
|
+
)
|
|
1253
|
+
] }) })
|
|
1254
|
+
] }) : /* @__PURE__ */ d("form", { onSubmit: M, class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1255
|
+
/* @__PURE__ */ i(Pt, { onClick: n, ariaLabel: a("nav.back_aria", "Back") }),
|
|
1256
|
+
/* @__PURE__ */ i("div", { class: "flex-1 min-h-0 overflow-y-auto px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8", children: /* @__PURE__ */ d("div", { class: "flex flex-col gap-5", children: [
|
|
1257
|
+
/* @__PURE__ */ d("div", { class: "flex flex-col gap-2 pr-10", children: [
|
|
1258
|
+
/* @__PURE__ */ i("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: a("support.heading", "Support") }),
|
|
1259
|
+
/* @__PURE__ */ i("p", { class: "text-base leading-relaxed text-gray-600", children: a("support.instruction", "Please fill out the form below to submit your support request.") })
|
|
1260
|
+
] }),
|
|
1261
|
+
/* @__PURE__ */ d("div", { class: "flex flex-col gap-3", children: [
|
|
1262
|
+
o ? /* @__PURE__ */ d("div", { class: "rounded-2xl bg-gray-100 px-5 py-3 text-sm text-gray-600", children: [
|
|
1263
|
+
a("support.sending_as", "Sending as"),
|
|
1264
|
+
" ",
|
|
1265
|
+
/* @__PURE__ */ i("b", { class: "font-medium text-gray-900", children: o })
|
|
1266
|
+
] }) : /* @__PURE__ */ i(
|
|
1267
|
+
_e,
|
|
1268
|
+
{
|
|
1269
|
+
type: "email",
|
|
1270
|
+
placeholder: a("support.email_placeholder", "Enter your email *"),
|
|
1271
|
+
value: c,
|
|
1272
|
+
onInput: l,
|
|
1273
|
+
error: C.email,
|
|
1274
|
+
autocomplete: "email",
|
|
1275
|
+
required: !0
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
/* @__PURE__ */ i(
|
|
1279
|
+
_e,
|
|
1280
|
+
{
|
|
1281
|
+
type: "text",
|
|
1282
|
+
placeholder: a("support.subject_placeholder", "Enter your subject *"),
|
|
1283
|
+
value: p,
|
|
1284
|
+
onInput: u,
|
|
1285
|
+
error: C.subject,
|
|
1286
|
+
required: !0
|
|
1287
|
+
}
|
|
1288
|
+
),
|
|
1289
|
+
/* @__PURE__ */ i(
|
|
1290
|
+
Et,
|
|
1291
|
+
{
|
|
1292
|
+
placeholder: a("support.message_placeholder", "Enter your message *"),
|
|
1293
|
+
value: f,
|
|
1294
|
+
onInput: _,
|
|
1295
|
+
error: C.message,
|
|
1296
|
+
required: !0
|
|
1297
|
+
}
|
|
1298
|
+
),
|
|
1299
|
+
/* @__PURE__ */ i(jt, { files: h, onChange: k, disabled: m })
|
|
1300
|
+
] })
|
|
1301
|
+
] }) }),
|
|
1302
|
+
/* @__PURE__ */ d("div", { class: D, style: R, children: [
|
|
1303
|
+
C.submit && /* @__PURE__ */ i("p", { class: "text-sm text-red-600", children: C.submit }),
|
|
1304
|
+
/* @__PURE__ */ d("div", { class: "flex items-center justify-end gap-3", children: [
|
|
1305
|
+
/* @__PURE__ */ i(
|
|
1306
|
+
"button",
|
|
1307
|
+
{
|
|
1308
|
+
type: "button",
|
|
1309
|
+
onClick: n,
|
|
1310
|
+
disabled: m,
|
|
1311
|
+
class: "rounded-full px-4 py-2 text-base font-medium text-gray-700 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1312
|
+
children: r === "standalone" ? a("support.close_button", "Close") : a("nav.back_aria", "Back")
|
|
1313
|
+
}
|
|
1314
|
+
),
|
|
1315
|
+
/* @__PURE__ */ i(
|
|
1316
|
+
"button",
|
|
1317
|
+
{
|
|
1318
|
+
type: "submit",
|
|
1319
|
+
disabled: m,
|
|
1320
|
+
class: "pw-cta-shimmer relative flex h-12 items-center justify-center overflow-hidden rounded-full px-8 text-base font-semibold text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1321
|
+
style: {
|
|
1322
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
|
|
1323
|
+
boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
|
|
1324
|
+
},
|
|
1325
|
+
children: m ? /* @__PURE__ */ i("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ i("span", { class: "relative z-10", children: a("support.send_button", "Send") })
|
|
1326
|
+
}
|
|
1327
|
+
)
|
|
1328
|
+
] })
|
|
1329
|
+
] })
|
|
1330
|
+
] });
|
|
1331
|
+
}
|
|
1332
|
+
function Pt({ onClick: t, ariaLabel: e }) {
|
|
1333
|
+
return /* @__PURE__ */ i(
|
|
1334
|
+
"button",
|
|
1335
|
+
{
|
|
1336
|
+
type: "button",
|
|
1337
|
+
onClick: t,
|
|
1338
|
+
"aria-label": e,
|
|
1339
|
+
class: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1340
|
+
children: /* @__PURE__ */ d("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1341
|
+
/* @__PURE__ */ i(
|
|
1342
|
+
"path",
|
|
1343
|
+
{
|
|
1344
|
+
d: "M5 8h8a4 4 0 0 1 0 8H9",
|
|
1345
|
+
stroke: "currentColor",
|
|
1346
|
+
"stroke-width": "1.75",
|
|
1347
|
+
"stroke-linecap": "round",
|
|
1348
|
+
"stroke-linejoin": "round"
|
|
1349
|
+
}
|
|
1350
|
+
),
|
|
1351
|
+
/* @__PURE__ */ i(
|
|
1352
|
+
"path",
|
|
1353
|
+
{
|
|
1354
|
+
d: "M8 4 4 8l4 4",
|
|
1355
|
+
stroke: "currentColor",
|
|
1356
|
+
"stroke-width": "1.75",
|
|
1357
|
+
"stroke-linecap": "round",
|
|
1358
|
+
"stroke-linejoin": "round"
|
|
1359
|
+
}
|
|
1360
|
+
)
|
|
1361
|
+
] })
|
|
1362
|
+
}
|
|
1363
|
+
);
|
|
1364
|
+
}
|
|
1365
|
+
function _e({
|
|
1366
|
+
type: t,
|
|
1367
|
+
placeholder: e,
|
|
1368
|
+
value: r,
|
|
1369
|
+
onInput: n,
|
|
1370
|
+
error: a,
|
|
1371
|
+
autocomplete: s,
|
|
1372
|
+
required: o
|
|
1373
|
+
}) {
|
|
1374
|
+
return /* @__PURE__ */ d("div", { children: [
|
|
1375
|
+
/* @__PURE__ */ i(
|
|
1376
|
+
"input",
|
|
1377
|
+
{
|
|
1378
|
+
type: t,
|
|
1379
|
+
value: r,
|
|
1380
|
+
placeholder: e,
|
|
1381
|
+
onInput: (c) => n(c.target.value),
|
|
1382
|
+
autocomplete: s,
|
|
1383
|
+
required: o,
|
|
1384
|
+
class: `h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${a ? "shadow-[0_0_0_2px_rgba(239,68,68,0.5)]" : "focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"}`
|
|
1385
|
+
}
|
|
1386
|
+
),
|
|
1387
|
+
a && /* @__PURE__ */ i("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: a })
|
|
1388
|
+
] });
|
|
1389
|
+
}
|
|
1390
|
+
function Et({
|
|
1391
|
+
placeholder: t,
|
|
1392
|
+
value: e,
|
|
1393
|
+
onInput: r,
|
|
1394
|
+
error: n,
|
|
1395
|
+
required: a
|
|
1396
|
+
}) {
|
|
1397
|
+
return /* @__PURE__ */ d("div", { children: [
|
|
1398
|
+
/* @__PURE__ */ i(
|
|
1399
|
+
"textarea",
|
|
1400
|
+
{
|
|
1401
|
+
value: e,
|
|
1402
|
+
placeholder: t,
|
|
1403
|
+
onInput: (s) => r(s.target.value),
|
|
1404
|
+
required: a,
|
|
1405
|
+
rows: 5,
|
|
1406
|
+
class: `min-h-[120px] w-full rounded-2xl bg-gray-100 px-5 py-3.5 text-base leading-relaxed text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${n ? "shadow-[0_0_0_2px_rgba(239,68,68,0.5)]" : "focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"}`
|
|
1407
|
+
}
|
|
1408
|
+
),
|
|
1409
|
+
n && /* @__PURE__ */ i("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: n })
|
|
1410
|
+
] });
|
|
1411
|
+
}
|
|
1412
|
+
function jt({ files: t, onChange: e, disabled: r }) {
|
|
1413
|
+
const { t: n } = S(), a = O(null), [s, o] = v(!1), [c, l] = v(null), p = (u) => {
|
|
1414
|
+
if (!u || r) return;
|
|
1415
|
+
l(null);
|
|
1416
|
+
const f = Array.from(u);
|
|
1417
|
+
if (t.length + f.length > ae) {
|
|
1418
|
+
l(n("support.too_many_files", "Up to {max} files", { max: ae }));
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
const _ = f.filter(
|
|
1422
|
+
(h) => ke.includes(h.type) && h.size <= Mt
|
|
1423
|
+
);
|
|
1424
|
+
if (_.length !== f.length) {
|
|
1425
|
+
l(n("support.invalid_file", "Only JPEG/PNG/WebP, ≤ 10MB each"));
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
e([...t, ..._]);
|
|
1429
|
+
};
|
|
1430
|
+
return /* @__PURE__ */ d("div", { children: [
|
|
1431
|
+
/* @__PURE__ */ i("span", { class: "text-xs font-medium text-gray-700", children: n("support.attachments_label", "Attachments (optional)") }),
|
|
1432
|
+
/* @__PURE__ */ d(
|
|
1433
|
+
"div",
|
|
1434
|
+
{
|
|
1435
|
+
role: "button",
|
|
1436
|
+
tabIndex: 0,
|
|
1437
|
+
"aria-label": n("support.attachments_aria", "Attachments upload"),
|
|
1438
|
+
onClick: () => !r && a.current?.click(),
|
|
1439
|
+
onDragOver: (u) => {
|
|
1440
|
+
u.preventDefault(), r || o(!0);
|
|
1441
|
+
},
|
|
1442
|
+
onDragLeave: () => o(!1),
|
|
1443
|
+
onDrop: (u) => {
|
|
1444
|
+
u.preventDefault(), o(!1), p(u.dataTransfer?.files ?? null);
|
|
1445
|
+
},
|
|
1446
|
+
class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${s ? "border-[var(--pw-accent)] bg-[color-mix(in_srgb,var(--pw-accent)_6%,white)]" : "border-gray-300 hover:border-gray-400 hover:bg-gray-50/60"} ${r ? "cursor-not-allowed opacity-60" : ""}`,
|
|
1447
|
+
children: [
|
|
1448
|
+
/* @__PURE__ */ i("div", { class: "text-xs text-gray-500", children: n("support.dropzone_text", "Drop images here or click to select") }),
|
|
1449
|
+
/* @__PURE__ */ i("div", { class: "mt-0.5 text-[11px] text-gray-400", children: n("support.file_requirements", "JPEG/PNG/WebP, up to {max} files, ≤ 10MB each", {
|
|
1450
|
+
max: ae
|
|
1451
|
+
}) })
|
|
1452
|
+
]
|
|
1453
|
+
}
|
|
1454
|
+
),
|
|
1455
|
+
/* @__PURE__ */ i(
|
|
1456
|
+
"input",
|
|
1457
|
+
{
|
|
1458
|
+
ref: a,
|
|
1459
|
+
type: "file",
|
|
1460
|
+
multiple: !0,
|
|
1461
|
+
accept: ke.join(","),
|
|
1462
|
+
class: "hidden",
|
|
1463
|
+
onChange: (u) => {
|
|
1464
|
+
p(u.target.files), u.currentTarget.value = "";
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
),
|
|
1468
|
+
c && /* @__PURE__ */ i("p", { class: "mt-1 text-xs text-red-600", children: c }),
|
|
1469
|
+
t.length > 0 && /* @__PURE__ */ i("ul", { class: "mt-2 flex flex-col gap-1", children: t.map((u, f) => /* @__PURE__ */ d(
|
|
1470
|
+
"li",
|
|
1471
|
+
{
|
|
1472
|
+
class: "flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",
|
|
1473
|
+
children: [
|
|
1474
|
+
/* @__PURE__ */ i("span", { class: "truncate text-gray-700", children: u.name }),
|
|
1475
|
+
/* @__PURE__ */ i(
|
|
1476
|
+
"button",
|
|
1477
|
+
{
|
|
1478
|
+
type: "button",
|
|
1479
|
+
onClick: () => {
|
|
1480
|
+
const _ = [...t];
|
|
1481
|
+
_.splice(f, 1), e(_);
|
|
1482
|
+
},
|
|
1483
|
+
disabled: r,
|
|
1484
|
+
class: "text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60",
|
|
1485
|
+
"aria-label": n("support.remove_file_aria", "Remove {filename}", { filename: u.name }),
|
|
1486
|
+
children: "✕"
|
|
1487
|
+
}
|
|
1488
|
+
)
|
|
1489
|
+
]
|
|
1490
|
+
},
|
|
1491
|
+
`${u.name}-${u.size}-${f}`
|
|
1492
|
+
)) })
|
|
1493
|
+
] });
|
|
1494
|
+
}
|
|
1495
|
+
const Bt = {
|
|
1496
|
+
day: "cta.get_plan_daily",
|
|
1497
|
+
week: "cta.get_plan_weekly",
|
|
1498
|
+
month: "cta.get_plan_monthly",
|
|
1499
|
+
year: "cta.get_plan_yearly"
|
|
1500
|
+
}, zt = {
|
|
1501
|
+
day: "Get Daily Plan",
|
|
1502
|
+
week: "Get Weekly Plan",
|
|
1503
|
+
month: "Get Monthly Plan",
|
|
1504
|
+
year: "Get Yearly Plan"
|
|
1505
|
+
};
|
|
1506
|
+
function Ot(t, e, r, n) {
|
|
1507
|
+
if (e === "close") return n("cta.close", "Close");
|
|
1508
|
+
if (!t) return n("cta.continue", "Continue");
|
|
1509
|
+
if (!r && t.trial_days && t.interval && t.interval !== "lifetime")
|
|
1510
|
+
return n("cta.start_trial", "Start {days}-Day Free Trial", { days: t.trial_days });
|
|
1511
|
+
if (!t.interval || t.interval === "lifetime")
|
|
1512
|
+
return n("cta.get_lifetime_access", "Get Lifetime Access");
|
|
1513
|
+
const a = Bt[t.interval];
|
|
1514
|
+
return a ? n(a, zt[t.interval]) : n("cta.get_plan_generic", "Get {interval} Plan", {
|
|
1515
|
+
interval: Ft(t.interval)
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
function Ft(t) {
|
|
1519
|
+
return t.length ? t[0].toUpperCase() + t.slice(1) : t;
|
|
1520
|
+
}
|
|
1521
|
+
function Rt({ block: t, ctx: e }) {
|
|
1522
|
+
const { t: r } = S(), [n, a] = v(!1), s = t.priceId ?? e.selectedPriceId, o = n || t.action === "checkout" && !s, c = s ? e.bootstrap.prices.find((f) => f.id === s) ?? null : null, l = e.bootstrap.user?.had_previous_trial ?? !1, p = t.label ?? Ot(c, t.action, l, r);
|
|
1523
|
+
return /* @__PURE__ */ d(
|
|
1524
|
+
"button",
|
|
1525
|
+
{
|
|
1526
|
+
type: "button",
|
|
1527
|
+
disabled: o,
|
|
1528
|
+
onClick: async () => {
|
|
1529
|
+
if (!o) {
|
|
1530
|
+
a(!0);
|
|
1531
|
+
try {
|
|
1532
|
+
await e.onAction(t.action, { priceId: s });
|
|
1533
|
+
} finally {
|
|
1534
|
+
a(!1);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
},
|
|
1538
|
+
class: "pw-cta-shimmer relative flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1539
|
+
style: {
|
|
1540
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
|
|
1541
|
+
boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
|
|
1542
|
+
},
|
|
1543
|
+
children: [
|
|
1544
|
+
/* @__PURE__ */ i(
|
|
1545
|
+
"span",
|
|
1546
|
+
{
|
|
1547
|
+
class: "absolute inset-0 opacity-40",
|
|
1548
|
+
style: {
|
|
1549
|
+
background: "radial-gradient(circle at 50% 0%, color-mix(in srgb, white 40%, transparent) 0%, transparent 70%)"
|
|
1550
|
+
},
|
|
1551
|
+
"aria-hidden": "true"
|
|
1552
|
+
}
|
|
1553
|
+
),
|
|
1554
|
+
n ? /* @__PURE__ */ i("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ i("span", { class: "relative z-10", children: p })
|
|
1555
|
+
]
|
|
1556
|
+
}
|
|
1557
|
+
);
|
|
1558
|
+
}
|
|
1559
|
+
function Ut({ ctx: t }) {
|
|
1560
|
+
const { t: e } = S(), r = t.authSession, n = t.auth, [a, s] = v(!1), o = () => t.onAction("support");
|
|
1561
|
+
if (r && !r.user.is_anonymous) {
|
|
1562
|
+
const c = async () => {
|
|
1563
|
+
if (!(!n || a)) {
|
|
1564
|
+
s(!0);
|
|
1565
|
+
try {
|
|
1566
|
+
await n.signOut();
|
|
1567
|
+
} catch {
|
|
1568
|
+
} finally {
|
|
1569
|
+
s(!1);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
return /* @__PURE__ */ d("div", { class: "-mt-3 flex flex-col items-center gap-1.5 pt-1 text-center text-[13px] text-gray-500", children: [
|
|
1574
|
+
/* @__PURE__ */ d("span", { children: [
|
|
1575
|
+
e("session.signed_in_as_prefix", "Signed in as"),
|
|
1576
|
+
" ",
|
|
1577
|
+
/* @__PURE__ */ i("b", { class: "font-medium text-gray-700", children: r.user.email })
|
|
1578
|
+
] }),
|
|
1579
|
+
/* @__PURE__ */ d("div", { class: "flex items-center justify-center gap-3", children: [
|
|
1580
|
+
/* @__PURE__ */ i(W, { onClick: c, disabled: !n || a, children: a ? e("session.signing_out", "Signing out…") : e("session.sign_out", "Sign Out") }),
|
|
1581
|
+
/* @__PURE__ */ i(Se, {}),
|
|
1582
|
+
/* @__PURE__ */ i(W, { onClick: o, children: e("session.contact_support", "Contact Support") })
|
|
1583
|
+
] })
|
|
1584
|
+
] });
|
|
1585
|
+
}
|
|
1586
|
+
return /* @__PURE__ */ d("div", { class: "-mt-3 flex items-center justify-center gap-3 pt-1 text-center text-[13px]", children: [
|
|
1587
|
+
/* @__PURE__ */ i(W, { onClick: () => t.onAction("restore"), children: e("session.restore_purchases", "Restore purchases") }),
|
|
1588
|
+
/* @__PURE__ */ i(Se, {}),
|
|
1589
|
+
/* @__PURE__ */ i(W, { onClick: o, children: e("session.contact_support", "Contact Support") })
|
|
1590
|
+
] });
|
|
1591
|
+
}
|
|
1592
|
+
function W({
|
|
1593
|
+
onClick: t,
|
|
1594
|
+
disabled: e,
|
|
1595
|
+
children: r
|
|
1596
|
+
}) {
|
|
1597
|
+
return /* @__PURE__ */ i(
|
|
1598
|
+
"button",
|
|
1599
|
+
{
|
|
1600
|
+
type: "button",
|
|
1601
|
+
onClick: t,
|
|
1602
|
+
disabled: e,
|
|
1603
|
+
class: "font-semibold transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:opacity-80",
|
|
1604
|
+
style: { color: "var(--pw-accent)" },
|
|
1605
|
+
children: r
|
|
1606
|
+
}
|
|
1607
|
+
);
|
|
1608
|
+
}
|
|
1609
|
+
function Se() {
|
|
1610
|
+
return /* @__PURE__ */ i("span", { class: "h-1 w-1 rounded-full bg-gray-300", "aria-hidden": "true" });
|
|
1611
|
+
}
|
|
1612
|
+
function Dt({ block: t }) {
|
|
1613
|
+
return t.items.length ? /* @__PURE__ */ i("ul", { class: "flex flex-col gap-2.5", role: "list", children: t.items.map((e) => /* @__PURE__ */ d("li", { class: "flex items-start gap-3 text-sm text-gray-700", children: [
|
|
1614
|
+
/* @__PURE__ */ i(
|
|
1615
|
+
"svg",
|
|
1616
|
+
{
|
|
1617
|
+
width: "18",
|
|
1618
|
+
height: "18",
|
|
1619
|
+
viewBox: "0 0 20 20",
|
|
1620
|
+
fill: "none",
|
|
1621
|
+
class: "mt-0.5 flex-shrink-0 text-emerald-500",
|
|
1622
|
+
"aria-hidden": "true",
|
|
1623
|
+
children: /* @__PURE__ */ i(
|
|
1624
|
+
"path",
|
|
1625
|
+
{
|
|
1626
|
+
d: "M4 10.5l3.5 3.5 8.5-8.5",
|
|
1627
|
+
stroke: "currentColor",
|
|
1628
|
+
"stroke-width": "2.5",
|
|
1629
|
+
"stroke-linecap": "round",
|
|
1630
|
+
"stroke-linejoin": "round"
|
|
1631
|
+
}
|
|
1632
|
+
)
|
|
1633
|
+
}
|
|
1634
|
+
),
|
|
1635
|
+
/* @__PURE__ */ d("div", { class: "flex flex-col gap-0.5", children: [
|
|
1636
|
+
/* @__PURE__ */ i("span", { class: "font-medium leading-snug text-gray-900", children: e.name }),
|
|
1637
|
+
e.desc ? /* @__PURE__ */ i("span", { class: "text-xs leading-relaxed text-gray-400", children: e.desc }) : null
|
|
1638
|
+
] })
|
|
1639
|
+
] }, e.id)) }) : null;
|
|
1640
|
+
}
|
|
1641
|
+
function Nt({ block: t }) {
|
|
1642
|
+
const { t: e } = S(), r = t.title ?? e("pricing.money_back", "30-day money-back guarantee"), n = t.subtitle, a = (t.icon ?? "dollar_shield") !== "none", s = Vt(r);
|
|
1643
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-1.5 border-b-1 pb-4 mb-1 border-gray-100", children: [
|
|
1644
|
+
/* @__PURE__ */ d("div", { class: "inline-flex items-center gap-2 text-[12px] text-gray-700", children: [
|
|
1645
|
+
a ? /* @__PURE__ */ i(Ht, {}) : null,
|
|
1646
|
+
s ? /* @__PURE__ */ d("span", { children: [
|
|
1647
|
+
/* @__PURE__ */ i("b", { class: "font-bold text-gray-900", children: s.bold }),
|
|
1648
|
+
" ",
|
|
1649
|
+
/* @__PURE__ */ i("span", { class: "font-medium", children: s.rest })
|
|
1650
|
+
] }) : /* @__PURE__ */ i("span", { class: "font-medium", children: r })
|
|
1651
|
+
] }),
|
|
1652
|
+
n ? /* @__PURE__ */ i("span", { class: "text-center text-xs leading-relaxed text-gray-500", children: n }) : null
|
|
1653
|
+
] });
|
|
1654
|
+
}
|
|
1655
|
+
function Vt(t) {
|
|
1656
|
+
const e = t.match(/^(\d+[-\s]?days?)\s+(.+)$/i);
|
|
1657
|
+
return e ? { bold: e[1], rest: e[2] } : null;
|
|
1658
|
+
}
|
|
1659
|
+
function Ht() {
|
|
1660
|
+
return /* @__PURE__ */ d(
|
|
1661
|
+
"svg",
|
|
1662
|
+
{
|
|
1663
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1664
|
+
viewBox: "0 0 24 24",
|
|
1665
|
+
fill: "none",
|
|
1666
|
+
width: "16",
|
|
1667
|
+
height: "16",
|
|
1668
|
+
class: "flex-shrink-0 text-emerald-500",
|
|
1669
|
+
"aria-hidden": "true",
|
|
1670
|
+
children: [
|
|
1671
|
+
/* @__PURE__ */ i(
|
|
1672
|
+
"path",
|
|
1673
|
+
{
|
|
1674
|
+
d: "M12 2 4 5v6c0 5.25 3.5 9.5 8 11 4.5-1.5 8-5.75 8-11V5l-8-3Z",
|
|
1675
|
+
stroke: "currentColor",
|
|
1676
|
+
"stroke-width": "2",
|
|
1677
|
+
"stroke-linejoin": "round"
|
|
1678
|
+
}
|
|
1679
|
+
),
|
|
1680
|
+
/* @__PURE__ */ i(
|
|
1681
|
+
"path",
|
|
1682
|
+
{
|
|
1683
|
+
d: "m9 12 2 2 4-4",
|
|
1684
|
+
stroke: "currentColor",
|
|
1685
|
+
"stroke-width": "2",
|
|
1686
|
+
"stroke-linecap": "round",
|
|
1687
|
+
"stroke-linejoin": "round"
|
|
1688
|
+
}
|
|
1689
|
+
)
|
|
1690
|
+
]
|
|
1691
|
+
}
|
|
1692
|
+
);
|
|
1693
|
+
}
|
|
1694
|
+
const Re = 24, $t = 16, qt = 2;
|
|
1695
|
+
function Gt(t, e) {
|
|
1696
|
+
const r = e * qt;
|
|
1697
|
+
let n = Re;
|
|
1698
|
+
for (t.style.fontSize = `${n}px`; t.scrollHeight > r && n > $t; )
|
|
1699
|
+
n -= 1, t.style.fontSize = `${n}px`;
|
|
1700
|
+
}
|
|
1701
|
+
function Wt({ block: t, ctx: e }) {
|
|
1702
|
+
const r = t.level ?? 1, n = `h${r}`, a = r === 1 ? "text-[22px] sm:text-2xl font-semibold leading-tight text-center text-balance text-gray-800" : r === 2 ? "text-xl font-semibold leading-snug text-gray-900 tracking-tight" : "text-base font-medium text-gray-900", s = O(null), o = r === 1 && !!e.bootstrap.settings.title_auto_fit;
|
|
1703
|
+
return j(() => {
|
|
1704
|
+
if (!o || !s.current) return;
|
|
1705
|
+
const c = getComputedStyle(s.current), l = parseFloat(c.lineHeight) || Re * 1.5;
|
|
1706
|
+
Gt(s.current, l);
|
|
1707
|
+
}, [o, t.text]), /* @__PURE__ */ i(n, { ref: s, class: a, children: t.text });
|
|
1708
|
+
}
|
|
1709
|
+
function Zt(t) {
|
|
1710
|
+
const e = t.local ?? { currency: t.currency, amount: t.amount };
|
|
1711
|
+
if (t.interval === "year") {
|
|
1712
|
+
const r = (t.interval_count ?? 1) * 12;
|
|
1713
|
+
return { amount: e.amount / r, currency: e.currency };
|
|
1714
|
+
}
|
|
1715
|
+
return { amount: e.amount, currency: e.currency };
|
|
1716
|
+
}
|
|
1717
|
+
function oe(t, e) {
|
|
1718
|
+
const r = t % 1 !== 0 ? 2 : 0;
|
|
1719
|
+
try {
|
|
1720
|
+
const n = new Intl.NumberFormat(void 0, {
|
|
1721
|
+
style: "currency",
|
|
1722
|
+
currency: e,
|
|
1723
|
+
currencyDisplay: "narrowSymbol",
|
|
1724
|
+
maximumFractionDigits: r,
|
|
1725
|
+
minimumFractionDigits: r
|
|
1726
|
+
}).formatToParts(t);
|
|
1727
|
+
let a = "", s = "";
|
|
1728
|
+
for (const o of n)
|
|
1729
|
+
o.type === "currency" ? a = o.value : o.type !== "literal" && (s += o.value);
|
|
1730
|
+
return { currency: a || e, amount: s.trim() };
|
|
1731
|
+
} catch {
|
|
1732
|
+
return { currency: e, amount: String(t) };
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
function ce(t, e) {
|
|
1736
|
+
const { amount: r, currency: n } = Zt(t);
|
|
1737
|
+
if (!e) {
|
|
1738
|
+
const { currency: c, amount: l } = oe(r, n);
|
|
1739
|
+
return { currency: c, amount: l, originalAmount: null };
|
|
1740
|
+
}
|
|
1741
|
+
const a = r * (1 - e / 100), s = oe(a, n), o = oe(r, n);
|
|
1742
|
+
return {
|
|
1743
|
+
currency: s.currency,
|
|
1744
|
+
amount: s.amount,
|
|
1745
|
+
originalAmount: `${o.currency}${o.amount}`
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
function Ue(t, e) {
|
|
1749
|
+
if (t.label) return t.label.toUpperCase();
|
|
1750
|
+
if (!t.interval || t.interval === "lifetime")
|
|
1751
|
+
return e("pricing.plan_label.lifetime", "LIFETIME");
|
|
1752
|
+
const n = {
|
|
1753
|
+
day: { key: "pricing.plan_label.daily", fallback: "DAILY PLAN" },
|
|
1754
|
+
week: { key: "pricing.plan_label.weekly", fallback: "WEEKLY PLAN" },
|
|
1755
|
+
month: { key: "pricing.plan_label.monthly", fallback: "MONTHLY PLAN" },
|
|
1756
|
+
year: { key: "pricing.plan_label.yearly", fallback: "YEARLY PLAN" }
|
|
1757
|
+
}[t.interval];
|
|
1758
|
+
return n ? e(n.key, n.fallback) : `${t.interval.toUpperCase()} PLAN`;
|
|
1759
|
+
}
|
|
1760
|
+
function de(t, e) {
|
|
1761
|
+
if (!t.interval || t.interval === "lifetime")
|
|
1762
|
+
return e("pricing.interval.lifetime_short", "lifetime");
|
|
1763
|
+
if (t.interval === "year") return e("pricing.interval.month", "month");
|
|
1764
|
+
const r = t.interval_count ?? 1;
|
|
1765
|
+
return r === 1 ? e(`pricing.interval.${t.interval}`, t.interval) : `${r} ${t.interval}s`;
|
|
1766
|
+
}
|
|
1767
|
+
function Kt({ block: t, ctx: e }) {
|
|
1768
|
+
const { t: r } = S(), n = t.priceIds && t.priceIds.length > 0 ? new Set(t.priceIds) : null, a = e.bootstrap.prices.filter((o) => !n || n.has(o.id));
|
|
1769
|
+
if (a.length === 0)
|
|
1770
|
+
return /* @__PURE__ */ i("p", { class: "text-sm text-gray-500", children: r("pricing.no_prices", "No prices available.") });
|
|
1771
|
+
const s = t.popular_label ?? r("pricing.most_popular", "Most popular");
|
|
1772
|
+
if (t.view === "compact")
|
|
1773
|
+
return /* @__PURE__ */ i(
|
|
1774
|
+
"div",
|
|
1775
|
+
{
|
|
1776
|
+
class: "flex w-full flex-col rounded-xl border border-gray-200 bg-gray-50",
|
|
1777
|
+
role: "radiogroup",
|
|
1778
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1779
|
+
children: a.map((o, c) => /* @__PURE__ */ i(
|
|
1780
|
+
Xt,
|
|
1781
|
+
{
|
|
1782
|
+
price: o,
|
|
1783
|
+
isLast: c === a.length - 1,
|
|
1784
|
+
isPopular: t.popular_price_id === o.id,
|
|
1785
|
+
popularLabel: s,
|
|
1786
|
+
offer: $(e.bootstrap.offers, o.id, { readStart: N }),
|
|
1787
|
+
selected: e.selectedPriceId === o.id,
|
|
1788
|
+
onSelect: () => {
|
|
1789
|
+
e.setSelectedPriceId(o.id), e.onAction("price_selected", { priceId: o.id, price: o });
|
|
1790
|
+
},
|
|
1791
|
+
t: r
|
|
1792
|
+
},
|
|
1793
|
+
o.id
|
|
1794
|
+
))
|
|
1795
|
+
}
|
|
1796
|
+
);
|
|
1797
|
+
if (t.view === "horizontal") {
|
|
1798
|
+
const o = Math.min(a.length, 3), c = a.some(
|
|
1799
|
+
(l) => ($(e.bootstrap.offers, l.id, { readStart: N })?.discount_percent ?? 0) > 0
|
|
1800
|
+
);
|
|
1801
|
+
return /* @__PURE__ */ i(
|
|
1802
|
+
"div",
|
|
1803
|
+
{
|
|
1804
|
+
class: "grid items-stretch gap-2",
|
|
1805
|
+
style: { gridTemplateColumns: `repeat(${o}, minmax(0, 1fr))` },
|
|
1806
|
+
role: "radiogroup",
|
|
1807
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1808
|
+
children: a.map((l) => /* @__PURE__ */ i(
|
|
1809
|
+
Jt,
|
|
1810
|
+
{
|
|
1811
|
+
price: l,
|
|
1812
|
+
isPopular: t.popular_price_id === l.id,
|
|
1813
|
+
popularLabel: s,
|
|
1814
|
+
offer: $(e.bootstrap.offers, l.id, { readStart: N }),
|
|
1815
|
+
reserveStrikeRow: c,
|
|
1816
|
+
selected: e.selectedPriceId === l.id,
|
|
1817
|
+
onSelect: () => {
|
|
1818
|
+
e.setSelectedPriceId(l.id), e.onAction("price_selected", { priceId: l.id, price: l });
|
|
1819
|
+
},
|
|
1820
|
+
t: r
|
|
1821
|
+
},
|
|
1822
|
+
l.id
|
|
1823
|
+
))
|
|
1824
|
+
}
|
|
1825
|
+
);
|
|
1826
|
+
}
|
|
1827
|
+
return /* @__PURE__ */ i(
|
|
1828
|
+
"div",
|
|
1829
|
+
{
|
|
1830
|
+
class: "flex flex-col gap-2",
|
|
1831
|
+
role: "radiogroup",
|
|
1832
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1833
|
+
children: a.map((o) => {
|
|
1834
|
+
const c = e.selectedPriceId === o.id, l = t.popular_price_id === o.id, u = $(e.bootstrap.offers, o.id, { readStart: N })?.discount_percent ?? null, { currency: f, amount: _, originalAmount: h } = ce(o, u);
|
|
1835
|
+
return /* @__PURE__ */ d(
|
|
1836
|
+
"button",
|
|
1837
|
+
{
|
|
1838
|
+
type: "button",
|
|
1839
|
+
role: "radio",
|
|
1840
|
+
"aria-checked": c,
|
|
1841
|
+
onClick: () => {
|
|
1842
|
+
e.setSelectedPriceId(o.id), e.onAction("price_selected", { priceId: o.id, price: o });
|
|
1843
|
+
},
|
|
1844
|
+
class: [
|
|
1845
|
+
"group relative inline-flex w-full mx-auto items-center justify-between flex-row-reverse gap-4 rounded-2xl border-2 px-4 py-3.5 text-left transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1846
|
+
// Везде border 2px — selection выражается только цветом, layout
|
|
1847
|
+
// не прыгает (равная толщина у selected/unselected). Цветовая
|
|
1848
|
+
// разница accent vs gray достаточно сильная для visual hierarchy.
|
|
1849
|
+
c ? "border-[var(--pw-accent)] bg-transparent" : "border-gray-200 bg-transparent hover:bg-gray-50"
|
|
1850
|
+
].join(" "),
|
|
1851
|
+
children: [
|
|
1852
|
+
/* @__PURE__ */ i(
|
|
1853
|
+
"span",
|
|
1854
|
+
{
|
|
1855
|
+
class: [
|
|
1856
|
+
"flex h-6.5 w-6.5 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
1857
|
+
c ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent",
|
|
1858
|
+
// Popular-label badge сидит absolute сверху-справа карточки и
|
|
1859
|
+
// визуально сдвигает центр content'а вниз. flex items-center
|
|
1860
|
+
// на карточке держит галочку по геометрическому центру, что
|
|
1861
|
+
// делает её визуально выше — компенсируем небольшим mt'ом.
|
|
1862
|
+
l ? "mt-3" : ""
|
|
1863
|
+
].join(" "),
|
|
1864
|
+
style: c ? {
|
|
1865
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
|
|
1866
|
+
} : void 0,
|
|
1867
|
+
"aria-hidden": "true",
|
|
1868
|
+
children: /* @__PURE__ */ i(
|
|
1869
|
+
"svg",
|
|
1870
|
+
{
|
|
1871
|
+
width: "14",
|
|
1872
|
+
height: "10",
|
|
1873
|
+
viewBox: "0 0 17 12",
|
|
1874
|
+
fill: "none",
|
|
1875
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1876
|
+
class: c ? "opacity-100" : "opacity-0",
|
|
1877
|
+
children: /* @__PURE__ */ i(
|
|
1878
|
+
"path",
|
|
1879
|
+
{
|
|
1880
|
+
d: "M16.5234 0.476562C16.9805 0.898438 16.9805 1.63672 16.5234 2.05859L7.52344 11.0586C7.10156 11.5156 6.36328 11.5156 5.94141 11.0586L1.44141 6.55859C0.984375 6.13672 0.984375 5.39844 1.44141 4.97656C1.86328 4.51953 2.60156 4.51953 3.02344 4.97656L6.75 8.66797L14.9414 0.476562C15.3633 0.0195312 16.1016 0.0195312 16.5234 0.476562Z",
|
|
1881
|
+
fill: "currentColor"
|
|
1882
|
+
}
|
|
1883
|
+
)
|
|
1884
|
+
}
|
|
1885
|
+
)
|
|
1886
|
+
}
|
|
1887
|
+
),
|
|
1888
|
+
/* @__PURE__ */ d("div", { class: "flex flex-1 flex-col gap-0.5", children: [
|
|
1889
|
+
/* @__PURE__ */ d("div", { class: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
1890
|
+
/* @__PURE__ */ i("span", { class: "text-xs font-normal uppercase tracking-normal text-gray-800/70", children: Ue(o, r) }),
|
|
1891
|
+
h ? (
|
|
1892
|
+
// opacity-60 приглушает strike: глаз сначала ловит label
|
|
1893
|
+
// и discount-badge, потом main price; original «бывшая цена»
|
|
1894
|
+
// — третичная информация, не должна конкурировать с label.
|
|
1895
|
+
/* @__PURE__ */ i("span", { class: "text-[15px] font-normal text-gray-400 opacity-60 line-through decoration-gray-400 decoration-[1.5px]", children: h })
|
|
1896
|
+
) : null,
|
|
1897
|
+
u ? (
|
|
1898
|
+
// Emerald pill — фиксированный «успех/выгода», не зависит от
|
|
1899
|
+
// brand_color. Читается даже на тёмных бренд-акцентах.
|
|
1900
|
+
/* @__PURE__ */ d("span", { class: "rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-bold leading-none text-emerald-700", children: [
|
|
1901
|
+
"-",
|
|
1902
|
+
u,
|
|
1903
|
+
"%"
|
|
1904
|
+
] })
|
|
1905
|
+
) : null
|
|
1906
|
+
] }),
|
|
1907
|
+
/* @__PURE__ */ i("div", { class: "flex items-baseline gap-2 flex-wrap", children: /* @__PURE__ */ d("span", { class: "text-[26px] leading-tight whitespace-nowrap text-gray-800 font-medium", children: [
|
|
1908
|
+
/* @__PURE__ */ i("span", { class: "opacity-90", children: f }),
|
|
1909
|
+
_,
|
|
1910
|
+
/* @__PURE__ */ d("span", { class: "text-sm font-normal text-gray-500", children: [
|
|
1911
|
+
" ",
|
|
1912
|
+
"/ ",
|
|
1913
|
+
de(o, r)
|
|
1914
|
+
] })
|
|
1915
|
+
] }) }),
|
|
1916
|
+
o.description ? /* @__PURE__ */ i("span", { class: "mt-1 text-xs leading-relaxed text-gray-500", children: o.description }) : null
|
|
1917
|
+
] }),
|
|
1918
|
+
l ? /* @__PURE__ */ i(
|
|
1919
|
+
"span",
|
|
1920
|
+
{
|
|
1921
|
+
class: "absolute -top-[9px] -right-[6px] rounded-[11px] border-[5px] border-white px-2 py-1 text-[12px] font-semibold text-white",
|
|
1922
|
+
style: { background: "var(--pw-accent)" },
|
|
1923
|
+
children: s
|
|
1924
|
+
}
|
|
1925
|
+
) : null
|
|
1926
|
+
]
|
|
1927
|
+
},
|
|
1928
|
+
o.id
|
|
1929
|
+
);
|
|
1930
|
+
})
|
|
1931
|
+
}
|
|
1932
|
+
);
|
|
1933
|
+
}
|
|
1934
|
+
function Yt(t, e) {
|
|
1935
|
+
return t.label ? t.label : !t.interval || t.interval === "lifetime" ? e("pricing.interval.lifetime_short", "lifetime") : e(`pricing.interval.${t.interval}`, t.interval);
|
|
1936
|
+
}
|
|
1937
|
+
function Xt({
|
|
1938
|
+
price: t,
|
|
1939
|
+
isLast: e,
|
|
1940
|
+
isPopular: r,
|
|
1941
|
+
popularLabel: n,
|
|
1942
|
+
offer: a,
|
|
1943
|
+
selected: s,
|
|
1944
|
+
onSelect: o,
|
|
1945
|
+
t: c
|
|
1946
|
+
}) {
|
|
1947
|
+
const l = a?.discount_percent ?? null, { currency: p, amount: u, originalAmount: f } = ce(t, l);
|
|
1948
|
+
return /* @__PURE__ */ d(
|
|
1949
|
+
"button",
|
|
1950
|
+
{
|
|
1951
|
+
type: "button",
|
|
1952
|
+
role: "radio",
|
|
1953
|
+
"aria-checked": s,
|
|
1954
|
+
onClick: o,
|
|
1955
|
+
class: "group relative inline-flex w-full max-w-[360px] mx-auto items-center justify-between gap-4 px-4 pt-3.5 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--pw-accent)]",
|
|
1956
|
+
children: [
|
|
1957
|
+
/* @__PURE__ */ i(
|
|
1958
|
+
"span",
|
|
1959
|
+
{
|
|
1960
|
+
class: [
|
|
1961
|
+
"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full border transition-colors mb-3",
|
|
1962
|
+
s ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent"
|
|
1963
|
+
].join(" "),
|
|
1964
|
+
style: s ? {
|
|
1965
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
|
|
1966
|
+
} : void 0,
|
|
1967
|
+
"aria-hidden": "true",
|
|
1968
|
+
children: /* @__PURE__ */ i(
|
|
1969
|
+
"svg",
|
|
1970
|
+
{
|
|
1971
|
+
width: "14",
|
|
1972
|
+
height: "10",
|
|
1973
|
+
viewBox: "0 0 17 12",
|
|
1974
|
+
fill: "none",
|
|
1975
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1976
|
+
class: s ? "opacity-100" : "opacity-0",
|
|
1977
|
+
children: /* @__PURE__ */ i(
|
|
1978
|
+
"path",
|
|
1979
|
+
{
|
|
1980
|
+
d: "M16.5234 0.476562C16.9805 0.898438 16.9805 1.63672 16.5234 2.05859L7.52344 11.0586C7.10156 11.5156 6.36328 11.5156 5.94141 11.0586L1.44141 6.55859C0.984375 6.13672 0.984375 5.39844 1.44141 4.97656C1.86328 4.51953 2.60156 4.51953 3.02344 4.97656L6.75 8.66797L14.9414 0.476562C15.3633 0.0195312 16.1016 0.0195312 16.5234 0.476562Z",
|
|
1981
|
+
fill: "currentColor"
|
|
1982
|
+
}
|
|
1983
|
+
)
|
|
1984
|
+
}
|
|
1985
|
+
)
|
|
1986
|
+
}
|
|
1987
|
+
),
|
|
1988
|
+
/* @__PURE__ */ d(
|
|
1989
|
+
"div",
|
|
1990
|
+
{
|
|
1991
|
+
class: [
|
|
1992
|
+
"flex flex-1 items-center gap-1.5 pb-3.5",
|
|
1993
|
+
e ? "" : "border-b border-gray-200"
|
|
1994
|
+
].join(" "),
|
|
1995
|
+
children: [
|
|
1996
|
+
/* @__PURE__ */ d("div", { class: "flex flex-wrap items-center gap-1 gap-x-1.5", children: [
|
|
1997
|
+
/* @__PURE__ */ i("span", { class: "text-base font-normal capitalize text-gray-800", children: Yt(t, c) }),
|
|
1998
|
+
r ? (
|
|
1999
|
+
// Pastel brand-mix pill — точно как `badge` в TelegramPricingRadio.
|
|
2000
|
+
// Низкий visual weight: pill про "имя плана" (most popular), а не
|
|
2001
|
+
// про savings — не должна конкурировать с -X% discount-pill.
|
|
2002
|
+
/* @__PURE__ */ i(
|
|
2003
|
+
"span",
|
|
2004
|
+
{
|
|
2005
|
+
class: "rounded-[9px] px-2 py-1 text-[10px] font-bold",
|
|
2006
|
+
style: {
|
|
2007
|
+
background: "linear-gradient(160deg, color-mix(in srgb, var(--pw-accent) 6%, white) 0%, color-mix(in srgb, var(--pw-accent) 15%, white) 100%)",
|
|
2008
|
+
color: "var(--pw-accent)"
|
|
2009
|
+
},
|
|
2010
|
+
children: n
|
|
2011
|
+
}
|
|
2012
|
+
)
|
|
2013
|
+
) : null,
|
|
2014
|
+
l ? /* @__PURE__ */ d("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
|
|
2015
|
+
"-",
|
|
2016
|
+
l,
|
|
2017
|
+
"%"
|
|
2018
|
+
] }) : null
|
|
2019
|
+
] }),
|
|
2020
|
+
/* @__PURE__ */ i("div", { class: "flex-1" }),
|
|
2021
|
+
/* @__PURE__ */ d("span", { class: "flex items-baseline gap-1.5 text-base font-normal text-gray-600", children: [
|
|
2022
|
+
f ? /* @__PURE__ */ i("span", { class: "text-xs text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: f }) : null,
|
|
2023
|
+
/* @__PURE__ */ d("span", { class: "whitespace-nowrap", children: [
|
|
2024
|
+
/* @__PURE__ */ i("span", { class: "opacity-90", children: p }),
|
|
2025
|
+
u,
|
|
2026
|
+
/* @__PURE__ */ d("span", { class: "text-xs text-gray-400", children: [
|
|
2027
|
+
" ",
|
|
2028
|
+
"/ ",
|
|
2029
|
+
de(t, c)
|
|
2030
|
+
] })
|
|
2031
|
+
] })
|
|
2032
|
+
] })
|
|
2033
|
+
]
|
|
2034
|
+
}
|
|
2035
|
+
)
|
|
2036
|
+
]
|
|
2037
|
+
}
|
|
2038
|
+
);
|
|
2039
|
+
}
|
|
2040
|
+
function Jt({
|
|
2041
|
+
price: t,
|
|
2042
|
+
isPopular: e,
|
|
2043
|
+
popularLabel: r,
|
|
2044
|
+
offer: n,
|
|
2045
|
+
reserveStrikeRow: a,
|
|
2046
|
+
selected: s,
|
|
2047
|
+
onSelect: o,
|
|
2048
|
+
t: c
|
|
2049
|
+
}) {
|
|
2050
|
+
const l = n?.discount_percent ?? null, { currency: p, amount: u, originalAmount: f } = ce(t, l);
|
|
2051
|
+
return /* @__PURE__ */ d(
|
|
2052
|
+
"button",
|
|
2053
|
+
{
|
|
2054
|
+
type: "button",
|
|
2055
|
+
role: "radio",
|
|
2056
|
+
"aria-checked": s,
|
|
2057
|
+
onClick: o,
|
|
2058
|
+
class: [
|
|
2059
|
+
"group relative flex h-full flex-col items-center justify-start gap-1 rounded-2xl border-2 px-3 pb-4 pt-3.5 text-center transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2060
|
+
s ? "border-[var(--pw-accent)]" : "border-gray-200 hover:bg-gray-50"
|
|
2061
|
+
].join(" "),
|
|
2062
|
+
style: s ? { background: "color-mix(in srgb, var(--pw-accent) 6%, transparent)" } : void 0,
|
|
2063
|
+
children: [
|
|
2064
|
+
/* @__PURE__ */ i("span", { class: "flex min-h-[2.4em] items-center text-[10px] font-normal uppercase leading-tight text-gray-800/70", children: Ue(t, c) }),
|
|
2065
|
+
a ? /* @__PURE__ */ d("div", { class: "flex h-[22px] items-center justify-center gap-1.5", children: [
|
|
2066
|
+
f ? /* @__PURE__ */ i("span", { class: "text-[12px] text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: f }) : null,
|
|
2067
|
+
l ? /* @__PURE__ */ d("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
|
|
2068
|
+
"-",
|
|
2069
|
+
l,
|
|
2070
|
+
"%"
|
|
2071
|
+
] }) : null
|
|
2072
|
+
] }) : null,
|
|
2073
|
+
/* @__PURE__ */ d("span", { class: "text-[26px] leading-none whitespace-nowrap text-gray-800 font-medium", children: [
|
|
2074
|
+
/* @__PURE__ */ i("span", { class: "opacity-90", children: p }),
|
|
2075
|
+
u
|
|
2076
|
+
] }),
|
|
2077
|
+
/* @__PURE__ */ d("span", { class: "text-xs font-normal text-gray-500", children: [
|
|
2078
|
+
"/ ",
|
|
2079
|
+
de(t, c)
|
|
2080
|
+
] }),
|
|
2081
|
+
e ? /* @__PURE__ */ i(
|
|
2082
|
+
"span",
|
|
2083
|
+
{
|
|
2084
|
+
class: "absolute -top-[10px] left-1/2 -translate-x-1/2 whitespace-nowrap rounded-[11px] border-[3px] border-white px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",
|
|
2085
|
+
style: { background: "var(--pw-accent)" },
|
|
2086
|
+
children: r
|
|
2087
|
+
}
|
|
2088
|
+
) : null
|
|
2089
|
+
]
|
|
2090
|
+
}
|
|
2091
|
+
);
|
|
2092
|
+
}
|
|
2093
|
+
function Qt({ block: t }) {
|
|
2094
|
+
return /* @__PURE__ */ i("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children: t.text });
|
|
2095
|
+
}
|
|
2096
|
+
const er = {
|
|
2097
|
+
week: 0.25,
|
|
2098
|
+
month: 1,
|
|
2099
|
+
year: 12
|
|
2100
|
+
};
|
|
2101
|
+
function tr(t, e) {
|
|
2102
|
+
return t ? e(`pricing.interval.${t}`, t) : e("pricing.interval.period", "period");
|
|
2103
|
+
}
|
|
2104
|
+
function rr({ block: t, ctx: e }) {
|
|
2105
|
+
const { t: r } = S();
|
|
2106
|
+
if (!t.queries.length) return null;
|
|
2107
|
+
const a = e.bootstrap.prices.find((o) => o.id === e.selectedPriceId)?.interval ?? null, s = a ? er[a] : void 0;
|
|
2108
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col gap-2", children: [
|
|
2109
|
+
/* @__PURE__ */ i("div", { class: "text-sm font-semibold text-gray-800", children: !a || a === "lifetime" ? r("pricing.included_total", "Included for lifetime:") : r("pricing.included_per", "Included per {interval}:", {
|
|
2110
|
+
interval: tr(a, r)
|
|
2111
|
+
}) }),
|
|
2112
|
+
/* @__PURE__ */ i("ul", { class: "flex flex-col gap-2", role: "list", children: t.queries.map((o) => {
|
|
2113
|
+
const c = Number.isFinite(o.count) ? o.count : 0, l = s !== void 0 ? Math.round(c * s) : c;
|
|
2114
|
+
return /* @__PURE__ */ d("li", { class: `flex gap-3 ${o.desc ? "items-start" : "items-center"}`, children: [
|
|
2115
|
+
/* @__PURE__ */ i(
|
|
2116
|
+
"svg",
|
|
2117
|
+
{
|
|
2118
|
+
width: "18",
|
|
2119
|
+
height: "18",
|
|
2120
|
+
viewBox: "0 0 20 20",
|
|
2121
|
+
fill: "none",
|
|
2122
|
+
class: `flex-shrink-0 text-emerald-500 ${o.desc ? "mt-0.5" : ""}`,
|
|
2123
|
+
"aria-hidden": "true",
|
|
2124
|
+
children: /* @__PURE__ */ i(
|
|
2125
|
+
"path",
|
|
2126
|
+
{
|
|
2127
|
+
d: "M4 10.5l3.5 3.5 8.5-8.5",
|
|
2128
|
+
stroke: "currentColor",
|
|
2129
|
+
"stroke-width": "2.5",
|
|
2130
|
+
"stroke-linecap": "round",
|
|
2131
|
+
"stroke-linejoin": "round"
|
|
2132
|
+
}
|
|
2133
|
+
)
|
|
2134
|
+
}
|
|
2135
|
+
),
|
|
2136
|
+
/* @__PURE__ */ d("div", { children: [
|
|
2137
|
+
/* @__PURE__ */ i("span", { class: "font-semibold text-gray-900 text-sm", children: l }),
|
|
2138
|
+
" ",
|
|
2139
|
+
/* @__PURE__ */ i("span", { class: "text-sm text-gray-800", children: o.name }),
|
|
2140
|
+
o.desc ? /* @__PURE__ */ d(le, { children: [
|
|
2141
|
+
/* @__PURE__ */ i("br", {}),
|
|
2142
|
+
/* @__PURE__ */ i("span", { class: "text-xs text-gray-400", children: o.desc })
|
|
2143
|
+
] }) : null
|
|
2144
|
+
] })
|
|
2145
|
+
] }, o.id);
|
|
2146
|
+
}) })
|
|
2147
|
+
] });
|
|
2148
|
+
}
|
|
2149
|
+
const ir = {
|
|
2150
|
+
heading: Wt,
|
|
2151
|
+
text: Qt,
|
|
2152
|
+
price_grid: Kt,
|
|
2153
|
+
cta_button: Rt,
|
|
2154
|
+
auth_panel: je,
|
|
2155
|
+
current_session: Ut,
|
|
2156
|
+
features_list: Dt,
|
|
2157
|
+
tokenization_gate: rr,
|
|
2158
|
+
guarantee_badge: Nt,
|
|
2159
|
+
offer_banner: It
|
|
2160
|
+
};
|
|
2161
|
+
function nr({ layout: t, bootstrap: e, onAction: r, auth: n, authSession: a, hasTopBanner: s }) {
|
|
2162
|
+
const o = We(() => {
|
|
2163
|
+
for (const k of t.blocks)
|
|
2164
|
+
if (k.type === "price_grid" && k.popular_price_id && e.prices.some((m) => m.id === k.popular_price_id))
|
|
2165
|
+
return k.popular_price_id;
|
|
2166
|
+
return e.prices[0]?.id ?? null;
|
|
2167
|
+
}, [t.blocks, e.prices]), [c, l] = v(o), p = {
|
|
2168
|
+
bootstrap: e,
|
|
2169
|
+
selectedPriceId: c,
|
|
2170
|
+
setSelectedPriceId: l,
|
|
2171
|
+
onAction: r,
|
|
2172
|
+
auth: n,
|
|
2173
|
+
authSession: a
|
|
2174
|
+
}, u = t.blocks.findIndex((k) => k.type === "cta_button"), f = u === -1 ? t.blocks : t.blocks.slice(0, u), _ = u === -1 ? [] : t.blocks.slice(u), h = (k, m) => {
|
|
2175
|
+
const A = ir[k.type];
|
|
2176
|
+
return A ? /* @__PURE__ */ i(A, { block: k, ctx: p }, `${k.type}-${m}`) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${k.type}`), null);
|
|
2177
|
+
};
|
|
2178
|
+
return /* @__PURE__ */ d(le, { children: [
|
|
2179
|
+
/* @__PURE__ */ i("div", { class: "flex-1 min-h-0 overflow-y-auto px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8", children: /* @__PURE__ */ i("div", { class: "flex flex-col gap-6", children: f.map(h) }) }),
|
|
2180
|
+
_.length > 0 ? (
|
|
2181
|
+
// Тонкий shadow-top вместо border-t — создаёт depth, читается как
|
|
2182
|
+
// «footer закреплён к низу dialog'а». Линия выглядела как divider
|
|
2183
|
+
// в обычном flow, не передавала sticky-character.
|
|
2184
|
+
/* @__PURE__ */ i(
|
|
2185
|
+
"div",
|
|
2186
|
+
{
|
|
2187
|
+
class: "flex flex-col gap-4 bg-white px-6 pb-6 pt-3 sm:px-8",
|
|
2188
|
+
style: { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" },
|
|
2189
|
+
children: _.map((k, m) => h(k, f.length + m))
|
|
2190
|
+
}
|
|
2191
|
+
)
|
|
2192
|
+
) : null
|
|
2193
|
+
] });
|
|
2194
|
+
}
|
|
2195
|
+
function ar(t, e, r, n) {
|
|
2196
|
+
return t ? n ? { open: !0, view: "purchased", error: null, processing: !1 } : e.status === "idle" || e.status === "loading" ? { open: !0, view: "loading", error: null, processing: !1 } : e.status === "error" ? { open: !0, view: "error", error: e.error, processing: !1 } : r.kind === "support" ? { open: !0, view: "support", error: null, processing: !1 } : r.kind === "auth_gate" ? { open: !0, view: "auth", error: null, processing: !1 } : r.kind === "awaiting_payment" ? { open: !0, view: "awaiting_payment", error: null, processing: !1 } : r.kind === "popup_blocked" ? { open: !0, view: "popup_blocked", error: null, processing: !1 } : r.kind === "purchase_success" ? { open: !0, view: "purchased", error: null, processing: !1 } : r.kind === "verifying" ? { open: !0, view: "loading", error: null, processing: !1 } : { open: !0, view: "layout", error: null, processing: !1 } : { open: !1, view: null, error: null, processing: !1 };
|
|
2197
|
+
}
|
|
2198
|
+
function or(t, e) {
|
|
2199
|
+
return t.open === e.open && t.view === e.view && t.error === e.error && t.processing === e.processing;
|
|
2200
|
+
}
|
|
2201
|
+
function sr({
|
|
2202
|
+
client: t,
|
|
2203
|
+
open: e,
|
|
2204
|
+
onClose: r,
|
|
2205
|
+
onEvent: n,
|
|
2206
|
+
initialView: a,
|
|
2207
|
+
initialAuthMode: s,
|
|
2208
|
+
initialCheckoutPriceId: o,
|
|
2209
|
+
initialCheckoutUrl: c,
|
|
2210
|
+
purchased: l,
|
|
2211
|
+
renew: p,
|
|
2212
|
+
onState: u,
|
|
2213
|
+
inline: f,
|
|
2214
|
+
locale: _
|
|
2215
|
+
}) {
|
|
2216
|
+
const [h, k] = v({ status: "idle" }), [m, A] = v(
|
|
2217
|
+
() => t.auth?.getCachedSession() ?? null
|
|
2218
|
+
), [b, w] = v(() => a === "support" ? { kind: "support", origin: "standalone" } : a === "auth" ? o ? {
|
|
2219
|
+
kind: "auth_gate",
|
|
2220
|
+
pendingCheckout: { priceId: o, direct: !0 },
|
|
2221
|
+
origin: "standalone",
|
|
2222
|
+
intent: "preauth"
|
|
2223
|
+
} : { kind: "auth_gate", origin: "standalone" } : a === "awaiting_payment" && o && c ? {
|
|
2224
|
+
kind: "awaiting_payment",
|
|
2225
|
+
priceId: o,
|
|
2226
|
+
url: c
|
|
2227
|
+
} : a === "popup_blocked" && o && c ? {
|
|
2228
|
+
kind: "popup_blocked",
|
|
2229
|
+
priceId: o,
|
|
2230
|
+
url: c
|
|
2231
|
+
} : { kind: "layout" }), C = a === "awaiting_payment" || a === "popup_blocked" || a === "auth" && !!o, I = O(!1), z = O(null);
|
|
2232
|
+
j(() => {
|
|
2233
|
+
if (!u) return;
|
|
2234
|
+
const x = ar(e, h, b, l), g = z.current;
|
|
2235
|
+
g && or(g, x) || (z.current = x, u(x));
|
|
2236
|
+
}, [e, h, b, l, u]), j(() => {
|
|
2237
|
+
if (t.auth)
|
|
2238
|
+
return t.auth.onAuthChange((x, g) => A(g));
|
|
2239
|
+
}, [t.auth]), j(() => {
|
|
2240
|
+
if (typeof t.onBootstrapChange == "function")
|
|
2241
|
+
return t.onBootstrapChange((x) => {
|
|
2242
|
+
k(
|
|
2243
|
+
(g) => g.status === "ready" ? { status: "ready", data: x } : g
|
|
2244
|
+
);
|
|
2245
|
+
});
|
|
2246
|
+
}, [t]), j(() => {
|
|
2247
|
+
if (!e || h.status === "ready" || h.status === "loading") return;
|
|
2248
|
+
let x = !1;
|
|
2249
|
+
return k({ status: "loading" }), t.bootstrap().then((g) => {
|
|
2250
|
+
if (x) return;
|
|
2251
|
+
k({ status: "ready", data: g }), n("ready", g);
|
|
2252
|
+
const y = a === "support" || a === "auth" || C;
|
|
2253
|
+
g.user?.has_active_subscription && !p && !y && (n("purchase_completed", {
|
|
2254
|
+
priceId: o ?? null,
|
|
2255
|
+
sessionId: null,
|
|
2256
|
+
restored: !0
|
|
2257
|
+
}), w({ kind: "purchase_success", restored: !0 }));
|
|
2258
|
+
}).catch((g) => {
|
|
2259
|
+
if (x) return;
|
|
2260
|
+
const y = g instanceof L ? g : new L("unknown", "Failed to load paywall", { cause: g });
|
|
2261
|
+
k({ status: "error", error: y }), n("error", y);
|
|
2262
|
+
}), () => {
|
|
2263
|
+
x = !0;
|
|
2264
|
+
};
|
|
2265
|
+
}, [e, t]), Ze(() => {
|
|
2266
|
+
if (!e) {
|
|
2267
|
+
w({ kind: "layout" }), I.current = !1;
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
a === "support" ? w({ kind: "support", origin: "standalone" }) : a === "auth" ? w(o ? {
|
|
2271
|
+
kind: "auth_gate",
|
|
2272
|
+
pendingCheckout: { priceId: o, direct: !0 },
|
|
2273
|
+
origin: "standalone",
|
|
2274
|
+
intent: "preauth"
|
|
2275
|
+
} : { kind: "auth_gate", origin: "standalone" }) : a === "awaiting_payment" && o && c ? w({
|
|
2276
|
+
kind: "awaiting_payment",
|
|
2277
|
+
priceId: o,
|
|
2278
|
+
url: c
|
|
2279
|
+
}) : a === "popup_blocked" && o && c && w({
|
|
2280
|
+
kind: "popup_blocked",
|
|
2281
|
+
priceId: o,
|
|
2282
|
+
url: c
|
|
2283
|
+
});
|
|
2284
|
+
}, [e, a, o, c]);
|
|
2285
|
+
const M = async (x) => {
|
|
2286
|
+
try {
|
|
2287
|
+
const g = t.getCachedOffers?.() ?? null, y = g ? $(g, x, { readStart: N }) : null, E = await t.createCheckout({
|
|
2288
|
+
priceId: x,
|
|
2289
|
+
offerId: y?.id,
|
|
2290
|
+
ignoreActivePurchase: p === !0
|
|
2291
|
+
});
|
|
2292
|
+
if (n("checkout_started", { priceId: x, url: E.url, acquiring: E.acquiring }), typeof window > "u" || !E.url) return;
|
|
2293
|
+
const H = window.open(E.url, "_blank");
|
|
2294
|
+
if (H) {
|
|
2295
|
+
try {
|
|
2296
|
+
H.opener = null;
|
|
2297
|
+
} catch {
|
|
2298
|
+
}
|
|
2299
|
+
w({ kind: "awaiting_payment", priceId: x, url: E.url });
|
|
2300
|
+
} else
|
|
2301
|
+
w({ kind: "popup_blocked", priceId: x, url: E.url });
|
|
2302
|
+
} catch (g) {
|
|
2303
|
+
if (g instanceof L && g.code === "already_purchased") {
|
|
2304
|
+
try {
|
|
2305
|
+
await t.getUser({ force: !0 });
|
|
2306
|
+
} catch {
|
|
2307
|
+
}
|
|
2308
|
+
n("purchase_completed", { priceId: x, sessionId: null, restored: !0 }), C ? r() : w({ kind: "purchase_success", restored: !0 });
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
const y = g instanceof L ? g : new L("checkout_failed", "Checkout failed", { cause: g });
|
|
2312
|
+
n("error", y), C ? r() : w({ kind: "layout" });
|
|
2313
|
+
}
|
|
2314
|
+
}, F = (x, g) => {
|
|
2315
|
+
if (typeof window > "u") return;
|
|
2316
|
+
const y = window.open(g, "_blank");
|
|
2317
|
+
if (y) {
|
|
2318
|
+
try {
|
|
2319
|
+
y.opener = null;
|
|
2320
|
+
} catch {
|
|
2321
|
+
}
|
|
2322
|
+
w({ kind: "awaiting_payment", priceId: x, url: g });
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2325
|
+
j(() => {
|
|
2326
|
+
if (b.kind !== "auth_gate" || !m || m.user.is_anonymous || I.current) return;
|
|
2327
|
+
I.current = !0;
|
|
2328
|
+
const x = b.pendingCheckout, g = b.origin;
|
|
2329
|
+
w({ kind: "verifying" }), (async () => {
|
|
2330
|
+
if (!p)
|
|
2331
|
+
try {
|
|
2332
|
+
if ((await t.getUser({ force: !0 })).has_active_subscription) {
|
|
2333
|
+
n("purchase_completed", {
|
|
2334
|
+
priceId: x?.priceId ?? null,
|
|
2335
|
+
sessionId: null,
|
|
2336
|
+
restored: !0
|
|
2337
|
+
}), x?.direct ? r() : w({ kind: "purchase_success", restored: !0 });
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
} catch {
|
|
2341
|
+
}
|
|
2342
|
+
if (!x) {
|
|
2343
|
+
g === "standalone" ? r() : w({ kind: "layout" });
|
|
2344
|
+
return;
|
|
2345
|
+
}
|
|
2346
|
+
await M(x.priceId);
|
|
2347
|
+
})().finally(() => {
|
|
2348
|
+
I.current = !1;
|
|
2349
|
+
});
|
|
2350
|
+
}, [m, b]);
|
|
2351
|
+
const D = async (x, g) => {
|
|
2352
|
+
if (x === "close") {
|
|
2353
|
+
r();
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
if (x === "price_selected") {
|
|
2357
|
+
n("price_selected", g);
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
if (x === "restore") {
|
|
2361
|
+
if (!t.auth) return;
|
|
2362
|
+
const y = t.auth.getCachedSession();
|
|
2363
|
+
if (y && !y.user.is_anonymous) return;
|
|
2364
|
+
w({ kind: "auth_gate", intent: "restore" });
|
|
2365
|
+
return;
|
|
2366
|
+
}
|
|
2367
|
+
if (x === "support") {
|
|
2368
|
+
w({ kind: "support", origin: "layout" });
|
|
2369
|
+
return;
|
|
2370
|
+
}
|
|
2371
|
+
if (x === "checkout" && h.status === "ready") {
|
|
2372
|
+
const y = g?.priceId;
|
|
2373
|
+
if (!y) {
|
|
2374
|
+
n("error", new L("no_price", "No price selected"));
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
const E = h.data.settings.checkout_mode ?? "guest", H = t.auth?.getCachedSession() ?? null, De = !!H && !H.user.is_anonymous;
|
|
2378
|
+
if (E === "preauth" && !!t.auth && !De) {
|
|
2379
|
+
w({ kind: "auth_gate", pendingCheckout: { priceId: y } });
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
await M(y);
|
|
2383
|
+
}
|
|
2384
|
+
}, R = h.status === "ready" ? h.data.settings.brand_color : null, P = h.status === "ready" ? h.data.settings.allow_close !== !1 : !0, U = b.kind === "layout" && h.status === "ready" ? Be(h.data.offers) : null, B = U ? /* @__PURE__ */ i(At, { offer: U }) : null, K = {
|
|
2385
|
+
type: "auth_panel",
|
|
2386
|
+
// Заголовок не задаём — AuthGate сам решит по intent'у (restore →
|
|
2387
|
+
// "Restore Purchases", остальные → дефолтный "Welcome back!").
|
|
2388
|
+
allow_signup: !0,
|
|
2389
|
+
allow_password_reset: !0,
|
|
2390
|
+
// Не скрываем при наличии сессии — auto-resume useEffect отрабатывает быстрее,
|
|
2391
|
+
// чем хотим показывать "Signed in as ..." промежуточным экраном.
|
|
2392
|
+
hide_when_authenticated: !1,
|
|
2393
|
+
providers: h.status === "ready" ? h.data.settings.auth_providers : void 0
|
|
2394
|
+
}, q = b.kind === "support" ? /* @__PURE__ */ i(
|
|
2395
|
+
Tt,
|
|
2396
|
+
{
|
|
2397
|
+
client: t,
|
|
2398
|
+
authSession: m,
|
|
2399
|
+
origin: b.origin,
|
|
2400
|
+
onBack: () => {
|
|
2401
|
+
b.origin === "standalone" ? r() : w({ kind: "layout" });
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
) : null, Y = b.kind === "auth_gate" && b.origin !== "standalone" || b.kind === "support", X = h.status === "ready" ? h.data : null;
|
|
2405
|
+
return /* @__PURE__ */ i(nt, { bootstrap: X, forceLocale: _, children: /* @__PURE__ */ i(
|
|
2406
|
+
at,
|
|
2407
|
+
{
|
|
2408
|
+
open: e,
|
|
2409
|
+
onClose: r,
|
|
2410
|
+
brandColor: R,
|
|
2411
|
+
topBanner: B,
|
|
2412
|
+
allowClose: P,
|
|
2413
|
+
hideCloseButton: Y,
|
|
2414
|
+
inline: f,
|
|
2415
|
+
labelledBy: "pw-title",
|
|
2416
|
+
children: l ? /* @__PURE__ */ i(Ce, { onContinue: r }) : b.kind === "purchase_success" ? /* @__PURE__ */ i(Ce, { restored: b.restored, onContinue: r }) : q || (h.status === "loading" || h.status === "idle" || b.kind === "verifying" ? /* @__PURE__ */ i(lr, { verifying: b.kind === "verifying" }) : h.status === "error" ? /* @__PURE__ */ i(cr, { message: h.error.message }) : b.kind === "auth_gate" && t.auth ? /* @__PURE__ */ i(
|
|
2417
|
+
kt,
|
|
2418
|
+
{
|
|
2419
|
+
block: K,
|
|
2420
|
+
bootstrap: h.data,
|
|
2421
|
+
auth: t.auth,
|
|
2422
|
+
authSession: m,
|
|
2423
|
+
showBack: b.origin !== "standalone",
|
|
2424
|
+
intent: b.intent ?? (b.origin === "standalone" ? "standalone" : "preauth"),
|
|
2425
|
+
initialMode: b.origin === "standalone" ? s : void 0,
|
|
2426
|
+
onBack: () => {
|
|
2427
|
+
b.origin === "standalone" ? r() : w({ kind: "layout" });
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
) : b.kind === "awaiting_payment" ? /* @__PURE__ */ i(
|
|
2431
|
+
ur,
|
|
2432
|
+
{
|
|
2433
|
+
client: t,
|
|
2434
|
+
onBack: () => w({ kind: "layout" }),
|
|
2435
|
+
onReopen: () => {
|
|
2436
|
+
if (typeof window > "u") return;
|
|
2437
|
+
const x = window.open(b.url, "_blank");
|
|
2438
|
+
if (x)
|
|
2439
|
+
try {
|
|
2440
|
+
x.opener = null;
|
|
2441
|
+
} catch {
|
|
2442
|
+
}
|
|
2443
|
+
},
|
|
2444
|
+
onRetry: () => M(b.priceId)
|
|
2445
|
+
}
|
|
2446
|
+
) : b.kind === "popup_blocked" ? /* @__PURE__ */ i(dr, { onReopen: () => F(b.priceId, b.url) }) : /* @__PURE__ */ i(
|
|
2447
|
+
nr,
|
|
2448
|
+
{
|
|
2449
|
+
layout: h.data.layout,
|
|
2450
|
+
bootstrap: h.data,
|
|
2451
|
+
onAction: D,
|
|
2452
|
+
auth: t.auth,
|
|
2453
|
+
authSession: m
|
|
2454
|
+
}
|
|
2455
|
+
))
|
|
2456
|
+
}
|
|
2457
|
+
) });
|
|
2458
|
+
}
|
|
2459
|
+
function lr({ verifying: t }) {
|
|
2460
|
+
const { t: e } = S();
|
|
2461
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
|
|
2462
|
+
/* @__PURE__ */ i("span", { class: "inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" }),
|
|
2463
|
+
/* @__PURE__ */ i("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: t ? e("modal.verifying_subscription", "Checking your subscription…") : e("modal.loading", "Loading…") })
|
|
2464
|
+
] });
|
|
2465
|
+
}
|
|
2466
|
+
function cr({ message: t }) {
|
|
2467
|
+
const { t: e } = S();
|
|
2468
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
2469
|
+
/* @__PURE__ */ i("div", { class: "flex h-11 w-11 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ d("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
2470
|
+
/* @__PURE__ */ i("path", { d: "M10 6v5M10 14h.01", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round" }),
|
|
2471
|
+
/* @__PURE__ */ i("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
|
|
2472
|
+
] }) }),
|
|
2473
|
+
/* @__PURE__ */ i("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: e("modal.error_generic", "Something went wrong") }),
|
|
2474
|
+
/* @__PURE__ */ i("p", { class: "text-xs leading-relaxed text-gray-500", children: t })
|
|
2475
|
+
] });
|
|
2476
|
+
}
|
|
2477
|
+
function dr({ onReopen: t }) {
|
|
2478
|
+
const { t: e } = S();
|
|
2479
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
2480
|
+
/* @__PURE__ */ i(
|
|
2481
|
+
"div",
|
|
2482
|
+
{
|
|
2483
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
2484
|
+
style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
|
|
2485
|
+
"aria-hidden": "true",
|
|
2486
|
+
children: /* @__PURE__ */ d("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "none", children: [
|
|
2487
|
+
/* @__PURE__ */ i(
|
|
2488
|
+
"path",
|
|
2489
|
+
{
|
|
2490
|
+
d: "M14 4h6v6",
|
|
2491
|
+
stroke: "currentColor",
|
|
2492
|
+
"stroke-width": "2",
|
|
2493
|
+
"stroke-linecap": "round",
|
|
2494
|
+
"stroke-linejoin": "round"
|
|
2495
|
+
}
|
|
2496
|
+
),
|
|
2497
|
+
/* @__PURE__ */ i(
|
|
2498
|
+
"path",
|
|
2499
|
+
{
|
|
2500
|
+
d: "M20 4l-9 9",
|
|
2501
|
+
stroke: "currentColor",
|
|
2502
|
+
"stroke-width": "2",
|
|
2503
|
+
"stroke-linecap": "round",
|
|
2504
|
+
"stroke-linejoin": "round"
|
|
2505
|
+
}
|
|
2506
|
+
),
|
|
2507
|
+
/* @__PURE__ */ i(
|
|
2508
|
+
"path",
|
|
2509
|
+
{
|
|
2510
|
+
d: "M19 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",
|
|
2511
|
+
stroke: "currentColor",
|
|
2512
|
+
"stroke-width": "2",
|
|
2513
|
+
"stroke-linecap": "round",
|
|
2514
|
+
"stroke-linejoin": "round"
|
|
2515
|
+
}
|
|
2516
|
+
)
|
|
2517
|
+
] })
|
|
2518
|
+
}
|
|
2519
|
+
),
|
|
2520
|
+
/* @__PURE__ */ i(
|
|
2521
|
+
"p",
|
|
2522
|
+
{
|
|
2523
|
+
id: "pw-title",
|
|
2524
|
+
class: "mt-1 text-lg font-semibold tracking-tight text-gray-900",
|
|
2525
|
+
children: e("payment.popup_blocked_title", "Allow popups to continue")
|
|
2526
|
+
}
|
|
2527
|
+
),
|
|
2528
|
+
/* @__PURE__ */ i("p", { class: "max-w-[20rem] text-sm leading-relaxed text-gray-500", children: e("payment.popup_blocked_message", "Your browser blocked the checkout tab. Click below to open it.") }),
|
|
2529
|
+
/* @__PURE__ */ i(
|
|
2530
|
+
"button",
|
|
2531
|
+
{
|
|
2532
|
+
type: "button",
|
|
2533
|
+
onClick: t,
|
|
2534
|
+
class: "mt-3 rounded-xl px-5 py-2.5 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2535
|
+
style: {
|
|
2536
|
+
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
2537
|
+
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
2538
|
+
},
|
|
2539
|
+
children: e("payment.open_checkout_button", "Open checkout")
|
|
2540
|
+
}
|
|
2541
|
+
)
|
|
2542
|
+
] });
|
|
2543
|
+
}
|
|
2544
|
+
function ur({
|
|
2545
|
+
client: t,
|
|
2546
|
+
onBack: e,
|
|
2547
|
+
onReopen: r,
|
|
2548
|
+
onRetry: n
|
|
2549
|
+
}) {
|
|
2550
|
+
const { t: a } = S(), [s, o] = v(!1), [c, l] = v(!1), p = O(null);
|
|
2551
|
+
j(() => () => {
|
|
2552
|
+
p.current !== null && clearTimeout(p.current);
|
|
2553
|
+
}, []);
|
|
2554
|
+
const u = async () => {
|
|
2555
|
+
if (!s) {
|
|
2556
|
+
o(!0), l(!1);
|
|
2557
|
+
try {
|
|
2558
|
+
if ((await t.getUser({ force: !0 })).has_active_subscription) {
|
|
2559
|
+
typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
|
|
2560
|
+
return;
|
|
2561
|
+
}
|
|
2562
|
+
l(!0), p.current !== null && clearTimeout(p.current), p.current = setTimeout(() => {
|
|
2563
|
+
l(!1), p.current = null;
|
|
2564
|
+
}, 5e3);
|
|
2565
|
+
} catch {
|
|
2566
|
+
l(!0);
|
|
2567
|
+
} finally {
|
|
2568
|
+
o(!1);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
};
|
|
2572
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col gap-3 px-6 pb-6 pt-4 sm:px-8 sm:pb-8 sm:pt-5", children: [
|
|
2573
|
+
/* @__PURE__ */ i(
|
|
2574
|
+
"button",
|
|
2575
|
+
{
|
|
2576
|
+
type: "button",
|
|
2577
|
+
onClick: e,
|
|
2578
|
+
class: "-ml-1 self-start rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2579
|
+
children: a("nav.back", "← Back")
|
|
2580
|
+
}
|
|
2581
|
+
),
|
|
2582
|
+
/* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-3 py-6 text-center", children: [
|
|
2583
|
+
/* @__PURE__ */ d("div", { class: "relative flex h-14 w-14 items-center justify-center", children: [
|
|
2584
|
+
/* @__PURE__ */ i(
|
|
2585
|
+
"span",
|
|
2586
|
+
{
|
|
2587
|
+
class: "absolute inset-0 animate-ping rounded-full opacity-40",
|
|
2588
|
+
style: { background: "color-mix(in srgb, var(--pw-accent) 30%, transparent)" },
|
|
2589
|
+
"aria-hidden": "true"
|
|
2590
|
+
}
|
|
2591
|
+
),
|
|
2592
|
+
/* @__PURE__ */ i("span", { class: "relative inline-block h-8 w-8 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" })
|
|
2593
|
+
] }),
|
|
2594
|
+
/* @__PURE__ */ i(
|
|
2595
|
+
"p",
|
|
2596
|
+
{
|
|
2597
|
+
id: "pw-title",
|
|
2598
|
+
class: "mt-1 text-lg font-semibold tracking-tight text-gray-900",
|
|
2599
|
+
children: a("payment.awaiting_title", "Complete payment in the new tab")
|
|
2600
|
+
}
|
|
2601
|
+
),
|
|
2602
|
+
/* @__PURE__ */ i("p", { class: "max-w-[22rem] text-sm leading-relaxed text-gray-500", children: a(
|
|
2603
|
+
"payment.awaiting_subtitle",
|
|
2604
|
+
"We'll detect your payment automatically — or click below once you're done."
|
|
2605
|
+
) }),
|
|
2606
|
+
/* @__PURE__ */ i(
|
|
2607
|
+
"button",
|
|
2608
|
+
{
|
|
2609
|
+
type: "button",
|
|
2610
|
+
onClick: u,
|
|
2611
|
+
disabled: s,
|
|
2612
|
+
class: "mt-3 rounded-xl px-5 py-2.5 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:brightness-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2613
|
+
style: {
|
|
2614
|
+
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
2615
|
+
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
2616
|
+
},
|
|
2617
|
+
children: s ? a("payment.checking", "Checking…") : a("payment.ive_paid", "I've paid")
|
|
2618
|
+
}
|
|
2619
|
+
),
|
|
2620
|
+
c ? /* @__PURE__ */ i("p", { class: "text-xs leading-relaxed text-gray-500", children: a("payment.still_processing", "Payment is still being processed. Please try again in a moment.") }) : null
|
|
2621
|
+
] }),
|
|
2622
|
+
/* @__PURE__ */ d("div", { class: "rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5", children: [
|
|
2623
|
+
/* @__PURE__ */ i("p", { class: "text-xs leading-relaxed text-gray-600", children: a("payment.popup_help_text", "Checkout window didn't open or got blocked? Click here to open it again.") }),
|
|
2624
|
+
/* @__PURE__ */ i(
|
|
2625
|
+
"button",
|
|
2626
|
+
{
|
|
2627
|
+
type: "button",
|
|
2628
|
+
onClick: r,
|
|
2629
|
+
class: "mt-2.5 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2630
|
+
children: a("payment.open_checkout_again", "Open checkout again")
|
|
2631
|
+
}
|
|
2632
|
+
)
|
|
2633
|
+
] }),
|
|
2634
|
+
/* @__PURE__ */ i(
|
|
2635
|
+
"button",
|
|
2636
|
+
{
|
|
2637
|
+
type: "button",
|
|
2638
|
+
onClick: n,
|
|
2639
|
+
class: "self-center rounded-md px-2 py-1 text-xs text-gray-500 underline-offset-2 hover:text-gray-900 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2640
|
+
children: a("payment.tab_closed_retry", "Tab closed? Try again")
|
|
2641
|
+
}
|
|
2642
|
+
)
|
|
2643
|
+
] });
|
|
2644
|
+
}
|
|
2645
|
+
function Ce({
|
|
2646
|
+
onContinue: t,
|
|
2647
|
+
restored: e = !1
|
|
2648
|
+
}) {
|
|
2649
|
+
const { t: r } = S();
|
|
2650
|
+
return /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-4 py-6 text-center", children: [
|
|
2651
|
+
/* @__PURE__ */ i(
|
|
2652
|
+
"div",
|
|
2653
|
+
{
|
|
2654
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
2655
|
+
style: {
|
|
2656
|
+
background: "linear-gradient(135deg, #4ade80, #16a34a)",
|
|
2657
|
+
color: "#fff",
|
|
2658
|
+
boxShadow: "0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"
|
|
2659
|
+
},
|
|
2660
|
+
"aria-hidden": "true",
|
|
2661
|
+
children: /* @__PURE__ */ i("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ i(
|
|
2662
|
+
"path",
|
|
2663
|
+
{
|
|
2664
|
+
d: "M5 13l4 4L19 7",
|
|
2665
|
+
stroke: "currentColor",
|
|
2666
|
+
"stroke-width": "2.5",
|
|
2667
|
+
"stroke-linecap": "round",
|
|
2668
|
+
"stroke-linejoin": "round"
|
|
2669
|
+
}
|
|
2670
|
+
) })
|
|
2671
|
+
}
|
|
2672
|
+
),
|
|
2673
|
+
/* @__PURE__ */ i("p", { id: "pw-title", class: "mt-1 text-3xl font-bold tracking-tight text-gray-900", children: e ? r("modal.purchase_restored_title", "Subscription restored") : r("modal.purchase_success_title", "Payment received") }),
|
|
2674
|
+
/* @__PURE__ */ i("p", { class: "text-base leading-relaxed text-gray-600", children: e ? r(
|
|
2675
|
+
"modal.purchase_restored_subtitle",
|
|
2676
|
+
"Welcome back — your subscription is already active."
|
|
2677
|
+
) : r("modal.purchase_success_subtitle", "Your subscription is now active.") }),
|
|
2678
|
+
/* @__PURE__ */ i(
|
|
2679
|
+
"button",
|
|
2680
|
+
{
|
|
2681
|
+
type: "button",
|
|
2682
|
+
onClick: t,
|
|
2683
|
+
class: "pw-cta-shimmer relative mt-2 flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2684
|
+
style: {
|
|
2685
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
|
|
2686
|
+
boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
|
|
2687
|
+
},
|
|
2688
|
+
children: /* @__PURE__ */ i("span", { class: "relative z-10", children: r("modal.continue", "Continue") })
|
|
2689
|
+
}
|
|
2690
|
+
)
|
|
2691
|
+
] });
|
|
2692
|
+
}
|
|
2693
|
+
const pr = 10 * 6e4, hr = 5e3, gr = 3e4;
|
|
2694
|
+
class fr {
|
|
2695
|
+
constructor(e) {
|
|
2696
|
+
this.timer = null, this.timeoutTimer = null, this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null, this.stopped = !1, this.checking = !1, this.opts = {
|
|
2697
|
+
client: e.client,
|
|
2698
|
+
onActive: e.onActive,
|
|
2699
|
+
onTimeout: e.onTimeout ?? (() => {
|
|
2700
|
+
}),
|
|
2701
|
+
timeoutMs: e.timeoutMs ?? pr,
|
|
2702
|
+
visibleIntervalMs: e.visibleIntervalMs ?? hr,
|
|
2703
|
+
hiddenIntervalMs: e.hiddenIntervalMs ?? gr
|
|
2704
|
+
};
|
|
2705
|
+
}
|
|
2706
|
+
start() {
|
|
2707
|
+
this.stopped || typeof document > "u" || typeof window > "u" || (this.check(), this.scheduleNext(), this.visibilityHandler = () => this.handleVisibilityChange(), document.addEventListener("visibilitychange", this.visibilityHandler), this.focusHandler = () => void this.check(), window.addEventListener("focus", this.focusHandler), this.messageHandler = (e) => this.handleMessage(e), window.addEventListener("message", this.messageHandler), this.timeoutTimer = setTimeout(() => {
|
|
2708
|
+
this.stopped || (this.stop(), this.opts.onTimeout());
|
|
2709
|
+
}, this.opts.timeoutMs));
|
|
2710
|
+
}
|
|
2711
|
+
stop() {
|
|
2712
|
+
this.stopped = !0, this.timer !== null && clearTimeout(this.timer), this.timer = null, this.timeoutTimer !== null && clearTimeout(this.timeoutTimer), this.timeoutTimer = null, typeof document < "u" && this.visibilityHandler && document.removeEventListener("visibilitychange", this.visibilityHandler), typeof window < "u" && (this.focusHandler && window.removeEventListener("focus", this.focusHandler), this.messageHandler && window.removeEventListener("message", this.messageHandler)), this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null;
|
|
2713
|
+
}
|
|
2714
|
+
async check() {
|
|
2715
|
+
if (!(this.stopped || this.checking)) {
|
|
2716
|
+
this.checking = !0;
|
|
2717
|
+
try {
|
|
2718
|
+
const e = await this.opts.client.getUser({ force: !0 });
|
|
2719
|
+
if (this.stopped) return;
|
|
2720
|
+
e.has_active_subscription && (this.stop(), this.opts.onActive(e));
|
|
2721
|
+
} catch {
|
|
2722
|
+
} finally {
|
|
2723
|
+
this.checking = !1;
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
scheduleNext() {
|
|
2728
|
+
if (this.stopped) return;
|
|
2729
|
+
const r = typeof document < "u" && document.visibilityState === "visible" ? this.opts.visibleIntervalMs : this.opts.hiddenIntervalMs;
|
|
2730
|
+
this.timer = setTimeout(async () => {
|
|
2731
|
+
await this.check(), this.scheduleNext();
|
|
2732
|
+
}, r);
|
|
2733
|
+
}
|
|
2734
|
+
handleVisibilityChange() {
|
|
2735
|
+
typeof document > "u" || (document.visibilityState === "visible" && this.check(), this.timer !== null && (clearTimeout(this.timer), this.timer = null), this.scheduleNext());
|
|
2736
|
+
}
|
|
2737
|
+
handleMessage(e) {
|
|
2738
|
+
const r = e.data;
|
|
2739
|
+
!r || typeof r != "object" || r.type === "paywall_purchase" && this.check();
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
function mr() {
|
|
2743
|
+
return !(typeof document > "u" || typeof window > "u" || typeof location < "u" && location.protocol === "chrome-extension:");
|
|
2744
|
+
}
|
|
2745
|
+
const se = {
|
|
2746
|
+
open: !1,
|
|
2747
|
+
view: null,
|
|
2748
|
+
error: null,
|
|
2749
|
+
processing: !1
|
|
2750
|
+
}, V = {
|
|
2751
|
+
status: "paywall_status",
|
|
2752
|
+
priceId: "paywall_price_id",
|
|
2753
|
+
sessionId: "paywall_session_id"
|
|
2754
|
+
};
|
|
2755
|
+
class Mr {
|
|
2756
|
+
constructor(e) {
|
|
2757
|
+
this.handle = null, this.isOpen = !1, this.listeners = /* @__PURE__ */ new Map(), this.userUnsub = null, this.authUnsub = null, this.watcher = null, this.tracker = null, this.purchased = !1, this.lastMountedView = null, this.trialStore = null, this.trialStoreConfig = null, this.lastTrialStatus = null, this.trialExpiredFired = !1, this.lastVisibility = null, this.currentState = se, this.stateListeners = /* @__PURE__ */ new Set();
|
|
2758
|
+
const { auth: r, ownsAuth: n } = wr(e);
|
|
2759
|
+
this.auth = r, this.ownsAuth = n, this.billing = e.client ?? new Ne({ ...e, auth: this.auth }), this.host = e.host, this.shadowMode = e.shadowMode ?? "closed", this.mountThenLoad = e.mountThenLoad ?? !0, this.inline = e.inline === !0, this.forceLocale = e.locale ?? null, this.userUnsub = this.billing.onUserChange((a) => {
|
|
2760
|
+
this.emit("userChange", a);
|
|
2761
|
+
}), this.auth && (this.authUnsub = this.auth.onAuthChange((a, s) => {
|
|
2762
|
+
this.emit("authChange", { event: a, session: s });
|
|
2763
|
+
})), this.initTracker(e.analytics), e.autoDetectReturn !== !1 && typeof window < "u" && queueMicrotask(() => this.checkReturn());
|
|
2764
|
+
}
|
|
2765
|
+
initTracker(e) {
|
|
2766
|
+
if (e === !1) return;
|
|
2767
|
+
const r = typeof e == "object" && e !== null ? e : {};
|
|
2768
|
+
if (r.enabled === !1) return;
|
|
2769
|
+
const n = r.endpoint ?? `${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;
|
|
2770
|
+
this.tracker = new Ve({
|
|
2771
|
+
endpoint: n,
|
|
2772
|
+
paywallId: this.billing.paywallId,
|
|
2773
|
+
capabilities: this.billing.capabilities,
|
|
2774
|
+
getVisitorId: () => this.billing.getVisitorId(),
|
|
2775
|
+
getCachedVisitorId: () => this.billing.getCachedVisitorId(),
|
|
2776
|
+
getUserId: () => this.billing.getIdentity()?.userId ?? null,
|
|
2777
|
+
flushIntervalMs: r.flushIntervalMs,
|
|
2778
|
+
maxBufferSize: r.maxBufferSize,
|
|
2779
|
+
fetch: r.fetch,
|
|
2780
|
+
sendBeacon: r.sendBeacon
|
|
2781
|
+
}), this.on("open", () => {
|
|
2782
|
+
this.lastMountedView === "layout" && this.tracker?.track("paywall_opened");
|
|
2783
|
+
}), this.on("ready", (a) => {
|
|
2784
|
+
this.lastMountedView === "layout" && this.tracker?.track("paywall_viewed", {
|
|
2785
|
+
is_test_mode: a.settings.is_test_mode,
|
|
2786
|
+
prices_count: a.prices.length,
|
|
2787
|
+
offers_count: a.offers.length
|
|
2788
|
+
});
|
|
2789
|
+
}), this.on(
|
|
2790
|
+
"price_selected",
|
|
2791
|
+
(a) => this.tracker?.track("price_selected", { price_id: a.priceId })
|
|
2792
|
+
), this.on(
|
|
2793
|
+
"checkout_started",
|
|
2794
|
+
(a) => this.tracker?.track("checkout_started", {
|
|
2795
|
+
price_id: a.priceId,
|
|
2796
|
+
acquiring: a.acquiring
|
|
2797
|
+
})
|
|
2798
|
+
), this.on(
|
|
2799
|
+
"purchase_completed",
|
|
2800
|
+
(a) => this.tracker?.track("purchase_completed", {
|
|
2801
|
+
price_id: a.priceId,
|
|
2802
|
+
session_id: a.sessionId
|
|
2803
|
+
})
|
|
2804
|
+
), this.on(
|
|
2805
|
+
"purchase_failed",
|
|
2806
|
+
(a) => this.tracker?.track("purchase_failed", { reason: a.reason })
|
|
2807
|
+
), this.on("close", () => {
|
|
2808
|
+
this.lastMountedView === "layout" && this.tracker?.track("paywall_closed");
|
|
2809
|
+
}), this.on(
|
|
2810
|
+
"trial_blocked",
|
|
2811
|
+
(a) => this.tracker?.track("trial_blocked", {
|
|
2812
|
+
mode: a.mode,
|
|
2813
|
+
...a.mode === "time" ? { remaining_ms: a.remainingMs, total_ms: a.totalMs } : a.mode === "opens" ? { remaining_actions: a.remainingActions, total_actions: a.totalActions } : {}
|
|
2814
|
+
})
|
|
2815
|
+
), this.on("trial_expired", () => this.tracker?.track("trial_expired")), this.on(
|
|
2816
|
+
"visibility_blocked",
|
|
2817
|
+
(a) => this.tracker?.track("visibility_blocked", {
|
|
2818
|
+
reason: a.reason,
|
|
2819
|
+
country: a.country,
|
|
2820
|
+
tier: a.tier
|
|
2821
|
+
})
|
|
2822
|
+
), this.on(
|
|
2823
|
+
"error",
|
|
2824
|
+
(a) => this.tracker?.track("error", { code: a.code, message: a.message })
|
|
2825
|
+
);
|
|
2826
|
+
}
|
|
2827
|
+
/**
|
|
2828
|
+
* Отправить произвольное аналитическое событие. Имена из системного whitelist'а
|
|
2829
|
+
* (`app_opened`, `paywall_viewed`, ...) разрешены как есть. Кастомные —
|
|
2830
|
+
* с префиксом `host:` (например `host:user_clicked_upgrade`). Сервер
|
|
2831
|
+
* дропает события с неразрешёнными именами.
|
|
2832
|
+
*
|
|
2833
|
+
* Самый частый кейс — `track('app_opened')` от хоста сразу после загрузки
|
|
2834
|
+
* приложения, чтобы зафиксировать воронку до открытия пейвола.
|
|
2835
|
+
*/
|
|
2836
|
+
track(e, r) {
|
|
2837
|
+
this.tracker?.track(e, r);
|
|
2838
|
+
}
|
|
2839
|
+
/**
|
|
2840
|
+
* Удобный шорткат вместо `paywall.on('userChange', cb)` — самый частый
|
|
2841
|
+
* паттерн в host-коде, поэтому отдельный named метод. Колбек получает
|
|
2842
|
+
* last-known user из кеша синхронно через microtask, если он есть.
|
|
2843
|
+
*/
|
|
2844
|
+
onUserChange(e) {
|
|
2845
|
+
return this.on("userChange", e);
|
|
2846
|
+
}
|
|
2847
|
+
/**
|
|
2848
|
+
* Заменить cachedBootstrap живыми данными — для preview-режима в редакторе
|
|
2849
|
+
* админки. Если модалка открыта, PaywallRoot подписан на onBootstrapChange
|
|
2850
|
+
* и перерендерится мгновенно. До open() — затравка для bootstrap()-effect'а.
|
|
2851
|
+
*
|
|
2852
|
+
* См. {@link BillingClientOptions.preview} — обычно эту опцию ставят на
|
|
2853
|
+
* клиент, чтобы заодно отключить сетевой revalidate. setBootstrap технически
|
|
2854
|
+
* работает и в production-режиме, но конкуренция с revalidate'ом из сети
|
|
2855
|
+
* почти всегда нежелательна.
|
|
2856
|
+
*/
|
|
2857
|
+
setBootstrap(e) {
|
|
2858
|
+
this.billing.setBootstrap(e);
|
|
2859
|
+
}
|
|
2860
|
+
/**
|
|
2861
|
+
* Сменить force-locale на лету — для live-preview редактора админки, когда
|
|
2862
|
+
* юзер переключает «Preview as user from <country>». Грузит соответствующий
|
|
2863
|
+
* static-чанк и форсит re-render через handle.update. См. PaywallUIOptions.locale.
|
|
2864
|
+
*
|
|
2865
|
+
* Передай `null`/`undefined`, чтобы вернуть автоматическую резолв-логику
|
|
2866
|
+
* (navigator.language → locale_default).
|
|
2867
|
+
*/
|
|
2868
|
+
setLocale(e) {
|
|
2869
|
+
const r = e ?? null;
|
|
2870
|
+
r !== this.forceLocale && (this.forceLocale = r, this.handle && this.handle.update({ locale: r }));
|
|
2871
|
+
}
|
|
2872
|
+
on(e, r) {
|
|
2873
|
+
let n = this.listeners.get(e);
|
|
2874
|
+
return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(r), () => n.delete(r);
|
|
2875
|
+
}
|
|
2876
|
+
off(e, r) {
|
|
2877
|
+
this.listeners.get(e)?.delete(r);
|
|
2878
|
+
}
|
|
2879
|
+
emit(e, ...r) {
|
|
2880
|
+
const n = this.listeners.get(e);
|
|
2881
|
+
if (!n) return;
|
|
2882
|
+
const a = r[0];
|
|
2883
|
+
for (const s of n)
|
|
2884
|
+
try {
|
|
2885
|
+
s(a);
|
|
2886
|
+
} catch (o) {
|
|
2887
|
+
typeof console < "u" && console.error("[paywall] listener error", o);
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
open(e = {}) {
|
|
2891
|
+
this.openInternal("layout", e);
|
|
2892
|
+
}
|
|
2893
|
+
/**
|
|
2894
|
+
* Прогревает bootstrap-кеш и balance-кеш заранее, без открытия модалки.
|
|
2895
|
+
* Полезно когда host знает, что юзер скоро откроет paywall (hover на CTA,
|
|
2896
|
+
* mount компонента) — первый `open()` рендерится мгновенно, без loading-flash.
|
|
2897
|
+
*
|
|
2898
|
+
* Не throw'ает: если сеть упала, тихо игнорирует (повторный open() сделает
|
|
2899
|
+
* fresh-bootstrap с error-state как обычно). `signal` для отмены — например,
|
|
2900
|
+
* если хост размонтирует компонент быстрее, чем bootstrap вернётся.
|
|
2901
|
+
*
|
|
2902
|
+
* Вызывать можно сколько угодно раз — последующие вызовы возвращают cached
|
|
2903
|
+
* Promise (BillingClient уже дедуплицирует).
|
|
2904
|
+
*/
|
|
2905
|
+
async preload(e = {}) {
|
|
2906
|
+
try {
|
|
2907
|
+
await this.billing.bootstrap({ signal: e.signal }), this.billing.auth && await this.billing.getBalances({ signal: e.signal });
|
|
2908
|
+
} catch {
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
/**
|
|
2912
|
+
* Открывает модалку сразу с саппорт-формой (минуя layout с тарифами).
|
|
2913
|
+
* Полезно, когда host-приложение хочет дать юзеру кнопку «Help / Support»,
|
|
2914
|
+
* не связанную с пейволом-апгрейдом. Back/Done в саппорт-форме закрывают
|
|
2915
|
+
* модалку (не возвращают к тарифам), потому что юзер пришёл сюда напрямую.
|
|
2916
|
+
*
|
|
2917
|
+
* Из обычного `paywall.open()`-flow саппорт всё равно доступен через
|
|
2918
|
+
* Contact Support-ссылку в `current_session`-блоке (там Back возвращает
|
|
2919
|
+
* к layout).
|
|
2920
|
+
*/
|
|
2921
|
+
openSupport(e = {}) {
|
|
2922
|
+
this.openInternal("support", e);
|
|
2923
|
+
}
|
|
2924
|
+
/**
|
|
2925
|
+
* Открывает модалку сразу с auth-gate (логин/регистрация), без layout с
|
|
2926
|
+
* тарифами. Сценарий: returning customer уже купил, ему просто нужно
|
|
2927
|
+
* залогиниться, чтобы SDK подцепил его purchases. После signIn модалка
|
|
2928
|
+
* закрывается; Back тоже закрывает (юзер пришёл только за логином).
|
|
2929
|
+
*
|
|
2930
|
+
* Без `auth` (managed-auth не подключён) метод — no-op: некому делать
|
|
2931
|
+
* signIn. Если юзер уже залогинен — модалка всё равно откроется и
|
|
2932
|
+
* закроется через auto-resume в auth_gate effect'е (мгновение).
|
|
2933
|
+
*
|
|
2934
|
+
* Триал не блокирует этот флоу — auth не connect'ится с trial-механикой.
|
|
2935
|
+
*/
|
|
2936
|
+
openAuth(e = {}) {
|
|
2937
|
+
this.auth && this.openInternal("auth", { ...e, skipTrial: !0 });
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* Шорткат над `openAuth()` — открывает модалку сразу на signin-форме.
|
|
2941
|
+
* Эквивалент `openAuth()` (signin — дефолт). Существует для симметрии с
|
|
2942
|
+
* `openSignup()` и читаемости host-кода:
|
|
2943
|
+
* - `paywall.openSignin()` — «вход в существующий аккаунт»
|
|
2944
|
+
* - `paywall.openSignup()` — «новая регистрация»
|
|
2945
|
+
* Без managed-auth — no-op.
|
|
2946
|
+
*/
|
|
2947
|
+
openSignin(e = {}) {
|
|
2948
|
+
this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signin" });
|
|
2949
|
+
}
|
|
2950
|
+
/**
|
|
2951
|
+
* Открывает модалку с auth-gate сразу в режиме регистрации (signup-mode
|
|
2952
|
+
* AuthPanel'а — email/password/repeat). Если в paywall layout админ
|
|
2953
|
+
* отключил allow_signup, AuthPanel игнорит mode и стартует с signin —
|
|
2954
|
+
* соблюдается admin-конфиг.
|
|
2955
|
+
* Без managed-auth — no-op.
|
|
2956
|
+
*/
|
|
2957
|
+
openSignup(e = {}) {
|
|
2958
|
+
this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signup" });
|
|
2959
|
+
}
|
|
2960
|
+
/**
|
|
2961
|
+
* Direct-checkout: создать checkout-URL по конкретной цене и сразу открыть
|
|
2962
|
+
* платёжного провайдера, минуя layout с тарифами. Полезно когда
|
|
2963
|
+
* host-приложение рендерит pricing-карточки/таблицу собственным UI и
|
|
2964
|
+
* хочет, чтобы клик по «Buy / Get this plan» вёл прямо в Stripe/Paddle.
|
|
2965
|
+
*
|
|
2966
|
+
* **Late-mount UX.** В отличие от `open()`, модалка не появляется во время
|
|
2967
|
+
* фоновой работы (bootstrap + visibility/trial gates + createCheckout).
|
|
2968
|
+
* Хост на этой фазе показывает busy-state прямо на своей кнопке (через
|
|
2969
|
+
* `state.processing === true` из `paywall.getState()` — или автоматически
|
|
2970
|
+
* через `<PaywallButton priceId>` в sdk-react). Модалка монтируется
|
|
2971
|
+
* ТОЛЬКО когда реально нужна UI:
|
|
2972
|
+
* - `checkout_mode='preauth'` + managed-auth + не залогинен → auth-gate
|
|
2973
|
+
* (форма signin'а); после успеха auto-resume в createCheckout.
|
|
2974
|
+
* - popup провайдера заблокирован браузером → popup_blocked view с
|
|
2975
|
+
* retry-кнопкой под fresh user gesture.
|
|
2976
|
+
* - popup открылся успешно → awaiting_payment view (индикатор «оплати
|
|
2977
|
+
* в новой вкладке» + I've paid).
|
|
2978
|
+
*
|
|
2979
|
+
* Что эмитится без модалки:
|
|
2980
|
+
* - `purchase_completed{restored:true, priceId}` когда юзер уже подписан
|
|
2981
|
+
* (cached user, fresh bootstrap, или 409 hasActivePurchase от бэка) —
|
|
2982
|
+
* headless reject;
|
|
2983
|
+
* - `error` когда createCheckout упал или identity.email отсутствует;
|
|
2984
|
+
* - `visibility_blocked` / `trial_blocked` — стандартные gate-эвенты.
|
|
2985
|
+
*
|
|
2986
|
+
* Что эмитится одновременно с модалкой:
|
|
2987
|
+
* - `checkout_started{priceId, url, acquiring}` ровно когда headless URL
|
|
2988
|
+
* получен, ДО mount'а awaiting_payment/popup_blocked.
|
|
2989
|
+
*
|
|
2990
|
+
* Offer (countdown-скидка) автоматически резолвится из cached offers'ов
|
|
2991
|
+
* через `getOfferForPrice(priceId)` и передаётся в createCheckout как
|
|
2992
|
+
* `offerId` — чтобы duration_minutes-офферы тоже применились на бэке
|
|
2993
|
+
* (для них нет server-side таймера, без явного offer-id скидка теряется).
|
|
2994
|
+
*
|
|
2995
|
+
* Требования:
|
|
2996
|
+
* - `identity.email` должен быть выставлен (через `opts.identity`, либо
|
|
2997
|
+
* managed-auth, либо ранний `setIdentity`/`paywall.open({identity})`).
|
|
2998
|
+
* Без email бэк `/start-checkout` 400'нёт; SDK эмитнет `error`.
|
|
2999
|
+
* - В `checkout_mode='preauth'` без managed-auth — backend требует
|
|
3000
|
+
* email-юзера; убедись что `identity.email` явно задан.
|
|
3001
|
+
*
|
|
3002
|
+
* Без модалки совсем (когда host рендерит свой awaiting-payment экран) —
|
|
3003
|
+
* используй `paywall.billing.createCheckout({priceId, offerId})` напрямую,
|
|
3004
|
+
* но тогда auth-gate / popup_blocked / awaiting_payment придётся рисовать
|
|
3005
|
+
* самостоятельно.
|
|
3006
|
+
*/
|
|
3007
|
+
checkout(e, r = {}) {
|
|
3008
|
+
if (r.identity && this.billing.setIdentity(r.identity), r.renew !== !0 && this.billing.getCachedUser()?.has_active_subscription) {
|
|
3009
|
+
this.emit("purchase_completed", {
|
|
3010
|
+
priceId: e,
|
|
3011
|
+
sessionId: null,
|
|
3012
|
+
restored: !0
|
|
3013
|
+
});
|
|
3014
|
+
return;
|
|
3015
|
+
}
|
|
3016
|
+
this.runDirectCheckout(e, r);
|
|
3017
|
+
}
|
|
3018
|
+
/** Headless prep-work для `checkout(priceId, opts)`: bootstrap → gates →
|
|
3019
|
+
* preauth check → createCheckout → mount модалки с финальным view.
|
|
3020
|
+
* Вынесено отдельным методом ради чистого async/await flow вместо вложенных
|
|
3021
|
+
* then-chain'ов (5+ ветвей). Любая ошибка не пробрасывается наружу: эмитим
|
|
3022
|
+
* через `paywall.emit('error')` и выходим — host подписан на `error`-event. */
|
|
3023
|
+
async runDirectCheckout(e, r) {
|
|
3024
|
+
const n = r.renew === !0, a = r.skipTrial === !0, s = r.skipVisibility === !0;
|
|
3025
|
+
this.applyProcessing(!0);
|
|
3026
|
+
const o = () => {
|
|
3027
|
+
this.applyProcessing(!1);
|
|
3028
|
+
};
|
|
3029
|
+
let c;
|
|
3030
|
+
try {
|
|
3031
|
+
c = await this.billing.bootstrap();
|
|
3032
|
+
} catch (m) {
|
|
3033
|
+
const A = m instanceof L ? m : new L("unknown", "Failed to load paywall", { cause: m });
|
|
3034
|
+
this.emit("error", A), o();
|
|
3035
|
+
return;
|
|
3036
|
+
}
|
|
3037
|
+
if (!s) {
|
|
3038
|
+
const m = c.settings.visibility;
|
|
3039
|
+
if (m && (this.lastVisibility = m, !m.visible)) {
|
|
3040
|
+
this.emit("visibility_blocked", m), o();
|
|
3041
|
+
return;
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
if (!a && await this.checkTrialBeforeCheckout(c)) {
|
|
3045
|
+
o();
|
|
3046
|
+
return;
|
|
3047
|
+
}
|
|
3048
|
+
if (!n && c.user?.has_active_subscription) {
|
|
3049
|
+
this.emit("purchase_completed", {
|
|
3050
|
+
priceId: e,
|
|
3051
|
+
sessionId: null,
|
|
3052
|
+
restored: !0
|
|
3053
|
+
}), o();
|
|
3054
|
+
return;
|
|
3055
|
+
}
|
|
3056
|
+
const l = c.settings.checkout_mode ?? "guest", p = this.auth?.getCachedSession() ?? null, u = !!p && !p.user.is_anonymous;
|
|
3057
|
+
if (l === "preauth" && !!this.auth && !u) {
|
|
3058
|
+
this.purchased = !1, this.mountAndShow("auth", {
|
|
3059
|
+
renew: n,
|
|
3060
|
+
authMode: "signin",
|
|
3061
|
+
checkoutPriceId: e
|
|
3062
|
+
});
|
|
3063
|
+
return;
|
|
3064
|
+
}
|
|
3065
|
+
const _ = this.getOfferForPrice(e);
|
|
3066
|
+
let h;
|
|
3067
|
+
try {
|
|
3068
|
+
h = await this.billing.createCheckout({
|
|
3069
|
+
priceId: e,
|
|
3070
|
+
offerId: _?.offer.id,
|
|
3071
|
+
ignoreActivePurchase: n
|
|
3072
|
+
});
|
|
3073
|
+
} catch (m) {
|
|
3074
|
+
if (m instanceof L && m.code === "already_purchased") {
|
|
3075
|
+
try {
|
|
3076
|
+
await this.billing.getUser({ force: !0 });
|
|
3077
|
+
} catch {
|
|
3078
|
+
}
|
|
3079
|
+
this.emit("purchase_completed", {
|
|
3080
|
+
priceId: e,
|
|
3081
|
+
sessionId: null,
|
|
3082
|
+
restored: !0
|
|
3083
|
+
}), o();
|
|
3084
|
+
return;
|
|
3085
|
+
}
|
|
3086
|
+
const A = m instanceof L ? m : new L("checkout_failed", "Checkout failed", { cause: m });
|
|
3087
|
+
this.emit("error", A), o();
|
|
3088
|
+
return;
|
|
3089
|
+
}
|
|
3090
|
+
if (this.emit("checkout_started", {
|
|
3091
|
+
priceId: e,
|
|
3092
|
+
url: h.url,
|
|
3093
|
+
acquiring: h.acquiring
|
|
3094
|
+
}), this.startUserWatcher(), typeof window > "u" || !h.url) {
|
|
3095
|
+
this.mountAndShow("awaiting_payment", {
|
|
3096
|
+
renew: n,
|
|
3097
|
+
checkoutPriceId: e,
|
|
3098
|
+
checkoutUrl: h.url
|
|
3099
|
+
});
|
|
3100
|
+
return;
|
|
3101
|
+
}
|
|
3102
|
+
const k = window.open(h.url, "_blank");
|
|
3103
|
+
if (this.purchased = !1, k) {
|
|
3104
|
+
try {
|
|
3105
|
+
k.opener = null;
|
|
3106
|
+
} catch {
|
|
3107
|
+
}
|
|
3108
|
+
this.mountAndShow("awaiting_payment", {
|
|
3109
|
+
renew: n,
|
|
3110
|
+
checkoutPriceId: e,
|
|
3111
|
+
checkoutUrl: h.url
|
|
3112
|
+
});
|
|
3113
|
+
} else
|
|
3114
|
+
this.mountAndShow("popup_blocked", {
|
|
3115
|
+
renew: n,
|
|
3116
|
+
checkoutPriceId: e,
|
|
3117
|
+
checkoutUrl: h.url
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
/** Trial-check без mount'а (для late-mount direct-checkout). Возвращает
|
|
3121
|
+
* true если trial заблокировал — caller должен прекратить flow. На любой
|
|
3122
|
+
* storage-ошибке log+продолжаем (не блокируем продажу). */
|
|
3123
|
+
async checkTrialBeforeCheckout(e) {
|
|
3124
|
+
const r = e.settings.trial;
|
|
3125
|
+
if (!r) return !1;
|
|
3126
|
+
const n = this.ensureTrialStore(r);
|
|
3127
|
+
try {
|
|
3128
|
+
const a = await n.check();
|
|
3129
|
+
if (this.lastTrialStatus = a, a.mode === "none") return !1;
|
|
3130
|
+
if (a.blocked) {
|
|
3131
|
+
const s = await n.recordBlock();
|
|
3132
|
+
return this.lastTrialStatus = s, this.emit("trial_blocked", s), !0;
|
|
3133
|
+
}
|
|
3134
|
+
return this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), !1;
|
|
3135
|
+
} catch (a) {
|
|
3136
|
+
return typeof console < "u" && console.warn("[paywall] trial check failed", a), !1;
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
applyProcessing(e) {
|
|
3140
|
+
this.currentState.processing !== e && this.applyState({ ...this.currentState, processing: e });
|
|
3141
|
+
}
|
|
3142
|
+
/**
|
|
3143
|
+
* Headless anonymous signin без открытия модалки. Внутри:
|
|
3144
|
+
* idempotent (если уже анон — instant return) → resume через сохранённый
|
|
3145
|
+
* refresh_token → fresh /auth/anonymous/signin. Дедуплицирует
|
|
3146
|
+
* параллельные вызовы внутри AuthClient'а.
|
|
3147
|
+
*
|
|
3148
|
+
* Удобно для host-кнопок типа «Continue as guest» — host сам управляет
|
|
3149
|
+
* loading-стейтом на своей кнопке, без полупустой модалки со спиннером.
|
|
3150
|
+
* Без managed-auth — резолвится rejected promise'ом (нет AuthClient'а
|
|
3151
|
+
* чтобы делать signin).
|
|
3152
|
+
*/
|
|
3153
|
+
signInAnonymously() {
|
|
3154
|
+
return this.auth ? this.auth.signInAnonymously() : Promise.reject(
|
|
3155
|
+
new L(
|
|
3156
|
+
"invalid_config",
|
|
3157
|
+
"signInAnonymously requires managed-auth. Pass `auth: true` to PaywallUI."
|
|
3158
|
+
)
|
|
3159
|
+
);
|
|
3160
|
+
}
|
|
3161
|
+
openInternal(e, r) {
|
|
3162
|
+
r.identity && this.billing.setIdentity(r.identity), this.purchased = !1;
|
|
3163
|
+
const n = r.skipTrial === !0 || e === "support", a = r.skipVisibility === !0 || e === "support" || e === "auth", s = r.renew === !0;
|
|
3164
|
+
if (n && a) {
|
|
3165
|
+
this.mountAndShow(e, { renew: s, authMode: r.authMode });
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
const o = this.billing.getCachedBootstrap();
|
|
3169
|
+
if (o) {
|
|
3170
|
+
this.runOpenGates(e, o, { skipTrial: n, skipVisibility: a, renew: s });
|
|
3171
|
+
return;
|
|
3172
|
+
}
|
|
3173
|
+
if (this.mountThenLoad) {
|
|
3174
|
+
this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((c) => this.runDelayedGates(c, { skipTrial: n, skipVisibility: a })).catch(() => {
|
|
3175
|
+
});
|
|
3176
|
+
return;
|
|
3177
|
+
}
|
|
3178
|
+
this.billing.bootstrap().then(
|
|
3179
|
+
(c) => this.runOpenGates(e, c, { skipTrial: n, skipVisibility: a, renew: s })
|
|
3180
|
+
).catch(() => {
|
|
3181
|
+
this.mountAndShow(e, { renew: s });
|
|
3182
|
+
});
|
|
3183
|
+
}
|
|
3184
|
+
/** Применить gates ПОСЛЕ того, как модалка уже смонтирована (mount-then-load
|
|
3185
|
+
* путь). Если gate блокирует — close() + emit. Если юзер уже сам закрыл
|
|
3186
|
+
* модалку до резолва bootstrap'а — no-op (isOpen=false). */
|
|
3187
|
+
runDelayedGates(e, r) {
|
|
3188
|
+
if (!this.isOpen) return;
|
|
3189
|
+
if (!r.skipVisibility) {
|
|
3190
|
+
const s = e.settings.visibility;
|
|
3191
|
+
if (s && (this.lastVisibility = s, !s.visible)) {
|
|
3192
|
+
this.close(), this.emit("visibility_blocked", s);
|
|
3193
|
+
return;
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
if (r.skipTrial) return;
|
|
3197
|
+
const n = e.settings.trial;
|
|
3198
|
+
if (!n) return;
|
|
3199
|
+
const a = this.ensureTrialStore(n);
|
|
3200
|
+
a.check().then(async (s) => {
|
|
3201
|
+
if (this.isOpen && (this.lastTrialStatus = s, s.mode !== "none")) {
|
|
3202
|
+
if (s.blocked) {
|
|
3203
|
+
const o = await a.recordBlock();
|
|
3204
|
+
if (this.lastTrialStatus = o, !this.isOpen) return;
|
|
3205
|
+
this.close(), this.emit("trial_blocked", o);
|
|
3206
|
+
return;
|
|
3207
|
+
}
|
|
3208
|
+
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired"));
|
|
3209
|
+
}
|
|
3210
|
+
}).catch((s) => {
|
|
3211
|
+
typeof console < "u" && console.warn("[paywall] trial check failed", s);
|
|
3212
|
+
});
|
|
3213
|
+
}
|
|
3214
|
+
// Порядок гейтов: visibility → trial. Country-mismatch ≠ trial-block, и
|
|
3215
|
+
// вести trial-стейт «осталось N показов» под юзером, который вообще не
|
|
3216
|
+
// должен увидеть пейвол по таргетингу — бессмысленно: при возврате в
|
|
3217
|
+
// правильную страну он окажется со «слипшимся» триал-счётчиком.
|
|
3218
|
+
runOpenGates(e, r, n) {
|
|
3219
|
+
if (!n.skipVisibility) {
|
|
3220
|
+
const a = r.settings.visibility;
|
|
3221
|
+
if (a && (this.lastVisibility = a, !a.visible)) {
|
|
3222
|
+
this.emit("visibility_blocked", a);
|
|
3223
|
+
return;
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
if (n.skipTrial) {
|
|
3227
|
+
this.mountAndShow(e, { renew: n.renew });
|
|
3228
|
+
return;
|
|
3229
|
+
}
|
|
3230
|
+
this.gateThroughTrial(e, r, n.renew);
|
|
3231
|
+
}
|
|
3232
|
+
gateThroughTrial(e, r, n) {
|
|
3233
|
+
const a = r.settings.trial;
|
|
3234
|
+
if (!a) {
|
|
3235
|
+
this.mountAndShow(e, { renew: n });
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
3238
|
+
const s = this.ensureTrialStore(a);
|
|
3239
|
+
s.check().then(async (o) => {
|
|
3240
|
+
if (this.lastTrialStatus = o, o.mode === "none") {
|
|
3241
|
+
this.mountAndShow(e, { renew: n });
|
|
3242
|
+
return;
|
|
3243
|
+
}
|
|
3244
|
+
if (o.blocked) {
|
|
3245
|
+
const c = await s.recordBlock();
|
|
3246
|
+
this.lastTrialStatus = c, this.emit("trial_blocked", c);
|
|
3247
|
+
return;
|
|
3248
|
+
}
|
|
3249
|
+
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), this.mountAndShow(e, { renew: n });
|
|
3250
|
+
}).catch((o) => {
|
|
3251
|
+
typeof console < "u" && console.warn("[paywall] trial check failed", o), this.mountAndShow(e, { renew: n });
|
|
3252
|
+
});
|
|
3253
|
+
}
|
|
3254
|
+
ensureTrialStore(e) {
|
|
3255
|
+
if (this.trialStore && this.trialStoreConfig && yr(this.trialStoreConfig, e))
|
|
3256
|
+
return this.trialStore;
|
|
3257
|
+
this.trialStoreConfig = e;
|
|
3258
|
+
const r = this.billing.createTrialStore;
|
|
3259
|
+
return this.trialStore = typeof r == "function" ? r.call(this.billing, e) : Ye(this.billing.getStorage(), this.billing.paywallId, e), this.trialStore;
|
|
3260
|
+
}
|
|
3261
|
+
mountAndShow(e, r = {}) {
|
|
3262
|
+
this.lastMountedView = e;
|
|
3263
|
+
const n = r.renew === !0, a = r.authMode, o = e === "auth" || e === "awaiting_payment" || e === "popup_blocked" ? r.checkoutPriceId ?? null : null, c = e === "awaiting_payment" || e === "popup_blocked" ? r.checkoutUrl ?? null : null;
|
|
3264
|
+
if (this.handle) {
|
|
3265
|
+
this.isOpen = !0, this.handle.update({
|
|
3266
|
+
open: !0,
|
|
3267
|
+
initialView: e,
|
|
3268
|
+
initialAuthMode: a,
|
|
3269
|
+
initialCheckoutPriceId: o,
|
|
3270
|
+
initialCheckoutUrl: c,
|
|
3271
|
+
purchased: !1,
|
|
3272
|
+
renew: n
|
|
3273
|
+
}), this.emit("open");
|
|
3274
|
+
return;
|
|
3275
|
+
}
|
|
3276
|
+
this.isOpen = !0, this.handle = Je(
|
|
3277
|
+
sr,
|
|
3278
|
+
{
|
|
3279
|
+
client: this.billing,
|
|
3280
|
+
open: !0,
|
|
3281
|
+
initialView: e,
|
|
3282
|
+
initialAuthMode: a,
|
|
3283
|
+
initialCheckoutPriceId: o,
|
|
3284
|
+
initialCheckoutUrl: c,
|
|
3285
|
+
purchased: !1,
|
|
3286
|
+
renew: n,
|
|
3287
|
+
onClose: () => this.close(),
|
|
3288
|
+
onEvent: (l, p) => {
|
|
3289
|
+
this.emit(l, p), l === "checkout_started" && this.startUserWatcher();
|
|
3290
|
+
},
|
|
3291
|
+
onState: (l) => this.applyState(l),
|
|
3292
|
+
inline: this.inline,
|
|
3293
|
+
locale: this.forceLocale
|
|
3294
|
+
},
|
|
3295
|
+
{ host: this.host, shadowMode: this.shadowMode, inline: this.inline }
|
|
3296
|
+
), this.emit("open");
|
|
3297
|
+
}
|
|
3298
|
+
applyState(e) {
|
|
3299
|
+
if (!xr(this.currentState, e)) {
|
|
3300
|
+
this.currentState = e;
|
|
3301
|
+
for (const r of this.stateListeners)
|
|
3302
|
+
try {
|
|
3303
|
+
r(e);
|
|
3304
|
+
} catch (n) {
|
|
3305
|
+
console.warn("[paywall] onStateChange listener threw", n);
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
/**
|
|
3310
|
+
* Sync-snapshot текущего состояния модалки. Подходит для `useSyncExternalStore`
|
|
3311
|
+
* в React (`useSyncExternalStore(paywall.onStateChange, paywall.getState)`)
|
|
3312
|
+
* и для одноразовых проверок («открыт ли пейвол сейчас?»).
|
|
3313
|
+
*
|
|
3314
|
+
* Snapshot стабилен — пока state не изменился, повторный getState() вернёт
|
|
3315
|
+
* `===`-равный объект (важно для useSyncExternalStore чтобы не ре-рендерить).
|
|
3316
|
+
*/
|
|
3317
|
+
getState() {
|
|
3318
|
+
return this.currentState;
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* Подписка на изменения state. Колбек вызывается при каждом реальном
|
|
3322
|
+
* изменении (closed → loading → ready → ...). По умолчанию initial snapshot
|
|
3323
|
+
* отдаётся через microtask после подписки; через `{immediate: 'sync'|'none'}`
|
|
3324
|
+
* можно сделать sync-доставку (для useSyncExternalStore — там она не нужна,
|
|
3325
|
+
* snapshot читается через getSnapshot отдельно) или вовсе пропустить
|
|
3326
|
+
* initial.
|
|
3327
|
+
*
|
|
3328
|
+
* Возвращает unsubscribe.
|
|
3329
|
+
*/
|
|
3330
|
+
onStateChange(e, r = {}) {
|
|
3331
|
+
this.stateListeners.add(e);
|
|
3332
|
+
const n = r.immediate ?? "microtask";
|
|
3333
|
+
if (n !== "none") {
|
|
3334
|
+
const a = this.currentState;
|
|
3335
|
+
if (n === "sync")
|
|
3336
|
+
try {
|
|
3337
|
+
e(a);
|
|
3338
|
+
} catch (s) {
|
|
3339
|
+
console.warn("[paywall] onStateChange initial sync threw", s);
|
|
3340
|
+
}
|
|
3341
|
+
else
|
|
3342
|
+
queueMicrotask(() => {
|
|
3343
|
+
this.stateListeners.has(e) && e(a);
|
|
3344
|
+
});
|
|
3345
|
+
}
|
|
3346
|
+
return () => {
|
|
3347
|
+
this.stateListeners.delete(e);
|
|
3348
|
+
};
|
|
3349
|
+
}
|
|
3350
|
+
/** Sync-доступ к последнему известному статусу триала. null — `paywall.open()`
|
|
3351
|
+
* ещё не вызывался либо триал отключён в конфиге пейвола. Удобно для
|
|
3352
|
+
* собственного UI хоста («осталось 3 показа», «триал истечёт через 2ч»). */
|
|
3353
|
+
getTrialStatus() {
|
|
3354
|
+
return this.lastTrialStatus;
|
|
3355
|
+
}
|
|
3356
|
+
/** Sync-доступ к последнему server-computed visibility-статусу. null —
|
|
3357
|
+
* bootstrap ещё не загружен или сервер не отдаёт `settings.visibility`
|
|
3358
|
+
* (например, старая версия online без targeting-патча). Хост может
|
|
3359
|
+
* использовать для собственного fallback'а: «сервис недоступен в вашей
|
|
3360
|
+
* стране». Обновляется на каждом open(), который проходит через gate. */
|
|
3361
|
+
getVisibility() {
|
|
3362
|
+
return this.lastVisibility;
|
|
3363
|
+
}
|
|
3364
|
+
/**
|
|
3365
|
+
* Цены пейвола — шорткат над `bootstrap()`. Локали уже применены, кэш и
|
|
3366
|
+
* stale-while-revalidate идентичны `billing.bootstrap()`. Подходит для
|
|
3367
|
+
* pricing-страниц/карточек на сайте, где host хочет показать те же цены,
|
|
3368
|
+
* что и в модалке, не вытаскивая bootstrap руками.
|
|
3369
|
+
*/
|
|
3370
|
+
getPrices(e = {}) {
|
|
3371
|
+
return this.billing.getPrices(e);
|
|
3372
|
+
}
|
|
3373
|
+
/** Sync-снимок цен. null — bootstrap ещё не загружали. */
|
|
3374
|
+
getCachedPrices() {
|
|
3375
|
+
return this.billing.getCachedPrices();
|
|
3376
|
+
}
|
|
3377
|
+
/** Sync-снимок офферов. null = bootstrap не загружали, [] = пейвол без офферов.
|
|
3378
|
+
* Бэк уже применил серверный targeting (страны/email/режим) — наружу
|
|
3379
|
+
* выезжает только то, что применимо к текущему юзеру. */
|
|
3380
|
+
getCachedOffers() {
|
|
3381
|
+
return this.billing.getCachedOffers();
|
|
3382
|
+
}
|
|
3383
|
+
/**
|
|
3384
|
+
* Резолвит активный offer для конкретной цены: price_id-таргетинг +
|
|
3385
|
+
* countdown (`expires_at` ИЛИ `duration_minutes` от первого открытия
|
|
3386
|
+
* пейвола, см. clientStorage `pw-offer-{id}-start`).
|
|
3387
|
+
*
|
|
3388
|
+
* Read-only — НЕ записывает start для `duration_minutes`-офферов. Запись
|
|
3389
|
+
* стартует только когда модалка реально открыта (renderer'ом). До этого
|
|
3390
|
+
* `getOfferForPrice` вернёт `null` для duration-only офферов, чтобы
|
|
3391
|
+
* страницы-хосты вне модалки (pricing, landing) не активировали countdown
|
|
3392
|
+
* раньше времени.
|
|
3393
|
+
*
|
|
3394
|
+
* Хост-странице нужен countdown, который тикает каждую секунду — для
|
|
3395
|
+
* этого использовать React-хук `usePaywallOffer(priceId)` из sdk-react
|
|
3396
|
+
* либо обёртку поверх `setInterval(1000)` + повторный вызов этого метода.
|
|
3397
|
+
*/
|
|
3398
|
+
getOfferForPrice(e) {
|
|
3399
|
+
const r = this.billing.getCachedOffers();
|
|
3400
|
+
if (!r) return null;
|
|
3401
|
+
const n = He(r, e);
|
|
3402
|
+
return n ? $e(n, {
|
|
3403
|
+
now: Date.now(),
|
|
3404
|
+
readStart: N
|
|
3405
|
+
}) : null;
|
|
3406
|
+
}
|
|
3407
|
+
/** Снимок текущего «языка юзера» — proxy над `billing.getUserLanguage()`.
|
|
3408
|
+
* Используй, чтобы синхронизировать i18n host'а с тем, что фактически
|
|
3409
|
+
* показывает пейвол. См. подробности в `BillingClient.getUserLanguage`. */
|
|
3410
|
+
getUserLanguage() {
|
|
3411
|
+
return this.billing.getUserLanguage();
|
|
3412
|
+
}
|
|
3413
|
+
/**
|
|
3414
|
+
* Решает, нужно ли блокировать фичу для текущего юзера. Без побочных эффектов
|
|
3415
|
+
* (на trial-storage `recordBlock` не вызывается, модалка не монтируется).
|
|
3416
|
+
*
|
|
3417
|
+
* Порядок проверок (первый сработавший — финальный):
|
|
3418
|
+
* 1. `has_active_subscription` — самый сильный сигнал, перебивает остальные.
|
|
3419
|
+
* Юзер с подпиской получает доступ независимо от visibility/trial.
|
|
3420
|
+
* 2. `visibility` (страна/девайс/disabled-флаг) — юзер вне monetization-scope'а
|
|
3421
|
+
* пейвола, гейтить нельзя.
|
|
3422
|
+
* 3. `trial` — пре-пейвольный бесплатный период активен.
|
|
3423
|
+
* 4. Иначе — `blocked`, host лочит фичу и зовёт `paywall.open()`.
|
|
3424
|
+
*
|
|
3425
|
+
* Bootstrap кешируется в BillingClient — `getAccess()` можно дёргать на
|
|
3426
|
+
* каждый рендер host-компонента, /bootstrap не дублируется. При упавшей сети
|
|
3427
|
+
* fallback на persistent-cached user из storage: юзер с прошлой подпиской
|
|
3428
|
+
* получает `granted` офлайн, иначе `blocked` (host покажет пейвол с
|
|
3429
|
+
* error-state, юзер сможет ретрайнуть). Side-эффект: обновляются
|
|
3430
|
+
* `lastVisibility` / `lastTrialStatus`, чтобы синхронные геттеры
|
|
3431
|
+
* `getVisibility()` / `getTrialStatus()` видели свежие данные после первого
|
|
3432
|
+
* `getAccess()`, а не только после первого `open()`.
|
|
3433
|
+
*/
|
|
3434
|
+
async getAccess(e = {}) {
|
|
3435
|
+
let r = this.billing.getCachedBootstrap();
|
|
3436
|
+
if (!r)
|
|
3437
|
+
try {
|
|
3438
|
+
r = await this.billing.bootstrap({ signal: e.signal });
|
|
3439
|
+
} catch {
|
|
3440
|
+
const o = this.billing.getCachedUser();
|
|
3441
|
+
return o?.has_active_subscription ? {
|
|
3442
|
+
access: "granted",
|
|
3443
|
+
reason: "has_subscription",
|
|
3444
|
+
visibility: null,
|
|
3445
|
+
trial: null,
|
|
3446
|
+
user: o
|
|
3447
|
+
} : {
|
|
3448
|
+
access: "blocked",
|
|
3449
|
+
reason: "no_subscription",
|
|
3450
|
+
visibility: null,
|
|
3451
|
+
trial: null,
|
|
3452
|
+
user: o
|
|
3453
|
+
};
|
|
3454
|
+
}
|
|
3455
|
+
const n = this.billing.getCachedUser() ?? r.user ?? null;
|
|
3456
|
+
if (n?.has_active_subscription)
|
|
3457
|
+
return {
|
|
3458
|
+
access: "granted",
|
|
3459
|
+
reason: "has_subscription",
|
|
3460
|
+
visibility: r.settings.visibility ?? null,
|
|
3461
|
+
trial: null,
|
|
3462
|
+
user: n
|
|
3463
|
+
};
|
|
3464
|
+
let a = null;
|
|
3465
|
+
if (!e.skipVisibility) {
|
|
3466
|
+
const o = r.settings.visibility;
|
|
3467
|
+
if (o && (a = o, this.lastVisibility = o, !o.visible))
|
|
3468
|
+
return { access: "granted", reason: "visibility_blocked", visibility: a, trial: null, user: n };
|
|
3469
|
+
}
|
|
3470
|
+
let s = null;
|
|
3471
|
+
if (!e.skipTrial) {
|
|
3472
|
+
const o = r.settings.trial;
|
|
3473
|
+
if (o)
|
|
3474
|
+
try {
|
|
3475
|
+
if (s = await this.ensureTrialStore(o).check(), this.lastTrialStatus = s, s.blocked)
|
|
3476
|
+
return { access: "granted", reason: "trial_blocked", visibility: a, trial: s, user: n };
|
|
3477
|
+
} catch (c) {
|
|
3478
|
+
typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", c);
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
return { access: "blocked", reason: "no_subscription", visibility: a, trial: s, user: n };
|
|
3482
|
+
}
|
|
3483
|
+
/** Сбросить состояние триала в storage. Полезно для дев-режима / админ-кнопки
|
|
3484
|
+
* «прогнать сценарий заново». В проде хост обычно не дёргает. */
|
|
3485
|
+
async resetTrial() {
|
|
3486
|
+
this.trialStore && (await this.trialStore.reset(), this.lastTrialStatus = null, this.trialExpiredFired = !1);
|
|
3487
|
+
}
|
|
3488
|
+
// Запускает polling user-state до has_active_subscription=true либо до
|
|
3489
|
+
// таймаута. Идемпотентен: повторный вызов на уже работающем watcher'е —
|
|
3490
|
+
// no-op (юзер мог нажать Continue повторно после возврата).
|
|
3491
|
+
//
|
|
3492
|
+
// В extension popup runtime — no-op (popup не доживёт). Там полагаемся на
|
|
3493
|
+
// bootstrap при следующем открытии.
|
|
3494
|
+
startUserWatcher() {
|
|
3495
|
+
this.watcher || mr() && (this.watcher = new fr({
|
|
3496
|
+
client: this.billing,
|
|
3497
|
+
onActive: (e) => {
|
|
3498
|
+
this.watcher = null, this.emit("purchase_completed", { priceId: null, sessionId: null });
|
|
3499
|
+
const r = this.billing.getCachedBootstrap()?.settings.success_redirect_url;
|
|
3500
|
+
if (r && typeof window < "u")
|
|
3501
|
+
try {
|
|
3502
|
+
window.location.assign(r);
|
|
3503
|
+
return;
|
|
3504
|
+
} catch {
|
|
3505
|
+
}
|
|
3506
|
+
this.isOpen && this.handle && (this.purchased = !0, this.handle.update({ purchased: !0 }));
|
|
3507
|
+
},
|
|
3508
|
+
onTimeout: () => {
|
|
3509
|
+
this.watcher = null;
|
|
3510
|
+
}
|
|
3511
|
+
}), this.watcher.start());
|
|
3512
|
+
}
|
|
3513
|
+
close() {
|
|
3514
|
+
!this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(se), this.emit("close"));
|
|
3515
|
+
}
|
|
3516
|
+
/**
|
|
3517
|
+
* Сканирует текущий URL на маркеры возврата с checkout и эмитит
|
|
3518
|
+
* purchase_completed / purchase_failed. Маркеры удаляются из URL
|
|
3519
|
+
* через history.replaceState. Ищет и в hash, и в search (hash приоритетнее —
|
|
3520
|
+
* защита от клиентских SPA-роутеров, перехватывающих query).
|
|
3521
|
+
*/
|
|
3522
|
+
checkReturn() {
|
|
3523
|
+
if (typeof window > "u") return;
|
|
3524
|
+
const e = new URL(window.location.href), r = Ie(e.hash.replace(/^#/, "")), n = Ie(e.search.replace(/^\?/, "")), a = r ?? n;
|
|
3525
|
+
a && (a.status === "paid" ? (this.emit("purchase_completed", {
|
|
3526
|
+
priceId: a.priceId,
|
|
3527
|
+
sessionId: a.sessionId
|
|
3528
|
+
}), vr(a)) : (a.status === "failed" || a.status === "cancelled") && this.emit("purchase_failed", { reason: a.status }), kr(e));
|
|
3529
|
+
}
|
|
3530
|
+
destroy() {
|
|
3531
|
+
this.tracker?.destroy(), this.tracker = null, this.listeners.clear(), this.stateListeners.clear(), this.watcher?.stop(), this.watcher = null, this.userUnsub?.(), this.userUnsub = null, this.authUnsub?.(), this.authUnsub = null, this.ownsAuth && this.auth && this.auth.destroy?.(), this.ownsAuth = !1, this.billing.destroy?.(), this.handle?.unmount(), this.handle = null, this.isOpen = !1, this.currentState = se;
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
function wr(t) {
|
|
3535
|
+
if (!t.auth) return { auth: void 0, ownsAuth: !1 };
|
|
3536
|
+
if (t.auth instanceof ue || br(t.auth))
|
|
3537
|
+
return { auth: t.auth, ownsAuth: !1 };
|
|
3538
|
+
const e = t.auth === !0 ? {} : t.auth;
|
|
3539
|
+
return {
|
|
3540
|
+
auth: new ue({
|
|
3541
|
+
paywallId: t.paywallId,
|
|
3542
|
+
apiOrigin: e.apiOrigin ?? t.apiOrigin,
|
|
3543
|
+
storage: e.storage ?? t.storage,
|
|
3544
|
+
fetch: e.fetch ?? t.fetch,
|
|
3545
|
+
openPopup: e.openPopup
|
|
3546
|
+
}),
|
|
3547
|
+
ownsAuth: !0
|
|
3548
|
+
};
|
|
3549
|
+
}
|
|
3550
|
+
function br(t) {
|
|
3551
|
+
if (typeof t != "object" || t === null) return !1;
|
|
3552
|
+
const e = t;
|
|
3553
|
+
return typeof e.onAuthChange == "function" && typeof e.getCachedSession == "function" && typeof e.signOut == "function";
|
|
3554
|
+
}
|
|
3555
|
+
function xr(t, e) {
|
|
3556
|
+
return t.open === e.open && t.view === e.view && t.error === e.error && t.processing === e.processing;
|
|
3557
|
+
}
|
|
3558
|
+
function yr(t, e) {
|
|
3559
|
+
return t.mode === e.mode && t.payload === e.payload && t.storage === e.storage;
|
|
3560
|
+
}
|
|
3561
|
+
function Ie(t) {
|
|
3562
|
+
if (!t) return null;
|
|
3563
|
+
const e = new URLSearchParams(t), r = e.get(V.status);
|
|
3564
|
+
return r ? {
|
|
3565
|
+
status: r,
|
|
3566
|
+
priceId: e.get(V.priceId),
|
|
3567
|
+
sessionId: e.get(V.sessionId)
|
|
3568
|
+
} : null;
|
|
3569
|
+
}
|
|
3570
|
+
function vr(t) {
|
|
3571
|
+
if (!(typeof window > "u" || !window.opener))
|
|
3572
|
+
try {
|
|
3573
|
+
window.opener.postMessage(
|
|
3574
|
+
{
|
|
3575
|
+
type: "paywall_purchase",
|
|
3576
|
+
status: t.status,
|
|
3577
|
+
priceId: t.priceId,
|
|
3578
|
+
sessionId: t.sessionId
|
|
3579
|
+
},
|
|
3580
|
+
"*"
|
|
3581
|
+
);
|
|
3582
|
+
} catch {
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
function kr(t) {
|
|
3586
|
+
const e = (n, a) => {
|
|
3587
|
+
if (!n) return "";
|
|
3588
|
+
const s = new URLSearchParams(n.replace(/^[?#]/, ""));
|
|
3589
|
+
s.delete(V.status), s.delete(V.priceId), s.delete(V.sessionId);
|
|
3590
|
+
const o = s.toString();
|
|
3591
|
+
return o ? a + o : "";
|
|
3592
|
+
}, r = t.pathname + e(t.search, "?") + e(t.hash, "#");
|
|
3593
|
+
window.history.replaceState(null, "", r);
|
|
3594
|
+
}
|
|
3595
|
+
export {
|
|
3596
|
+
Mr as P,
|
|
3597
|
+
ir as b
|
|
3598
|
+
};
|
|
3599
|
+
//# sourceMappingURL=PaywallUI-CDlJL5Em.js.map
|