@monetize.software/sdk-extension 3.0.0-alpha.2 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/content.cjs +3 -3
- package/dist/content.cjs.map +1 -1
- package/dist/content.js +255 -251
- package/dist/content.js.map +1 -1
- package/package.json +1 -1
package/dist/content.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./chunks/chrome-port-MoMohiHB.js"),P=require("preact"),r=require("preact/jsx-runtime"),h=require("preact/hooks"),ne=require("./chunks/port-name-qwB109u9.js"),J='@layer theme,base,components,utilities;@layer theme{@theme default{ --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; --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-100: oklch(93.6% .032 17.717); --color-red-200: oklch(88.5% .062 18.334); --color-red-300: oklch(80.8% .114 19.571); --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-red-800: oklch(44.4% .177 26.899); --color-red-900: oklch(39.6% .141 25.723); --color-red-950: oklch(25.8% .092 26.042); --color-orange-50: oklch(98% .016 73.684); --color-orange-100: oklch(95.4% .038 75.164); --color-orange-200: oklch(90.1% .076 70.697); --color-orange-300: oklch(83.7% .128 66.29); --color-orange-400: oklch(75% .183 55.934); --color-orange-500: oklch(70.5% .213 47.604); --color-orange-600: oklch(64.6% .222 41.116); --color-orange-700: oklch(55.3% .195 38.402); --color-orange-800: oklch(47% .157 37.304); --color-orange-900: oklch(40.8% .123 38.172); --color-orange-950: oklch(26.6% .079 36.259); --color-amber-50: oklch(98.7% .022 95.277); --color-amber-100: oklch(96.2% .059 95.617); --color-amber-200: oklch(92.4% .12 95.746); --color-amber-300: oklch(87.9% .169 91.605); --color-amber-400: oklch(82.8% .189 84.429); --color-amber-500: oklch(76.9% .188 70.08); --color-amber-600: oklch(66.6% .179 58.318); --color-amber-700: oklch(55.5% .163 48.998); --color-amber-800: oklch(47.3% .137 46.201); --color-amber-900: oklch(41.4% .112 45.904); --color-amber-950: oklch(27.9% .077 45.635); --color-yellow-50: oklch(98.7% .026 102.212); --color-yellow-100: oklch(97.3% .071 103.193); --color-yellow-200: oklch(94.5% .129 101.54); --color-yellow-300: oklch(90.5% .182 98.111); --color-yellow-400: oklch(85.2% .199 91.936); --color-yellow-500: oklch(79.5% .184 86.047); --color-yellow-600: oklch(68.1% .162 75.834); --color-yellow-700: oklch(55.4% .135 66.442); --color-yellow-800: oklch(47.6% .114 61.907); --color-yellow-900: oklch(42.1% .095 57.708); --color-yellow-950: oklch(28.6% .066 53.813); --color-lime-50: oklch(98.6% .031 120.757); --color-lime-100: oklch(96.7% .067 122.328); --color-lime-200: oklch(93.8% .127 124.321); --color-lime-300: oklch(89.7% .196 126.665); --color-lime-400: oklch(84.1% .238 128.85); --color-lime-500: oklch(76.8% .233 130.85); --color-lime-600: oklch(64.8% .2 131.684); --color-lime-700: oklch(53.2% .157 131.589); --color-lime-800: oklch(45.3% .124 130.933); --color-lime-900: oklch(40.5% .101 131.063); --color-lime-950: oklch(27.4% .072 132.109); --color-green-50: oklch(98.2% .018 155.826); --color-green-100: oklch(96.2% .044 156.743); --color-green-200: oklch(92.5% .084 155.995); --color-green-300: oklch(87.1% .15 154.449); --color-green-400: oklch(79.2% .209 151.711); --color-green-500: oklch(72.3% .219 149.579); --color-green-600: oklch(62.7% .194 149.214); --color-green-700: oklch(52.7% .154 150.069); --color-green-800: oklch(44.8% .119 151.328); --color-green-900: oklch(39.3% .095 152.535); --color-green-950: oklch(26.6% .065 152.934); --color-emerald-50: oklch(97.9% .021 166.113); --color-emerald-100: oklch(95% .052 163.051); --color-emerald-200: oklch(90.5% .093 164.15); --color-emerald-300: oklch(84.5% .143 164.978); --color-emerald-400: oklch(76.5% .177 163.223); --color-emerald-500: oklch(69.6% .17 162.48); --color-emerald-600: oklch(59.6% .145 163.225); --color-emerald-700: oklch(50.8% .118 165.612); --color-emerald-800: oklch(43.2% .095 166.913); --color-emerald-900: oklch(37.8% .077 168.94); --color-emerald-950: oklch(26.2% .051 172.552); --color-teal-50: oklch(98.4% .014 180.72); --color-teal-100: oklch(95.3% .051 180.801); --color-teal-200: oklch(91% .096 180.426); --color-teal-300: oklch(85.5% .138 181.071); --color-teal-400: oklch(77.7% .152 181.912); --color-teal-500: oklch(70.4% .14 182.503); --color-teal-600: oklch(60% .118 184.704); --color-teal-700: oklch(51.1% .096 186.391); --color-teal-800: oklch(43.7% .078 188.216); --color-teal-900: oklch(38.6% .063 188.416); --color-teal-950: oklch(27.7% .046 192.524); --color-cyan-50: oklch(98.4% .019 200.873); --color-cyan-100: oklch(95.6% .045 203.388); --color-cyan-200: oklch(91.7% .08 205.041); --color-cyan-300: oklch(86.5% .127 207.078); --color-cyan-400: oklch(78.9% .154 211.53); --color-cyan-500: oklch(71.5% .143 215.221); --color-cyan-600: oklch(60.9% .126 221.723); --color-cyan-700: oklch(52% .105 223.128); --color-cyan-800: oklch(45% .085 224.283); --color-cyan-900: oklch(39.8% .07 227.392); --color-cyan-950: oklch(30.2% .056 229.695); --color-sky-50: oklch(97.7% .013 236.62); --color-sky-100: oklch(95.1% .026 236.824); --color-sky-200: oklch(90.1% .058 230.902); --color-sky-300: oklch(82.8% .111 230.318); --color-sky-400: oklch(74.6% .16 232.661); --color-sky-500: oklch(68.5% .169 237.323); --color-sky-600: oklch(58.8% .158 241.966); --color-sky-700: oklch(50% .134 242.749); --color-sky-800: oklch(44.3% .11 240.79); --color-sky-900: oklch(39.1% .09 240.876); --color-sky-950: oklch(29.3% .066 243.157); --color-blue-50: oklch(97% .014 254.604); --color-blue-100: oklch(93.2% .032 255.585); --color-blue-200: oklch(88.2% .059 254.128); --color-blue-300: oklch(80.9% .105 251.813); --color-blue-400: oklch(70.7% .165 254.624); --color-blue-500: oklch(62.3% .214 259.815); --color-blue-600: oklch(54.6% .245 262.881); --color-blue-700: oklch(48.8% .243 264.376); --color-blue-800: oklch(42.4% .199 265.638); --color-blue-900: oklch(37.9% .146 265.522); --color-blue-950: oklch(28.2% .091 267.935); --color-indigo-50: oklch(96.2% .018 272.314); --color-indigo-100: oklch(93% .034 272.788); --color-indigo-200: oklch(87% .065 274.039); --color-indigo-300: oklch(78.5% .115 274.713); --color-indigo-400: oklch(67.3% .182 276.935); --color-indigo-500: oklch(58.5% .233 277.117); --color-indigo-600: oklch(51.1% .262 276.966); --color-indigo-700: oklch(45.7% .24 277.023); --color-indigo-800: oklch(39.8% .195 277.366); --color-indigo-900: oklch(35.9% .144 278.697); --color-indigo-950: oklch(25.7% .09 281.288); --color-violet-50: oklch(96.9% .016 293.756); --color-violet-100: oklch(94.3% .029 294.588); --color-violet-200: oklch(89.4% .057 293.283); --color-violet-300: oklch(81.1% .111 293.571); --color-violet-400: oklch(70.2% .183 293.541); --color-violet-500: oklch(60.6% .25 292.717); --color-violet-600: oklch(54.1% .281 293.009); --color-violet-700: oklch(49.1% .27 292.581); --color-violet-800: oklch(43.2% .232 292.759); --color-violet-900: oklch(38% .189 293.745); --color-violet-950: oklch(28.3% .141 291.089); --color-purple-50: oklch(97.7% .014 308.299); --color-purple-100: oklch(94.6% .033 307.174); --color-purple-200: oklch(90.2% .063 306.703); --color-purple-300: oklch(82.7% .119 306.383); --color-purple-400: oklch(71.4% .203 305.504); --color-purple-500: oklch(62.7% .265 303.9); --color-purple-600: oklch(55.8% .288 302.321); --color-purple-700: oklch(49.6% .265 301.924); --color-purple-800: oklch(43.8% .218 303.724); --color-purple-900: oklch(38.1% .176 304.987); --color-purple-950: oklch(29.1% .149 302.717); --color-fuchsia-50: oklch(97.7% .017 320.058); --color-fuchsia-100: oklch(95.2% .037 318.852); --color-fuchsia-200: oklch(90.3% .076 319.62); --color-fuchsia-300: oklch(83.3% .145 321.434); --color-fuchsia-400: oklch(74% .238 322.16); --color-fuchsia-500: oklch(66.7% .295 322.15); --color-fuchsia-600: oklch(59.1% .293 322.896); --color-fuchsia-700: oklch(51.8% .253 323.949); --color-fuchsia-800: oklch(45.2% .211 324.591); --color-fuchsia-900: oklch(40.1% .17 325.612); --color-fuchsia-950: oklch(29.3% .136 325.661); --color-pink-50: oklch(97.1% .014 343.198); --color-pink-100: oklch(94.8% .028 342.258); --color-pink-200: oklch(89.9% .061 343.231); --color-pink-300: oklch(82.3% .12 346.018); --color-pink-400: oklch(71.8% .202 349.761); --color-pink-500: oklch(65.6% .241 354.308); --color-pink-600: oklch(59.2% .249 .584); --color-pink-700: oklch(52.5% .223 3.958); --color-pink-800: oklch(45.9% .187 3.815); --color-pink-900: oklch(40.8% .153 2.432); --color-pink-950: oklch(28.4% .109 3.907); --color-rose-50: oklch(96.9% .015 12.422); --color-rose-100: oklch(94.1% .03 12.58); --color-rose-200: oklch(89.2% .058 10.001); --color-rose-300: oklch(81% .117 11.638); --color-rose-400: oklch(71.2% .194 13.428); --color-rose-500: oklch(64.5% .246 16.439); --color-rose-600: oklch(58.6% .253 17.585); --color-rose-700: oklch(51.4% .222 16.935); --color-rose-800: oklch(45.5% .188 13.697); --color-rose-900: oklch(41% .159 10.272); --color-rose-950: oklch(27.1% .105 12.094); --color-slate-50: oklch(98.4% .003 247.858); --color-slate-100: oklch(96.8% .007 247.896); --color-slate-200: oklch(92.9% .013 255.508); --color-slate-300: oklch(86.9% .022 252.894); --color-slate-400: oklch(70.4% .04 256.788); --color-slate-500: oklch(55.4% .046 257.417); --color-slate-600: oklch(44.6% .043 257.281); --color-slate-700: oklch(37.2% .044 257.287); --color-slate-800: oklch(27.9% .041 260.031); --color-slate-900: oklch(20.8% .042 265.755); --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-gray-950: oklch(13% .028 261.692); --color-zinc-50: oklch(98.5% 0 0); --color-zinc-100: oklch(96.7% .001 286.375); --color-zinc-200: oklch(92% .004 286.32); --color-zinc-300: oklch(87.1% .006 286.286); --color-zinc-400: oklch(70.5% .015 286.067); --color-zinc-500: oklch(55.2% .016 285.938); --color-zinc-600: oklch(44.2% .017 285.786); --color-zinc-700: oklch(37% .013 285.805); --color-zinc-800: oklch(27.4% .006 286.033); --color-zinc-900: oklch(21% .006 285.885); --color-zinc-950: oklch(14.1% .005 285.823); --color-neutral-50: oklch(98.5% 0 0); --color-neutral-100: oklch(97% 0 0); --color-neutral-200: oklch(92.2% 0 0); --color-neutral-300: oklch(87% 0 0); --color-neutral-400: oklch(70.8% 0 0); --color-neutral-500: oklch(55.6% 0 0); --color-neutral-600: oklch(43.9% 0 0); --color-neutral-700: oklch(37.1% 0 0); --color-neutral-800: oklch(26.9% 0 0); --color-neutral-900: oklch(20.5% 0 0); --color-neutral-950: oklch(14.5% 0 0); --color-stone-50: oklch(98.5% .001 106.423); --color-stone-100: oklch(97% .001 106.424); --color-stone-200: oklch(92.3% .003 48.717); --color-stone-300: oklch(86.9% .005 56.366); --color-stone-400: oklch(70.9% .01 56.259); --color-stone-500: oklch(55.3% .013 58.071); --color-stone-600: oklch(44.4% .011 73.639); --color-stone-700: oklch(37.4% .01 67.558); --color-stone-800: oklch(26.8% .007 34.298); --color-stone-900: oklch(21.6% .006 56.043); --color-stone-950: oklch(14.7% .004 49.25); --color-mauve-50: oklch(98.5% 0 0); --color-mauve-100: oklch(96% .003 325.6); --color-mauve-200: oklch(92.2% .005 325.62); --color-mauve-300: oklch(86.5% .012 325.68); --color-mauve-400: oklch(71.1% .019 323.02); --color-mauve-500: oklch(54.2% .034 322.5); --color-mauve-600: oklch(43.5% .029 321.78); --color-mauve-700: oklch(36.4% .029 323.89); --color-mauve-800: oklch(26.3% .024 320.12); --color-mauve-900: oklch(21.2% .019 322.12); --color-mauve-950: oklch(14.5% .008 326); --color-olive-50: oklch(98.8% .003 106.5); --color-olive-100: oklch(96.6% .005 106.5); --color-olive-200: oklch(93% .007 106.5); --color-olive-300: oklch(88% .011 106.6); --color-olive-400: oklch(73.7% .021 106.9); --color-olive-500: oklch(58% .031 107.3); --color-olive-600: oklch(46.6% .025 107.3); --color-olive-700: oklch(39.4% .023 107.4); --color-olive-800: oklch(28.6% .016 107.4); --color-olive-900: oklch(22.8% .013 107.4); --color-olive-950: oklch(15.3% .006 107.1); --color-mist-50: oklch(98.7% .002 197.1); --color-mist-100: oklch(96.3% .002 197.1); --color-mist-200: oklch(92.5% .005 214.3); --color-mist-300: oklch(87.2% .007 219.6); --color-mist-400: oklch(72.3% .014 214.4); --color-mist-500: oklch(56% .021 213.5); --color-mist-600: oklch(45% .017 213.2); --color-mist-700: oklch(37.8% .015 216); --color-mist-800: oklch(27.5% .011 216.9); --color-mist-900: oklch(21.8% .008 223.9); --color-mist-950: oklch(14.8% .004 228.8); --color-taupe-50: oklch(98.6% .002 67.8); --color-taupe-100: oklch(96% .002 17.2); --color-taupe-200: oklch(92.2% .005 34.3); --color-taupe-300: oklch(86.8% .007 39.5); --color-taupe-400: oklch(71.4% .014 41.2); --color-taupe-500: oklch(54.7% .021 43.1); --color-taupe-600: oklch(43.8% .017 39.3); --color-taupe-700: oklch(36.7% .016 35.7); --color-taupe-800: oklch(26.8% .011 36.5); --color-taupe-900: oklch(21.4% .009 43.1); --color-taupe-950: oklch(14.7% .004 49.3); --color-black: #000; --color-white: #fff; --spacing: .25rem; --breakpoint-sm: 40rem; --breakpoint-md: 48rem; --breakpoint-lg: 64rem; --breakpoint-xl: 80rem; --breakpoint-2xl: 96rem; --container-3xs: 16rem; --container-2xs: 18rem; --container-xs: 20rem; --container-sm: 24rem; --container-md: 28rem; --container-lg: 32rem; --container-xl: 36rem; --container-2xl: 42rem; --container-3xl: 48rem; --container-4xl: 56rem; --container-5xl: 64rem; --container-6xl: 72rem; --container-7xl: 80rem; --text-xs: .75rem; --text-xs--line-height: calc(1 / .75); --text-sm: .875rem; --text-sm--line-height: calc(1.25 / .875); --text-base: 1rem; --text-base--line-height: 1.5 ; --text-lg: 1.125rem; --text-lg--line-height: calc(1.75 / 1.125); --text-xl: 1.25rem; --text-xl--line-height: calc(1.75 / 1.25); --text-2xl: 1.5rem; --text-2xl--line-height: calc(2 / 1.5); --text-3xl: 1.875rem; --text-3xl--line-height: 1.2 ; --text-4xl: 2.25rem; --text-4xl--line-height: calc(2.5 / 2.25); --text-5xl: 3rem; --text-5xl--line-height: 1; --text-6xl: 3.75rem; --text-6xl--line-height: 1; --text-7xl: 4.5rem; --text-7xl--line-height: 1; --text-8xl: 6rem; --text-8xl--line-height: 1; --text-9xl: 8rem; --text-9xl--line-height: 1; --font-weight-thin: 100; --font-weight-extralight: 200; --font-weight-light: 300; --font-weight-normal: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700; --font-weight-extrabold: 800; --font-weight-black: 900; --tracking-tighter: -.05em; --tracking-tight: -.025em; --tracking-normal: 0em; --tracking-wide: .025em; --tracking-wider: .05em; --tracking-widest: .1em; --leading-tight: 1.25; --leading-snug: 1.375; --leading-normal: 1.5; --leading-relaxed: 1.625; --leading-loose: 2; --radius-xs: .125rem; --radius-sm: .25rem; --radius-md: .375rem; --radius-lg: .5rem; --radius-xl: .75rem; --radius-2xl: 1rem; --radius-3xl: 1.5rem; --radius-4xl: 2rem; --shadow-2xs: 0 1px rgb(0 0 0 / .05); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05); --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25); --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / .05); --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / .05); --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / .05); --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / .05); --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / .15); --drop-shadow-md: 0 3px 3px rgb(0 0 0 / .12); --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / .15); --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / .1); --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / .15); --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / .15); --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / .2); --text-shadow-sm: 0px 1px 0px rgb(0 0 0 / .075), 0px 1px 1px rgb(0 0 0 / .075), 0px 2px 2px rgb(0 0 0 / .075); --text-shadow-md: 0px 1px 1px rgb(0 0 0 / .1), 0px 1px 2px rgb(0 0 0 / .1), 0px 2px 4px rgb(0 0 0 / .1); --text-shadow-lg: 0px 1px 2px rgb(0 0 0 / .1), 0px 3px 2px rgb(0 0 0 / .1), 0px 4px 8px rgb(0 0 0 / .1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-out: cubic-bezier(0, 0, .2, 1); --ease-in-out: cubic-bezier(.4, 0, .2, 1); --animate-spin: spin 1s linear infinite; --animate-ping: ping 1s cubic-bezier(0, 0, .2, 1) infinite; --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; --animate-bounce: bounce 1s infinite; @keyframes spin { to { transform: rotate(360deg); } } @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } @keyframes pulse { 50% { opacity: .5; } } @keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); } } --blur-xs: 4px; --blur-sm: 8px; --blur-md: 12px; --blur-lg: 16px; --blur-xl: 24px; --blur-2xl: 40px; --blur-3xl: 64px; --perspective-dramatic: 100px; --perspective-near: 300px; --perspective-normal: 500px; --perspective-midrange: 800px; --perspective-distant: 1200px; --aspect-video: 16 / 9; --default-transition-duration: .15s; --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1); --default-font-family: --theme(--font-sans, initial); --default-font-feature-settings: --theme( --font-sans--font-feature-settings, initial ); --default-font-variation-settings: --theme( --font-sans--font-variation-settings, initial ); --default-mono-font-family: --theme(--font-mono, initial); --default-mono-font-feature-settings: --theme( --font-mono--font-feature-settings, initial ); --default-mono-font-variation-settings: --theme( --font-mono--font-variation-settings, initial ); }@theme default inline reference{ --blur: 8px; --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / .05); --drop-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 1px 1px rgb(0 0 0 / .06); --radius: .25rem; --max-width-prose: 65ch; }}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:--theme(--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:--theme(--default-font-feature-settings,normal);font-variation-settings:--theme(--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:--theme(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:--theme(--default-mono-font-feature-settings,normal);font-variation-settings:--theme(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}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{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}: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: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,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-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]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{@tailwind utilities;}@source "../**/*.{ts,tsx,js,jsx}";@layer base{: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{font-family:inherit;cursor:pointer}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}';let D=!1;function ie(){if(D||(D=!0,typeof CSS>"u"||typeof CSS.registerProperty!="function"))return;let s;try{const e=new CSSStyleSheet;e.replaceSync(J),s=e.cssRules}catch{return}for(const e of s){if(e.constructor.name!=="CSSPropertyRule")continue;const t=e;try{CSS.registerProperty({name:t.name,syntax:t.syntax,inherits:t.inherits,...t.initialValue!=null?{initialValue:t.initialValue}:{}})}catch{}}}function oe(s,e,t={}){if(typeof document>"u")throw new Error("mountShadow called in non-DOM environment");ie();const n=t.host??document.createElement("div");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);const i=n.attachShadow({mode:t.shadowMode??"closed"}),o=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./chunks/chrome-port-MoMohiHB.js"),P=require("preact"),r=require("preact/jsx-runtime"),d=require("preact/hooks"),ne=require("./chunks/port-name-qwB109u9.js"),J='@layer theme,base,components,utilities;@layer theme{@theme default{ --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; --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-100: oklch(93.6% .032 17.717); --color-red-200: oklch(88.5% .062 18.334); --color-red-300: oklch(80.8% .114 19.571); --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-red-800: oklch(44.4% .177 26.899); --color-red-900: oklch(39.6% .141 25.723); --color-red-950: oklch(25.8% .092 26.042); --color-orange-50: oklch(98% .016 73.684); --color-orange-100: oklch(95.4% .038 75.164); --color-orange-200: oklch(90.1% .076 70.697); --color-orange-300: oklch(83.7% .128 66.29); --color-orange-400: oklch(75% .183 55.934); --color-orange-500: oklch(70.5% .213 47.604); --color-orange-600: oklch(64.6% .222 41.116); --color-orange-700: oklch(55.3% .195 38.402); --color-orange-800: oklch(47% .157 37.304); --color-orange-900: oklch(40.8% .123 38.172); --color-orange-950: oklch(26.6% .079 36.259); --color-amber-50: oklch(98.7% .022 95.277); --color-amber-100: oklch(96.2% .059 95.617); --color-amber-200: oklch(92.4% .12 95.746); --color-amber-300: oklch(87.9% .169 91.605); --color-amber-400: oklch(82.8% .189 84.429); --color-amber-500: oklch(76.9% .188 70.08); --color-amber-600: oklch(66.6% .179 58.318); --color-amber-700: oklch(55.5% .163 48.998); --color-amber-800: oklch(47.3% .137 46.201); --color-amber-900: oklch(41.4% .112 45.904); --color-amber-950: oklch(27.9% .077 45.635); --color-yellow-50: oklch(98.7% .026 102.212); --color-yellow-100: oklch(97.3% .071 103.193); --color-yellow-200: oklch(94.5% .129 101.54); --color-yellow-300: oklch(90.5% .182 98.111); --color-yellow-400: oklch(85.2% .199 91.936); --color-yellow-500: oklch(79.5% .184 86.047); --color-yellow-600: oklch(68.1% .162 75.834); --color-yellow-700: oklch(55.4% .135 66.442); --color-yellow-800: oklch(47.6% .114 61.907); --color-yellow-900: oklch(42.1% .095 57.708); --color-yellow-950: oklch(28.6% .066 53.813); --color-lime-50: oklch(98.6% .031 120.757); --color-lime-100: oklch(96.7% .067 122.328); --color-lime-200: oklch(93.8% .127 124.321); --color-lime-300: oklch(89.7% .196 126.665); --color-lime-400: oklch(84.1% .238 128.85); --color-lime-500: oklch(76.8% .233 130.85); --color-lime-600: oklch(64.8% .2 131.684); --color-lime-700: oklch(53.2% .157 131.589); --color-lime-800: oklch(45.3% .124 130.933); --color-lime-900: oklch(40.5% .101 131.063); --color-lime-950: oklch(27.4% .072 132.109); --color-green-50: oklch(98.2% .018 155.826); --color-green-100: oklch(96.2% .044 156.743); --color-green-200: oklch(92.5% .084 155.995); --color-green-300: oklch(87.1% .15 154.449); --color-green-400: oklch(79.2% .209 151.711); --color-green-500: oklch(72.3% .219 149.579); --color-green-600: oklch(62.7% .194 149.214); --color-green-700: oklch(52.7% .154 150.069); --color-green-800: oklch(44.8% .119 151.328); --color-green-900: oklch(39.3% .095 152.535); --color-green-950: oklch(26.6% .065 152.934); --color-emerald-50: oklch(97.9% .021 166.113); --color-emerald-100: oklch(95% .052 163.051); --color-emerald-200: oklch(90.5% .093 164.15); --color-emerald-300: oklch(84.5% .143 164.978); --color-emerald-400: oklch(76.5% .177 163.223); --color-emerald-500: oklch(69.6% .17 162.48); --color-emerald-600: oklch(59.6% .145 163.225); --color-emerald-700: oklch(50.8% .118 165.612); --color-emerald-800: oklch(43.2% .095 166.913); --color-emerald-900: oklch(37.8% .077 168.94); --color-emerald-950: oklch(26.2% .051 172.552); --color-teal-50: oklch(98.4% .014 180.72); --color-teal-100: oklch(95.3% .051 180.801); --color-teal-200: oklch(91% .096 180.426); --color-teal-300: oklch(85.5% .138 181.071); --color-teal-400: oklch(77.7% .152 181.912); --color-teal-500: oklch(70.4% .14 182.503); --color-teal-600: oklch(60% .118 184.704); --color-teal-700: oklch(51.1% .096 186.391); --color-teal-800: oklch(43.7% .078 188.216); --color-teal-900: oklch(38.6% .063 188.416); --color-teal-950: oklch(27.7% .046 192.524); --color-cyan-50: oklch(98.4% .019 200.873); --color-cyan-100: oklch(95.6% .045 203.388); --color-cyan-200: oklch(91.7% .08 205.041); --color-cyan-300: oklch(86.5% .127 207.078); --color-cyan-400: oklch(78.9% .154 211.53); --color-cyan-500: oklch(71.5% .143 215.221); --color-cyan-600: oklch(60.9% .126 221.723); --color-cyan-700: oklch(52% .105 223.128); --color-cyan-800: oklch(45% .085 224.283); --color-cyan-900: oklch(39.8% .07 227.392); --color-cyan-950: oklch(30.2% .056 229.695); --color-sky-50: oklch(97.7% .013 236.62); --color-sky-100: oklch(95.1% .026 236.824); --color-sky-200: oklch(90.1% .058 230.902); --color-sky-300: oklch(82.8% .111 230.318); --color-sky-400: oklch(74.6% .16 232.661); --color-sky-500: oklch(68.5% .169 237.323); --color-sky-600: oklch(58.8% .158 241.966); --color-sky-700: oklch(50% .134 242.749); --color-sky-800: oklch(44.3% .11 240.79); --color-sky-900: oklch(39.1% .09 240.876); --color-sky-950: oklch(29.3% .066 243.157); --color-blue-50: oklch(97% .014 254.604); --color-blue-100: oklch(93.2% .032 255.585); --color-blue-200: oklch(88.2% .059 254.128); --color-blue-300: oklch(80.9% .105 251.813); --color-blue-400: oklch(70.7% .165 254.624); --color-blue-500: oklch(62.3% .214 259.815); --color-blue-600: oklch(54.6% .245 262.881); --color-blue-700: oklch(48.8% .243 264.376); --color-blue-800: oklch(42.4% .199 265.638); --color-blue-900: oklch(37.9% .146 265.522); --color-blue-950: oklch(28.2% .091 267.935); --color-indigo-50: oklch(96.2% .018 272.314); --color-indigo-100: oklch(93% .034 272.788); --color-indigo-200: oklch(87% .065 274.039); --color-indigo-300: oklch(78.5% .115 274.713); --color-indigo-400: oklch(67.3% .182 276.935); --color-indigo-500: oklch(58.5% .233 277.117); --color-indigo-600: oklch(51.1% .262 276.966); --color-indigo-700: oklch(45.7% .24 277.023); --color-indigo-800: oklch(39.8% .195 277.366); --color-indigo-900: oklch(35.9% .144 278.697); --color-indigo-950: oklch(25.7% .09 281.288); --color-violet-50: oklch(96.9% .016 293.756); --color-violet-100: oklch(94.3% .029 294.588); --color-violet-200: oklch(89.4% .057 293.283); --color-violet-300: oklch(81.1% .111 293.571); --color-violet-400: oklch(70.2% .183 293.541); --color-violet-500: oklch(60.6% .25 292.717); --color-violet-600: oklch(54.1% .281 293.009); --color-violet-700: oklch(49.1% .27 292.581); --color-violet-800: oklch(43.2% .232 292.759); --color-violet-900: oklch(38% .189 293.745); --color-violet-950: oklch(28.3% .141 291.089); --color-purple-50: oklch(97.7% .014 308.299); --color-purple-100: oklch(94.6% .033 307.174); --color-purple-200: oklch(90.2% .063 306.703); --color-purple-300: oklch(82.7% .119 306.383); --color-purple-400: oklch(71.4% .203 305.504); --color-purple-500: oklch(62.7% .265 303.9); --color-purple-600: oklch(55.8% .288 302.321); --color-purple-700: oklch(49.6% .265 301.924); --color-purple-800: oklch(43.8% .218 303.724); --color-purple-900: oklch(38.1% .176 304.987); --color-purple-950: oklch(29.1% .149 302.717); --color-fuchsia-50: oklch(97.7% .017 320.058); --color-fuchsia-100: oklch(95.2% .037 318.852); --color-fuchsia-200: oklch(90.3% .076 319.62); --color-fuchsia-300: oklch(83.3% .145 321.434); --color-fuchsia-400: oklch(74% .238 322.16); --color-fuchsia-500: oklch(66.7% .295 322.15); --color-fuchsia-600: oklch(59.1% .293 322.896); --color-fuchsia-700: oklch(51.8% .253 323.949); --color-fuchsia-800: oklch(45.2% .211 324.591); --color-fuchsia-900: oklch(40.1% .17 325.612); --color-fuchsia-950: oklch(29.3% .136 325.661); --color-pink-50: oklch(97.1% .014 343.198); --color-pink-100: oklch(94.8% .028 342.258); --color-pink-200: oklch(89.9% .061 343.231); --color-pink-300: oklch(82.3% .12 346.018); --color-pink-400: oklch(71.8% .202 349.761); --color-pink-500: oklch(65.6% .241 354.308); --color-pink-600: oklch(59.2% .249 .584); --color-pink-700: oklch(52.5% .223 3.958); --color-pink-800: oklch(45.9% .187 3.815); --color-pink-900: oklch(40.8% .153 2.432); --color-pink-950: oklch(28.4% .109 3.907); --color-rose-50: oklch(96.9% .015 12.422); --color-rose-100: oklch(94.1% .03 12.58); --color-rose-200: oklch(89.2% .058 10.001); --color-rose-300: oklch(81% .117 11.638); --color-rose-400: oklch(71.2% .194 13.428); --color-rose-500: oklch(64.5% .246 16.439); --color-rose-600: oklch(58.6% .253 17.585); --color-rose-700: oklch(51.4% .222 16.935); --color-rose-800: oklch(45.5% .188 13.697); --color-rose-900: oklch(41% .159 10.272); --color-rose-950: oklch(27.1% .105 12.094); --color-slate-50: oklch(98.4% .003 247.858); --color-slate-100: oklch(96.8% .007 247.896); --color-slate-200: oklch(92.9% .013 255.508); --color-slate-300: oklch(86.9% .022 252.894); --color-slate-400: oklch(70.4% .04 256.788); --color-slate-500: oklch(55.4% .046 257.417); --color-slate-600: oklch(44.6% .043 257.281); --color-slate-700: oklch(37.2% .044 257.287); --color-slate-800: oklch(27.9% .041 260.031); --color-slate-900: oklch(20.8% .042 265.755); --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-gray-950: oklch(13% .028 261.692); --color-zinc-50: oklch(98.5% 0 0); --color-zinc-100: oklch(96.7% .001 286.375); --color-zinc-200: oklch(92% .004 286.32); --color-zinc-300: oklch(87.1% .006 286.286); --color-zinc-400: oklch(70.5% .015 286.067); --color-zinc-500: oklch(55.2% .016 285.938); --color-zinc-600: oklch(44.2% .017 285.786); --color-zinc-700: oklch(37% .013 285.805); --color-zinc-800: oklch(27.4% .006 286.033); --color-zinc-900: oklch(21% .006 285.885); --color-zinc-950: oklch(14.1% .005 285.823); --color-neutral-50: oklch(98.5% 0 0); --color-neutral-100: oklch(97% 0 0); --color-neutral-200: oklch(92.2% 0 0); --color-neutral-300: oklch(87% 0 0); --color-neutral-400: oklch(70.8% 0 0); --color-neutral-500: oklch(55.6% 0 0); --color-neutral-600: oklch(43.9% 0 0); --color-neutral-700: oklch(37.1% 0 0); --color-neutral-800: oklch(26.9% 0 0); --color-neutral-900: oklch(20.5% 0 0); --color-neutral-950: oklch(14.5% 0 0); --color-stone-50: oklch(98.5% .001 106.423); --color-stone-100: oklch(97% .001 106.424); --color-stone-200: oklch(92.3% .003 48.717); --color-stone-300: oklch(86.9% .005 56.366); --color-stone-400: oklch(70.9% .01 56.259); --color-stone-500: oklch(55.3% .013 58.071); --color-stone-600: oklch(44.4% .011 73.639); --color-stone-700: oklch(37.4% .01 67.558); --color-stone-800: oklch(26.8% .007 34.298); --color-stone-900: oklch(21.6% .006 56.043); --color-stone-950: oklch(14.7% .004 49.25); --color-mauve-50: oklch(98.5% 0 0); --color-mauve-100: oklch(96% .003 325.6); --color-mauve-200: oklch(92.2% .005 325.62); --color-mauve-300: oklch(86.5% .012 325.68); --color-mauve-400: oklch(71.1% .019 323.02); --color-mauve-500: oklch(54.2% .034 322.5); --color-mauve-600: oklch(43.5% .029 321.78); --color-mauve-700: oklch(36.4% .029 323.89); --color-mauve-800: oklch(26.3% .024 320.12); --color-mauve-900: oklch(21.2% .019 322.12); --color-mauve-950: oklch(14.5% .008 326); --color-olive-50: oklch(98.8% .003 106.5); --color-olive-100: oklch(96.6% .005 106.5); --color-olive-200: oklch(93% .007 106.5); --color-olive-300: oklch(88% .011 106.6); --color-olive-400: oklch(73.7% .021 106.9); --color-olive-500: oklch(58% .031 107.3); --color-olive-600: oklch(46.6% .025 107.3); --color-olive-700: oklch(39.4% .023 107.4); --color-olive-800: oklch(28.6% .016 107.4); --color-olive-900: oklch(22.8% .013 107.4); --color-olive-950: oklch(15.3% .006 107.1); --color-mist-50: oklch(98.7% .002 197.1); --color-mist-100: oklch(96.3% .002 197.1); --color-mist-200: oklch(92.5% .005 214.3); --color-mist-300: oklch(87.2% .007 219.6); --color-mist-400: oklch(72.3% .014 214.4); --color-mist-500: oklch(56% .021 213.5); --color-mist-600: oklch(45% .017 213.2); --color-mist-700: oklch(37.8% .015 216); --color-mist-800: oklch(27.5% .011 216.9); --color-mist-900: oklch(21.8% .008 223.9); --color-mist-950: oklch(14.8% .004 228.8); --color-taupe-50: oklch(98.6% .002 67.8); --color-taupe-100: oklch(96% .002 17.2); --color-taupe-200: oklch(92.2% .005 34.3); --color-taupe-300: oklch(86.8% .007 39.5); --color-taupe-400: oklch(71.4% .014 41.2); --color-taupe-500: oklch(54.7% .021 43.1); --color-taupe-600: oklch(43.8% .017 39.3); --color-taupe-700: oklch(36.7% .016 35.7); --color-taupe-800: oklch(26.8% .011 36.5); --color-taupe-900: oklch(21.4% .009 43.1); --color-taupe-950: oklch(14.7% .004 49.3); --color-black: #000; --color-white: #fff; --spacing: .25rem; --breakpoint-sm: 40rem; --breakpoint-md: 48rem; --breakpoint-lg: 64rem; --breakpoint-xl: 80rem; --breakpoint-2xl: 96rem; --container-3xs: 16rem; --container-2xs: 18rem; --container-xs: 20rem; --container-sm: 24rem; --container-md: 28rem; --container-lg: 32rem; --container-xl: 36rem; --container-2xl: 42rem; --container-3xl: 48rem; --container-4xl: 56rem; --container-5xl: 64rem; --container-6xl: 72rem; --container-7xl: 80rem; --text-xs: .75rem; --text-xs--line-height: calc(1 / .75); --text-sm: .875rem; --text-sm--line-height: calc(1.25 / .875); --text-base: 1rem; --text-base--line-height: 1.5 ; --text-lg: 1.125rem; --text-lg--line-height: calc(1.75 / 1.125); --text-xl: 1.25rem; --text-xl--line-height: calc(1.75 / 1.25); --text-2xl: 1.5rem; --text-2xl--line-height: calc(2 / 1.5); --text-3xl: 1.875rem; --text-3xl--line-height: 1.2 ; --text-4xl: 2.25rem; --text-4xl--line-height: calc(2.5 / 2.25); --text-5xl: 3rem; --text-5xl--line-height: 1; --text-6xl: 3.75rem; --text-6xl--line-height: 1; --text-7xl: 4.5rem; --text-7xl--line-height: 1; --text-8xl: 6rem; --text-8xl--line-height: 1; --text-9xl: 8rem; --text-9xl--line-height: 1; --font-weight-thin: 100; --font-weight-extralight: 200; --font-weight-light: 300; --font-weight-normal: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700; --font-weight-extrabold: 800; --font-weight-black: 900; --tracking-tighter: -.05em; --tracking-tight: -.025em; --tracking-normal: 0em; --tracking-wide: .025em; --tracking-wider: .05em; --tracking-widest: .1em; --leading-tight: 1.25; --leading-snug: 1.375; --leading-normal: 1.5; --leading-relaxed: 1.625; --leading-loose: 2; --radius-xs: .125rem; --radius-sm: .25rem; --radius-md: .375rem; --radius-lg: .5rem; --radius-xl: .75rem; --radius-2xl: 1rem; --radius-3xl: 1.5rem; --radius-4xl: 2rem; --shadow-2xs: 0 1px rgb(0 0 0 / .05); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05); --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25); --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / .05); --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / .05); --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / .05); --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / .05); --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / .15); --drop-shadow-md: 0 3px 3px rgb(0 0 0 / .12); --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / .15); --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / .1); --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / .15); --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / .15); --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / .2); --text-shadow-sm: 0px 1px 0px rgb(0 0 0 / .075), 0px 1px 1px rgb(0 0 0 / .075), 0px 2px 2px rgb(0 0 0 / .075); --text-shadow-md: 0px 1px 1px rgb(0 0 0 / .1), 0px 1px 2px rgb(0 0 0 / .1), 0px 2px 4px rgb(0 0 0 / .1); --text-shadow-lg: 0px 1px 2px rgb(0 0 0 / .1), 0px 3px 2px rgb(0 0 0 / .1), 0px 4px 8px rgb(0 0 0 / .1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-out: cubic-bezier(0, 0, .2, 1); --ease-in-out: cubic-bezier(.4, 0, .2, 1); --animate-spin: spin 1s linear infinite; --animate-ping: ping 1s cubic-bezier(0, 0, .2, 1) infinite; --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; --animate-bounce: bounce 1s infinite; @keyframes spin { to { transform: rotate(360deg); } } @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } @keyframes pulse { 50% { opacity: .5; } } @keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); } } --blur-xs: 4px; --blur-sm: 8px; --blur-md: 12px; --blur-lg: 16px; --blur-xl: 24px; --blur-2xl: 40px; --blur-3xl: 64px; --perspective-dramatic: 100px; --perspective-near: 300px; --perspective-normal: 500px; --perspective-midrange: 800px; --perspective-distant: 1200px; --aspect-video: 16 / 9; --default-transition-duration: .15s; --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1); --default-font-family: --theme(--font-sans, initial); --default-font-feature-settings: --theme( --font-sans--font-feature-settings, initial ); --default-font-variation-settings: --theme( --font-sans--font-variation-settings, initial ); --default-mono-font-family: --theme(--font-mono, initial); --default-mono-font-feature-settings: --theme( --font-mono--font-feature-settings, initial ); --default-mono-font-variation-settings: --theme( --font-mono--font-variation-settings, initial ); }@theme default inline reference{ --blur: 8px; --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / .05); --drop-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 1px 1px rgb(0 0 0 / .06); --radius: .25rem; --max-width-prose: 65ch; }}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:--theme(--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:--theme(--default-font-feature-settings,normal);font-variation-settings:--theme(--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:--theme(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:--theme(--default-mono-font-feature-settings,normal);font-variation-settings:--theme(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}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{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}: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: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,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-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]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{@tailwind utilities;}@source "../**/*.{ts,tsx,js,jsx}";@layer base{: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{font-family:inherit;cursor:pointer}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}';let D=!1;function ie(){if(D||(D=!0,typeof CSS>"u"||typeof CSS.registerProperty!="function"))return;let s;try{const e=new CSSStyleSheet;e.replaceSync(J),s=e.cssRules}catch{return}for(const e of s){if(e.constructor.name!=="CSSPropertyRule")continue;const t=e;try{CSS.registerProperty({name:t.name,syntax:t.syntax,inherits:t.inherits,...t.initialValue!=null?{initialValue:t.initialValue}:{}})}catch{}}}function oe(s,e,t={}){if(typeof document>"u")throw new Error("mountShadow called in non-DOM environment");ie();const n=t.host??document.createElement("div");n.setAttribute("data-paywall-host",""),n.style.cssText=t.inline?"all: initial; position: absolute; inset: 0; z-index: 1; pointer-events: none;":"all: initial; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;",!n.isConnected&&!t.inline&&document.body.appendChild(n);const i=n.attachShadow({mode:t.shadowMode??"closed"}),o=`
|
|
2
2
|
:host {
|
|
3
3
|
all: initial !important;
|
|
4
4
|
display: block !important;
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
cursor: auto !important;
|
|
17
17
|
visibility: visible !important;
|
|
18
18
|
}
|
|
19
|
-
`,l=document.createElement("style");l.textContent=o+J+(t.injectCss??""),i.appendChild(l);const a=document.createElement("div");a.style.pointerEvents="auto",i.appendChild(a);let
|
|
19
|
+
`,l=document.createElement("style");l.textContent=o+J+(t.injectCss??""),i.appendChild(l);const a=document.createElement("div");a.style.pointerEvents="auto",i.appendChild(a);let u=e;return P.render(P.h(s,u),a),{shadowRoot:i,update(c){u={...u,...c},P.render(P.h(s,u),a)},unmount(){P.render(null,a),n.remove()}}}const F='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function le({open:s,onClose:e,labelledBy:t,brandColor:n,testMode:i,allowClose:o=!0,inline:l=!1,children:a}){const u=d.useRef(null),c=d.useRef(null);if(d.useEffect(()=>{if(!s)return;c.current=document.activeElement??null;const f=u.current;f&&(f.querySelector(F)??f).focus({preventScroll:!0});const g=v=>{if(v.key==="Escape"){if(!o)return;v.stopPropagation(),e();return}if(v.key!=="Tab"||!u.current)return;const b=Array.from(u.current.querySelectorAll(F)).filter(T=>!T.hasAttribute("disabled")&&T.tabIndex!==-1);if(b.length===0){v.preventDefault();return}const _=b[0],w=b[b.length-1],A=document.activeElement;v.shiftKey&&A===_?(v.preventDefault(),w.focus()):!v.shiftKey&&A===w&&(v.preventDefault(),_.focus())};document.addEventListener("keydown",g,!0);const j=document.body.style.overflow;return l||(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",g,!0),l||(document.body.style.overflow=j),c.current?.focus?.({preventScroll:!0})}},[s,e,o,l]),!s)return null;const x=f=>{o&&f.target===f.currentTarget&&e()},m=n??"#3b82f6",I=`${l?"absolute z-[1]":"fixed z-[2147483647]"} inset-0 flex items-center justify-center bg-slate-950/50 p-2 sm:p-4 backdrop-blur-md animate-[pw-fade-in_180ms_ease-out]`;return r.jsxs("div",{class:I,onClick:x,"data-pw-root":!0,children:[r.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":t,tabIndex:-1,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)]",style:{"--pw-accent":m,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)"},children:[i&&r.jsxs("div",{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",role:"status",children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r.jsx("path",{d:"M8 1L15 14H1L8 1Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"}),r.jsx("path",{d:"M8 6v3",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),r.jsx("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor"})]}),"Test mode — no real charge"]}),r.jsx("div",{class:"flex-1 overflow-y-auto p-7",children:a}),o?r.jsx("button",{type:"button",onClick:e,"aria-label":"Close",class:`absolute right-3 ${i?"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)]`,children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round"})})}):null]}),r.jsx("style",{children:`
|
|
20
20
|
@keyframes pw-fade-in { from { opacity: 0 } to { opacity: 1 } }
|
|
21
21
|
@keyframes pw-scale-in {
|
|
22
22
|
from { opacity: 0; transform: translateY(12px) scale(0.96) }
|
|
23
23
|
to { opacity: 1; transform: none }
|
|
24
24
|
}
|
|
25
|
-
`})]})}const ae={google:"Continue with Google",apple:"Continue with Apple",github:"Continue with GitHub",facebook:"Continue with Facebook"};function K({block:s,ctx:e}){const t=e.auth,n=e.authSession,i=s.allow_signup!==!1,o=s.allow_password_reset!==!1,l=s.hide_when_authenticated!==!1;if(!t)return typeof console<"u"&&console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"),null;const a=n&&!n.user.is_anonymous?n:null;return a&&l?null:a?r.jsx(ce,{email:a.user.email??"",onSignOut:()=>t.signOut().catch(()=>{})}):r.jsx(ue,{block:s,allowSignup:i,allowReset:o,ctx:e})}function ce({email:s,onSignOut:e}){return r.jsxs("div",{class:"flex items-center justify-between gap-3 rounded-2xl border border-gray-200 bg-gray-50/60 px-4 py-3",children:[r.jsxs("div",{class:"flex flex-col",children:[r.jsx("span",{class:"text-[10px] font-semibold uppercase tracking-wider text-gray-500",children:"Signed in"}),r.jsx("span",{class:"text-sm font-medium text-gray-900",children:s})]}),r.jsx("button",{type:"button",onClick:e,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)]",children:"Sign out"})]})}function ue({block:s,allowSignup:e,allowReset:t,ctx:n}){const i=n.auth,o=s.providers??[],[l,a]=h.useState("signin"),[c,d]=h.useState(""),[g,y]=h.useState(""),[f,x]=h.useState(""),[m,j]=h.useState(null),[I,v]=h.useState(null),[_,w]=h.useState(null),A=async S=>{if(S.preventDefault(),!m){j("email"),v(null),w(null);try{l==="signin"?await i.signInWithEmail({email:c,password:g}):l==="signup"?(await i.signUp({email:c,password:g})).kind==="confirmation_required"&&(a("reset_verify"),w("Check your email for a confirmation code.")):l==="forgot"?(await i.requestPasswordReset({email:c}),a("reset_sent"),w("If that email exists, a reset code has been sent.")):l==="reset_verify"&&(await i.verifyOtp({email:c,token:f,type:g?"recovery":"email"}),g&&await i.updatePassword({password:g}))}catch(C){const p=C instanceof k.PaywallError?C.message:"Something went wrong";v(p)}finally{j(null)}}},T=async S=>{if(!m){j(S),v(null),w(null);try{await i.signInWithOAuth({provider:S,onPopupOpened:()=>j(null)})}catch(C){if(C instanceof k.PaywallError){if(C.code==="oauth_cancelled"||C.code==="oauth_timeout")return;v(C.message)}else v("Sign-in failed")}finally{j(null)}}};return r.jsxs("div",{class:"flex flex-col gap-3",children:[s.heading?r.jsx("h2",{class:"text-lg font-semibold tracking-tight text-gray-900",children:s.heading}):null,o.length>0&&(l==="signin"||l==="signup")?r.jsxs("div",{class:"flex flex-col gap-2",children:[o.map(S=>r.jsxs("button",{type:"button",onClick:()=>T(S),disabled:m!==null,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)]",children:[m===S?r.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700"}):r.jsx(pe,{provider:S}),r.jsx("span",{children:ae[S]})]},S)),r.jsx(de,{})]}):null,r.jsxs("form",{onSubmit:A,class:"flex flex-col gap-2",children:[(l==="signin"||l==="signup"||l==="forgot")&&r.jsx(L,{type:"email",label:"Email",value:c,onInput:d,autocomplete:"email",required:!0}),(l==="signin"||l==="signup")&&r.jsx(L,{type:"password",label:"Password",value:g,onInput:y,autocomplete:l==="signin"?"current-password":"new-password",required:!0}),l==="reset_verify"&&r.jsxs(r.Fragment,{children:[r.jsx(L,{type:"text",label:"Confirmation code",value:f,onInput:x,autocomplete:"one-time-code",inputMode:"numeric",required:!0}),r.jsx(L,{type:"password",label:"New password (optional — only for password reset)",value:g,onInput:y,autocomplete:"new-password"})]}),l==="reset_sent"&&_&&r.jsx("p",{class:"rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600",children:_}),I&&r.jsx("p",{class:"text-xs text-red-600",children:I}),_&&l!=="reset_sent"&&r.jsx("p",{class:"text-xs text-gray-500",children:_}),l!=="reset_sent"&&r.jsx("button",{type:"submit",disabled:m!==null,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:m==="email"?r.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):he(l)})]}),r.jsxs("div",{class:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-xs text-gray-500",children:[l==="signin"&&e&&r.jsx("button",{type:"button",onClick:()=>B(a,v,w,"signup"),class:"font-medium text-gray-700 hover:underline",children:"Create account"}),l==="signup"&&r.jsx("button",{type:"button",onClick:()=>B(a,v,w,"signin"),class:"font-medium text-gray-700 hover:underline",children:"I already have an account"}),l==="signin"&&t&&r.jsx("button",{type:"button",onClick:()=>B(a,v,w,"forgot"),class:"hover:underline",children:"Forgot password?"}),(l==="forgot"||l==="reset_sent"||l==="reset_verify")&&r.jsx("button",{type:"button",onClick:()=>B(a,v,w,"signin"),class:"hover:underline",children:"Back to sign in"}),l==="reset_sent"&&r.jsx("button",{type:"button",onClick:()=>B(a,v,w,"reset_verify"),class:"font-medium text-gray-700 hover:underline",children:"I have a code"})]})]})}function he(s){switch(s){case"signin":return"Sign in";case"signup":return"Create account";case"forgot":return"Send reset code";case"reset_verify":return"Verify";default:return"Continue"}}function B(s,e,t,n){s(n),e(null),t(null)}function L({type:s,label:e,value:t,onInput:n,autocomplete:i,inputMode:o,required:l}){return r.jsxs("label",{class:"flex flex-col gap-1.5",children:[r.jsx("span",{class:"text-xs font-medium text-gray-700",children:e}),r.jsx("input",{type:s,value:t,onInput:a=>n(a.target.value),autocomplete:i,inputMode:o,required:l,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)]"})]})}function de(){return r.jsxs("div",{class:"flex items-center gap-2 py-1 text-[10px] uppercase tracking-[0.14em] text-gray-400",children:[r.jsx("div",{class:"h-px flex-1 bg-gradient-to-r from-gray-200 to-transparent"}),r.jsx("span",{children:"or"}),r.jsx("div",{class:"h-px flex-1 bg-gradient-to-r from-transparent to-gray-200"})]})}function pe({provider:s}){return s==="google"?r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 18 18","aria-hidden":"true",children:[r.jsx("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"}),r.jsx("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"}),r.jsx("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"}),r.jsx("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"})]}):s==="apple"?r.jsx("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:r.jsx("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"})}):s==="github"?r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:r.jsx("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"})}):r.jsx("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:r.jsx("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"})})}function fe({block:s,bootstrap:e,auth:t,authSession:n,onBack:i,showBack:o=!0}){const l={bootstrap:e,selectedPriceId:null,setSelectedPriceId:()=>{},onAction:()=>{},auth:t,authSession:n};return r.jsxs("div",{class:"flex flex-col gap-3",children:[o?r.jsx("button",{type:"button",onClick:i,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)]",children:"← Back"}):null,r.jsx(K,{block:s,ctx:l})]})}function ge({auth:s,onSuccess:e,onBack:t,heading:n="Continue as guest",description:i="Setting up your guest session…"}){const[o,l]=h.useState({kind:"signing-in"}),a=h.useRef(!0);h.useEffect(()=>()=>{a.current=!1},[]);const c=()=>{l({kind:"signing-in"}),(async()=>{try{const d=await s.signInAnonymously();if(!a.current)return;e(d)}catch(d){if(!a.current)return;l({kind:"error",message:d instanceof Error?d.message:"Anonymous sign-in failed"})}})()};return h.useEffect(()=>{c()},[]),r.jsxs("div",{class:"flex flex-col gap-3",children:[t?r.jsx("button",{type:"button",onClick:t,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)]",children:"← Back"}):null,r.jsxs("div",{class:"flex flex-col gap-1",children:[r.jsx("h2",{class:"text-xl font-semibold text-gray-900",children:n}),r.jsx("p",{class:"text-sm text-gray-500",children:i})]}),o.kind==="signing-in"?r.jsx("div",{class:"flex items-center justify-center py-6",children:r.jsx(xe,{})}):null,o.kind==="error"?r.jsxs("div",{class:"flex flex-col gap-3",children:[r.jsx("div",{class:"rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700",children:o.message}),r.jsx("button",{type:"button",onClick:c,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",children:"Try again"})]}):null]})}function xe(){return r.jsxs("svg",{class:"h-5 w-5 animate-spin text-[var(--pw-accent)]",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"3","stroke-opacity":"0.2"}),r.jsx("path",{d:"M22 12a10 10 0 0 0-10-10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"})]})}const U=3,R=200,q=5e3,z=5,me=10*1024*1024,N=["image/jpeg","image/png","image/webp"],$=/.+@.+\..+/;function ye({client:s,authSession:e,origin:t,onBack:n}){const i=e?.user.email??"",o=i||null,[l,a]=h.useState(i),[c,d]=h.useState(""),[g,y]=h.useState(""),[f,x]=h.useState([]),[m,j]=h.useState(!1),[I,v]=h.useState(null),[_,w]=h.useState({}),A=h.useMemo(()=>{const p=(o??l).trim().toLowerCase(),u=c.trim(),b=g.trim();return $.test(p)&&u.length>=U&&u.length<=R&&b.length>=1&&b.length<=q},[o,l,c,g]),T=()=>{const p={},u=(o??l).trim(),b=c.trim(),M=g.trim();return u?$.test(u.toLowerCase())||(p.email="Invalid email"):p.email="Required",(b.length<U||b.length>R)&&(p.subject=`${U}–${R} characters`),(M.length<1||M.length>q)&&(p.message=`1–${q} characters`),w(p),Object.keys(p).length===0},S=async p=>{if(p.preventDefault(),!m&&T()){j(!0),w(u=>({...u,submit:void 0}));try{const u=(o??l).trim();await s.createSupportTicket({subject:c.trim(),content:g.trim(),email:u||void 0,files:f.length>0?f:void 0}),v(u)}catch(u){const b=u instanceof k.PaywallError&&u.message||"Failed to send. Please try again.";w(M=>({...M,submit:b}))}finally{j(!1)}}},C=()=>{d(""),y(""),x([]),w({}),v(null)};return I?r.jsxs("div",{class:"flex flex-col items-center gap-4 py-2 text-center",children:[r.jsx("div",{class:"flex h-14 w-14 items-center justify-center rounded-full",style:{background:"linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",color:"#fff",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)"},"aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",class:"h-7 w-7",children:r.jsx("path",{fill:"currentColor",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"})})}),r.jsx("div",{class:"text-lg font-semibold tracking-tight text-gray-900",children:"Request submitted"}),r.jsxs("div",{class:"max-w-[320px] text-sm leading-relaxed text-gray-500",children:["We've received your message and will respond to"," ",r.jsx("b",{class:"text-gray-700",children:I}),"."]}),r.jsxs("div",{class:"mt-2 flex items-center justify-center gap-3",children:[r.jsx("button",{type:"button",onClick:n,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)]",children:t==="standalone"?"Done":"Back"}),r.jsx("button",{type:"button",onClick:C,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Send another request"})]})]}):r.jsxs("div",{class:"flex flex-col gap-3",children:[r.jsx("div",{class:"flex items-center justify-between",children:r.jsxs("button",{type:"button",onClick:n,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)]",children:["← ",t==="standalone"?"Close":"Back"]})}),r.jsx("h2",{class:"text-lg font-semibold tracking-tight text-gray-900",children:"Contact Support"}),r.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:"Fill out the form below and we'll get back to you."}),r.jsxs("form",{onSubmit:S,class:"flex flex-col gap-3",children:[o?r.jsxs("div",{class:"rounded-xl border border-gray-200 bg-gray-50/60 px-3 py-2 text-xs text-gray-500",children:["Sending as ",r.jsx("b",{class:"font-medium text-gray-700",children:o})]}):r.jsx(H,{type:"email",label:"Your email",value:l,onInput:a,error:_.email,autocomplete:"email",required:!0}),r.jsx(H,{type:"text",label:"Subject",value:c,onInput:d,error:_.subject,required:!0}),r.jsx(be,{label:"Message",value:g,onInput:y,error:_.message,required:!0}),r.jsx(ke,{files:f,onChange:x,disabled:m}),_.submit&&r.jsx("p",{class:"text-xs text-red-600",children:_.submit}),r.jsxs("div",{class:"mt-1 flex items-center justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:n,disabled:m,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)]",children:t==="standalone"?"Close":"Back"}),r.jsx("button",{type:"submit",disabled:!A||m,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:m?r.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):"Send"})]})]})]})}function H({type:s,label:e,value:t,onInput:n,error:i,autocomplete:o,required:l}){return r.jsxs("label",{class:"flex flex-col gap-1.5",children:[r.jsx("span",{class:"text-xs font-medium text-gray-700",children:e}),r.jsx("input",{type:s,value:t,onInput:a=>n(a.target.value),autocomplete:o,required:l,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 ${i?"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)]"}`}),i&&r.jsx("span",{class:"text-xs text-red-600",children:i})]})}function be({label:s,value:e,onInput:t,error:n,required:i}){return r.jsxs("label",{class:"flex flex-col gap-1.5",children:[r.jsx("span",{class:"text-xs font-medium text-gray-700",children:s}),r.jsx("textarea",{value:e,onInput:o=>t(o.target.value),required:i,rows:4,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)]"}`}),n&&r.jsx("span",{class:"text-xs text-red-600",children:n})]})}function ke({files:s,onChange:e,disabled:t}){const n=h.useRef(null),[i,o]=h.useState(!1),[l,a]=h.useState(null),c=d=>{if(!d||t)return;a(null);const g=Array.from(d);if(s.length+g.length>z){a(`Up to ${z} files`);return}const y=g.filter(f=>N.includes(f.type)&&f.size<=me);if(y.length!==g.length){a("Only JPEG/PNG/WebP, ≤ 10MB each");return}e([...s,...y])};return r.jsxs("div",{children:[r.jsx("span",{class:"text-xs font-medium text-gray-700",children:"Attachments (optional)"}),r.jsxs("div",{role:"button",tabIndex:0,"aria-label":"Attachments upload",onClick:()=>!t&&n.current?.click(),onDragOver:d=>{d.preventDefault(),t||o(!0)},onDragLeave:()=>o(!1),onDrop:d=>{d.preventDefault(),o(!1),c(d.dataTransfer?.files??null)},class:`mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${i?"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"} ${t?"cursor-not-allowed opacity-60":""}`,children:[r.jsx("div",{class:"text-xs text-gray-500",children:"Drop images here or click to select"}),r.jsxs("div",{class:"mt-0.5 text-[11px] text-gray-400",children:["JPEG/PNG/WebP, up to ",z," files, ≤ 10MB each"]})]}),r.jsx("input",{ref:n,type:"file",multiple:!0,accept:N.join(","),class:"hidden",onChange:d=>{c(d.target.files),d.currentTarget.value=""}}),l&&r.jsx("p",{class:"mt-1 text-xs text-red-600",children:l}),s.length>0&&r.jsx("ul",{class:"mt-2 flex flex-col gap-1",children:s.map((d,g)=>r.jsxs("li",{class:"flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",children:[r.jsx("span",{class:"truncate text-gray-700",children:d.name}),r.jsx("button",{type:"button",onClick:()=>{const y=[...s];y.splice(g,1),e(y)},disabled:t,class:"text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60","aria-label":`Remove ${d.name}`,children:"✕"})]},`${d.name}-${d.size}-${g}`))})]})}function we({block:s,ctx:e}){const[t,n]=h.useState(!1),i=s.priceId??e.selectedPriceId,o=t||s.action==="checkout"&&!i,l=async()=>{if(!o){n(!0);try{await e.onAction(s.action,{priceId:i})}finally{n(!1)}}};return r.jsx("button",{type:"button",disabled:o,onClick:l,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",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)"},children:t?r.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):s.label})}function ve({ctx:s}){const e=s.authSession,t=s.auth,[n,i]=h.useState(!1),o=()=>s.onAction("support");if(e&&!e.user.is_anonymous){const l=async()=>{if(!(!t||n)){i(!0);try{await t.signOut()}catch{}finally{i(!1)}}};return r.jsxs("div",{class:"mt-2 text-center text-xs text-gray-500",children:[r.jsx("span",{children:"Signed in as "}),r.jsx("b",{class:"font-medium text-gray-700",children:e.user.email}),r.jsxs("div",{class:"mt-1 flex items-center justify-center gap-3",children:[r.jsx("button",{type:"button",onClick:l,disabled:!t||n,class:"font-medium text-gray-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:underline",children:n?"Signing out…":"Sign out"}),r.jsx(W,{}),r.jsx(G,{onClick:o})]})]})}return r.jsxs("div",{class:"mt-2 flex items-center justify-center gap-3 text-center text-xs text-gray-500",children:[r.jsx("button",{type:"button",onClick:()=>s.onAction("restore"),class:"font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",children:"Restore purchases"}),r.jsx(W,{}),r.jsx(G,{onClick:o})]})}function G({onClick:s}){return r.jsx("button",{type:"button",onClick:s,class:"font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",children:"Contact Support"})}function W(){return r.jsx("span",{class:"h-1 w-1 rounded-full bg-gray-300","aria-hidden":"true"})}function je({block:s}){return s.items.length?r.jsx("ul",{class:"flex flex-col gap-2.5",role:"list",children:s.items.map(e=>r.jsxs("li",{class:"flex items-start gap-3 text-sm text-gray-700",children:[r.jsx("span",{class:"mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full",style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 20 20",fill:"none",children:r.jsx("path",{d:"M5 10l3 3 7-7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),r.jsxs("div",{class:"flex flex-col gap-0.5",children:[r.jsx("span",{class:"font-medium leading-snug text-gray-900",children:e.name}),e.desc?r.jsx("span",{class:"text-xs leading-relaxed text-gray-500",children:e.desc}):null]})]},e.id))}):null}const Q=26,_e=14,Se=2;function Ce(s,e){const t=e*Se;let n=Q;for(s.style.fontSize=`${n}px`;s.scrollHeight>t&&n>_e;)n-=1,s.style.fontSize=`${n}px`}function Ie({block:s,ctx:e}){const t=s.level??1,n=`h${t}`,i=t===1?"text-[1.625rem] font-semibold leading-tight text-gray-900 tracking-[-0.02em]":t===2?"text-xl font-semibold leading-snug text-gray-900 tracking-tight":"text-base font-medium text-gray-900",o=h.useRef(null),l=t===1&&!!e.bootstrap.settings.title_auto_fit;return h.useEffect(()=>{if(!l||!o.current)return;const a=getComputedStyle(o.current),c=parseFloat(a.lineHeight)||Q*1.5;Ce(o.current,c)},[l,s.text]),r.jsx(n,{ref:o,class:i,children:s.text})}function Ee(s){const e=s.local??{currency:s.currency,amount:s.amount};try{return new Intl.NumberFormat(void 0,{style:"currency",currency:e.currency,maximumFractionDigits:e.amount%1===0?0:2}).format(e.amount)}catch{return`${e.amount} ${e.currency}`}}function Z(s){if(!s.interval||s.interval==="lifetime")return"one-time";const e=s.interval_count??1;return e===1?`per ${s.interval}`:`every ${e} ${s.interval}s`}function Ae({block:s,ctx:e}){const t=s.priceIds&&s.priceIds.length>0?new Set(s.priceIds):null,n=e.bootstrap.prices.filter(a=>!t||t.has(a.id));if(n.length===0)return r.jsx("p",{class:"text-sm text-gray-500",children:"No prices available."});const i=s.view==="horizontal",o=s.popular_label??"Most popular",l=i?Math.min(n.length,3):1;return r.jsx("div",{class:i?"grid gap-2.5":"flex flex-col gap-2.5",style:i?{gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`}:void 0,role:"radiogroup","aria-label":"Plans",children:n.map(a=>{const c=e.selectedPriceId===a.id,d=s.popular_price_id===a.id;return r.jsxs("button",{type:"button",role:"radio","aria-checked":c,onClick:()=>{e.setSelectedPriceId(a.id),e.onAction("price_selected",{priceId:a.id,price:a})},class:["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)]",i?"flex w-full flex-col items-start gap-1":"flex w-full items-center justify-between gap-3",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",d?"mt-2.5":""].join(" "),children:[d?r.jsx("span",{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",style:{background:"linear-gradient(135deg, var(--pw-accent), color-mix(in srgb, var(--pw-accent) 70%, black))"},children:o}):null,r.jsxs("div",{class:i?"flex w-full items-start gap-2.5":"flex flex-1 items-start gap-2.5",children:[r.jsx("span",{class:["mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border transition-colors",c?"border-[var(--pw-accent)] bg-[var(--pw-accent)]":"border-gray-300 bg-white group-hover:border-gray-400"].join(" "),"aria-hidden":"true",children:c?r.jsx("span",{class:"h-1.5 w-1.5 rounded-full bg-white"}):null}),r.jsxs("div",{class:"flex flex-col",children:[r.jsx("span",{class:"text-sm font-semibold text-gray-900",children:a.label??Z(a)}),a.description?r.jsx("span",{class:"text-xs leading-relaxed text-gray-500",children:a.description}):null,a.trial_days?r.jsxs("span",{class:"text-xs font-medium text-[var(--pw-accent)]",children:[a.trial_days,"-day free trial"]}):null]})]}),r.jsxs("div",{class:i?"mt-1 flex flex-col items-start":"flex flex-col items-end",children:[r.jsx("span",{class:"text-base font-semibold tracking-tight text-gray-900",children:Ee(a)}),r.jsx("span",{class:"text-[11px] text-gray-500",children:Z(a)})]})]},a.id)})})}function Te({block:s}){return r.jsx("p",{class:"text-[0.9375rem] leading-relaxed text-gray-600",children:s.text})}const Me={week:.25,month:1,year:12};function Pe(s){return s||"period"}function Be({block:s,ctx:e}){if(!s.queries.length)return null;const n=e.bootstrap.prices.find(o=>o.id===e.selectedPriceId)?.interval??null,i=n?Me[n]:void 0;return r.jsxs("div",{class:"flex flex-col gap-2",children:[r.jsxs("div",{class:"text-sm font-semibold text-gray-800",children:["Included per ",r.jsx("span",{children:Pe(n)}),":"]}),r.jsx("ul",{class:"flex flex-col gap-2",role:"list",children:s.queries.map(o=>{const l=Number.isFinite(o.count)?o.count:0,a=i!==void 0?Math.round(l*i):l;return r.jsxs("li",{class:`flex gap-2 ${o.desc?"":"items-center"}`,children:[r.jsx("span",{class:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full ${o.desc?"mt-0.5":""}`,style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 20 20",fill:"none",children:r.jsx("path",{d:"M5 10l3 3 7-7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),r.jsxs("div",{children:[r.jsx("span",{class:"font-semibold text-gray-900 text-sm",children:a})," ",r.jsx("span",{class:"text-sm text-gray-800",children:o.name}),o.desc?r.jsxs(r.Fragment,{children:[r.jsx("br",{}),r.jsx("span",{class:"text-xs text-gray-500",children:o.desc})]}):null]})]},o.id)})})]})}const Le={heading:Ie,text:Te,price_grid:Ae,cta_button:we,auth_panel:K,current_session:ve,features_list:je,tokenization_gate:Be};function Oe({layout:s,bootstrap:e,onAction:t,auth:n,authSession:i}){const o=h.useMemo(()=>e.prices[0]?.id??null,[e.prices]),[l,a]=h.useState(o),c={bootstrap:e,selectedPriceId:l,setSelectedPriceId:a,onAction:t,auth:n,authSession:i};return r.jsx("div",{class:"flex flex-col gap-4",children:s.blocks.map((d,g)=>{const y=Le[d.type];return y?r.jsx(y,{block:d,ctx:c},g):(typeof console<"u"&&console.warn(`[paywall] unknown block type: ${d.type}`),null)})})}function Ue(s,e,t,n){return s?n?{open:!0,view:"purchased",error:null}:e.status==="idle"||e.status==="loading"?{open:!0,view:"loading",error:null}:e.status==="error"?{open:!0,view:"error",error:e.error}:t.kind==="support"?{open:!0,view:"support",error:null}:t.kind==="auth_gate"?{open:!0,view:"auth",error:null}:t.kind==="anon_gate"?{open:!0,view:"anon",error:null}:t.kind==="awaiting_payment"?{open:!0,view:"awaiting_payment",error:null}:t.kind==="popup_blocked"?{open:!0,view:"popup_blocked",error:null}:t.kind==="purchase_success"?{open:!0,view:"purchased",error:null}:t.kind==="verifying"?{open:!0,view:"loading",error:null}:{open:!0,view:"layout",error:null}:{open:!1,view:null,error:null}}function Re(s,e){return s.open===e.open&&s.view===e.view&&s.error===e.error}function qe({client:s,open:e,onClose:t,onEvent:n,initialView:i,purchased:o,renew:l,onState:a}){const[c,d]=h.useState({status:"idle"}),[g,y]=h.useState(()=>s.auth?.getCachedSession()??null),[f,x]=h.useState(()=>i==="support"?{kind:"support",origin:"standalone"}:i==="auth"?{kind:"auth_gate",origin:"standalone"}:i==="anon"?{kind:"anon_gate",origin:"standalone"}:{kind:"layout"}),m=h.useRef(!1),j=h.useRef(null);h.useEffect(()=>{if(!a)return;const p=Ue(e,c,f,o),u=j.current;u&&Re(u,p)||(j.current=p,a(p))},[e,c,f,o,a]),h.useEffect(()=>{if(s.auth)return s.auth.onAuthChange(p=>y(p))},[s.auth]),h.useEffect(()=>{if(typeof s.onBootstrapChange=="function")return s.onBootstrapChange(p=>{d(u=>u.status==="ready"?{status:"ready",data:p}:u)})},[s]),h.useEffect(()=>{if(!e||c.status==="ready"||c.status==="loading")return;let p=!1;return d({status:"loading"}),s.bootstrap().then(u=>{p||(d({status:"ready",data:u}),n("ready",u),u.user?.has_active_subscription&&!l&&(n("purchase_completed",{priceId:null,sessionId:null,restored:!0}),x({kind:"purchase_success",restored:!0})))}).catch(u=>{if(p)return;const b=u instanceof k.PaywallError?u:new k.PaywallError("unknown","Failed to load paywall",{cause:u});d({status:"error",error:b}),n("error",b)}),()=>{p=!0}},[e,s]),h.useEffect(()=>{if(!e){x({kind:"layout"}),m.current=!1;return}i==="support"?x({kind:"support",origin:"standalone"}):i==="auth"?x({kind:"auth_gate",origin:"standalone"}):i==="anon"&&x({kind:"anon_gate",origin:"standalone"})},[e,i]);const I=async p=>{try{const u=await s.createCheckout({priceId:p,ignoreActivePurchase:l===!0});if(n("checkout_started",{priceId:p,url:u.url,acquiring:u.acquiring}),typeof window>"u"||!u.url)return;const b=window.open(u.url,"_blank");if(b){try{b.opener=null}catch{}x({kind:"awaiting_payment",priceId:p,url:u.url})}else x({kind:"popup_blocked",priceId:p,url:u.url})}catch(u){if(u instanceof k.PaywallError&&u.code==="already_purchased"){try{await s.getUser({force:!0})}catch{}n("purchase_completed",{priceId:p,sessionId:null,restored:!0}),x({kind:"purchase_success",restored:!0});return}const b=u instanceof k.PaywallError?u:new k.PaywallError("checkout_failed","Checkout failed",{cause:u});n("error",b),x({kind:"layout"})}},v=(p,u)=>{if(typeof window>"u")return;const b=window.open(u,"_blank");if(b){try{b.opener=null}catch{}x({kind:"awaiting_payment",priceId:p,url:u})}};h.useEffect(()=>{if(f.kind!=="auth_gate"||!g||g.user.is_anonymous||m.current)return;m.current=!0;const p=f.pendingCheckout,u=f.origin;x({kind:"verifying"}),(async()=>{if(!l)try{if((await s.getUser({force:!0})).has_active_subscription){n("purchase_completed",{priceId:p?.priceId??null,sessionId:null,restored:!0}),x({kind:"purchase_success",restored:!0});return}}catch{}if(!p){u==="standalone"?t():x({kind:"layout"});return}await I(p.priceId)})().finally(()=>{m.current=!1})},[g,f]);const _=async(p,u)=>{if(p==="close"){t();return}if(p==="price_selected"){n("price_selected",u);return}if(p==="restore"){if(!s.auth||s.auth.getCachedSession())return;x({kind:"auth_gate"});return}if(p==="support"){x({kind:"support",origin:"layout"});return}if(p==="checkout"&&c.status==="ready"){const b=u?.priceId;if(!b){n("error",new k.PaywallError("no_price","No price selected"));return}if((c.data.settings.checkout_mode??"guest")==="preauth"&&!!s.auth&&!s.auth.getCachedSession()){x({kind:"auth_gate",pendingCheckout:{priceId:b}});return}await I(b)}},w=c.status==="ready"?c.data.settings.brand_color:null,A=c.status==="ready"?!!c.data.settings.is_test_mode:!1,T=c.status==="ready"?c.data.settings.allow_close!==!1:!0,S={type:"auth_panel",heading:"Sign in to continue",allow_signup:!0,allow_password_reset:!0,hide_when_authenticated:!1,providers:c.status==="ready"?c.data.settings.auth_providers:void 0},C=f.kind==="support"?r.jsx(ye,{client:s,authSession:g,origin:f.origin,onBack:()=>{f.origin==="standalone"?t():x({kind:"layout"})}}):null;return r.jsx(le,{open:e,onClose:t,brandColor:w,testMode:A,allowClose:T,labelledBy:"pw-title",children:o?r.jsx(X,{onContinue:t}):f.kind==="purchase_success"?r.jsx(X,{restored:f.restored,onContinue:t}):C||(c.status==="loading"||c.status==="idle"||f.kind==="verifying"?r.jsxs("div",{class:"flex flex-col items-center justify-center gap-3 py-12",children:[r.jsx("span",{class:"inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]"}),r.jsx("span",{class:"text-xs font-medium tracking-wide text-gray-500",children:f.kind==="verifying"?"Checking your subscription…":"Loading…"})]}):c.status==="error"?r.jsxs("div",{class:"flex flex-col items-center gap-2 py-8 text-center",children:[r.jsx("div",{class:"flex h-11 w-11 items-center justify-center rounded-full bg-red-50",children:r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[r.jsx("path",{d:"M10 6v5M10 14h.01",stroke:"#dc2626","stroke-width":"2","stroke-linecap":"round"}),r.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"#dc2626","stroke-width":"1.75"})]})}),r.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Something went wrong"}),r.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:c.error.message})]}):f.kind==="auth_gate"&&s.auth?r.jsx(fe,{block:S,bootstrap:c.data,auth:s.auth,authSession:g,showBack:f.origin!=="standalone",onBack:()=>{f.origin==="standalone"?t():x({kind:"layout"})}}):f.kind==="anon_gate"&&s.auth?r.jsx(ge,{auth:s.auth,onSuccess:()=>{f.origin==="standalone"?t():x({kind:"layout"})},onBack:f.origin==="standalone"?void 0:()=>x({kind:"layout"})}):f.kind==="awaiting_payment"?r.jsx(ze,{client:s,onBack:()=>x({kind:"layout"}),onReopen:()=>{if(typeof window>"u")return;const p=window.open(f.url,"_blank");if(p)try{p.opener=null}catch{}},onRetry:()=>I(f.priceId)}):f.kind==="popup_blocked"?r.jsxs("div",{class:"flex flex-col items-center gap-3 py-8 text-center",children:[r.jsx("div",{class:"flex h-11 w-11 items-center justify-center rounded-full",style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[r.jsx("path",{d:"M4 5h12v10H4z",stroke:"currentColor","stroke-width":"1.75","stroke-linejoin":"round"}),r.jsx("path",{d:"M7 9l3 3 4-5",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"})]})}),r.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Allow popups to continue"}),r.jsx("p",{class:"max-w-[18rem] text-xs leading-relaxed text-gray-500",children:"Your browser blocked the checkout tab. Click below to open it."}),r.jsx("button",{type:"button",onClick:()=>v(f.priceId,f.url),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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Open checkout"})]}):r.jsx(Oe,{layout:c.data.layout,bootstrap:c.data,onAction:_,auth:s.auth,authSession:g}))})}function ze({client:s,onBack:e,onReopen:t,onRetry:n}){const[i,o]=h.useState(!1),[l,a]=h.useState(!1),c=h.useRef(null);h.useEffect(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);const d=async()=>{if(!i){o(!0),a(!1);try{if((await s.getUser({force:!0})).has_active_subscription){typeof window<"u"&&window.postMessage({type:"paywall_purchase"},"*");return}a(!0),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>{a(!1),c.current=null},5e3)}catch{a(!0)}finally{o(!1)}}};return r.jsxs("div",{class:"flex flex-col gap-3",children:[r.jsx("button",{type:"button",onClick:e,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)]",children:"← Back"}),r.jsxs("div",{class:"flex flex-col items-center gap-3 py-6 text-center",children:[r.jsxs("div",{class:"relative flex h-12 w-12 items-center justify-center",children:[r.jsx("span",{class:"absolute inset-0 animate-ping rounded-full opacity-40",style:{background:"color-mix(in srgb, var(--pw-accent) 30%, transparent)"},"aria-hidden":"true"}),r.jsx("span",{class:"relative inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]"})]}),r.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Complete payment in the new tab"}),r.jsx("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."}),r.jsx("button",{type:"button",onClick:d,disabled:i,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:i?"Checking…":"I've paid"}),l?r.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:"Payment is still being processed. Please try again in a moment."}):null]}),r.jsxs("div",{class:"rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5",children:[r.jsx("p",{class:"text-xs leading-relaxed text-gray-600",children:"Checkout window didn't open or got blocked? Click here to open it again."}),r.jsx("button",{type:"button",onClick:t,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)]",children:"Open checkout again"})]}),r.jsx("button",{type:"button",onClick:n,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)]",children:"Tab closed? Try again"})]})}function X({onContinue:s,restored:e=!1}){return r.jsxs("div",{class:"flex flex-col items-center gap-3 py-8 text-center",children:[r.jsx("div",{class:"flex h-14 w-14 items-center justify-center rounded-full ring-8",style:{background:"linear-gradient(135deg, #4ade80, #16a34a)",color:"#fff",boxShadow:"0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"},"aria-hidden":"true",children:r.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",children:r.jsx("path",{d:"M5 13l4 4L19 7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),r.jsx("p",{id:"pw-title",class:"mt-1 text-lg font-semibold tracking-tight text-gray-900",children:e?"Subscription restored":"Payment received"}),r.jsx("p",{class:"text-sm leading-relaxed text-gray-500",children:e?"Welcome back — your subscription is already active.":"Your subscription is now active."}),r.jsx("button",{type:"button",onClick:s,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Continue"})]})}const Ve=10*6e4,De=5e3,Fe=3e4;class Ne{constructor(e){this.timer=null,this.timeoutTimer=null,this.visibilityHandler=null,this.focusHandler=null,this.messageHandler=null,this.stopped=!1,this.checking=!1,this.opts={client:e.client,onActive:e.onActive,onTimeout:e.onTimeout??(()=>{}),timeoutMs:e.timeoutMs??Ve,visibleIntervalMs:e.visibleIntervalMs??De,hiddenIntervalMs:e.hiddenIntervalMs??Fe}}start(){this.stopped||typeof document>"u"||typeof window>"u"||(this.check(),this.scheduleNext(),this.visibilityHandler=()=>this.handleVisibilityChange(),document.addEventListener("visibilitychange",this.visibilityHandler),this.focusHandler=()=>void this.check(),window.addEventListener("focus",this.focusHandler),this.messageHandler=e=>this.handleMessage(e),window.addEventListener("message",this.messageHandler),this.timeoutTimer=setTimeout(()=>{this.stopped||(this.stop(),this.opts.onTimeout())},this.opts.timeoutMs))}stop(){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}async check(){if(!(this.stopped||this.checking)){this.checking=!0;try{const e=await this.opts.client.getUser({force:!0});if(this.stopped)return;e.has_active_subscription&&(this.stop(),this.opts.onActive(e))}catch{}finally{this.checking=!1}}}scheduleNext(){if(this.stopped)return;const t=typeof document<"u"&&document.visibilityState==="visible"?this.opts.visibleIntervalMs:this.opts.hiddenIntervalMs;this.timer=setTimeout(async()=>{await this.check(),this.scheduleNext()},t)}handleVisibilityChange(){typeof document>"u"||(document.visibilityState==="visible"&&this.check(),this.timer!==null&&(clearTimeout(this.timer),this.timer=null),this.scheduleNext())}handleMessage(e){const t=e.data;!t||typeof t!="object"||t.type==="paywall_purchase"&&this.check()}}function $e(){return!(typeof document>"u"||typeof window>"u"||typeof location<"u"&&location.protocol==="chrome-extension:")}const V={open:!1,view:null,error:null},E={status:"paywall_status",priceId:"paywall_price_id",sessionId:"paywall_session_id"};let He=class{constructor(e){this.handle=null,this.isOpen=!1,this.listeners=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=V,this.stateListeners=new Set;const{auth:t,ownsAuth:n}=Ge(e);this.auth=t,this.ownsAuth=n,this.billing=e.client??new k.BillingClient({...e,auth:this.auth}),this.host=e.host,this.shadowMode=e.shadowMode??"closed",this.mountThenLoad=e.mountThenLoad??!0,this.userUnsub=this.billing.onUserChange(i=>{this.emit("userChange",i)}),this.auth&&(this.authUnsub=this.auth.onAuthChange(i=>{this.emit("authChange",i)})),this.initTracker(e.analytics),e.autoDetectReturn!==!1&&typeof window<"u"&&queueMicrotask(()=>this.checkReturn())}initTracker(e){if(e===!1)return;const t=typeof e=="object"&&e!==null?e:{};if(t.enabled===!1)return;const n=t.endpoint??`${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;this.tracker=new k.EventTracker({endpoint:n,paywallId:this.billing.paywallId,capabilities:this.billing.capabilities,getVisitorId:()=>this.billing.getVisitorId(),getCachedVisitorId:()=>this.billing.getCachedVisitorId(),getUserId:()=>this.billing.getIdentity()?.userId??null,flushIntervalMs:t.flushIntervalMs,maxBufferSize:t.maxBufferSize,fetch:t.fetch,sendBeacon:t.sendBeacon}),this.on("open",()=>this.tracker?.track("paywall_opened")),this.on("ready",i=>this.tracker?.track("paywall_viewed",{is_test_mode:i.settings.is_test_mode,prices_count:i.prices.length,offers_count:i.offers.length})),this.on("price_selected",i=>this.tracker?.track("price_selected",{price_id:i.priceId})),this.on("checkout_started",i=>this.tracker?.track("checkout_started",{price_id:i.priceId,acquiring:i.acquiring})),this.on("purchase_completed",i=>this.tracker?.track("purchase_completed",{price_id:i.priceId,session_id:i.sessionId})),this.on("purchase_failed",i=>this.tracker?.track("purchase_failed",{reason:i.reason})),this.on("close",()=>this.tracker?.track("paywall_closed")),this.on("trial_blocked",i=>this.tracker?.track("trial_blocked",{mode:i.mode,...i.mode==="time"?{remaining_ms:i.remainingMs,total_ms:i.totalMs}:i.mode==="opens"?{remaining_actions:i.remainingActions,total_actions:i.totalActions}:{}})),this.on("trial_expired",()=>this.tracker?.track("trial_expired")),this.on("visibility_blocked",i=>this.tracker?.track("visibility_blocked",{reason:i.reason,country:i.country,tier:i.tier})),this.on("error",i=>this.tracker?.track("error",{code:i.code,message:i.message}))}track(e,t){this.tracker?.track(e,t)}onUserChange(e){return this.on("userChange",e)}setBootstrap(e){this.billing.setBootstrap(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,...t){const n=this.listeners.get(e);if(!n)return;const i=t[0];for(const o of n)try{o(i)}catch(l){typeof console<"u"&&console.error("[paywall] listener error",l)}}open(e={}){this.openInternal("layout",e)}async preload(e={}){try{await this.billing.bootstrap({signal:e.signal}),this.billing.auth&&await this.billing.getBalances({signal:e.signal})}catch{}}openSupport(e={}){this.openInternal("support",e)}openAuth(e={}){this.auth&&this.openInternal("auth",{...e,skipTrial:!0})}openAnonGate(e={}){this.auth&&this.openInternal("anon",{...e,skipTrial:!0,skipVisibility:!0})}openInternal(e,t){t.identity&&this.billing.setIdentity(t.identity),this.purchased=!1;const n=t.skipTrial===!0||e==="support",i=t.skipVisibility===!0||e==="support"||e==="auth"||e==="anon",o=t.renew===!0;if(n&&i){this.mountAndShow(e,{renew:o});return}const l=this.billing.getCachedBootstrap();if(l){this.runOpenGates(e,l,{skipTrial:n,skipVisibility:i,renew:o});return}if(this.mountThenLoad){this.mountAndShow(e,{renew:o}),this.billing.bootstrap().then(a=>this.runDelayedGates(a,{skipTrial:n,skipVisibility:i})).catch(()=>{});return}this.billing.bootstrap().then(a=>this.runOpenGates(e,a,{skipTrial:n,skipVisibility:i,renew:o})).catch(()=>{this.mountAndShow(e,{renew:o})})}runDelayedGates(e,t){if(!this.isOpen)return;if(!t.skipVisibility){const o=e.settings.visibility;if(o&&(this.lastVisibility=o,!o.visible)){this.close(),this.emit("visibility_blocked",o);return}}if(t.skipTrial)return;const n=e.settings.trial;if(!n)return;const i=this.ensureTrialStore(n);i.check().then(async o=>{if(this.isOpen&&(this.lastTrialStatus=o,o.mode!=="none")){if(o.blocked){const l=await i.recordBlock();if(this.lastTrialStatus=l,!this.isOpen)return;this.close(),this.emit("trial_blocked",l);return}this.trialExpiredFired||(this.trialExpiredFired=!0,this.emit("trial_expired"))}}).catch(o=>{typeof console<"u"&&console.warn("[paywall] trial check failed",o)})}runOpenGates(e,t,n){if(!n.skipVisibility){const i=t.settings.visibility;if(i&&(this.lastVisibility=i,!i.visible)){this.emit("visibility_blocked",i);return}}if(n.skipTrial){this.mountAndShow(e,{renew:n.renew});return}this.gateThroughTrial(e,t,n.renew)}gateThroughTrial(e,t,n){const i=t.settings.trial;if(!i){this.mountAndShow(e,{renew:n});return}const o=this.ensureTrialStore(i);o.check().then(async l=>{if(this.lastTrialStatus=l,l.mode==="none"){this.mountAndShow(e,{renew:n});return}if(l.blocked){const a=await o.recordBlock();this.lastTrialStatus=a,this.emit("trial_blocked",a);return}this.trialExpiredFired||(this.trialExpiredFired=!0,this.emit("trial_expired")),this.mountAndShow(e,{renew:n})}).catch(l=>{typeof console<"u"&&console.warn("[paywall] trial check failed",l),this.mountAndShow(e,{renew:n})})}ensureTrialStore(e){if(this.trialStore&&this.trialStoreConfig&&Xe(this.trialStoreConfig,e))return this.trialStore;this.trialStoreConfig=e;const t=this.billing.createTrialStore;return this.trialStore=typeof t=="function"?t.call(this.billing,e):k.createTrialStore(this.billing.getStorage(),this.billing.paywallId,e),this.trialStore}mountAndShow(e,t={}){const n=t.renew===!0;if(this.handle){this.isOpen=!0,this.handle.update({open:!0,initialView:e,purchased:!1,renew:n}),this.emit("open");return}this.isOpen=!0,this.handle=oe(qe,{client:this.billing,open:!0,initialView:e,purchased:!1,renew:n,onClose:()=>this.close(),onEvent:(i,o)=>{this.emit(i,o),i==="checkout_started"&&this.startUserWatcher()},onState:i=>this.applyState(i)},{host:this.host,shadowMode:this.shadowMode}),this.emit("open")}applyState(e){if(!Ze(this.currentState,e)){this.currentState=e;for(const t of this.stateListeners)try{t(e)}catch(n){console.warn("[paywall] onStateChange listener threw",n)}}}getState(){return this.currentState}onStateChange(e,t={}){this.stateListeners.add(e);const n=t.immediate??"microtask";if(n!=="none"){const i=this.currentState;if(n==="sync")try{e(i)}catch(o){console.warn("[paywall] onStateChange initial sync threw",o)}else queueMicrotask(()=>{this.stateListeners.has(e)&&e(i)})}return()=>{this.stateListeners.delete(e)}}getTrialStatus(){return this.lastTrialStatus}getVisibility(){return this.lastVisibility}getPrices(e={}){return this.billing.getPrices(e)}getCachedPrices(){return this.billing.getCachedPrices()}getUserLanguage(){return this.billing.getUserLanguage()}async getAccess(e={}){let t=this.billing.getCachedBootstrap();if(!t)try{t=await this.billing.bootstrap({signal:e.signal})}catch{const l=this.billing.getCachedUser();return l?.has_active_subscription?{access:"granted",reason:"has_subscription",visibility:null,trial:null,user:l}:{access:"blocked",reason:"no_subscription",visibility:null,trial:null,user:l}}const n=t.user??null;if(n?.has_active_subscription)return{access:"granted",reason:"has_subscription",visibility:t.settings.visibility??null,trial:null,user:n};let i=null;if(!e.skipVisibility){const l=t.settings.visibility;if(l&&(i=l,this.lastVisibility=l,!l.visible))return{access:"granted",reason:"visibility_blocked",visibility:i,trial:null,user:n}}let o=null;if(!e.skipTrial){const l=t.settings.trial;if(l)try{if(o=await this.ensureTrialStore(l).check(),this.lastTrialStatus=o,o.blocked)return{access:"granted",reason:"trial_blocked",visibility:i,trial:o,user:n}}catch(a){typeof console<"u"&&console.warn("[paywall] getAccess: trial check failed",a)}}return{access:"blocked",reason:"no_subscription",visibility:i,trial:o,user:n}}async resetTrial(){this.trialStore&&(await this.trialStore.reset(),this.lastTrialStatus=null,this.trialExpiredFired=!1)}startUserWatcher(){this.watcher||$e()&&(this.watcher=new Ne({client:this.billing,onActive:e=>{this.watcher=null,this.emit("purchase_completed",{priceId:null,sessionId:null});const t=this.billing.getCachedBootstrap()?.settings.success_redirect_url;if(t&&typeof window<"u")try{window.location.assign(t);return}catch{}this.isOpen&&this.handle&&(this.purchased=!0,this.handle.update({purchased:!0}))},onTimeout:()=>{this.watcher=null}}),this.watcher.start())}close(){!this.isOpen||!this.handle||(this.isOpen=!1,this.purchased=!1,this.handle.update({open:!1,purchased:!1}),this.applyState(V),this.emit("close"))}checkReturn(){if(typeof window>"u")return;const e=new URL(window.location.href),t=Y(e.hash.replace(/^#/,"")),n=Y(e.search.replace(/^\?/,"")),i=t??n;i&&(i.status==="paid"?(this.emit("purchase_completed",{priceId:i.priceId,sessionId:i.sessionId}),Ye(i)):(i.status==="failed"||i.status==="cancelled")&&this.emit("purchase_failed",{reason:i.status}),Je(e))}destroy(){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=V}};function Ge(s){if(!s.auth)return{auth:void 0,ownsAuth:!1};if(s.auth instanceof k.AuthClient||We(s.auth))return{auth:s.auth,ownsAuth:!1};const e=s.auth===!0?{}:s.auth;return{auth:new k.AuthClient({paywallId:s.paywallId,apiOrigin:e.apiOrigin??s.apiOrigin,storage:e.storage??s.storage,fetch:e.fetch??s.fetch,openPopup:e.openPopup}),ownsAuth:!0}}function We(s){if(typeof s!="object"||s===null)return!1;const e=s;return typeof e.onAuthChange=="function"&&typeof e.getCachedSession=="function"&&typeof e.signOut=="function"}function Ze(s,e){return s.open===e.open&&s.view===e.view&&s.error===e.error}function Xe(s,e){return s.mode===e.mode&&s.payload===e.payload&&s.storage===e.storage}function Y(s){if(!s)return null;const e=new URLSearchParams(s),t=e.get(E.status);return t?{status:t,priceId:e.get(E.priceId),sessionId:e.get(E.sessionId)}:null}function Ye(s){if(!(typeof window>"u"||!window.opener))try{window.opener.postMessage({type:"paywall_purchase",status:s.status,priceId:s.priceId,sessionId:s.sessionId},"*")}catch{}}function Je(s){const e=(n,i)=>{if(!n)return"";const o=new URLSearchParams(n.replace(/^[?#]/,""));o.delete(E.status),o.delete(E.priceId),o.delete(E.sessionId);const l=o.toString();return l?i+l:""},t=s.pathname+e(s.search,"?")+e(s.hash,"#");window.history.replaceState(null,"",t)}class Ke{constructor(e,t,n){this.transport=e,this.paywallId=t,this.config=n}async check(){return this.transport.request("trial.check",{paywallId:this.paywallId,config:this.config})}async recordBlock(){return this.transport.request("trial.recordBlock",{paywallId:this.paywallId,config:this.config})}async reset(){await this.transport.request("trial.reset",{paywallId:this.paywallId,config:this.config})}}class ee{constructor(e,t){this.transport=e,this.cachedBootstrap=null,this.cachedUser=null,this.cachedBalances=null,this.identity=null,this.userListeners=new Set,this.balanceListeners=new Set,this.unsubUserBroadcast=null,this.unsubBalancesBroadcast=null,this.paywallId=t.paywallId,this.apiOrigin=t.apiOrigin,this.remoteStorageAdapter={getItem:n=>this.transport.request("storage.get",{key:n}),setItem:async(n,i)=>{await this.transport.request("storage.set",{key:n,value:i})},removeItem:async n=>{await this.transport.request("storage.remove",{key:n})}},this.unsubUserBroadcast=this.transport.on("userChange",n=>{this.applyUser(n)}),this.unsubBalancesBroadcast=this.transport.on("balancesChange",n=>{this.applyBalances([...n])})}async bootstrap(e={}){const t=await this.transport.request("billing.bootstrap",{force:e.force},{signal:e.signal});return this.cachedBootstrap=t,t.user&&this.applyUser(t.user),t}getCachedBootstrap(){return this.cachedBootstrap}async getPrices(e={}){return(await this.bootstrap(e)).prices}getCachedPrices(){return this.cachedBootstrap?.prices??null}async getVisitorId(){return this.transport.request("billing.getVisitorId",void 0)}async getUser(e={}){const t=await this.transport.request("billing.getUser",{force:e.force},{signal:e.signal});return this.applyUser(t),t}getCachedUser(){return this.cachedUser}onUserChange(e,t={}){this.userListeners.add(e);const n=t.immediate??"microtask";if(this.cachedUser&&n!=="none"){const i=this.cachedUser;if(n==="sync")try{e(i)}catch(o){console.warn("[paywall] onUserChange initial sync threw",o)}else queueMicrotask(()=>{this.userListeners.has(e)&&e(i)})}return()=>{this.userListeners.delete(e)}}async getBalances(e={}){const n=[...await this.transport.request("billing.getBalances",{force:e.force},{signal:e.signal})];return this.applyBalances(n),n}getCachedBalances(){return this.cachedBalances}onBalanceChange(e,t={}){this.balanceListeners.add(e);const n=t.immediate??"microtask";if(this.cachedBalances&&n!=="none"){const i=this.cachedBalances;if(n==="sync")try{e(i)}catch(o){console.warn("[paywall] onBalanceChange initial sync threw",o)}else queueMicrotask(()=>{this.balanceListeners.has(e)&&e(i)})}return()=>{this.balanceListeners.delete(e)}}async createCheckout(e){const{signal:t,...n}=e;return this.transport.request("billing.createCheckout",n,{signal:t})}async listPurchases(e={}){return[...await this.transport.request("billing.listPurchases",void 0,{signal:e.signal})]}async cancelSubscription(e){const{signal:t,...n}=e;return this.transport.request("billing.cancelSubscription",n,{signal:t})}getStorage(){return this.remoteStorageAdapter}createTrialStore(e){return new Ke(this.transport,this.paywallId,e)}getIdentity(){return this.identity}async setIdentity(e){this.identity=e,await this.transport.request("billing.setIdentity",{identity:e})}async syncIdentity(){const e=await this.transport.request("billing.getIdentity",void 0);return this.identity=e,e}destroy(){this.unsubUserBroadcast?.(),this.unsubBalancesBroadcast?.(),this.unsubUserBroadcast=null,this.unsubBalancesBroadcast=null,this.userListeners.clear(),this.balanceListeners.clear(),this.cachedBootstrap=null,this.cachedUser=null,this.cachedBalances=null,this.identity=null}applyUser(e){Qe(this.cachedUser,e)||(this.cachedUser=e,this.fireUserListeners(e))}applyBalances(e){et(this.cachedBalances,e)||(this.cachedBalances=e,this.fireBalanceListeners(e))}fireUserListeners(e){for(const t of[...this.userListeners])try{t(e)}catch(n){console.warn("[paywall] onUserChange listener threw",n)}}fireBalanceListeners(e){for(const t of[...this.balanceListeners])try{t(e)}catch(n){console.warn("[paywall] onBalanceChange listener threw",n)}}}function Qe(s,e){return s===e?!0:!s||!e?!1:s.has_active_subscription===e.has_active_subscription&&(s.purchases?.length??0)===(e.purchases?.length??0)}function et(s,e){if(s===e)return!0;if(!s||!e||s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t].type!==e[t].type||s[t].count!==e[t].count)return!1;return!0}class te{constructor(e,t){this.transport=e,this.session=null,this.listeners=new Set,this.unsubBroadcast=null,this.paywallId=t.paywallId,this.apiOrigin=t.apiOrigin,this.unsubBroadcast=this.transport.on("authChange",n=>{this.applySession(n)}),this.hydrated=this.transport.request("auth.getCachedSession",void 0).then(n=>{this.session===null&&n!==null&&this.applySession(n)}).catch(()=>{})}ready(){return this.hydrated}getCachedSession(){return this.session}getCachedUser(){return this.session?.user??null}onAuthChange(e){if(this.listeners.add(e),this.session){const t=this.session;queueMicrotask(()=>{this.listeners.has(e)&&e(t)})}return()=>{this.listeners.delete(e)}}async signInWithEmail(e){const t=await this.transport.request("auth.signInWithEmail",e);return this.applySession(t),t}async signUp(e){const t=await this.transport.request("auth.signUp",e);return t.kind==="signed_in"&&this.applySession(t.session),t}async signOut(){await this.transport.request("auth.signOut",void 0)}async refresh(){const e=await this.transport.request("auth.refresh",void 0);return this.applySession(e),e}async sendOtp(e){await this.transport.request("auth.sendOtp",e)}async verifyOtp(e){const t=await this.transport.request("auth.verifyOtp",e);return this.applySession(t),t}async resendConfirmation(e){await this.transport.request("auth.resendConfirmation",e)}async requestPasswordReset(e){await this.transport.request("auth.requestPasswordReset",e)}async updatePassword(e){await this.transport.request("auth.updatePassword",e)}async revokeAllSessions(){await this.transport.request("auth.revokeAllSessions",void 0)}async signInAnonymously(e={}){const t=await this.transport.request("auth.signInAnonymously",{captchaToken:e.captchaToken,userMeta:e.userMeta,forceCaptcha:e.forceCaptcha});return this.applySession(t),t}async getAccessToken(){return this.transport.request("auth.getAccessToken",void 0)}async signInWithOAuth(e){if(typeof window>"u")throw new k.PaywallError("oauth_unavailable","window is required for OAuth");const t=`pw-oauth-pending-${Math.random().toString(36).slice(2,10)}`,n=window.open("about:blank",t,"width=480,height=640,popup=yes");if(!n)throw new k.PaywallError("popup_blocked","browser blocked auth popup — call from a user gesture");st(n,e.provider);try{const{authorizeUrl:i,state:o}=await this.transport.request("auth.oauthStart",{provider:e.provider,scopes:e.scopes,userMeta:e.userMeta});n.name=`pw-oauth-${o}`,n.location.replace(i),e.onPopupOpened?.();const l=await k.waitForOAuthCode(n,o),a=await this.transport.request("auth.oauthExchange",{state:o,code:l});return this.applySession(a),a}catch(i){try{n.close()}catch{}throw i}}destroy(){this.unsubBroadcast?.(),this.unsubBroadcast=null,this.listeners.clear(),this.session=null}applySession(e){if(!tt(this.session,e)){this.session=e;for(const t of[...this.listeners])try{t(e)}catch(n){console.warn("[paywall] onAuthChange listener threw",n)}}}}function tt(s,e){return s===e?!0:!s||!e?!1:s.access_token===e.access_token&&s.refresh_token===e.refresh_token&&s.expires_at===e.expires_at&&s.user.id===e.user.id}const rt={google:"Google",apple:"Apple",github:"GitHub",facebook:"Facebook"};function st(s,e){const t=rt[e]??e;try{const n=s.document;n.title=`Sign in with ${t}`;const i=n.createElement("style");i.textContent="html,body{margin:0;padding:0;height:100%;font-family:-apple-system,system-ui,sans-serif;background:#fafafa;color:#475569}.pw-oauth-wrap{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:16px}.pw-oauth-spinner{width:36px;height:36px;border:3px solid #e2e8f0;border-top-color:#7c3aed;border-radius:50%;animation:pw-oauth-spin 800ms linear infinite}.pw-oauth-label{font-size:14px;font-weight:500;letter-spacing:-0.01em}@keyframes pw-oauth-spin{to{transform:rotate(360deg)}}",n.head.appendChild(i);const o=n.createElement("div");o.className="pw-oauth-wrap";const l=n.createElement("div");l.className="pw-oauth-spinner";const a=n.createElement("div");a.className="pw-oauth-label",a.textContent=`Connecting to ${t}…`,o.appendChild(l),o.appendChild(a),n.body.appendChild(o)}catch{}}class re{constructor(e){this.transport=e}track(e,t){typeof e!="string"||e.length===0||this.transport.request("tracker.track",{name:e,props:t}).catch(n=>{console.warn("[paywall] track failed",n)})}}class nt{constructor(e){this.factory=e,this.channel=null,this.channelDisposers=[],this.pending=new Map,this.listeners=new Map,this.destroyed=!1,this.nextId=0,this.clientId=`c-${Math.random().toString(36).slice(2,10)}`}ensureChannel(){if(this.destroyed)throw new Error("TransportClient destroyed");if(this.channel)return this.channel;const e=this.factory();this.channel=e;const t=e.onMessage(i=>this.handleMessage(i)),n=e.onDisconnect(()=>this.handleDisconnect());return this.channelDisposers=[t,n],this.request("handshake",{protocolVersion:k.PROTOCOL_VERSION,clientId:this.clientId}).then(i=>{i.protocolVersion!==k.PROTOCOL_VERSION&&console.warn(`[sdk-extension] protocol version mismatch: client=${k.PROTOCOL_VERSION}, offscreen=${i.protocolVersion}. Update host's @monetize.software/sdk-extension.`)}).catch(()=>{}),e}handleMessage(e){if(ot(e)){if(e.type==="response"){const t=this.pending.get(e.id);if(!t)return;this.pending.delete(e.id),t.signal?.removeEventListener("abort",t.abortListener),e.ok?t.resolve(e.result):t.reject(k.reconstructError(e.error));return}if(e.type==="event"){const t=this.listeners.get(e.kind);if(!t)return;for(const n of[...t])try{n(e.payload)}catch(i){console.error("[sdk-extension] event handler threw",i)}}}}handleDisconnect(){for(const t of this.channelDisposers)t();this.channelDisposers=[],this.channel=null;const e=Array.from(this.pending.values());this.pending.clear();for(const t of e)t.signal?.removeEventListener("abort",t.abortListener),t.reject(new it)}request(e,t,n={}){if(this.destroyed)return Promise.reject(new Error("TransportClient destroyed"));if(n.signal?.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));const i=this.ensureChannel(),o=`r${++this.nextId}`;return new Promise((l,a)=>{const c={resolve:l,reject:a,signal:n.signal};n.signal&&(c.abortListener=()=>{if(this.pending.delete(o)){a(new DOMException("Aborted","AbortError"));try{i.send({type:"cancel",id:o})}catch{}}},n.signal.addEventListener("abort",c.abortListener)),this.pending.set(o,c);const d={type:"request",id:o,kind:e,params:t};try{i.send(d)}catch(g){this.pending.delete(o),n.signal?.removeEventListener("abort",c.abortListener),a(g)}})}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n));const i=t;return n.add(i),this.ensureChannel(),()=>{n.delete(i)}}destroy(){if(this.destroyed)return;this.destroyed=!0;for(const t of this.channelDisposers)t();this.channelDisposers=[],this.listeners.clear();const e=Array.from(this.pending.values());this.pending.clear();for(const t of e)t.signal?.removeEventListener("abort",t.abortListener),t.reject(new Error("TransportClient destroyed"));this.channel?.close(),this.channel=null}}class it extends Error{constructor(){super("Transport channel disconnected mid-request"),this.code="transport_disconnected",this.name="TransportDisconnectedError"}}function ot(s){if(typeof s!="object"||s===null)return!1;const e=s.type;return e==="request"||e==="response"||e==="event"}let O=null;function se(){return O||(O=new nt(()=>k.createRuntimeChannel(ne.PORT_NAME)),O)}class lt extends He{constructor(e){const t=se(),n=new ee(t,{paywallId:e.paywallId,apiOrigin:e.apiOrigin});let i;e.auth===!0?i=new te(t,{paywallId:e.paywallId,apiOrigin:e.apiOrigin}):e.auth&&console.warn("[sdk-extension] passing AuthClient instance to PaywallUI.opts.auth is not supported in extension mode — pass `auth: true` to use offscreen-shared auth, or omit for hybrid identity-only mode."),i&&(n.auth=i),super({...e,client:n,auth:i,analytics:!1}),this.remoteTracker=null,this.trackerUnsubs=[],e.analytics!==!1&&(this.remoteTracker=new re(t),this.bindAnalytics())}bindAnalytics(){const e=this.remoteTracker;e&&this.trackerUnsubs.push(this.on("open",()=>e.track("paywall_opened")),this.on("ready",t=>e.track("paywall_viewed",{is_test_mode:t.settings.is_test_mode,prices_count:t.prices.length,offers_count:t.offers.length})),this.on("price_selected",t=>e.track("price_selected",{price_id:t.priceId})),this.on("checkout_started",t=>e.track("checkout_started",{price_id:t.priceId,acquiring:t.acquiring})),this.on("purchase_completed",t=>e.track("purchase_completed",{price_id:t.priceId,session_id:t.sessionId})),this.on("purchase_failed",t=>e.track("purchase_failed",{reason:t.reason})),this.on("close",()=>e.track("paywall_closed")),this.on("trial_blocked",t=>e.track("trial_blocked",{mode:t.mode,...t.mode==="time"?{remaining_ms:t.remainingMs,total_ms:t.totalMs}:t.mode==="opens"?{remaining_actions:t.remainingActions,total_actions:t.totalActions}:{}})),this.on("trial_expired",()=>e.track("trial_expired")),this.on("visibility_blocked",t=>e.track("visibility_blocked",{reason:t.reason,country:t.country,tier:t.tier})),this.on("error",t=>e.track("error",{code:t.code,message:t.message})))}track(e,t){this.remoteTracker?.track(e,t)}destroy(){for(const e of this.trackerUnsubs)e();this.trackerUnsubs=[],this.remoteTracker=null,super.destroy()}}exports.PROTOCOL_VERSION=k.PROTOCOL_VERSION;exports.PaywallUI=lt;exports.RemoteAuthClient=te;exports.RemoteBillingClient=ee;exports.RemoteEventTracker=re;exports.getContentTransport=se;
|
|
25
|
+
`})]})}const ae={google:"Continue with Google",apple:"Continue with Apple",github:"Continue with GitHub",facebook:"Continue with Facebook"};function K({block:s,ctx:e}){const t=e.auth,n=e.authSession,i=s.allow_signup!==!1,o=s.allow_password_reset!==!1,l=s.hide_when_authenticated!==!1;if(!t)return typeof console<"u"&&console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"),null;const a=n&&!n.user.is_anonymous?n:null;return a&&l?null:a?r.jsx(ce,{email:a.user.email??"",onSignOut:()=>t.signOut().catch(()=>{})}):r.jsx(ue,{block:s,allowSignup:i,allowReset:o,ctx:e})}function ce({email:s,onSignOut:e}){return r.jsxs("div",{class:"flex items-center justify-between gap-3 rounded-2xl border border-gray-200 bg-gray-50/60 px-4 py-3",children:[r.jsxs("div",{class:"flex flex-col",children:[r.jsx("span",{class:"text-[10px] font-semibold uppercase tracking-wider text-gray-500",children:"Signed in"}),r.jsx("span",{class:"text-sm font-medium text-gray-900",children:s})]}),r.jsx("button",{type:"button",onClick:e,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)]",children:"Sign out"})]})}function ue({block:s,allowSignup:e,allowReset:t,ctx:n}){const i=n.auth,o=s.providers??[],[l,a]=d.useState("signin"),[u,c]=d.useState(""),[x,m]=d.useState(""),[I,f]=d.useState(""),[g,j]=d.useState(null),[v,b]=d.useState(null),[_,w]=d.useState(null),A=async C=>{if(C.preventDefault(),!g){j("email"),b(null),w(null);try{l==="signin"?await i.signInWithEmail({email:u,password:x}):l==="signup"?(await i.signUp({email:u,password:x})).kind==="confirmation_required"&&(a("reset_verify"),w("Check your email for a confirmation code.")):l==="forgot"?(await i.requestPasswordReset({email:u}),a("reset_sent"),w("If that email exists, a reset code has been sent.")):l==="reset_verify"&&(await i.verifyOtp({email:u,token:I,type:x?"recovery":"email"}),x&&await i.updatePassword({password:x}))}catch(E){const S=E instanceof y.PaywallError?E.message:"Something went wrong";b(S)}finally{j(null)}}},T=async C=>{if(!g){j(C),b(null),w(null);try{await i.signInWithOAuth({provider:C,onPopupOpened:()=>j(null)})}catch(E){if(E instanceof y.PaywallError){if(E.code==="oauth_cancelled"||E.code==="oauth_timeout")return;b(E.message)}else b("Sign-in failed")}finally{j(null)}}};return r.jsxs("div",{class:"flex flex-col gap-3",children:[s.heading?r.jsx("h2",{class:"text-lg font-semibold tracking-tight text-gray-900",children:s.heading}):null,o.length>0&&(l==="signin"||l==="signup")?r.jsxs("div",{class:"flex flex-col gap-2",children:[o.map(C=>r.jsxs("button",{type:"button",onClick:()=>T(C),disabled:g!==null,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)]",children:[g===C?r.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700"}):r.jsx(pe,{provider:C}),r.jsx("span",{children:ae[C]})]},C)),r.jsx(de,{})]}):null,r.jsxs("form",{onSubmit:A,class:"flex flex-col gap-2",children:[(l==="signin"||l==="signup"||l==="forgot")&&r.jsx(L,{type:"email",label:"Email",value:u,onInput:c,autocomplete:"email",required:!0}),(l==="signin"||l==="signup")&&r.jsx(L,{type:"password",label:"Password",value:x,onInput:m,autocomplete:l==="signin"?"current-password":"new-password",required:!0}),l==="reset_verify"&&r.jsxs(r.Fragment,{children:[r.jsx(L,{type:"text",label:"Confirmation code",value:I,onInput:f,autocomplete:"one-time-code",inputMode:"numeric",required:!0}),r.jsx(L,{type:"password",label:"New password (optional — only for password reset)",value:x,onInput:m,autocomplete:"new-password"})]}),l==="reset_sent"&&_&&r.jsx("p",{class:"rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600",children:_}),v&&r.jsx("p",{class:"text-xs text-red-600",children:v}),_&&l!=="reset_sent"&&r.jsx("p",{class:"text-xs text-gray-500",children:_}),l!=="reset_sent"&&r.jsx("button",{type:"submit",disabled:g!==null,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:g==="email"?r.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):he(l)})]}),r.jsxs("div",{class:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-xs text-gray-500",children:[l==="signin"&&e&&r.jsx("button",{type:"button",onClick:()=>B(a,b,w,"signup"),class:"font-medium text-gray-700 hover:underline",children:"Create account"}),l==="signup"&&r.jsx("button",{type:"button",onClick:()=>B(a,b,w,"signin"),class:"font-medium text-gray-700 hover:underline",children:"I already have an account"}),l==="signin"&&t&&r.jsx("button",{type:"button",onClick:()=>B(a,b,w,"forgot"),class:"hover:underline",children:"Forgot password?"}),(l==="forgot"||l==="reset_sent"||l==="reset_verify")&&r.jsx("button",{type:"button",onClick:()=>B(a,b,w,"signin"),class:"hover:underline",children:"Back to sign in"}),l==="reset_sent"&&r.jsx("button",{type:"button",onClick:()=>B(a,b,w,"reset_verify"),class:"font-medium text-gray-700 hover:underline",children:"I have a code"})]})]})}function he(s){switch(s){case"signin":return"Sign in";case"signup":return"Create account";case"forgot":return"Send reset code";case"reset_verify":return"Verify";default:return"Continue"}}function B(s,e,t,n){s(n),e(null),t(null)}function L({type:s,label:e,value:t,onInput:n,autocomplete:i,inputMode:o,required:l}){return r.jsxs("label",{class:"flex flex-col gap-1.5",children:[r.jsx("span",{class:"text-xs font-medium text-gray-700",children:e}),r.jsx("input",{type:s,value:t,onInput:a=>n(a.target.value),autocomplete:i,inputMode:o,required:l,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)]"})]})}function de(){return r.jsxs("div",{class:"flex items-center gap-2 py-1 text-[10px] uppercase tracking-[0.14em] text-gray-400",children:[r.jsx("div",{class:"h-px flex-1 bg-gradient-to-r from-gray-200 to-transparent"}),r.jsx("span",{children:"or"}),r.jsx("div",{class:"h-px flex-1 bg-gradient-to-r from-transparent to-gray-200"})]})}function pe({provider:s}){return s==="google"?r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 18 18","aria-hidden":"true",children:[r.jsx("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"}),r.jsx("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"}),r.jsx("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"}),r.jsx("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"})]}):s==="apple"?r.jsx("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:r.jsx("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"})}):s==="github"?r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:r.jsx("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"})}):r.jsx("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:r.jsx("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"})})}function fe({block:s,bootstrap:e,auth:t,authSession:n,onBack:i,showBack:o=!0}){const l={bootstrap:e,selectedPriceId:null,setSelectedPriceId:()=>{},onAction:()=>{},auth:t,authSession:n};return r.jsxs("div",{class:"flex flex-col gap-3",children:[o?r.jsx("button",{type:"button",onClick:i,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)]",children:"← Back"}):null,r.jsx(K,{block:s,ctx:l})]})}function ge({auth:s,onSuccess:e,onBack:t,heading:n="Continue as guest",description:i="Setting up your guest session…"}){const[o,l]=d.useState({kind:"signing-in"}),a=d.useRef(!0);d.useEffect(()=>()=>{a.current=!1},[]);const u=()=>{l({kind:"signing-in"}),(async()=>{try{const c=await s.signInAnonymously();if(!a.current)return;e(c)}catch(c){if(!a.current)return;l({kind:"error",message:c instanceof Error?c.message:"Anonymous sign-in failed"})}})()};return d.useEffect(()=>{u()},[]),r.jsxs("div",{class:"flex flex-col gap-3",children:[t?r.jsx("button",{type:"button",onClick:t,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)]",children:"← Back"}):null,r.jsxs("div",{class:"flex flex-col gap-1",children:[r.jsx("h2",{class:"text-xl font-semibold text-gray-900",children:n}),r.jsx("p",{class:"text-sm text-gray-500",children:i})]}),o.kind==="signing-in"?r.jsx("div",{class:"flex items-center justify-center py-6",children:r.jsx(xe,{})}):null,o.kind==="error"?r.jsxs("div",{class:"flex flex-col gap-3",children:[r.jsx("div",{class:"rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700",children:o.message}),r.jsx("button",{type:"button",onClick:u,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",children:"Try again"})]}):null]})}function xe(){return r.jsxs("svg",{class:"h-5 w-5 animate-spin text-[var(--pw-accent)]",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"3","stroke-opacity":"0.2"}),r.jsx("path",{d:"M22 12a10 10 0 0 0-10-10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"})]})}const U=3,R=200,q=5e3,z=5,me=10*1024*1024,N=["image/jpeg","image/png","image/webp"],$=/.+@.+\..+/;function ye({client:s,authSession:e,origin:t,onBack:n}){const i=e?.user.email??"",o=i||null,[l,a]=d.useState(i),[u,c]=d.useState(""),[x,m]=d.useState(""),[I,f]=d.useState([]),[g,j]=d.useState(!1),[v,b]=d.useState(null),[_,w]=d.useState({}),A=d.useMemo(()=>{const S=(o??l).trim().toLowerCase(),h=u.trim(),p=x.trim();return $.test(S)&&h.length>=U&&h.length<=R&&p.length>=1&&p.length<=q},[o,l,u,x]),T=()=>{const S={},h=(o??l).trim(),p=u.trim(),k=x.trim();return h?$.test(h.toLowerCase())||(S.email="Invalid email"):S.email="Required",(p.length<U||p.length>R)&&(S.subject=`${U}–${R} characters`),(k.length<1||k.length>q)&&(S.message=`1–${q} characters`),w(S),Object.keys(S).length===0},C=async S=>{if(S.preventDefault(),!g&&T()){j(!0),w(h=>({...h,submit:void 0}));try{const h=(o??l).trim();await s.createSupportTicket({subject:u.trim(),content:x.trim(),email:h||void 0,files:I.length>0?I:void 0}),b(h)}catch(h){const p=h instanceof y.PaywallError&&h.message||"Failed to send. Please try again.";w(k=>({...k,submit:p}))}finally{j(!1)}}},E=()=>{c(""),m(""),f([]),w({}),b(null)};return v?r.jsxs("div",{class:"flex flex-col items-center gap-4 py-2 text-center",children:[r.jsx("div",{class:"flex h-14 w-14 items-center justify-center rounded-full",style:{background:"linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",color:"#fff",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)"},"aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",class:"h-7 w-7",children:r.jsx("path",{fill:"currentColor",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"})})}),r.jsx("div",{class:"text-lg font-semibold tracking-tight text-gray-900",children:"Request submitted"}),r.jsxs("div",{class:"max-w-[320px] text-sm leading-relaxed text-gray-500",children:["We've received your message and will respond to"," ",r.jsx("b",{class:"text-gray-700",children:v}),"."]}),r.jsxs("div",{class:"mt-2 flex items-center justify-center gap-3",children:[r.jsx("button",{type:"button",onClick:n,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)]",children:t==="standalone"?"Done":"Back"}),r.jsx("button",{type:"button",onClick:E,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Send another request"})]})]}):r.jsxs("div",{class:"flex flex-col gap-3",children:[r.jsx("div",{class:"flex items-center justify-between",children:r.jsxs("button",{type:"button",onClick:n,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)]",children:["← ",t==="standalone"?"Close":"Back"]})}),r.jsx("h2",{class:"text-lg font-semibold tracking-tight text-gray-900",children:"Contact Support"}),r.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:"Fill out the form below and we'll get back to you."}),r.jsxs("form",{onSubmit:C,class:"flex flex-col gap-3",children:[o?r.jsxs("div",{class:"rounded-xl border border-gray-200 bg-gray-50/60 px-3 py-2 text-xs text-gray-500",children:["Sending as ",r.jsx("b",{class:"font-medium text-gray-700",children:o})]}):r.jsx(H,{type:"email",label:"Your email",value:l,onInput:a,error:_.email,autocomplete:"email",required:!0}),r.jsx(H,{type:"text",label:"Subject",value:u,onInput:c,error:_.subject,required:!0}),r.jsx(be,{label:"Message",value:x,onInput:m,error:_.message,required:!0}),r.jsx(ke,{files:I,onChange:f,disabled:g}),_.submit&&r.jsx("p",{class:"text-xs text-red-600",children:_.submit}),r.jsxs("div",{class:"mt-1 flex items-center justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:n,disabled:g,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)]",children:t==="standalone"?"Close":"Back"}),r.jsx("button",{type:"submit",disabled:!A||g,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:g?r.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):"Send"})]})]})]})}function H({type:s,label:e,value:t,onInput:n,error:i,autocomplete:o,required:l}){return r.jsxs("label",{class:"flex flex-col gap-1.5",children:[r.jsx("span",{class:"text-xs font-medium text-gray-700",children:e}),r.jsx("input",{type:s,value:t,onInput:a=>n(a.target.value),autocomplete:o,required:l,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 ${i?"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)]"}`}),i&&r.jsx("span",{class:"text-xs text-red-600",children:i})]})}function be({label:s,value:e,onInput:t,error:n,required:i}){return r.jsxs("label",{class:"flex flex-col gap-1.5",children:[r.jsx("span",{class:"text-xs font-medium text-gray-700",children:s}),r.jsx("textarea",{value:e,onInput:o=>t(o.target.value),required:i,rows:4,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)]"}`}),n&&r.jsx("span",{class:"text-xs text-red-600",children:n})]})}function ke({files:s,onChange:e,disabled:t}){const n=d.useRef(null),[i,o]=d.useState(!1),[l,a]=d.useState(null),u=c=>{if(!c||t)return;a(null);const x=Array.from(c);if(s.length+x.length>z){a(`Up to ${z} files`);return}const m=x.filter(I=>N.includes(I.type)&&I.size<=me);if(m.length!==x.length){a("Only JPEG/PNG/WebP, ≤ 10MB each");return}e([...s,...m])};return r.jsxs("div",{children:[r.jsx("span",{class:"text-xs font-medium text-gray-700",children:"Attachments (optional)"}),r.jsxs("div",{role:"button",tabIndex:0,"aria-label":"Attachments upload",onClick:()=>!t&&n.current?.click(),onDragOver:c=>{c.preventDefault(),t||o(!0)},onDragLeave:()=>o(!1),onDrop:c=>{c.preventDefault(),o(!1),u(c.dataTransfer?.files??null)},class:`mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${i?"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"} ${t?"cursor-not-allowed opacity-60":""}`,children:[r.jsx("div",{class:"text-xs text-gray-500",children:"Drop images here or click to select"}),r.jsxs("div",{class:"mt-0.5 text-[11px] text-gray-400",children:["JPEG/PNG/WebP, up to ",z," files, ≤ 10MB each"]})]}),r.jsx("input",{ref:n,type:"file",multiple:!0,accept:N.join(","),class:"hidden",onChange:c=>{u(c.target.files),c.currentTarget.value=""}}),l&&r.jsx("p",{class:"mt-1 text-xs text-red-600",children:l}),s.length>0&&r.jsx("ul",{class:"mt-2 flex flex-col gap-1",children:s.map((c,x)=>r.jsxs("li",{class:"flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",children:[r.jsx("span",{class:"truncate text-gray-700",children:c.name}),r.jsx("button",{type:"button",onClick:()=>{const m=[...s];m.splice(x,1),e(m)},disabled:t,class:"text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60","aria-label":`Remove ${c.name}`,children:"✕"})]},`${c.name}-${c.size}-${x}`))})]})}function we({block:s,ctx:e}){const[t,n]=d.useState(!1),i=s.priceId??e.selectedPriceId,o=t||s.action==="checkout"&&!i,l=async()=>{if(!o){n(!0);try{await e.onAction(s.action,{priceId:i})}finally{n(!1)}}};return r.jsx("button",{type:"button",disabled:o,onClick:l,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",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)"},children:t?r.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):s.label})}function ve({ctx:s}){const e=s.authSession,t=s.auth,[n,i]=d.useState(!1),o=()=>s.onAction("support");if(e&&!e.user.is_anonymous){const l=async()=>{if(!(!t||n)){i(!0);try{await t.signOut()}catch{}finally{i(!1)}}};return r.jsxs("div",{class:"mt-2 text-center text-xs text-gray-500",children:[r.jsx("span",{children:"Signed in as "}),r.jsx("b",{class:"font-medium text-gray-700",children:e.user.email}),r.jsxs("div",{class:"mt-1 flex items-center justify-center gap-3",children:[r.jsx("button",{type:"button",onClick:l,disabled:!t||n,class:"font-medium text-gray-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:underline",children:n?"Signing out…":"Sign out"}),r.jsx(W,{}),r.jsx(G,{onClick:o})]})]})}return r.jsxs("div",{class:"mt-2 flex items-center justify-center gap-3 text-center text-xs text-gray-500",children:[r.jsx("button",{type:"button",onClick:()=>s.onAction("restore"),class:"font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",children:"Restore purchases"}),r.jsx(W,{}),r.jsx(G,{onClick:o})]})}function G({onClick:s}){return r.jsx("button",{type:"button",onClick:s,class:"font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",children:"Contact Support"})}function W(){return r.jsx("span",{class:"h-1 w-1 rounded-full bg-gray-300","aria-hidden":"true"})}function je({block:s}){return s.items.length?r.jsx("ul",{class:"flex flex-col gap-2.5",role:"list",children:s.items.map(e=>r.jsxs("li",{class:"flex items-start gap-3 text-sm text-gray-700",children:[r.jsx("span",{class:"mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full",style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 20 20",fill:"none",children:r.jsx("path",{d:"M5 10l3 3 7-7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),r.jsxs("div",{class:"flex flex-col gap-0.5",children:[r.jsx("span",{class:"font-medium leading-snug text-gray-900",children:e.name}),e.desc?r.jsx("span",{class:"text-xs leading-relaxed text-gray-500",children:e.desc}):null]})]},e.id))}):null}const Q=26,_e=14,Se=2;function Ce(s,e){const t=e*Se;let n=Q;for(s.style.fontSize=`${n}px`;s.scrollHeight>t&&n>_e;)n-=1,s.style.fontSize=`${n}px`}function Ie({block:s,ctx:e}){const t=s.level??1,n=`h${t}`,i=t===1?"text-[1.625rem] font-semibold leading-tight text-gray-900 tracking-[-0.02em]":t===2?"text-xl font-semibold leading-snug text-gray-900 tracking-tight":"text-base font-medium text-gray-900",o=d.useRef(null),l=t===1&&!!e.bootstrap.settings.title_auto_fit;return d.useEffect(()=>{if(!l||!o.current)return;const a=getComputedStyle(o.current),u=parseFloat(a.lineHeight)||Q*1.5;Ce(o.current,u)},[l,s.text]),r.jsx(n,{ref:o,class:i,children:s.text})}function Ee(s){const e=s.local??{currency:s.currency,amount:s.amount};try{return new Intl.NumberFormat(void 0,{style:"currency",currency:e.currency,maximumFractionDigits:e.amount%1===0?0:2}).format(e.amount)}catch{return`${e.amount} ${e.currency}`}}function Z(s){if(!s.interval||s.interval==="lifetime")return"one-time";const e=s.interval_count??1;return e===1?`per ${s.interval}`:`every ${e} ${s.interval}s`}function Ae({block:s,ctx:e}){const t=s.priceIds&&s.priceIds.length>0?new Set(s.priceIds):null,n=e.bootstrap.prices.filter(a=>!t||t.has(a.id));if(n.length===0)return r.jsx("p",{class:"text-sm text-gray-500",children:"No prices available."});const i=s.view==="horizontal",o=s.popular_label??"Most popular",l=i?Math.min(n.length,3):1;return r.jsx("div",{class:i?"grid gap-2.5":"flex flex-col gap-2.5",style:i?{gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`}:void 0,role:"radiogroup","aria-label":"Plans",children:n.map(a=>{const u=e.selectedPriceId===a.id,c=s.popular_price_id===a.id;return r.jsxs("button",{type:"button",role:"radio","aria-checked":u,onClick:()=>{e.setSelectedPriceId(a.id),e.onAction("price_selected",{priceId:a.id,price:a})},class:["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)]",i?"flex w-full flex-col items-start gap-1":"flex w-full items-center justify-between gap-3",u?"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",c?"mt-2.5":""].join(" "),children:[c?r.jsx("span",{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",style:{background:"linear-gradient(135deg, var(--pw-accent), color-mix(in srgb, var(--pw-accent) 70%, black))"},children:o}):null,r.jsxs("div",{class:i?"flex w-full items-start gap-2.5":"flex flex-1 items-start gap-2.5",children:[r.jsx("span",{class:["mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border transition-colors",u?"border-[var(--pw-accent)] bg-[var(--pw-accent)]":"border-gray-300 bg-white group-hover:border-gray-400"].join(" "),"aria-hidden":"true",children:u?r.jsx("span",{class:"h-1.5 w-1.5 rounded-full bg-white"}):null}),r.jsxs("div",{class:"flex flex-col",children:[r.jsx("span",{class:"text-sm font-semibold text-gray-900",children:a.label??Z(a)}),a.description?r.jsx("span",{class:"text-xs leading-relaxed text-gray-500",children:a.description}):null,a.trial_days?r.jsxs("span",{class:"text-xs font-medium text-[var(--pw-accent)]",children:[a.trial_days,"-day free trial"]}):null]})]}),r.jsxs("div",{class:i?"mt-1 flex flex-col items-start":"flex flex-col items-end",children:[r.jsx("span",{class:"text-base font-semibold tracking-tight text-gray-900",children:Ee(a)}),r.jsx("span",{class:"text-[11px] text-gray-500",children:Z(a)})]})]},a.id)})})}function Te({block:s}){return r.jsx("p",{class:"text-[0.9375rem] leading-relaxed text-gray-600",children:s.text})}const Me={week:.25,month:1,year:12};function Pe(s){return s||"period"}function Be({block:s,ctx:e}){if(!s.queries.length)return null;const n=e.bootstrap.prices.find(o=>o.id===e.selectedPriceId)?.interval??null,i=n?Me[n]:void 0;return r.jsxs("div",{class:"flex flex-col gap-2",children:[r.jsxs("div",{class:"text-sm font-semibold text-gray-800",children:["Included per ",r.jsx("span",{children:Pe(n)}),":"]}),r.jsx("ul",{class:"flex flex-col gap-2",role:"list",children:s.queries.map(o=>{const l=Number.isFinite(o.count)?o.count:0,a=i!==void 0?Math.round(l*i):l;return r.jsxs("li",{class:`flex gap-2 ${o.desc?"":"items-center"}`,children:[r.jsx("span",{class:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full ${o.desc?"mt-0.5":""}`,style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 20 20",fill:"none",children:r.jsx("path",{d:"M5 10l3 3 7-7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),r.jsxs("div",{children:[r.jsx("span",{class:"font-semibold text-gray-900 text-sm",children:a})," ",r.jsx("span",{class:"text-sm text-gray-800",children:o.name}),o.desc?r.jsxs(r.Fragment,{children:[r.jsx("br",{}),r.jsx("span",{class:"text-xs text-gray-500",children:o.desc})]}):null]})]},o.id)})})]})}const Le={heading:Ie,text:Te,price_grid:Ae,cta_button:we,auth_panel:K,current_session:ve,features_list:je,tokenization_gate:Be};function Oe({layout:s,bootstrap:e,onAction:t,auth:n,authSession:i}){const o=d.useMemo(()=>e.prices[0]?.id??null,[e.prices]),[l,a]=d.useState(o),u={bootstrap:e,selectedPriceId:l,setSelectedPriceId:a,onAction:t,auth:n,authSession:i};return r.jsx("div",{class:"flex flex-col gap-4",children:s.blocks.map((c,x)=>{const m=Le[c.type];return m?r.jsx(m,{block:c,ctx:u},x):(typeof console<"u"&&console.warn(`[paywall] unknown block type: ${c.type}`),null)})})}function Ue(s,e,t,n){return s?n?{open:!0,view:"purchased",error:null}:e.status==="idle"||e.status==="loading"?{open:!0,view:"loading",error:null}:e.status==="error"?{open:!0,view:"error",error:e.error}:t.kind==="support"?{open:!0,view:"support",error:null}:t.kind==="auth_gate"?{open:!0,view:"auth",error:null}:t.kind==="anon_gate"?{open:!0,view:"anon",error:null}:t.kind==="awaiting_payment"?{open:!0,view:"awaiting_payment",error:null}:t.kind==="popup_blocked"?{open:!0,view:"popup_blocked",error:null}:t.kind==="purchase_success"?{open:!0,view:"purchased",error:null}:t.kind==="verifying"?{open:!0,view:"loading",error:null}:{open:!0,view:"layout",error:null}:{open:!1,view:null,error:null}}function Re(s,e){return s.open===e.open&&s.view===e.view&&s.error===e.error}function qe({client:s,open:e,onClose:t,onEvent:n,initialView:i,purchased:o,renew:l,onState:a,inline:u}){const[c,x]=d.useState({status:"idle"}),[m,I]=d.useState(()=>s.auth?.getCachedSession()??null),[f,g]=d.useState(()=>i==="support"?{kind:"support",origin:"standalone"}:i==="auth"?{kind:"auth_gate",origin:"standalone"}:i==="anon"?{kind:"anon_gate",origin:"standalone"}:{kind:"layout"}),j=d.useRef(!1),v=d.useRef(null);d.useEffect(()=>{if(!a)return;const h=Ue(e,c,f,o),p=v.current;p&&Re(p,h)||(v.current=h,a(h))},[e,c,f,o,a]),d.useEffect(()=>{if(s.auth)return s.auth.onAuthChange(h=>I(h))},[s.auth]),d.useEffect(()=>{if(typeof s.onBootstrapChange=="function")return s.onBootstrapChange(h=>{x(p=>p.status==="ready"?{status:"ready",data:h}:p)})},[s]),d.useEffect(()=>{if(!e||c.status==="ready"||c.status==="loading")return;let h=!1;return x({status:"loading"}),s.bootstrap().then(p=>{h||(x({status:"ready",data:p}),n("ready",p),p.user?.has_active_subscription&&!l&&(n("purchase_completed",{priceId:null,sessionId:null,restored:!0}),g({kind:"purchase_success",restored:!0})))}).catch(p=>{if(h)return;const k=p instanceof y.PaywallError?p:new y.PaywallError("unknown","Failed to load paywall",{cause:p});x({status:"error",error:k}),n("error",k)}),()=>{h=!0}},[e,s]),d.useEffect(()=>{if(!e){g({kind:"layout"}),j.current=!1;return}i==="support"?g({kind:"support",origin:"standalone"}):i==="auth"?g({kind:"auth_gate",origin:"standalone"}):i==="anon"&&g({kind:"anon_gate",origin:"standalone"})},[e,i]);const b=async h=>{try{const p=await s.createCheckout({priceId:h,ignoreActivePurchase:l===!0});if(n("checkout_started",{priceId:h,url:p.url,acquiring:p.acquiring}),typeof window>"u"||!p.url)return;const k=window.open(p.url,"_blank");if(k){try{k.opener=null}catch{}g({kind:"awaiting_payment",priceId:h,url:p.url})}else g({kind:"popup_blocked",priceId:h,url:p.url})}catch(p){if(p instanceof y.PaywallError&&p.code==="already_purchased"){try{await s.getUser({force:!0})}catch{}n("purchase_completed",{priceId:h,sessionId:null,restored:!0}),g({kind:"purchase_success",restored:!0});return}const k=p instanceof y.PaywallError?p:new y.PaywallError("checkout_failed","Checkout failed",{cause:p});n("error",k),g({kind:"layout"})}},_=(h,p)=>{if(typeof window>"u")return;const k=window.open(p,"_blank");if(k){try{k.opener=null}catch{}g({kind:"awaiting_payment",priceId:h,url:p})}};d.useEffect(()=>{if(f.kind!=="auth_gate"||!m||m.user.is_anonymous||j.current)return;j.current=!0;const h=f.pendingCheckout,p=f.origin;g({kind:"verifying"}),(async()=>{if(!l)try{if((await s.getUser({force:!0})).has_active_subscription){n("purchase_completed",{priceId:h?.priceId??null,sessionId:null,restored:!0}),g({kind:"purchase_success",restored:!0});return}}catch{}if(!h){p==="standalone"?t():g({kind:"layout"});return}await b(h.priceId)})().finally(()=>{j.current=!1})},[m,f]);const w=async(h,p)=>{if(h==="close"){t();return}if(h==="price_selected"){n("price_selected",p);return}if(h==="restore"){if(!s.auth||s.auth.getCachedSession())return;g({kind:"auth_gate"});return}if(h==="support"){g({kind:"support",origin:"layout"});return}if(h==="checkout"&&c.status==="ready"){const k=p?.priceId;if(!k){n("error",new y.PaywallError("no_price","No price selected"));return}if((c.data.settings.checkout_mode??"guest")==="preauth"&&!!s.auth&&!s.auth.getCachedSession()){g({kind:"auth_gate",pendingCheckout:{priceId:k}});return}await b(k)}},A=c.status==="ready"?c.data.settings.brand_color:null,T=c.status==="ready"?!!c.data.settings.is_test_mode:!1,C=c.status==="ready"?c.data.settings.allow_close!==!1:!0,E={type:"auth_panel",heading:"Sign in to continue",allow_signup:!0,allow_password_reset:!0,hide_when_authenticated:!1,providers:c.status==="ready"?c.data.settings.auth_providers:void 0},S=f.kind==="support"?r.jsx(ye,{client:s,authSession:m,origin:f.origin,onBack:()=>{f.origin==="standalone"?t():g({kind:"layout"})}}):null;return r.jsx(le,{open:e,onClose:t,brandColor:A,testMode:T,allowClose:C,inline:u,labelledBy:"pw-title",children:o?r.jsx(X,{onContinue:t}):f.kind==="purchase_success"?r.jsx(X,{restored:f.restored,onContinue:t}):S||(c.status==="loading"||c.status==="idle"||f.kind==="verifying"?r.jsxs("div",{class:"flex flex-col items-center justify-center gap-3 py-12",children:[r.jsx("span",{class:"inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]"}),r.jsx("span",{class:"text-xs font-medium tracking-wide text-gray-500",children:f.kind==="verifying"?"Checking your subscription…":"Loading…"})]}):c.status==="error"?r.jsxs("div",{class:"flex flex-col items-center gap-2 py-8 text-center",children:[r.jsx("div",{class:"flex h-11 w-11 items-center justify-center rounded-full bg-red-50",children:r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[r.jsx("path",{d:"M10 6v5M10 14h.01",stroke:"#dc2626","stroke-width":"2","stroke-linecap":"round"}),r.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"#dc2626","stroke-width":"1.75"})]})}),r.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Something went wrong"}),r.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:c.error.message})]}):f.kind==="auth_gate"&&s.auth?r.jsx(fe,{block:E,bootstrap:c.data,auth:s.auth,authSession:m,showBack:f.origin!=="standalone",onBack:()=>{f.origin==="standalone"?t():g({kind:"layout"})}}):f.kind==="anon_gate"&&s.auth?r.jsx(ge,{auth:s.auth,onSuccess:()=>{f.origin==="standalone"?t():g({kind:"layout"})},onBack:f.origin==="standalone"?void 0:()=>g({kind:"layout"})}):f.kind==="awaiting_payment"?r.jsx(ze,{client:s,onBack:()=>g({kind:"layout"}),onReopen:()=>{if(typeof window>"u")return;const h=window.open(f.url,"_blank");if(h)try{h.opener=null}catch{}},onRetry:()=>b(f.priceId)}):f.kind==="popup_blocked"?r.jsxs("div",{class:"flex flex-col items-center gap-3 py-8 text-center",children:[r.jsx("div",{class:"flex h-11 w-11 items-center justify-center rounded-full",style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[r.jsx("path",{d:"M4 5h12v10H4z",stroke:"currentColor","stroke-width":"1.75","stroke-linejoin":"round"}),r.jsx("path",{d:"M7 9l3 3 4-5",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"})]})}),r.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Allow popups to continue"}),r.jsx("p",{class:"max-w-[18rem] text-xs leading-relaxed text-gray-500",children:"Your browser blocked the checkout tab. Click below to open it."}),r.jsx("button",{type:"button",onClick:()=>_(f.priceId,f.url),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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Open checkout"})]}):r.jsx(Oe,{layout:c.data.layout,bootstrap:c.data,onAction:w,auth:s.auth,authSession:m}))})}function ze({client:s,onBack:e,onReopen:t,onRetry:n}){const[i,o]=d.useState(!1),[l,a]=d.useState(!1),u=d.useRef(null);d.useEffect(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]);const c=async()=>{if(!i){o(!0),a(!1);try{if((await s.getUser({force:!0})).has_active_subscription){typeof window<"u"&&window.postMessage({type:"paywall_purchase"},"*");return}a(!0),u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{a(!1),u.current=null},5e3)}catch{a(!0)}finally{o(!1)}}};return r.jsxs("div",{class:"flex flex-col gap-3",children:[r.jsx("button",{type:"button",onClick:e,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)]",children:"← Back"}),r.jsxs("div",{class:"flex flex-col items-center gap-3 py-6 text-center",children:[r.jsxs("div",{class:"relative flex h-12 w-12 items-center justify-center",children:[r.jsx("span",{class:"absolute inset-0 animate-ping rounded-full opacity-40",style:{background:"color-mix(in srgb, var(--pw-accent) 30%, transparent)"},"aria-hidden":"true"}),r.jsx("span",{class:"relative inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]"})]}),r.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Complete payment in the new tab"}),r.jsx("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."}),r.jsx("button",{type:"button",onClick:c,disabled:i,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:i?"Checking…":"I've paid"}),l?r.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:"Payment is still being processed. Please try again in a moment."}):null]}),r.jsxs("div",{class:"rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5",children:[r.jsx("p",{class:"text-xs leading-relaxed text-gray-600",children:"Checkout window didn't open or got blocked? Click here to open it again."}),r.jsx("button",{type:"button",onClick:t,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)]",children:"Open checkout again"})]}),r.jsx("button",{type:"button",onClick:n,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)]",children:"Tab closed? Try again"})]})}function X({onContinue:s,restored:e=!1}){return r.jsxs("div",{class:"flex flex-col items-center gap-3 py-8 text-center",children:[r.jsx("div",{class:"flex h-14 w-14 items-center justify-center rounded-full ring-8",style:{background:"linear-gradient(135deg, #4ade80, #16a34a)",color:"#fff",boxShadow:"0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"},"aria-hidden":"true",children:r.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",children:r.jsx("path",{d:"M5 13l4 4L19 7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),r.jsx("p",{id:"pw-title",class:"mt-1 text-lg font-semibold tracking-tight text-gray-900",children:e?"Subscription restored":"Payment received"}),r.jsx("p",{class:"text-sm leading-relaxed text-gray-500",children:e?"Welcome back — your subscription is already active.":"Your subscription is now active."}),r.jsx("button",{type:"button",onClick:s,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Continue"})]})}const Ve=10*6e4,De=5e3,Fe=3e4;class Ne{constructor(e){this.timer=null,this.timeoutTimer=null,this.visibilityHandler=null,this.focusHandler=null,this.messageHandler=null,this.stopped=!1,this.checking=!1,this.opts={client:e.client,onActive:e.onActive,onTimeout:e.onTimeout??(()=>{}),timeoutMs:e.timeoutMs??Ve,visibleIntervalMs:e.visibleIntervalMs??De,hiddenIntervalMs:e.hiddenIntervalMs??Fe}}start(){this.stopped||typeof document>"u"||typeof window>"u"||(this.check(),this.scheduleNext(),this.visibilityHandler=()=>this.handleVisibilityChange(),document.addEventListener("visibilitychange",this.visibilityHandler),this.focusHandler=()=>void this.check(),window.addEventListener("focus",this.focusHandler),this.messageHandler=e=>this.handleMessage(e),window.addEventListener("message",this.messageHandler),this.timeoutTimer=setTimeout(()=>{this.stopped||(this.stop(),this.opts.onTimeout())},this.opts.timeoutMs))}stop(){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}async check(){if(!(this.stopped||this.checking)){this.checking=!0;try{const e=await this.opts.client.getUser({force:!0});if(this.stopped)return;e.has_active_subscription&&(this.stop(),this.opts.onActive(e))}catch{}finally{this.checking=!1}}}scheduleNext(){if(this.stopped)return;const t=typeof document<"u"&&document.visibilityState==="visible"?this.opts.visibleIntervalMs:this.opts.hiddenIntervalMs;this.timer=setTimeout(async()=>{await this.check(),this.scheduleNext()},t)}handleVisibilityChange(){typeof document>"u"||(document.visibilityState==="visible"&&this.check(),this.timer!==null&&(clearTimeout(this.timer),this.timer=null),this.scheduleNext())}handleMessage(e){const t=e.data;!t||typeof t!="object"||t.type==="paywall_purchase"&&this.check()}}function $e(){return!(typeof document>"u"||typeof window>"u"||typeof location<"u"&&location.protocol==="chrome-extension:")}const V={open:!1,view:null,error:null},M={status:"paywall_status",priceId:"paywall_price_id",sessionId:"paywall_session_id"};let He=class{constructor(e){this.handle=null,this.isOpen=!1,this.listeners=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=V,this.stateListeners=new Set;const{auth:t,ownsAuth:n}=Ge(e);this.auth=t,this.ownsAuth=n,this.billing=e.client??new y.BillingClient({...e,auth:this.auth}),this.host=e.host,this.shadowMode=e.shadowMode??"closed",this.mountThenLoad=e.mountThenLoad??!0,this.inline=e.inline===!0,this.userUnsub=this.billing.onUserChange(i=>{this.emit("userChange",i)}),this.auth&&(this.authUnsub=this.auth.onAuthChange(i=>{this.emit("authChange",i)})),this.initTracker(e.analytics),e.autoDetectReturn!==!1&&typeof window<"u"&&queueMicrotask(()=>this.checkReturn())}initTracker(e){if(e===!1)return;const t=typeof e=="object"&&e!==null?e:{};if(t.enabled===!1)return;const n=t.endpoint??`${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;this.tracker=new y.EventTracker({endpoint:n,paywallId:this.billing.paywallId,capabilities:this.billing.capabilities,getVisitorId:()=>this.billing.getVisitorId(),getCachedVisitorId:()=>this.billing.getCachedVisitorId(),getUserId:()=>this.billing.getIdentity()?.userId??null,flushIntervalMs:t.flushIntervalMs,maxBufferSize:t.maxBufferSize,fetch:t.fetch,sendBeacon:t.sendBeacon}),this.on("open",()=>this.tracker?.track("paywall_opened")),this.on("ready",i=>this.tracker?.track("paywall_viewed",{is_test_mode:i.settings.is_test_mode,prices_count:i.prices.length,offers_count:i.offers.length})),this.on("price_selected",i=>this.tracker?.track("price_selected",{price_id:i.priceId})),this.on("checkout_started",i=>this.tracker?.track("checkout_started",{price_id:i.priceId,acquiring:i.acquiring})),this.on("purchase_completed",i=>this.tracker?.track("purchase_completed",{price_id:i.priceId,session_id:i.sessionId})),this.on("purchase_failed",i=>this.tracker?.track("purchase_failed",{reason:i.reason})),this.on("close",()=>this.tracker?.track("paywall_closed")),this.on("trial_blocked",i=>this.tracker?.track("trial_blocked",{mode:i.mode,...i.mode==="time"?{remaining_ms:i.remainingMs,total_ms:i.totalMs}:i.mode==="opens"?{remaining_actions:i.remainingActions,total_actions:i.totalActions}:{}})),this.on("trial_expired",()=>this.tracker?.track("trial_expired")),this.on("visibility_blocked",i=>this.tracker?.track("visibility_blocked",{reason:i.reason,country:i.country,tier:i.tier})),this.on("error",i=>this.tracker?.track("error",{code:i.code,message:i.message}))}track(e,t){this.tracker?.track(e,t)}onUserChange(e){return this.on("userChange",e)}setBootstrap(e){this.billing.setBootstrap(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,...t){const n=this.listeners.get(e);if(!n)return;const i=t[0];for(const o of n)try{o(i)}catch(l){typeof console<"u"&&console.error("[paywall] listener error",l)}}open(e={}){this.openInternal("layout",e)}async preload(e={}){try{await this.billing.bootstrap({signal:e.signal}),this.billing.auth&&await this.billing.getBalances({signal:e.signal})}catch{}}openSupport(e={}){this.openInternal("support",e)}openAuth(e={}){this.auth&&this.openInternal("auth",{...e,skipTrial:!0})}openAnonGate(e={}){this.auth&&this.openInternal("anon",{...e,skipTrial:!0,skipVisibility:!0})}openInternal(e,t){t.identity&&this.billing.setIdentity(t.identity),this.purchased=!1;const n=t.skipTrial===!0||e==="support",i=t.skipVisibility===!0||e==="support"||e==="auth"||e==="anon",o=t.renew===!0;if(n&&i){this.mountAndShow(e,{renew:o});return}const l=this.billing.getCachedBootstrap();if(l){this.runOpenGates(e,l,{skipTrial:n,skipVisibility:i,renew:o});return}if(this.mountThenLoad){this.mountAndShow(e,{renew:o}),this.billing.bootstrap().then(a=>this.runDelayedGates(a,{skipTrial:n,skipVisibility:i})).catch(()=>{});return}this.billing.bootstrap().then(a=>this.runOpenGates(e,a,{skipTrial:n,skipVisibility:i,renew:o})).catch(()=>{this.mountAndShow(e,{renew:o})})}runDelayedGates(e,t){if(!this.isOpen)return;if(!t.skipVisibility){const o=e.settings.visibility;if(o&&(this.lastVisibility=o,!o.visible)){this.close(),this.emit("visibility_blocked",o);return}}if(t.skipTrial)return;const n=e.settings.trial;if(!n)return;const i=this.ensureTrialStore(n);i.check().then(async o=>{if(this.isOpen&&(this.lastTrialStatus=o,o.mode!=="none")){if(o.blocked){const l=await i.recordBlock();if(this.lastTrialStatus=l,!this.isOpen)return;this.close(),this.emit("trial_blocked",l);return}this.trialExpiredFired||(this.trialExpiredFired=!0,this.emit("trial_expired"))}}).catch(o=>{typeof console<"u"&&console.warn("[paywall] trial check failed",o)})}runOpenGates(e,t,n){if(!n.skipVisibility){const i=t.settings.visibility;if(i&&(this.lastVisibility=i,!i.visible)){this.emit("visibility_blocked",i);return}}if(n.skipTrial){this.mountAndShow(e,{renew:n.renew});return}this.gateThroughTrial(e,t,n.renew)}gateThroughTrial(e,t,n){const i=t.settings.trial;if(!i){this.mountAndShow(e,{renew:n});return}const o=this.ensureTrialStore(i);o.check().then(async l=>{if(this.lastTrialStatus=l,l.mode==="none"){this.mountAndShow(e,{renew:n});return}if(l.blocked){const a=await o.recordBlock();this.lastTrialStatus=a,this.emit("trial_blocked",a);return}this.trialExpiredFired||(this.trialExpiredFired=!0,this.emit("trial_expired")),this.mountAndShow(e,{renew:n})}).catch(l=>{typeof console<"u"&&console.warn("[paywall] trial check failed",l),this.mountAndShow(e,{renew:n})})}ensureTrialStore(e){if(this.trialStore&&this.trialStoreConfig&&Xe(this.trialStoreConfig,e))return this.trialStore;this.trialStoreConfig=e;const t=this.billing.createTrialStore;return this.trialStore=typeof t=="function"?t.call(this.billing,e):y.createTrialStore(this.billing.getStorage(),this.billing.paywallId,e),this.trialStore}mountAndShow(e,t={}){const n=t.renew===!0;if(this.handle){this.isOpen=!0,this.handle.update({open:!0,initialView:e,purchased:!1,renew:n}),this.emit("open");return}this.isOpen=!0,this.handle=oe(qe,{client:this.billing,open:!0,initialView:e,purchased:!1,renew:n,onClose:()=>this.close(),onEvent:(i,o)=>{this.emit(i,o),i==="checkout_started"&&this.startUserWatcher()},onState:i=>this.applyState(i),inline:this.inline},{host:this.host,shadowMode:this.shadowMode,inline:this.inline}),this.emit("open")}applyState(e){if(!Ze(this.currentState,e)){this.currentState=e;for(const t of this.stateListeners)try{t(e)}catch(n){console.warn("[paywall] onStateChange listener threw",n)}}}getState(){return this.currentState}onStateChange(e,t={}){this.stateListeners.add(e);const n=t.immediate??"microtask";if(n!=="none"){const i=this.currentState;if(n==="sync")try{e(i)}catch(o){console.warn("[paywall] onStateChange initial sync threw",o)}else queueMicrotask(()=>{this.stateListeners.has(e)&&e(i)})}return()=>{this.stateListeners.delete(e)}}getTrialStatus(){return this.lastTrialStatus}getVisibility(){return this.lastVisibility}getPrices(e={}){return this.billing.getPrices(e)}getCachedPrices(){return this.billing.getCachedPrices()}getUserLanguage(){return this.billing.getUserLanguage()}async getAccess(e={}){let t=this.billing.getCachedBootstrap();if(!t)try{t=await this.billing.bootstrap({signal:e.signal})}catch{const l=this.billing.getCachedUser();return l?.has_active_subscription?{access:"granted",reason:"has_subscription",visibility:null,trial:null,user:l}:{access:"blocked",reason:"no_subscription",visibility:null,trial:null,user:l}}const n=t.user??null;if(n?.has_active_subscription)return{access:"granted",reason:"has_subscription",visibility:t.settings.visibility??null,trial:null,user:n};let i=null;if(!e.skipVisibility){const l=t.settings.visibility;if(l&&(i=l,this.lastVisibility=l,!l.visible))return{access:"granted",reason:"visibility_blocked",visibility:i,trial:null,user:n}}let o=null;if(!e.skipTrial){const l=t.settings.trial;if(l)try{if(o=await this.ensureTrialStore(l).check(),this.lastTrialStatus=o,o.blocked)return{access:"granted",reason:"trial_blocked",visibility:i,trial:o,user:n}}catch(a){typeof console<"u"&&console.warn("[paywall] getAccess: trial check failed",a)}}return{access:"blocked",reason:"no_subscription",visibility:i,trial:o,user:n}}async resetTrial(){this.trialStore&&(await this.trialStore.reset(),this.lastTrialStatus=null,this.trialExpiredFired=!1)}startUserWatcher(){this.watcher||$e()&&(this.watcher=new Ne({client:this.billing,onActive:e=>{this.watcher=null,this.emit("purchase_completed",{priceId:null,sessionId:null});const t=this.billing.getCachedBootstrap()?.settings.success_redirect_url;if(t&&typeof window<"u")try{window.location.assign(t);return}catch{}this.isOpen&&this.handle&&(this.purchased=!0,this.handle.update({purchased:!0}))},onTimeout:()=>{this.watcher=null}}),this.watcher.start())}close(){!this.isOpen||!this.handle||(this.isOpen=!1,this.purchased=!1,this.handle.update({open:!1,purchased:!1}),this.applyState(V),this.emit("close"))}checkReturn(){if(typeof window>"u")return;const e=new URL(window.location.href),t=Y(e.hash.replace(/^#/,"")),n=Y(e.search.replace(/^\?/,"")),i=t??n;i&&(i.status==="paid"?(this.emit("purchase_completed",{priceId:i.priceId,sessionId:i.sessionId}),Ye(i)):(i.status==="failed"||i.status==="cancelled")&&this.emit("purchase_failed",{reason:i.status}),Je(e))}destroy(){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=V}};function Ge(s){if(!s.auth)return{auth:void 0,ownsAuth:!1};if(s.auth instanceof y.AuthClient||We(s.auth))return{auth:s.auth,ownsAuth:!1};const e=s.auth===!0?{}:s.auth;return{auth:new y.AuthClient({paywallId:s.paywallId,apiOrigin:e.apiOrigin??s.apiOrigin,storage:e.storage??s.storage,fetch:e.fetch??s.fetch,openPopup:e.openPopup}),ownsAuth:!0}}function We(s){if(typeof s!="object"||s===null)return!1;const e=s;return typeof e.onAuthChange=="function"&&typeof e.getCachedSession=="function"&&typeof e.signOut=="function"}function Ze(s,e){return s.open===e.open&&s.view===e.view&&s.error===e.error}function Xe(s,e){return s.mode===e.mode&&s.payload===e.payload&&s.storage===e.storage}function Y(s){if(!s)return null;const e=new URLSearchParams(s),t=e.get(M.status);return t?{status:t,priceId:e.get(M.priceId),sessionId:e.get(M.sessionId)}:null}function Ye(s){if(!(typeof window>"u"||!window.opener))try{window.opener.postMessage({type:"paywall_purchase",status:s.status,priceId:s.priceId,sessionId:s.sessionId},"*")}catch{}}function Je(s){const e=(n,i)=>{if(!n)return"";const o=new URLSearchParams(n.replace(/^[?#]/,""));o.delete(M.status),o.delete(M.priceId),o.delete(M.sessionId);const l=o.toString();return l?i+l:""},t=s.pathname+e(s.search,"?")+e(s.hash,"#");window.history.replaceState(null,"",t)}class Ke{constructor(e,t,n){this.transport=e,this.paywallId=t,this.config=n}async check(){return this.transport.request("trial.check",{paywallId:this.paywallId,config:this.config})}async recordBlock(){return this.transport.request("trial.recordBlock",{paywallId:this.paywallId,config:this.config})}async reset(){await this.transport.request("trial.reset",{paywallId:this.paywallId,config:this.config})}}class ee{constructor(e,t){this.transport=e,this.cachedBootstrap=null,this.cachedUser=null,this.cachedBalances=null,this.identity=null,this.userListeners=new Set,this.balanceListeners=new Set,this.unsubUserBroadcast=null,this.unsubBalancesBroadcast=null,this.paywallId=t.paywallId,this.apiOrigin=t.apiOrigin,this.remoteStorageAdapter={getItem:n=>this.transport.request("storage.get",{key:n}),setItem:async(n,i)=>{await this.transport.request("storage.set",{key:n,value:i})},removeItem:async n=>{await this.transport.request("storage.remove",{key:n})}},this.unsubUserBroadcast=this.transport.on("userChange",n=>{this.applyUser(n)}),this.unsubBalancesBroadcast=this.transport.on("balancesChange",n=>{this.applyBalances([...n])})}async bootstrap(e={}){const t=await this.transport.request("billing.bootstrap",{force:e.force},{signal:e.signal});return this.cachedBootstrap=t,t.user&&this.applyUser(t.user),t}getCachedBootstrap(){return this.cachedBootstrap}async getPrices(e={}){return(await this.bootstrap(e)).prices}getCachedPrices(){return this.cachedBootstrap?.prices??null}async getVisitorId(){return this.transport.request("billing.getVisitorId",void 0)}async getUser(e={}){const t=await this.transport.request("billing.getUser",{force:e.force},{signal:e.signal});return this.applyUser(t),t}getCachedUser(){return this.cachedUser}onUserChange(e,t={}){this.userListeners.add(e);const n=t.immediate??"microtask";if(this.cachedUser&&n!=="none"){const i=this.cachedUser;if(n==="sync")try{e(i)}catch(o){console.warn("[paywall] onUserChange initial sync threw",o)}else queueMicrotask(()=>{this.userListeners.has(e)&&e(i)})}return()=>{this.userListeners.delete(e)}}async getBalances(e={}){const n=[...await this.transport.request("billing.getBalances",{force:e.force},{signal:e.signal})];return this.applyBalances(n),n}getCachedBalances(){return this.cachedBalances}onBalanceChange(e,t={}){this.balanceListeners.add(e);const n=t.immediate??"microtask";if(this.cachedBalances&&n!=="none"){const i=this.cachedBalances;if(n==="sync")try{e(i)}catch(o){console.warn("[paywall] onBalanceChange initial sync threw",o)}else queueMicrotask(()=>{this.balanceListeners.has(e)&&e(i)})}return()=>{this.balanceListeners.delete(e)}}async createCheckout(e){const{signal:t,...n}=e;return this.transport.request("billing.createCheckout",n,{signal:t})}async listPurchases(e={}){return[...await this.transport.request("billing.listPurchases",void 0,{signal:e.signal})]}async cancelSubscription(e){const{signal:t,...n}=e;return this.transport.request("billing.cancelSubscription",n,{signal:t})}getStorage(){return this.remoteStorageAdapter}createTrialStore(e){return new Ke(this.transport,this.paywallId,e)}getIdentity(){return this.identity}async setIdentity(e){this.identity=e,await this.transport.request("billing.setIdentity",{identity:e})}async syncIdentity(){const e=await this.transport.request("billing.getIdentity",void 0);return this.identity=e,e}destroy(){this.unsubUserBroadcast?.(),this.unsubBalancesBroadcast?.(),this.unsubUserBroadcast=null,this.unsubBalancesBroadcast=null,this.userListeners.clear(),this.balanceListeners.clear(),this.cachedBootstrap=null,this.cachedUser=null,this.cachedBalances=null,this.identity=null}applyUser(e){Qe(this.cachedUser,e)||(this.cachedUser=e,this.fireUserListeners(e))}applyBalances(e){et(this.cachedBalances,e)||(this.cachedBalances=e,this.fireBalanceListeners(e))}fireUserListeners(e){for(const t of[...this.userListeners])try{t(e)}catch(n){console.warn("[paywall] onUserChange listener threw",n)}}fireBalanceListeners(e){for(const t of[...this.balanceListeners])try{t(e)}catch(n){console.warn("[paywall] onBalanceChange listener threw",n)}}}function Qe(s,e){return s===e?!0:!s||!e?!1:s.has_active_subscription===e.has_active_subscription&&(s.purchases?.length??0)===(e.purchases?.length??0)}function et(s,e){if(s===e)return!0;if(!s||!e||s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t].type!==e[t].type||s[t].count!==e[t].count)return!1;return!0}class te{constructor(e,t){this.transport=e,this.session=null,this.listeners=new Set,this.unsubBroadcast=null,this.paywallId=t.paywallId,this.apiOrigin=t.apiOrigin,this.unsubBroadcast=this.transport.on("authChange",n=>{this.applySession(n)}),this.hydrated=this.transport.request("auth.getCachedSession",void 0).then(n=>{this.session===null&&n!==null&&this.applySession(n)}).catch(()=>{})}ready(){return this.hydrated}getCachedSession(){return this.session}getCachedUser(){return this.session?.user??null}onAuthChange(e){if(this.listeners.add(e),this.session){const t=this.session;queueMicrotask(()=>{this.listeners.has(e)&&e(t)})}return()=>{this.listeners.delete(e)}}async signInWithEmail(e){const t=await this.transport.request("auth.signInWithEmail",e);return this.applySession(t),t}async signUp(e){const t=await this.transport.request("auth.signUp",e);return t.kind==="signed_in"&&this.applySession(t.session),t}async signOut(){await this.transport.request("auth.signOut",void 0)}async refresh(){const e=await this.transport.request("auth.refresh",void 0);return this.applySession(e),e}async sendOtp(e){await this.transport.request("auth.sendOtp",e)}async verifyOtp(e){const t=await this.transport.request("auth.verifyOtp",e);return this.applySession(t),t}async resendConfirmation(e){await this.transport.request("auth.resendConfirmation",e)}async requestPasswordReset(e){await this.transport.request("auth.requestPasswordReset",e)}async updatePassword(e){await this.transport.request("auth.updatePassword",e)}async revokeAllSessions(){await this.transport.request("auth.revokeAllSessions",void 0)}async signInAnonymously(e={}){const t=await this.transport.request("auth.signInAnonymously",{captchaToken:e.captchaToken,userMeta:e.userMeta,forceCaptcha:e.forceCaptcha});return this.applySession(t),t}async getAccessToken(){return this.transport.request("auth.getAccessToken",void 0)}async signInWithOAuth(e){if(typeof window>"u")throw new y.PaywallError("oauth_unavailable","window is required for OAuth");const t=`pw-oauth-pending-${Math.random().toString(36).slice(2,10)}`,n=window.open("about:blank",t,"width=480,height=640,popup=yes");if(!n)throw new y.PaywallError("popup_blocked","browser blocked auth popup — call from a user gesture");st(n,e.provider);try{const{authorizeUrl:i,state:o}=await this.transport.request("auth.oauthStart",{provider:e.provider,scopes:e.scopes,userMeta:e.userMeta});n.name=`pw-oauth-${o}`,n.location.replace(i),e.onPopupOpened?.();const l=await y.waitForOAuthCode(n,o),a=await this.transport.request("auth.oauthExchange",{state:o,code:l});return this.applySession(a),a}catch(i){try{n.close()}catch{}throw i}}destroy(){this.unsubBroadcast?.(),this.unsubBroadcast=null,this.listeners.clear(),this.session=null}applySession(e){if(!tt(this.session,e)){this.session=e;for(const t of[...this.listeners])try{t(e)}catch(n){console.warn("[paywall] onAuthChange listener threw",n)}}}}function tt(s,e){return s===e?!0:!s||!e?!1:s.access_token===e.access_token&&s.refresh_token===e.refresh_token&&s.expires_at===e.expires_at&&s.user.id===e.user.id}const rt={google:"Google",apple:"Apple",github:"GitHub",facebook:"Facebook"};function st(s,e){const t=rt[e]??e;try{const n=s.document;n.title=`Sign in with ${t}`;const i=n.createElement("style");i.textContent="html,body{margin:0;padding:0;height:100%;font-family:-apple-system,system-ui,sans-serif;background:#fafafa;color:#475569}.pw-oauth-wrap{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:16px}.pw-oauth-spinner{width:36px;height:36px;border:3px solid #e2e8f0;border-top-color:#7c3aed;border-radius:50%;animation:pw-oauth-spin 800ms linear infinite}.pw-oauth-label{font-size:14px;font-weight:500;letter-spacing:-0.01em}@keyframes pw-oauth-spin{to{transform:rotate(360deg)}}",n.head.appendChild(i);const o=n.createElement("div");o.className="pw-oauth-wrap";const l=n.createElement("div");l.className="pw-oauth-spinner";const a=n.createElement("div");a.className="pw-oauth-label",a.textContent=`Connecting to ${t}…`,o.appendChild(l),o.appendChild(a),n.body.appendChild(o)}catch{}}class re{constructor(e){this.transport=e}track(e,t){typeof e!="string"||e.length===0||this.transport.request("tracker.track",{name:e,props:t}).catch(n=>{console.warn("[paywall] track failed",n)})}}class nt{constructor(e){this.factory=e,this.channel=null,this.channelDisposers=[],this.pending=new Map,this.listeners=new Map,this.destroyed=!1,this.nextId=0,this.clientId=`c-${Math.random().toString(36).slice(2,10)}`}ensureChannel(){if(this.destroyed)throw new Error("TransportClient destroyed");if(this.channel)return this.channel;const e=this.factory();this.channel=e;const t=e.onMessage(i=>this.handleMessage(i)),n=e.onDisconnect(()=>this.handleDisconnect());return this.channelDisposers=[t,n],this.request("handshake",{protocolVersion:y.PROTOCOL_VERSION,clientId:this.clientId}).then(i=>{i.protocolVersion!==y.PROTOCOL_VERSION&&console.warn(`[sdk-extension] protocol version mismatch: client=${y.PROTOCOL_VERSION}, offscreen=${i.protocolVersion}. Update host's @monetize.software/sdk-extension.`)}).catch(()=>{}),e}handleMessage(e){if(ot(e)){if(e.type==="response"){const t=this.pending.get(e.id);if(!t)return;this.pending.delete(e.id),t.signal?.removeEventListener("abort",t.abortListener),e.ok?t.resolve(e.result):t.reject(y.reconstructError(e.error));return}if(e.type==="event"){const t=this.listeners.get(e.kind);if(!t)return;for(const n of[...t])try{n(e.payload)}catch(i){console.error("[sdk-extension] event handler threw",i)}}}}handleDisconnect(){for(const t of this.channelDisposers)t();this.channelDisposers=[],this.channel=null;const e=Array.from(this.pending.values());this.pending.clear();for(const t of e)t.signal?.removeEventListener("abort",t.abortListener),t.reject(new it)}request(e,t,n={}){if(this.destroyed)return Promise.reject(new Error("TransportClient destroyed"));if(n.signal?.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));const i=this.ensureChannel(),o=`r${++this.nextId}`;return new Promise((l,a)=>{const u={resolve:l,reject:a,signal:n.signal};n.signal&&(u.abortListener=()=>{if(this.pending.delete(o)){a(new DOMException("Aborted","AbortError"));try{i.send({type:"cancel",id:o})}catch{}}},n.signal.addEventListener("abort",u.abortListener)),this.pending.set(o,u);const c={type:"request",id:o,kind:e,params:t};try{i.send(c)}catch(x){this.pending.delete(o),n.signal?.removeEventListener("abort",u.abortListener),a(x)}})}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n));const i=t;return n.add(i),this.ensureChannel(),()=>{n.delete(i)}}destroy(){if(this.destroyed)return;this.destroyed=!0;for(const t of this.channelDisposers)t();this.channelDisposers=[],this.listeners.clear();const e=Array.from(this.pending.values());this.pending.clear();for(const t of e)t.signal?.removeEventListener("abort",t.abortListener),t.reject(new Error("TransportClient destroyed"));this.channel?.close(),this.channel=null}}class it extends Error{constructor(){super("Transport channel disconnected mid-request"),this.code="transport_disconnected",this.name="TransportDisconnectedError"}}function ot(s){if(typeof s!="object"||s===null)return!1;const e=s.type;return e==="request"||e==="response"||e==="event"}let O=null;function se(){return O||(O=new nt(()=>y.createRuntimeChannel(ne.PORT_NAME)),O)}class lt extends He{constructor(e){const t=se(),n=new ee(t,{paywallId:e.paywallId,apiOrigin:e.apiOrigin});let i;e.auth===!0?i=new te(t,{paywallId:e.paywallId,apiOrigin:e.apiOrigin}):e.auth&&console.warn("[sdk-extension] passing AuthClient instance to PaywallUI.opts.auth is not supported in extension mode — pass `auth: true` to use offscreen-shared auth, or omit for hybrid identity-only mode."),i&&(n.auth=i),super({...e,client:n,auth:i,analytics:!1}),this.remoteTracker=null,this.trackerUnsubs=[],e.analytics!==!1&&(this.remoteTracker=new re(t),this.bindAnalytics())}bindAnalytics(){const e=this.remoteTracker;e&&this.trackerUnsubs.push(this.on("open",()=>e.track("paywall_opened")),this.on("ready",t=>e.track("paywall_viewed",{is_test_mode:t.settings.is_test_mode,prices_count:t.prices.length,offers_count:t.offers.length})),this.on("price_selected",t=>e.track("price_selected",{price_id:t.priceId})),this.on("checkout_started",t=>e.track("checkout_started",{price_id:t.priceId,acquiring:t.acquiring})),this.on("purchase_completed",t=>e.track("purchase_completed",{price_id:t.priceId,session_id:t.sessionId})),this.on("purchase_failed",t=>e.track("purchase_failed",{reason:t.reason})),this.on("close",()=>e.track("paywall_closed")),this.on("trial_blocked",t=>e.track("trial_blocked",{mode:t.mode,...t.mode==="time"?{remaining_ms:t.remainingMs,total_ms:t.totalMs}:t.mode==="opens"?{remaining_actions:t.remainingActions,total_actions:t.totalActions}:{}})),this.on("trial_expired",()=>e.track("trial_expired")),this.on("visibility_blocked",t=>e.track("visibility_blocked",{reason:t.reason,country:t.country,tier:t.tier})),this.on("error",t=>e.track("error",{code:t.code,message:t.message})))}track(e,t){this.remoteTracker?.track(e,t)}destroy(){for(const e of this.trackerUnsubs)e();this.trackerUnsubs=[],this.remoteTracker=null,super.destroy()}}exports.PROTOCOL_VERSION=y.PROTOCOL_VERSION;exports.PaywallUI=lt;exports.RemoteAuthClient=te;exports.RemoteBillingClient=ee;exports.RemoteEventTracker=re;exports.getContentTransport=se;
|
|
26
26
|
//# sourceMappingURL=content.cjs.map
|