@monetize.software/sdk 3.0.0-alpha.4 → 3.0.0-alpha.6
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-BYquPomD.js +3255 -0
- package/dist/chunks/PaywallUI-BYquPomD.js.map +1 -0
- package/dist/chunks/PaywallUI-Cl9sz_xA.js +26 -0
- package/dist/chunks/PaywallUI-Cl9sz_xA.js.map +1 -0
- package/dist/chunks/ar-BUQInJ5a.js +2 -0
- package/dist/chunks/ar-BUQInJ5a.js.map +1 -0
- package/dist/chunks/ar-nh4l4WDE.js +125 -0
- package/dist/chunks/ar-nh4l4WDE.js.map +1 -0
- package/dist/chunks/cs-2UYO2rWf.js +121 -0
- package/dist/chunks/cs-2UYO2rWf.js.map +1 -0
- package/dist/chunks/cs-i5K4KTFV.js +2 -0
- package/dist/chunks/cs-i5K4KTFV.js.map +1 -0
- package/dist/chunks/da-BD0O_HfV.js +121 -0
- package/dist/chunks/da-BD0O_HfV.js.map +1 -0
- package/dist/chunks/da-CZbhtVJO.js +2 -0
- package/dist/chunks/da-CZbhtVJO.js.map +1 -0
- package/dist/chunks/de-Bc-GoLgC.js +2 -0
- package/dist/chunks/de-Bc-GoLgC.js.map +1 -0
- package/dist/chunks/de-BkCiXPsn.js +139 -0
- package/dist/chunks/de-BkCiXPsn.js.map +1 -0
- package/dist/chunks/el-CcMEbl_F.js +2 -0
- package/dist/chunks/el-CcMEbl_F.js.map +1 -0
- package/dist/chunks/el-cIcxTp07.js +125 -0
- package/dist/chunks/el-cIcxTp07.js.map +1 -0
- package/dist/chunks/es-BvYmomAz.js +2 -0
- package/dist/chunks/es-BvYmomAz.js.map +1 -0
- package/dist/chunks/es-CJBC_jrV.js +139 -0
- package/dist/chunks/es-CJBC_jrV.js.map +1 -0
- package/dist/chunks/fi-DyV7ynBf.js +121 -0
- package/dist/chunks/fi-DyV7ynBf.js.map +1 -0
- package/dist/chunks/fi-aZR-qmZN.js +2 -0
- package/dist/chunks/fi-aZR-qmZN.js.map +1 -0
- package/dist/chunks/fr-BLQ4AIu7.js +139 -0
- package/dist/chunks/fr-BLQ4AIu7.js.map +1 -0
- package/dist/chunks/fr-BgbFAgHx.js +2 -0
- package/dist/chunks/fr-BgbFAgHx.js.map +1 -0
- package/dist/chunks/he-Bg-Bqi7r.js +125 -0
- package/dist/chunks/he-Bg-Bqi7r.js.map +1 -0
- package/dist/chunks/he-CQ4yCuja.js +2 -0
- package/dist/chunks/he-CQ4yCuja.js.map +1 -0
- package/dist/chunks/hi-DtUsj1c-.js +2 -0
- package/dist/chunks/hi-DtUsj1c-.js.map +1 -0
- package/dist/chunks/hi-wQeE43oY.js +125 -0
- package/dist/chunks/hi-wQeE43oY.js.map +1 -0
- package/dist/chunks/hu-D9qxzu0r.js +121 -0
- package/dist/chunks/hu-D9qxzu0r.js.map +1 -0
- package/dist/chunks/hu-DXtscQ8_.js +2 -0
- package/dist/chunks/hu-DXtscQ8_.js.map +1 -0
- package/dist/chunks/id-BByOYpeo.js +2 -0
- package/dist/chunks/id-BByOYpeo.js.map +1 -0
- package/dist/chunks/id-Rx_wYvqy.js +121 -0
- package/dist/chunks/id-Rx_wYvqy.js.map +1 -0
- package/dist/chunks/it-52Ip42pa.js +2 -0
- package/dist/chunks/it-52Ip42pa.js.map +1 -0
- package/dist/chunks/it-B1SRPZ3e.js +139 -0
- package/dist/chunks/it-B1SRPZ3e.js.map +1 -0
- package/dist/chunks/ja-CMC3Parn.js +2 -0
- package/dist/chunks/ja-CMC3Parn.js.map +1 -0
- package/dist/chunks/ja-DiItm8te.js +143 -0
- package/dist/chunks/ja-DiItm8te.js.map +1 -0
- package/dist/chunks/ko-3qY21q40.js +2 -0
- package/dist/chunks/ko-3qY21q40.js.map +1 -0
- package/dist/chunks/ko-CdGFWAKX.js +143 -0
- package/dist/chunks/ko-CdGFWAKX.js.map +1 -0
- package/dist/chunks/nl-Borc5nw1.js +2 -0
- package/dist/chunks/nl-Borc5nw1.js.map +1 -0
- package/dist/chunks/nl-CmZ3vEvj.js +139 -0
- package/dist/chunks/nl-CmZ3vEvj.js.map +1 -0
- package/dist/chunks/no-BuxByZpq.js +121 -0
- package/dist/chunks/no-BuxByZpq.js.map +1 -0
- package/dist/chunks/no-Do2iGedg.js +2 -0
- package/dist/chunks/no-Do2iGedg.js.map +1 -0
- package/dist/chunks/pl-jZFCnDb8.js +121 -0
- package/dist/chunks/pl-jZFCnDb8.js.map +1 -0
- package/dist/chunks/pl-mRaky_7k.js +2 -0
- package/dist/chunks/pl-mRaky_7k.js.map +1 -0
- package/dist/chunks/pt-Cld7MwIW.js +139 -0
- package/dist/chunks/pt-Cld7MwIW.js.map +1 -0
- package/dist/chunks/pt-DilDTXfs.js +2 -0
- package/dist/chunks/pt-DilDTXfs.js.map +1 -0
- package/dist/chunks/ro-CuKDqj3C.js +121 -0
- package/dist/chunks/ro-CuKDqj3C.js.map +1 -0
- package/dist/chunks/ro-DF2uzPIB.js +2 -0
- package/dist/chunks/ro-DF2uzPIB.js.map +1 -0
- package/dist/chunks/ru-B7cjqJUm.js +135 -0
- package/dist/chunks/ru-B7cjqJUm.js.map +1 -0
- package/dist/chunks/ru-YeaXnTO-.js +2 -0
- package/dist/chunks/ru-YeaXnTO-.js.map +1 -0
- package/dist/chunks/sv-2pHEvuSe.js +2 -0
- package/dist/chunks/sv-2pHEvuSe.js.map +1 -0
- package/dist/chunks/sv-D9y-M1Fo.js +121 -0
- package/dist/chunks/sv-D9y-M1Fo.js.map +1 -0
- package/dist/chunks/th-D9umBjEy.js +125 -0
- package/dist/chunks/th-D9umBjEy.js.map +1 -0
- package/dist/chunks/th-u2QSDF0G.js +2 -0
- package/dist/chunks/th-u2QSDF0G.js.map +1 -0
- package/dist/chunks/tr-BddMywiw.js +121 -0
- package/dist/chunks/tr-BddMywiw.js.map +1 -0
- package/dist/chunks/tr-Bhgm6_ti.js +2 -0
- package/dist/chunks/tr-Bhgm6_ti.js.map +1 -0
- package/dist/chunks/uk-7vwqsaVK.js +2 -0
- package/dist/chunks/uk-7vwqsaVK.js.map +1 -0
- package/dist/chunks/uk-Dbd31hFt.js +135 -0
- package/dist/chunks/uk-Dbd31hFt.js.map +1 -0
- package/dist/chunks/vi-CJefLP_g.js +2 -0
- package/dist/chunks/vi-CJefLP_g.js.map +1 -0
- package/dist/chunks/vi-Do3BMOdh.js +121 -0
- package/dist/chunks/vi-Do3BMOdh.js.map +1 -0
- package/dist/chunks/zh-D5C3BzYL.js +2 -0
- package/dist/chunks/zh-D5C3BzYL.js.map +1 -0
- package/dist/chunks/zh-gQSYLZI3.js +143 -0
- package/dist/chunks/zh-gQSYLZI3.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +81 -5
- package/dist/core.js +209 -171
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +93 -5
- package/dist/index.js +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +93 -5
- package/dist/ui.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/PaywallUI-2bwf2scV.js +0 -2277
- package/dist/chunks/PaywallUI-2bwf2scV.js.map +0 -1
- package/dist/chunks/PaywallUI-Bu51__PT.js +0 -26
- package/dist/chunks/PaywallUI-Bu51__PT.js.map +0 -1
|
@@ -0,0 +1,3255 @@
|
|
|
1
|
+
import { PaywallError as U, BillingClient as Dt, EventTracker as Nt, AuthClient as dt } from "../core.js";
|
|
2
|
+
import { render as K, h as ut, createContext as Ht } from "preact";
|
|
3
|
+
import { jsx as n, jsxs as c, Fragment as Z } from "preact/jsx-runtime";
|
|
4
|
+
import { useContext as Vt, useState as b, useEffect as T, useRef as F, useMemo as Ct, useLayoutEffect as $t } from "preact/hooks";
|
|
5
|
+
const pt = 3600 * 1e3;
|
|
6
|
+
function Y(e) {
|
|
7
|
+
return `paywall-${e}-trial-time-first-open`;
|
|
8
|
+
}
|
|
9
|
+
function X(e) {
|
|
10
|
+
return `paywall-${e}-skip-times`;
|
|
11
|
+
}
|
|
12
|
+
class It {
|
|
13
|
+
constructor(t, r, a) {
|
|
14
|
+
this.storage = t, this.paywallId = r, this.config = a;
|
|
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" ? Y(this.paywallId) : X(this.paywallId));
|
|
24
|
+
}
|
|
25
|
+
async checkTime() {
|
|
26
|
+
const t = this.config.payload * pt, r = await this.storage.getItem(Y(this.paywallId)), a = r ? Number(r) : null;
|
|
27
|
+
if (!a || !Number.isFinite(a))
|
|
28
|
+
return {
|
|
29
|
+
mode: "time",
|
|
30
|
+
blocked: !0,
|
|
31
|
+
startedAt: null,
|
|
32
|
+
expiresAt: null,
|
|
33
|
+
remainingMs: t,
|
|
34
|
+
totalMs: t
|
|
35
|
+
};
|
|
36
|
+
const i = a + t, o = Math.max(0, i - Date.now());
|
|
37
|
+
return {
|
|
38
|
+
mode: "time",
|
|
39
|
+
blocked: o > 0,
|
|
40
|
+
startedAt: a,
|
|
41
|
+
expiresAt: i,
|
|
42
|
+
remainingMs: o,
|
|
43
|
+
totalMs: t
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async checkOpens() {
|
|
47
|
+
const t = this.config.payload, r = await this.storage.getItem(X(this.paywallId)), a = r ? Number(r) : 0, i = Number.isFinite(a) ? a : 0, o = i < t, s = Math.max(0, t - i);
|
|
48
|
+
return {
|
|
49
|
+
mode: "opens",
|
|
50
|
+
blocked: o,
|
|
51
|
+
remainingActions: s,
|
|
52
|
+
totalActions: t
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async recordTime() {
|
|
56
|
+
const t = this.config.payload * pt, r = Y(this.paywallId), a = await this.storage.getItem(r);
|
|
57
|
+
let i = a ? Number(a) : null;
|
|
58
|
+
(!i || !Number.isFinite(i)) && (i = Date.now(), await this.storage.setItem(r, String(i)));
|
|
59
|
+
const o = i + t, s = Math.max(0, o - Date.now());
|
|
60
|
+
return {
|
|
61
|
+
mode: "time",
|
|
62
|
+
blocked: s > 0,
|
|
63
|
+
startedAt: i,
|
|
64
|
+
expiresAt: o,
|
|
65
|
+
remainingMs: s,
|
|
66
|
+
totalMs: t
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async recordOpens() {
|
|
70
|
+
const t = this.config.payload, r = X(this.paywallId), a = await this.storage.getItem(r), i = a ? Number(a) : 0, o = Number.isFinite(i) ? i : 0, s = Math.min(t, o + 1);
|
|
71
|
+
await this.storage.setItem(r, String(s));
|
|
72
|
+
const l = Math.max(0, t - s);
|
|
73
|
+
return {
|
|
74
|
+
mode: "opens",
|
|
75
|
+
blocked: s < t,
|
|
76
|
+
remainingActions: l,
|
|
77
|
+
totalActions: t
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
let ht = !1;
|
|
82
|
+
class Gt {
|
|
83
|
+
constructor(t, r, a) {
|
|
84
|
+
ht || (ht = !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 It(t, r, a);
|
|
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 qt(e, t, r) {
|
|
99
|
+
return r.storage === "server" ? new Gt(e, t, r) : new It(e, t, r);
|
|
100
|
+
}
|
|
101
|
+
const At = '/*! 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-red-700:oklch(50.5% .213 27.518);--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-lg:.5rem;--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-5{height:calc(var(--spacing) * 5)}.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-5{width:calc(var(--spacing) * 5)}.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-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-full{width:100%}.max-w-\\[18rem\\]{max-width:18rem}.max-w-\\[20rem\\]{max-width:20rem}.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-lg{border-radius:var(--radius-lg)}.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-\\[var\\(--pw-accent\\)\\]{background-color:var(--pw-accent)}.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-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.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-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}.whitespace-nowrap{white-space:nowrap}.text-\\[var\\(--pw-accent\\)\\]{color:var(--pw-accent)}.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-red-700{color:var(--color-red-700)}.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)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + 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)}.ring-8{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(8px + 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)}.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\\:opacity-90:hover{opacity:.9}.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-8{padding-top:calc(var(--spacing) * 8)}.sm\\:pb-4{padding-bottom:calc(var(--spacing) * 4)}.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 gt = !1;
|
|
103
|
+
function Wt() {
|
|
104
|
+
if (gt || (gt = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
|
|
105
|
+
let e;
|
|
106
|
+
try {
|
|
107
|
+
const t = new CSSStyleSheet();
|
|
108
|
+
t.replaceSync(At), e = t.cssRules;
|
|
109
|
+
} catch {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
for (const t of e) {
|
|
113
|
+
if (t.constructor.name !== "CSSPropertyRule") continue;
|
|
114
|
+
const r = t;
|
|
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 Zt(e, t, r = {}) {
|
|
127
|
+
if (typeof document > "u")
|
|
128
|
+
throw new Error("mountShadow called in non-DOM environment");
|
|
129
|
+
Wt();
|
|
130
|
+
const a = r.host ?? document.createElement("div");
|
|
131
|
+
a.setAttribute("data-paywall-host", ""), a.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;", !a.isConnected && !r.inline && document.body.appendChild(a);
|
|
132
|
+
const i = a.attachShadow({ mode: r.shadowMode ?? "closed" }), o = `
|
|
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
|
+
`, s = document.createElement("style");
|
|
151
|
+
s.textContent = o + At + (r.injectCss ?? ""), i.appendChild(s);
|
|
152
|
+
const l = document.createElement("div");
|
|
153
|
+
l.style.pointerEvents = "auto", i.appendChild(l);
|
|
154
|
+
let u = t;
|
|
155
|
+
return K(ut(e, u), l), {
|
|
156
|
+
shadowRoot: i,
|
|
157
|
+
update(h) {
|
|
158
|
+
u = { ...u, ...h }, K(ut(e, u), l);
|
|
159
|
+
},
|
|
160
|
+
unmount() {
|
|
161
|
+
K(null, l), a.remove();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const Kt = (e, t, r) => {
|
|
166
|
+
const a = e[t];
|
|
167
|
+
return a ? typeof a == "function" ? a() : Promise.resolve(a) : new Promise((i, o) => {
|
|
168
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
169
|
+
o.bind(
|
|
170
|
+
null,
|
|
171
|
+
new Error(
|
|
172
|
+
"Unknown variable dynamic import: " + t + (t.split("/").length !== r ? ". Note that variables only represent file names one level deep." : "")
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
});
|
|
177
|
+
}, Yt = [
|
|
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
|
+
], Mt = (e, t, r) => Pt(t, r), Lt = Ht({ t: Mt, locale: "en" });
|
|
206
|
+
function Pt(e, t) {
|
|
207
|
+
if (!t) return e;
|
|
208
|
+
let r = e;
|
|
209
|
+
for (const [a, i] of Object.entries(t))
|
|
210
|
+
r = r.split(`{${a}}`).join(String(i));
|
|
211
|
+
return r;
|
|
212
|
+
}
|
|
213
|
+
const J = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map();
|
|
214
|
+
function Tt(e) {
|
|
215
|
+
return Yt.includes(e);
|
|
216
|
+
}
|
|
217
|
+
function Xt(e) {
|
|
218
|
+
const t = [];
|
|
219
|
+
if (typeof navigator < "u" && navigator.language) {
|
|
220
|
+
t.push(navigator.language);
|
|
221
|
+
const a = navigator.language.split("-")[0];
|
|
222
|
+
a && a !== navigator.language && t.push(a);
|
|
223
|
+
}
|
|
224
|
+
const r = e.settings.locale_default;
|
|
225
|
+
if (r) {
|
|
226
|
+
t.push(r);
|
|
227
|
+
const a = r.split("-")[0];
|
|
228
|
+
a && a !== r && t.push(a);
|
|
229
|
+
}
|
|
230
|
+
for (const a of t)
|
|
231
|
+
if (Tt(a)) return a;
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
function Jt(e) {
|
|
235
|
+
return !!e.locales && Object.keys(e.locales).length > 0;
|
|
236
|
+
}
|
|
237
|
+
async function Qt(e) {
|
|
238
|
+
const t = J.get(e);
|
|
239
|
+
if (t) return t;
|
|
240
|
+
const r = Q.get(e);
|
|
241
|
+
if (r) return r;
|
|
242
|
+
const a = Kt(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./ar-nh4l4WDE.js"), "./locales/cs.ts": () => import("./cs-2UYO2rWf.js"), "./locales/da.ts": () => import("./da-BD0O_HfV.js"), "./locales/de.ts": () => import("./de-BkCiXPsn.js"), "./locales/el.ts": () => import("./el-cIcxTp07.js"), "./locales/es.ts": () => import("./es-CJBC_jrV.js"), "./locales/fi.ts": () => import("./fi-DyV7ynBf.js"), "./locales/fr.ts": () => import("./fr-BLQ4AIu7.js"), "./locales/he.ts": () => import("./he-Bg-Bqi7r.js"), "./locales/hi.ts": () => import("./hi-wQeE43oY.js"), "./locales/hu.ts": () => import("./hu-D9qxzu0r.js"), "./locales/id.ts": () => import("./id-Rx_wYvqy.js"), "./locales/it.ts": () => import("./it-B1SRPZ3e.js"), "./locales/ja.ts": () => import("./ja-DiItm8te.js"), "./locales/ko.ts": () => import("./ko-CdGFWAKX.js"), "./locales/nl.ts": () => import("./nl-CmZ3vEvj.js"), "./locales/no.ts": () => import("./no-BuxByZpq.js"), "./locales/pl.ts": () => import("./pl-jZFCnDb8.js"), "./locales/pt.ts": () => import("./pt-Cld7MwIW.js"), "./locales/ro.ts": () => import("./ro-CuKDqj3C.js"), "./locales/ru.ts": () => import("./ru-B7cjqJUm.js"), "./locales/sv.ts": () => import("./sv-D9y-M1Fo.js"), "./locales/th.ts": () => import("./th-D9umBjEy.js"), "./locales/tr.ts": () => import("./tr-BddMywiw.js"), "./locales/uk.ts": () => import("./uk-Dbd31hFt.js"), "./locales/vi.ts": () => import("./vi-Do3BMOdh.js"), "./locales/zh.ts": () => import("./zh-gQSYLZI3.js") }), `./locales/${e}.ts`, 3).then((i) => {
|
|
243
|
+
const o = i.default ?? {};
|
|
244
|
+
return J.set(e, o), o;
|
|
245
|
+
}).catch((i) => {
|
|
246
|
+
console.warn(`[paywall] failed to load locale chunk "${e}"`, i);
|
|
247
|
+
const o = {};
|
|
248
|
+
return J.set(e, o), o;
|
|
249
|
+
}).finally(() => {
|
|
250
|
+
Q.delete(e);
|
|
251
|
+
});
|
|
252
|
+
return Q.set(e, a), a;
|
|
253
|
+
}
|
|
254
|
+
function te({ bootstrap: e, forceLocale: t, children: r }) {
|
|
255
|
+
const [a, i] = b("en"), [o, s] = b(null);
|
|
256
|
+
T(() => {
|
|
257
|
+
const h = (t && Tt(t) ? t : null) ?? (!e || !Jt(e) ? null : Xt(e));
|
|
258
|
+
if (!h) {
|
|
259
|
+
(o !== null || a !== "en") && (i("en"), s(null));
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (h === a && o) return;
|
|
263
|
+
let d = !1;
|
|
264
|
+
return Qt(h).then((p) => {
|
|
265
|
+
d || (i(h), s(p));
|
|
266
|
+
}), () => {
|
|
267
|
+
d = !0;
|
|
268
|
+
};
|
|
269
|
+
}, [e, t]);
|
|
270
|
+
const l = {
|
|
271
|
+
locale: a,
|
|
272
|
+
t: o ? (u, h, d) => Pt(o[u] ?? h, d) : Mt
|
|
273
|
+
};
|
|
274
|
+
return /* @__PURE__ */ n(Lt.Provider, { value: l, children: r });
|
|
275
|
+
}
|
|
276
|
+
function v() {
|
|
277
|
+
return Vt(Lt);
|
|
278
|
+
}
|
|
279
|
+
const ft = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
280
|
+
function ee({
|
|
281
|
+
open: e,
|
|
282
|
+
onClose: t,
|
|
283
|
+
labelledBy: r,
|
|
284
|
+
brandColor: a,
|
|
285
|
+
topBanner: i,
|
|
286
|
+
allowClose: o = !0,
|
|
287
|
+
hideCloseButton: s = !1,
|
|
288
|
+
inline: l = !1,
|
|
289
|
+
children: u
|
|
290
|
+
}) {
|
|
291
|
+
const { t: h } = v(), d = F(null), p = F(null);
|
|
292
|
+
return T(() => {
|
|
293
|
+
if (!e) return;
|
|
294
|
+
p.current = document.activeElement ?? null;
|
|
295
|
+
const f = d.current;
|
|
296
|
+
f && (f.querySelector(ft) ?? f).focus({ preventScroll: !0 });
|
|
297
|
+
const M = (y) => {
|
|
298
|
+
if (y.key === "Escape") {
|
|
299
|
+
if (!o) return;
|
|
300
|
+
y.stopPropagation(), t();
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (y.key !== "Tab" || !d.current) return;
|
|
304
|
+
const L = Array.from(
|
|
305
|
+
d.current.querySelectorAll(ft)
|
|
306
|
+
).filter((O) => !O.hasAttribute("disabled") && O.tabIndex !== -1);
|
|
307
|
+
if (L.length === 0) {
|
|
308
|
+
y.preventDefault();
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const I = L[0], z = L[L.length - 1], j = document.activeElement;
|
|
312
|
+
y.shiftKey && j === I ? (y.preventDefault(), z.focus()) : !y.shiftKey && j === z && (y.preventDefault(), I.focus());
|
|
313
|
+
};
|
|
314
|
+
document.addEventListener("keydown", M, !0);
|
|
315
|
+
const E = document.body.style.overflow;
|
|
316
|
+
return l || (document.body.style.overflow = "hidden"), () => {
|
|
317
|
+
document.removeEventListener("keydown", M, !0), l || (document.body.style.overflow = E), p.current?.focus?.({ preventScroll: !0 });
|
|
318
|
+
};
|
|
319
|
+
}, [e, t, o, l]), e ? /* @__PURE__ */ c(
|
|
320
|
+
"div",
|
|
321
|
+
{
|
|
322
|
+
class: `${l ? "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]`,
|
|
323
|
+
onClick: (f) => {
|
|
324
|
+
o && f.target === f.currentTarget && t();
|
|
325
|
+
},
|
|
326
|
+
"data-pw-root": !0,
|
|
327
|
+
children: [
|
|
328
|
+
/* @__PURE__ */ c(
|
|
329
|
+
"div",
|
|
330
|
+
{
|
|
331
|
+
class: "relative flex w-full max-w-[400px] flex-col animate-[pw-scale-in_220ms_cubic-bezier(0.16,1,0.3,1)]",
|
|
332
|
+
style: { "--pw-accent": a ?? "#3b82f6" },
|
|
333
|
+
children: [
|
|
334
|
+
i,
|
|
335
|
+
/* @__PURE__ */ c(
|
|
336
|
+
"div",
|
|
337
|
+
{
|
|
338
|
+
ref: d,
|
|
339
|
+
role: "dialog",
|
|
340
|
+
"aria-modal": "true",
|
|
341
|
+
"aria-labelledby": r,
|
|
342
|
+
tabIndex: -1,
|
|
343
|
+
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",
|
|
344
|
+
style: {
|
|
345
|
+
boxShadow: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
|
|
346
|
+
},
|
|
347
|
+
children: [
|
|
348
|
+
u,
|
|
349
|
+
o && !s ? /* @__PURE__ */ n(
|
|
350
|
+
"button",
|
|
351
|
+
{
|
|
352
|
+
type: "button",
|
|
353
|
+
onClick: t,
|
|
354
|
+
"aria-label": h("modal.close_aria", "Close"),
|
|
355
|
+
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)]",
|
|
356
|
+
children: /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
357
|
+
"path",
|
|
358
|
+
{
|
|
359
|
+
d: "M3 3l10 10M13 3L3 13",
|
|
360
|
+
stroke: "currentColor",
|
|
361
|
+
"stroke-width": "1.75",
|
|
362
|
+
"stroke-linecap": "round"
|
|
363
|
+
}
|
|
364
|
+
) })
|
|
365
|
+
}
|
|
366
|
+
) : null
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
)
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
/* @__PURE__ */ n("style", { children: `
|
|
374
|
+
@keyframes pw-fade-in { from { opacity: 0 } to { opacity: 1 } }
|
|
375
|
+
@keyframes pw-scale-in {
|
|
376
|
+
from { opacity: 0; transform: translateY(12px) scale(0.96) }
|
|
377
|
+
to { opacity: 1; transform: none }
|
|
378
|
+
}
|
|
379
|
+
` })
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
) : null;
|
|
383
|
+
}
|
|
384
|
+
function re(e, t) {
|
|
385
|
+
switch (e) {
|
|
386
|
+
case "google":
|
|
387
|
+
return t("auth.continue_with_google", "Continue with Google");
|
|
388
|
+
case "apple":
|
|
389
|
+
return t("auth.continue_with_apple", "Continue with Apple");
|
|
390
|
+
case "github":
|
|
391
|
+
return t("auth.continue_with_github", "Continue with GitHub");
|
|
392
|
+
case "facebook":
|
|
393
|
+
return t("auth.continue_with_facebook", "Continue with Facebook");
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
function wt(e, t, r) {
|
|
397
|
+
const a = t === "signup" ? r("auth.signup_failed", "Sign-up failed") : r("auth.signin_failed", "Sign-in failed");
|
|
398
|
+
if (!(e instanceof U)) return a;
|
|
399
|
+
switch (e.code) {
|
|
400
|
+
case "invalid_credentials":
|
|
401
|
+
return r("auth.invalid_credentials", "Invalid email or password");
|
|
402
|
+
case "email_not_confirmed":
|
|
403
|
+
return r("auth.email_not_confirmed", "Please confirm your email before signing in.");
|
|
404
|
+
case "email_exists":
|
|
405
|
+
case "user_already_exists":
|
|
406
|
+
return r("auth.email_exists", "An account with this email already exists.");
|
|
407
|
+
case "weak_password":
|
|
408
|
+
return r("auth.weak_password", "Password is too weak.");
|
|
409
|
+
case "invalid_otp":
|
|
410
|
+
case "otp_expired":
|
|
411
|
+
case "token_expired":
|
|
412
|
+
return r("auth.invalid_otp", "The code is invalid or has expired.");
|
|
413
|
+
case "over_email_send_rate_limit":
|
|
414
|
+
case "over_request_rate_limit":
|
|
415
|
+
case "rate_limited":
|
|
416
|
+
case "http_429":
|
|
417
|
+
return r("auth.rate_limited", "Too many requests. Please try again in a moment.");
|
|
418
|
+
case "network_error":
|
|
419
|
+
return r("auth.network_error", "Network error. Please check your connection and try again.");
|
|
420
|
+
case "upstream":
|
|
421
|
+
case "upstream_error":
|
|
422
|
+
case "http_502":
|
|
423
|
+
case "http_503":
|
|
424
|
+
case "http_504":
|
|
425
|
+
return r("auth.service_unavailable", "Service is temporarily unavailable. Please try again.");
|
|
426
|
+
default:
|
|
427
|
+
return a;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function Et({ block: e, ctx: t }) {
|
|
431
|
+
const r = t.auth, a = t.authSession, i = e.allow_signup !== !1, o = e.allow_password_reset !== !1, s = e.hide_when_authenticated !== !1;
|
|
432
|
+
if (!r)
|
|
433
|
+
return typeof console < "u" && console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"), null;
|
|
434
|
+
const l = a && !a.user.is_anonymous ? a : null;
|
|
435
|
+
return l && s ? null : l ? /* @__PURE__ */ n(ie, { email: l.user.email ?? "", onSignOut: () => r.signOut().catch(() => {
|
|
436
|
+
}) }) : /* @__PURE__ */ n(
|
|
437
|
+
ne,
|
|
438
|
+
{
|
|
439
|
+
block: e,
|
|
440
|
+
allowSignup: i,
|
|
441
|
+
allowReset: o,
|
|
442
|
+
ctx: t
|
|
443
|
+
}
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
function ie({ email: e, onSignOut: t }) {
|
|
447
|
+
const { t: r } = v();
|
|
448
|
+
return /* @__PURE__ */ c("div", { class: "flex items-center justify-between gap-3 rounded-2xl bg-gray-100 px-4 py-3", children: [
|
|
449
|
+
/* @__PURE__ */ c("div", { class: "flex flex-col", children: [
|
|
450
|
+
/* @__PURE__ */ n("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: r("auth.signed_in", "Signed in") }),
|
|
451
|
+
/* @__PURE__ */ n("span", { class: "text-sm font-medium text-gray-900", children: e })
|
|
452
|
+
] }),
|
|
453
|
+
/* @__PURE__ */ n(
|
|
454
|
+
"button",
|
|
455
|
+
{
|
|
456
|
+
type: "button",
|
|
457
|
+
onClick: t,
|
|
458
|
+
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)]",
|
|
459
|
+
children: r("auth.sign_out", "Sign out")
|
|
460
|
+
}
|
|
461
|
+
)
|
|
462
|
+
] });
|
|
463
|
+
}
|
|
464
|
+
function ne({ block: e, allowSignup: t, allowReset: r, ctx: a }) {
|
|
465
|
+
const { t: i } = v(), o = a.auth, s = e.providers ?? [], [l, u] = b("signin"), [h, d] = b(""), [p, x] = b(""), [_, g] = b(""), [f, M] = b(""), [E, y] = b(null), [L, I] = b(null), [z, j] = b(null), [O, D] = b(!1), [R, N] = b(null);
|
|
466
|
+
T(() => {
|
|
467
|
+
if (typeof o.getLastLogin != "function") return;
|
|
468
|
+
let S = !1;
|
|
469
|
+
return o.getLastLogin().then(
|
|
470
|
+
(P) => {
|
|
471
|
+
S || !P || (N(P), P.email && d((V) => V === "" ? P.email : V));
|
|
472
|
+
},
|
|
473
|
+
() => {
|
|
474
|
+
}
|
|
475
|
+
), () => {
|
|
476
|
+
S = !0;
|
|
477
|
+
};
|
|
478
|
+
}, [o]);
|
|
479
|
+
const A = (S) => {
|
|
480
|
+
u(S), I(null), j(null), D(!1);
|
|
481
|
+
}, C = async (S) => {
|
|
482
|
+
if (S.preventDefault(), !E) {
|
|
483
|
+
if (I(null), j(null), l === "signup" && !O) {
|
|
484
|
+
if (!h.trim()) return;
|
|
485
|
+
D(!0);
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (l === "signup" && p !== _) {
|
|
489
|
+
I(i("auth.passwords_mismatch", "Passwords don't match"));
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
y("email");
|
|
493
|
+
try {
|
|
494
|
+
l === "signin" ? await o.signInWithEmail({ email: h, password: p }) : l === "signup" ? (await o.signUp({ email: h, password: p })).kind === "confirmation_required" && (u("reset_verify"), j(i("auth.check_email_message", "Check your email for a confirmation code."))) : l === "forgot" ? (await o.requestPasswordReset({ email: h }), u("reset_sent"), j(
|
|
495
|
+
i("auth.reset_sent_message", "If that email exists, a reset code has been sent.")
|
|
496
|
+
)) : l === "reset_verify" && (await o.verifyOtp({
|
|
497
|
+
email: h,
|
|
498
|
+
token: f,
|
|
499
|
+
type: p ? "recovery" : "email"
|
|
500
|
+
}), p && await o.updatePassword({ password: p }));
|
|
501
|
+
} catch (P) {
|
|
502
|
+
I(wt(P, l === "signup" ? "signup" : l === "reset_verify" ? "otp" : l === "forgot" ? "reset" : "signin", i));
|
|
503
|
+
} finally {
|
|
504
|
+
y(null);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}, B = async (S) => {
|
|
508
|
+
if (!E) {
|
|
509
|
+
y(S), I(null), j(null);
|
|
510
|
+
try {
|
|
511
|
+
await o.signInWithOAuth({
|
|
512
|
+
provider: S,
|
|
513
|
+
onPopupOpened: () => y(null)
|
|
514
|
+
});
|
|
515
|
+
} catch (P) {
|
|
516
|
+
if (P instanceof U && (P.code === "oauth_cancelled" || P.code === "oauth_timeout"))
|
|
517
|
+
return;
|
|
518
|
+
I(wt(P, "signin", i));
|
|
519
|
+
} finally {
|
|
520
|
+
y(null);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}, w = s.length > 0 && (l === "signin" || l === "signup"), m = l === "signin" || l === "signup" || l === "forgot", k = l === "signin" || l === "signup" && O;
|
|
524
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col gap-5", children: [
|
|
525
|
+
/* @__PURE__ */ n(ae, { mode: l, customHeading: e.heading, customSubheading: e.subheading }),
|
|
526
|
+
w ? /* @__PURE__ */ c("div", { class: "flex flex-col gap-2.5", children: [
|
|
527
|
+
s.map((S) => /* @__PURE__ */ c("div", { class: "relative", children: [
|
|
528
|
+
/* @__PURE__ */ c(
|
|
529
|
+
"button",
|
|
530
|
+
{
|
|
531
|
+
type: "button",
|
|
532
|
+
onClick: () => B(S),
|
|
533
|
+
disabled: E !== null,
|
|
534
|
+
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)]",
|
|
535
|
+
children: [
|
|
536
|
+
E === S ? /* @__PURE__ */ n("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" }) : /* @__PURE__ */ n(ge, { provider: S }),
|
|
537
|
+
/* @__PURE__ */ n("span", { children: re(S, i) })
|
|
538
|
+
]
|
|
539
|
+
}
|
|
540
|
+
),
|
|
541
|
+
R?.method === S ? /* @__PURE__ */ n(bt, { email: R.email }) : null
|
|
542
|
+
] }, S)),
|
|
543
|
+
/* @__PURE__ */ n(he, {})
|
|
544
|
+
] }) : null,
|
|
545
|
+
/* @__PURE__ */ c("form", { onSubmit: C, class: "flex flex-col gap-3", children: [
|
|
546
|
+
m && /* @__PURE__ */ n(
|
|
547
|
+
mt,
|
|
548
|
+
{
|
|
549
|
+
type: "email",
|
|
550
|
+
placeholder: i("auth.email", "Email address"),
|
|
551
|
+
value: h,
|
|
552
|
+
onInput: d,
|
|
553
|
+
autocomplete: "email",
|
|
554
|
+
required: !0
|
|
555
|
+
}
|
|
556
|
+
),
|
|
557
|
+
k && /* @__PURE__ */ n(
|
|
558
|
+
tt,
|
|
559
|
+
{
|
|
560
|
+
placeholder: i("auth.password", "Password"),
|
|
561
|
+
value: p,
|
|
562
|
+
onInput: x,
|
|
563
|
+
autocomplete: l === "signin" ? "current-password" : "new-password",
|
|
564
|
+
required: !0
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
l === "signup" && O && /* @__PURE__ */ n(
|
|
568
|
+
tt,
|
|
569
|
+
{
|
|
570
|
+
placeholder: i("auth.repeat_password", "Repeat password"),
|
|
571
|
+
value: _,
|
|
572
|
+
onInput: g,
|
|
573
|
+
autocomplete: "new-password",
|
|
574
|
+
required: !0
|
|
575
|
+
}
|
|
576
|
+
),
|
|
577
|
+
l === "reset_verify" && /* @__PURE__ */ c(Z, { children: [
|
|
578
|
+
/* @__PURE__ */ n(
|
|
579
|
+
mt,
|
|
580
|
+
{
|
|
581
|
+
type: "text",
|
|
582
|
+
placeholder: i("auth.confirmation_code", "Confirmation code"),
|
|
583
|
+
value: f,
|
|
584
|
+
onInput: M,
|
|
585
|
+
autocomplete: "one-time-code",
|
|
586
|
+
inputMode: "numeric",
|
|
587
|
+
required: !0
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
/* @__PURE__ */ n(
|
|
591
|
+
tt,
|
|
592
|
+
{
|
|
593
|
+
placeholder: i(
|
|
594
|
+
"auth.new_password_optional",
|
|
595
|
+
"New password (optional — only for password reset)"
|
|
596
|
+
),
|
|
597
|
+
value: p,
|
|
598
|
+
onInput: x,
|
|
599
|
+
autocomplete: "new-password"
|
|
600
|
+
}
|
|
601
|
+
)
|
|
602
|
+
] }),
|
|
603
|
+
l === "reset_sent" && z && /* @__PURE__ */ n("p", { class: "rounded-2xl bg-gray-100 px-4 py-3 text-sm text-gray-600", children: z }),
|
|
604
|
+
l === "signin" && r && /* @__PURE__ */ n("div", { class: "flex justify-end text-sm", children: /* @__PURE__ */ n(W, { onClick: () => A("forgot"), children: i("auth.forgot_password", "Forgot password?") }) }),
|
|
605
|
+
L && /* @__PURE__ */ n("p", { class: "text-sm text-red-600", children: L }),
|
|
606
|
+
z && l !== "reset_sent" && /* @__PURE__ */ n("p", { class: "text-sm text-gray-500", children: z }),
|
|
607
|
+
l !== "reset_sent" && /* @__PURE__ */ c("div", { class: "relative", children: [
|
|
608
|
+
/* @__PURE__ */ n(
|
|
609
|
+
ce,
|
|
610
|
+
{
|
|
611
|
+
busy: E === "email",
|
|
612
|
+
label: se(l, O, e.submit_label ?? e.heading, i)
|
|
613
|
+
}
|
|
614
|
+
),
|
|
615
|
+
l === "signin" && R?.method === "email" ? /* @__PURE__ */ n(bt, { email: R.email }) : null
|
|
616
|
+
] })
|
|
617
|
+
] }),
|
|
618
|
+
/* @__PURE__ */ n(
|
|
619
|
+
le,
|
|
620
|
+
{
|
|
621
|
+
mode: l,
|
|
622
|
+
allowSignup: t,
|
|
623
|
+
onSwitch: A
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
] });
|
|
627
|
+
}
|
|
628
|
+
function ae({
|
|
629
|
+
mode: e,
|
|
630
|
+
customHeading: t,
|
|
631
|
+
customSubheading: r
|
|
632
|
+
}) {
|
|
633
|
+
const { t: a } = v(), i = oe(e, a), o = e === "signin" || e === "signup", s = o && t ? t : i.title, l = o && r !== void 0 ? r || null : i.subtitle;
|
|
634
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col gap-2", children: [
|
|
635
|
+
/* @__PURE__ */ n("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: s }),
|
|
636
|
+
l ? /* @__PURE__ */ n("p", { class: "text-base leading-relaxed text-gray-600", children: l }) : null
|
|
637
|
+
] });
|
|
638
|
+
}
|
|
639
|
+
function oe(e, t) {
|
|
640
|
+
switch (e) {
|
|
641
|
+
case "signin":
|
|
642
|
+
return {
|
|
643
|
+
title: t("auth.welcome", "Welcome back!"),
|
|
644
|
+
subtitle: t("auth.default_subtitle", "Sign in to access all features and sync your data.")
|
|
645
|
+
};
|
|
646
|
+
case "signup":
|
|
647
|
+
return {
|
|
648
|
+
title: t("auth.welcome_signup", "Welcome!"),
|
|
649
|
+
subtitle: t("auth.default_subtitle", "Sign in to access all features and sync your data.")
|
|
650
|
+
};
|
|
651
|
+
case "forgot":
|
|
652
|
+
return {
|
|
653
|
+
title: t("auth.forgot_password_title", "Forgot password?"),
|
|
654
|
+
subtitle: t(
|
|
655
|
+
"auth.forgot_subtitle",
|
|
656
|
+
"Enter your email and we'll send you a password reset link."
|
|
657
|
+
)
|
|
658
|
+
};
|
|
659
|
+
case "reset_sent":
|
|
660
|
+
return {
|
|
661
|
+
title: t("auth.check_email_title", "Check your email"),
|
|
662
|
+
subtitle: null
|
|
663
|
+
};
|
|
664
|
+
case "reset_verify":
|
|
665
|
+
return {
|
|
666
|
+
title: t("auth.reset_password_title", "Reset password"),
|
|
667
|
+
subtitle: t(
|
|
668
|
+
"auth.reset_password_subtitle",
|
|
669
|
+
"Enter the code from your email and a new password."
|
|
670
|
+
)
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
function se(e, t, r, a) {
|
|
675
|
+
if (e === "signin" && r) return r;
|
|
676
|
+
switch (e) {
|
|
677
|
+
case "signin":
|
|
678
|
+
return a("auth.log_in", "Sign In");
|
|
679
|
+
case "signup":
|
|
680
|
+
return t ? a("auth.create_account", "Create Account") : a("auth.sign_up", "Sign Up");
|
|
681
|
+
case "forgot":
|
|
682
|
+
return a("auth.send_reset", "Send Reset Email");
|
|
683
|
+
case "reset_verify":
|
|
684
|
+
return a("auth.verify", "Verify");
|
|
685
|
+
default:
|
|
686
|
+
return a("cta.continue", "Continue");
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
function le({
|
|
690
|
+
mode: e,
|
|
691
|
+
allowSignup: t,
|
|
692
|
+
onSwitch: r
|
|
693
|
+
}) {
|
|
694
|
+
const { t: a } = v();
|
|
695
|
+
return e === "signin" && t ? /* @__PURE__ */ c("p", { class: "text-center text-sm text-gray-600", children: [
|
|
696
|
+
a("auth.no_account", "Don't have an account?"),
|
|
697
|
+
" ",
|
|
698
|
+
/* @__PURE__ */ n(W, { onClick: () => r("signup"), children: a("auth.sign_up_link", "Sign Up") })
|
|
699
|
+
] }) : e === "signup" ? /* @__PURE__ */ c("p", { class: "text-center text-sm text-gray-600", children: [
|
|
700
|
+
a("auth.have_account", "Already have an account?"),
|
|
701
|
+
" ",
|
|
702
|
+
/* @__PURE__ */ n(W, { onClick: () => r("signin"), children: a("auth.log_in_link", "Log In") })
|
|
703
|
+
] }) : e === "forgot" || e === "reset_sent" || e === "reset_verify" ? /* @__PURE__ */ c("p", { class: "text-center text-sm text-gray-600", children: [
|
|
704
|
+
a("auth.no_account", "Don't have an account?"),
|
|
705
|
+
" ",
|
|
706
|
+
/* @__PURE__ */ n(W, { onClick: () => r("signup"), children: a("auth.sign_up_link", "Sign Up") })
|
|
707
|
+
] }) : null;
|
|
708
|
+
}
|
|
709
|
+
function W({
|
|
710
|
+
onClick: e,
|
|
711
|
+
children: t
|
|
712
|
+
}) {
|
|
713
|
+
return /* @__PURE__ */ n(
|
|
714
|
+
"button",
|
|
715
|
+
{
|
|
716
|
+
type: "button",
|
|
717
|
+
onClick: e,
|
|
718
|
+
class: "font-semibold transition-opacity hover:opacity-80 focus:outline-none focus-visible:opacity-80",
|
|
719
|
+
style: { color: "var(--pw-accent)" },
|
|
720
|
+
children: t
|
|
721
|
+
}
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
function ce({ busy: e, label: t }) {
|
|
725
|
+
return /* @__PURE__ */ n(
|
|
726
|
+
"button",
|
|
727
|
+
{
|
|
728
|
+
type: "submit",
|
|
729
|
+
disabled: e,
|
|
730
|
+
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)]",
|
|
731
|
+
style: {
|
|
732
|
+
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%)",
|
|
733
|
+
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)"
|
|
734
|
+
},
|
|
735
|
+
children: e ? /* @__PURE__ */ n("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ n("span", { class: "relative z-10", children: t })
|
|
736
|
+
}
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
function mt({ type: e, placeholder: t, value: r, onInput: a, autocomplete: i, inputMode: o, required: s }) {
|
|
740
|
+
return /* @__PURE__ */ n(
|
|
741
|
+
"input",
|
|
742
|
+
{
|
|
743
|
+
type: e,
|
|
744
|
+
value: r,
|
|
745
|
+
placeholder: t,
|
|
746
|
+
onInput: (l) => a(l.target.value),
|
|
747
|
+
autocomplete: i,
|
|
748
|
+
inputMode: o,
|
|
749
|
+
required: s,
|
|
750
|
+
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)]"
|
|
751
|
+
}
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
function tt({ placeholder: e, value: t, onInput: r, autocomplete: a, required: i }) {
|
|
755
|
+
const { t: o } = v(), [s, l] = b(!1), u = F(null);
|
|
756
|
+
T(() => {
|
|
757
|
+
const p = u.current;
|
|
758
|
+
p && p.value !== t && (p.value = t);
|
|
759
|
+
}, [s, t]);
|
|
760
|
+
const h = o("auth.show_password", "Show password"), d = o("auth.hide_password", "Hide password");
|
|
761
|
+
return /* @__PURE__ */ c("div", { class: "relative", children: [
|
|
762
|
+
/* @__PURE__ */ n(
|
|
763
|
+
"input",
|
|
764
|
+
{
|
|
765
|
+
ref: u,
|
|
766
|
+
type: s ? "text" : "password",
|
|
767
|
+
value: t,
|
|
768
|
+
placeholder: e,
|
|
769
|
+
onInput: (p) => r(p.target.value),
|
|
770
|
+
autocomplete: a,
|
|
771
|
+
required: i,
|
|
772
|
+
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)]"
|
|
773
|
+
}
|
|
774
|
+
),
|
|
775
|
+
/* @__PURE__ */ n(
|
|
776
|
+
"button",
|
|
777
|
+
{
|
|
778
|
+
type: "button",
|
|
779
|
+
onClick: () => l((p) => !p),
|
|
780
|
+
"aria-label": s ? d : h,
|
|
781
|
+
tabIndex: -1,
|
|
782
|
+
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)]",
|
|
783
|
+
children: s ? /* @__PURE__ */ n(ue, {}) : /* @__PURE__ */ n(de, {})
|
|
784
|
+
}
|
|
785
|
+
)
|
|
786
|
+
] });
|
|
787
|
+
}
|
|
788
|
+
function de() {
|
|
789
|
+
return /* @__PURE__ */ c("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
790
|
+
/* @__PURE__ */ n(
|
|
791
|
+
"path",
|
|
792
|
+
{
|
|
793
|
+
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",
|
|
794
|
+
stroke: "currentColor",
|
|
795
|
+
"stroke-width": "1.5",
|
|
796
|
+
"stroke-linecap": "round",
|
|
797
|
+
"stroke-linejoin": "round"
|
|
798
|
+
}
|
|
799
|
+
),
|
|
800
|
+
/* @__PURE__ */ n("circle", { cx: "10", cy: "10", r: "2.5", stroke: "currentColor", "stroke-width": "1.5" })
|
|
801
|
+
] });
|
|
802
|
+
}
|
|
803
|
+
function ue() {
|
|
804
|
+
return /* @__PURE__ */ c("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
805
|
+
/* @__PURE__ */ n(
|
|
806
|
+
"path",
|
|
807
|
+
{
|
|
808
|
+
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",
|
|
809
|
+
stroke: "currentColor",
|
|
810
|
+
"stroke-width": "1.5",
|
|
811
|
+
"stroke-linecap": "round",
|
|
812
|
+
"stroke-linejoin": "round"
|
|
813
|
+
}
|
|
814
|
+
),
|
|
815
|
+
/* @__PURE__ */ n(
|
|
816
|
+
"path",
|
|
817
|
+
{
|
|
818
|
+
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",
|
|
819
|
+
stroke: "currentColor",
|
|
820
|
+
"stroke-width": "1.5",
|
|
821
|
+
"stroke-linecap": "round",
|
|
822
|
+
"stroke-linejoin": "round"
|
|
823
|
+
}
|
|
824
|
+
)
|
|
825
|
+
] });
|
|
826
|
+
}
|
|
827
|
+
function bt({ email: e }) {
|
|
828
|
+
const { t } = v(), r = e ? t("auth.last_used", "Last · {email}", { email: pe(e) }) : t("auth.last_used_no_email", "Last");
|
|
829
|
+
return /* @__PURE__ */ n("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 });
|
|
830
|
+
}
|
|
831
|
+
function pe(e) {
|
|
832
|
+
const [t, r] = e.split("@");
|
|
833
|
+
return r ? `${t.slice(0, 3)}*****@${r}` : e;
|
|
834
|
+
}
|
|
835
|
+
function he() {
|
|
836
|
+
const { t: e } = v();
|
|
837
|
+
return /* @__PURE__ */ c("div", { class: "flex items-center gap-3 py-1 text-sm text-gray-400", children: [
|
|
838
|
+
/* @__PURE__ */ n("div", { class: "h-px flex-1 bg-gray-200" }),
|
|
839
|
+
/* @__PURE__ */ n("span", { children: e("auth.or", "or") }),
|
|
840
|
+
/* @__PURE__ */ n("div", { class: "h-px flex-1 bg-gray-200" })
|
|
841
|
+
] });
|
|
842
|
+
}
|
|
843
|
+
function ge({ provider: e }) {
|
|
844
|
+
return e === "google" ? /* @__PURE__ */ c("svg", { width: "20", height: "20", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
|
|
845
|
+
/* @__PURE__ */ n("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" }),
|
|
846
|
+
/* @__PURE__ */ n("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" }),
|
|
847
|
+
/* @__PURE__ */ n("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" }),
|
|
848
|
+
/* @__PURE__ */ n("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" })
|
|
849
|
+
] }) : e === "apple" ? (
|
|
850
|
+
// viewBox 0 0 24 24 даёт воздух сверху/снизу пути, поэтому визуально
|
|
851
|
+
// Apple-яблоко выглядит меньше Google. Компенсируем увеличенным
|
|
852
|
+
// width/height — 26×26 даёт примерно equal optical size с Google 20×20.
|
|
853
|
+
/* @__PURE__ */ n("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ n("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" }) })
|
|
854
|
+
) : e === "github" ? /* @__PURE__ */ n("svg", { width: "20", height: "20", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ n("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__ */ n("svg", { width: "18", height: "20", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ n("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" }) });
|
|
855
|
+
}
|
|
856
|
+
function fe({
|
|
857
|
+
block: e,
|
|
858
|
+
bootstrap: t,
|
|
859
|
+
auth: r,
|
|
860
|
+
authSession: a,
|
|
861
|
+
onBack: i,
|
|
862
|
+
showBack: o = !0,
|
|
863
|
+
intent: s = "preauth"
|
|
864
|
+
}) {
|
|
865
|
+
const { t: l } = v(), u = {
|
|
866
|
+
bootstrap: t,
|
|
867
|
+
selectedPriceId: null,
|
|
868
|
+
setSelectedPriceId: () => {
|
|
869
|
+
},
|
|
870
|
+
onAction: () => {
|
|
871
|
+
},
|
|
872
|
+
auth: r,
|
|
873
|
+
authSession: a
|
|
874
|
+
}, h = s === "restore" ? {
|
|
875
|
+
...e,
|
|
876
|
+
heading: l("auth.restore_purchases_heading", "Restore Purchases"),
|
|
877
|
+
subheading: l(
|
|
878
|
+
"auth.restore_purchases_subheading",
|
|
879
|
+
"Please sign in to restore your purchases."
|
|
880
|
+
)
|
|
881
|
+
} : s === "preauth" ? {
|
|
882
|
+
...e,
|
|
883
|
+
heading: l("auth.login_continue_purchase", "Log in to continue your purchase"),
|
|
884
|
+
subheading: l(
|
|
885
|
+
"auth.link_purchase_subheading",
|
|
886
|
+
"We'll link the purchase to your account to keep access."
|
|
887
|
+
),
|
|
888
|
+
// Preauth heading — descriptive sentence ("Log in to continue your
|
|
889
|
+
// purchase"), а не action verb. Длинные локализации (RU: "Войдите,
|
|
890
|
+
// чтобы продолжить покупку") в pill-кнопку h-12 не помещаются и
|
|
891
|
+
// переносятся на 2 строки. Явный короткий submit_label решает.
|
|
892
|
+
submit_label: l("auth.log_in", "Sign In")
|
|
893
|
+
} : e;
|
|
894
|
+
return /* @__PURE__ */ c("div", { class: "relative flex-1 min-h-0 overflow-y-auto p-6 sm:p-8", children: [
|
|
895
|
+
o ? /* @__PURE__ */ n(we, { onClick: i, ariaLabel: l("nav.back_aria", "Back") }) : null,
|
|
896
|
+
/* @__PURE__ */ n(Et, { block: h, ctx: u })
|
|
897
|
+
] });
|
|
898
|
+
}
|
|
899
|
+
function we({ onClick: e, ariaLabel: t }) {
|
|
900
|
+
return /* @__PURE__ */ n(
|
|
901
|
+
"button",
|
|
902
|
+
{
|
|
903
|
+
type: "button",
|
|
904
|
+
onClick: e,
|
|
905
|
+
"aria-label": t,
|
|
906
|
+
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)]",
|
|
907
|
+
children: /* @__PURE__ */ c("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
908
|
+
/* @__PURE__ */ n(
|
|
909
|
+
"path",
|
|
910
|
+
{
|
|
911
|
+
d: "M5 8h8a4 4 0 0 1 0 8H9",
|
|
912
|
+
stroke: "currentColor",
|
|
913
|
+
"stroke-width": "1.75",
|
|
914
|
+
"stroke-linecap": "round",
|
|
915
|
+
"stroke-linejoin": "round"
|
|
916
|
+
}
|
|
917
|
+
),
|
|
918
|
+
/* @__PURE__ */ n(
|
|
919
|
+
"path",
|
|
920
|
+
{
|
|
921
|
+
d: "M8 4 4 8l4 4",
|
|
922
|
+
stroke: "currentColor",
|
|
923
|
+
"stroke-width": "1.75",
|
|
924
|
+
"stroke-linecap": "round",
|
|
925
|
+
"stroke-linejoin": "round"
|
|
926
|
+
}
|
|
927
|
+
)
|
|
928
|
+
] })
|
|
929
|
+
}
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
function me({
|
|
933
|
+
auth: e,
|
|
934
|
+
onSuccess: t,
|
|
935
|
+
onBack: r,
|
|
936
|
+
heading: a,
|
|
937
|
+
description: i
|
|
938
|
+
}) {
|
|
939
|
+
const { t: o } = v(), s = a ?? o("anon.heading_default", "Continue as guest"), l = i ?? o("anon.description_default", "Setting up your guest session…"), [u, h] = b({ kind: "signing-in" }), d = F(!0);
|
|
940
|
+
T(() => () => {
|
|
941
|
+
d.current = !1;
|
|
942
|
+
}, []);
|
|
943
|
+
const p = () => {
|
|
944
|
+
h({ kind: "signing-in" }), (async () => {
|
|
945
|
+
try {
|
|
946
|
+
const x = await e.signInAnonymously();
|
|
947
|
+
if (!d.current) return;
|
|
948
|
+
t(x);
|
|
949
|
+
} catch (x) {
|
|
950
|
+
if (!d.current) return;
|
|
951
|
+
h({
|
|
952
|
+
kind: "error",
|
|
953
|
+
message: x instanceof Error ? x.message : "Anonymous sign-in failed"
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
})();
|
|
957
|
+
};
|
|
958
|
+
return T(() => {
|
|
959
|
+
p();
|
|
960
|
+
}, []), /* @__PURE__ */ c("div", { class: "flex flex-col gap-3", children: [
|
|
961
|
+
r ? /* @__PURE__ */ n(
|
|
962
|
+
"button",
|
|
963
|
+
{
|
|
964
|
+
type: "button",
|
|
965
|
+
onClick: r,
|
|
966
|
+
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)]",
|
|
967
|
+
children: o("nav.back", "← Back")
|
|
968
|
+
}
|
|
969
|
+
) : null,
|
|
970
|
+
/* @__PURE__ */ c("div", { class: "flex flex-col gap-1", children: [
|
|
971
|
+
/* @__PURE__ */ n("h2", { class: "text-xl font-semibold text-gray-900", children: s }),
|
|
972
|
+
/* @__PURE__ */ n("p", { class: "text-sm text-gray-500", children: l })
|
|
973
|
+
] }),
|
|
974
|
+
u.kind === "signing-in" ? /* @__PURE__ */ n("div", { class: "flex items-center justify-center py-6", children: /* @__PURE__ */ n(be, {}) }) : null,
|
|
975
|
+
u.kind === "error" ? /* @__PURE__ */ c("div", { class: "flex flex-col gap-3", children: [
|
|
976
|
+
/* @__PURE__ */ n("div", { class: "rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700", children: u.message }),
|
|
977
|
+
/* @__PURE__ */ n(
|
|
978
|
+
"button",
|
|
979
|
+
{
|
|
980
|
+
type: "button",
|
|
981
|
+
onClick: p,
|
|
982
|
+
class: "self-start rounded-md bg-[var(--pw-accent)] px-3 py-1.5 text-sm font-medium text-white hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)] focus-visible:ring-offset-2",
|
|
983
|
+
children: o("anon.try_again", "Try again")
|
|
984
|
+
}
|
|
985
|
+
)
|
|
986
|
+
] }) : null
|
|
987
|
+
] });
|
|
988
|
+
}
|
|
989
|
+
function be() {
|
|
990
|
+
return /* @__PURE__ */ c("svg", { class: "h-5 w-5 animate-spin text-[var(--pw-accent)]", viewBox: "0 0 24 24", fill: "none", children: [
|
|
991
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "3", "stroke-opacity": "0.2" }),
|
|
992
|
+
/* @__PURE__ */ n("path", { d: "M22 12a10 10 0 0 0-10-10", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round" })
|
|
993
|
+
] });
|
|
994
|
+
}
|
|
995
|
+
const jt = (e) => `pw-offer-${e}-start`;
|
|
996
|
+
function et(e) {
|
|
997
|
+
const t = e - Date.now();
|
|
998
|
+
return t <= 0 ? { days: 0, hours: 0, minutes: 0, seconds: 0, expired: !0 } : {
|
|
999
|
+
days: Math.floor(t / (1e3 * 60 * 60 * 24)),
|
|
1000
|
+
hours: Math.floor(t % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)),
|
|
1001
|
+
minutes: Math.floor(t % (1e3 * 60 * 60) / (1e3 * 60)),
|
|
1002
|
+
seconds: Math.floor(t % (1e3 * 60) / 1e3),
|
|
1003
|
+
expired: !1
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
function xe(e) {
|
|
1007
|
+
if (e.expires_at) {
|
|
1008
|
+
const t = Date.parse(e.expires_at);
|
|
1009
|
+
return Number.isFinite(t) ? t : null;
|
|
1010
|
+
}
|
|
1011
|
+
if (e.duration_minutes && e.duration_minutes > 0) {
|
|
1012
|
+
if (typeof window > "u") return null;
|
|
1013
|
+
try {
|
|
1014
|
+
const t = jt(e.id);
|
|
1015
|
+
let r = window.localStorage.getItem(t);
|
|
1016
|
+
return r || (r = (/* @__PURE__ */ new Date()).toISOString(), window.localStorage.setItem(t, r)), Date.parse(r) + e.duration_minutes * 6e4;
|
|
1017
|
+
} catch {
|
|
1018
|
+
return null;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return null;
|
|
1022
|
+
}
|
|
1023
|
+
function zt(e, t) {
|
|
1024
|
+
if (!e || e.length === 0) return null;
|
|
1025
|
+
if (t) {
|
|
1026
|
+
const r = e.find((a) => a.id === t);
|
|
1027
|
+
if (r) return r;
|
|
1028
|
+
}
|
|
1029
|
+
return e.find((r) => r.expires_at || r.duration_minutes) ?? null;
|
|
1030
|
+
}
|
|
1031
|
+
function Bt(e) {
|
|
1032
|
+
const t = e ? xe(e) : null, [r, a] = b(
|
|
1033
|
+
() => t !== null ? et(t) : null
|
|
1034
|
+
), i = F(t);
|
|
1035
|
+
return i.current = t, T(() => {
|
|
1036
|
+
if (t === null) {
|
|
1037
|
+
a(null);
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
a(et(t));
|
|
1041
|
+
const o = setInterval(() => {
|
|
1042
|
+
const s = et(i.current ?? 0);
|
|
1043
|
+
if (a(s), s.expired && (clearInterval(o), e?.duration_minutes && typeof window < "u"))
|
|
1044
|
+
try {
|
|
1045
|
+
window.localStorage.removeItem(jt(e.id));
|
|
1046
|
+
} catch {
|
|
1047
|
+
}
|
|
1048
|
+
}, 1e3);
|
|
1049
|
+
return () => clearInterval(o);
|
|
1050
|
+
}, [t, e?.duration_minutes, e?.id]), r;
|
|
1051
|
+
}
|
|
1052
|
+
function ve({ block: e, ctx: t }) {
|
|
1053
|
+
const { t: r } = v(), a = zt(t.bootstrap.offers, e.offer_id), i = Bt(a);
|
|
1054
|
+
if (!a || i === null || i.expired && !e.force) return null;
|
|
1055
|
+
const o = e.title ?? a.label ?? r("offer.limited_time", "Limited-time offer"), s = a.discount_percent ? `${o} ${a.discount_percent}%` : o;
|
|
1056
|
+
return /* @__PURE__ */ c(
|
|
1057
|
+
"div",
|
|
1058
|
+
{
|
|
1059
|
+
class: "flex flex-wrap items-center justify-center gap-2 rounded-2xl px-4 py-3 text-[15px] font-semibold leading-tight text-white",
|
|
1060
|
+
style: {
|
|
1061
|
+
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%)",
|
|
1062
|
+
textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
|
|
1063
|
+
},
|
|
1064
|
+
role: "status",
|
|
1065
|
+
children: [
|
|
1066
|
+
/* @__PURE__ */ n(Ft, {}),
|
|
1067
|
+
/* @__PURE__ */ n("span", { children: s }),
|
|
1068
|
+
/* @__PURE__ */ n(Ot, { value: i, t: r })
|
|
1069
|
+
]
|
|
1070
|
+
}
|
|
1071
|
+
);
|
|
1072
|
+
}
|
|
1073
|
+
function Ot({ value: e, t }) {
|
|
1074
|
+
return /* @__PURE__ */ c("div", { class: "flex items-center gap-1 font-mono text-sm", children: [
|
|
1075
|
+
e.days > 0 ? /* @__PURE__ */ c(Z, { children: [
|
|
1076
|
+
/* @__PURE__ */ n($, { children: String(e.days) }),
|
|
1077
|
+
/* @__PURE__ */ n("span", { class: "text-xs", children: t("countdown.d", "d") })
|
|
1078
|
+
] }) : null,
|
|
1079
|
+
/* @__PURE__ */ n($, { children: String(e.hours).padStart(2, "0") }),
|
|
1080
|
+
/* @__PURE__ */ n("span", { class: "text-xs", children: t("countdown.h", "h") }),
|
|
1081
|
+
/* @__PURE__ */ n($, { children: String(e.minutes).padStart(2, "0") }),
|
|
1082
|
+
/* @__PURE__ */ n("span", { class: "text-xs", children: t("countdown.m", "m") }),
|
|
1083
|
+
/* @__PURE__ */ n($, { children: String(e.seconds).padStart(2, "0") }),
|
|
1084
|
+
/* @__PURE__ */ n("span", { class: "text-xs", children: t("countdown.s", "s") })
|
|
1085
|
+
] });
|
|
1086
|
+
}
|
|
1087
|
+
function $({ children: e }) {
|
|
1088
|
+
return /* @__PURE__ */ n("span", { class: "rounded bg-black/20 px-1.5 py-0.5 text-xs font-bold", children: e });
|
|
1089
|
+
}
|
|
1090
|
+
function ye({ offer: e }) {
|
|
1091
|
+
const { t } = v(), r = Bt(e);
|
|
1092
|
+
if (r === null || r.expired) return null;
|
|
1093
|
+
const a = e.label ?? t("offer.limited_time", "Limited-time offer"), i = e.discount_percent ? `${a} ${e.discount_percent}%` : a;
|
|
1094
|
+
return /* @__PURE__ */ c(
|
|
1095
|
+
"div",
|
|
1096
|
+
{
|
|
1097
|
+
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",
|
|
1098
|
+
style: {
|
|
1099
|
+
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%)",
|
|
1100
|
+
textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
|
|
1101
|
+
},
|
|
1102
|
+
role: "status",
|
|
1103
|
+
children: [
|
|
1104
|
+
/* @__PURE__ */ n(Ft, {}),
|
|
1105
|
+
/* @__PURE__ */ n("span", { children: i }),
|
|
1106
|
+
/* @__PURE__ */ n(Ot, { value: r, t })
|
|
1107
|
+
]
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
function Ft() {
|
|
1112
|
+
return /* @__PURE__ */ n(
|
|
1113
|
+
"svg",
|
|
1114
|
+
{
|
|
1115
|
+
width: "16",
|
|
1116
|
+
height: "16",
|
|
1117
|
+
viewBox: "0 0 12 12",
|
|
1118
|
+
fill: "none",
|
|
1119
|
+
"aria-hidden": "true",
|
|
1120
|
+
children: /* @__PURE__ */ n(
|
|
1121
|
+
"path",
|
|
1122
|
+
{
|
|
1123
|
+
fill: "currentColor",
|
|
1124
|
+
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"
|
|
1125
|
+
}
|
|
1126
|
+
)
|
|
1127
|
+
}
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
1130
|
+
const rt = 3, it = 200, nt = 5e3, at = 5, ke = 10 * 1024 * 1024, xt = ["image/jpeg", "image/png", "image/webp"], vt = /.+@.+\..+/;
|
|
1131
|
+
function _e({ client: e, authSession: t, origin: r, onBack: a }) {
|
|
1132
|
+
const { t: i } = v(), o = t?.user.email ?? "", s = o || null, [l, u] = b(o), [h, d] = b(""), [p, x] = b(""), [_, g] = b([]), [f, M] = b(!1), [E, y] = b(null), [L, I] = b({}), z = Ct(() => {
|
|
1133
|
+
const A = (s ?? l).trim().toLowerCase(), C = h.trim(), B = p.trim();
|
|
1134
|
+
return vt.test(A) && C.length >= rt && C.length <= it && B.length >= 1 && B.length <= nt;
|
|
1135
|
+
}, [s, l, h, p]), j = () => {
|
|
1136
|
+
const A = {}, C = (s ?? l).trim(), B = h.trim(), w = p.trim();
|
|
1137
|
+
return C ? vt.test(C.toLowerCase()) || (A.email = i("support.invalid_email", "Invalid email")) : A.email = i("support.required", "Required"), (B.length < rt || B.length > it) && (A.subject = i("support.subject_length", "{min}–{max} characters", {
|
|
1138
|
+
min: rt,
|
|
1139
|
+
max: it
|
|
1140
|
+
})), (w.length < 1 || w.length > nt) && (A.message = i("support.message_length", "{min}–{max} characters", {
|
|
1141
|
+
min: 1,
|
|
1142
|
+
max: nt
|
|
1143
|
+
})), I(A), Object.keys(A).length === 0;
|
|
1144
|
+
}, O = async (A) => {
|
|
1145
|
+
if (A.preventDefault(), !f && j()) {
|
|
1146
|
+
M(!0), I((C) => ({ ...C, submit: void 0 }));
|
|
1147
|
+
try {
|
|
1148
|
+
const C = (s ?? l).trim();
|
|
1149
|
+
await e.createSupportTicket({
|
|
1150
|
+
subject: h.trim(),
|
|
1151
|
+
content: p.trim(),
|
|
1152
|
+
email: C || void 0,
|
|
1153
|
+
files: _.length > 0 ? _ : void 0
|
|
1154
|
+
}), y(C);
|
|
1155
|
+
} catch (C) {
|
|
1156
|
+
const B = C instanceof U && C.message || "Failed to send. Please try again.";
|
|
1157
|
+
I((w) => ({ ...w, submit: B }));
|
|
1158
|
+
} finally {
|
|
1159
|
+
M(!1);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}, D = () => {
|
|
1163
|
+
d(""), x(""), g([]), I({}), y(null);
|
|
1164
|
+
}, R = "flex flex-col gap-3 bg-white px-6 pb-6 pt-3 sm:px-8", N = { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" };
|
|
1165
|
+
return E ? /* @__PURE__ */ c("div", { class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1166
|
+
/* @__PURE__ */ c("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: [
|
|
1167
|
+
/* @__PURE__ */ n(
|
|
1168
|
+
"div",
|
|
1169
|
+
{
|
|
1170
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
1171
|
+
style: {
|
|
1172
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",
|
|
1173
|
+
color: "#fff",
|
|
1174
|
+
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)"
|
|
1175
|
+
},
|
|
1176
|
+
"aria-hidden": "true",
|
|
1177
|
+
children: /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", class: "h-7 w-7", children: /* @__PURE__ */ n(
|
|
1178
|
+
"path",
|
|
1179
|
+
{
|
|
1180
|
+
fill: "currentColor",
|
|
1181
|
+
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"
|
|
1182
|
+
}
|
|
1183
|
+
) })
|
|
1184
|
+
}
|
|
1185
|
+
),
|
|
1186
|
+
/* @__PURE__ */ n("div", { class: "text-lg font-semibold tracking-tight text-gray-900", children: i("support.success_heading", "Request submitted") }),
|
|
1187
|
+
/* @__PURE__ */ c("div", { class: "max-w-[320px] text-sm leading-relaxed text-gray-500", children: [
|
|
1188
|
+
i(
|
|
1189
|
+
"support.success_message_prefix",
|
|
1190
|
+
"We've received your message and will respond to"
|
|
1191
|
+
),
|
|
1192
|
+
" ",
|
|
1193
|
+
/* @__PURE__ */ n("b", { class: "text-gray-700", children: E }),
|
|
1194
|
+
"."
|
|
1195
|
+
] })
|
|
1196
|
+
] }),
|
|
1197
|
+
/* @__PURE__ */ n("div", { class: R, style: N, children: /* @__PURE__ */ c("div", { class: "flex items-center justify-center gap-3", children: [
|
|
1198
|
+
/* @__PURE__ */ n(
|
|
1199
|
+
"button",
|
|
1200
|
+
{
|
|
1201
|
+
type: "button",
|
|
1202
|
+
onClick: a,
|
|
1203
|
+
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)]",
|
|
1204
|
+
children: r === "standalone" ? i("support.done_button", "Done") : i("nav.back_aria", "Back")
|
|
1205
|
+
}
|
|
1206
|
+
),
|
|
1207
|
+
/* @__PURE__ */ n(
|
|
1208
|
+
"button",
|
|
1209
|
+
{
|
|
1210
|
+
type: "button",
|
|
1211
|
+
onClick: D,
|
|
1212
|
+
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)]",
|
|
1213
|
+
style: {
|
|
1214
|
+
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
1215
|
+
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
1216
|
+
},
|
|
1217
|
+
children: i("support.send_another", "Send another request")
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
] }) })
|
|
1221
|
+
] }) : /* @__PURE__ */ c("form", { onSubmit: O, class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1222
|
+
/* @__PURE__ */ n(Se, { onClick: a, ariaLabel: i("nav.back_aria", "Back") }),
|
|
1223
|
+
/* @__PURE__ */ n("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__ */ c("div", { class: "flex flex-col gap-5", children: [
|
|
1224
|
+
/* @__PURE__ */ c("div", { class: "flex flex-col gap-2 pr-10", children: [
|
|
1225
|
+
/* @__PURE__ */ n("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: i("support.heading", "Support") }),
|
|
1226
|
+
/* @__PURE__ */ n("p", { class: "text-base leading-relaxed text-gray-600", children: i("support.instruction", "Please fill out the form below to submit your support request.") })
|
|
1227
|
+
] }),
|
|
1228
|
+
/* @__PURE__ */ c("div", { class: "flex flex-col gap-3", children: [
|
|
1229
|
+
s ? /* @__PURE__ */ c("div", { class: "rounded-2xl bg-gray-100 px-5 py-3 text-sm text-gray-600", children: [
|
|
1230
|
+
i("support.sending_as", "Sending as"),
|
|
1231
|
+
" ",
|
|
1232
|
+
/* @__PURE__ */ n("b", { class: "font-medium text-gray-900", children: s })
|
|
1233
|
+
] }) : /* @__PURE__ */ n(
|
|
1234
|
+
yt,
|
|
1235
|
+
{
|
|
1236
|
+
type: "email",
|
|
1237
|
+
placeholder: i("support.email_placeholder", "Enter your email *"),
|
|
1238
|
+
value: l,
|
|
1239
|
+
onInput: u,
|
|
1240
|
+
error: L.email,
|
|
1241
|
+
autocomplete: "email",
|
|
1242
|
+
required: !0
|
|
1243
|
+
}
|
|
1244
|
+
),
|
|
1245
|
+
/* @__PURE__ */ n(
|
|
1246
|
+
yt,
|
|
1247
|
+
{
|
|
1248
|
+
type: "text",
|
|
1249
|
+
placeholder: i("support.subject_placeholder", "Enter your subject *"),
|
|
1250
|
+
value: h,
|
|
1251
|
+
onInput: d,
|
|
1252
|
+
error: L.subject,
|
|
1253
|
+
required: !0
|
|
1254
|
+
}
|
|
1255
|
+
),
|
|
1256
|
+
/* @__PURE__ */ n(
|
|
1257
|
+
Ce,
|
|
1258
|
+
{
|
|
1259
|
+
placeholder: i("support.message_placeholder", "Enter your message *"),
|
|
1260
|
+
value: p,
|
|
1261
|
+
onInput: x,
|
|
1262
|
+
error: L.message,
|
|
1263
|
+
required: !0
|
|
1264
|
+
}
|
|
1265
|
+
),
|
|
1266
|
+
/* @__PURE__ */ n(Ie, { files: _, onChange: g, disabled: f })
|
|
1267
|
+
] })
|
|
1268
|
+
] }) }),
|
|
1269
|
+
/* @__PURE__ */ c("div", { class: R, style: N, children: [
|
|
1270
|
+
L.submit && /* @__PURE__ */ n("p", { class: "text-sm text-red-600", children: L.submit }),
|
|
1271
|
+
/* @__PURE__ */ c("div", { class: "flex items-center justify-end gap-3", children: [
|
|
1272
|
+
/* @__PURE__ */ n(
|
|
1273
|
+
"button",
|
|
1274
|
+
{
|
|
1275
|
+
type: "button",
|
|
1276
|
+
onClick: a,
|
|
1277
|
+
disabled: f,
|
|
1278
|
+
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)]",
|
|
1279
|
+
children: r === "standalone" ? i("support.close_button", "Close") : i("nav.back_aria", "Back")
|
|
1280
|
+
}
|
|
1281
|
+
),
|
|
1282
|
+
/* @__PURE__ */ n(
|
|
1283
|
+
"button",
|
|
1284
|
+
{
|
|
1285
|
+
type: "submit",
|
|
1286
|
+
disabled: !z || f,
|
|
1287
|
+
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)]",
|
|
1288
|
+
style: {
|
|
1289
|
+
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%)",
|
|
1290
|
+
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)"
|
|
1291
|
+
},
|
|
1292
|
+
children: f ? /* @__PURE__ */ n("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ n("span", { class: "relative z-10", children: i("support.send_button", "Send") })
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
] })
|
|
1296
|
+
] })
|
|
1297
|
+
] });
|
|
1298
|
+
}
|
|
1299
|
+
function Se({ onClick: e, ariaLabel: t }) {
|
|
1300
|
+
return /* @__PURE__ */ n(
|
|
1301
|
+
"button",
|
|
1302
|
+
{
|
|
1303
|
+
type: "button",
|
|
1304
|
+
onClick: e,
|
|
1305
|
+
"aria-label": t,
|
|
1306
|
+
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)]",
|
|
1307
|
+
children: /* @__PURE__ */ c("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1308
|
+
/* @__PURE__ */ n(
|
|
1309
|
+
"path",
|
|
1310
|
+
{
|
|
1311
|
+
d: "M5 8h8a4 4 0 0 1 0 8H9",
|
|
1312
|
+
stroke: "currentColor",
|
|
1313
|
+
"stroke-width": "1.75",
|
|
1314
|
+
"stroke-linecap": "round",
|
|
1315
|
+
"stroke-linejoin": "round"
|
|
1316
|
+
}
|
|
1317
|
+
),
|
|
1318
|
+
/* @__PURE__ */ n(
|
|
1319
|
+
"path",
|
|
1320
|
+
{
|
|
1321
|
+
d: "M8 4 4 8l4 4",
|
|
1322
|
+
stroke: "currentColor",
|
|
1323
|
+
"stroke-width": "1.75",
|
|
1324
|
+
"stroke-linecap": "round",
|
|
1325
|
+
"stroke-linejoin": "round"
|
|
1326
|
+
}
|
|
1327
|
+
)
|
|
1328
|
+
] })
|
|
1329
|
+
}
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
function yt({
|
|
1333
|
+
type: e,
|
|
1334
|
+
placeholder: t,
|
|
1335
|
+
value: r,
|
|
1336
|
+
onInput: a,
|
|
1337
|
+
error: i,
|
|
1338
|
+
autocomplete: o,
|
|
1339
|
+
required: s
|
|
1340
|
+
}) {
|
|
1341
|
+
return /* @__PURE__ */ c("div", { children: [
|
|
1342
|
+
/* @__PURE__ */ n(
|
|
1343
|
+
"input",
|
|
1344
|
+
{
|
|
1345
|
+
type: e,
|
|
1346
|
+
value: r,
|
|
1347
|
+
placeholder: t,
|
|
1348
|
+
onInput: (l) => a(l.target.value),
|
|
1349
|
+
autocomplete: o,
|
|
1350
|
+
required: s,
|
|
1351
|
+
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 ${i ? "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)]"}`
|
|
1352
|
+
}
|
|
1353
|
+
),
|
|
1354
|
+
i && /* @__PURE__ */ n("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: i })
|
|
1355
|
+
] });
|
|
1356
|
+
}
|
|
1357
|
+
function Ce({
|
|
1358
|
+
placeholder: e,
|
|
1359
|
+
value: t,
|
|
1360
|
+
onInput: r,
|
|
1361
|
+
error: a,
|
|
1362
|
+
required: i
|
|
1363
|
+
}) {
|
|
1364
|
+
return /* @__PURE__ */ c("div", { children: [
|
|
1365
|
+
/* @__PURE__ */ n(
|
|
1366
|
+
"textarea",
|
|
1367
|
+
{
|
|
1368
|
+
value: t,
|
|
1369
|
+
placeholder: e,
|
|
1370
|
+
onInput: (o) => r(o.target.value),
|
|
1371
|
+
required: i,
|
|
1372
|
+
rows: 5,
|
|
1373
|
+
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 ${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)]"}`
|
|
1374
|
+
}
|
|
1375
|
+
),
|
|
1376
|
+
a && /* @__PURE__ */ n("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: a })
|
|
1377
|
+
] });
|
|
1378
|
+
}
|
|
1379
|
+
function Ie({ files: e, onChange: t, disabled: r }) {
|
|
1380
|
+
const { t: a } = v(), i = F(null), [o, s] = b(!1), [l, u] = b(null), h = (d) => {
|
|
1381
|
+
if (!d || r) return;
|
|
1382
|
+
u(null);
|
|
1383
|
+
const p = Array.from(d);
|
|
1384
|
+
if (e.length + p.length > at) {
|
|
1385
|
+
u(a("support.too_many_files", "Up to {max} files", { max: at }));
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1388
|
+
const x = p.filter(
|
|
1389
|
+
(_) => xt.includes(_.type) && _.size <= ke
|
|
1390
|
+
);
|
|
1391
|
+
if (x.length !== p.length) {
|
|
1392
|
+
u(a("support.invalid_file", "Only JPEG/PNG/WebP, ≤ 10MB each"));
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
t([...e, ...x]);
|
|
1396
|
+
};
|
|
1397
|
+
return /* @__PURE__ */ c("div", { children: [
|
|
1398
|
+
/* @__PURE__ */ n("span", { class: "text-xs font-medium text-gray-700", children: a("support.attachments_label", "Attachments (optional)") }),
|
|
1399
|
+
/* @__PURE__ */ c(
|
|
1400
|
+
"div",
|
|
1401
|
+
{
|
|
1402
|
+
role: "button",
|
|
1403
|
+
tabIndex: 0,
|
|
1404
|
+
"aria-label": a("support.attachments_aria", "Attachments upload"),
|
|
1405
|
+
onClick: () => !r && i.current?.click(),
|
|
1406
|
+
onDragOver: (d) => {
|
|
1407
|
+
d.preventDefault(), r || s(!0);
|
|
1408
|
+
},
|
|
1409
|
+
onDragLeave: () => s(!1),
|
|
1410
|
+
onDrop: (d) => {
|
|
1411
|
+
d.preventDefault(), s(!1), h(d.dataTransfer?.files ?? null);
|
|
1412
|
+
},
|
|
1413
|
+
class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${o ? "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" : ""}`,
|
|
1414
|
+
children: [
|
|
1415
|
+
/* @__PURE__ */ n("div", { class: "text-xs text-gray-500", children: a("support.dropzone_text", "Drop images here or click to select") }),
|
|
1416
|
+
/* @__PURE__ */ n("div", { class: "mt-0.5 text-[11px] text-gray-400", children: a("support.file_requirements", "JPEG/PNG/WebP, up to {max} files, ≤ 10MB each", {
|
|
1417
|
+
max: at
|
|
1418
|
+
}) })
|
|
1419
|
+
]
|
|
1420
|
+
}
|
|
1421
|
+
),
|
|
1422
|
+
/* @__PURE__ */ n(
|
|
1423
|
+
"input",
|
|
1424
|
+
{
|
|
1425
|
+
ref: i,
|
|
1426
|
+
type: "file",
|
|
1427
|
+
multiple: !0,
|
|
1428
|
+
accept: xt.join(","),
|
|
1429
|
+
class: "hidden",
|
|
1430
|
+
onChange: (d) => {
|
|
1431
|
+
h(d.target.files), d.currentTarget.value = "";
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
),
|
|
1435
|
+
l && /* @__PURE__ */ n("p", { class: "mt-1 text-xs text-red-600", children: l }),
|
|
1436
|
+
e.length > 0 && /* @__PURE__ */ n("ul", { class: "mt-2 flex flex-col gap-1", children: e.map((d, p) => /* @__PURE__ */ c(
|
|
1437
|
+
"li",
|
|
1438
|
+
{
|
|
1439
|
+
class: "flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",
|
|
1440
|
+
children: [
|
|
1441
|
+
/* @__PURE__ */ n("span", { class: "truncate text-gray-700", children: d.name }),
|
|
1442
|
+
/* @__PURE__ */ n(
|
|
1443
|
+
"button",
|
|
1444
|
+
{
|
|
1445
|
+
type: "button",
|
|
1446
|
+
onClick: () => {
|
|
1447
|
+
const x = [...e];
|
|
1448
|
+
x.splice(p, 1), t(x);
|
|
1449
|
+
},
|
|
1450
|
+
disabled: r,
|
|
1451
|
+
class: "text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60",
|
|
1452
|
+
"aria-label": a("support.remove_file_aria", "Remove {filename}", { filename: d.name }),
|
|
1453
|
+
children: "✕"
|
|
1454
|
+
}
|
|
1455
|
+
)
|
|
1456
|
+
]
|
|
1457
|
+
},
|
|
1458
|
+
`${d.name}-${d.size}-${p}`
|
|
1459
|
+
)) })
|
|
1460
|
+
] });
|
|
1461
|
+
}
|
|
1462
|
+
const Ae = {
|
|
1463
|
+
day: "cta.get_plan_daily",
|
|
1464
|
+
week: "cta.get_plan_weekly",
|
|
1465
|
+
month: "cta.get_plan_monthly",
|
|
1466
|
+
year: "cta.get_plan_yearly"
|
|
1467
|
+
}, Me = {
|
|
1468
|
+
day: "Get Daily Plan",
|
|
1469
|
+
week: "Get Weekly Plan",
|
|
1470
|
+
month: "Get Monthly Plan",
|
|
1471
|
+
year: "Get Yearly Plan"
|
|
1472
|
+
};
|
|
1473
|
+
function Le(e, t, r, a) {
|
|
1474
|
+
if (t === "close") return a("cta.close", "Close");
|
|
1475
|
+
if (!e) return a("cta.continue", "Continue");
|
|
1476
|
+
if (!r && e.trial_days && e.interval && e.interval !== "lifetime")
|
|
1477
|
+
return a("cta.start_trial", "Start {days}-Day Free Trial", { days: e.trial_days });
|
|
1478
|
+
if (!e.interval || e.interval === "lifetime")
|
|
1479
|
+
return a("cta.get_lifetime_access", "Get Lifetime Access");
|
|
1480
|
+
const i = Ae[e.interval];
|
|
1481
|
+
return i ? a(i, Me[e.interval]) : a("cta.get_plan_generic", "Get {interval} Plan", {
|
|
1482
|
+
interval: Pe(e.interval)
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
function Pe(e) {
|
|
1486
|
+
return e.length ? e[0].toUpperCase() + e.slice(1) : e;
|
|
1487
|
+
}
|
|
1488
|
+
function Te({ block: e, ctx: t }) {
|
|
1489
|
+
const { t: r } = v(), [a, i] = b(!1), o = e.priceId ?? t.selectedPriceId, s = a || e.action === "checkout" && !o, l = o ? t.bootstrap.prices.find((p) => p.id === o) ?? null : null, u = t.bootstrap.user?.had_previous_trial ?? !1, h = e.label ?? Le(l, e.action, u, r);
|
|
1490
|
+
return /* @__PURE__ */ c(
|
|
1491
|
+
"button",
|
|
1492
|
+
{
|
|
1493
|
+
type: "button",
|
|
1494
|
+
disabled: s,
|
|
1495
|
+
onClick: async () => {
|
|
1496
|
+
if (!s) {
|
|
1497
|
+
i(!0);
|
|
1498
|
+
try {
|
|
1499
|
+
await t.onAction(e.action, { priceId: o });
|
|
1500
|
+
} finally {
|
|
1501
|
+
i(!1);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
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)]",
|
|
1506
|
+
style: {
|
|
1507
|
+
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%)",
|
|
1508
|
+
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)"
|
|
1509
|
+
},
|
|
1510
|
+
children: [
|
|
1511
|
+
/* @__PURE__ */ n(
|
|
1512
|
+
"span",
|
|
1513
|
+
{
|
|
1514
|
+
class: "absolute inset-0 opacity-40",
|
|
1515
|
+
style: {
|
|
1516
|
+
background: "radial-gradient(circle at 50% 0%, color-mix(in srgb, white 40%, transparent) 0%, transparent 70%)"
|
|
1517
|
+
},
|
|
1518
|
+
"aria-hidden": "true"
|
|
1519
|
+
}
|
|
1520
|
+
),
|
|
1521
|
+
a ? /* @__PURE__ */ n("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ n("span", { class: "relative z-10", children: h })
|
|
1522
|
+
]
|
|
1523
|
+
}
|
|
1524
|
+
);
|
|
1525
|
+
}
|
|
1526
|
+
function Ee({ ctx: e }) {
|
|
1527
|
+
const { t } = v(), r = e.authSession, a = e.auth, [i, o] = b(!1), s = () => e.onAction("support");
|
|
1528
|
+
if (r && !r.user.is_anonymous) {
|
|
1529
|
+
const l = async () => {
|
|
1530
|
+
if (!(!a || i)) {
|
|
1531
|
+
o(!0);
|
|
1532
|
+
try {
|
|
1533
|
+
await a.signOut();
|
|
1534
|
+
} catch {
|
|
1535
|
+
} finally {
|
|
1536
|
+
o(!1);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
return /* @__PURE__ */ c("div", { class: "-mt-3 flex flex-col items-center gap-1.5 pt-1 text-center text-[13px] text-gray-500", children: [
|
|
1541
|
+
/* @__PURE__ */ c("span", { children: [
|
|
1542
|
+
t("session.signed_in_as_prefix", "Signed in as"),
|
|
1543
|
+
" ",
|
|
1544
|
+
/* @__PURE__ */ n("b", { class: "font-medium text-gray-700", children: r.user.email })
|
|
1545
|
+
] }),
|
|
1546
|
+
/* @__PURE__ */ c("div", { class: "flex items-center justify-center gap-3", children: [
|
|
1547
|
+
/* @__PURE__ */ n(G, { onClick: l, disabled: !a || i, children: i ? t("session.signing_out", "Signing out…") : t("session.sign_out", "Sign Out") }),
|
|
1548
|
+
/* @__PURE__ */ n(kt, {}),
|
|
1549
|
+
/* @__PURE__ */ n(G, { onClick: s, children: t("session.contact_support", "Contact Support") })
|
|
1550
|
+
] })
|
|
1551
|
+
] });
|
|
1552
|
+
}
|
|
1553
|
+
return /* @__PURE__ */ c("div", { class: "-mt-3 flex items-center justify-center gap-3 pt-1 text-center text-[13px]", children: [
|
|
1554
|
+
/* @__PURE__ */ n(G, { onClick: () => e.onAction("restore"), children: t("session.restore_purchases", "Restore purchases") }),
|
|
1555
|
+
/* @__PURE__ */ n(kt, {}),
|
|
1556
|
+
/* @__PURE__ */ n(G, { onClick: s, children: t("session.contact_support", "Contact Support") })
|
|
1557
|
+
] });
|
|
1558
|
+
}
|
|
1559
|
+
function G({
|
|
1560
|
+
onClick: e,
|
|
1561
|
+
disabled: t,
|
|
1562
|
+
children: r
|
|
1563
|
+
}) {
|
|
1564
|
+
return /* @__PURE__ */ n(
|
|
1565
|
+
"button",
|
|
1566
|
+
{
|
|
1567
|
+
type: "button",
|
|
1568
|
+
onClick: e,
|
|
1569
|
+
disabled: t,
|
|
1570
|
+
class: "font-semibold transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:opacity-80",
|
|
1571
|
+
style: { color: "var(--pw-accent)" },
|
|
1572
|
+
children: r
|
|
1573
|
+
}
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
function kt() {
|
|
1577
|
+
return /* @__PURE__ */ n("span", { class: "h-1 w-1 rounded-full bg-gray-300", "aria-hidden": "true" });
|
|
1578
|
+
}
|
|
1579
|
+
function je({ block: e }) {
|
|
1580
|
+
return e.items.length ? /* @__PURE__ */ n("ul", { class: "flex flex-col gap-2.5", role: "list", children: e.items.map((t) => /* @__PURE__ */ c("li", { class: "flex items-start gap-3 text-sm text-gray-700", children: [
|
|
1581
|
+
/* @__PURE__ */ n(
|
|
1582
|
+
"svg",
|
|
1583
|
+
{
|
|
1584
|
+
width: "18",
|
|
1585
|
+
height: "18",
|
|
1586
|
+
viewBox: "0 0 20 20",
|
|
1587
|
+
fill: "none",
|
|
1588
|
+
class: "mt-0.5 flex-shrink-0 text-emerald-500",
|
|
1589
|
+
"aria-hidden": "true",
|
|
1590
|
+
children: /* @__PURE__ */ n(
|
|
1591
|
+
"path",
|
|
1592
|
+
{
|
|
1593
|
+
d: "M4 10.5l3.5 3.5 8.5-8.5",
|
|
1594
|
+
stroke: "currentColor",
|
|
1595
|
+
"stroke-width": "2.5",
|
|
1596
|
+
"stroke-linecap": "round",
|
|
1597
|
+
"stroke-linejoin": "round"
|
|
1598
|
+
}
|
|
1599
|
+
)
|
|
1600
|
+
}
|
|
1601
|
+
),
|
|
1602
|
+
/* @__PURE__ */ c("div", { class: "flex flex-col gap-0.5", children: [
|
|
1603
|
+
/* @__PURE__ */ n("span", { class: "font-medium leading-snug text-gray-900", children: t.name }),
|
|
1604
|
+
t.desc ? /* @__PURE__ */ n("span", { class: "text-xs leading-relaxed text-gray-400", children: t.desc }) : null
|
|
1605
|
+
] })
|
|
1606
|
+
] }, t.id)) }) : null;
|
|
1607
|
+
}
|
|
1608
|
+
function ze({ block: e }) {
|
|
1609
|
+
const { t } = v(), r = e.title ?? t("pricing.money_back", "30-day money-back guarantee"), a = e.subtitle, i = (e.icon ?? "dollar_shield") !== "none", o = Be(r);
|
|
1610
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col items-center gap-1.5 border-b-1 pb-4 mb-1 border-gray-100", children: [
|
|
1611
|
+
/* @__PURE__ */ c("div", { class: "inline-flex items-center gap-2 text-[12px] text-gray-700", children: [
|
|
1612
|
+
i ? /* @__PURE__ */ n(Oe, {}) : null,
|
|
1613
|
+
o ? /* @__PURE__ */ c("span", { children: [
|
|
1614
|
+
/* @__PURE__ */ n("b", { class: "font-bold text-gray-900", children: o.bold }),
|
|
1615
|
+
" ",
|
|
1616
|
+
/* @__PURE__ */ n("span", { class: "font-medium", children: o.rest })
|
|
1617
|
+
] }) : /* @__PURE__ */ n("span", { class: "font-medium", children: r })
|
|
1618
|
+
] }),
|
|
1619
|
+
a ? /* @__PURE__ */ n("span", { class: "text-center text-xs leading-relaxed text-gray-500", children: a }) : null
|
|
1620
|
+
] });
|
|
1621
|
+
}
|
|
1622
|
+
function Be(e) {
|
|
1623
|
+
const t = e.match(/^(\d+[-\s]?days?)\s+(.+)$/i);
|
|
1624
|
+
return t ? { bold: t[1], rest: t[2] } : null;
|
|
1625
|
+
}
|
|
1626
|
+
function Oe() {
|
|
1627
|
+
return /* @__PURE__ */ c(
|
|
1628
|
+
"svg",
|
|
1629
|
+
{
|
|
1630
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1631
|
+
viewBox: "0 0 24 24",
|
|
1632
|
+
fill: "none",
|
|
1633
|
+
width: "16",
|
|
1634
|
+
height: "16",
|
|
1635
|
+
class: "flex-shrink-0 text-emerald-500",
|
|
1636
|
+
"aria-hidden": "true",
|
|
1637
|
+
children: [
|
|
1638
|
+
/* @__PURE__ */ n(
|
|
1639
|
+
"path",
|
|
1640
|
+
{
|
|
1641
|
+
d: "M12 2 4 5v6c0 5.25 3.5 9.5 8 11 4.5-1.5 8-5.75 8-11V5l-8-3Z",
|
|
1642
|
+
stroke: "currentColor",
|
|
1643
|
+
"stroke-width": "2",
|
|
1644
|
+
"stroke-linejoin": "round"
|
|
1645
|
+
}
|
|
1646
|
+
),
|
|
1647
|
+
/* @__PURE__ */ n(
|
|
1648
|
+
"path",
|
|
1649
|
+
{
|
|
1650
|
+
d: "m9 12 2 2 4-4",
|
|
1651
|
+
stroke: "currentColor",
|
|
1652
|
+
"stroke-width": "2",
|
|
1653
|
+
"stroke-linecap": "round",
|
|
1654
|
+
"stroke-linejoin": "round"
|
|
1655
|
+
}
|
|
1656
|
+
)
|
|
1657
|
+
]
|
|
1658
|
+
}
|
|
1659
|
+
);
|
|
1660
|
+
}
|
|
1661
|
+
const Rt = 24, Fe = 16, Re = 2;
|
|
1662
|
+
function Ue(e, t) {
|
|
1663
|
+
const r = t * Re;
|
|
1664
|
+
let a = Rt;
|
|
1665
|
+
for (e.style.fontSize = `${a}px`; e.scrollHeight > r && a > Fe; )
|
|
1666
|
+
a -= 1, e.style.fontSize = `${a}px`;
|
|
1667
|
+
}
|
|
1668
|
+
function De({ block: e, ctx: t }) {
|
|
1669
|
+
const r = e.level ?? 1, a = `h${r}`, i = 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", o = F(null), s = r === 1 && !!t.bootstrap.settings.title_auto_fit;
|
|
1670
|
+
return T(() => {
|
|
1671
|
+
if (!s || !o.current) return;
|
|
1672
|
+
const l = getComputedStyle(o.current), u = parseFloat(l.lineHeight) || Rt * 1.5;
|
|
1673
|
+
Ue(o.current, u);
|
|
1674
|
+
}, [s, e.text]), /* @__PURE__ */ n(a, { ref: o, class: i, children: e.text });
|
|
1675
|
+
}
|
|
1676
|
+
function Ne(e) {
|
|
1677
|
+
const t = e.local ?? { currency: e.currency, amount: e.amount };
|
|
1678
|
+
if (e.interval === "year") {
|
|
1679
|
+
const r = (e.interval_count ?? 1) * 12;
|
|
1680
|
+
return { amount: t.amount / r, currency: t.currency };
|
|
1681
|
+
}
|
|
1682
|
+
return { amount: t.amount, currency: t.currency };
|
|
1683
|
+
}
|
|
1684
|
+
function ot(e, t) {
|
|
1685
|
+
const r = e % 1 !== 0 ? 2 : 0;
|
|
1686
|
+
try {
|
|
1687
|
+
const a = new Intl.NumberFormat(void 0, {
|
|
1688
|
+
style: "currency",
|
|
1689
|
+
currency: t,
|
|
1690
|
+
currencyDisplay: "narrowSymbol",
|
|
1691
|
+
maximumFractionDigits: r,
|
|
1692
|
+
minimumFractionDigits: r
|
|
1693
|
+
}).formatToParts(e);
|
|
1694
|
+
let i = "", o = "";
|
|
1695
|
+
for (const s of a)
|
|
1696
|
+
s.type === "currency" ? i = s.value : s.type !== "literal" && (o += s.value);
|
|
1697
|
+
return { currency: i || t, amount: o.trim() };
|
|
1698
|
+
} catch {
|
|
1699
|
+
return { currency: t, amount: String(e) };
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
function lt(e, t) {
|
|
1703
|
+
const { amount: r, currency: a } = Ne(e);
|
|
1704
|
+
if (!t) {
|
|
1705
|
+
const { currency: l, amount: u } = ot(r, a);
|
|
1706
|
+
return { currency: l, amount: u, originalAmount: null };
|
|
1707
|
+
}
|
|
1708
|
+
const i = r * (1 - t / 100), o = ot(i, a), s = ot(r, a);
|
|
1709
|
+
return {
|
|
1710
|
+
currency: o.currency,
|
|
1711
|
+
amount: o.amount,
|
|
1712
|
+
originalAmount: `${s.currency}${s.amount}`
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
function q(e, t) {
|
|
1716
|
+
if (!e || e.length === 0) return null;
|
|
1717
|
+
const r = e.find(
|
|
1718
|
+
(i) => i.price_id === t && i.discount_percent && i.discount_percent > 0
|
|
1719
|
+
);
|
|
1720
|
+
return r || (e.find(
|
|
1721
|
+
(i) => i.price_id == null && i.discount_percent && i.discount_percent > 0
|
|
1722
|
+
) ?? null);
|
|
1723
|
+
}
|
|
1724
|
+
function Ut(e, t) {
|
|
1725
|
+
if (e.label) return e.label.toUpperCase();
|
|
1726
|
+
if (!e.interval || e.interval === "lifetime")
|
|
1727
|
+
return t("pricing.plan_label.lifetime", "LIFETIME");
|
|
1728
|
+
const a = {
|
|
1729
|
+
day: { key: "pricing.plan_label.daily", fallback: "DAILY PLAN" },
|
|
1730
|
+
week: { key: "pricing.plan_label.weekly", fallback: "WEEKLY PLAN" },
|
|
1731
|
+
month: { key: "pricing.plan_label.monthly", fallback: "MONTHLY PLAN" },
|
|
1732
|
+
year: { key: "pricing.plan_label.yearly", fallback: "YEARLY PLAN" }
|
|
1733
|
+
}[e.interval];
|
|
1734
|
+
return a ? t(a.key, a.fallback) : `${e.interval.toUpperCase()} PLAN`;
|
|
1735
|
+
}
|
|
1736
|
+
function ct(e, t) {
|
|
1737
|
+
if (!e.interval || e.interval === "lifetime")
|
|
1738
|
+
return t("pricing.interval.lifetime_short", "lifetime");
|
|
1739
|
+
if (e.interval === "year") return t("pricing.interval.month", "month");
|
|
1740
|
+
const r = e.interval_count ?? 1;
|
|
1741
|
+
return r === 1 ? t(`pricing.interval.${e.interval}`, e.interval) : `${r} ${e.interval}s`;
|
|
1742
|
+
}
|
|
1743
|
+
function He({ block: e, ctx: t }) {
|
|
1744
|
+
const { t: r } = v(), a = e.priceIds && e.priceIds.length > 0 ? new Set(e.priceIds) : null, i = t.bootstrap.prices.filter((s) => !a || a.has(s.id));
|
|
1745
|
+
if (i.length === 0)
|
|
1746
|
+
return /* @__PURE__ */ n("p", { class: "text-sm text-gray-500", children: r("pricing.no_prices", "No prices available.") });
|
|
1747
|
+
const o = e.popular_label ?? r("pricing.most_popular", "Most popular");
|
|
1748
|
+
if (e.view === "compact")
|
|
1749
|
+
return /* @__PURE__ */ n(
|
|
1750
|
+
"div",
|
|
1751
|
+
{
|
|
1752
|
+
class: "flex w-full flex-col rounded-xl border border-gray-200 bg-gray-50",
|
|
1753
|
+
role: "radiogroup",
|
|
1754
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1755
|
+
children: i.map((s, l) => /* @__PURE__ */ n(
|
|
1756
|
+
$e,
|
|
1757
|
+
{
|
|
1758
|
+
price: s,
|
|
1759
|
+
isLast: l === i.length - 1,
|
|
1760
|
+
isPopular: e.popular_price_id === s.id,
|
|
1761
|
+
popularLabel: o,
|
|
1762
|
+
offer: q(t.bootstrap.offers, s.id),
|
|
1763
|
+
selected: t.selectedPriceId === s.id,
|
|
1764
|
+
onSelect: () => {
|
|
1765
|
+
t.setSelectedPriceId(s.id), t.onAction("price_selected", { priceId: s.id, price: s });
|
|
1766
|
+
},
|
|
1767
|
+
t: r
|
|
1768
|
+
},
|
|
1769
|
+
s.id
|
|
1770
|
+
))
|
|
1771
|
+
}
|
|
1772
|
+
);
|
|
1773
|
+
if (e.view === "horizontal") {
|
|
1774
|
+
const s = Math.min(i.length, 3), l = i.some(
|
|
1775
|
+
(u) => (q(t.bootstrap.offers, u.id)?.discount_percent ?? 0) > 0
|
|
1776
|
+
);
|
|
1777
|
+
return /* @__PURE__ */ n(
|
|
1778
|
+
"div",
|
|
1779
|
+
{
|
|
1780
|
+
class: "grid items-stretch gap-2",
|
|
1781
|
+
style: { gridTemplateColumns: `repeat(${s}, minmax(0, 1fr))` },
|
|
1782
|
+
role: "radiogroup",
|
|
1783
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1784
|
+
children: i.map((u) => /* @__PURE__ */ n(
|
|
1785
|
+
Ge,
|
|
1786
|
+
{
|
|
1787
|
+
price: u,
|
|
1788
|
+
isPopular: e.popular_price_id === u.id,
|
|
1789
|
+
popularLabel: o,
|
|
1790
|
+
offer: q(t.bootstrap.offers, u.id),
|
|
1791
|
+
reserveStrikeRow: l,
|
|
1792
|
+
selected: t.selectedPriceId === u.id,
|
|
1793
|
+
onSelect: () => {
|
|
1794
|
+
t.setSelectedPriceId(u.id), t.onAction("price_selected", { priceId: u.id, price: u });
|
|
1795
|
+
},
|
|
1796
|
+
t: r
|
|
1797
|
+
},
|
|
1798
|
+
u.id
|
|
1799
|
+
))
|
|
1800
|
+
}
|
|
1801
|
+
);
|
|
1802
|
+
}
|
|
1803
|
+
return /* @__PURE__ */ n(
|
|
1804
|
+
"div",
|
|
1805
|
+
{
|
|
1806
|
+
class: "flex flex-col gap-2",
|
|
1807
|
+
role: "radiogroup",
|
|
1808
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1809
|
+
children: i.map((s) => {
|
|
1810
|
+
const l = t.selectedPriceId === s.id, u = e.popular_price_id === s.id, d = q(t.bootstrap.offers, s.id)?.discount_percent ?? null, { currency: p, amount: x, originalAmount: _ } = lt(s, d);
|
|
1811
|
+
return /* @__PURE__ */ c(
|
|
1812
|
+
"button",
|
|
1813
|
+
{
|
|
1814
|
+
type: "button",
|
|
1815
|
+
role: "radio",
|
|
1816
|
+
"aria-checked": l,
|
|
1817
|
+
onClick: () => {
|
|
1818
|
+
t.setSelectedPriceId(s.id), t.onAction("price_selected", { priceId: s.id, price: s });
|
|
1819
|
+
},
|
|
1820
|
+
class: [
|
|
1821
|
+
"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)]",
|
|
1822
|
+
// Везде border 2px — selection выражается только цветом, layout
|
|
1823
|
+
// не прыгает (равная толщина у selected/unselected). Цветовая
|
|
1824
|
+
// разница accent vs gray достаточно сильная для visual hierarchy.
|
|
1825
|
+
l ? "border-[var(--pw-accent)] bg-transparent" : "border-gray-200 bg-transparent hover:bg-gray-50"
|
|
1826
|
+
].join(" "),
|
|
1827
|
+
children: [
|
|
1828
|
+
/* @__PURE__ */ n(
|
|
1829
|
+
"span",
|
|
1830
|
+
{
|
|
1831
|
+
class: [
|
|
1832
|
+
"flex h-6.5 w-6.5 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
1833
|
+
l ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent",
|
|
1834
|
+
// Popular-label badge сидит absolute сверху-справа карточки и
|
|
1835
|
+
// визуально сдвигает центр content'а вниз. flex items-center
|
|
1836
|
+
// на карточке держит галочку по геометрическому центру, что
|
|
1837
|
+
// делает её визуально выше — компенсируем небольшим mt'ом.
|
|
1838
|
+
u ? "mt-3" : ""
|
|
1839
|
+
].join(" "),
|
|
1840
|
+
style: l ? {
|
|
1841
|
+
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%)"
|
|
1842
|
+
} : void 0,
|
|
1843
|
+
"aria-hidden": "true",
|
|
1844
|
+
children: /* @__PURE__ */ n(
|
|
1845
|
+
"svg",
|
|
1846
|
+
{
|
|
1847
|
+
width: "14",
|
|
1848
|
+
height: "10",
|
|
1849
|
+
viewBox: "0 0 17 12",
|
|
1850
|
+
fill: "none",
|
|
1851
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1852
|
+
class: l ? "opacity-100" : "opacity-0",
|
|
1853
|
+
children: /* @__PURE__ */ n(
|
|
1854
|
+
"path",
|
|
1855
|
+
{
|
|
1856
|
+
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",
|
|
1857
|
+
fill: "currentColor"
|
|
1858
|
+
}
|
|
1859
|
+
)
|
|
1860
|
+
}
|
|
1861
|
+
)
|
|
1862
|
+
}
|
|
1863
|
+
),
|
|
1864
|
+
/* @__PURE__ */ c("div", { class: "flex flex-1 flex-col gap-0.5", children: [
|
|
1865
|
+
/* @__PURE__ */ c("div", { class: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
1866
|
+
/* @__PURE__ */ n("span", { class: "text-xs font-normal uppercase tracking-normal text-gray-800/70", children: Ut(s, r) }),
|
|
1867
|
+
_ ? (
|
|
1868
|
+
// opacity-60 приглушает strike: глаз сначала ловит label
|
|
1869
|
+
// и discount-badge, потом main price; original «бывшая цена»
|
|
1870
|
+
// — третичная информация, не должна конкурировать с label.
|
|
1871
|
+
/* @__PURE__ */ n("span", { class: "text-[15px] font-normal text-gray-400 opacity-60 line-through decoration-gray-400 decoration-[1.5px]", children: _ })
|
|
1872
|
+
) : null,
|
|
1873
|
+
d ? (
|
|
1874
|
+
// Emerald pill — фиксированный «успех/выгода», не зависит от
|
|
1875
|
+
// brand_color. Читается даже на тёмных бренд-акцентах.
|
|
1876
|
+
/* @__PURE__ */ c("span", { class: "rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-bold leading-none text-emerald-700", children: [
|
|
1877
|
+
"-",
|
|
1878
|
+
d,
|
|
1879
|
+
"%"
|
|
1880
|
+
] })
|
|
1881
|
+
) : null
|
|
1882
|
+
] }),
|
|
1883
|
+
/* @__PURE__ */ n("div", { class: "flex items-baseline gap-2 flex-wrap", children: /* @__PURE__ */ c("span", { class: "text-[26px] leading-tight whitespace-nowrap text-gray-800 font-medium", children: [
|
|
1884
|
+
/* @__PURE__ */ n("span", { class: "opacity-90", children: p }),
|
|
1885
|
+
x,
|
|
1886
|
+
/* @__PURE__ */ c("span", { class: "text-sm font-normal text-gray-500", children: [
|
|
1887
|
+
" ",
|
|
1888
|
+
"/ ",
|
|
1889
|
+
ct(s, r)
|
|
1890
|
+
] })
|
|
1891
|
+
] }) }),
|
|
1892
|
+
s.description ? /* @__PURE__ */ n("span", { class: "mt-1 text-xs leading-relaxed text-gray-500", children: s.description }) : null
|
|
1893
|
+
] }),
|
|
1894
|
+
u ? /* @__PURE__ */ n(
|
|
1895
|
+
"span",
|
|
1896
|
+
{
|
|
1897
|
+
class: "absolute -top-[9px] -right-[6px] rounded-[11px] border-[5px] border-white px-2 py-1 text-[12px] font-semibold text-white",
|
|
1898
|
+
style: { background: "var(--pw-accent)" },
|
|
1899
|
+
children: o
|
|
1900
|
+
}
|
|
1901
|
+
) : null
|
|
1902
|
+
]
|
|
1903
|
+
},
|
|
1904
|
+
s.id
|
|
1905
|
+
);
|
|
1906
|
+
})
|
|
1907
|
+
}
|
|
1908
|
+
);
|
|
1909
|
+
}
|
|
1910
|
+
function Ve(e, t) {
|
|
1911
|
+
return e.label ? e.label : !e.interval || e.interval === "lifetime" ? t("pricing.interval.lifetime_short", "lifetime") : t(`pricing.interval.${e.interval}`, e.interval);
|
|
1912
|
+
}
|
|
1913
|
+
function $e({
|
|
1914
|
+
price: e,
|
|
1915
|
+
isLast: t,
|
|
1916
|
+
isPopular: r,
|
|
1917
|
+
popularLabel: a,
|
|
1918
|
+
offer: i,
|
|
1919
|
+
selected: o,
|
|
1920
|
+
onSelect: s,
|
|
1921
|
+
t: l
|
|
1922
|
+
}) {
|
|
1923
|
+
const u = i?.discount_percent ?? null, { currency: h, amount: d, originalAmount: p } = lt(e, u);
|
|
1924
|
+
return /* @__PURE__ */ c(
|
|
1925
|
+
"button",
|
|
1926
|
+
{
|
|
1927
|
+
type: "button",
|
|
1928
|
+
role: "radio",
|
|
1929
|
+
"aria-checked": o,
|
|
1930
|
+
onClick: s,
|
|
1931
|
+
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)]",
|
|
1932
|
+
children: [
|
|
1933
|
+
/* @__PURE__ */ n(
|
|
1934
|
+
"span",
|
|
1935
|
+
{
|
|
1936
|
+
class: [
|
|
1937
|
+
"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full border transition-colors mb-3",
|
|
1938
|
+
o ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent"
|
|
1939
|
+
].join(" "),
|
|
1940
|
+
style: o ? {
|
|
1941
|
+
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%)"
|
|
1942
|
+
} : void 0,
|
|
1943
|
+
"aria-hidden": "true",
|
|
1944
|
+
children: /* @__PURE__ */ n(
|
|
1945
|
+
"svg",
|
|
1946
|
+
{
|
|
1947
|
+
width: "14",
|
|
1948
|
+
height: "10",
|
|
1949
|
+
viewBox: "0 0 17 12",
|
|
1950
|
+
fill: "none",
|
|
1951
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1952
|
+
class: o ? "opacity-100" : "opacity-0",
|
|
1953
|
+
children: /* @__PURE__ */ n(
|
|
1954
|
+
"path",
|
|
1955
|
+
{
|
|
1956
|
+
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",
|
|
1957
|
+
fill: "currentColor"
|
|
1958
|
+
}
|
|
1959
|
+
)
|
|
1960
|
+
}
|
|
1961
|
+
)
|
|
1962
|
+
}
|
|
1963
|
+
),
|
|
1964
|
+
/* @__PURE__ */ c(
|
|
1965
|
+
"div",
|
|
1966
|
+
{
|
|
1967
|
+
class: [
|
|
1968
|
+
"flex flex-1 items-center gap-1.5 pb-3.5",
|
|
1969
|
+
t ? "" : "border-b border-gray-200"
|
|
1970
|
+
].join(" "),
|
|
1971
|
+
children: [
|
|
1972
|
+
/* @__PURE__ */ c("div", { class: "flex flex-wrap items-center gap-1 gap-x-1.5", children: [
|
|
1973
|
+
/* @__PURE__ */ n("span", { class: "text-base font-normal capitalize text-gray-800", children: Ve(e, l) }),
|
|
1974
|
+
r ? (
|
|
1975
|
+
// Pastel brand-mix pill — точно как `badge` в TelegramPricingRadio.
|
|
1976
|
+
// Низкий visual weight: pill про "имя плана" (most popular), а не
|
|
1977
|
+
// про savings — не должна конкурировать с -X% discount-pill.
|
|
1978
|
+
/* @__PURE__ */ n(
|
|
1979
|
+
"span",
|
|
1980
|
+
{
|
|
1981
|
+
class: "rounded-[9px] px-2 py-1 text-[10px] font-bold",
|
|
1982
|
+
style: {
|
|
1983
|
+
background: "linear-gradient(160deg, color-mix(in srgb, var(--pw-accent) 6%, white) 0%, color-mix(in srgb, var(--pw-accent) 15%, white) 100%)",
|
|
1984
|
+
color: "var(--pw-accent)"
|
|
1985
|
+
},
|
|
1986
|
+
children: a
|
|
1987
|
+
}
|
|
1988
|
+
)
|
|
1989
|
+
) : null,
|
|
1990
|
+
u ? /* @__PURE__ */ c("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
|
|
1991
|
+
"-",
|
|
1992
|
+
u,
|
|
1993
|
+
"%"
|
|
1994
|
+
] }) : null
|
|
1995
|
+
] }),
|
|
1996
|
+
/* @__PURE__ */ n("div", { class: "flex-1" }),
|
|
1997
|
+
/* @__PURE__ */ c("span", { class: "flex items-baseline gap-1.5 text-base font-normal text-gray-600", children: [
|
|
1998
|
+
p ? /* @__PURE__ */ n("span", { class: "text-xs text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: p }) : null,
|
|
1999
|
+
/* @__PURE__ */ c("span", { class: "whitespace-nowrap", children: [
|
|
2000
|
+
/* @__PURE__ */ n("span", { class: "opacity-90", children: h }),
|
|
2001
|
+
d,
|
|
2002
|
+
/* @__PURE__ */ c("span", { class: "text-xs text-gray-400", children: [
|
|
2003
|
+
" ",
|
|
2004
|
+
"/ ",
|
|
2005
|
+
ct(e, l)
|
|
2006
|
+
] })
|
|
2007
|
+
] })
|
|
2008
|
+
] })
|
|
2009
|
+
]
|
|
2010
|
+
}
|
|
2011
|
+
)
|
|
2012
|
+
]
|
|
2013
|
+
}
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
function Ge({
|
|
2017
|
+
price: e,
|
|
2018
|
+
isPopular: t,
|
|
2019
|
+
popularLabel: r,
|
|
2020
|
+
offer: a,
|
|
2021
|
+
reserveStrikeRow: i,
|
|
2022
|
+
selected: o,
|
|
2023
|
+
onSelect: s,
|
|
2024
|
+
t: l
|
|
2025
|
+
}) {
|
|
2026
|
+
const u = a?.discount_percent ?? null, { currency: h, amount: d, originalAmount: p } = lt(e, u);
|
|
2027
|
+
return /* @__PURE__ */ c(
|
|
2028
|
+
"button",
|
|
2029
|
+
{
|
|
2030
|
+
type: "button",
|
|
2031
|
+
role: "radio",
|
|
2032
|
+
"aria-checked": o,
|
|
2033
|
+
onClick: s,
|
|
2034
|
+
class: [
|
|
2035
|
+
"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)]",
|
|
2036
|
+
o ? "border-[var(--pw-accent)]" : "border-gray-200 hover:bg-gray-50"
|
|
2037
|
+
].join(" "),
|
|
2038
|
+
style: o ? { background: "color-mix(in srgb, var(--pw-accent) 6%, transparent)" } : void 0,
|
|
2039
|
+
children: [
|
|
2040
|
+
/* @__PURE__ */ n("span", { class: "flex min-h-[2.4em] items-center text-[10px] font-normal uppercase leading-tight text-gray-800/70", children: Ut(e, l) }),
|
|
2041
|
+
i ? /* @__PURE__ */ c("div", { class: "flex h-[22px] items-center justify-center gap-1.5", children: [
|
|
2042
|
+
p ? /* @__PURE__ */ n("span", { class: "text-[12px] text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: p }) : null,
|
|
2043
|
+
u ? /* @__PURE__ */ c("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
|
|
2044
|
+
"-",
|
|
2045
|
+
u,
|
|
2046
|
+
"%"
|
|
2047
|
+
] }) : null
|
|
2048
|
+
] }) : null,
|
|
2049
|
+
/* @__PURE__ */ c("span", { class: "text-[26px] leading-none whitespace-nowrap text-gray-800 font-medium", children: [
|
|
2050
|
+
/* @__PURE__ */ n("span", { class: "opacity-90", children: h }),
|
|
2051
|
+
d
|
|
2052
|
+
] }),
|
|
2053
|
+
/* @__PURE__ */ c("span", { class: "text-xs font-normal text-gray-500", children: [
|
|
2054
|
+
"/ ",
|
|
2055
|
+
ct(e, l)
|
|
2056
|
+
] }),
|
|
2057
|
+
t ? /* @__PURE__ */ n(
|
|
2058
|
+
"span",
|
|
2059
|
+
{
|
|
2060
|
+
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",
|
|
2061
|
+
style: { background: "var(--pw-accent)" },
|
|
2062
|
+
children: r
|
|
2063
|
+
}
|
|
2064
|
+
) : null
|
|
2065
|
+
]
|
|
2066
|
+
}
|
|
2067
|
+
);
|
|
2068
|
+
}
|
|
2069
|
+
function qe({ block: e }) {
|
|
2070
|
+
return /* @__PURE__ */ n("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children: e.text });
|
|
2071
|
+
}
|
|
2072
|
+
const We = {
|
|
2073
|
+
week: 0.25,
|
|
2074
|
+
month: 1,
|
|
2075
|
+
year: 12
|
|
2076
|
+
};
|
|
2077
|
+
function Ze(e, t) {
|
|
2078
|
+
return e ? t(`pricing.interval.${e}`, e) : t("pricing.interval.period", "period");
|
|
2079
|
+
}
|
|
2080
|
+
function Ke({ block: e, ctx: t }) {
|
|
2081
|
+
const { t: r } = v();
|
|
2082
|
+
if (!e.queries.length) return null;
|
|
2083
|
+
const i = t.bootstrap.prices.find((s) => s.id === t.selectedPriceId)?.interval ?? null, o = i ? We[i] : void 0;
|
|
2084
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col gap-2", children: [
|
|
2085
|
+
/* @__PURE__ */ n("div", { class: "text-sm font-semibold text-gray-800", children: !i || i === "lifetime" ? r("pricing.included_total", "Included for lifetime:") : r("pricing.included_per", "Included per {interval}:", {
|
|
2086
|
+
interval: Ze(i, r)
|
|
2087
|
+
}) }),
|
|
2088
|
+
/* @__PURE__ */ n("ul", { class: "flex flex-col gap-2", role: "list", children: e.queries.map((s) => {
|
|
2089
|
+
const l = Number.isFinite(s.count) ? s.count : 0, u = o !== void 0 ? Math.round(l * o) : l;
|
|
2090
|
+
return /* @__PURE__ */ c("li", { class: `flex gap-3 ${s.desc ? "items-start" : "items-center"}`, children: [
|
|
2091
|
+
/* @__PURE__ */ n(
|
|
2092
|
+
"svg",
|
|
2093
|
+
{
|
|
2094
|
+
width: "18",
|
|
2095
|
+
height: "18",
|
|
2096
|
+
viewBox: "0 0 20 20",
|
|
2097
|
+
fill: "none",
|
|
2098
|
+
class: `flex-shrink-0 text-emerald-500 ${s.desc ? "mt-0.5" : ""}`,
|
|
2099
|
+
"aria-hidden": "true",
|
|
2100
|
+
children: /* @__PURE__ */ n(
|
|
2101
|
+
"path",
|
|
2102
|
+
{
|
|
2103
|
+
d: "M4 10.5l3.5 3.5 8.5-8.5",
|
|
2104
|
+
stroke: "currentColor",
|
|
2105
|
+
"stroke-width": "2.5",
|
|
2106
|
+
"stroke-linecap": "round",
|
|
2107
|
+
"stroke-linejoin": "round"
|
|
2108
|
+
}
|
|
2109
|
+
)
|
|
2110
|
+
}
|
|
2111
|
+
),
|
|
2112
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2113
|
+
/* @__PURE__ */ n("span", { class: "font-semibold text-gray-900 text-sm", children: u }),
|
|
2114
|
+
" ",
|
|
2115
|
+
/* @__PURE__ */ n("span", { class: "text-sm text-gray-800", children: s.name }),
|
|
2116
|
+
s.desc ? /* @__PURE__ */ c(Z, { children: [
|
|
2117
|
+
/* @__PURE__ */ n("br", {}),
|
|
2118
|
+
/* @__PURE__ */ n("span", { class: "text-xs text-gray-400", children: s.desc })
|
|
2119
|
+
] }) : null
|
|
2120
|
+
] })
|
|
2121
|
+
] }, s.id);
|
|
2122
|
+
}) })
|
|
2123
|
+
] });
|
|
2124
|
+
}
|
|
2125
|
+
const Ye = {
|
|
2126
|
+
heading: De,
|
|
2127
|
+
text: qe,
|
|
2128
|
+
price_grid: He,
|
|
2129
|
+
cta_button: Te,
|
|
2130
|
+
auth_panel: Et,
|
|
2131
|
+
current_session: Ee,
|
|
2132
|
+
features_list: je,
|
|
2133
|
+
tokenization_gate: Ke,
|
|
2134
|
+
guarantee_badge: ze,
|
|
2135
|
+
offer_banner: ve
|
|
2136
|
+
};
|
|
2137
|
+
function Xe({ layout: e, bootstrap: t, onAction: r, auth: a, authSession: i, hasTopBanner: o }) {
|
|
2138
|
+
const s = Ct(() => {
|
|
2139
|
+
for (const g of e.blocks)
|
|
2140
|
+
if (g.type === "price_grid" && g.popular_price_id && t.prices.some((f) => f.id === g.popular_price_id))
|
|
2141
|
+
return g.popular_price_id;
|
|
2142
|
+
return t.prices[0]?.id ?? null;
|
|
2143
|
+
}, [e.blocks, t.prices]), [l, u] = b(s), h = {
|
|
2144
|
+
bootstrap: t,
|
|
2145
|
+
selectedPriceId: l,
|
|
2146
|
+
setSelectedPriceId: u,
|
|
2147
|
+
onAction: r,
|
|
2148
|
+
auth: a,
|
|
2149
|
+
authSession: i
|
|
2150
|
+
}, d = e.blocks.findIndex((g) => g.type === "cta_button"), p = d === -1 ? e.blocks : e.blocks.slice(0, d), x = d === -1 ? [] : e.blocks.slice(d), _ = (g, f) => {
|
|
2151
|
+
const M = Ye[g.type];
|
|
2152
|
+
return M ? /* @__PURE__ */ n(M, { block: g, ctx: h }, `${g.type}-${f}`) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${g.type}`), null);
|
|
2153
|
+
};
|
|
2154
|
+
return /* @__PURE__ */ c(Z, { children: [
|
|
2155
|
+
/* @__PURE__ */ n("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__ */ n("div", { class: "flex flex-col gap-6", children: p.map(_) }) }),
|
|
2156
|
+
x.length > 0 ? (
|
|
2157
|
+
// Тонкий shadow-top вместо border-t — создаёт depth, читается как
|
|
2158
|
+
// «footer закреплён к низу dialog'а». Линия выглядела как divider
|
|
2159
|
+
// в обычном flow, не передавала sticky-character.
|
|
2160
|
+
/* @__PURE__ */ n(
|
|
2161
|
+
"div",
|
|
2162
|
+
{
|
|
2163
|
+
class: "flex flex-col gap-4 bg-white px-6 pb-6 pt-3 sm:px-8",
|
|
2164
|
+
style: { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" },
|
|
2165
|
+
children: x.map((g, f) => _(g, p.length + f))
|
|
2166
|
+
}
|
|
2167
|
+
)
|
|
2168
|
+
) : null
|
|
2169
|
+
] });
|
|
2170
|
+
}
|
|
2171
|
+
function Je(e, t, r, a) {
|
|
2172
|
+
return e ? a ? { open: !0, view: "purchased", error: null } : t.status === "idle" || t.status === "loading" ? { open: !0, view: "loading", error: null } : t.status === "error" ? { open: !0, view: "error", error: t.error } : r.kind === "support" ? { open: !0, view: "support", error: null } : r.kind === "auth_gate" ? { open: !0, view: "auth", error: null } : r.kind === "anon_gate" ? { open: !0, view: "anon", error: null } : r.kind === "awaiting_payment" ? { open: !0, view: "awaiting_payment", error: null } : r.kind === "popup_blocked" ? { open: !0, view: "popup_blocked", error: null } : r.kind === "purchase_success" ? { open: !0, view: "purchased", error: null } : r.kind === "verifying" ? { open: !0, view: "loading", error: null } : { open: !0, view: "layout", error: null } : { open: !1, view: null, error: null };
|
|
2173
|
+
}
|
|
2174
|
+
function Qe(e, t) {
|
|
2175
|
+
return e.open === t.open && e.view === t.view && e.error === t.error;
|
|
2176
|
+
}
|
|
2177
|
+
function tr({
|
|
2178
|
+
client: e,
|
|
2179
|
+
open: t,
|
|
2180
|
+
onClose: r,
|
|
2181
|
+
onEvent: a,
|
|
2182
|
+
initialView: i,
|
|
2183
|
+
purchased: o,
|
|
2184
|
+
renew: s,
|
|
2185
|
+
onState: l,
|
|
2186
|
+
inline: u,
|
|
2187
|
+
locale: h
|
|
2188
|
+
}) {
|
|
2189
|
+
const [d, p] = b({ status: "idle" }), [x, _] = b(
|
|
2190
|
+
() => e.auth?.getCachedSession() ?? null
|
|
2191
|
+
), [g, f] = b(() => i === "support" ? { kind: "support", origin: "standalone" } : i === "auth" ? { kind: "auth_gate", origin: "standalone" } : i === "anon" ? { kind: "anon_gate", origin: "standalone" } : { kind: "layout" }), M = F(!1), E = F(null);
|
|
2192
|
+
T(() => {
|
|
2193
|
+
if (!l) return;
|
|
2194
|
+
const w = Je(t, d, g, o), m = E.current;
|
|
2195
|
+
m && Qe(m, w) || (E.current = w, l(w));
|
|
2196
|
+
}, [t, d, g, o, l]), T(() => {
|
|
2197
|
+
if (e.auth)
|
|
2198
|
+
return e.auth.onAuthChange((w, m) => _(m));
|
|
2199
|
+
}, [e.auth]), T(() => {
|
|
2200
|
+
if (typeof e.onBootstrapChange == "function")
|
|
2201
|
+
return e.onBootstrapChange((w) => {
|
|
2202
|
+
p(
|
|
2203
|
+
(m) => m.status === "ready" ? { status: "ready", data: w } : m
|
|
2204
|
+
);
|
|
2205
|
+
});
|
|
2206
|
+
}, [e]), T(() => {
|
|
2207
|
+
if (!t || d.status === "ready" || d.status === "loading") return;
|
|
2208
|
+
let w = !1;
|
|
2209
|
+
return p({ status: "loading" }), e.bootstrap().then((m) => {
|
|
2210
|
+
w || (p({ status: "ready", data: m }), a("ready", m), m.user?.has_active_subscription && !s && (a("purchase_completed", {
|
|
2211
|
+
priceId: null,
|
|
2212
|
+
sessionId: null,
|
|
2213
|
+
restored: !0
|
|
2214
|
+
}), f({ kind: "purchase_success", restored: !0 })));
|
|
2215
|
+
}).catch((m) => {
|
|
2216
|
+
if (w) return;
|
|
2217
|
+
const k = m instanceof U ? m : new U("unknown", "Failed to load paywall", { cause: m });
|
|
2218
|
+
p({ status: "error", error: k }), a("error", k);
|
|
2219
|
+
}), () => {
|
|
2220
|
+
w = !0;
|
|
2221
|
+
};
|
|
2222
|
+
}, [t, e]), $t(() => {
|
|
2223
|
+
if (!t) {
|
|
2224
|
+
f({ kind: "layout" }), M.current = !1;
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
2227
|
+
i === "support" ? f({ kind: "support", origin: "standalone" }) : i === "auth" ? f({ kind: "auth_gate", origin: "standalone" }) : i === "anon" && f({ kind: "anon_gate", origin: "standalone" });
|
|
2228
|
+
}, [t, i]);
|
|
2229
|
+
const y = async (w) => {
|
|
2230
|
+
try {
|
|
2231
|
+
const m = await e.createCheckout({
|
|
2232
|
+
priceId: w,
|
|
2233
|
+
ignoreActivePurchase: s === !0
|
|
2234
|
+
});
|
|
2235
|
+
if (a("checkout_started", { priceId: w, url: m.url, acquiring: m.acquiring }), typeof window > "u" || !m.url) return;
|
|
2236
|
+
const k = window.open(m.url, "_blank");
|
|
2237
|
+
if (k) {
|
|
2238
|
+
try {
|
|
2239
|
+
k.opener = null;
|
|
2240
|
+
} catch {
|
|
2241
|
+
}
|
|
2242
|
+
f({ kind: "awaiting_payment", priceId: w, url: m.url });
|
|
2243
|
+
} else
|
|
2244
|
+
f({ kind: "popup_blocked", priceId: w, url: m.url });
|
|
2245
|
+
} catch (m) {
|
|
2246
|
+
if (m instanceof U && m.code === "already_purchased") {
|
|
2247
|
+
try {
|
|
2248
|
+
await e.getUser({ force: !0 });
|
|
2249
|
+
} catch {
|
|
2250
|
+
}
|
|
2251
|
+
a("purchase_completed", { priceId: w, sessionId: null, restored: !0 }), f({ kind: "purchase_success", restored: !0 });
|
|
2252
|
+
return;
|
|
2253
|
+
}
|
|
2254
|
+
const k = m instanceof U ? m : new U("checkout_failed", "Checkout failed", { cause: m });
|
|
2255
|
+
a("error", k), f({ kind: "layout" });
|
|
2256
|
+
}
|
|
2257
|
+
}, L = (w, m) => {
|
|
2258
|
+
if (typeof window > "u") return;
|
|
2259
|
+
const k = window.open(m, "_blank");
|
|
2260
|
+
if (k) {
|
|
2261
|
+
try {
|
|
2262
|
+
k.opener = null;
|
|
2263
|
+
} catch {
|
|
2264
|
+
}
|
|
2265
|
+
f({ kind: "awaiting_payment", priceId: w, url: m });
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2268
|
+
T(() => {
|
|
2269
|
+
if (g.kind !== "auth_gate" || !x || x.user.is_anonymous || M.current) return;
|
|
2270
|
+
M.current = !0;
|
|
2271
|
+
const w = g.pendingCheckout, m = g.origin;
|
|
2272
|
+
f({ kind: "verifying" }), (async () => {
|
|
2273
|
+
if (!s)
|
|
2274
|
+
try {
|
|
2275
|
+
if ((await e.getUser({ force: !0 })).has_active_subscription) {
|
|
2276
|
+
a("purchase_completed", {
|
|
2277
|
+
priceId: w?.priceId ?? null,
|
|
2278
|
+
sessionId: null,
|
|
2279
|
+
restored: !0
|
|
2280
|
+
}), f({ kind: "purchase_success", restored: !0 });
|
|
2281
|
+
return;
|
|
2282
|
+
}
|
|
2283
|
+
} catch {
|
|
2284
|
+
}
|
|
2285
|
+
if (!w) {
|
|
2286
|
+
m === "standalone" ? r() : f({ kind: "layout" });
|
|
2287
|
+
return;
|
|
2288
|
+
}
|
|
2289
|
+
await y(w.priceId);
|
|
2290
|
+
})().finally(() => {
|
|
2291
|
+
M.current = !1;
|
|
2292
|
+
});
|
|
2293
|
+
}, [x, g]);
|
|
2294
|
+
const I = async (w, m) => {
|
|
2295
|
+
if (w === "close") {
|
|
2296
|
+
r();
|
|
2297
|
+
return;
|
|
2298
|
+
}
|
|
2299
|
+
if (w === "price_selected") {
|
|
2300
|
+
a("price_selected", m);
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
if (w === "restore") {
|
|
2304
|
+
if (!e.auth) return;
|
|
2305
|
+
const k = e.auth.getCachedSession();
|
|
2306
|
+
if (k && !k.user.is_anonymous) return;
|
|
2307
|
+
f({ kind: "auth_gate", intent: "restore" });
|
|
2308
|
+
return;
|
|
2309
|
+
}
|
|
2310
|
+
if (w === "support") {
|
|
2311
|
+
f({ kind: "support", origin: "layout" });
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
if (w === "checkout" && d.status === "ready") {
|
|
2315
|
+
const k = m?.priceId;
|
|
2316
|
+
if (!k) {
|
|
2317
|
+
a("error", new U("no_price", "No price selected"));
|
|
2318
|
+
return;
|
|
2319
|
+
}
|
|
2320
|
+
const S = d.data.settings.checkout_mode ?? "guest", P = e.auth?.getCachedSession() ?? null, V = !!P && !P.user.is_anonymous;
|
|
2321
|
+
if (S === "preauth" && !!e.auth && !V) {
|
|
2322
|
+
f({ kind: "auth_gate", pendingCheckout: { priceId: k } });
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
await y(k);
|
|
2326
|
+
}
|
|
2327
|
+
}, z = d.status === "ready" ? d.data.settings.brand_color : null, j = d.status === "ready" ? d.data.settings.allow_close !== !1 : !0, D = g.kind === "layout" && d.status === "ready" ? zt(d.data.offers) : null, R = D ? /* @__PURE__ */ n(ye, { offer: D }) : null, N = {
|
|
2328
|
+
type: "auth_panel",
|
|
2329
|
+
// Заголовок не задаём — AuthGate сам решит по intent'у (restore →
|
|
2330
|
+
// "Restore Purchases", остальные → дефолтный "Welcome back!").
|
|
2331
|
+
allow_signup: !0,
|
|
2332
|
+
allow_password_reset: !0,
|
|
2333
|
+
// Не скрываем при наличии сессии — auto-resume useEffect отрабатывает быстрее,
|
|
2334
|
+
// чем хотим показывать "Signed in as ..." промежуточным экраном.
|
|
2335
|
+
hide_when_authenticated: !1,
|
|
2336
|
+
providers: d.status === "ready" ? d.data.settings.auth_providers : void 0
|
|
2337
|
+
}, A = g.kind === "support" ? /* @__PURE__ */ n(
|
|
2338
|
+
_e,
|
|
2339
|
+
{
|
|
2340
|
+
client: e,
|
|
2341
|
+
authSession: x,
|
|
2342
|
+
origin: g.origin,
|
|
2343
|
+
onBack: () => {
|
|
2344
|
+
g.origin === "standalone" ? r() : f({ kind: "layout" });
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
) : null, C = g.kind === "auth_gate" && g.origin !== "standalone" || g.kind === "support", B = d.status === "ready" ? d.data : null;
|
|
2348
|
+
return /* @__PURE__ */ n(te, { bootstrap: B, forceLocale: h, children: /* @__PURE__ */ n(
|
|
2349
|
+
ee,
|
|
2350
|
+
{
|
|
2351
|
+
open: t,
|
|
2352
|
+
onClose: r,
|
|
2353
|
+
brandColor: z,
|
|
2354
|
+
topBanner: R,
|
|
2355
|
+
allowClose: j,
|
|
2356
|
+
hideCloseButton: C,
|
|
2357
|
+
inline: u,
|
|
2358
|
+
labelledBy: "pw-title",
|
|
2359
|
+
children: o ? /* @__PURE__ */ n(_t, { onContinue: r }) : g.kind === "purchase_success" ? /* @__PURE__ */ n(_t, { restored: g.restored, onContinue: r }) : A || (d.status === "loading" || d.status === "idle" || g.kind === "verifying" ? /* @__PURE__ */ n(er, { verifying: g.kind === "verifying" }) : d.status === "error" ? /* @__PURE__ */ n(rr, { message: d.error.message }) : g.kind === "auth_gate" && e.auth ? /* @__PURE__ */ n(
|
|
2360
|
+
fe,
|
|
2361
|
+
{
|
|
2362
|
+
block: N,
|
|
2363
|
+
bootstrap: d.data,
|
|
2364
|
+
auth: e.auth,
|
|
2365
|
+
authSession: x,
|
|
2366
|
+
showBack: g.origin !== "standalone",
|
|
2367
|
+
intent: g.intent ?? (g.origin === "standalone" ? "standalone" : "preauth"),
|
|
2368
|
+
onBack: () => {
|
|
2369
|
+
g.origin === "standalone" ? r() : f({ kind: "layout" });
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
) : g.kind === "anon_gate" && e.auth ? /* @__PURE__ */ n(
|
|
2373
|
+
me,
|
|
2374
|
+
{
|
|
2375
|
+
auth: e.auth,
|
|
2376
|
+
onSuccess: () => {
|
|
2377
|
+
g.origin === "standalone" ? r() : f({ kind: "layout" });
|
|
2378
|
+
},
|
|
2379
|
+
onBack: g.origin === "standalone" ? void 0 : () => f({ kind: "layout" })
|
|
2380
|
+
}
|
|
2381
|
+
) : g.kind === "awaiting_payment" ? /* @__PURE__ */ n(
|
|
2382
|
+
nr,
|
|
2383
|
+
{
|
|
2384
|
+
client: e,
|
|
2385
|
+
onBack: () => f({ kind: "layout" }),
|
|
2386
|
+
onReopen: () => {
|
|
2387
|
+
if (typeof window > "u") return;
|
|
2388
|
+
const w = window.open(g.url, "_blank");
|
|
2389
|
+
if (w)
|
|
2390
|
+
try {
|
|
2391
|
+
w.opener = null;
|
|
2392
|
+
} catch {
|
|
2393
|
+
}
|
|
2394
|
+
},
|
|
2395
|
+
onRetry: () => y(g.priceId)
|
|
2396
|
+
}
|
|
2397
|
+
) : g.kind === "popup_blocked" ? /* @__PURE__ */ n(ir, { onReopen: () => L(g.priceId, g.url) }) : /* @__PURE__ */ n(
|
|
2398
|
+
Xe,
|
|
2399
|
+
{
|
|
2400
|
+
layout: d.data.layout,
|
|
2401
|
+
bootstrap: d.data,
|
|
2402
|
+
onAction: I,
|
|
2403
|
+
auth: e.auth,
|
|
2404
|
+
authSession: x
|
|
2405
|
+
}
|
|
2406
|
+
))
|
|
2407
|
+
}
|
|
2408
|
+
) });
|
|
2409
|
+
}
|
|
2410
|
+
function er({ verifying: e }) {
|
|
2411
|
+
const { t } = v();
|
|
2412
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
|
|
2413
|
+
/* @__PURE__ */ n("span", { class: "inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" }),
|
|
2414
|
+
/* @__PURE__ */ n("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: e ? t("modal.verifying_subscription", "Checking your subscription…") : t("modal.loading", "Loading…") })
|
|
2415
|
+
] });
|
|
2416
|
+
}
|
|
2417
|
+
function rr({ message: e }) {
|
|
2418
|
+
const { t } = v();
|
|
2419
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
2420
|
+
/* @__PURE__ */ n("div", { class: "flex h-11 w-11 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ c("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
2421
|
+
/* @__PURE__ */ n("path", { d: "M10 6v5M10 14h.01", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round" }),
|
|
2422
|
+
/* @__PURE__ */ n("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
|
|
2423
|
+
] }) }),
|
|
2424
|
+
/* @__PURE__ */ n("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: t("modal.error_generic", "Something went wrong") }),
|
|
2425
|
+
/* @__PURE__ */ n("p", { class: "text-xs leading-relaxed text-gray-500", children: e })
|
|
2426
|
+
] });
|
|
2427
|
+
}
|
|
2428
|
+
function ir({ onReopen: e }) {
|
|
2429
|
+
const { t } = v();
|
|
2430
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
2431
|
+
/* @__PURE__ */ n(
|
|
2432
|
+
"div",
|
|
2433
|
+
{
|
|
2434
|
+
class: "flex h-11 w-11 items-center justify-center rounded-full",
|
|
2435
|
+
style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
|
|
2436
|
+
"aria-hidden": "true",
|
|
2437
|
+
children: /* @__PURE__ */ c("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
2438
|
+
/* @__PURE__ */ n("path", { d: "M4 5h12v10H4z", stroke: "currentColor", "stroke-width": "1.75", "stroke-linejoin": "round" }),
|
|
2439
|
+
/* @__PURE__ */ n("path", { d: "M7 9l3 3 4-5", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" })
|
|
2440
|
+
] })
|
|
2441
|
+
}
|
|
2442
|
+
),
|
|
2443
|
+
/* @__PURE__ */ n("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: t("payment.popup_blocked_title", "Allow popups to continue") }),
|
|
2444
|
+
/* @__PURE__ */ n("p", { class: "max-w-[18rem] text-xs leading-relaxed text-gray-500", children: t("payment.popup_blocked_message", "Your browser blocked the checkout tab. Click below to open it.") }),
|
|
2445
|
+
/* @__PURE__ */ n(
|
|
2446
|
+
"button",
|
|
2447
|
+
{
|
|
2448
|
+
type: "button",
|
|
2449
|
+
onClick: e,
|
|
2450
|
+
class: "mt-1 rounded-xl px-4 py-2 text-xs 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)]",
|
|
2451
|
+
style: {
|
|
2452
|
+
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
2453
|
+
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
2454
|
+
},
|
|
2455
|
+
children: t("payment.open_checkout_button", "Open checkout")
|
|
2456
|
+
}
|
|
2457
|
+
)
|
|
2458
|
+
] });
|
|
2459
|
+
}
|
|
2460
|
+
function nr({
|
|
2461
|
+
client: e,
|
|
2462
|
+
onBack: t,
|
|
2463
|
+
onReopen: r,
|
|
2464
|
+
onRetry: a
|
|
2465
|
+
}) {
|
|
2466
|
+
const { t: i } = v(), [o, s] = b(!1), [l, u] = b(!1), h = F(null);
|
|
2467
|
+
T(() => () => {
|
|
2468
|
+
h.current !== null && clearTimeout(h.current);
|
|
2469
|
+
}, []);
|
|
2470
|
+
const d = async () => {
|
|
2471
|
+
if (!o) {
|
|
2472
|
+
s(!0), u(!1);
|
|
2473
|
+
try {
|
|
2474
|
+
if ((await e.getUser({ force: !0 })).has_active_subscription) {
|
|
2475
|
+
typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
|
|
2476
|
+
return;
|
|
2477
|
+
}
|
|
2478
|
+
u(!0), h.current !== null && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
2479
|
+
u(!1), h.current = null;
|
|
2480
|
+
}, 5e3);
|
|
2481
|
+
} catch {
|
|
2482
|
+
u(!0);
|
|
2483
|
+
} finally {
|
|
2484
|
+
s(!1);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
};
|
|
2488
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col gap-3", children: [
|
|
2489
|
+
/* @__PURE__ */ n(
|
|
2490
|
+
"button",
|
|
2491
|
+
{
|
|
2492
|
+
type: "button",
|
|
2493
|
+
onClick: t,
|
|
2494
|
+
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)]",
|
|
2495
|
+
children: i("nav.back", "← Back")
|
|
2496
|
+
}
|
|
2497
|
+
),
|
|
2498
|
+
/* @__PURE__ */ c("div", { class: "flex flex-col items-center gap-3 py-6 text-center", children: [
|
|
2499
|
+
/* @__PURE__ */ c("div", { class: "relative flex h-12 w-12 items-center justify-center", children: [
|
|
2500
|
+
/* @__PURE__ */ n(
|
|
2501
|
+
"span",
|
|
2502
|
+
{
|
|
2503
|
+
class: "absolute inset-0 animate-ping rounded-full opacity-40",
|
|
2504
|
+
style: { background: "color-mix(in srgb, var(--pw-accent) 30%, transparent)" },
|
|
2505
|
+
"aria-hidden": "true"
|
|
2506
|
+
}
|
|
2507
|
+
),
|
|
2508
|
+
/* @__PURE__ */ n("span", { class: "relative inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" })
|
|
2509
|
+
] }),
|
|
2510
|
+
/* @__PURE__ */ n("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: i("payment.awaiting_title", "Complete payment in the new tab") }),
|
|
2511
|
+
/* @__PURE__ */ n("p", { class: "max-w-[20rem] text-xs leading-relaxed text-gray-500", children: i(
|
|
2512
|
+
"payment.awaiting_subtitle",
|
|
2513
|
+
"We'll detect your payment automatically — or click below once you're done."
|
|
2514
|
+
) }),
|
|
2515
|
+
/* @__PURE__ */ n(
|
|
2516
|
+
"button",
|
|
2517
|
+
{
|
|
2518
|
+
type: "button",
|
|
2519
|
+
onClick: d,
|
|
2520
|
+
disabled: o,
|
|
2521
|
+
class: "mt-1 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)]",
|
|
2522
|
+
style: {
|
|
2523
|
+
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
2524
|
+
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
2525
|
+
},
|
|
2526
|
+
children: o ? i("payment.checking", "Checking…") : i("payment.ive_paid", "I've paid")
|
|
2527
|
+
}
|
|
2528
|
+
),
|
|
2529
|
+
l ? /* @__PURE__ */ n("p", { class: "text-xs leading-relaxed text-gray-500", children: i("payment.still_processing", "Payment is still being processed. Please try again in a moment.") }) : null
|
|
2530
|
+
] }),
|
|
2531
|
+
/* @__PURE__ */ c("div", { class: "rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5", children: [
|
|
2532
|
+
/* @__PURE__ */ n("p", { class: "text-xs leading-relaxed text-gray-600", children: i("payment.popup_help_text", "Checkout window didn't open or got blocked? Click here to open it again.") }),
|
|
2533
|
+
/* @__PURE__ */ n(
|
|
2534
|
+
"button",
|
|
2535
|
+
{
|
|
2536
|
+
type: "button",
|
|
2537
|
+
onClick: r,
|
|
2538
|
+
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)]",
|
|
2539
|
+
children: i("payment.open_checkout_again", "Open checkout again")
|
|
2540
|
+
}
|
|
2541
|
+
)
|
|
2542
|
+
] }),
|
|
2543
|
+
/* @__PURE__ */ n(
|
|
2544
|
+
"button",
|
|
2545
|
+
{
|
|
2546
|
+
type: "button",
|
|
2547
|
+
onClick: a,
|
|
2548
|
+
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)]",
|
|
2549
|
+
children: i("payment.tab_closed_retry", "Tab closed? Try again")
|
|
2550
|
+
}
|
|
2551
|
+
)
|
|
2552
|
+
] });
|
|
2553
|
+
}
|
|
2554
|
+
function _t({
|
|
2555
|
+
onContinue: e,
|
|
2556
|
+
restored: t = !1
|
|
2557
|
+
}) {
|
|
2558
|
+
const { t: r } = v();
|
|
2559
|
+
return /* @__PURE__ */ c("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
2560
|
+
/* @__PURE__ */ n(
|
|
2561
|
+
"div",
|
|
2562
|
+
{
|
|
2563
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full ring-8",
|
|
2564
|
+
style: {
|
|
2565
|
+
background: "linear-gradient(135deg, #4ade80, #16a34a)",
|
|
2566
|
+
color: "#fff",
|
|
2567
|
+
// emerald ring with low alpha for a halo effect
|
|
2568
|
+
boxShadow: "0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"
|
|
2569
|
+
},
|
|
2570
|
+
"aria-hidden": "true",
|
|
2571
|
+
children: /* @__PURE__ */ n("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ n(
|
|
2572
|
+
"path",
|
|
2573
|
+
{
|
|
2574
|
+
d: "M5 13l4 4L19 7",
|
|
2575
|
+
stroke: "currentColor",
|
|
2576
|
+
"stroke-width": "2.5",
|
|
2577
|
+
"stroke-linecap": "round",
|
|
2578
|
+
"stroke-linejoin": "round"
|
|
2579
|
+
}
|
|
2580
|
+
) })
|
|
2581
|
+
}
|
|
2582
|
+
),
|
|
2583
|
+
/* @__PURE__ */ n("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: t ? r("modal.purchase_restored_title", "Subscription restored") : r("modal.purchase_success_title", "Payment received") }),
|
|
2584
|
+
/* @__PURE__ */ n("p", { class: "text-sm leading-relaxed text-gray-500", children: t ? r(
|
|
2585
|
+
"modal.purchase_restored_subtitle",
|
|
2586
|
+
"Welcome back — your subscription is already active."
|
|
2587
|
+
) : r("modal.purchase_success_subtitle", "Your subscription is now active.") }),
|
|
2588
|
+
/* @__PURE__ */ n(
|
|
2589
|
+
"button",
|
|
2590
|
+
{
|
|
2591
|
+
type: "button",
|
|
2592
|
+
onClick: e,
|
|
2593
|
+
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)]",
|
|
2594
|
+
style: {
|
|
2595
|
+
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
2596
|
+
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
2597
|
+
},
|
|
2598
|
+
children: r("modal.continue", "Continue")
|
|
2599
|
+
}
|
|
2600
|
+
)
|
|
2601
|
+
] });
|
|
2602
|
+
}
|
|
2603
|
+
const ar = 10 * 6e4, or = 5e3, sr = 3e4;
|
|
2604
|
+
class lr {
|
|
2605
|
+
constructor(t) {
|
|
2606
|
+
this.timer = null, this.timeoutTimer = null, this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null, this.stopped = !1, this.checking = !1, this.opts = {
|
|
2607
|
+
client: t.client,
|
|
2608
|
+
onActive: t.onActive,
|
|
2609
|
+
onTimeout: t.onTimeout ?? (() => {
|
|
2610
|
+
}),
|
|
2611
|
+
timeoutMs: t.timeoutMs ?? ar,
|
|
2612
|
+
visibleIntervalMs: t.visibleIntervalMs ?? or,
|
|
2613
|
+
hiddenIntervalMs: t.hiddenIntervalMs ?? sr
|
|
2614
|
+
};
|
|
2615
|
+
}
|
|
2616
|
+
start() {
|
|
2617
|
+
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 = (t) => this.handleMessage(t), window.addEventListener("message", this.messageHandler), this.timeoutTimer = setTimeout(() => {
|
|
2618
|
+
this.stopped || (this.stop(), this.opts.onTimeout());
|
|
2619
|
+
}, this.opts.timeoutMs));
|
|
2620
|
+
}
|
|
2621
|
+
stop() {
|
|
2622
|
+
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;
|
|
2623
|
+
}
|
|
2624
|
+
async check() {
|
|
2625
|
+
if (!(this.stopped || this.checking)) {
|
|
2626
|
+
this.checking = !0;
|
|
2627
|
+
try {
|
|
2628
|
+
const t = await this.opts.client.getUser({ force: !0 });
|
|
2629
|
+
if (this.stopped) return;
|
|
2630
|
+
t.has_active_subscription && (this.stop(), this.opts.onActive(t));
|
|
2631
|
+
} catch {
|
|
2632
|
+
} finally {
|
|
2633
|
+
this.checking = !1;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
scheduleNext() {
|
|
2638
|
+
if (this.stopped) return;
|
|
2639
|
+
const r = typeof document < "u" && document.visibilityState === "visible" ? this.opts.visibleIntervalMs : this.opts.hiddenIntervalMs;
|
|
2640
|
+
this.timer = setTimeout(async () => {
|
|
2641
|
+
await this.check(), this.scheduleNext();
|
|
2642
|
+
}, r);
|
|
2643
|
+
}
|
|
2644
|
+
handleVisibilityChange() {
|
|
2645
|
+
typeof document > "u" || (document.visibilityState === "visible" && this.check(), this.timer !== null && (clearTimeout(this.timer), this.timer = null), this.scheduleNext());
|
|
2646
|
+
}
|
|
2647
|
+
handleMessage(t) {
|
|
2648
|
+
const r = t.data;
|
|
2649
|
+
!r || typeof r != "object" || r.type === "paywall_purchase" && this.check();
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
function cr() {
|
|
2653
|
+
return !(typeof document > "u" || typeof window > "u" || typeof location < "u" && location.protocol === "chrome-extension:");
|
|
2654
|
+
}
|
|
2655
|
+
const st = { open: !1, view: null, error: null }, H = {
|
|
2656
|
+
status: "paywall_status",
|
|
2657
|
+
priceId: "paywall_price_id",
|
|
2658
|
+
sessionId: "paywall_session_id"
|
|
2659
|
+
};
|
|
2660
|
+
class yr {
|
|
2661
|
+
constructor(t) {
|
|
2662
|
+
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.trialStore = null, this.trialStoreConfig = null, this.lastTrialStatus = null, this.trialExpiredFired = !1, this.lastVisibility = null, this.currentState = st, this.stateListeners = /* @__PURE__ */ new Set();
|
|
2663
|
+
const { auth: r, ownsAuth: a } = dr(t);
|
|
2664
|
+
this.auth = r, this.ownsAuth = a, this.billing = t.client ?? new Dt({ ...t, auth: this.auth }), this.host = t.host, this.shadowMode = t.shadowMode ?? "closed", this.mountThenLoad = t.mountThenLoad ?? !0, this.inline = t.inline === !0, this.forceLocale = t.locale ?? null, this.userUnsub = this.billing.onUserChange((i) => {
|
|
2665
|
+
this.emit("userChange", i);
|
|
2666
|
+
}), this.auth && (this.authUnsub = this.auth.onAuthChange((i, o) => {
|
|
2667
|
+
this.emit("authChange", { event: i, session: o });
|
|
2668
|
+
})), this.initTracker(t.analytics), t.autoDetectReturn !== !1 && typeof window < "u" && queueMicrotask(() => this.checkReturn());
|
|
2669
|
+
}
|
|
2670
|
+
initTracker(t) {
|
|
2671
|
+
if (t === !1) return;
|
|
2672
|
+
const r = typeof t == "object" && t !== null ? t : {};
|
|
2673
|
+
if (r.enabled === !1) return;
|
|
2674
|
+
const a = r.endpoint ?? `${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;
|
|
2675
|
+
this.tracker = new Nt({
|
|
2676
|
+
endpoint: a,
|
|
2677
|
+
paywallId: this.billing.paywallId,
|
|
2678
|
+
capabilities: this.billing.capabilities,
|
|
2679
|
+
getVisitorId: () => this.billing.getVisitorId(),
|
|
2680
|
+
getCachedVisitorId: () => this.billing.getCachedVisitorId(),
|
|
2681
|
+
getUserId: () => this.billing.getIdentity()?.userId ?? null,
|
|
2682
|
+
flushIntervalMs: r.flushIntervalMs,
|
|
2683
|
+
maxBufferSize: r.maxBufferSize,
|
|
2684
|
+
fetch: r.fetch,
|
|
2685
|
+
sendBeacon: r.sendBeacon
|
|
2686
|
+
}), this.on("open", () => this.tracker?.track("paywall_opened")), this.on(
|
|
2687
|
+
"ready",
|
|
2688
|
+
(i) => this.tracker?.track("paywall_viewed", {
|
|
2689
|
+
is_test_mode: i.settings.is_test_mode,
|
|
2690
|
+
prices_count: i.prices.length,
|
|
2691
|
+
offers_count: i.offers.length
|
|
2692
|
+
})
|
|
2693
|
+
), this.on(
|
|
2694
|
+
"price_selected",
|
|
2695
|
+
(i) => this.tracker?.track("price_selected", { price_id: i.priceId })
|
|
2696
|
+
), this.on(
|
|
2697
|
+
"checkout_started",
|
|
2698
|
+
(i) => this.tracker?.track("checkout_started", {
|
|
2699
|
+
price_id: i.priceId,
|
|
2700
|
+
acquiring: i.acquiring
|
|
2701
|
+
})
|
|
2702
|
+
), this.on(
|
|
2703
|
+
"purchase_completed",
|
|
2704
|
+
(i) => this.tracker?.track("purchase_completed", {
|
|
2705
|
+
price_id: i.priceId,
|
|
2706
|
+
session_id: i.sessionId
|
|
2707
|
+
})
|
|
2708
|
+
), this.on(
|
|
2709
|
+
"purchase_failed",
|
|
2710
|
+
(i) => this.tracker?.track("purchase_failed", { reason: i.reason })
|
|
2711
|
+
), this.on("close", () => this.tracker?.track("paywall_closed")), this.on(
|
|
2712
|
+
"trial_blocked",
|
|
2713
|
+
(i) => this.tracker?.track("trial_blocked", {
|
|
2714
|
+
mode: i.mode,
|
|
2715
|
+
...i.mode === "time" ? { remaining_ms: i.remainingMs, total_ms: i.totalMs } : i.mode === "opens" ? { remaining_actions: i.remainingActions, total_actions: i.totalActions } : {}
|
|
2716
|
+
})
|
|
2717
|
+
), this.on("trial_expired", () => this.tracker?.track("trial_expired")), this.on(
|
|
2718
|
+
"visibility_blocked",
|
|
2719
|
+
(i) => this.tracker?.track("visibility_blocked", {
|
|
2720
|
+
reason: i.reason,
|
|
2721
|
+
country: i.country,
|
|
2722
|
+
tier: i.tier
|
|
2723
|
+
})
|
|
2724
|
+
), this.on(
|
|
2725
|
+
"error",
|
|
2726
|
+
(i) => this.tracker?.track("error", { code: i.code, message: i.message })
|
|
2727
|
+
);
|
|
2728
|
+
}
|
|
2729
|
+
/**
|
|
2730
|
+
* Отправить произвольное аналитическое событие. Имена из системного whitelist'а
|
|
2731
|
+
* (`app_opened`, `paywall_viewed`, ...) разрешены как есть. Кастомные —
|
|
2732
|
+
* с префиксом `host:` (например `host:user_clicked_upgrade`). Сервер
|
|
2733
|
+
* дропает события с неразрешёнными именами.
|
|
2734
|
+
*
|
|
2735
|
+
* Самый частый кейс — `track('app_opened')` от хоста сразу после загрузки
|
|
2736
|
+
* приложения, чтобы зафиксировать воронку до открытия пейвола.
|
|
2737
|
+
*/
|
|
2738
|
+
track(t, r) {
|
|
2739
|
+
this.tracker?.track(t, r);
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* Удобный шорткат вместо `paywall.on('userChange', cb)` — самый частый
|
|
2743
|
+
* паттерн в host-коде, поэтому отдельный named метод. Колбек получает
|
|
2744
|
+
* last-known user из кеша синхронно через microtask, если он есть.
|
|
2745
|
+
*/
|
|
2746
|
+
onUserChange(t) {
|
|
2747
|
+
return this.on("userChange", t);
|
|
2748
|
+
}
|
|
2749
|
+
/**
|
|
2750
|
+
* Заменить cachedBootstrap живыми данными — для preview-режима в редакторе
|
|
2751
|
+
* админки. Если модалка открыта, PaywallRoot подписан на onBootstrapChange
|
|
2752
|
+
* и перерендерится мгновенно. До open() — затравка для bootstrap()-effect'а.
|
|
2753
|
+
*
|
|
2754
|
+
* См. {@link BillingClientOptions.preview} — обычно эту опцию ставят на
|
|
2755
|
+
* клиент, чтобы заодно отключить сетевой revalidate. setBootstrap технически
|
|
2756
|
+
* работает и в production-режиме, но конкуренция с revalidate'ом из сети
|
|
2757
|
+
* почти всегда нежелательна.
|
|
2758
|
+
*/
|
|
2759
|
+
setBootstrap(t) {
|
|
2760
|
+
this.billing.setBootstrap(t);
|
|
2761
|
+
}
|
|
2762
|
+
/**
|
|
2763
|
+
* Сменить force-locale на лету — для live-preview редактора админки, когда
|
|
2764
|
+
* юзер переключает «Preview as user from <country>». Грузит соответствующий
|
|
2765
|
+
* static-чанк и форсит re-render через handle.update. См. PaywallUIOptions.locale.
|
|
2766
|
+
*
|
|
2767
|
+
* Передай `null`/`undefined`, чтобы вернуть автоматическую резолв-логику
|
|
2768
|
+
* (navigator.language → locale_default).
|
|
2769
|
+
*/
|
|
2770
|
+
setLocale(t) {
|
|
2771
|
+
const r = t ?? null;
|
|
2772
|
+
r !== this.forceLocale && (this.forceLocale = r, this.handle && this.handle.update({ locale: r }));
|
|
2773
|
+
}
|
|
2774
|
+
on(t, r) {
|
|
2775
|
+
let a = this.listeners.get(t);
|
|
2776
|
+
return a || (a = /* @__PURE__ */ new Set(), this.listeners.set(t, a)), a.add(r), () => a.delete(r);
|
|
2777
|
+
}
|
|
2778
|
+
off(t, r) {
|
|
2779
|
+
this.listeners.get(t)?.delete(r);
|
|
2780
|
+
}
|
|
2781
|
+
emit(t, ...r) {
|
|
2782
|
+
const a = this.listeners.get(t);
|
|
2783
|
+
if (!a) return;
|
|
2784
|
+
const i = r[0];
|
|
2785
|
+
for (const o of a)
|
|
2786
|
+
try {
|
|
2787
|
+
o(i);
|
|
2788
|
+
} catch (s) {
|
|
2789
|
+
typeof console < "u" && console.error("[paywall] listener error", s);
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
open(t = {}) {
|
|
2793
|
+
this.openInternal("layout", t);
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* Прогревает bootstrap-кеш и balance-кеш заранее, без открытия модалки.
|
|
2797
|
+
* Полезно когда host знает, что юзер скоро откроет paywall (hover на CTA,
|
|
2798
|
+
* mount компонента) — первый `open()` рендерится мгновенно, без loading-flash.
|
|
2799
|
+
*
|
|
2800
|
+
* Не throw'ает: если сеть упала, тихо игнорирует (повторный open() сделает
|
|
2801
|
+
* fresh-bootstrap с error-state как обычно). `signal` для отмены — например,
|
|
2802
|
+
* если хост размонтирует компонент быстрее, чем bootstrap вернётся.
|
|
2803
|
+
*
|
|
2804
|
+
* Вызывать можно сколько угодно раз — последующие вызовы возвращают cached
|
|
2805
|
+
* Promise (BillingClient уже дедуплицирует).
|
|
2806
|
+
*/
|
|
2807
|
+
async preload(t = {}) {
|
|
2808
|
+
try {
|
|
2809
|
+
await this.billing.bootstrap({ signal: t.signal }), this.billing.auth && await this.billing.getBalances({ signal: t.signal });
|
|
2810
|
+
} catch {
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
/**
|
|
2814
|
+
* Открывает модалку сразу с саппорт-формой (минуя layout с тарифами).
|
|
2815
|
+
* Полезно, когда host-приложение хочет дать юзеру кнопку «Help / Support»,
|
|
2816
|
+
* не связанную с пейволом-апгрейдом. Back/Done в саппорт-форме закрывают
|
|
2817
|
+
* модалку (не возвращают к тарифам), потому что юзер пришёл сюда напрямую.
|
|
2818
|
+
*
|
|
2819
|
+
* Из обычного `paywall.open()`-flow саппорт всё равно доступен через
|
|
2820
|
+
* Contact Support-ссылку в `current_session`-блоке (там Back возвращает
|
|
2821
|
+
* к layout).
|
|
2822
|
+
*/
|
|
2823
|
+
openSupport(t = {}) {
|
|
2824
|
+
this.openInternal("support", t);
|
|
2825
|
+
}
|
|
2826
|
+
/**
|
|
2827
|
+
* Открывает модалку сразу с auth-gate (логин/регистрация), без layout с
|
|
2828
|
+
* тарифами. Сценарий: returning customer уже купил, ему просто нужно
|
|
2829
|
+
* залогиниться, чтобы SDK подцепил его purchases. После signIn модалка
|
|
2830
|
+
* закрывается; Back тоже закрывает (юзер пришёл только за логином).
|
|
2831
|
+
*
|
|
2832
|
+
* Без `auth` (managed-auth не подключён) метод — no-op: некому делать
|
|
2833
|
+
* signIn. Если юзер уже залогинен — модалка всё равно откроется и
|
|
2834
|
+
* закроется через auto-resume в auth_gate effect'е (мгновение).
|
|
2835
|
+
*
|
|
2836
|
+
* Триал не блокирует этот флоу — auth не connect'ится с trial-механикой.
|
|
2837
|
+
*/
|
|
2838
|
+
openAuth(t = {}) {
|
|
2839
|
+
this.auth && this.openInternal("auth", { ...t, skipTrial: !0 });
|
|
2840
|
+
}
|
|
2841
|
+
/**
|
|
2842
|
+
* Открывает модалку с anonymous-gate. AnonGate сразу зовёт
|
|
2843
|
+
* `auth.signInAnonymously()`:
|
|
2844
|
+
* - если в storage есть `anonRefreshToken` — silent resume через
|
|
2845
|
+
* /auth/refresh, модалка схлопывается мгновенно (юзер видит лёгкий
|
|
2846
|
+
* спиннер ~100мс);
|
|
2847
|
+
* - иначе — fresh POST /auth/anonymous/signin без captcha (защита от
|
|
2848
|
+
* abuse держится на Supabase per-real-IP rate-limit + CF Bot Fight Mode).
|
|
2849
|
+
*
|
|
2850
|
+
* После успешного signIn'а модалка закрывается; host подхватывает свежую
|
|
2851
|
+
* session через `auth.onAuthChange` или `paywall.onUserChange`. Для UX
|
|
2852
|
+
* "просто залогиниться чтобы api-gateway работал, без покупок".
|
|
2853
|
+
*
|
|
2854
|
+
* Без managed-auth (`auth` не подключён) метод — no-op. Триал и
|
|
2855
|
+
* visibility-таргетинг этот flow обходит: анон-логин не должен зависеть
|
|
2856
|
+
* от страны юзера или trial-стейджа.
|
|
2857
|
+
*/
|
|
2858
|
+
openAnonGate(t = {}) {
|
|
2859
|
+
this.auth && this.openInternal("anon", { ...t, skipTrial: !0, skipVisibility: !0 });
|
|
2860
|
+
}
|
|
2861
|
+
openInternal(t, r) {
|
|
2862
|
+
r.identity && this.billing.setIdentity(r.identity), this.purchased = !1;
|
|
2863
|
+
const a = r.skipTrial === !0 || t === "support", i = r.skipVisibility === !0 || t === "support" || t === "auth" || t === "anon", o = r.renew === !0;
|
|
2864
|
+
if (a && i) {
|
|
2865
|
+
this.mountAndShow(t, { renew: o });
|
|
2866
|
+
return;
|
|
2867
|
+
}
|
|
2868
|
+
const s = this.billing.getCachedBootstrap();
|
|
2869
|
+
if (s) {
|
|
2870
|
+
this.runOpenGates(t, s, { skipTrial: a, skipVisibility: i, renew: o });
|
|
2871
|
+
return;
|
|
2872
|
+
}
|
|
2873
|
+
if (this.mountThenLoad) {
|
|
2874
|
+
this.mountAndShow(t, { renew: o }), this.billing.bootstrap().then((l) => this.runDelayedGates(l, { skipTrial: a, skipVisibility: i })).catch(() => {
|
|
2875
|
+
});
|
|
2876
|
+
return;
|
|
2877
|
+
}
|
|
2878
|
+
this.billing.bootstrap().then((l) => this.runOpenGates(t, l, { skipTrial: a, skipVisibility: i, renew: o })).catch(() => {
|
|
2879
|
+
this.mountAndShow(t, { renew: o });
|
|
2880
|
+
});
|
|
2881
|
+
}
|
|
2882
|
+
/** Применить gates ПОСЛЕ того, как модалка уже смонтирована (mount-then-load
|
|
2883
|
+
* путь). Если gate блокирует — close() + emit. Если юзер уже сам закрыл
|
|
2884
|
+
* модалку до резолва bootstrap'а — no-op (isOpen=false). */
|
|
2885
|
+
runDelayedGates(t, r) {
|
|
2886
|
+
if (!this.isOpen) return;
|
|
2887
|
+
if (!r.skipVisibility) {
|
|
2888
|
+
const o = t.settings.visibility;
|
|
2889
|
+
if (o && (this.lastVisibility = o, !o.visible)) {
|
|
2890
|
+
this.close(), this.emit("visibility_blocked", o);
|
|
2891
|
+
return;
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
if (r.skipTrial) return;
|
|
2895
|
+
const a = t.settings.trial;
|
|
2896
|
+
if (!a) return;
|
|
2897
|
+
const i = this.ensureTrialStore(a);
|
|
2898
|
+
i.check().then(async (o) => {
|
|
2899
|
+
if (this.isOpen && (this.lastTrialStatus = o, o.mode !== "none")) {
|
|
2900
|
+
if (o.blocked) {
|
|
2901
|
+
const s = await i.recordBlock();
|
|
2902
|
+
if (this.lastTrialStatus = s, !this.isOpen) return;
|
|
2903
|
+
this.close(), this.emit("trial_blocked", s);
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired"));
|
|
2907
|
+
}
|
|
2908
|
+
}).catch((o) => {
|
|
2909
|
+
typeof console < "u" && console.warn("[paywall] trial check failed", o);
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
// Порядок гейтов: visibility → trial. Country-mismatch ≠ trial-block, и
|
|
2913
|
+
// вести trial-стейт «осталось N показов» под юзером, который вообще не
|
|
2914
|
+
// должен увидеть пейвол по таргетингу — бессмысленно: при возврате в
|
|
2915
|
+
// правильную страну он окажется со «слипшимся» триал-счётчиком.
|
|
2916
|
+
runOpenGates(t, r, a) {
|
|
2917
|
+
if (!a.skipVisibility) {
|
|
2918
|
+
const i = r.settings.visibility;
|
|
2919
|
+
if (i && (this.lastVisibility = i, !i.visible)) {
|
|
2920
|
+
this.emit("visibility_blocked", i);
|
|
2921
|
+
return;
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
if (a.skipTrial) {
|
|
2925
|
+
this.mountAndShow(t, { renew: a.renew });
|
|
2926
|
+
return;
|
|
2927
|
+
}
|
|
2928
|
+
this.gateThroughTrial(t, r, a.renew);
|
|
2929
|
+
}
|
|
2930
|
+
gateThroughTrial(t, r, a) {
|
|
2931
|
+
const i = r.settings.trial;
|
|
2932
|
+
if (!i) {
|
|
2933
|
+
this.mountAndShow(t, { renew: a });
|
|
2934
|
+
return;
|
|
2935
|
+
}
|
|
2936
|
+
const o = this.ensureTrialStore(i);
|
|
2937
|
+
o.check().then(async (s) => {
|
|
2938
|
+
if (this.lastTrialStatus = s, s.mode === "none") {
|
|
2939
|
+
this.mountAndShow(t, { renew: a });
|
|
2940
|
+
return;
|
|
2941
|
+
}
|
|
2942
|
+
if (s.blocked) {
|
|
2943
|
+
const l = await o.recordBlock();
|
|
2944
|
+
this.lastTrialStatus = l, this.emit("trial_blocked", l);
|
|
2945
|
+
return;
|
|
2946
|
+
}
|
|
2947
|
+
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), this.mountAndShow(t, { renew: a });
|
|
2948
|
+
}).catch((s) => {
|
|
2949
|
+
typeof console < "u" && console.warn("[paywall] trial check failed", s), this.mountAndShow(t, { renew: a });
|
|
2950
|
+
});
|
|
2951
|
+
}
|
|
2952
|
+
ensureTrialStore(t) {
|
|
2953
|
+
if (this.trialStore && this.trialStoreConfig && hr(this.trialStoreConfig, t))
|
|
2954
|
+
return this.trialStore;
|
|
2955
|
+
this.trialStoreConfig = t;
|
|
2956
|
+
const r = this.billing.createTrialStore;
|
|
2957
|
+
return this.trialStore = typeof r == "function" ? r.call(this.billing, t) : qt(this.billing.getStorage(), this.billing.paywallId, t), this.trialStore;
|
|
2958
|
+
}
|
|
2959
|
+
mountAndShow(t, r = {}) {
|
|
2960
|
+
const a = r.renew === !0;
|
|
2961
|
+
if (this.handle) {
|
|
2962
|
+
this.isOpen = !0, this.handle.update({ open: !0, initialView: t, purchased: !1, renew: a }), this.emit("open");
|
|
2963
|
+
return;
|
|
2964
|
+
}
|
|
2965
|
+
this.isOpen = !0, this.handle = Zt(
|
|
2966
|
+
tr,
|
|
2967
|
+
{
|
|
2968
|
+
client: this.billing,
|
|
2969
|
+
open: !0,
|
|
2970
|
+
initialView: t,
|
|
2971
|
+
purchased: !1,
|
|
2972
|
+
renew: a,
|
|
2973
|
+
onClose: () => this.close(),
|
|
2974
|
+
onEvent: (i, o) => {
|
|
2975
|
+
this.emit(i, o), i === "checkout_started" && this.startUserWatcher();
|
|
2976
|
+
},
|
|
2977
|
+
onState: (i) => this.applyState(i),
|
|
2978
|
+
inline: this.inline,
|
|
2979
|
+
locale: this.forceLocale
|
|
2980
|
+
},
|
|
2981
|
+
{ host: this.host, shadowMode: this.shadowMode, inline: this.inline }
|
|
2982
|
+
), this.emit("open");
|
|
2983
|
+
}
|
|
2984
|
+
applyState(t) {
|
|
2985
|
+
if (!pr(this.currentState, t)) {
|
|
2986
|
+
this.currentState = t;
|
|
2987
|
+
for (const r of this.stateListeners)
|
|
2988
|
+
try {
|
|
2989
|
+
r(t);
|
|
2990
|
+
} catch (a) {
|
|
2991
|
+
console.warn("[paywall] onStateChange listener threw", a);
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
/**
|
|
2996
|
+
* Sync-snapshot текущего состояния модалки. Подходит для `useSyncExternalStore`
|
|
2997
|
+
* в React (`useSyncExternalStore(paywall.onStateChange, paywall.getState)`)
|
|
2998
|
+
* и для одноразовых проверок («открыт ли пейвол сейчас?»).
|
|
2999
|
+
*
|
|
3000
|
+
* Snapshot стабилен — пока state не изменился, повторный getState() вернёт
|
|
3001
|
+
* `===`-равный объект (важно для useSyncExternalStore чтобы не ре-рендерить).
|
|
3002
|
+
*/
|
|
3003
|
+
getState() {
|
|
3004
|
+
return this.currentState;
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* Подписка на изменения state. Колбек вызывается при каждом реальном
|
|
3008
|
+
* изменении (closed → loading → ready → ...). По умолчанию initial snapshot
|
|
3009
|
+
* отдаётся через microtask после подписки; через `{immediate: 'sync'|'none'}`
|
|
3010
|
+
* можно сделать sync-доставку (для useSyncExternalStore — там она не нужна,
|
|
3011
|
+
* snapshot читается через getSnapshot отдельно) или вовсе пропустить
|
|
3012
|
+
* initial.
|
|
3013
|
+
*
|
|
3014
|
+
* Возвращает unsubscribe.
|
|
3015
|
+
*/
|
|
3016
|
+
onStateChange(t, r = {}) {
|
|
3017
|
+
this.stateListeners.add(t);
|
|
3018
|
+
const a = r.immediate ?? "microtask";
|
|
3019
|
+
if (a !== "none") {
|
|
3020
|
+
const i = this.currentState;
|
|
3021
|
+
if (a === "sync")
|
|
3022
|
+
try {
|
|
3023
|
+
t(i);
|
|
3024
|
+
} catch (o) {
|
|
3025
|
+
console.warn("[paywall] onStateChange initial sync threw", o);
|
|
3026
|
+
}
|
|
3027
|
+
else
|
|
3028
|
+
queueMicrotask(() => {
|
|
3029
|
+
this.stateListeners.has(t) && t(i);
|
|
3030
|
+
});
|
|
3031
|
+
}
|
|
3032
|
+
return () => {
|
|
3033
|
+
this.stateListeners.delete(t);
|
|
3034
|
+
};
|
|
3035
|
+
}
|
|
3036
|
+
/** Sync-доступ к последнему известному статусу триала. null — `paywall.open()`
|
|
3037
|
+
* ещё не вызывался либо триал отключён в конфиге пейвола. Удобно для
|
|
3038
|
+
* собственного UI хоста («осталось 3 показа», «триал истечёт через 2ч»). */
|
|
3039
|
+
getTrialStatus() {
|
|
3040
|
+
return this.lastTrialStatus;
|
|
3041
|
+
}
|
|
3042
|
+
/** Sync-доступ к последнему server-computed visibility-статусу. null —
|
|
3043
|
+
* bootstrap ещё не загружен или сервер не отдаёт `settings.visibility`
|
|
3044
|
+
* (например, старая версия online без targeting-патча). Хост может
|
|
3045
|
+
* использовать для собственного fallback'а: «сервис недоступен в вашей
|
|
3046
|
+
* стране». Обновляется на каждом open(), который проходит через gate. */
|
|
3047
|
+
getVisibility() {
|
|
3048
|
+
return this.lastVisibility;
|
|
3049
|
+
}
|
|
3050
|
+
/**
|
|
3051
|
+
* Цены пейвола — шорткат над `bootstrap()`. Локали уже применены, кэш и
|
|
3052
|
+
* stale-while-revalidate идентичны `billing.bootstrap()`. Подходит для
|
|
3053
|
+
* pricing-страниц/карточек на сайте, где host хочет показать те же цены,
|
|
3054
|
+
* что и в модалке, не вытаскивая bootstrap руками.
|
|
3055
|
+
*/
|
|
3056
|
+
getPrices(t = {}) {
|
|
3057
|
+
return this.billing.getPrices(t);
|
|
3058
|
+
}
|
|
3059
|
+
/** Sync-снимок цен. null — bootstrap ещё не загружали. */
|
|
3060
|
+
getCachedPrices() {
|
|
3061
|
+
return this.billing.getCachedPrices();
|
|
3062
|
+
}
|
|
3063
|
+
/** Снимок текущего «языка юзера» — proxy над `billing.getUserLanguage()`.
|
|
3064
|
+
* Используй, чтобы синхронизировать i18n host'а с тем, что фактически
|
|
3065
|
+
* показывает пейвол. См. подробности в `BillingClient.getUserLanguage`. */
|
|
3066
|
+
getUserLanguage() {
|
|
3067
|
+
return this.billing.getUserLanguage();
|
|
3068
|
+
}
|
|
3069
|
+
/**
|
|
3070
|
+
* Решает, нужно ли блокировать фичу для текущего юзера. Без побочных эффектов
|
|
3071
|
+
* (на trial-storage `recordBlock` не вызывается, модалка не монтируется).
|
|
3072
|
+
*
|
|
3073
|
+
* Порядок проверок (первый сработавший — финальный):
|
|
3074
|
+
* 1. `has_active_subscription` — самый сильный сигнал, перебивает остальные.
|
|
3075
|
+
* Юзер с подпиской получает доступ независимо от visibility/trial.
|
|
3076
|
+
* 2. `visibility` (страна/девайс/disabled-флаг) — юзер вне monetization-scope'а
|
|
3077
|
+
* пейвола, гейтить нельзя.
|
|
3078
|
+
* 3. `trial` — пре-пейвольный бесплатный период активен.
|
|
3079
|
+
* 4. Иначе — `blocked`, host лочит фичу и зовёт `paywall.open()`.
|
|
3080
|
+
*
|
|
3081
|
+
* Bootstrap кешируется в BillingClient — `getAccess()` можно дёргать на
|
|
3082
|
+
* каждый рендер host-компонента, /bootstrap не дублируется. При упавшей сети
|
|
3083
|
+
* fallback на persistent-cached user из storage: юзер с прошлой подпиской
|
|
3084
|
+
* получает `granted` офлайн, иначе `blocked` (host покажет пейвол с
|
|
3085
|
+
* error-state, юзер сможет ретрайнуть). Side-эффект: обновляются
|
|
3086
|
+
* `lastVisibility` / `lastTrialStatus`, чтобы синхронные геттеры
|
|
3087
|
+
* `getVisibility()` / `getTrialStatus()` видели свежие данные после первого
|
|
3088
|
+
* `getAccess()`, а не только после первого `open()`.
|
|
3089
|
+
*/
|
|
3090
|
+
async getAccess(t = {}) {
|
|
3091
|
+
let r = this.billing.getCachedBootstrap();
|
|
3092
|
+
if (!r)
|
|
3093
|
+
try {
|
|
3094
|
+
r = await this.billing.bootstrap({ signal: t.signal });
|
|
3095
|
+
} catch {
|
|
3096
|
+
const s = this.billing.getCachedUser();
|
|
3097
|
+
return s?.has_active_subscription ? {
|
|
3098
|
+
access: "granted",
|
|
3099
|
+
reason: "has_subscription",
|
|
3100
|
+
visibility: null,
|
|
3101
|
+
trial: null,
|
|
3102
|
+
user: s
|
|
3103
|
+
} : {
|
|
3104
|
+
access: "blocked",
|
|
3105
|
+
reason: "no_subscription",
|
|
3106
|
+
visibility: null,
|
|
3107
|
+
trial: null,
|
|
3108
|
+
user: s
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
const a = r.user ?? null;
|
|
3112
|
+
if (a?.has_active_subscription)
|
|
3113
|
+
return {
|
|
3114
|
+
access: "granted",
|
|
3115
|
+
reason: "has_subscription",
|
|
3116
|
+
visibility: r.settings.visibility ?? null,
|
|
3117
|
+
trial: null,
|
|
3118
|
+
user: a
|
|
3119
|
+
};
|
|
3120
|
+
let i = null;
|
|
3121
|
+
if (!t.skipVisibility) {
|
|
3122
|
+
const s = r.settings.visibility;
|
|
3123
|
+
if (s && (i = s, this.lastVisibility = s, !s.visible))
|
|
3124
|
+
return { access: "granted", reason: "visibility_blocked", visibility: i, trial: null, user: a };
|
|
3125
|
+
}
|
|
3126
|
+
let o = null;
|
|
3127
|
+
if (!t.skipTrial) {
|
|
3128
|
+
const s = r.settings.trial;
|
|
3129
|
+
if (s)
|
|
3130
|
+
try {
|
|
3131
|
+
if (o = await this.ensureTrialStore(s).check(), this.lastTrialStatus = o, o.blocked)
|
|
3132
|
+
return { access: "granted", reason: "trial_blocked", visibility: i, trial: o, user: a };
|
|
3133
|
+
} catch (l) {
|
|
3134
|
+
typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", l);
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
return { access: "blocked", reason: "no_subscription", visibility: i, trial: o, user: a };
|
|
3138
|
+
}
|
|
3139
|
+
/** Сбросить состояние триала в storage. Полезно для дев-режима / админ-кнопки
|
|
3140
|
+
* «прогнать сценарий заново». В проде хост обычно не дёргает. */
|
|
3141
|
+
async resetTrial() {
|
|
3142
|
+
this.trialStore && (await this.trialStore.reset(), this.lastTrialStatus = null, this.trialExpiredFired = !1);
|
|
3143
|
+
}
|
|
3144
|
+
// Запускает polling user-state до has_active_subscription=true либо до
|
|
3145
|
+
// таймаута. Идемпотентен: повторный вызов на уже работающем watcher'е —
|
|
3146
|
+
// no-op (юзер мог нажать Continue повторно после возврата).
|
|
3147
|
+
//
|
|
3148
|
+
// В extension popup runtime — no-op (popup не доживёт). Там полагаемся на
|
|
3149
|
+
// bootstrap при следующем открытии.
|
|
3150
|
+
startUserWatcher() {
|
|
3151
|
+
this.watcher || cr() && (this.watcher = new lr({
|
|
3152
|
+
client: this.billing,
|
|
3153
|
+
onActive: (t) => {
|
|
3154
|
+
this.watcher = null, this.emit("purchase_completed", { priceId: null, sessionId: null });
|
|
3155
|
+
const r = this.billing.getCachedBootstrap()?.settings.success_redirect_url;
|
|
3156
|
+
if (r && typeof window < "u")
|
|
3157
|
+
try {
|
|
3158
|
+
window.location.assign(r);
|
|
3159
|
+
return;
|
|
3160
|
+
} catch {
|
|
3161
|
+
}
|
|
3162
|
+
this.isOpen && this.handle && (this.purchased = !0, this.handle.update({ purchased: !0 }));
|
|
3163
|
+
},
|
|
3164
|
+
onTimeout: () => {
|
|
3165
|
+
this.watcher = null;
|
|
3166
|
+
}
|
|
3167
|
+
}), this.watcher.start());
|
|
3168
|
+
}
|
|
3169
|
+
close() {
|
|
3170
|
+
!this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(st), this.emit("close"));
|
|
3171
|
+
}
|
|
3172
|
+
/**
|
|
3173
|
+
* Сканирует текущий URL на маркеры возврата с checkout и эмитит
|
|
3174
|
+
* purchase_completed / purchase_failed. Маркеры удаляются из URL
|
|
3175
|
+
* через history.replaceState. Ищет и в hash, и в search (hash приоритетнее —
|
|
3176
|
+
* защита от клиентских SPA-роутеров, перехватывающих query).
|
|
3177
|
+
*/
|
|
3178
|
+
checkReturn() {
|
|
3179
|
+
if (typeof window > "u") return;
|
|
3180
|
+
const t = new URL(window.location.href), r = St(t.hash.replace(/^#/, "")), a = St(t.search.replace(/^\?/, "")), i = r ?? a;
|
|
3181
|
+
i && (i.status === "paid" ? (this.emit("purchase_completed", {
|
|
3182
|
+
priceId: i.priceId,
|
|
3183
|
+
sessionId: i.sessionId
|
|
3184
|
+
}), gr(i)) : (i.status === "failed" || i.status === "cancelled") && this.emit("purchase_failed", { reason: i.status }), fr(t));
|
|
3185
|
+
}
|
|
3186
|
+
destroy() {
|
|
3187
|
+
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 = st;
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
function dr(e) {
|
|
3191
|
+
if (!e.auth) return { auth: void 0, ownsAuth: !1 };
|
|
3192
|
+
if (e.auth instanceof dt || ur(e.auth))
|
|
3193
|
+
return { auth: e.auth, ownsAuth: !1 };
|
|
3194
|
+
const t = e.auth === !0 ? {} : e.auth;
|
|
3195
|
+
return {
|
|
3196
|
+
auth: new dt({
|
|
3197
|
+
paywallId: e.paywallId,
|
|
3198
|
+
apiOrigin: t.apiOrigin ?? e.apiOrigin,
|
|
3199
|
+
storage: t.storage ?? e.storage,
|
|
3200
|
+
fetch: t.fetch ?? e.fetch,
|
|
3201
|
+
openPopup: t.openPopup
|
|
3202
|
+
}),
|
|
3203
|
+
ownsAuth: !0
|
|
3204
|
+
};
|
|
3205
|
+
}
|
|
3206
|
+
function ur(e) {
|
|
3207
|
+
if (typeof e != "object" || e === null) return !1;
|
|
3208
|
+
const t = e;
|
|
3209
|
+
return typeof t.onAuthChange == "function" && typeof t.getCachedSession == "function" && typeof t.signOut == "function";
|
|
3210
|
+
}
|
|
3211
|
+
function pr(e, t) {
|
|
3212
|
+
return e.open === t.open && e.view === t.view && e.error === t.error;
|
|
3213
|
+
}
|
|
3214
|
+
function hr(e, t) {
|
|
3215
|
+
return e.mode === t.mode && e.payload === t.payload && e.storage === t.storage;
|
|
3216
|
+
}
|
|
3217
|
+
function St(e) {
|
|
3218
|
+
if (!e) return null;
|
|
3219
|
+
const t = new URLSearchParams(e), r = t.get(H.status);
|
|
3220
|
+
return r ? {
|
|
3221
|
+
status: r,
|
|
3222
|
+
priceId: t.get(H.priceId),
|
|
3223
|
+
sessionId: t.get(H.sessionId)
|
|
3224
|
+
} : null;
|
|
3225
|
+
}
|
|
3226
|
+
function gr(e) {
|
|
3227
|
+
if (!(typeof window > "u" || !window.opener))
|
|
3228
|
+
try {
|
|
3229
|
+
window.opener.postMessage(
|
|
3230
|
+
{
|
|
3231
|
+
type: "paywall_purchase",
|
|
3232
|
+
status: e.status,
|
|
3233
|
+
priceId: e.priceId,
|
|
3234
|
+
sessionId: e.sessionId
|
|
3235
|
+
},
|
|
3236
|
+
"*"
|
|
3237
|
+
);
|
|
3238
|
+
} catch {
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
function fr(e) {
|
|
3242
|
+
const t = (a, i) => {
|
|
3243
|
+
if (!a) return "";
|
|
3244
|
+
const o = new URLSearchParams(a.replace(/^[?#]/, ""));
|
|
3245
|
+
o.delete(H.status), o.delete(H.priceId), o.delete(H.sessionId);
|
|
3246
|
+
const s = o.toString();
|
|
3247
|
+
return s ? i + s : "";
|
|
3248
|
+
}, r = e.pathname + t(e.search, "?") + t(e.hash, "#");
|
|
3249
|
+
window.history.replaceState(null, "", r);
|
|
3250
|
+
}
|
|
3251
|
+
export {
|
|
3252
|
+
yr as P,
|
|
3253
|
+
Ye as b
|
|
3254
|
+
};
|
|
3255
|
+
//# sourceMappingURL=PaywallUI-BYquPomD.js.map
|