@monetize.software/sdk 3.0.0-alpha.2 → 3.0.0-alpha.20
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/README.md +34 -13
- package/dist/chunks/PaywallUI-BXEOgPTK.js +3555 -0
- package/dist/chunks/PaywallUI-BXEOgPTK.js.map +1 -0
- package/dist/chunks/PaywallUI-Cybo6wdO.js +26 -0
- package/dist/chunks/PaywallUI-Cybo6wdO.js.map +1 -0
- package/dist/chunks/ar-OnxZkqWR.js +2 -0
- package/dist/chunks/ar-OnxZkqWR.js.map +1 -0
- package/dist/chunks/ar-rSKgwKvp.js +129 -0
- package/dist/chunks/ar-rSKgwKvp.js.map +1 -0
- package/dist/chunks/cs-Cb2KZ70r.js +2 -0
- package/dist/chunks/cs-Cb2KZ70r.js.map +1 -0
- package/dist/chunks/cs-DIWkcge_.js +125 -0
- package/dist/chunks/cs-DIWkcge_.js.map +1 -0
- package/dist/chunks/da-DdMW98j3.js +125 -0
- package/dist/chunks/da-DdMW98j3.js.map +1 -0
- package/dist/chunks/da-DyQC12xy.js +2 -0
- package/dist/chunks/da-DyQC12xy.js.map +1 -0
- package/dist/chunks/de-CWM13wnK.js +2 -0
- package/dist/chunks/de-CWM13wnK.js.map +1 -0
- package/dist/chunks/de-D1bSmD_-.js +144 -0
- package/dist/chunks/de-D1bSmD_-.js.map +1 -0
- package/dist/chunks/el-BtKuORsc.js +2 -0
- package/dist/chunks/el-BtKuORsc.js.map +1 -0
- package/dist/chunks/el-C4LtWpfP.js +129 -0
- package/dist/chunks/el-C4LtWpfP.js.map +1 -0
- package/dist/chunks/es-Bhx7w85J.js +144 -0
- package/dist/chunks/es-Bhx7w85J.js.map +1 -0
- package/dist/chunks/es-qLcKnBft.js +2 -0
- package/dist/chunks/es-qLcKnBft.js.map +1 -0
- package/dist/chunks/fi-C34Oc6rg.js +125 -0
- package/dist/chunks/fi-C34Oc6rg.js.map +1 -0
- package/dist/chunks/fi-kGtbK51C.js +2 -0
- package/dist/chunks/fi-kGtbK51C.js.map +1 -0
- package/dist/chunks/fr-BrWtqej3.js +144 -0
- package/dist/chunks/fr-BrWtqej3.js.map +1 -0
- package/dist/chunks/fr-CScwFVNj.js +2 -0
- package/dist/chunks/fr-CScwFVNj.js.map +1 -0
- package/dist/chunks/he-Byr2r07x.js +129 -0
- package/dist/chunks/he-Byr2r07x.js.map +1 -0
- package/dist/chunks/he-ChFVbP_S.js +2 -0
- package/dist/chunks/he-ChFVbP_S.js.map +1 -0
- package/dist/chunks/hi-BIswPYL2.js +2 -0
- package/dist/chunks/hi-BIswPYL2.js.map +1 -0
- package/dist/chunks/hi-CABVgpKU.js +129 -0
- package/dist/chunks/hi-CABVgpKU.js.map +1 -0
- package/dist/chunks/hu-CSQ9avfJ.js +125 -0
- package/dist/chunks/hu-CSQ9avfJ.js.map +1 -0
- package/dist/chunks/hu-CT_jwL0k.js +2 -0
- package/dist/chunks/hu-CT_jwL0k.js.map +1 -0
- package/dist/chunks/id-2lYf7ogC.js +2 -0
- package/dist/chunks/id-2lYf7ogC.js.map +1 -0
- package/dist/chunks/id-BJ5w6RSU.js +125 -0
- package/dist/chunks/id-BJ5w6RSU.js.map +1 -0
- package/dist/chunks/it-CEMhCvXU.js +2 -0
- package/dist/chunks/it-CEMhCvXU.js.map +1 -0
- package/dist/chunks/it-Df8ChmTK.js +144 -0
- package/dist/chunks/it-Df8ChmTK.js.map +1 -0
- package/dist/chunks/ja-CkpO3n78.js +2 -0
- package/dist/chunks/ja-CkpO3n78.js.map +1 -0
- package/dist/chunks/ja-a53E5b2s.js +148 -0
- package/dist/chunks/ja-a53E5b2s.js.map +1 -0
- package/dist/chunks/ko-AZ8GrmXu.js +148 -0
- package/dist/chunks/ko-AZ8GrmXu.js.map +1 -0
- package/dist/chunks/ko-BKdzk0jX.js +2 -0
- package/dist/chunks/ko-BKdzk0jX.js.map +1 -0
- package/dist/chunks/nl-Bek7IiHL.js +2 -0
- package/dist/chunks/nl-Bek7IiHL.js.map +1 -0
- package/dist/chunks/nl-sF6ms5FU.js +144 -0
- package/dist/chunks/nl-sF6ms5FU.js.map +1 -0
- package/dist/chunks/no-BztcQKh8.js +2 -0
- package/dist/chunks/no-BztcQKh8.js.map +1 -0
- package/dist/chunks/no-DGf5PuW5.js +125 -0
- package/dist/chunks/no-DGf5PuW5.js.map +1 -0
- package/dist/chunks/pl-CMF2KerQ.js +2 -0
- package/dist/chunks/pl-CMF2KerQ.js.map +1 -0
- package/dist/chunks/pl-Dd-Ze6wn.js +125 -0
- package/dist/chunks/pl-Dd-Ze6wn.js.map +1 -0
- package/dist/chunks/pt-BL9X8Du2.js +144 -0
- package/dist/chunks/pt-BL9X8Du2.js.map +1 -0
- package/dist/chunks/pt-DF9cd_iW.js +2 -0
- package/dist/chunks/pt-DF9cd_iW.js.map +1 -0
- package/dist/chunks/ro-CGYmtR8q.js +125 -0
- package/dist/chunks/ro-CGYmtR8q.js.map +1 -0
- package/dist/chunks/ro-DpPc1UhJ.js +2 -0
- package/dist/chunks/ro-DpPc1UhJ.js.map +1 -0
- package/dist/chunks/ru-gt3-clOi.js +2 -0
- package/dist/chunks/ru-gt3-clOi.js.map +1 -0
- package/dist/chunks/ru-oPoQtUxk.js +147 -0
- package/dist/chunks/ru-oPoQtUxk.js.map +1 -0
- package/dist/chunks/sv-Cg7O9Uh3.js +2 -0
- package/dist/chunks/sv-Cg7O9Uh3.js.map +1 -0
- package/dist/chunks/sv-kXHP1Ct3.js +125 -0
- package/dist/chunks/sv-kXHP1Ct3.js.map +1 -0
- package/dist/chunks/th-DMcmb36d.js +129 -0
- package/dist/chunks/th-DMcmb36d.js.map +1 -0
- package/dist/chunks/th-pvtT9u-U.js +2 -0
- package/dist/chunks/th-pvtT9u-U.js.map +1 -0
- package/dist/chunks/tr-gAn3KCul.js +2 -0
- package/dist/chunks/tr-gAn3KCul.js.map +1 -0
- package/dist/chunks/tr-zjLbddlL.js +125 -0
- package/dist/chunks/tr-zjLbddlL.js.map +1 -0
- package/dist/chunks/uk-BYSiM14V.js +147 -0
- package/dist/chunks/uk-BYSiM14V.js.map +1 -0
- package/dist/chunks/uk-HIaOETe4.js +2 -0
- package/dist/chunks/uk-HIaOETe4.js.map +1 -0
- package/dist/chunks/vi-B7DVCjxx.js +2 -0
- package/dist/chunks/vi-B7DVCjxx.js.map +1 -0
- package/dist/chunks/vi-FbVRwy9D.js +125 -0
- package/dist/chunks/vi-FbVRwy9D.js.map +1 -0
- package/dist/chunks/zh-007yK7rl.js +2 -0
- package/dist/chunks/zh-007yK7rl.js.map +1 -0
- package/dist/chunks/zh-Cv0Yw4qR.js +148 -0
- package/dist/chunks/zh-Cv0Yw4qR.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +260 -26
- package/dist/core.js +505 -338
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +411 -45
- package/dist/index.js +14 -10
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +376 -44
- package/dist/ui.js +1 -1
- package/package.json +32 -31
- package/dist/chunks/PaywallUI-CRTEPjJm.js +0 -2229
- package/dist/chunks/PaywallUI-CRTEPjJm.js.map +0 -1
- package/dist/chunks/PaywallUI-CbbcfXXZ.js +0 -26
- package/dist/chunks/PaywallUI-CbbcfXXZ.js.map +0 -1
|
@@ -1,2229 +0,0 @@
|
|
|
1
|
-
import { PaywallError as T, BillingClient as ut, EventTracker as ht, AuthClient as G } from "../core.js";
|
|
2
|
-
import { render as U, h as q } from "preact";
|
|
3
|
-
import { jsxs as d, jsx as r, Fragment as nt } from "preact/jsx-runtime";
|
|
4
|
-
import { useRef as E, useEffect as M, useState as v, useMemo as ot } from "preact/hooks";
|
|
5
|
-
const W = 3600 * 1e3;
|
|
6
|
-
function R(e) {
|
|
7
|
-
return `paywall-${e}-trial-time-first-open`;
|
|
8
|
-
}
|
|
9
|
-
function F(e) {
|
|
10
|
-
return `paywall-${e}-skip-times`;
|
|
11
|
-
}
|
|
12
|
-
class st {
|
|
13
|
-
constructor(t, i, n) {
|
|
14
|
-
this.storage = t, this.paywallId = i, this.config = n;
|
|
15
|
-
}
|
|
16
|
-
async check() {
|
|
17
|
-
return this.config.mode === "time" ? this.checkTime() : this.checkOpens();
|
|
18
|
-
}
|
|
19
|
-
async recordBlock() {
|
|
20
|
-
return this.config.mode === "time" ? this.recordTime() : this.recordOpens();
|
|
21
|
-
}
|
|
22
|
-
async reset() {
|
|
23
|
-
await this.storage.removeItem(this.config.mode === "time" ? R(this.paywallId) : F(this.paywallId));
|
|
24
|
-
}
|
|
25
|
-
async checkTime() {
|
|
26
|
-
const t = this.config.payload * W, i = await this.storage.getItem(R(this.paywallId)), n = i ? Number(i) : null;
|
|
27
|
-
if (!n || !Number.isFinite(n))
|
|
28
|
-
return {
|
|
29
|
-
mode: "time",
|
|
30
|
-
blocked: !0,
|
|
31
|
-
startedAt: null,
|
|
32
|
-
expiresAt: null,
|
|
33
|
-
remainingMs: t,
|
|
34
|
-
totalMs: t
|
|
35
|
-
};
|
|
36
|
-
const a = n + t, o = Math.max(0, a - Date.now());
|
|
37
|
-
return {
|
|
38
|
-
mode: "time",
|
|
39
|
-
blocked: o > 0,
|
|
40
|
-
startedAt: n,
|
|
41
|
-
expiresAt: a,
|
|
42
|
-
remainingMs: o,
|
|
43
|
-
totalMs: t
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
async checkOpens() {
|
|
47
|
-
const t = this.config.payload, i = await this.storage.getItem(F(this.paywallId)), n = i ? Number(i) : 0, a = Number.isFinite(n) ? n : 0, o = a < t, s = Math.max(0, t - a);
|
|
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 * W, i = R(this.paywallId), n = await this.storage.getItem(i);
|
|
57
|
-
let a = n ? Number(n) : null;
|
|
58
|
-
(!a || !Number.isFinite(a)) && (a = Date.now(), await this.storage.setItem(i, String(a)));
|
|
59
|
-
const o = a + t, s = Math.max(0, o - Date.now());
|
|
60
|
-
return {
|
|
61
|
-
mode: "time",
|
|
62
|
-
blocked: s > 0,
|
|
63
|
-
startedAt: a,
|
|
64
|
-
expiresAt: o,
|
|
65
|
-
remainingMs: s,
|
|
66
|
-
totalMs: t
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
async recordOpens() {
|
|
70
|
-
const t = this.config.payload, i = F(this.paywallId), n = await this.storage.getItem(i), a = n ? Number(n) : 0, o = Number.isFinite(a) ? a : 0, s = Math.min(t, o + 1);
|
|
71
|
-
await this.storage.setItem(i, 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 Z = !1;
|
|
82
|
-
class pt {
|
|
83
|
-
constructor(t, i, n) {
|
|
84
|
-
Z || (Z = !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 st(t, i, n);
|
|
87
|
-
}
|
|
88
|
-
check() {
|
|
89
|
-
return this.fallback.check();
|
|
90
|
-
}
|
|
91
|
-
recordBlock() {
|
|
92
|
-
return this.fallback.recordBlock();
|
|
93
|
-
}
|
|
94
|
-
reset() {
|
|
95
|
-
return this.fallback.reset();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function gt(e, t, i) {
|
|
99
|
-
return i.storage === "server" ? new pt(e, t, i) : new st(e, t, i);
|
|
100
|
-
}
|
|
101
|
-
const lt = '/*! tailwindcss v4.2.4 | 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-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--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;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}@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-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-950:oklch(27.9% .077 45.635);--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;--container-md:28rem;--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);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--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;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}*,:before,:after{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{.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.-top-2\\.5{top:calc(var(--spacing) * -2.5)}.top-3{top:calc(var(--spacing) * 3)}.top-10{top:calc(var(--spacing) * 10)}.right-3{right:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.z-10{z-index:10}.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}}.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)}.mt-px{margin-top:1px}.-ml-1{margin-left:calc(var(--spacing) * -1)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.h-1{height:calc(var(--spacing) * 1)}.h-1\\.5{height:calc(var(--spacing) * 1.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 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-px{height:1px}.max-h-\\[calc\\(100dvh-1rem\\)\\]{max-height:calc(100dvh - 1rem)}.min-h-\\[104px\\]{min-height:104px}.w-1{width:calc(var(--spacing) * 1)}.w-1\\.5{width:calc(var(--spacing) * 1.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 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-\\[320px\\]{max-width:320px}.max-w-md{max-width:var(--container-md)}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.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-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.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-x-3{column-gap:calc(var(--spacing) * 3)}.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-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)}.border{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-dashed{--tw-border-style:dashed;border-style:dashed}.border-\\[var\\(--pw-accent\\)\\]{border-color:var(--pw-accent)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-400{border-color:var(--color-red-400)}.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-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-300{background-color:var(--color-gray-300)}.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-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)}}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-300{--tw-gradient-from:var(--color-amber-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-gray-200{--tw-gradient-from:var(--color-gray-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-transparent{--tw-gradient-from:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-400{--tw-gradient-to:var(--color-amber-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-gray-200{--tw-gradient-to:var(--color-gray-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-2{padding:calc(var(--spacing) * 2)}.p-3\\.5{padding:calc(var(--spacing) * 3.5)}.p-7{padding:calc(var(--spacing) * 7)}.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-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.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)}.text-center{text-align:center}.text-left{text-align:left}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--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-\\[1\\.625rem\\]{font-size:1.625rem}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.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-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[-0\\.02em\\]{--tw-tracking:-.02em;letter-spacing:-.02em}.tracking-\\[0\\.14em\\]{--tw-tracking:.14em;letter-spacing:.14em}.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-\\[var\\(--pw-accent\\)\\]{color:var(--pw-accent)}.text-amber-950{color:var(--color-amber-950)}.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-900{color:var(--color-gray-900)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.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_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_12\\%\\,transparent\\)\\]{--tw-shadow:0 0 0 3px var(--tw-shadow-color,var(--pw-accent))}@supports (color:color-mix(in lab,red,red)){.shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_12\\%\\,transparent\\)\\]{--tw-shadow:0 0 0 3px var(--tw-shadow-color,color-mix(in srgb,var(--pw-accent) 12%,transparent))}}.shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_12\\%\\,transparent\\)\\]{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_1px_0_rgba\\(15\\,23\\,42\\,0\\.02\\)\\]{--tw-shadow:0 1px 0 var(--tw-shadow-color,#0f172a05);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_1px_0_rgba\\(15\\,23\\,42\\,0\\.04\\)\\]{--tw-shadow:0 1px 0 var(--tw-shadow-color,#0f172a0a);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,.ring-1{--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)}.ring-black\\/5{--tw-ring-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.ring-black\\/5{--tw-ring-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.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))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}@media(hover:hover){.group-hover\\:border-gray-400:is(:where(.group):hover *){border-color:var(--color-gray-400)}}.placeholder\\:text-gray-400::placeholder{color:var(--color-gray-400)}@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-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-90:hover{opacity:.9}.hover\\:shadow-sm:hover{--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)}.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\\:border-\\[var\\(--pw-accent\\)\\]:focus{border-color:var(--pw-accent)}.focus\\:border-red-500:focus{border-color:var(--color-red-500)}.focus\\:shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_18\\%\\,transparent\\)\\]:focus{--tw-shadow:0 0 0 3px var(--tw-shadow-color,var(--pw-accent))}@supports (color:color-mix(in lab,red,red)){.focus\\:shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_18\\%\\,transparent\\)\\]:focus{--tw-shadow:0 0 0 3px var(--tw-shadow-color,color-mix(in srgb,var(--pw-accent) 18%,transparent))}}.focus\\:shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_18\\%\\,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\\:shadow-\\[0_0_0_3px_rgba\\(239\\,68\\,68\\,0\\.18\\)\\]:focus{--tw-shadow:0 0 0 3px var(--tw-shadow-color,#ef44442e);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\\:underline:focus-visible{text-decoration-line:underline}.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)}.active\\:translate-y-0:active{--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.active\\:brightness-95:active{--tw-brightness:brightness(95%);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,)}.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\\:shadow-\\[0_1px_0_rgba\\(15\\,23\\,42\\,0\\.04\\)\\]:disabled:hover{--tw-shadow:0 1px 0 var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.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)}}}@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-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@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}@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}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}';
|
|
102
|
-
let X = !1;
|
|
103
|
-
function ft() {
|
|
104
|
-
if (X || (X = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
|
|
105
|
-
let e;
|
|
106
|
-
try {
|
|
107
|
-
const t = new CSSStyleSheet();
|
|
108
|
-
t.replaceSync(lt), e = t.cssRules;
|
|
109
|
-
} catch {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
for (const t of e) {
|
|
113
|
-
if (t.constructor.name !== "CSSPropertyRule") continue;
|
|
114
|
-
const i = t;
|
|
115
|
-
try {
|
|
116
|
-
CSS.registerProperty({
|
|
117
|
-
name: i.name,
|
|
118
|
-
syntax: i.syntax,
|
|
119
|
-
inherits: i.inherits,
|
|
120
|
-
...i.initialValue != null ? { initialValue: i.initialValue } : {}
|
|
121
|
-
});
|
|
122
|
-
} catch {
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
function wt(e, t, i = {}) {
|
|
127
|
-
if (typeof document > "u")
|
|
128
|
-
throw new Error("mountShadow called in non-DOM environment");
|
|
129
|
-
ft();
|
|
130
|
-
const n = i.host ?? document.createElement("div");
|
|
131
|
-
n.setAttribute("data-paywall-host", ""), n.style.cssText = "all: initial; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;", n.isConnected || document.body.appendChild(n);
|
|
132
|
-
const a = n.attachShadow({ mode: i.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 + lt + (i.injectCss ?? ""), a.appendChild(s);
|
|
152
|
-
const l = document.createElement("div");
|
|
153
|
-
l.style.pointerEvents = "auto", a.appendChild(l);
|
|
154
|
-
let c = t;
|
|
155
|
-
return U(q(e, c), l), {
|
|
156
|
-
shadowRoot: a,
|
|
157
|
-
update(p) {
|
|
158
|
-
c = { ...c, ...p }, U(q(e, c), l);
|
|
159
|
-
},
|
|
160
|
-
unmount() {
|
|
161
|
-
U(null, l), n.remove();
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
const K = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
166
|
-
function bt({
|
|
167
|
-
open: e,
|
|
168
|
-
onClose: t,
|
|
169
|
-
labelledBy: i,
|
|
170
|
-
brandColor: n,
|
|
171
|
-
testMode: a,
|
|
172
|
-
allowClose: o = !0,
|
|
173
|
-
children: s
|
|
174
|
-
}) {
|
|
175
|
-
const l = E(null), c = E(null);
|
|
176
|
-
return M(() => {
|
|
177
|
-
if (!e) return;
|
|
178
|
-
c.current = document.activeElement ?? null;
|
|
179
|
-
const m = l.current;
|
|
180
|
-
m && (m.querySelector(K) ?? m).focus({ preventScroll: !0 });
|
|
181
|
-
const g = (b) => {
|
|
182
|
-
if (b.key === "Escape") {
|
|
183
|
-
if (!o) return;
|
|
184
|
-
b.stopPropagation(), t();
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (b.key !== "Tab" || !l.current) return;
|
|
188
|
-
const _ = Array.from(
|
|
189
|
-
l.current.querySelectorAll(K)
|
|
190
|
-
).filter((y) => !y.hasAttribute("disabled") && y.tabIndex !== -1);
|
|
191
|
-
if (_.length === 0) {
|
|
192
|
-
b.preventDefault();
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
const A = _[0], k = _[_.length - 1], S = document.activeElement;
|
|
196
|
-
b.shiftKey && S === A ? (b.preventDefault(), k.focus()) : !b.shiftKey && S === k && (b.preventDefault(), A.focus());
|
|
197
|
-
};
|
|
198
|
-
document.addEventListener("keydown", g, !0);
|
|
199
|
-
const w = document.body.style.overflow;
|
|
200
|
-
return document.body.style.overflow = "hidden", () => {
|
|
201
|
-
document.removeEventListener("keydown", g, !0), document.body.style.overflow = w, c.current?.focus?.({ preventScroll: !0 });
|
|
202
|
-
};
|
|
203
|
-
}, [e, t, o]), e ? /* @__PURE__ */ d(
|
|
204
|
-
"div",
|
|
205
|
-
{
|
|
206
|
-
class: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-slate-950/50 p-2 sm:p-4 backdrop-blur-md animate-[pw-fade-in_180ms_ease-out]",
|
|
207
|
-
onClick: (m) => {
|
|
208
|
-
o && m.target === m.currentTarget && t();
|
|
209
|
-
},
|
|
210
|
-
"data-pw-root": !0,
|
|
211
|
-
children: [
|
|
212
|
-
/* @__PURE__ */ d(
|
|
213
|
-
"div",
|
|
214
|
-
{
|
|
215
|
-
ref: l,
|
|
216
|
-
role: "dialog",
|
|
217
|
-
"aria-modal": "true",
|
|
218
|
-
"aria-labelledby": i,
|
|
219
|
-
tabIndex: -1,
|
|
220
|
-
class: "relative flex max-h-[calc(100dvh-1rem)] sm:max-h-[calc(100dvh-2rem)] w-full max-w-md flex-col overflow-hidden rounded-3xl bg-white outline-none ring-1 ring-black/5 animate-[pw-scale-in_220ms_cubic-bezier(0.16,1,0.3,1)]",
|
|
221
|
-
style: {
|
|
222
|
-
"--pw-accent": n ?? "#3b82f6",
|
|
223
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.04), 0 12px 32px -8px rgba(15,23,42,0.18), 0 24px 64px -16px rgba(15,23,42,0.22)"
|
|
224
|
-
},
|
|
225
|
-
children: [
|
|
226
|
-
a && /* @__PURE__ */ d(
|
|
227
|
-
"div",
|
|
228
|
-
{
|
|
229
|
-
class: "flex items-center justify-center gap-1.5 bg-gradient-to-r from-amber-300 to-amber-400 px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-amber-950",
|
|
230
|
-
role: "status",
|
|
231
|
-
children: [
|
|
232
|
-
/* @__PURE__ */ d("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
233
|
-
/* @__PURE__ */ r(
|
|
234
|
-
"path",
|
|
235
|
-
{
|
|
236
|
-
d: "M8 1L15 14H1L8 1Z",
|
|
237
|
-
stroke: "currentColor",
|
|
238
|
-
"stroke-width": "1.5",
|
|
239
|
-
"stroke-linejoin": "round"
|
|
240
|
-
}
|
|
241
|
-
),
|
|
242
|
-
/* @__PURE__ */ r("path", { d: "M8 6v3", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }),
|
|
243
|
-
/* @__PURE__ */ r("circle", { cx: "8", cy: "11.5", r: "0.5", fill: "currentColor" })
|
|
244
|
-
] }),
|
|
245
|
-
"Test mode — no real charge"
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
),
|
|
249
|
-
/* @__PURE__ */ r("div", { class: "flex-1 overflow-y-auto p-7", children: s }),
|
|
250
|
-
o ? /* @__PURE__ */ r(
|
|
251
|
-
"button",
|
|
252
|
-
{
|
|
253
|
-
type: "button",
|
|
254
|
-
onClick: t,
|
|
255
|
-
"aria-label": "Close",
|
|
256
|
-
class: `absolute right-3 ${a ? "top-10" : "top-3"} z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white/80 text-gray-400 backdrop-blur-sm transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]`,
|
|
257
|
-
children: /* @__PURE__ */ r("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ r(
|
|
258
|
-
"path",
|
|
259
|
-
{
|
|
260
|
-
d: "M3 3l10 10M13 3L3 13",
|
|
261
|
-
stroke: "currentColor",
|
|
262
|
-
"stroke-width": "1.75",
|
|
263
|
-
"stroke-linecap": "round"
|
|
264
|
-
}
|
|
265
|
-
) })
|
|
266
|
-
}
|
|
267
|
-
) : null
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
),
|
|
271
|
-
/* @__PURE__ */ r("style", { children: `
|
|
272
|
-
@keyframes pw-fade-in { from { opacity: 0 } to { opacity: 1 } }
|
|
273
|
-
@keyframes pw-scale-in {
|
|
274
|
-
from { opacity: 0; transform: translateY(12px) scale(0.96) }
|
|
275
|
-
to { opacity: 1; transform: none }
|
|
276
|
-
}
|
|
277
|
-
` })
|
|
278
|
-
]
|
|
279
|
-
}
|
|
280
|
-
) : null;
|
|
281
|
-
}
|
|
282
|
-
const vt = {
|
|
283
|
-
google: "Continue with Google",
|
|
284
|
-
apple: "Continue with Apple",
|
|
285
|
-
github: "Continue with GitHub",
|
|
286
|
-
facebook: "Continue with Facebook"
|
|
287
|
-
};
|
|
288
|
-
function ct({ block: e, ctx: t }) {
|
|
289
|
-
const i = t.auth, n = t.authSession, a = e.allow_signup !== !1, o = e.allow_password_reset !== !1, s = e.hide_when_authenticated !== !1;
|
|
290
|
-
if (!i)
|
|
291
|
-
return typeof console < "u" && console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"), null;
|
|
292
|
-
const l = n && !n.user.is_anonymous ? n : null;
|
|
293
|
-
return l && s ? null : l ? /* @__PURE__ */ r(mt, { email: l.user.email ?? "", onSignOut: () => i.signOut().catch(() => {
|
|
294
|
-
}) }) : /* @__PURE__ */ r(
|
|
295
|
-
xt,
|
|
296
|
-
{
|
|
297
|
-
block: e,
|
|
298
|
-
allowSignup: a,
|
|
299
|
-
allowReset: o,
|
|
300
|
-
ctx: t
|
|
301
|
-
}
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
function mt({ email: e, onSignOut: t }) {
|
|
305
|
-
return /* @__PURE__ */ d("div", { class: "flex items-center justify-between gap-3 rounded-2xl border border-gray-200 bg-gray-50/60 px-4 py-3", children: [
|
|
306
|
-
/* @__PURE__ */ d("div", { class: "flex flex-col", children: [
|
|
307
|
-
/* @__PURE__ */ r("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: "Signed in" }),
|
|
308
|
-
/* @__PURE__ */ r("span", { class: "text-sm font-medium text-gray-900", children: e })
|
|
309
|
-
] }),
|
|
310
|
-
/* @__PURE__ */ r(
|
|
311
|
-
"button",
|
|
312
|
-
{
|
|
313
|
-
type: "button",
|
|
314
|
-
onClick: t,
|
|
315
|
-
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)]",
|
|
316
|
-
children: "Sign out"
|
|
317
|
-
}
|
|
318
|
-
)
|
|
319
|
-
] });
|
|
320
|
-
}
|
|
321
|
-
function xt({ block: e, allowSignup: t, allowReset: i, ctx: n }) {
|
|
322
|
-
const a = n.auth, o = e.providers ?? [], [s, l] = v("signin"), [c, p] = v(""), [f, m] = v(""), [g, w] = v(""), [b, _] = v(null), [A, k] = v(null), [S, y] = v(null), j = async (C) => {
|
|
323
|
-
if (C.preventDefault(), !b) {
|
|
324
|
-
_("email"), k(null), y(null);
|
|
325
|
-
try {
|
|
326
|
-
s === "signin" ? await a.signInWithEmail({ email: c, password: f }) : s === "signup" ? (await a.signUp({ email: c, password: f })).kind === "confirmation_required" && (l("reset_verify"), y("Check your email for a confirmation code.")) : s === "forgot" ? (await a.requestPasswordReset({ email: c }), l("reset_sent"), y("If that email exists, a reset code has been sent.")) : s === "reset_verify" && (await a.verifyOtp({
|
|
327
|
-
email: c,
|
|
328
|
-
token: g,
|
|
329
|
-
type: f ? "recovery" : "email"
|
|
330
|
-
}), f && await a.updatePassword({ password: f }));
|
|
331
|
-
} catch (I) {
|
|
332
|
-
const h = I instanceof T ? I.message : "Something went wrong";
|
|
333
|
-
k(h);
|
|
334
|
-
} finally {
|
|
335
|
-
_(null);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}, z = async (C) => {
|
|
339
|
-
if (!b) {
|
|
340
|
-
_(C), k(null), y(null);
|
|
341
|
-
try {
|
|
342
|
-
await a.signInWithOAuth({
|
|
343
|
-
provider: C,
|
|
344
|
-
onPopupOpened: () => _(null)
|
|
345
|
-
});
|
|
346
|
-
} catch (I) {
|
|
347
|
-
if (I instanceof T) {
|
|
348
|
-
if (I.code === "oauth_cancelled" || I.code === "oauth_timeout") return;
|
|
349
|
-
k(I.message);
|
|
350
|
-
} else
|
|
351
|
-
k("Sign-in failed");
|
|
352
|
-
} finally {
|
|
353
|
-
_(null);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
return /* @__PURE__ */ d("div", { class: "flex flex-col gap-3", children: [
|
|
358
|
-
e.heading ? /* @__PURE__ */ r("h2", { class: "text-lg font-semibold tracking-tight text-gray-900", children: e.heading }) : null,
|
|
359
|
-
o.length > 0 && (s === "signin" || s === "signup") ? /* @__PURE__ */ d("div", { class: "flex flex-col gap-2", children: [
|
|
360
|
-
o.map((C) => /* @__PURE__ */ d(
|
|
361
|
-
"button",
|
|
362
|
-
{
|
|
363
|
-
type: "button",
|
|
364
|
-
onClick: () => z(C),
|
|
365
|
-
disabled: b !== null,
|
|
366
|
-
class: "flex h-11 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white px-4 text-sm font-medium text-gray-900 shadow-[0_1px_0_rgba(15,23,42,0.04)] transition-all hover:-translate-y-px hover:border-gray-300 hover:bg-gray-50 hover:shadow-sm disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:shadow-[0_1px_0_rgba(15,23,42,0.04)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
367
|
-
children: [
|
|
368
|
-
b === C ? /* @__PURE__ */ r("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" }) : /* @__PURE__ */ r(_t, { provider: C }),
|
|
369
|
-
/* @__PURE__ */ r("span", { children: vt[C] })
|
|
370
|
-
]
|
|
371
|
-
},
|
|
372
|
-
C
|
|
373
|
-
)),
|
|
374
|
-
/* @__PURE__ */ r(kt, {})
|
|
375
|
-
] }) : null,
|
|
376
|
-
/* @__PURE__ */ d("form", { onSubmit: j, class: "flex flex-col gap-2", children: [
|
|
377
|
-
(s === "signin" || s === "signup" || s === "forgot") && /* @__PURE__ */ r(
|
|
378
|
-
O,
|
|
379
|
-
{
|
|
380
|
-
type: "email",
|
|
381
|
-
label: "Email",
|
|
382
|
-
value: c,
|
|
383
|
-
onInput: p,
|
|
384
|
-
autocomplete: "email",
|
|
385
|
-
required: !0
|
|
386
|
-
}
|
|
387
|
-
),
|
|
388
|
-
(s === "signin" || s === "signup") && /* @__PURE__ */ r(
|
|
389
|
-
O,
|
|
390
|
-
{
|
|
391
|
-
type: "password",
|
|
392
|
-
label: "Password",
|
|
393
|
-
value: f,
|
|
394
|
-
onInput: m,
|
|
395
|
-
autocomplete: s === "signin" ? "current-password" : "new-password",
|
|
396
|
-
required: !0
|
|
397
|
-
}
|
|
398
|
-
),
|
|
399
|
-
s === "reset_verify" && /* @__PURE__ */ d(nt, { children: [
|
|
400
|
-
/* @__PURE__ */ r(
|
|
401
|
-
O,
|
|
402
|
-
{
|
|
403
|
-
type: "text",
|
|
404
|
-
label: "Confirmation code",
|
|
405
|
-
value: g,
|
|
406
|
-
onInput: w,
|
|
407
|
-
autocomplete: "one-time-code",
|
|
408
|
-
inputMode: "numeric",
|
|
409
|
-
required: !0
|
|
410
|
-
}
|
|
411
|
-
),
|
|
412
|
-
/* @__PURE__ */ r(
|
|
413
|
-
O,
|
|
414
|
-
{
|
|
415
|
-
type: "password",
|
|
416
|
-
label: "New password (optional — only for password reset)",
|
|
417
|
-
value: f,
|
|
418
|
-
onInput: m,
|
|
419
|
-
autocomplete: "new-password"
|
|
420
|
-
}
|
|
421
|
-
)
|
|
422
|
-
] }),
|
|
423
|
-
s === "reset_sent" && S && /* @__PURE__ */ r("p", { class: "rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600", children: S }),
|
|
424
|
-
A && /* @__PURE__ */ r("p", { class: "text-xs text-red-600", children: A }),
|
|
425
|
-
S && s !== "reset_sent" && /* @__PURE__ */ r("p", { class: "text-xs text-gray-500", children: S }),
|
|
426
|
-
s !== "reset_sent" && /* @__PURE__ */ r(
|
|
427
|
-
"button",
|
|
428
|
-
{
|
|
429
|
-
type: "submit",
|
|
430
|
-
disabled: b !== null,
|
|
431
|
-
class: "flex h-11 w-full items-center justify-center rounded-xl px-4 text-sm font-semibold tracking-tight 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)]",
|
|
432
|
-
style: {
|
|
433
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
434
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
435
|
-
},
|
|
436
|
-
children: b === "email" ? /* @__PURE__ */ r("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : yt(s)
|
|
437
|
-
}
|
|
438
|
-
)
|
|
439
|
-
] }),
|
|
440
|
-
/* @__PURE__ */ d("div", { class: "flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-xs text-gray-500", children: [
|
|
441
|
-
s === "signin" && t && /* @__PURE__ */ r("button", { type: "button", onClick: () => B(l, k, y, "signup"), class: "font-medium text-gray-700 hover:underline", children: "Create account" }),
|
|
442
|
-
s === "signup" && /* @__PURE__ */ r("button", { type: "button", onClick: () => B(l, k, y, "signin"), class: "font-medium text-gray-700 hover:underline", children: "I already have an account" }),
|
|
443
|
-
s === "signin" && i && /* @__PURE__ */ r("button", { type: "button", onClick: () => B(l, k, y, "forgot"), class: "hover:underline", children: "Forgot password?" }),
|
|
444
|
-
(s === "forgot" || s === "reset_sent" || s === "reset_verify") && /* @__PURE__ */ r("button", { type: "button", onClick: () => B(l, k, y, "signin"), class: "hover:underline", children: "Back to sign in" }),
|
|
445
|
-
s === "reset_sent" && /* @__PURE__ */ r("button", { type: "button", onClick: () => B(l, k, y, "reset_verify"), class: "font-medium text-gray-700 hover:underline", children: "I have a code" })
|
|
446
|
-
] })
|
|
447
|
-
] });
|
|
448
|
-
}
|
|
449
|
-
function yt(e) {
|
|
450
|
-
switch (e) {
|
|
451
|
-
case "signin":
|
|
452
|
-
return "Sign in";
|
|
453
|
-
case "signup":
|
|
454
|
-
return "Create account";
|
|
455
|
-
case "forgot":
|
|
456
|
-
return "Send reset code";
|
|
457
|
-
case "reset_verify":
|
|
458
|
-
return "Verify";
|
|
459
|
-
default:
|
|
460
|
-
return "Continue";
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
function B(e, t, i, n) {
|
|
464
|
-
e(n), t(null), i(null);
|
|
465
|
-
}
|
|
466
|
-
function O({ type: e, label: t, value: i, onInput: n, autocomplete: a, inputMode: o, required: s }) {
|
|
467
|
-
return /* @__PURE__ */ d("label", { class: "flex flex-col gap-1.5", children: [
|
|
468
|
-
/* @__PURE__ */ r("span", { class: "text-xs font-medium text-gray-700", children: t }),
|
|
469
|
-
/* @__PURE__ */ r(
|
|
470
|
-
"input",
|
|
471
|
-
{
|
|
472
|
-
type: e,
|
|
473
|
-
value: i,
|
|
474
|
-
onInput: (l) => n(l.target.value),
|
|
475
|
-
autocomplete: a,
|
|
476
|
-
inputMode: o,
|
|
477
|
-
required: s,
|
|
478
|
-
class: "h-11 w-full rounded-xl border border-gray-200 bg-white px-3.5 text-sm text-gray-900 shadow-[0_1px_0_rgba(15,23,42,0.02)] outline-none transition-all placeholder:text-gray-400 hover:border-gray-300 focus:border-[var(--pw-accent)] focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--pw-accent)_18%,transparent)]"
|
|
479
|
-
}
|
|
480
|
-
)
|
|
481
|
-
] });
|
|
482
|
-
}
|
|
483
|
-
function kt() {
|
|
484
|
-
return /* @__PURE__ */ d("div", { class: "flex items-center gap-2 py-1 text-[10px] uppercase tracking-[0.14em] text-gray-400", children: [
|
|
485
|
-
/* @__PURE__ */ r("div", { class: "h-px flex-1 bg-gradient-to-r from-gray-200 to-transparent" }),
|
|
486
|
-
/* @__PURE__ */ r("span", { children: "or" }),
|
|
487
|
-
/* @__PURE__ */ r("div", { class: "h-px flex-1 bg-gradient-to-r from-transparent to-gray-200" })
|
|
488
|
-
] });
|
|
489
|
-
}
|
|
490
|
-
function _t({ provider: e }) {
|
|
491
|
-
return e === "google" ? /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
|
|
492
|
-
/* @__PURE__ */ r("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" }),
|
|
493
|
-
/* @__PURE__ */ r("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" }),
|
|
494
|
-
/* @__PURE__ */ r("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" }),
|
|
495
|
-
/* @__PURE__ */ r("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" })
|
|
496
|
-
] }) : e === "apple" ? /* @__PURE__ */ r("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M11.4 8.5c0-2 1.6-3 1.7-3-.9-1.3-2.4-1.5-2.9-1.5-1.2-.1-2.4.7-3 .7-.6 0-1.6-.7-2.6-.7-1.3 0-2.6.8-3.3 2C-.4 8.4.7 12.5 2.2 14.7c.7 1.1 1.6 2.3 2.7 2.3 1.1 0 1.5-.7 2.8-.7 1.3 0 1.7.7 2.8.7 1.2 0 1.9-1.1 2.6-2.2.6-.9 1-1.8 1.1-2.7-1.4-.5-2.8-1.7-2.8-3.6Zm-2-6.5C10 1.3 10.4.4 10.3 0c-.7 0-1.6.5-2.1 1.1-.5.5-1 1.4-.9 2.2.7 0 1.5-.4 2.1-1.3Z" }) }) : e === "github" ? /* @__PURE__ */ r("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ r("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__ */ r("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ r("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" }) });
|
|
497
|
-
}
|
|
498
|
-
function St({
|
|
499
|
-
block: e,
|
|
500
|
-
bootstrap: t,
|
|
501
|
-
auth: i,
|
|
502
|
-
authSession: n,
|
|
503
|
-
onBack: a,
|
|
504
|
-
showBack: o = !0
|
|
505
|
-
}) {
|
|
506
|
-
return /* @__PURE__ */ d("div", { class: "flex flex-col gap-3", children: [
|
|
507
|
-
o ? /* @__PURE__ */ r(
|
|
508
|
-
"button",
|
|
509
|
-
{
|
|
510
|
-
type: "button",
|
|
511
|
-
onClick: a,
|
|
512
|
-
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)]",
|
|
513
|
-
children: "← Back"
|
|
514
|
-
}
|
|
515
|
-
) : null,
|
|
516
|
-
/* @__PURE__ */ r(ct, { block: e, ctx: {
|
|
517
|
-
bootstrap: t,
|
|
518
|
-
selectedPriceId: null,
|
|
519
|
-
setSelectedPriceId: () => {
|
|
520
|
-
},
|
|
521
|
-
onAction: () => {
|
|
522
|
-
},
|
|
523
|
-
auth: i,
|
|
524
|
-
authSession: n
|
|
525
|
-
} })
|
|
526
|
-
] });
|
|
527
|
-
}
|
|
528
|
-
function Ct({
|
|
529
|
-
auth: e,
|
|
530
|
-
onSuccess: t,
|
|
531
|
-
onBack: i,
|
|
532
|
-
heading: n = "Continue as guest",
|
|
533
|
-
description: a = "Setting up your guest session…"
|
|
534
|
-
}) {
|
|
535
|
-
const [o, s] = v({ kind: "signing-in" }), l = E(!0);
|
|
536
|
-
M(() => () => {
|
|
537
|
-
l.current = !1;
|
|
538
|
-
}, []);
|
|
539
|
-
const c = () => {
|
|
540
|
-
s({ kind: "signing-in" }), (async () => {
|
|
541
|
-
try {
|
|
542
|
-
const p = await e.signInAnonymously();
|
|
543
|
-
if (!l.current) return;
|
|
544
|
-
t(p);
|
|
545
|
-
} catch (p) {
|
|
546
|
-
if (!l.current) return;
|
|
547
|
-
s({
|
|
548
|
-
kind: "error",
|
|
549
|
-
message: p instanceof Error ? p.message : "Anonymous sign-in failed"
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
})();
|
|
553
|
-
};
|
|
554
|
-
return M(() => {
|
|
555
|
-
c();
|
|
556
|
-
}, []), /* @__PURE__ */ d("div", { class: "flex flex-col gap-3", children: [
|
|
557
|
-
i ? /* @__PURE__ */ r(
|
|
558
|
-
"button",
|
|
559
|
-
{
|
|
560
|
-
type: "button",
|
|
561
|
-
onClick: i,
|
|
562
|
-
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)]",
|
|
563
|
-
children: "← Back"
|
|
564
|
-
}
|
|
565
|
-
) : null,
|
|
566
|
-
/* @__PURE__ */ d("div", { class: "flex flex-col gap-1", children: [
|
|
567
|
-
/* @__PURE__ */ r("h2", { class: "text-xl font-semibold text-gray-900", children: n }),
|
|
568
|
-
/* @__PURE__ */ r("p", { class: "text-sm text-gray-500", children: a })
|
|
569
|
-
] }),
|
|
570
|
-
o.kind === "signing-in" ? /* @__PURE__ */ r("div", { class: "flex items-center justify-center py-6", children: /* @__PURE__ */ r(It, {}) }) : null,
|
|
571
|
-
o.kind === "error" ? /* @__PURE__ */ d("div", { class: "flex flex-col gap-3", children: [
|
|
572
|
-
/* @__PURE__ */ r("div", { class: "rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700", children: o.message }),
|
|
573
|
-
/* @__PURE__ */ r(
|
|
574
|
-
"button",
|
|
575
|
-
{
|
|
576
|
-
type: "button",
|
|
577
|
-
onClick: c,
|
|
578
|
-
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",
|
|
579
|
-
children: "Try again"
|
|
580
|
-
}
|
|
581
|
-
)
|
|
582
|
-
] }) : null
|
|
583
|
-
] });
|
|
584
|
-
}
|
|
585
|
-
function It() {
|
|
586
|
-
return /* @__PURE__ */ d("svg", { class: "h-5 w-5 animate-spin text-[var(--pw-accent)]", viewBox: "0 0 24 24", fill: "none", children: [
|
|
587
|
-
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "3", "stroke-opacity": "0.2" }),
|
|
588
|
-
/* @__PURE__ */ r("path", { d: "M22 12a10 10 0 0 0-10-10", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round" })
|
|
589
|
-
] });
|
|
590
|
-
}
|
|
591
|
-
const N = 3, V = 200, H = 5e3, D = 5, At = 10 * 1024 * 1024, J = ["image/jpeg", "image/png", "image/webp"], Y = /.+@.+\..+/;
|
|
592
|
-
function Mt({ client: e, authSession: t, origin: i, onBack: n }) {
|
|
593
|
-
const a = t?.user.email ?? "", o = a || null, [s, l] = v(a), [c, p] = v(""), [f, m] = v(""), [g, w] = v([]), [b, _] = v(!1), [A, k] = v(null), [S, y] = v({}), j = ot(() => {
|
|
594
|
-
const h = (o ?? s).trim().toLowerCase(), u = c.trim(), x = f.trim();
|
|
595
|
-
return Y.test(h) && u.length >= N && u.length <= V && x.length >= 1 && x.length <= H;
|
|
596
|
-
}, [o, s, c, f]), z = () => {
|
|
597
|
-
const h = {}, u = (o ?? s).trim(), x = c.trim(), L = f.trim();
|
|
598
|
-
return u ? Y.test(u.toLowerCase()) || (h.email = "Invalid email") : h.email = "Required", (x.length < N || x.length > V) && (h.subject = `${N}–${V} characters`), (L.length < 1 || L.length > H) && (h.message = `1–${H} characters`), y(h), Object.keys(h).length === 0;
|
|
599
|
-
}, C = async (h) => {
|
|
600
|
-
if (h.preventDefault(), !b && z()) {
|
|
601
|
-
_(!0), y((u) => ({ ...u, submit: void 0 }));
|
|
602
|
-
try {
|
|
603
|
-
const u = (o ?? s).trim();
|
|
604
|
-
await e.createSupportTicket({
|
|
605
|
-
subject: c.trim(),
|
|
606
|
-
content: f.trim(),
|
|
607
|
-
email: u || void 0,
|
|
608
|
-
files: g.length > 0 ? g : void 0
|
|
609
|
-
}), k(u);
|
|
610
|
-
} catch (u) {
|
|
611
|
-
const x = u instanceof T && u.message || "Failed to send. Please try again.";
|
|
612
|
-
y((L) => ({ ...L, submit: x }));
|
|
613
|
-
} finally {
|
|
614
|
-
_(!1);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}, I = () => {
|
|
618
|
-
p(""), m(""), w([]), y({}), k(null);
|
|
619
|
-
};
|
|
620
|
-
return A ? /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-4 py-2 text-center", children: [
|
|
621
|
-
/* @__PURE__ */ r(
|
|
622
|
-
"div",
|
|
623
|
-
{
|
|
624
|
-
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
625
|
-
style: {
|
|
626
|
-
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",
|
|
627
|
-
color: "#fff",
|
|
628
|
-
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)"
|
|
629
|
-
},
|
|
630
|
-
"aria-hidden": "true",
|
|
631
|
-
children: /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", class: "h-7 w-7", children: /* @__PURE__ */ r(
|
|
632
|
-
"path",
|
|
633
|
-
{
|
|
634
|
-
fill: "currentColor",
|
|
635
|
-
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"
|
|
636
|
-
}
|
|
637
|
-
) })
|
|
638
|
-
}
|
|
639
|
-
),
|
|
640
|
-
/* @__PURE__ */ r("div", { class: "text-lg font-semibold tracking-tight text-gray-900", children: "Request submitted" }),
|
|
641
|
-
/* @__PURE__ */ d("div", { class: "max-w-[320px] text-sm leading-relaxed text-gray-500", children: [
|
|
642
|
-
"We've received your message and will respond to",
|
|
643
|
-
" ",
|
|
644
|
-
/* @__PURE__ */ r("b", { class: "text-gray-700", children: A }),
|
|
645
|
-
"."
|
|
646
|
-
] }),
|
|
647
|
-
/* @__PURE__ */ d("div", { class: "mt-2 flex items-center justify-center gap-3", children: [
|
|
648
|
-
/* @__PURE__ */ r(
|
|
649
|
-
"button",
|
|
650
|
-
{
|
|
651
|
-
type: "button",
|
|
652
|
-
onClick: n,
|
|
653
|
-
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)]",
|
|
654
|
-
children: i === "standalone" ? "Done" : "Back"
|
|
655
|
-
}
|
|
656
|
-
),
|
|
657
|
-
/* @__PURE__ */ r(
|
|
658
|
-
"button",
|
|
659
|
-
{
|
|
660
|
-
type: "button",
|
|
661
|
-
onClick: I,
|
|
662
|
-
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)]",
|
|
663
|
-
style: {
|
|
664
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
665
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
666
|
-
},
|
|
667
|
-
children: "Send another request"
|
|
668
|
-
}
|
|
669
|
-
)
|
|
670
|
-
] })
|
|
671
|
-
] }) : /* @__PURE__ */ d("div", { class: "flex flex-col gap-3", children: [
|
|
672
|
-
/* @__PURE__ */ r("div", { class: "flex items-center justify-between", children: /* @__PURE__ */ d(
|
|
673
|
-
"button",
|
|
674
|
-
{
|
|
675
|
-
type: "button",
|
|
676
|
-
onClick: n,
|
|
677
|
-
class: "-ml-1 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)]",
|
|
678
|
-
children: [
|
|
679
|
-
"← ",
|
|
680
|
-
i === "standalone" ? "Close" : "Back"
|
|
681
|
-
]
|
|
682
|
-
}
|
|
683
|
-
) }),
|
|
684
|
-
/* @__PURE__ */ r("h2", { class: "text-lg font-semibold tracking-tight text-gray-900", children: "Contact Support" }),
|
|
685
|
-
/* @__PURE__ */ r("p", { class: "text-xs leading-relaxed text-gray-500", children: "Fill out the form below and we'll get back to you." }),
|
|
686
|
-
/* @__PURE__ */ d("form", { onSubmit: C, class: "flex flex-col gap-3", children: [
|
|
687
|
-
o ? /* @__PURE__ */ d("div", { class: "rounded-xl border border-gray-200 bg-gray-50/60 px-3 py-2 text-xs text-gray-500", children: [
|
|
688
|
-
"Sending as ",
|
|
689
|
-
/* @__PURE__ */ r("b", { class: "font-medium text-gray-700", children: o })
|
|
690
|
-
] }) : /* @__PURE__ */ r(
|
|
691
|
-
Q,
|
|
692
|
-
{
|
|
693
|
-
type: "email",
|
|
694
|
-
label: "Your email",
|
|
695
|
-
value: s,
|
|
696
|
-
onInput: l,
|
|
697
|
-
error: S.email,
|
|
698
|
-
autocomplete: "email",
|
|
699
|
-
required: !0
|
|
700
|
-
}
|
|
701
|
-
),
|
|
702
|
-
/* @__PURE__ */ r(
|
|
703
|
-
Q,
|
|
704
|
-
{
|
|
705
|
-
type: "text",
|
|
706
|
-
label: "Subject",
|
|
707
|
-
value: c,
|
|
708
|
-
onInput: p,
|
|
709
|
-
error: S.subject,
|
|
710
|
-
required: !0
|
|
711
|
-
}
|
|
712
|
-
),
|
|
713
|
-
/* @__PURE__ */ r(
|
|
714
|
-
Tt,
|
|
715
|
-
{
|
|
716
|
-
label: "Message",
|
|
717
|
-
value: f,
|
|
718
|
-
onInput: m,
|
|
719
|
-
error: S.message,
|
|
720
|
-
required: !0
|
|
721
|
-
}
|
|
722
|
-
),
|
|
723
|
-
/* @__PURE__ */ r(Et, { files: g, onChange: w, disabled: b }),
|
|
724
|
-
S.submit && /* @__PURE__ */ r("p", { class: "text-xs text-red-600", children: S.submit }),
|
|
725
|
-
/* @__PURE__ */ d("div", { class: "mt-1 flex items-center justify-end gap-2", children: [
|
|
726
|
-
/* @__PURE__ */ r(
|
|
727
|
-
"button",
|
|
728
|
-
{
|
|
729
|
-
type: "button",
|
|
730
|
-
onClick: n,
|
|
731
|
-
disabled: b,
|
|
732
|
-
class: "rounded-xl px-3 py-2 text-sm font-medium text-gray-600 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)]",
|
|
733
|
-
children: i === "standalone" ? "Close" : "Back"
|
|
734
|
-
}
|
|
735
|
-
),
|
|
736
|
-
/* @__PURE__ */ r(
|
|
737
|
-
"button",
|
|
738
|
-
{
|
|
739
|
-
type: "submit",
|
|
740
|
-
disabled: !j || b,
|
|
741
|
-
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 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)]",
|
|
742
|
-
style: {
|
|
743
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
744
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
745
|
-
},
|
|
746
|
-
children: b ? /* @__PURE__ */ r("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : "Send"
|
|
747
|
-
}
|
|
748
|
-
)
|
|
749
|
-
] })
|
|
750
|
-
] })
|
|
751
|
-
] });
|
|
752
|
-
}
|
|
753
|
-
function Q({ type: e, label: t, value: i, onInput: n, error: a, autocomplete: o, required: s }) {
|
|
754
|
-
return /* @__PURE__ */ d("label", { class: "flex flex-col gap-1.5", children: [
|
|
755
|
-
/* @__PURE__ */ r("span", { class: "text-xs font-medium text-gray-700", children: t }),
|
|
756
|
-
/* @__PURE__ */ r(
|
|
757
|
-
"input",
|
|
758
|
-
{
|
|
759
|
-
type: e,
|
|
760
|
-
value: i,
|
|
761
|
-
onInput: (l) => n(l.target.value),
|
|
762
|
-
autocomplete: o,
|
|
763
|
-
required: s,
|
|
764
|
-
class: `h-11 w-full rounded-xl border bg-white px-3.5 text-sm text-gray-900 shadow-[0_1px_0_rgba(15,23,42,0.02)] outline-none transition-all placeholder:text-gray-400 ${a ? "border-red-400 focus:border-red-500 focus:shadow-[0_0_0_3px_rgba(239,68,68,0.18)]" : "border-gray-200 hover:border-gray-300 focus:border-[var(--pw-accent)] focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--pw-accent)_18%,transparent)]"}`
|
|
765
|
-
}
|
|
766
|
-
),
|
|
767
|
-
a && /* @__PURE__ */ r("span", { class: "text-xs text-red-600", children: a })
|
|
768
|
-
] });
|
|
769
|
-
}
|
|
770
|
-
function Tt({ label: e, value: t, onInput: i, error: n, required: a }) {
|
|
771
|
-
return /* @__PURE__ */ d("label", { class: "flex flex-col gap-1.5", children: [
|
|
772
|
-
/* @__PURE__ */ r("span", { class: "text-xs font-medium text-gray-700", children: e }),
|
|
773
|
-
/* @__PURE__ */ r(
|
|
774
|
-
"textarea",
|
|
775
|
-
{
|
|
776
|
-
value: t,
|
|
777
|
-
onInput: (o) => i(o.target.value),
|
|
778
|
-
required: a,
|
|
779
|
-
rows: 4,
|
|
780
|
-
class: `min-h-[104px] w-full rounded-xl border bg-white px-3.5 py-2.5 text-sm leading-relaxed text-gray-900 shadow-[0_1px_0_rgba(15,23,42,0.02)] outline-none transition-all placeholder:text-gray-400 ${n ? "border-red-400 focus:border-red-500 focus:shadow-[0_0_0_3px_rgba(239,68,68,0.18)]" : "border-gray-200 hover:border-gray-300 focus:border-[var(--pw-accent)] focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--pw-accent)_18%,transparent)]"}`
|
|
781
|
-
}
|
|
782
|
-
),
|
|
783
|
-
n && /* @__PURE__ */ r("span", { class: "text-xs text-red-600", children: n })
|
|
784
|
-
] });
|
|
785
|
-
}
|
|
786
|
-
function Et({ files: e, onChange: t, disabled: i }) {
|
|
787
|
-
const n = E(null), [a, o] = v(!1), [s, l] = v(null), c = (p) => {
|
|
788
|
-
if (!p || i) return;
|
|
789
|
-
l(null);
|
|
790
|
-
const f = Array.from(p);
|
|
791
|
-
if (e.length + f.length > D) {
|
|
792
|
-
l(`Up to ${D} files`);
|
|
793
|
-
return;
|
|
794
|
-
}
|
|
795
|
-
const m = f.filter(
|
|
796
|
-
(g) => J.includes(g.type) && g.size <= At
|
|
797
|
-
);
|
|
798
|
-
if (m.length !== f.length) {
|
|
799
|
-
l("Only JPEG/PNG/WebP, ≤ 10MB each");
|
|
800
|
-
return;
|
|
801
|
-
}
|
|
802
|
-
t([...e, ...m]);
|
|
803
|
-
};
|
|
804
|
-
return /* @__PURE__ */ d("div", { children: [
|
|
805
|
-
/* @__PURE__ */ r("span", { class: "text-xs font-medium text-gray-700", children: "Attachments (optional)" }),
|
|
806
|
-
/* @__PURE__ */ d(
|
|
807
|
-
"div",
|
|
808
|
-
{
|
|
809
|
-
role: "button",
|
|
810
|
-
tabIndex: 0,
|
|
811
|
-
"aria-label": "Attachments upload",
|
|
812
|
-
onClick: () => !i && n.current?.click(),
|
|
813
|
-
onDragOver: (p) => {
|
|
814
|
-
p.preventDefault(), i || o(!0);
|
|
815
|
-
},
|
|
816
|
-
onDragLeave: () => o(!1),
|
|
817
|
-
onDrop: (p) => {
|
|
818
|
-
p.preventDefault(), o(!1), c(p.dataTransfer?.files ?? null);
|
|
819
|
-
},
|
|
820
|
-
class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${a ? "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"} ${i ? "cursor-not-allowed opacity-60" : ""}`,
|
|
821
|
-
children: [
|
|
822
|
-
/* @__PURE__ */ r("div", { class: "text-xs text-gray-500", children: "Drop images here or click to select" }),
|
|
823
|
-
/* @__PURE__ */ d("div", { class: "mt-0.5 text-[11px] text-gray-400", children: [
|
|
824
|
-
"JPEG/PNG/WebP, up to ",
|
|
825
|
-
D,
|
|
826
|
-
" files, ≤ 10MB each"
|
|
827
|
-
] })
|
|
828
|
-
]
|
|
829
|
-
}
|
|
830
|
-
),
|
|
831
|
-
/* @__PURE__ */ r(
|
|
832
|
-
"input",
|
|
833
|
-
{
|
|
834
|
-
ref: n,
|
|
835
|
-
type: "file",
|
|
836
|
-
multiple: !0,
|
|
837
|
-
accept: J.join(","),
|
|
838
|
-
class: "hidden",
|
|
839
|
-
onChange: (p) => {
|
|
840
|
-
c(p.target.files), p.currentTarget.value = "";
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
),
|
|
844
|
-
s && /* @__PURE__ */ r("p", { class: "mt-1 text-xs text-red-600", children: s }),
|
|
845
|
-
e.length > 0 && /* @__PURE__ */ r("ul", { class: "mt-2 flex flex-col gap-1", children: e.map((p, f) => /* @__PURE__ */ d(
|
|
846
|
-
"li",
|
|
847
|
-
{
|
|
848
|
-
class: "flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",
|
|
849
|
-
children: [
|
|
850
|
-
/* @__PURE__ */ r("span", { class: "truncate text-gray-700", children: p.name }),
|
|
851
|
-
/* @__PURE__ */ r(
|
|
852
|
-
"button",
|
|
853
|
-
{
|
|
854
|
-
type: "button",
|
|
855
|
-
onClick: () => {
|
|
856
|
-
const m = [...e];
|
|
857
|
-
m.splice(f, 1), t(m);
|
|
858
|
-
},
|
|
859
|
-
disabled: i,
|
|
860
|
-
class: "text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60",
|
|
861
|
-
"aria-label": `Remove ${p.name}`,
|
|
862
|
-
children: "✕"
|
|
863
|
-
}
|
|
864
|
-
)
|
|
865
|
-
]
|
|
866
|
-
},
|
|
867
|
-
`${p.name}-${p.size}-${f}`
|
|
868
|
-
)) })
|
|
869
|
-
] });
|
|
870
|
-
}
|
|
871
|
-
function Pt({ block: e, ctx: t }) {
|
|
872
|
-
const [i, n] = v(!1), a = e.priceId ?? t.selectedPriceId, o = i || e.action === "checkout" && !a;
|
|
873
|
-
return /* @__PURE__ */ r(
|
|
874
|
-
"button",
|
|
875
|
-
{
|
|
876
|
-
type: "button",
|
|
877
|
-
disabled: o,
|
|
878
|
-
onClick: async () => {
|
|
879
|
-
if (!o) {
|
|
880
|
-
n(!0);
|
|
881
|
-
try {
|
|
882
|
-
await t.onAction(e.action, { priceId: a });
|
|
883
|
-
} finally {
|
|
884
|
-
n(!1);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
},
|
|
888
|
-
class: "relative flex h-12 w-full items-center justify-center overflow-hidden rounded-2xl px-4 text-sm font-semibold tracking-tight text-white transition-all duration-150 hover:-translate-y-px hover:brightness-105 active:translate-y-0 active:brightness-95 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)]",
|
|
889
|
-
style: {
|
|
890
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
891
|
-
boxShadow: "0 1px 0 rgba(255,255,255,0.25) inset, 0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
892
|
-
},
|
|
893
|
-
children: i ? /* @__PURE__ */ r("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : e.label
|
|
894
|
-
}
|
|
895
|
-
);
|
|
896
|
-
}
|
|
897
|
-
function jt({ ctx: e }) {
|
|
898
|
-
const t = e.authSession, i = e.auth, [n, a] = v(!1), o = () => e.onAction("support");
|
|
899
|
-
if (t && !t.user.is_anonymous) {
|
|
900
|
-
const s = async () => {
|
|
901
|
-
if (!(!i || n)) {
|
|
902
|
-
a(!0);
|
|
903
|
-
try {
|
|
904
|
-
await i.signOut();
|
|
905
|
-
} catch {
|
|
906
|
-
} finally {
|
|
907
|
-
a(!1);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
};
|
|
911
|
-
return /* @__PURE__ */ d("div", { class: "mt-2 text-center text-xs text-gray-500", children: [
|
|
912
|
-
/* @__PURE__ */ r("span", { children: "Signed in as " }),
|
|
913
|
-
/* @__PURE__ */ r("b", { class: "font-medium text-gray-700", children: t.user.email }),
|
|
914
|
-
/* @__PURE__ */ d("div", { class: "mt-1 flex items-center justify-center gap-3", children: [
|
|
915
|
-
/* @__PURE__ */ r(
|
|
916
|
-
"button",
|
|
917
|
-
{
|
|
918
|
-
type: "button",
|
|
919
|
-
onClick: s,
|
|
920
|
-
disabled: !i || n,
|
|
921
|
-
class: "font-medium text-gray-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:underline",
|
|
922
|
-
children: n ? "Signing out…" : "Sign out"
|
|
923
|
-
}
|
|
924
|
-
),
|
|
925
|
-
/* @__PURE__ */ r(et, {}),
|
|
926
|
-
/* @__PURE__ */ r(tt, { onClick: o })
|
|
927
|
-
] })
|
|
928
|
-
] });
|
|
929
|
-
}
|
|
930
|
-
return /* @__PURE__ */ d("div", { class: "mt-2 flex items-center justify-center gap-3 text-center text-xs text-gray-500", children: [
|
|
931
|
-
/* @__PURE__ */ r(
|
|
932
|
-
"button",
|
|
933
|
-
{
|
|
934
|
-
type: "button",
|
|
935
|
-
onClick: () => e.onAction("restore"),
|
|
936
|
-
class: "font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",
|
|
937
|
-
children: "Restore purchases"
|
|
938
|
-
}
|
|
939
|
-
),
|
|
940
|
-
/* @__PURE__ */ r(et, {}),
|
|
941
|
-
/* @__PURE__ */ r(tt, { onClick: o })
|
|
942
|
-
] });
|
|
943
|
-
}
|
|
944
|
-
function tt({ onClick: e }) {
|
|
945
|
-
return /* @__PURE__ */ r(
|
|
946
|
-
"button",
|
|
947
|
-
{
|
|
948
|
-
type: "button",
|
|
949
|
-
onClick: e,
|
|
950
|
-
class: "font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",
|
|
951
|
-
children: "Contact Support"
|
|
952
|
-
}
|
|
953
|
-
);
|
|
954
|
-
}
|
|
955
|
-
function et() {
|
|
956
|
-
return /* @__PURE__ */ r("span", { class: "h-1 w-1 rounded-full bg-gray-300", "aria-hidden": "true" });
|
|
957
|
-
}
|
|
958
|
-
function zt({ block: e }) {
|
|
959
|
-
return e.items.length ? /* @__PURE__ */ r("ul", { class: "flex flex-col gap-2.5", role: "list", children: e.items.map((t) => /* @__PURE__ */ d("li", { class: "flex items-start gap-3 text-sm text-gray-700", children: [
|
|
960
|
-
/* @__PURE__ */ r(
|
|
961
|
-
"span",
|
|
962
|
-
{
|
|
963
|
-
class: "mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full",
|
|
964
|
-
style: {
|
|
965
|
-
background: "color-mix(in srgb, var(--pw-accent) 12%, white)",
|
|
966
|
-
color: "var(--pw-accent)"
|
|
967
|
-
},
|
|
968
|
-
"aria-hidden": "true",
|
|
969
|
-
children: /* @__PURE__ */ r("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ r(
|
|
970
|
-
"path",
|
|
971
|
-
{
|
|
972
|
-
d: "M5 10l3 3 7-7",
|
|
973
|
-
stroke: "currentColor",
|
|
974
|
-
"stroke-width": "2.5",
|
|
975
|
-
"stroke-linecap": "round",
|
|
976
|
-
"stroke-linejoin": "round"
|
|
977
|
-
}
|
|
978
|
-
) })
|
|
979
|
-
}
|
|
980
|
-
),
|
|
981
|
-
/* @__PURE__ */ d("div", { class: "flex flex-col gap-0.5", children: [
|
|
982
|
-
/* @__PURE__ */ r("span", { class: "font-medium leading-snug text-gray-900", children: t.name }),
|
|
983
|
-
t.desc ? /* @__PURE__ */ r("span", { class: "text-xs leading-relaxed text-gray-500", children: t.desc }) : null
|
|
984
|
-
] })
|
|
985
|
-
] }, t.id)) }) : null;
|
|
986
|
-
}
|
|
987
|
-
const dt = 26, Lt = 14, Bt = 2;
|
|
988
|
-
function Ot(e, t) {
|
|
989
|
-
const i = t * Bt;
|
|
990
|
-
let n = dt;
|
|
991
|
-
for (e.style.fontSize = `${n}px`; e.scrollHeight > i && n > Lt; )
|
|
992
|
-
n -= 1, e.style.fontSize = `${n}px`;
|
|
993
|
-
}
|
|
994
|
-
function Ut({ block: e, ctx: t }) {
|
|
995
|
-
const i = e.level ?? 1, n = `h${i}`, a = i === 1 ? "text-[1.625rem] font-semibold leading-tight text-gray-900 tracking-[-0.02em]" : i === 2 ? "text-xl font-semibold leading-snug text-gray-900 tracking-tight" : "text-base font-medium text-gray-900", o = E(null), s = i === 1 && !!t.bootstrap.settings.title_auto_fit;
|
|
996
|
-
return M(() => {
|
|
997
|
-
if (!s || !o.current) return;
|
|
998
|
-
const l = getComputedStyle(o.current), c = parseFloat(l.lineHeight) || dt * 1.5;
|
|
999
|
-
Ot(o.current, c);
|
|
1000
|
-
}, [s, e.text]), /* @__PURE__ */ r(n, { ref: o, class: a, children: e.text });
|
|
1001
|
-
}
|
|
1002
|
-
function Rt(e) {
|
|
1003
|
-
const t = e.local ?? { currency: e.currency, amount: e.amount };
|
|
1004
|
-
try {
|
|
1005
|
-
return new Intl.NumberFormat(void 0, {
|
|
1006
|
-
style: "currency",
|
|
1007
|
-
currency: t.currency,
|
|
1008
|
-
maximumFractionDigits: t.amount % 1 === 0 ? 0 : 2
|
|
1009
|
-
}).format(t.amount);
|
|
1010
|
-
} catch {
|
|
1011
|
-
return `${t.amount} ${t.currency}`;
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
function rt(e) {
|
|
1015
|
-
if (!e.interval || e.interval === "lifetime") return "one-time";
|
|
1016
|
-
const t = e.interval_count ?? 1;
|
|
1017
|
-
return t === 1 ? `per ${e.interval}` : `every ${t} ${e.interval}s`;
|
|
1018
|
-
}
|
|
1019
|
-
function Ft({ block: e, ctx: t }) {
|
|
1020
|
-
const i = e.priceIds && e.priceIds.length > 0 ? new Set(e.priceIds) : null, n = t.bootstrap.prices.filter((l) => !i || i.has(l.id));
|
|
1021
|
-
if (n.length === 0)
|
|
1022
|
-
return /* @__PURE__ */ r("p", { class: "text-sm text-gray-500", children: "No prices available." });
|
|
1023
|
-
const a = e.view === "horizontal", o = e.popular_label ?? "Most popular", s = a ? Math.min(n.length, 3) : 1;
|
|
1024
|
-
return /* @__PURE__ */ r(
|
|
1025
|
-
"div",
|
|
1026
|
-
{
|
|
1027
|
-
class: a ? "grid gap-2.5" : "flex flex-col gap-2.5",
|
|
1028
|
-
style: a ? { gridTemplateColumns: `repeat(${s}, minmax(0, 1fr))` } : void 0,
|
|
1029
|
-
role: "radiogroup",
|
|
1030
|
-
"aria-label": "Plans",
|
|
1031
|
-
children: n.map((l) => {
|
|
1032
|
-
const c = t.selectedPriceId === l.id, p = e.popular_price_id === l.id;
|
|
1033
|
-
return /* @__PURE__ */ d(
|
|
1034
|
-
"button",
|
|
1035
|
-
{
|
|
1036
|
-
type: "button",
|
|
1037
|
-
role: "radio",
|
|
1038
|
-
"aria-checked": c,
|
|
1039
|
-
onClick: () => {
|
|
1040
|
-
t.setSelectedPriceId(l.id), t.onAction("price_selected", { priceId: l.id, price: l });
|
|
1041
|
-
},
|
|
1042
|
-
class: [
|
|
1043
|
-
"group relative rounded-2xl border px-4 py-3.5 text-left transition-all duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1044
|
-
a ? "flex w-full flex-col items-start gap-1" : "flex w-full items-center justify-between gap-3",
|
|
1045
|
-
c ? "border-[var(--pw-accent)] bg-[color-mix(in_srgb,var(--pw-accent)_6%,white)] shadow-[0_0_0_3px_color-mix(in_srgb,var(--pw-accent)_12%,transparent)]" : "border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm",
|
|
1046
|
-
p ? "mt-2.5" : ""
|
|
1047
|
-
].join(" "),
|
|
1048
|
-
children: [
|
|
1049
|
-
p ? /* @__PURE__ */ r(
|
|
1050
|
-
"span",
|
|
1051
|
-
{
|
|
1052
|
-
class: "absolute -top-2.5 left-4 rounded-full px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white shadow-sm",
|
|
1053
|
-
style: {
|
|
1054
|
-
background: "linear-gradient(135deg, var(--pw-accent), color-mix(in srgb, var(--pw-accent) 70%, black))"
|
|
1055
|
-
},
|
|
1056
|
-
children: o
|
|
1057
|
-
}
|
|
1058
|
-
) : null,
|
|
1059
|
-
/* @__PURE__ */ d("div", { class: a ? "flex w-full items-start gap-2.5" : "flex flex-1 items-start gap-2.5", children: [
|
|
1060
|
-
/* @__PURE__ */ r(
|
|
1061
|
-
"span",
|
|
1062
|
-
{
|
|
1063
|
-
class: [
|
|
1064
|
-
"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
1065
|
-
c ? "border-[var(--pw-accent)] bg-[var(--pw-accent)]" : "border-gray-300 bg-white group-hover:border-gray-400"
|
|
1066
|
-
].join(" "),
|
|
1067
|
-
"aria-hidden": "true",
|
|
1068
|
-
children: c ? /* @__PURE__ */ r("span", { class: "h-1.5 w-1.5 rounded-full bg-white" }) : null
|
|
1069
|
-
}
|
|
1070
|
-
),
|
|
1071
|
-
/* @__PURE__ */ d("div", { class: "flex flex-col", children: [
|
|
1072
|
-
/* @__PURE__ */ r("span", { class: "text-sm font-semibold text-gray-900", children: l.label ?? rt(l) }),
|
|
1073
|
-
l.description ? /* @__PURE__ */ r("span", { class: "text-xs leading-relaxed text-gray-500", children: l.description }) : null,
|
|
1074
|
-
l.trial_days ? /* @__PURE__ */ d("span", { class: "text-xs font-medium text-[var(--pw-accent)]", children: [
|
|
1075
|
-
l.trial_days,
|
|
1076
|
-
"-day free trial"
|
|
1077
|
-
] }) : null
|
|
1078
|
-
] })
|
|
1079
|
-
] }),
|
|
1080
|
-
/* @__PURE__ */ d("div", { class: a ? "mt-1 flex flex-col items-start" : "flex flex-col items-end", children: [
|
|
1081
|
-
/* @__PURE__ */ r("span", { class: "text-base font-semibold tracking-tight text-gray-900", children: Rt(l) }),
|
|
1082
|
-
/* @__PURE__ */ r("span", { class: "text-[11px] text-gray-500", children: rt(l) })
|
|
1083
|
-
] })
|
|
1084
|
-
]
|
|
1085
|
-
},
|
|
1086
|
-
l.id
|
|
1087
|
-
);
|
|
1088
|
-
})
|
|
1089
|
-
}
|
|
1090
|
-
);
|
|
1091
|
-
}
|
|
1092
|
-
function Nt({ block: e }) {
|
|
1093
|
-
return /* @__PURE__ */ r("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children: e.text });
|
|
1094
|
-
}
|
|
1095
|
-
const Vt = {
|
|
1096
|
-
week: 0.25,
|
|
1097
|
-
month: 1,
|
|
1098
|
-
year: 12
|
|
1099
|
-
};
|
|
1100
|
-
function Ht(e) {
|
|
1101
|
-
return e || "period";
|
|
1102
|
-
}
|
|
1103
|
-
function Dt({ block: e, ctx: t }) {
|
|
1104
|
-
if (!e.queries.length) return null;
|
|
1105
|
-
const n = t.bootstrap.prices.find((o) => o.id === t.selectedPriceId)?.interval ?? null, a = n ? Vt[n] : void 0;
|
|
1106
|
-
return /* @__PURE__ */ d("div", { class: "flex flex-col gap-2", children: [
|
|
1107
|
-
/* @__PURE__ */ d("div", { class: "text-sm font-semibold text-gray-800", children: [
|
|
1108
|
-
"Included per ",
|
|
1109
|
-
/* @__PURE__ */ r("span", { children: Ht(n) }),
|
|
1110
|
-
":"
|
|
1111
|
-
] }),
|
|
1112
|
-
/* @__PURE__ */ r("ul", { class: "flex flex-col gap-2", role: "list", children: e.queries.map((o) => {
|
|
1113
|
-
const s = Number.isFinite(o.count) ? o.count : 0, l = a !== void 0 ? Math.round(s * a) : s;
|
|
1114
|
-
return /* @__PURE__ */ d("li", { class: `flex gap-2 ${o.desc ? "" : "items-center"}`, children: [
|
|
1115
|
-
/* @__PURE__ */ r(
|
|
1116
|
-
"span",
|
|
1117
|
-
{
|
|
1118
|
-
class: `flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full ${o.desc ? "mt-0.5" : ""}`,
|
|
1119
|
-
style: {
|
|
1120
|
-
background: "color-mix(in srgb, var(--pw-accent) 12%, white)",
|
|
1121
|
-
color: "var(--pw-accent)"
|
|
1122
|
-
},
|
|
1123
|
-
"aria-hidden": "true",
|
|
1124
|
-
children: /* @__PURE__ */ r("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ r(
|
|
1125
|
-
"path",
|
|
1126
|
-
{
|
|
1127
|
-
d: "M5 10l3 3 7-7",
|
|
1128
|
-
stroke: "currentColor",
|
|
1129
|
-
"stroke-width": "2.5",
|
|
1130
|
-
"stroke-linecap": "round",
|
|
1131
|
-
"stroke-linejoin": "round"
|
|
1132
|
-
}
|
|
1133
|
-
) })
|
|
1134
|
-
}
|
|
1135
|
-
),
|
|
1136
|
-
/* @__PURE__ */ d("div", { children: [
|
|
1137
|
-
/* @__PURE__ */ r("span", { class: "font-semibold text-gray-900 text-sm", children: l }),
|
|
1138
|
-
" ",
|
|
1139
|
-
/* @__PURE__ */ r("span", { class: "text-sm text-gray-800", children: o.name }),
|
|
1140
|
-
o.desc ? /* @__PURE__ */ d(nt, { children: [
|
|
1141
|
-
/* @__PURE__ */ r("br", {}),
|
|
1142
|
-
/* @__PURE__ */ r("span", { class: "text-xs text-gray-500", children: o.desc })
|
|
1143
|
-
] }) : null
|
|
1144
|
-
] })
|
|
1145
|
-
] }, o.id);
|
|
1146
|
-
}) })
|
|
1147
|
-
] });
|
|
1148
|
-
}
|
|
1149
|
-
const $t = {
|
|
1150
|
-
heading: Ut,
|
|
1151
|
-
text: Nt,
|
|
1152
|
-
price_grid: Ft,
|
|
1153
|
-
cta_button: Pt,
|
|
1154
|
-
auth_panel: ct,
|
|
1155
|
-
current_session: jt,
|
|
1156
|
-
features_list: zt,
|
|
1157
|
-
tokenization_gate: Dt
|
|
1158
|
-
};
|
|
1159
|
-
function Gt({ layout: e, bootstrap: t, onAction: i, auth: n, authSession: a }) {
|
|
1160
|
-
const o = ot(() => t.prices[0]?.id ?? null, [t.prices]), [s, l] = v(o), c = {
|
|
1161
|
-
bootstrap: t,
|
|
1162
|
-
selectedPriceId: s,
|
|
1163
|
-
setSelectedPriceId: l,
|
|
1164
|
-
onAction: i,
|
|
1165
|
-
auth: n,
|
|
1166
|
-
authSession: a
|
|
1167
|
-
};
|
|
1168
|
-
return /* @__PURE__ */ r("div", { class: "flex flex-col gap-4", children: e.blocks.map((p, f) => {
|
|
1169
|
-
const m = $t[p.type];
|
|
1170
|
-
return m ? /* @__PURE__ */ r(m, { block: p, ctx: c }, f) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${p.type}`), null);
|
|
1171
|
-
}) });
|
|
1172
|
-
}
|
|
1173
|
-
function qt(e, t, i, n) {
|
|
1174
|
-
return e ? n ? { 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 } : i.kind === "support" ? { open: !0, view: "support", error: null } : i.kind === "auth_gate" ? { open: !0, view: "auth", error: null } : i.kind === "anon_gate" ? { open: !0, view: "anon", error: null } : i.kind === "awaiting_payment" ? { open: !0, view: "awaiting_payment", error: null } : i.kind === "popup_blocked" ? { open: !0, view: "popup_blocked", error: null } : i.kind === "purchase_success" ? { open: !0, view: "purchased", error: null } : i.kind === "verifying" ? { open: !0, view: "loading", error: null } : { open: !0, view: "layout", error: null } : { open: !1, view: null, error: null };
|
|
1175
|
-
}
|
|
1176
|
-
function Wt(e, t) {
|
|
1177
|
-
return e.open === t.open && e.view === t.view && e.error === t.error;
|
|
1178
|
-
}
|
|
1179
|
-
function Zt({
|
|
1180
|
-
client: e,
|
|
1181
|
-
open: t,
|
|
1182
|
-
onClose: i,
|
|
1183
|
-
onEvent: n,
|
|
1184
|
-
initialView: a,
|
|
1185
|
-
purchased: o,
|
|
1186
|
-
renew: s,
|
|
1187
|
-
onState: l
|
|
1188
|
-
}) {
|
|
1189
|
-
const [c, p] = v({ status: "idle" }), [f, m] = v(
|
|
1190
|
-
() => e.auth?.getCachedSession() ?? null
|
|
1191
|
-
), [g, w] = v(() => a === "support" ? { kind: "support", origin: "standalone" } : a === "auth" ? { kind: "auth_gate", origin: "standalone" } : a === "anon" ? { kind: "anon_gate", origin: "standalone" } : { kind: "layout" }), b = E(!1), _ = E(null);
|
|
1192
|
-
M(() => {
|
|
1193
|
-
if (!l) return;
|
|
1194
|
-
const h = qt(t, c, g, o), u = _.current;
|
|
1195
|
-
u && Wt(u, h) || (_.current = h, l(h));
|
|
1196
|
-
}, [t, c, g, o, l]), M(() => {
|
|
1197
|
-
if (e.auth)
|
|
1198
|
-
return e.auth.onAuthChange((h) => m(h));
|
|
1199
|
-
}, [e.auth]), M(() => {
|
|
1200
|
-
if (typeof e.onBootstrapChange == "function")
|
|
1201
|
-
return e.onBootstrapChange((h) => {
|
|
1202
|
-
p(
|
|
1203
|
-
(u) => u.status === "ready" ? { status: "ready", data: h } : u
|
|
1204
|
-
);
|
|
1205
|
-
});
|
|
1206
|
-
}, [e]), M(() => {
|
|
1207
|
-
if (!t || c.status === "ready" || c.status === "loading") return;
|
|
1208
|
-
let h = !1;
|
|
1209
|
-
return p({ status: "loading" }), e.bootstrap().then((u) => {
|
|
1210
|
-
h || (p({ status: "ready", data: u }), n("ready", u), u.user?.has_active_subscription && !s && (n("purchase_completed", {
|
|
1211
|
-
priceId: null,
|
|
1212
|
-
sessionId: null,
|
|
1213
|
-
restored: !0
|
|
1214
|
-
}), w({ kind: "purchase_success", restored: !0 })));
|
|
1215
|
-
}).catch((u) => {
|
|
1216
|
-
if (h) return;
|
|
1217
|
-
const x = u instanceof T ? u : new T("unknown", "Failed to load paywall", { cause: u });
|
|
1218
|
-
p({ status: "error", error: x }), n("error", x);
|
|
1219
|
-
}), () => {
|
|
1220
|
-
h = !0;
|
|
1221
|
-
};
|
|
1222
|
-
}, [t, e]), M(() => {
|
|
1223
|
-
if (!t) {
|
|
1224
|
-
w({ kind: "layout" }), b.current = !1;
|
|
1225
|
-
return;
|
|
1226
|
-
}
|
|
1227
|
-
a === "support" ? w({ kind: "support", origin: "standalone" }) : a === "auth" ? w({ kind: "auth_gate", origin: "standalone" }) : a === "anon" && w({ kind: "anon_gate", origin: "standalone" });
|
|
1228
|
-
}, [t, a]);
|
|
1229
|
-
const A = async (h) => {
|
|
1230
|
-
try {
|
|
1231
|
-
const u = await e.createCheckout({
|
|
1232
|
-
priceId: h,
|
|
1233
|
-
ignoreActivePurchase: s === !0
|
|
1234
|
-
});
|
|
1235
|
-
if (n("checkout_started", { priceId: h, url: u.url, acquiring: u.acquiring }), typeof window > "u" || !u.url) return;
|
|
1236
|
-
const x = window.open(u.url, "_blank");
|
|
1237
|
-
if (x) {
|
|
1238
|
-
try {
|
|
1239
|
-
x.opener = null;
|
|
1240
|
-
} catch {
|
|
1241
|
-
}
|
|
1242
|
-
w({ kind: "awaiting_payment", priceId: h, url: u.url });
|
|
1243
|
-
} else
|
|
1244
|
-
w({ kind: "popup_blocked", priceId: h, url: u.url });
|
|
1245
|
-
} catch (u) {
|
|
1246
|
-
if (u instanceof T && u.code === "already_purchased") {
|
|
1247
|
-
try {
|
|
1248
|
-
await e.getUser({ force: !0 });
|
|
1249
|
-
} catch {
|
|
1250
|
-
}
|
|
1251
|
-
n("purchase_completed", { priceId: h, sessionId: null, restored: !0 }), w({ kind: "purchase_success", restored: !0 });
|
|
1252
|
-
return;
|
|
1253
|
-
}
|
|
1254
|
-
const x = u instanceof T ? u : new T("checkout_failed", "Checkout failed", { cause: u });
|
|
1255
|
-
n("error", x), w({ kind: "layout" });
|
|
1256
|
-
}
|
|
1257
|
-
}, k = (h, u) => {
|
|
1258
|
-
if (typeof window > "u") return;
|
|
1259
|
-
const x = window.open(u, "_blank");
|
|
1260
|
-
if (x) {
|
|
1261
|
-
try {
|
|
1262
|
-
x.opener = null;
|
|
1263
|
-
} catch {
|
|
1264
|
-
}
|
|
1265
|
-
w({ kind: "awaiting_payment", priceId: h, url: u });
|
|
1266
|
-
}
|
|
1267
|
-
};
|
|
1268
|
-
M(() => {
|
|
1269
|
-
if (g.kind !== "auth_gate" || !f || f.user.is_anonymous || b.current) return;
|
|
1270
|
-
b.current = !0;
|
|
1271
|
-
const h = g.pendingCheckout, u = g.origin;
|
|
1272
|
-
w({ kind: "verifying" }), (async () => {
|
|
1273
|
-
if (!s)
|
|
1274
|
-
try {
|
|
1275
|
-
if ((await e.getUser({ force: !0 })).has_active_subscription) {
|
|
1276
|
-
n("purchase_completed", {
|
|
1277
|
-
priceId: h?.priceId ?? null,
|
|
1278
|
-
sessionId: null,
|
|
1279
|
-
restored: !0
|
|
1280
|
-
}), w({ kind: "purchase_success", restored: !0 });
|
|
1281
|
-
return;
|
|
1282
|
-
}
|
|
1283
|
-
} catch {
|
|
1284
|
-
}
|
|
1285
|
-
if (!h) {
|
|
1286
|
-
u === "standalone" ? i() : w({ kind: "layout" });
|
|
1287
|
-
return;
|
|
1288
|
-
}
|
|
1289
|
-
await A(h.priceId);
|
|
1290
|
-
})().finally(() => {
|
|
1291
|
-
b.current = !1;
|
|
1292
|
-
});
|
|
1293
|
-
}, [f, g]);
|
|
1294
|
-
const S = async (h, u) => {
|
|
1295
|
-
if (h === "close") {
|
|
1296
|
-
i();
|
|
1297
|
-
return;
|
|
1298
|
-
}
|
|
1299
|
-
if (h === "price_selected") {
|
|
1300
|
-
n("price_selected", u);
|
|
1301
|
-
return;
|
|
1302
|
-
}
|
|
1303
|
-
if (h === "restore") {
|
|
1304
|
-
if (!e.auth || e.auth.getCachedSession()) return;
|
|
1305
|
-
w({ kind: "auth_gate" });
|
|
1306
|
-
return;
|
|
1307
|
-
}
|
|
1308
|
-
if (h === "support") {
|
|
1309
|
-
w({ kind: "support", origin: "layout" });
|
|
1310
|
-
return;
|
|
1311
|
-
}
|
|
1312
|
-
if (h === "checkout" && c.status === "ready") {
|
|
1313
|
-
const x = u?.priceId;
|
|
1314
|
-
if (!x) {
|
|
1315
|
-
n("error", new T("no_price", "No price selected"));
|
|
1316
|
-
return;
|
|
1317
|
-
}
|
|
1318
|
-
if ((c.data.settings.checkout_mode ?? "guest") === "preauth" && !!e.auth && !e.auth.getCachedSession()) {
|
|
1319
|
-
w({ kind: "auth_gate", pendingCheckout: { priceId: x } });
|
|
1320
|
-
return;
|
|
1321
|
-
}
|
|
1322
|
-
await A(x);
|
|
1323
|
-
}
|
|
1324
|
-
}, y = c.status === "ready" ? c.data.settings.brand_color : null, j = c.status === "ready" ? !!c.data.settings.is_test_mode : !1, z = c.status === "ready" ? c.data.settings.allow_close !== !1 : !0, C = {
|
|
1325
|
-
type: "auth_panel",
|
|
1326
|
-
heading: "Sign in to continue",
|
|
1327
|
-
allow_signup: !0,
|
|
1328
|
-
allow_password_reset: !0,
|
|
1329
|
-
// Не скрываем при наличии сессии — auto-resume useEffect отрабатывает быстрее,
|
|
1330
|
-
// чем хотим показывать "Signed in as ..." промежуточным экраном.
|
|
1331
|
-
hide_when_authenticated: !1,
|
|
1332
|
-
providers: c.status === "ready" ? c.data.settings.auth_providers : void 0
|
|
1333
|
-
}, I = g.kind === "support" ? /* @__PURE__ */ r(
|
|
1334
|
-
Mt,
|
|
1335
|
-
{
|
|
1336
|
-
client: e,
|
|
1337
|
-
authSession: f,
|
|
1338
|
-
origin: g.origin,
|
|
1339
|
-
onBack: () => {
|
|
1340
|
-
g.origin === "standalone" ? i() : w({ kind: "layout" });
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
) : null;
|
|
1344
|
-
return /* @__PURE__ */ r(
|
|
1345
|
-
bt,
|
|
1346
|
-
{
|
|
1347
|
-
open: t,
|
|
1348
|
-
onClose: i,
|
|
1349
|
-
brandColor: y,
|
|
1350
|
-
testMode: j,
|
|
1351
|
-
allowClose: z,
|
|
1352
|
-
labelledBy: "pw-title",
|
|
1353
|
-
children: o ? /* @__PURE__ */ r(it, { onContinue: i }) : g.kind === "purchase_success" ? /* @__PURE__ */ r(it, { restored: g.restored, onContinue: i }) : I || (c.status === "loading" || c.status === "idle" || g.kind === "verifying" ? /* @__PURE__ */ d("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
|
|
1354
|
-
/* @__PURE__ */ r("span", { class: "inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" }),
|
|
1355
|
-
/* @__PURE__ */ r("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: g.kind === "verifying" ? "Checking your subscription…" : "Loading…" })
|
|
1356
|
-
] }) : c.status === "error" ? /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
1357
|
-
/* @__PURE__ */ r("div", { class: "flex h-11 w-11 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ d("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1358
|
-
/* @__PURE__ */ r(
|
|
1359
|
-
"path",
|
|
1360
|
-
{
|
|
1361
|
-
d: "M10 6v5M10 14h.01",
|
|
1362
|
-
stroke: "#dc2626",
|
|
1363
|
-
"stroke-width": "2",
|
|
1364
|
-
"stroke-linecap": "round"
|
|
1365
|
-
}
|
|
1366
|
-
),
|
|
1367
|
-
/* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
|
|
1368
|
-
] }) }),
|
|
1369
|
-
/* @__PURE__ */ r("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Something went wrong" }),
|
|
1370
|
-
/* @__PURE__ */ r("p", { class: "text-xs leading-relaxed text-gray-500", children: c.error.message })
|
|
1371
|
-
] }) : g.kind === "auth_gate" && e.auth ? /* @__PURE__ */ r(
|
|
1372
|
-
St,
|
|
1373
|
-
{
|
|
1374
|
-
block: C,
|
|
1375
|
-
bootstrap: c.data,
|
|
1376
|
-
auth: e.auth,
|
|
1377
|
-
authSession: f,
|
|
1378
|
-
showBack: g.origin !== "standalone",
|
|
1379
|
-
onBack: () => {
|
|
1380
|
-
g.origin === "standalone" ? i() : w({ kind: "layout" });
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
) : g.kind === "anon_gate" && e.auth ? /* @__PURE__ */ r(
|
|
1384
|
-
Ct,
|
|
1385
|
-
{
|
|
1386
|
-
auth: e.auth,
|
|
1387
|
-
onSuccess: () => {
|
|
1388
|
-
g.origin === "standalone" ? i() : w({ kind: "layout" });
|
|
1389
|
-
},
|
|
1390
|
-
onBack: g.origin === "standalone" ? void 0 : () => w({ kind: "layout" })
|
|
1391
|
-
}
|
|
1392
|
-
) : g.kind === "awaiting_payment" ? /* @__PURE__ */ r(
|
|
1393
|
-
Xt,
|
|
1394
|
-
{
|
|
1395
|
-
client: e,
|
|
1396
|
-
onBack: () => w({ kind: "layout" }),
|
|
1397
|
-
onReopen: () => {
|
|
1398
|
-
if (typeof window > "u") return;
|
|
1399
|
-
const h = window.open(g.url, "_blank");
|
|
1400
|
-
if (h)
|
|
1401
|
-
try {
|
|
1402
|
-
h.opener = null;
|
|
1403
|
-
} catch {
|
|
1404
|
-
}
|
|
1405
|
-
},
|
|
1406
|
-
onRetry: () => A(g.priceId)
|
|
1407
|
-
}
|
|
1408
|
-
) : g.kind === "popup_blocked" ? /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
1409
|
-
/* @__PURE__ */ r(
|
|
1410
|
-
"div",
|
|
1411
|
-
{
|
|
1412
|
-
class: "flex h-11 w-11 items-center justify-center rounded-full",
|
|
1413
|
-
style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
|
|
1414
|
-
"aria-hidden": "true",
|
|
1415
|
-
children: /* @__PURE__ */ d("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
1416
|
-
/* @__PURE__ */ r(
|
|
1417
|
-
"path",
|
|
1418
|
-
{
|
|
1419
|
-
d: "M4 5h12v10H4z",
|
|
1420
|
-
stroke: "currentColor",
|
|
1421
|
-
"stroke-width": "1.75",
|
|
1422
|
-
"stroke-linejoin": "round"
|
|
1423
|
-
}
|
|
1424
|
-
),
|
|
1425
|
-
/* @__PURE__ */ r("path", { d: "M7 9l3 3 4-5", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" })
|
|
1426
|
-
] })
|
|
1427
|
-
}
|
|
1428
|
-
),
|
|
1429
|
-
/* @__PURE__ */ r("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Allow popups to continue" }),
|
|
1430
|
-
/* @__PURE__ */ r("p", { class: "max-w-[18rem] text-xs leading-relaxed text-gray-500", children: "Your browser blocked the checkout tab. Click below to open it." }),
|
|
1431
|
-
/* @__PURE__ */ r(
|
|
1432
|
-
"button",
|
|
1433
|
-
{
|
|
1434
|
-
type: "button",
|
|
1435
|
-
onClick: () => k(g.priceId, g.url),
|
|
1436
|
-
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)]",
|
|
1437
|
-
style: {
|
|
1438
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
1439
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
1440
|
-
},
|
|
1441
|
-
children: "Open checkout"
|
|
1442
|
-
}
|
|
1443
|
-
)
|
|
1444
|
-
] }) : /* @__PURE__ */ r(
|
|
1445
|
-
Gt,
|
|
1446
|
-
{
|
|
1447
|
-
layout: c.data.layout,
|
|
1448
|
-
bootstrap: c.data,
|
|
1449
|
-
onAction: S,
|
|
1450
|
-
auth: e.auth,
|
|
1451
|
-
authSession: f
|
|
1452
|
-
}
|
|
1453
|
-
))
|
|
1454
|
-
}
|
|
1455
|
-
);
|
|
1456
|
-
}
|
|
1457
|
-
function Xt({
|
|
1458
|
-
client: e,
|
|
1459
|
-
onBack: t,
|
|
1460
|
-
onReopen: i,
|
|
1461
|
-
onRetry: n
|
|
1462
|
-
}) {
|
|
1463
|
-
const [a, o] = v(!1), [s, l] = v(!1), c = E(null);
|
|
1464
|
-
return M(() => () => {
|
|
1465
|
-
c.current !== null && clearTimeout(c.current);
|
|
1466
|
-
}, []), /* @__PURE__ */ d("div", { class: "flex flex-col gap-3", children: [
|
|
1467
|
-
/* @__PURE__ */ r(
|
|
1468
|
-
"button",
|
|
1469
|
-
{
|
|
1470
|
-
type: "button",
|
|
1471
|
-
onClick: t,
|
|
1472
|
-
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)]",
|
|
1473
|
-
children: "← Back"
|
|
1474
|
-
}
|
|
1475
|
-
),
|
|
1476
|
-
/* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-3 py-6 text-center", children: [
|
|
1477
|
-
/* @__PURE__ */ d("div", { class: "relative flex h-12 w-12 items-center justify-center", children: [
|
|
1478
|
-
/* @__PURE__ */ r(
|
|
1479
|
-
"span",
|
|
1480
|
-
{
|
|
1481
|
-
class: "absolute inset-0 animate-ping rounded-full opacity-40",
|
|
1482
|
-
style: { background: "color-mix(in srgb, var(--pw-accent) 30%, transparent)" },
|
|
1483
|
-
"aria-hidden": "true"
|
|
1484
|
-
}
|
|
1485
|
-
),
|
|
1486
|
-
/* @__PURE__ */ r("span", { class: "relative inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" })
|
|
1487
|
-
] }),
|
|
1488
|
-
/* @__PURE__ */ r("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Complete payment in the new tab" }),
|
|
1489
|
-
/* @__PURE__ */ r("p", { class: "max-w-[20rem] text-xs leading-relaxed text-gray-500", children: "We'll detect your payment automatically — or click below once you're done." }),
|
|
1490
|
-
/* @__PURE__ */ r(
|
|
1491
|
-
"button",
|
|
1492
|
-
{
|
|
1493
|
-
type: "button",
|
|
1494
|
-
onClick: async () => {
|
|
1495
|
-
if (!a) {
|
|
1496
|
-
o(!0), l(!1);
|
|
1497
|
-
try {
|
|
1498
|
-
if ((await e.getUser({ force: !0 })).has_active_subscription) {
|
|
1499
|
-
typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
|
|
1500
|
-
return;
|
|
1501
|
-
}
|
|
1502
|
-
l(!0), c.current !== null && clearTimeout(c.current), c.current = setTimeout(() => {
|
|
1503
|
-
l(!1), c.current = null;
|
|
1504
|
-
}, 5e3);
|
|
1505
|
-
} catch {
|
|
1506
|
-
l(!0);
|
|
1507
|
-
} finally {
|
|
1508
|
-
o(!1);
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
},
|
|
1512
|
-
disabled: a,
|
|
1513
|
-
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)]",
|
|
1514
|
-
style: {
|
|
1515
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
1516
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
1517
|
-
},
|
|
1518
|
-
children: a ? "Checking…" : "I've paid"
|
|
1519
|
-
}
|
|
1520
|
-
),
|
|
1521
|
-
s ? /* @__PURE__ */ r("p", { class: "text-xs leading-relaxed text-gray-500", children: "Payment is still being processed. Please try again in a moment." }) : null
|
|
1522
|
-
] }),
|
|
1523
|
-
/* @__PURE__ */ d("div", { class: "rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5", children: [
|
|
1524
|
-
/* @__PURE__ */ r("p", { class: "text-xs leading-relaxed text-gray-600", children: "Checkout window didn't open or got blocked? Click here to open it again." }),
|
|
1525
|
-
/* @__PURE__ */ r(
|
|
1526
|
-
"button",
|
|
1527
|
-
{
|
|
1528
|
-
type: "button",
|
|
1529
|
-
onClick: i,
|
|
1530
|
-
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)]",
|
|
1531
|
-
children: "Open checkout again"
|
|
1532
|
-
}
|
|
1533
|
-
)
|
|
1534
|
-
] }),
|
|
1535
|
-
/* @__PURE__ */ r(
|
|
1536
|
-
"button",
|
|
1537
|
-
{
|
|
1538
|
-
type: "button",
|
|
1539
|
-
onClick: n,
|
|
1540
|
-
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)]",
|
|
1541
|
-
children: "Tab closed? Try again"
|
|
1542
|
-
}
|
|
1543
|
-
)
|
|
1544
|
-
] });
|
|
1545
|
-
}
|
|
1546
|
-
function it({
|
|
1547
|
-
onContinue: e,
|
|
1548
|
-
restored: t = !1
|
|
1549
|
-
}) {
|
|
1550
|
-
return /* @__PURE__ */ d("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
1551
|
-
/* @__PURE__ */ r(
|
|
1552
|
-
"div",
|
|
1553
|
-
{
|
|
1554
|
-
class: "flex h-14 w-14 items-center justify-center rounded-full ring-8",
|
|
1555
|
-
style: {
|
|
1556
|
-
background: "linear-gradient(135deg, #4ade80, #16a34a)",
|
|
1557
|
-
color: "#fff",
|
|
1558
|
-
// emerald ring with low alpha for a halo effect
|
|
1559
|
-
boxShadow: "0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"
|
|
1560
|
-
},
|
|
1561
|
-
"aria-hidden": "true",
|
|
1562
|
-
children: /* @__PURE__ */ r("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ r(
|
|
1563
|
-
"path",
|
|
1564
|
-
{
|
|
1565
|
-
d: "M5 13l4 4L19 7",
|
|
1566
|
-
stroke: "currentColor",
|
|
1567
|
-
"stroke-width": "2.5",
|
|
1568
|
-
"stroke-linecap": "round",
|
|
1569
|
-
"stroke-linejoin": "round"
|
|
1570
|
-
}
|
|
1571
|
-
) })
|
|
1572
|
-
}
|
|
1573
|
-
),
|
|
1574
|
-
/* @__PURE__ */ r("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: t ? "Subscription restored" : "Payment received" }),
|
|
1575
|
-
/* @__PURE__ */ r("p", { class: "text-sm leading-relaxed text-gray-500", children: t ? "Welcome back — your subscription is already active." : "Your subscription is now active." }),
|
|
1576
|
-
/* @__PURE__ */ r(
|
|
1577
|
-
"button",
|
|
1578
|
-
{
|
|
1579
|
-
type: "button",
|
|
1580
|
-
onClick: e,
|
|
1581
|
-
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)]",
|
|
1582
|
-
style: {
|
|
1583
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
1584
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
1585
|
-
},
|
|
1586
|
-
children: "Continue"
|
|
1587
|
-
}
|
|
1588
|
-
)
|
|
1589
|
-
] });
|
|
1590
|
-
}
|
|
1591
|
-
const Kt = 10 * 6e4, Jt = 5e3, Yt = 3e4;
|
|
1592
|
-
class Qt {
|
|
1593
|
-
constructor(t) {
|
|
1594
|
-
this.timer = null, this.timeoutTimer = null, this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null, this.stopped = !1, this.checking = !1, this.opts = {
|
|
1595
|
-
client: t.client,
|
|
1596
|
-
onActive: t.onActive,
|
|
1597
|
-
onTimeout: t.onTimeout ?? (() => {
|
|
1598
|
-
}),
|
|
1599
|
-
timeoutMs: t.timeoutMs ?? Kt,
|
|
1600
|
-
visibleIntervalMs: t.visibleIntervalMs ?? Jt,
|
|
1601
|
-
hiddenIntervalMs: t.hiddenIntervalMs ?? Yt
|
|
1602
|
-
};
|
|
1603
|
-
}
|
|
1604
|
-
start() {
|
|
1605
|
-
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(() => {
|
|
1606
|
-
this.stopped || (this.stop(), this.opts.onTimeout());
|
|
1607
|
-
}, this.opts.timeoutMs));
|
|
1608
|
-
}
|
|
1609
|
-
stop() {
|
|
1610
|
-
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;
|
|
1611
|
-
}
|
|
1612
|
-
async check() {
|
|
1613
|
-
if (!(this.stopped || this.checking)) {
|
|
1614
|
-
this.checking = !0;
|
|
1615
|
-
try {
|
|
1616
|
-
const t = await this.opts.client.getUser({ force: !0 });
|
|
1617
|
-
if (this.stopped) return;
|
|
1618
|
-
t.has_active_subscription && (this.stop(), this.opts.onActive(t));
|
|
1619
|
-
} catch {
|
|
1620
|
-
} finally {
|
|
1621
|
-
this.checking = !1;
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
scheduleNext() {
|
|
1626
|
-
if (this.stopped) return;
|
|
1627
|
-
const i = typeof document < "u" && document.visibilityState === "visible" ? this.opts.visibleIntervalMs : this.opts.hiddenIntervalMs;
|
|
1628
|
-
this.timer = setTimeout(async () => {
|
|
1629
|
-
await this.check(), this.scheduleNext();
|
|
1630
|
-
}, i);
|
|
1631
|
-
}
|
|
1632
|
-
handleVisibilityChange() {
|
|
1633
|
-
typeof document > "u" || (document.visibilityState === "visible" && this.check(), this.timer !== null && (clearTimeout(this.timer), this.timer = null), this.scheduleNext());
|
|
1634
|
-
}
|
|
1635
|
-
handleMessage(t) {
|
|
1636
|
-
const i = t.data;
|
|
1637
|
-
!i || typeof i != "object" || i.type === "paywall_purchase" && this.check();
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
function te() {
|
|
1641
|
-
return !(typeof document > "u" || typeof window > "u" || typeof location < "u" && location.protocol === "chrome-extension:");
|
|
1642
|
-
}
|
|
1643
|
-
const $ = { open: !1, view: null, error: null }, P = {
|
|
1644
|
-
status: "paywall_status",
|
|
1645
|
-
priceId: "paywall_price_id",
|
|
1646
|
-
sessionId: "paywall_session_id"
|
|
1647
|
-
};
|
|
1648
|
-
class he {
|
|
1649
|
-
constructor(t) {
|
|
1650
|
-
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 = $, this.stateListeners = /* @__PURE__ */ new Set();
|
|
1651
|
-
const { auth: i, ownsAuth: n } = ee(t);
|
|
1652
|
-
this.auth = i, this.ownsAuth = n, this.billing = t.client ?? new ut({ ...t, auth: this.auth }), this.host = t.host, this.shadowMode = t.shadowMode ?? "closed", this.mountThenLoad = t.mountThenLoad ?? !0, this.userUnsub = this.billing.onUserChange((a) => {
|
|
1653
|
-
this.emit("userChange", a);
|
|
1654
|
-
}), this.auth && (this.authUnsub = this.auth.onAuthChange((a) => {
|
|
1655
|
-
this.emit("authChange", a);
|
|
1656
|
-
})), this.initTracker(t.analytics), t.autoDetectReturn !== !1 && typeof window < "u" && queueMicrotask(() => this.checkReturn());
|
|
1657
|
-
}
|
|
1658
|
-
initTracker(t) {
|
|
1659
|
-
if (t === !1) return;
|
|
1660
|
-
const i = typeof t == "object" && t !== null ? t : {};
|
|
1661
|
-
if (i.enabled === !1) return;
|
|
1662
|
-
const n = i.endpoint ?? `${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;
|
|
1663
|
-
this.tracker = new ht({
|
|
1664
|
-
endpoint: n,
|
|
1665
|
-
paywallId: this.billing.paywallId,
|
|
1666
|
-
capabilities: this.billing.capabilities,
|
|
1667
|
-
getVisitorId: () => this.billing.getVisitorId(),
|
|
1668
|
-
getCachedVisitorId: () => this.billing.getCachedVisitorId(),
|
|
1669
|
-
getUserId: () => this.billing.getIdentity()?.userId ?? null,
|
|
1670
|
-
flushIntervalMs: i.flushIntervalMs,
|
|
1671
|
-
maxBufferSize: i.maxBufferSize,
|
|
1672
|
-
fetch: i.fetch,
|
|
1673
|
-
sendBeacon: i.sendBeacon
|
|
1674
|
-
}), this.on("open", () => this.tracker?.track("paywall_opened")), this.on(
|
|
1675
|
-
"ready",
|
|
1676
|
-
(a) => this.tracker?.track("paywall_viewed", {
|
|
1677
|
-
is_test_mode: a.settings.is_test_mode,
|
|
1678
|
-
prices_count: a.prices.length,
|
|
1679
|
-
offers_count: a.offers.length
|
|
1680
|
-
})
|
|
1681
|
-
), this.on(
|
|
1682
|
-
"price_selected",
|
|
1683
|
-
(a) => this.tracker?.track("price_selected", { price_id: a.priceId })
|
|
1684
|
-
), this.on(
|
|
1685
|
-
"checkout_started",
|
|
1686
|
-
(a) => this.tracker?.track("checkout_started", {
|
|
1687
|
-
price_id: a.priceId,
|
|
1688
|
-
acquiring: a.acquiring
|
|
1689
|
-
})
|
|
1690
|
-
), this.on(
|
|
1691
|
-
"purchase_completed",
|
|
1692
|
-
(a) => this.tracker?.track("purchase_completed", {
|
|
1693
|
-
price_id: a.priceId,
|
|
1694
|
-
session_id: a.sessionId
|
|
1695
|
-
})
|
|
1696
|
-
), this.on(
|
|
1697
|
-
"purchase_failed",
|
|
1698
|
-
(a) => this.tracker?.track("purchase_failed", { reason: a.reason })
|
|
1699
|
-
), this.on("close", () => this.tracker?.track("paywall_closed")), this.on(
|
|
1700
|
-
"trial_blocked",
|
|
1701
|
-
(a) => this.tracker?.track("trial_blocked", {
|
|
1702
|
-
mode: a.mode,
|
|
1703
|
-
...a.mode === "time" ? { remaining_ms: a.remainingMs, total_ms: a.totalMs } : a.mode === "opens" ? { remaining_actions: a.remainingActions, total_actions: a.totalActions } : {}
|
|
1704
|
-
})
|
|
1705
|
-
), this.on("trial_expired", () => this.tracker?.track("trial_expired")), this.on(
|
|
1706
|
-
"visibility_blocked",
|
|
1707
|
-
(a) => this.tracker?.track("visibility_blocked", {
|
|
1708
|
-
reason: a.reason,
|
|
1709
|
-
country: a.country,
|
|
1710
|
-
tier: a.tier
|
|
1711
|
-
})
|
|
1712
|
-
), this.on(
|
|
1713
|
-
"error",
|
|
1714
|
-
(a) => this.tracker?.track("error", { code: a.code, message: a.message })
|
|
1715
|
-
);
|
|
1716
|
-
}
|
|
1717
|
-
/**
|
|
1718
|
-
* Отправить произвольное аналитическое событие. Имена из системного whitelist'а
|
|
1719
|
-
* (`app_opened`, `paywall_viewed`, ...) разрешены как есть. Кастомные —
|
|
1720
|
-
* с префиксом `host:` (например `host:user_clicked_upgrade`). Сервер
|
|
1721
|
-
* дропает события с неразрешёнными именами.
|
|
1722
|
-
*
|
|
1723
|
-
* Самый частый кейс — `track('app_opened')` от хоста сразу после загрузки
|
|
1724
|
-
* приложения, чтобы зафиксировать воронку до открытия пейвола.
|
|
1725
|
-
*/
|
|
1726
|
-
track(t, i) {
|
|
1727
|
-
this.tracker?.track(t, i);
|
|
1728
|
-
}
|
|
1729
|
-
/**
|
|
1730
|
-
* Удобный шорткат вместо `paywall.on('userChange', cb)` — самый частый
|
|
1731
|
-
* паттерн в host-коде, поэтому отдельный named метод. Колбек получает
|
|
1732
|
-
* last-known user из кеша синхронно через microtask, если он есть.
|
|
1733
|
-
*/
|
|
1734
|
-
onUserChange(t) {
|
|
1735
|
-
return this.on("userChange", t);
|
|
1736
|
-
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Заменить cachedBootstrap живыми данными — для preview-режима в редакторе
|
|
1739
|
-
* админки. Если модалка открыта, PaywallRoot подписан на onBootstrapChange
|
|
1740
|
-
* и перерендерится мгновенно. До open() — затравка для bootstrap()-effect'а.
|
|
1741
|
-
*
|
|
1742
|
-
* См. {@link BillingClientOptions.preview} — обычно эту опцию ставят на
|
|
1743
|
-
* клиент, чтобы заодно отключить сетевой revalidate. setBootstrap технически
|
|
1744
|
-
* работает и в production-режиме, но конкуренция с revalidate'ом из сети
|
|
1745
|
-
* почти всегда нежелательна.
|
|
1746
|
-
*/
|
|
1747
|
-
setBootstrap(t) {
|
|
1748
|
-
this.billing.setBootstrap(t);
|
|
1749
|
-
}
|
|
1750
|
-
on(t, i) {
|
|
1751
|
-
let n = this.listeners.get(t);
|
|
1752
|
-
return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(t, n)), n.add(i), () => n.delete(i);
|
|
1753
|
-
}
|
|
1754
|
-
off(t, i) {
|
|
1755
|
-
this.listeners.get(t)?.delete(i);
|
|
1756
|
-
}
|
|
1757
|
-
emit(t, ...i) {
|
|
1758
|
-
const n = this.listeners.get(t);
|
|
1759
|
-
if (!n) return;
|
|
1760
|
-
const a = i[0];
|
|
1761
|
-
for (const o of n)
|
|
1762
|
-
try {
|
|
1763
|
-
o(a);
|
|
1764
|
-
} catch (s) {
|
|
1765
|
-
typeof console < "u" && console.error("[paywall] listener error", s);
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
open(t = {}) {
|
|
1769
|
-
this.openInternal("layout", t);
|
|
1770
|
-
}
|
|
1771
|
-
/**
|
|
1772
|
-
* Прогревает bootstrap-кеш и balance-кеш заранее, без открытия модалки.
|
|
1773
|
-
* Полезно когда host знает, что юзер скоро откроет paywall (hover на CTA,
|
|
1774
|
-
* mount компонента) — первый `open()` рендерится мгновенно, без loading-flash.
|
|
1775
|
-
*
|
|
1776
|
-
* Не throw'ает: если сеть упала, тихо игнорирует (повторный open() сделает
|
|
1777
|
-
* fresh-bootstrap с error-state как обычно). `signal` для отмены — например,
|
|
1778
|
-
* если хост размонтирует компонент быстрее, чем bootstrap вернётся.
|
|
1779
|
-
*
|
|
1780
|
-
* Вызывать можно сколько угодно раз — последующие вызовы возвращают cached
|
|
1781
|
-
* Promise (BillingClient уже дедуплицирует).
|
|
1782
|
-
*/
|
|
1783
|
-
async preload(t = {}) {
|
|
1784
|
-
try {
|
|
1785
|
-
await this.billing.bootstrap({ signal: t.signal }), this.billing.auth && await this.billing.getBalances({ signal: t.signal });
|
|
1786
|
-
} catch {
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
/**
|
|
1790
|
-
* Открывает модалку сразу с саппорт-формой (минуя layout с тарифами).
|
|
1791
|
-
* Полезно, когда host-приложение хочет дать юзеру кнопку «Help / Support»,
|
|
1792
|
-
* не связанную с пейволом-апгрейдом. Back/Done в саппорт-форме закрывают
|
|
1793
|
-
* модалку (не возвращают к тарифам), потому что юзер пришёл сюда напрямую.
|
|
1794
|
-
*
|
|
1795
|
-
* Из обычного `paywall.open()`-flow саппорт всё равно доступен через
|
|
1796
|
-
* Contact Support-ссылку в `current_session`-блоке (там Back возвращает
|
|
1797
|
-
* к layout).
|
|
1798
|
-
*/
|
|
1799
|
-
openSupport(t = {}) {
|
|
1800
|
-
this.openInternal("support", t);
|
|
1801
|
-
}
|
|
1802
|
-
/**
|
|
1803
|
-
* Открывает модалку сразу с auth-gate (логин/регистрация), без layout с
|
|
1804
|
-
* тарифами. Сценарий: returning customer уже купил, ему просто нужно
|
|
1805
|
-
* залогиниться, чтобы SDK подцепил его purchases. После signIn модалка
|
|
1806
|
-
* закрывается; Back тоже закрывает (юзер пришёл только за логином).
|
|
1807
|
-
*
|
|
1808
|
-
* Без `auth` (managed-auth не подключён) метод — no-op: некому делать
|
|
1809
|
-
* signIn. Если юзер уже залогинен — модалка всё равно откроется и
|
|
1810
|
-
* закроется через auto-resume в auth_gate effect'е (мгновение).
|
|
1811
|
-
*
|
|
1812
|
-
* Триал не блокирует этот флоу — auth не connect'ится с trial-механикой.
|
|
1813
|
-
*/
|
|
1814
|
-
openAuth(t = {}) {
|
|
1815
|
-
this.auth && this.openInternal("auth", { ...t, skipTrial: !0 });
|
|
1816
|
-
}
|
|
1817
|
-
/**
|
|
1818
|
-
* Открывает модалку с anonymous-gate. AnonGate сразу зовёт
|
|
1819
|
-
* `auth.signInAnonymously()`:
|
|
1820
|
-
* - если в storage есть `anonRefreshToken` — silent resume через
|
|
1821
|
-
* /auth/refresh, модалка схлопывается мгновенно (юзер видит лёгкий
|
|
1822
|
-
* спиннер ~100мс);
|
|
1823
|
-
* - иначе — fresh POST /auth/anonymous/signin без captcha (защита от
|
|
1824
|
-
* abuse держится на Supabase per-real-IP rate-limit + CF Bot Fight Mode).
|
|
1825
|
-
*
|
|
1826
|
-
* После успешного signIn'а модалка закрывается; host подхватывает свежую
|
|
1827
|
-
* session через `auth.onAuthChange` или `paywall.onUserChange`. Для UX
|
|
1828
|
-
* "просто залогиниться чтобы api-gateway работал, без покупок".
|
|
1829
|
-
*
|
|
1830
|
-
* Без managed-auth (`auth` не подключён) метод — no-op. Триал и
|
|
1831
|
-
* visibility-таргетинг этот flow обходит: анон-логин не должен зависеть
|
|
1832
|
-
* от страны юзера или trial-стейджа.
|
|
1833
|
-
*/
|
|
1834
|
-
openAnonGate(t = {}) {
|
|
1835
|
-
this.auth && this.openInternal("anon", { ...t, skipTrial: !0, skipVisibility: !0 });
|
|
1836
|
-
}
|
|
1837
|
-
openInternal(t, i) {
|
|
1838
|
-
i.identity && this.billing.setIdentity(i.identity), this.purchased = !1;
|
|
1839
|
-
const n = i.skipTrial === !0 || t === "support", a = i.skipVisibility === !0 || t === "support" || t === "auth" || t === "anon", o = i.renew === !0;
|
|
1840
|
-
if (n && a) {
|
|
1841
|
-
this.mountAndShow(t, { renew: o });
|
|
1842
|
-
return;
|
|
1843
|
-
}
|
|
1844
|
-
const s = this.billing.getCachedBootstrap();
|
|
1845
|
-
if (s) {
|
|
1846
|
-
this.runOpenGates(t, s, { skipTrial: n, skipVisibility: a, renew: o });
|
|
1847
|
-
return;
|
|
1848
|
-
}
|
|
1849
|
-
if (this.mountThenLoad) {
|
|
1850
|
-
this.mountAndShow(t, { renew: o }), this.billing.bootstrap().then((l) => this.runDelayedGates(l, { skipTrial: n, skipVisibility: a })).catch(() => {
|
|
1851
|
-
});
|
|
1852
|
-
return;
|
|
1853
|
-
}
|
|
1854
|
-
this.billing.bootstrap().then((l) => this.runOpenGates(t, l, { skipTrial: n, skipVisibility: a, renew: o })).catch(() => {
|
|
1855
|
-
this.mountAndShow(t, { renew: o });
|
|
1856
|
-
});
|
|
1857
|
-
}
|
|
1858
|
-
/** Применить gates ПОСЛЕ того, как модалка уже смонтирована (mount-then-load
|
|
1859
|
-
* путь). Если gate блокирует — close() + emit. Если юзер уже сам закрыл
|
|
1860
|
-
* модалку до резолва bootstrap'а — no-op (isOpen=false). */
|
|
1861
|
-
runDelayedGates(t, i) {
|
|
1862
|
-
if (!this.isOpen) return;
|
|
1863
|
-
if (!i.skipVisibility) {
|
|
1864
|
-
const o = t.settings.visibility;
|
|
1865
|
-
if (o && (this.lastVisibility = o, !o.visible)) {
|
|
1866
|
-
this.close(), this.emit("visibility_blocked", o);
|
|
1867
|
-
return;
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
if (i.skipTrial) return;
|
|
1871
|
-
const n = t.settings.trial;
|
|
1872
|
-
if (!n) return;
|
|
1873
|
-
const a = this.ensureTrialStore(n);
|
|
1874
|
-
a.check().then(async (o) => {
|
|
1875
|
-
if (this.isOpen && (this.lastTrialStatus = o, o.mode !== "none")) {
|
|
1876
|
-
if (o.blocked) {
|
|
1877
|
-
const s = await a.recordBlock();
|
|
1878
|
-
if (this.lastTrialStatus = s, !this.isOpen) return;
|
|
1879
|
-
this.close(), this.emit("trial_blocked", s);
|
|
1880
|
-
return;
|
|
1881
|
-
}
|
|
1882
|
-
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired"));
|
|
1883
|
-
}
|
|
1884
|
-
}).catch((o) => {
|
|
1885
|
-
typeof console < "u" && console.warn("[paywall] trial check failed", o);
|
|
1886
|
-
});
|
|
1887
|
-
}
|
|
1888
|
-
// Порядок гейтов: visibility → trial. Country-mismatch ≠ trial-block, и
|
|
1889
|
-
// вести trial-стейт «осталось N показов» под юзером, который вообще не
|
|
1890
|
-
// должен увидеть пейвол по таргетингу — бессмысленно: при возврате в
|
|
1891
|
-
// правильную страну он окажется со «слипшимся» триал-счётчиком.
|
|
1892
|
-
runOpenGates(t, i, n) {
|
|
1893
|
-
if (!n.skipVisibility) {
|
|
1894
|
-
const a = i.settings.visibility;
|
|
1895
|
-
if (a && (this.lastVisibility = a, !a.visible)) {
|
|
1896
|
-
this.emit("visibility_blocked", a);
|
|
1897
|
-
return;
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
if (n.skipTrial) {
|
|
1901
|
-
this.mountAndShow(t, { renew: n.renew });
|
|
1902
|
-
return;
|
|
1903
|
-
}
|
|
1904
|
-
this.gateThroughTrial(t, i, n.renew);
|
|
1905
|
-
}
|
|
1906
|
-
gateThroughTrial(t, i, n) {
|
|
1907
|
-
const a = i.settings.trial;
|
|
1908
|
-
if (!a) {
|
|
1909
|
-
this.mountAndShow(t, { renew: n });
|
|
1910
|
-
return;
|
|
1911
|
-
}
|
|
1912
|
-
const o = this.ensureTrialStore(a);
|
|
1913
|
-
o.check().then(async (s) => {
|
|
1914
|
-
if (this.lastTrialStatus = s, s.mode === "none") {
|
|
1915
|
-
this.mountAndShow(t, { renew: n });
|
|
1916
|
-
return;
|
|
1917
|
-
}
|
|
1918
|
-
if (s.blocked) {
|
|
1919
|
-
const l = await o.recordBlock();
|
|
1920
|
-
this.lastTrialStatus = l, this.emit("trial_blocked", l);
|
|
1921
|
-
return;
|
|
1922
|
-
}
|
|
1923
|
-
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), this.mountAndShow(t, { renew: n });
|
|
1924
|
-
}).catch((s) => {
|
|
1925
|
-
typeof console < "u" && console.warn("[paywall] trial check failed", s), this.mountAndShow(t, { renew: n });
|
|
1926
|
-
});
|
|
1927
|
-
}
|
|
1928
|
-
ensureTrialStore(t) {
|
|
1929
|
-
if (this.trialStore && this.trialStoreConfig && ae(this.trialStoreConfig, t))
|
|
1930
|
-
return this.trialStore;
|
|
1931
|
-
this.trialStoreConfig = t;
|
|
1932
|
-
const i = this.billing.createTrialStore;
|
|
1933
|
-
return this.trialStore = typeof i == "function" ? i.call(this.billing, t) : gt(this.billing.getStorage(), this.billing.paywallId, t), this.trialStore;
|
|
1934
|
-
}
|
|
1935
|
-
mountAndShow(t, i = {}) {
|
|
1936
|
-
const n = i.renew === !0;
|
|
1937
|
-
if (this.handle) {
|
|
1938
|
-
this.isOpen = !0, this.handle.update({ open: !0, initialView: t, purchased: !1, renew: n }), this.emit("open");
|
|
1939
|
-
return;
|
|
1940
|
-
}
|
|
1941
|
-
this.isOpen = !0, this.handle = wt(
|
|
1942
|
-
Zt,
|
|
1943
|
-
{
|
|
1944
|
-
client: this.billing,
|
|
1945
|
-
open: !0,
|
|
1946
|
-
initialView: t,
|
|
1947
|
-
purchased: !1,
|
|
1948
|
-
renew: n,
|
|
1949
|
-
onClose: () => this.close(),
|
|
1950
|
-
onEvent: (a, o) => {
|
|
1951
|
-
this.emit(a, o), a === "checkout_started" && this.startUserWatcher();
|
|
1952
|
-
},
|
|
1953
|
-
onState: (a) => this.applyState(a)
|
|
1954
|
-
},
|
|
1955
|
-
{ host: this.host, shadowMode: this.shadowMode }
|
|
1956
|
-
), this.emit("open");
|
|
1957
|
-
}
|
|
1958
|
-
applyState(t) {
|
|
1959
|
-
if (!ie(this.currentState, t)) {
|
|
1960
|
-
this.currentState = t;
|
|
1961
|
-
for (const i of this.stateListeners)
|
|
1962
|
-
try {
|
|
1963
|
-
i(t);
|
|
1964
|
-
} catch (n) {
|
|
1965
|
-
console.warn("[paywall] onStateChange listener threw", n);
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
/**
|
|
1970
|
-
* Sync-snapshot текущего состояния модалки. Подходит для `useSyncExternalStore`
|
|
1971
|
-
* в React (`useSyncExternalStore(paywall.onStateChange, paywall.getState)`)
|
|
1972
|
-
* и для одноразовых проверок («открыт ли пейвол сейчас?»).
|
|
1973
|
-
*
|
|
1974
|
-
* Snapshot стабилен — пока state не изменился, повторный getState() вернёт
|
|
1975
|
-
* `===`-равный объект (важно для useSyncExternalStore чтобы не ре-рендерить).
|
|
1976
|
-
*/
|
|
1977
|
-
getState() {
|
|
1978
|
-
return this.currentState;
|
|
1979
|
-
}
|
|
1980
|
-
/**
|
|
1981
|
-
* Подписка на изменения state. Колбек вызывается при каждом реальном
|
|
1982
|
-
* изменении (closed → loading → ready → ...). По умолчанию initial snapshot
|
|
1983
|
-
* отдаётся через microtask после подписки; через `{immediate: 'sync'|'none'}`
|
|
1984
|
-
* можно сделать sync-доставку (для useSyncExternalStore — там она не нужна,
|
|
1985
|
-
* snapshot читается через getSnapshot отдельно) или вовсе пропустить
|
|
1986
|
-
* initial.
|
|
1987
|
-
*
|
|
1988
|
-
* Возвращает unsubscribe.
|
|
1989
|
-
*/
|
|
1990
|
-
onStateChange(t, i = {}) {
|
|
1991
|
-
this.stateListeners.add(t);
|
|
1992
|
-
const n = i.immediate ?? "microtask";
|
|
1993
|
-
if (n !== "none") {
|
|
1994
|
-
const a = this.currentState;
|
|
1995
|
-
if (n === "sync")
|
|
1996
|
-
try {
|
|
1997
|
-
t(a);
|
|
1998
|
-
} catch (o) {
|
|
1999
|
-
console.warn("[paywall] onStateChange initial sync threw", o);
|
|
2000
|
-
}
|
|
2001
|
-
else
|
|
2002
|
-
queueMicrotask(() => {
|
|
2003
|
-
this.stateListeners.has(t) && t(a);
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
return () => {
|
|
2007
|
-
this.stateListeners.delete(t);
|
|
2008
|
-
};
|
|
2009
|
-
}
|
|
2010
|
-
/** Sync-доступ к последнему известному статусу триала. null — `paywall.open()`
|
|
2011
|
-
* ещё не вызывался либо триал отключён в конфиге пейвола. Удобно для
|
|
2012
|
-
* собственного UI хоста («осталось 3 показа», «триал истечёт через 2ч»). */
|
|
2013
|
-
getTrialStatus() {
|
|
2014
|
-
return this.lastTrialStatus;
|
|
2015
|
-
}
|
|
2016
|
-
/** Sync-доступ к последнему server-computed visibility-статусу. null —
|
|
2017
|
-
* bootstrap ещё не загружен или сервер не отдаёт `settings.visibility`
|
|
2018
|
-
* (например, старая версия online без targeting-патча). Хост может
|
|
2019
|
-
* использовать для собственного fallback'а: «сервис недоступен в вашей
|
|
2020
|
-
* стране». Обновляется на каждом open(), который проходит через gate. */
|
|
2021
|
-
getVisibility() {
|
|
2022
|
-
return this.lastVisibility;
|
|
2023
|
-
}
|
|
2024
|
-
/**
|
|
2025
|
-
* Цены пейвола — шорткат над `bootstrap()`. Локали уже применены, кэш и
|
|
2026
|
-
* stale-while-revalidate идентичны `billing.bootstrap()`. Подходит для
|
|
2027
|
-
* pricing-страниц/карточек на сайте, где host хочет показать те же цены,
|
|
2028
|
-
* что и в модалке, не вытаскивая bootstrap руками.
|
|
2029
|
-
*/
|
|
2030
|
-
getPrices(t = {}) {
|
|
2031
|
-
return this.billing.getPrices(t);
|
|
2032
|
-
}
|
|
2033
|
-
/** Sync-снимок цен. null — bootstrap ещё не загружали. */
|
|
2034
|
-
getCachedPrices() {
|
|
2035
|
-
return this.billing.getCachedPrices();
|
|
2036
|
-
}
|
|
2037
|
-
/** Снимок текущего «языка юзера» — proxy над `billing.getUserLanguage()`.
|
|
2038
|
-
* Используй, чтобы синхронизировать i18n host'а с тем, что фактически
|
|
2039
|
-
* показывает пейвол. См. подробности в `BillingClient.getUserLanguage`. */
|
|
2040
|
-
getUserLanguage() {
|
|
2041
|
-
return this.billing.getUserLanguage();
|
|
2042
|
-
}
|
|
2043
|
-
/**
|
|
2044
|
-
* Решает, нужно ли блокировать фичу для текущего юзера. Без побочных эффектов
|
|
2045
|
-
* (на trial-storage `recordBlock` не вызывается, модалка не монтируется).
|
|
2046
|
-
*
|
|
2047
|
-
* Порядок проверок (первый сработавший — финальный):
|
|
2048
|
-
* 1. `has_active_subscription` — самый сильный сигнал, перебивает остальные.
|
|
2049
|
-
* Юзер с подпиской получает доступ независимо от visibility/trial.
|
|
2050
|
-
* 2. `visibility` (страна/девайс/disabled-флаг) — юзер вне monetization-scope'а
|
|
2051
|
-
* пейвола, гейтить нельзя.
|
|
2052
|
-
* 3. `trial` — пре-пейвольный бесплатный период активен.
|
|
2053
|
-
* 4. Иначе — `blocked`, host лочит фичу и зовёт `paywall.open()`.
|
|
2054
|
-
*
|
|
2055
|
-
* Bootstrap кешируется в BillingClient — `getAccess()` можно дёргать на
|
|
2056
|
-
* каждый рендер host-компонента, /bootstrap не дублируется. При упавшей сети
|
|
2057
|
-
* fallback на persistent-cached user из storage: юзер с прошлой подпиской
|
|
2058
|
-
* получает `granted` офлайн, иначе `blocked` (host покажет пейвол с
|
|
2059
|
-
* error-state, юзер сможет ретрайнуть). Side-эффект: обновляются
|
|
2060
|
-
* `lastVisibility` / `lastTrialStatus`, чтобы синхронные геттеры
|
|
2061
|
-
* `getVisibility()` / `getTrialStatus()` видели свежие данные после первого
|
|
2062
|
-
* `getAccess()`, а не только после первого `open()`.
|
|
2063
|
-
*/
|
|
2064
|
-
async getAccess(t = {}) {
|
|
2065
|
-
let i = this.billing.getCachedBootstrap();
|
|
2066
|
-
if (!i)
|
|
2067
|
-
try {
|
|
2068
|
-
i = await this.billing.bootstrap({ signal: t.signal });
|
|
2069
|
-
} catch {
|
|
2070
|
-
const s = this.billing.getCachedUser();
|
|
2071
|
-
return s?.has_active_subscription ? {
|
|
2072
|
-
access: "granted",
|
|
2073
|
-
reason: "has_subscription",
|
|
2074
|
-
visibility: null,
|
|
2075
|
-
trial: null,
|
|
2076
|
-
user: s
|
|
2077
|
-
} : {
|
|
2078
|
-
access: "blocked",
|
|
2079
|
-
reason: "no_subscription",
|
|
2080
|
-
visibility: null,
|
|
2081
|
-
trial: null,
|
|
2082
|
-
user: s
|
|
2083
|
-
};
|
|
2084
|
-
}
|
|
2085
|
-
const n = i.user ?? null;
|
|
2086
|
-
if (n?.has_active_subscription)
|
|
2087
|
-
return {
|
|
2088
|
-
access: "granted",
|
|
2089
|
-
reason: "has_subscription",
|
|
2090
|
-
visibility: i.settings.visibility ?? null,
|
|
2091
|
-
trial: null,
|
|
2092
|
-
user: n
|
|
2093
|
-
};
|
|
2094
|
-
let a = null;
|
|
2095
|
-
if (!t.skipVisibility) {
|
|
2096
|
-
const s = i.settings.visibility;
|
|
2097
|
-
if (s && (a = s, this.lastVisibility = s, !s.visible))
|
|
2098
|
-
return { access: "granted", reason: "visibility_blocked", visibility: a, trial: null, user: n };
|
|
2099
|
-
}
|
|
2100
|
-
let o = null;
|
|
2101
|
-
if (!t.skipTrial) {
|
|
2102
|
-
const s = i.settings.trial;
|
|
2103
|
-
if (s)
|
|
2104
|
-
try {
|
|
2105
|
-
if (o = await this.ensureTrialStore(s).check(), this.lastTrialStatus = o, o.blocked)
|
|
2106
|
-
return { access: "granted", reason: "trial_blocked", visibility: a, trial: o, user: n };
|
|
2107
|
-
} catch (l) {
|
|
2108
|
-
typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", l);
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
return { access: "blocked", reason: "no_subscription", visibility: a, trial: o, user: n };
|
|
2112
|
-
}
|
|
2113
|
-
/** Сбросить состояние триала в storage. Полезно для дев-режима / админ-кнопки
|
|
2114
|
-
* «прогнать сценарий заново». В проде хост обычно не дёргает. */
|
|
2115
|
-
async resetTrial() {
|
|
2116
|
-
this.trialStore && (await this.trialStore.reset(), this.lastTrialStatus = null, this.trialExpiredFired = !1);
|
|
2117
|
-
}
|
|
2118
|
-
// Запускает polling user-state до has_active_subscription=true либо до
|
|
2119
|
-
// таймаута. Идемпотентен: повторный вызов на уже работающем watcher'е —
|
|
2120
|
-
// no-op (юзер мог нажать Continue повторно после возврата).
|
|
2121
|
-
//
|
|
2122
|
-
// В extension popup runtime — no-op (popup не доживёт). Там полагаемся на
|
|
2123
|
-
// bootstrap при следующем открытии.
|
|
2124
|
-
startUserWatcher() {
|
|
2125
|
-
this.watcher || te() && (this.watcher = new Qt({
|
|
2126
|
-
client: this.billing,
|
|
2127
|
-
onActive: (t) => {
|
|
2128
|
-
this.watcher = null, this.emit("purchase_completed", { priceId: null, sessionId: null });
|
|
2129
|
-
const i = this.billing.getCachedBootstrap()?.settings.success_redirect_url;
|
|
2130
|
-
if (i && typeof window < "u")
|
|
2131
|
-
try {
|
|
2132
|
-
window.location.assign(i);
|
|
2133
|
-
return;
|
|
2134
|
-
} catch {
|
|
2135
|
-
}
|
|
2136
|
-
this.isOpen && this.handle && (this.purchased = !0, this.handle.update({ purchased: !0 }));
|
|
2137
|
-
},
|
|
2138
|
-
onTimeout: () => {
|
|
2139
|
-
this.watcher = null;
|
|
2140
|
-
}
|
|
2141
|
-
}), this.watcher.start());
|
|
2142
|
-
}
|
|
2143
|
-
close() {
|
|
2144
|
-
!this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState($), this.emit("close"));
|
|
2145
|
-
}
|
|
2146
|
-
/**
|
|
2147
|
-
* Сканирует текущий URL на маркеры возврата с checkout и эмитит
|
|
2148
|
-
* purchase_completed / purchase_failed. Маркеры удаляются из URL
|
|
2149
|
-
* через history.replaceState. Ищет и в hash, и в search (hash приоритетнее —
|
|
2150
|
-
* защита от клиентских SPA-роутеров, перехватывающих query).
|
|
2151
|
-
*/
|
|
2152
|
-
checkReturn() {
|
|
2153
|
-
if (typeof window > "u") return;
|
|
2154
|
-
const t = new URL(window.location.href), i = at(t.hash.replace(/^#/, "")), n = at(t.search.replace(/^\?/, "")), a = i ?? n;
|
|
2155
|
-
a && (a.status === "paid" ? (this.emit("purchase_completed", {
|
|
2156
|
-
priceId: a.priceId,
|
|
2157
|
-
sessionId: a.sessionId
|
|
2158
|
-
}), ne(a)) : (a.status === "failed" || a.status === "cancelled") && this.emit("purchase_failed", { reason: a.status }), oe(t));
|
|
2159
|
-
}
|
|
2160
|
-
destroy() {
|
|
2161
|
-
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 = $;
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
function ee(e) {
|
|
2165
|
-
if (!e.auth) return { auth: void 0, ownsAuth: !1 };
|
|
2166
|
-
if (e.auth instanceof G || re(e.auth))
|
|
2167
|
-
return { auth: e.auth, ownsAuth: !1 };
|
|
2168
|
-
const t = e.auth === !0 ? {} : e.auth;
|
|
2169
|
-
return {
|
|
2170
|
-
auth: new G({
|
|
2171
|
-
paywallId: e.paywallId,
|
|
2172
|
-
apiOrigin: t.apiOrigin ?? e.apiOrigin,
|
|
2173
|
-
storage: t.storage ?? e.storage,
|
|
2174
|
-
fetch: t.fetch ?? e.fetch,
|
|
2175
|
-
openPopup: t.openPopup
|
|
2176
|
-
}),
|
|
2177
|
-
ownsAuth: !0
|
|
2178
|
-
};
|
|
2179
|
-
}
|
|
2180
|
-
function re(e) {
|
|
2181
|
-
if (typeof e != "object" || e === null) return !1;
|
|
2182
|
-
const t = e;
|
|
2183
|
-
return typeof t.onAuthChange == "function" && typeof t.getCachedSession == "function" && typeof t.signOut == "function";
|
|
2184
|
-
}
|
|
2185
|
-
function ie(e, t) {
|
|
2186
|
-
return e.open === t.open && e.view === t.view && e.error === t.error;
|
|
2187
|
-
}
|
|
2188
|
-
function ae(e, t) {
|
|
2189
|
-
return e.mode === t.mode && e.payload === t.payload && e.storage === t.storage;
|
|
2190
|
-
}
|
|
2191
|
-
function at(e) {
|
|
2192
|
-
if (!e) return null;
|
|
2193
|
-
const t = new URLSearchParams(e), i = t.get(P.status);
|
|
2194
|
-
return i ? {
|
|
2195
|
-
status: i,
|
|
2196
|
-
priceId: t.get(P.priceId),
|
|
2197
|
-
sessionId: t.get(P.sessionId)
|
|
2198
|
-
} : null;
|
|
2199
|
-
}
|
|
2200
|
-
function ne(e) {
|
|
2201
|
-
if (!(typeof window > "u" || !window.opener))
|
|
2202
|
-
try {
|
|
2203
|
-
window.opener.postMessage(
|
|
2204
|
-
{
|
|
2205
|
-
type: "paywall_purchase",
|
|
2206
|
-
status: e.status,
|
|
2207
|
-
priceId: e.priceId,
|
|
2208
|
-
sessionId: e.sessionId
|
|
2209
|
-
},
|
|
2210
|
-
"*"
|
|
2211
|
-
);
|
|
2212
|
-
} catch {
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
function oe(e) {
|
|
2216
|
-
const t = (n, a) => {
|
|
2217
|
-
if (!n) return "";
|
|
2218
|
-
const o = new URLSearchParams(n.replace(/^[?#]/, ""));
|
|
2219
|
-
o.delete(P.status), o.delete(P.priceId), o.delete(P.sessionId);
|
|
2220
|
-
const s = o.toString();
|
|
2221
|
-
return s ? a + s : "";
|
|
2222
|
-
}, i = e.pathname + t(e.search, "?") + t(e.hash, "#");
|
|
2223
|
-
window.history.replaceState(null, "", i);
|
|
2224
|
-
}
|
|
2225
|
-
export {
|
|
2226
|
-
he as P,
|
|
2227
|
-
$t as b
|
|
2228
|
-
};
|
|
2229
|
-
//# sourceMappingURL=PaywallUI-CRTEPjJm.js.map
|