@monetize.software/sdk-extension 3.0.0-alpha.2 → 3.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -20
  3. package/dist/chunks/ar-7cgIM-Vl.js +2 -0
  4. package/dist/chunks/ar-7cgIM-Vl.js.map +1 -0
  5. package/dist/chunks/ar-B2Wg_IrC.js +126 -0
  6. package/dist/chunks/ar-B2Wg_IrC.js.map +1 -0
  7. package/dist/chunks/chrome-port-BEMjZQAH.js +2 -0
  8. package/dist/chunks/chrome-port-BEMjZQAH.js.map +1 -0
  9. package/dist/chunks/{chrome-port-DPFUj1MP.js → chrome-port-bfTUUDz_.js} +332 -211
  10. package/dist/chunks/chrome-port-bfTUUDz_.js.map +1 -0
  11. package/dist/chunks/cs-BNo9Dx0Q.js +122 -0
  12. package/dist/chunks/cs-BNo9Dx0Q.js.map +1 -0
  13. package/dist/chunks/cs-S05PC5AC.js +2 -0
  14. package/dist/chunks/cs-S05PC5AC.js.map +1 -0
  15. package/dist/chunks/da-Bi4zBG14.js +2 -0
  16. package/dist/chunks/da-Bi4zBG14.js.map +1 -0
  17. package/dist/chunks/da-Do9Lq6En.js +122 -0
  18. package/dist/chunks/da-Do9Lq6En.js.map +1 -0
  19. package/dist/chunks/de-C8pDZNvx.js +141 -0
  20. package/dist/chunks/de-C8pDZNvx.js.map +1 -0
  21. package/dist/chunks/de-nCDB6D2W.js +2 -0
  22. package/dist/chunks/de-nCDB6D2W.js.map +1 -0
  23. package/dist/chunks/el-BrKaa978.js +2 -0
  24. package/dist/chunks/el-BrKaa978.js.map +1 -0
  25. package/dist/chunks/el-DzMNX-_P.js +126 -0
  26. package/dist/chunks/el-DzMNX-_P.js.map +1 -0
  27. package/dist/chunks/es-B-Wtyzrl.js +2 -0
  28. package/dist/chunks/es-B-Wtyzrl.js.map +1 -0
  29. package/dist/chunks/es-YrKt-q4w.js +141 -0
  30. package/dist/chunks/es-YrKt-q4w.js.map +1 -0
  31. package/dist/chunks/fi-Bh44pwZ4.js +122 -0
  32. package/dist/chunks/fi-Bh44pwZ4.js.map +1 -0
  33. package/dist/chunks/fi-D1SGXjnO.js +2 -0
  34. package/dist/chunks/fi-D1SGXjnO.js.map +1 -0
  35. package/dist/chunks/fr-Bc0pw4ws.js +141 -0
  36. package/dist/chunks/fr-Bc0pw4ws.js.map +1 -0
  37. package/dist/chunks/fr-BhYf-iKk.js +2 -0
  38. package/dist/chunks/fr-BhYf-iKk.js.map +1 -0
  39. package/dist/chunks/he-BXAaFv6Y.js +2 -0
  40. package/dist/chunks/he-BXAaFv6Y.js.map +1 -0
  41. package/dist/chunks/he-Bfm-bhe3.js +126 -0
  42. package/dist/chunks/he-Bfm-bhe3.js.map +1 -0
  43. package/dist/chunks/hi-D-O-B9Dn.js +126 -0
  44. package/dist/chunks/hi-D-O-B9Dn.js.map +1 -0
  45. package/dist/chunks/hi-xblDO0O7.js +2 -0
  46. package/dist/chunks/hi-xblDO0O7.js.map +1 -0
  47. package/dist/chunks/hu-CmIuAbLL.js +122 -0
  48. package/dist/chunks/hu-CmIuAbLL.js.map +1 -0
  49. package/dist/chunks/hu-Wa46p0y4.js +2 -0
  50. package/dist/chunks/hu-Wa46p0y4.js.map +1 -0
  51. package/dist/chunks/id-CQEo5X94.js +2 -0
  52. package/dist/chunks/id-CQEo5X94.js.map +1 -0
  53. package/dist/chunks/id-DN7IES-A.js +122 -0
  54. package/dist/chunks/id-DN7IES-A.js.map +1 -0
  55. package/dist/chunks/it-8AYCm0xz.js +2 -0
  56. package/dist/chunks/it-8AYCm0xz.js.map +1 -0
  57. package/dist/chunks/it-Cz5Nmqx5.js +141 -0
  58. package/dist/chunks/it-Cz5Nmqx5.js.map +1 -0
  59. package/dist/chunks/ja-BH9BlBh2.js +145 -0
  60. package/dist/chunks/ja-BH9BlBh2.js.map +1 -0
  61. package/dist/chunks/ja-q-COVayn.js +2 -0
  62. package/dist/chunks/ja-q-COVayn.js.map +1 -0
  63. package/dist/chunks/ko-B6HRCscZ.js +2 -0
  64. package/dist/chunks/ko-B6HRCscZ.js.map +1 -0
  65. package/dist/chunks/ko-CYV9QuYs.js +145 -0
  66. package/dist/chunks/ko-CYV9QuYs.js.map +1 -0
  67. package/dist/chunks/nl-BvkB900D.js +141 -0
  68. package/dist/chunks/nl-BvkB900D.js.map +1 -0
  69. package/dist/chunks/nl-CAd6_xlm.js +2 -0
  70. package/dist/chunks/nl-CAd6_xlm.js.map +1 -0
  71. package/dist/chunks/no-3s9_ormb.js +122 -0
  72. package/dist/chunks/no-3s9_ormb.js.map +1 -0
  73. package/dist/chunks/no-CAmz6bz6.js +2 -0
  74. package/dist/chunks/no-CAmz6bz6.js.map +1 -0
  75. package/dist/chunks/pl-C9WTGQtb.js +122 -0
  76. package/dist/chunks/pl-C9WTGQtb.js.map +1 -0
  77. package/dist/chunks/pl-DqUSTCaF.js +2 -0
  78. package/dist/chunks/pl-DqUSTCaF.js.map +1 -0
  79. package/dist/chunks/port-name-CF4WQQ3-.js +2 -0
  80. package/dist/chunks/port-name-CF4WQQ3-.js.map +1 -0
  81. package/dist/chunks/port-name-ervLBWAQ.js +6 -0
  82. package/dist/chunks/port-name-ervLBWAQ.js.map +1 -0
  83. package/dist/chunks/pt-8ARZnH0_.js +2 -0
  84. package/dist/chunks/pt-8ARZnH0_.js.map +1 -0
  85. package/dist/chunks/pt-uFVUv_Op.js +141 -0
  86. package/dist/chunks/pt-uFVUv_Op.js.map +1 -0
  87. package/dist/chunks/ro-BrqQ8Au-.js +122 -0
  88. package/dist/chunks/ro-BrqQ8Au-.js.map +1 -0
  89. package/dist/chunks/ro-D-NMbp2F.js +2 -0
  90. package/dist/chunks/ro-D-NMbp2F.js.map +1 -0
  91. package/dist/chunks/ru-8gbHPh0g.js +2 -0
  92. package/dist/chunks/ru-8gbHPh0g.js.map +1 -0
  93. package/dist/chunks/ru-DK594dA8.js +144 -0
  94. package/dist/chunks/ru-DK594dA8.js.map +1 -0
  95. package/dist/chunks/sv-CHNH8-mq.js +122 -0
  96. package/dist/chunks/sv-CHNH8-mq.js.map +1 -0
  97. package/dist/chunks/sv-D8a8hmx9.js +2 -0
  98. package/dist/chunks/sv-D8a8hmx9.js.map +1 -0
  99. package/dist/chunks/th-DfjUK0Y7.js +2 -0
  100. package/dist/chunks/th-DfjUK0Y7.js.map +1 -0
  101. package/dist/chunks/th-l24Pm5q-.js +126 -0
  102. package/dist/chunks/th-l24Pm5q-.js.map +1 -0
  103. package/dist/chunks/tr-ADpigSY5.js +122 -0
  104. package/dist/chunks/tr-ADpigSY5.js.map +1 -0
  105. package/dist/chunks/tr-BdBpz4tL.js +2 -0
  106. package/dist/chunks/tr-BdBpz4tL.js.map +1 -0
  107. package/dist/chunks/uk-CGqo4jek.js +144 -0
  108. package/dist/chunks/uk-CGqo4jek.js.map +1 -0
  109. package/dist/chunks/uk-Cx1zv1ao.js +2 -0
  110. package/dist/chunks/uk-Cx1zv1ao.js.map +1 -0
  111. package/dist/chunks/vi-Dk9bTu6f.js +122 -0
  112. package/dist/chunks/vi-Dk9bTu6f.js.map +1 -0
  113. package/dist/chunks/vi-oe2dW21I.js +2 -0
  114. package/dist/chunks/vi-oe2dW21I.js.map +1 -0
  115. package/dist/chunks/zh-CwczPMPp.js +2 -0
  116. package/dist/chunks/zh-CwczPMPp.js.map +1 -0
  117. package/dist/chunks/zh-LDkEV2D9.js +145 -0
  118. package/dist/chunks/zh-LDkEV2D9.js.map +1 -0
  119. package/dist/content/PaywallUI.d.ts +1 -1
  120. package/dist/content/RemoteAuthClient.d.ts +8 -4
  121. package/dist/content/RemoteAuthClient.d.ts.map +1 -1
  122. package/dist/content/RemoteAuthClient.test-d.d.ts +2 -0
  123. package/dist/content/RemoteAuthClient.test-d.d.ts.map +1 -0
  124. package/dist/content/RemoteBillingClient.d.ts +36 -3
  125. package/dist/content/RemoteBillingClient.d.ts.map +1 -1
  126. package/dist/content/RemoteBillingClient.test-d.d.ts +2 -0
  127. package/dist/content/RemoteBillingClient.test-d.d.ts.map +1 -0
  128. package/dist/content/RemoteTrialStore.d.ts +2 -2
  129. package/dist/content.cjs +3 -3
  130. package/dist/content.cjs.map +1 -1
  131. package/dist/content.js +2478 -1049
  132. package/dist/content.js.map +1 -1
  133. package/dist/offscreen/server.d.ts +3 -3
  134. package/dist/offscreen/server.d.ts.map +1 -1
  135. package/dist/offscreen.cjs +1 -1
  136. package/dist/offscreen.cjs.map +1 -1
  137. package/dist/offscreen.js +18 -15
  138. package/dist/offscreen.js.map +1 -1
  139. package/dist/shared/messages.d.ts +28 -5
  140. package/dist/shared/messages.d.ts.map +1 -1
  141. package/dist/shared/port-name.d.ts +1 -0
  142. package/dist/shared/port-name.d.ts.map +1 -1
  143. package/dist/shared/protocol.d.ts +1 -1
  144. package/dist/shared/protocol.d.ts.map +1 -1
  145. package/dist/sw.cjs +1 -1
  146. package/dist/sw.cjs.map +1 -1
  147. package/dist/sw.js +14 -14
  148. package/dist/sw.js.map +1 -1
  149. package/package.json +39 -21
  150. package/dist/chunks/chrome-port-DPFUj1MP.js.map +0 -1
  151. package/dist/chunks/chrome-port-MoMohiHB.js +0 -2
  152. package/dist/chunks/chrome-port-MoMohiHB.js.map +0 -1
  153. package/dist/chunks/port-name-BPfQKtdb.js +0 -5
  154. package/dist/chunks/port-name-BPfQKtdb.js.map +0 -1
  155. package/dist/chunks/port-name-qwB109u9.js +0 -2
  156. package/dist/chunks/port-name-qwB109u9.js.map +0 -1
package/dist/content.js CHANGED
@@ -1,16 +1,58 @@
1
- import { P as T, B as ae, E as ce, c as ue, A as H, w as he, a as R, r as de, b as pe } from "./chunks/chrome-port-DPFUj1MP.js";
2
- import { render as z, h as G } from "preact";
3
- import { jsxs as u, jsx as o, Fragment as ne } from "preact/jsx-runtime";
4
- import { useRef as B, useEffect as M, useState as x, useMemo as ie } from "preact/hooks";
5
- import { P as fe } from "./chunks/port-name-BPfQKtdb.js";
6
- const oe = '@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}}';
7
- let W = !1;
8
- function ge() {
9
- if (W || (W = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
1
+ import { P as L, B as De, E as ze, c as qe, A as ue, w as Ne, a as J, r as Fe, b as $e } from "./chunks/chrome-port-bfTUUDz_.js";
2
+ import { render as Q, h as de, createContext as Ve } from "preact";
3
+ import { jsx as o, jsxs as u, Fragment as ae } from "preact/jsx-runtime";
4
+ import { useState as k, useEffect as P, useContext as He, useRef as j, useMemo as Ge, useLayoutEffect as We } from "preact/hooks";
5
+ import { P as Ze } from "./chunks/port-name-ervLBWAQ.js";
6
+ function Ye(r) {
7
+ return `pw-offer-${r}-start`;
8
+ }
9
+ function N(r, e) {
10
+ if (!r || r.length === 0) return null;
11
+ const t = r.find(
12
+ (i) => i.price_id === e && (i.discount_percent ?? 0) > 0
13
+ );
14
+ return t || (r.find(
15
+ (i) => i.price_id == null && (i.discount_percent ?? 0) > 0
16
+ ) ?? null);
17
+ }
18
+ function Ke(r, e = {}) {
19
+ const t = r.discount_percent ?? 0;
20
+ if (t <= 0) return null;
21
+ const n = e.now ?? Date.now(), i = Xe(r, e.readStart), s = Je(r, i), a = i !== null ? Math.max(0, i - n) : null;
22
+ return i !== null && i <= n ? null : { offer: r, discountPercent: t, remainingMs: a, totalMs: s, expiresAt: i };
23
+ }
24
+ function Xe(r, e) {
25
+ if (r.expires_at) {
26
+ const t = Date.parse(r.expires_at);
27
+ return Number.isFinite(t) ? t : null;
28
+ }
29
+ if (r.duration_minutes && r.duration_minutes > 0 && e) {
30
+ const t = e(r.id);
31
+ if (!t) return null;
32
+ const n = Date.parse(t);
33
+ return Number.isFinite(n) ? n + r.duration_minutes * 6e4 : null;
34
+ }
35
+ return null;
36
+ }
37
+ function Je(r, e) {
38
+ return r.duration_minutes && r.duration_minutes > 0 ? r.duration_minutes * 6e4 : e !== null ? e - Date.now() : null;
39
+ }
40
+ function Qe(r) {
41
+ if (typeof window > "u") return null;
42
+ try {
43
+ return window.localStorage.getItem(Ye(r));
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+ const Se = '@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;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}*,*:before,*:after{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,*:before,*:after{box-sizing:border-box}button{font-family:inherit;cursor:pointer}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}.pw-cta-shimmer:before{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.35) 50%,transparent);animation:pw-cta-shimmer 3s infinite;z-index:1}@keyframes pw-cta-shimmer{0%{left:-100%}to{left:100%}}';
49
+ let he = !1;
50
+ function et() {
51
+ if (he || (he = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
10
52
  let r;
11
53
  try {
12
54
  const e = new CSSStyleSheet();
13
- e.replaceSync(oe), r = e.cssRules;
55
+ e.replaceSync(Se), r = e.cssRules;
14
56
  } catch {
15
57
  return;
16
58
  }
@@ -28,12 +70,12 @@ function ge() {
28
70
  }
29
71
  }
30
72
  }
31
- function me(r, e, t = {}) {
73
+ function tt(r, e, t = {}) {
32
74
  if (typeof document > "u")
33
75
  throw new Error("mountShadow called in non-DOM environment");
34
- ge();
76
+ et();
35
77
  const n = t.host ?? document.createElement("div");
36
- 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);
78
+ 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);
37
79
  const i = n.attachShadow({ mode: t.shadowMode ?? "closed" }), s = `
38
80
  :host {
39
81
  all: initial !important;
@@ -52,124 +94,230 @@ function me(r, e, t = {}) {
52
94
  cursor: auto !important;
53
95
  visibility: visible !important;
54
96
  }
55
- `, l = document.createElement("style");
56
- l.textContent = s + oe + (t.injectCss ?? ""), i.appendChild(l);
57
- const a = document.createElement("div");
58
- a.style.pointerEvents = "auto", i.appendChild(a);
97
+ `, a = document.createElement("style");
98
+ a.textContent = s + Se + (t.injectCss ?? ""), i.appendChild(a);
99
+ const l = document.createElement("div");
100
+ l.style.pointerEvents = "auto", i.appendChild(l);
59
101
  let c = e;
60
- return z(G(r, c), a), {
102
+ return Q(de(r, c), l), {
61
103
  shadowRoot: i,
62
- update(p) {
63
- c = { ...c, ...p }, z(G(r, c), a);
104
+ update(h) {
105
+ c = { ...c, ...h }, Q(de(r, c), l);
64
106
  },
65
107
  unmount() {
66
- z(null, a), n.remove();
108
+ Q(null, l), n.remove();
67
109
  }
68
110
  };
69
111
  }
70
- const Z = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
71
- function ye({
112
+ const rt = (r, e, t) => {
113
+ const n = r[e];
114
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, s) => {
115
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
116
+ s.bind(
117
+ null,
118
+ new Error(
119
+ "Unknown variable dynamic import: " + e + (e.split("/").length !== t ? ". Note that variables only represent file names one level deep." : "")
120
+ )
121
+ )
122
+ );
123
+ });
124
+ }, nt = [
125
+ "ru",
126
+ "uk",
127
+ "de",
128
+ "es",
129
+ "fr",
130
+ "it",
131
+ "pt",
132
+ "pl",
133
+ "cs",
134
+ "hu",
135
+ "ro",
136
+ "nl",
137
+ "sv",
138
+ "da",
139
+ "no",
140
+ "fi",
141
+ "el",
142
+ "tr",
143
+ "id",
144
+ "ar",
145
+ "ja",
146
+ "ko",
147
+ "zh",
148
+ "hi",
149
+ "th",
150
+ "vi",
151
+ "he"
152
+ ], Ce = (r, e, t) => Ae(e, t), Ie = Ve({ t: Ce, locale: "en" });
153
+ function Ae(r, e) {
154
+ if (!e) return r;
155
+ let t = r;
156
+ for (const [n, i] of Object.entries(e))
157
+ t = t.split(`{${n}}`).join(String(i));
158
+ return t;
159
+ }
160
+ const ee = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
161
+ function Le(r) {
162
+ return nt.includes(r);
163
+ }
164
+ function it(r) {
165
+ const e = [];
166
+ if (typeof navigator < "u" && navigator.language) {
167
+ e.push(navigator.language);
168
+ const n = navigator.language.split("-")[0];
169
+ n && n !== navigator.language && e.push(n);
170
+ }
171
+ const t = r.settings.locale_default;
172
+ if (t) {
173
+ e.push(t);
174
+ const n = t.split("-")[0];
175
+ n && n !== t && e.push(n);
176
+ }
177
+ for (const n of e)
178
+ if (Le(n)) return n;
179
+ return null;
180
+ }
181
+ function ot(r, e) {
182
+ return !!r.locales && r.locales[e] !== void 0;
183
+ }
184
+ async function st(r) {
185
+ const e = ee.get(r);
186
+ if (e) return e;
187
+ const t = te.get(r);
188
+ if (t) return t;
189
+ const n = rt(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./chunks/ar-B2Wg_IrC.js"), "./locales/cs.ts": () => import("./chunks/cs-BNo9Dx0Q.js"), "./locales/da.ts": () => import("./chunks/da-Do9Lq6En.js"), "./locales/de.ts": () => import("./chunks/de-C8pDZNvx.js"), "./locales/el.ts": () => import("./chunks/el-DzMNX-_P.js"), "./locales/es.ts": () => import("./chunks/es-YrKt-q4w.js"), "./locales/fi.ts": () => import("./chunks/fi-Bh44pwZ4.js"), "./locales/fr.ts": () => import("./chunks/fr-Bc0pw4ws.js"), "./locales/he.ts": () => import("./chunks/he-Bfm-bhe3.js"), "./locales/hi.ts": () => import("./chunks/hi-D-O-B9Dn.js"), "./locales/hu.ts": () => import("./chunks/hu-CmIuAbLL.js"), "./locales/id.ts": () => import("./chunks/id-DN7IES-A.js"), "./locales/it.ts": () => import("./chunks/it-Cz5Nmqx5.js"), "./locales/ja.ts": () => import("./chunks/ja-BH9BlBh2.js"), "./locales/ko.ts": () => import("./chunks/ko-CYV9QuYs.js"), "./locales/nl.ts": () => import("./chunks/nl-BvkB900D.js"), "./locales/no.ts": () => import("./chunks/no-3s9_ormb.js"), "./locales/pl.ts": () => import("./chunks/pl-C9WTGQtb.js"), "./locales/pt.ts": () => import("./chunks/pt-uFVUv_Op.js"), "./locales/ro.ts": () => import("./chunks/ro-BrqQ8Au-.js"), "./locales/ru.ts": () => import("./chunks/ru-DK594dA8.js"), "./locales/sv.ts": () => import("./chunks/sv-CHNH8-mq.js"), "./locales/th.ts": () => import("./chunks/th-l24Pm5q-.js"), "./locales/tr.ts": () => import("./chunks/tr-ADpigSY5.js"), "./locales/uk.ts": () => import("./chunks/uk-CGqo4jek.js"), "./locales/vi.ts": () => import("./chunks/vi-Dk9bTu6f.js"), "./locales/zh.ts": () => import("./chunks/zh-LDkEV2D9.js") }), `./locales/${r}.ts`, 3).then((i) => {
190
+ const s = i.default ?? {};
191
+ return ee.set(r, s), s;
192
+ }).catch((i) => {
193
+ console.warn(`[paywall] failed to load locale chunk "${r}"`, i);
194
+ const s = {};
195
+ return ee.set(r, s), s;
196
+ }).finally(() => {
197
+ te.delete(r);
198
+ });
199
+ return te.set(r, n), n;
200
+ }
201
+ function at({ bootstrap: r, forceLocale: e, children: t }) {
202
+ const [n, i] = k("en"), [s, a] = k(null);
203
+ P(() => {
204
+ const h = (e && Le(e) ? e : null) ?? (() => {
205
+ if (!r) return null;
206
+ const g = it(r);
207
+ return !g || !ot(r, g) ? null : g;
208
+ })();
209
+ if (!h) {
210
+ (s !== null || n !== "en") && (i("en"), a(null));
211
+ return;
212
+ }
213
+ if (h === n && s) return;
214
+ let d = !1;
215
+ return st(h).then((g) => {
216
+ d || (i(h), a(g));
217
+ }), () => {
218
+ d = !0;
219
+ };
220
+ }, [r, e]);
221
+ const l = {
222
+ locale: n,
223
+ t: s ? (c, h, d) => Ae(s[c] ?? h, d) : Ce
224
+ };
225
+ return /* @__PURE__ */ o(Ie.Provider, { value: l, children: t });
226
+ }
227
+ function S() {
228
+ return He(Ie);
229
+ }
230
+ const pe = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
231
+ function lt({
72
232
  open: r,
73
233
  onClose: e,
74
234
  labelledBy: t,
75
235
  brandColor: n,
76
- testMode: i,
236
+ topBanner: i,
77
237
  allowClose: s = !0,
78
- children: l
238
+ hideCloseButton: a = !1,
239
+ inline: l = !1,
240
+ children: c
79
241
  }) {
80
- const a = B(null), c = B(null);
81
- return M(() => {
242
+ const { t: h } = S(), d = j(null), g = j(null);
243
+ return P(() => {
82
244
  if (!r) return;
83
- c.current = document.activeElement ?? null;
84
- const b = a.current;
85
- b && (b.querySelector(Z) ?? b).focus({ preventScroll: !0 });
86
- const f = (y) => {
245
+ g.current = document.activeElement ?? null;
246
+ const m = d.current;
247
+ m && (m.querySelector(pe) ?? m).focus({ preventScroll: !0 });
248
+ const A = (y) => {
87
249
  if (y.key === "Escape") {
88
250
  if (!s) return;
89
251
  y.stopPropagation(), e();
90
252
  return;
91
253
  }
92
- if (y.key !== "Tab" || !a.current) return;
93
- const _ = Array.from(
94
- a.current.querySelectorAll(Z)
95
- ).filter((w) => !w.hasAttribute("disabled") && w.tabIndex !== -1);
96
- if (_.length === 0) {
254
+ if (y.key !== "Tab" || !d.current) return;
255
+ const C = Array.from(
256
+ d.current.querySelectorAll(pe)
257
+ ).filter((R) => !R.hasAttribute("disabled") && R.tabIndex !== -1);
258
+ if (C.length === 0) {
97
259
  y.preventDefault();
98
260
  return;
99
261
  }
100
- const A = _[0], v = _[_.length - 1], S = document.activeElement;
101
- y.shiftKey && S === A ? (y.preventDefault(), v.focus()) : !y.shiftKey && S === v && (y.preventDefault(), A.focus());
262
+ const I = C[0], O = C[C.length - 1], M = document.activeElement;
263
+ y.shiftKey && M === I ? (y.preventDefault(), O.focus()) : !y.shiftKey && M === O && (y.preventDefault(), I.focus());
102
264
  };
103
- document.addEventListener("keydown", f, !0);
104
- const m = document.body.style.overflow;
105
- return document.body.style.overflow = "hidden", () => {
106
- document.removeEventListener("keydown", f, !0), document.body.style.overflow = m, c.current?.focus?.({ preventScroll: !0 });
265
+ document.addEventListener("keydown", A, !0);
266
+ const b = document.body.style.overflow;
267
+ return l || (document.body.style.overflow = "hidden"), () => {
268
+ document.removeEventListener("keydown", A, !0), l || (document.body.style.overflow = b), g.current?.focus?.({ preventScroll: !0 });
107
269
  };
108
- }, [r, e, s]), r ? /* @__PURE__ */ u(
270
+ }, [r, e, s, l]), r ? /* @__PURE__ */ u(
109
271
  "div",
110
272
  {
111
- class: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-slate-950/50 p-2 sm:p-4 backdrop-blur-md animate-[pw-fade-in_180ms_ease-out]",
112
- onClick: (b) => {
113
- s && b.target === b.currentTarget && e();
273
+ class: `${l ? "absolute z-[1]" : "fixed z-[2147483647]"} inset-0 flex items-center justify-center bg-slate-950/50 p-2 sm:p-4 backdrop-blur-md animate-[pw-fade-in_180ms_ease-out]`,
274
+ onClick: (m) => {
275
+ s && m.target === m.currentTarget && e();
114
276
  },
115
277
  "data-pw-root": !0,
116
278
  children: [
117
279
  /* @__PURE__ */ u(
118
280
  "div",
119
281
  {
120
- ref: a,
121
- role: "dialog",
122
- "aria-modal": "true",
123
- "aria-labelledby": t,
124
- tabIndex: -1,
125
- 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)]",
126
- style: {
127
- "--pw-accent": n ?? "#3b82f6",
128
- 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)"
129
- },
282
+ class: "relative flex w-full max-w-[400px] flex-col animate-[pw-scale-in_220ms_cubic-bezier(0.16,1,0.3,1)]",
283
+ style: { "--pw-accent": n ?? "#3b82f6" },
130
284
  children: [
131
- i && /* @__PURE__ */ u(
285
+ i,
286
+ /* @__PURE__ */ u(
132
287
  "div",
133
288
  {
134
- 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",
135
- role: "status",
289
+ ref: d,
290
+ role: "dialog",
291
+ "aria-modal": "true",
292
+ "aria-labelledby": t,
293
+ tabIndex: -1,
294
+ class: "relative flex max-h-[calc(100dvh-1rem)] sm:max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-xl bg-white outline-none",
295
+ style: {
296
+ boxShadow: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
297
+ },
136
298
  children: [
137
- /* @__PURE__ */ u("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
138
- /* @__PURE__ */ o(
139
- "path",
140
- {
141
- d: "M8 1L15 14H1L8 1Z",
142
- stroke: "currentColor",
143
- "stroke-width": "1.5",
144
- "stroke-linejoin": "round"
145
- }
146
- ),
147
- /* @__PURE__ */ o("path", { d: "M8 6v3", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }),
148
- /* @__PURE__ */ o("circle", { cx: "8", cy: "11.5", r: "0.5", fill: "currentColor" })
149
- ] }),
150
- "Test mode — no real charge"
299
+ c,
300
+ s && !a ? /* @__PURE__ */ o(
301
+ "button",
302
+ {
303
+ type: "button",
304
+ onClick: e,
305
+ "aria-label": h("modal.close_aria", "Close"),
306
+ class: "absolute right-3 top-3 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white/80 text-gray-500 backdrop-blur-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
307
+ children: /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o(
308
+ "path",
309
+ {
310
+ d: "M3 3l10 10M13 3L3 13",
311
+ stroke: "currentColor",
312
+ "stroke-width": "1.75",
313
+ "stroke-linecap": "round"
314
+ }
315
+ ) })
316
+ }
317
+ ) : null
151
318
  ]
152
319
  }
153
- ),
154
- /* @__PURE__ */ o("div", { class: "flex-1 overflow-y-auto p-7", children: l }),
155
- s ? /* @__PURE__ */ o(
156
- "button",
157
- {
158
- type: "button",
159
- onClick: e,
160
- "aria-label": "Close",
161
- 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)]`,
162
- children: /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o(
163
- "path",
164
- {
165
- d: "M3 3l10 10M13 3L3 13",
166
- stroke: "currentColor",
167
- "stroke-width": "1.75",
168
- "stroke-linecap": "round"
169
- }
170
- ) })
171
- }
172
- ) : null
320
+ )
173
321
  ]
174
322
  }
175
323
  ),
@@ -184,20 +332,60 @@ function ye({
184
332
  }
185
333
  ) : null;
186
334
  }
187
- const xe = {
188
- google: "Continue with Google",
189
- apple: "Continue with Apple",
190
- github: "Continue with GitHub",
191
- facebook: "Continue with Facebook"
192
- };
193
- function se({ block: r, ctx: e }) {
194
- const t = e.auth, n = e.authSession, i = r.allow_signup !== !1, s = r.allow_password_reset !== !1, l = r.hide_when_authenticated !== !1;
335
+ function ct(r, e) {
336
+ switch (r) {
337
+ case "google":
338
+ return e("auth.continue_with_google", "Continue with Google");
339
+ case "apple":
340
+ return e("auth.continue_with_apple", "Continue with Apple");
341
+ case "github":
342
+ return e("auth.continue_with_github", "Continue with GitHub");
343
+ case "facebook":
344
+ return e("auth.continue_with_facebook", "Continue with Facebook");
345
+ }
346
+ }
347
+ function fe(r, e, t) {
348
+ const n = e === "signup" ? t("auth.signup_failed", "Sign-up failed") : t("auth.signin_failed", "Sign-in failed");
349
+ if (!(r instanceof L)) return n;
350
+ switch (r.code) {
351
+ case "invalid_credentials":
352
+ return t("auth.invalid_credentials", "Invalid email or password");
353
+ case "email_not_confirmed":
354
+ return t("auth.email_not_confirmed", "Please confirm your email before signing in.");
355
+ case "email_exists":
356
+ case "user_already_exists":
357
+ return t("auth.email_exists", "An account with this email already exists.");
358
+ case "weak_password":
359
+ return t("auth.weak_password", "Password is too weak.");
360
+ case "invalid_otp":
361
+ case "otp_expired":
362
+ case "token_expired":
363
+ return t("auth.invalid_otp", "The code is invalid or has expired.");
364
+ case "over_email_send_rate_limit":
365
+ case "over_request_rate_limit":
366
+ case "rate_limited":
367
+ case "http_429":
368
+ return t("auth.rate_limited", "Too many requests. Please try again later.");
369
+ case "network_error":
370
+ return t("auth.network_error", "Network error. Please check your connection and try again.");
371
+ case "upstream":
372
+ case "upstream_error":
373
+ case "http_502":
374
+ case "http_503":
375
+ case "http_504":
376
+ return t("auth.service_unavailable", "Service is temporarily unavailable. Please try again.");
377
+ default:
378
+ return n;
379
+ }
380
+ }
381
+ function Me({ block: r, ctx: e }) {
382
+ const t = e.auth, n = e.authSession, i = r.allow_signup !== !1, s = r.allow_password_reset !== !1, a = r.hide_when_authenticated !== !1;
195
383
  if (!t)
196
384
  return typeof console < "u" && console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"), null;
197
- const a = n && !n.user.is_anonymous ? n : null;
198
- return a && l ? null : a ? /* @__PURE__ */ o(be, { email: a.user.email ?? "", onSignOut: () => t.signOut().catch(() => {
385
+ const l = n && !n.user.is_anonymous ? n : null;
386
+ return l && a ? null : l ? /* @__PURE__ */ o(ut, { email: l.user.email ?? "", onSignOut: () => t.signOut().catch(() => {
199
387
  }) }) : /* @__PURE__ */ o(
200
- ke,
388
+ dt,
201
389
  {
202
390
  block: r,
203
391
  allowSignup: i,
@@ -206,10 +394,11 @@ function se({ block: r, ctx: e }) {
206
394
  }
207
395
  );
208
396
  }
209
- function be({ email: r, onSignOut: e }) {
210
- return /* @__PURE__ */ u("div", { class: "flex items-center justify-between gap-3 rounded-2xl border border-gray-200 bg-gray-50/60 px-4 py-3", children: [
397
+ function ut({ email: r, onSignOut: e }) {
398
+ const { t } = S();
399
+ return /* @__PURE__ */ u("div", { class: "flex items-center justify-between gap-3 rounded-2xl bg-gray-100 px-4 py-3", children: [
211
400
  /* @__PURE__ */ u("div", { class: "flex flex-col", children: [
212
- /* @__PURE__ */ o("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: "Signed in" }),
401
+ /* @__PURE__ */ o("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: t("auth.signed_in", "Signed in") }),
213
402
  /* @__PURE__ */ o("span", { class: "text-sm font-medium text-gray-900", children: r })
214
403
  ] }),
215
404
  /* @__PURE__ */ o(
@@ -218,1168 +407,2090 @@ function be({ email: r, onSignOut: e }) {
218
407
  type: "button",
219
408
  onClick: e,
220
409
  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)]",
221
- children: "Sign out"
410
+ children: t("auth.sign_out", "Sign out")
222
411
  }
223
412
  )
224
413
  ] });
225
414
  }
226
- function ke({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
227
- const i = n.auth, s = r.providers ?? [], [l, a] = x("signin"), [c, p] = x(""), [g, b] = x(""), [f, m] = x(""), [y, _] = x(null), [A, v] = x(null), [S, w] = x(null), P = async (C) => {
228
- if (C.preventDefault(), !y) {
229
- _("email"), v(null), w(null);
415
+ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
416
+ const { t: i } = S(), s = n.auth, a = r.providers ?? [], l = n.initialAuthMode === "signup" && e ? "signup" : "signin", [c, h] = k(l), [d, g] = k(""), [_, p] = k(""), [v, m] = k(""), [A, b] = k(""), [y, C] = k(null), I = j(!1), [O, M] = k(null), [R, D] = k(null), [z, T] = k(!1), [E, q] = k(null);
417
+ P(() => {
418
+ if (typeof s.getLastLogin != "function") return;
419
+ let f = !1;
420
+ return s.getLastLogin().then(
421
+ (w) => {
422
+ f || !w || (q(w), w.email && g((B) => B === "" ? w.email : B));
423
+ },
424
+ () => {
425
+ }
426
+ ), () => {
427
+ f = !0;
428
+ };
429
+ }, [s]);
430
+ const U = (f) => {
431
+ h(f), M(null), D(null), T(!1);
432
+ }, Y = async (f) => {
433
+ if (f.preventDefault(), !(I.current || y)) {
434
+ I.current = !0;
230
435
  try {
231
- 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({
232
- email: c,
233
- token: f,
234
- type: g ? "recovery" : "email"
235
- }), g && await i.updatePassword({ password: g }));
236
- } catch (I) {
237
- const d = I instanceof T ? I.message : "Something went wrong";
238
- v(d);
436
+ if (M(null), D(null), c === "signup" && !z) {
437
+ if (!d.trim()) return;
438
+ T(!0);
439
+ return;
440
+ }
441
+ if (c === "signup" && _ !== v) {
442
+ M(i("auth.passwords_mismatch", "Passwords don't match"));
443
+ return;
444
+ }
445
+ C("email");
446
+ try {
447
+ c === "signin" ? await s.signInWithEmail({ email: d, password: _ }) : c === "signup" ? (await s.signUp({ email: d, password: _ })).kind === "confirmation_required" && (p(""), h("signup_verify"), D(i("auth.check_email_message", "Check your email for a confirmation code."))) : c === "forgot" ? (await s.requestPasswordReset({ email: d }), h("reset_sent")) : c === "signup_verify" ? await s.verifyOtp({ email: d, token: A, type: "email" }) : c === "reset_verify" && (await s.verifyOtp({
448
+ email: d,
449
+ token: A,
450
+ type: _ ? "recovery" : "email"
451
+ }), _ && await s.updatePassword({ password: _ }));
452
+ } catch (w) {
453
+ M(fe(w, c === "signup" ? "signup" : c === "signup_verify" || c === "reset_verify" ? "otp" : c === "forgot" ? "reset" : "signin", i));
454
+ } finally {
455
+ C(null);
456
+ }
239
457
  } finally {
240
- _(null);
458
+ I.current = !1;
241
459
  }
242
460
  }
243
- }, L = async (C) => {
244
- if (!y) {
245
- _(C), v(null), w(null);
461
+ }, V = async (f) => {
462
+ if (!(I.current || y)) {
463
+ I.current = !0, C(f), M(null), D(null);
246
464
  try {
247
- await i.signInWithOAuth({
248
- provider: C,
249
- onPopupOpened: () => _(null)
465
+ await s.signInWithOAuth({
466
+ provider: f,
467
+ onPopupOpened: () => C(null)
250
468
  });
251
- } catch (I) {
252
- if (I instanceof T) {
253
- if (I.code === "oauth_cancelled" || I.code === "oauth_timeout") return;
254
- v(I.message);
255
- } else
256
- v("Sign-in failed");
469
+ } catch (w) {
470
+ if (w instanceof L && (w.code === "oauth_cancelled" || w.code === "oauth_timeout"))
471
+ return;
472
+ M(fe(w, "signin", i));
257
473
  } finally {
258
- _(null);
474
+ I.current = !1, C(null);
259
475
  }
260
476
  }
261
- };
262
- return /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
263
- r.heading ? /* @__PURE__ */ o("h2", { class: "text-lg font-semibold tracking-tight text-gray-900", children: r.heading }) : null,
264
- s.length > 0 && (l === "signin" || l === "signup") ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
265
- s.map((C) => /* @__PURE__ */ u(
266
- "button",
267
- {
268
- type: "button",
269
- onClick: () => L(C),
270
- disabled: y !== null,
271
- 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)]",
272
- children: [
273
- y === C ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" }) : /* @__PURE__ */ o(_e, { provider: C }),
274
- /* @__PURE__ */ o("span", { children: xe[C] })
275
- ]
276
- },
277
- C
278
- )),
279
- /* @__PURE__ */ o(ve, {})
477
+ }, K = a.length > 0 && (c === "signin" || c === "signup"), X = c === "signin" || c === "signup" || c === "forgot", x = c === "signin" || c === "signup" && z;
478
+ return c === "reset_sent" ? /* @__PURE__ */ o(_t, { email: d, onBack: () => U("signin"), t: i }) : /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
479
+ /* @__PURE__ */ o(ht, { mode: c, customHeading: r.heading, customSubheading: r.subheading }),
480
+ K ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-2.5", children: [
481
+ a.map((f) => /* @__PURE__ */ u("div", { class: "relative", children: [
482
+ /* @__PURE__ */ u(
483
+ "button",
484
+ {
485
+ type: "button",
486
+ onClick: () => V(f),
487
+ disabled: y !== null,
488
+ class: "flex h-12 w-full items-center justify-center gap-2.5 rounded-full border-1 border-gray-200 bg-white px-5 text-base font-medium text-gray-900 transition-all hover:border-gray-300 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
489
+ children: [
490
+ y === f ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" }) : /* @__PURE__ */ o(vt, { provider: f }),
491
+ /* @__PURE__ */ o("span", { children: ct(f, i) })
492
+ ]
493
+ }
494
+ ),
495
+ E?.method === f ? /* @__PURE__ */ o(xt, { email: E.email }) : null
496
+ ] }, f)),
497
+ /* @__PURE__ */ o(kt, {})
280
498
  ] }) : null,
281
- /* @__PURE__ */ u("form", { onSubmit: P, class: "flex flex-col gap-2", children: [
282
- (l === "signin" || l === "signup" || l === "forgot") && /* @__PURE__ */ o(
283
- j,
499
+ /* @__PURE__ */ u("form", { onSubmit: Y, class: "flex flex-col gap-3", children: [
500
+ X && /* @__PURE__ */ o(
501
+ ge,
284
502
  {
285
503
  type: "email",
286
- label: "Email",
287
- value: c,
288
- onInput: p,
504
+ placeholder: i("auth.email", "Email address"),
505
+ value: d,
506
+ onInput: g,
289
507
  autocomplete: "email",
290
508
  required: !0
291
509
  }
292
510
  ),
293
- (l === "signin" || l === "signup") && /* @__PURE__ */ o(
294
- j,
511
+ x && /* @__PURE__ */ o(
512
+ re,
513
+ {
514
+ placeholder: i("auth.password", "Password"),
515
+ value: _,
516
+ onInput: p,
517
+ autocomplete: c === "signin" ? "current-password" : "new-password",
518
+ required: !0
519
+ }
520
+ ),
521
+ c === "signup" && z && /* @__PURE__ */ o(
522
+ re,
295
523
  {
296
- type: "password",
297
- label: "Password",
298
- value: g,
524
+ placeholder: i("auth.repeat_password", "Repeat password"),
525
+ value: v,
526
+ onInput: m,
527
+ autocomplete: "new-password",
528
+ required: !0
529
+ }
530
+ ),
531
+ (c === "signup_verify" || c === "reset_verify") && /* @__PURE__ */ o(
532
+ ge,
533
+ {
534
+ type: "text",
535
+ placeholder: i("auth.confirmation_code", "Confirmation code"),
536
+ value: A,
299
537
  onInput: b,
300
- autocomplete: l === "signin" ? "current-password" : "new-password",
538
+ autocomplete: "one-time-code",
539
+ inputMode: "numeric",
301
540
  required: !0
302
541
  }
303
542
  ),
304
- l === "reset_verify" && /* @__PURE__ */ u(ne, { children: [
305
- /* @__PURE__ */ o(
306
- j,
307
- {
308
- type: "text",
309
- label: "Confirmation code",
310
- value: f,
311
- onInput: m,
312
- autocomplete: "one-time-code",
313
- inputMode: "numeric",
314
- required: !0
315
- }
316
- ),
317
- /* @__PURE__ */ o(
318
- j,
319
- {
320
- type: "password",
321
- label: "New password (optional — only for password reset)",
322
- value: g,
323
- onInput: b,
324
- autocomplete: "new-password"
325
- }
326
- )
327
- ] }),
328
- l === "reset_sent" && S && /* @__PURE__ */ o("p", { class: "rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600", children: S }),
329
- A && /* @__PURE__ */ o("p", { class: "text-xs text-red-600", children: A }),
330
- S && l !== "reset_sent" && /* @__PURE__ */ o("p", { class: "text-xs text-gray-500", children: S }),
331
- l !== "reset_sent" && /* @__PURE__ */ o(
332
- "button",
543
+ c === "reset_verify" && /* @__PURE__ */ o(
544
+ re,
333
545
  {
334
- type: "submit",
335
- disabled: y !== null,
336
- 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)]",
337
- style: {
338
- background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
339
- boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
340
- },
341
- children: y === "email" ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : we(l)
546
+ placeholder: i(
547
+ "auth.new_password_optional",
548
+ "New password (optional only for password reset)"
549
+ ),
550
+ value: _,
551
+ onInput: p,
552
+ autocomplete: "new-password"
553
+ }
554
+ ),
555
+ c === "signin" && t && /* @__PURE__ */ o("div", { class: "flex justify-end text-sm", children: /* @__PURE__ */ o(Z, { onClick: () => U("forgot"), children: i("auth.forgot_password", "Forgot password?") }) }),
556
+ O && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: O }),
557
+ R && /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: R }),
558
+ /* @__PURE__ */ o(
559
+ mt,
560
+ {
561
+ busy: y === "email",
562
+ label: ft(c, z, r.submit_label ?? r.heading, i)
342
563
  }
343
564
  )
344
565
  ] }),
345
- /* @__PURE__ */ u("div", { class: "flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-xs text-gray-500", children: [
346
- l === "signin" && e && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "signup"), class: "font-medium text-gray-700 hover:underline", children: "Create account" }),
347
- l === "signup" && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "signin"), class: "font-medium text-gray-700 hover:underline", children: "I already have an account" }),
348
- l === "signin" && t && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "forgot"), class: "hover:underline", children: "Forgot password?" }),
349
- (l === "forgot" || l === "reset_sent" || l === "reset_verify") && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "signin"), class: "hover:underline", children: "Back to sign in" }),
350
- l === "reset_sent" && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "reset_verify"), class: "font-medium text-gray-700 hover:underline", children: "I have a code" })
351
- ] })
566
+ /* @__PURE__ */ o(
567
+ gt,
568
+ {
569
+ mode: c,
570
+ allowSignup: e,
571
+ onSwitch: U
572
+ }
573
+ )
574
+ ] });
575
+ }
576
+ function ht({
577
+ mode: r,
578
+ customHeading: e,
579
+ customSubheading: t
580
+ }) {
581
+ const { t: n } = S(), i = pt(r, n), s = r === "signin" || r === "signup", a = s && e ? e : i.title, l = s && t !== void 0 ? t || null : i.subtitle;
582
+ return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
583
+ /* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: a }),
584
+ l ? /* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: l }) : null
352
585
  ] });
353
586
  }
354
- function we(r) {
587
+ function pt(r, e) {
355
588
  switch (r) {
356
589
  case "signin":
357
- return "Sign in";
590
+ return {
591
+ title: e("auth.welcome", "Welcome back!"),
592
+ subtitle: e("auth.default_subtitle", "Sign in to access all features and sync your data.")
593
+ };
358
594
  case "signup":
359
- return "Create account";
595
+ return {
596
+ title: e("auth.welcome_signup", "Welcome!"),
597
+ subtitle: e("auth.default_subtitle", "Sign in to access all features and sync your data.")
598
+ };
360
599
  case "forgot":
361
- return "Send reset code";
600
+ return {
601
+ title: e("auth.forgot_password_title", "Forgot password?"),
602
+ subtitle: e(
603
+ "auth.forgot_subtitle",
604
+ "Enter your email and we'll send you a password reset link."
605
+ )
606
+ };
607
+ case "reset_sent":
608
+ return {
609
+ title: e("auth.check_email_title", "Check your email"),
610
+ subtitle: null
611
+ };
612
+ case "reset_verify":
613
+ return {
614
+ title: e("auth.reset_password_title", "Reset password"),
615
+ subtitle: e(
616
+ "auth.reset_password_subtitle",
617
+ "Enter the code from your email and a new password."
618
+ )
619
+ };
620
+ case "signup_verify":
621
+ return {
622
+ title: e("auth.confirm_email_title", "Confirm your email"),
623
+ subtitle: e(
624
+ "auth.confirm_email_subtitle",
625
+ "Enter the code we sent to your email to finish creating your account."
626
+ )
627
+ };
628
+ }
629
+ }
630
+ function ft(r, e, t, n) {
631
+ if (r === "signin" && t) return t;
632
+ switch (r) {
633
+ case "signin":
634
+ return n("auth.log_in", "Sign In");
635
+ case "signup":
636
+ return e ? n("auth.create_account", "Create Account") : n("auth.sign_up", "Sign Up");
637
+ case "forgot":
638
+ return n("auth.send_reset", "Send Reset Email");
639
+ case "signup_verify":
362
640
  case "reset_verify":
363
- return "Verify";
641
+ return n("auth.verify", "Verify");
364
642
  default:
365
- return "Continue";
643
+ return n("cta.continue", "Continue");
366
644
  }
367
645
  }
368
- function O(r, e, t, n) {
369
- r(n), e(null), t(null);
646
+ function gt({
647
+ mode: r,
648
+ allowSignup: e,
649
+ onSwitch: t
650
+ }) {
651
+ const { t: n } = S();
652
+ return r === "signin" && e ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
653
+ n("auth.no_account", "Don't have an account?"),
654
+ " ",
655
+ /* @__PURE__ */ o(Z, { onClick: () => t("signup"), children: n("auth.sign_up_link", "Sign Up") })
656
+ ] }) : r === "signup" || r === "signup_verify" ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
657
+ n("auth.have_account", "Already have an account?"),
658
+ " ",
659
+ /* @__PURE__ */ o(Z, { onClick: () => t("signin"), children: n("auth.log_in_link", "Log In") })
660
+ ] }) : r === "forgot" || r === "reset_sent" || r === "reset_verify" ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
661
+ n("auth.no_account", "Don't have an account?"),
662
+ " ",
663
+ /* @__PURE__ */ o(Z, { onClick: () => t("signup"), children: n("auth.sign_up_link", "Sign Up") })
664
+ ] }) : null;
665
+ }
666
+ function Z({
667
+ onClick: r,
668
+ children: e
669
+ }) {
670
+ return /* @__PURE__ */ o(
671
+ "button",
672
+ {
673
+ type: "button",
674
+ onClick: r,
675
+ class: "font-semibold transition-opacity hover:opacity-80 focus:outline-none focus-visible:opacity-80",
676
+ style: { color: "var(--pw-accent)" },
677
+ children: e
678
+ }
679
+ );
680
+ }
681
+ function mt({ busy: r, label: e }) {
682
+ return /* @__PURE__ */ o(
683
+ "button",
684
+ {
685
+ type: "submit",
686
+ disabled: r,
687
+ class: "pw-cta-shimmer relative mt-1 flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
688
+ style: {
689
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
690
+ boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
691
+ },
692
+ children: r ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: e })
693
+ }
694
+ );
695
+ }
696
+ function ge({ type: r, placeholder: e, value: t, onInput: n, autocomplete: i, inputMode: s, required: a }) {
697
+ return /* @__PURE__ */ o(
698
+ "input",
699
+ {
700
+ type: r,
701
+ value: t,
702
+ placeholder: e,
703
+ onInput: (l) => n(l.target.value),
704
+ autocomplete: i,
705
+ inputMode: s,
706
+ required: a,
707
+ class: "h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"
708
+ }
709
+ );
370
710
  }
371
- function j({ type: r, label: e, value: t, onInput: n, autocomplete: i, inputMode: s, required: l }) {
372
- return /* @__PURE__ */ u("label", { class: "flex flex-col gap-1.5", children: [
373
- /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: e }),
711
+ function re({ placeholder: r, value: e, onInput: t, autocomplete: n, required: i }) {
712
+ const { t: s } = S(), [a, l] = k(!1), c = j(null);
713
+ P(() => {
714
+ const g = c.current;
715
+ g && g.value !== e && (g.value = e);
716
+ }, [a, e]);
717
+ const h = s("auth.show_password", "Show password"), d = s("auth.hide_password", "Hide password");
718
+ return /* @__PURE__ */ u("div", { class: "relative", children: [
374
719
  /* @__PURE__ */ o(
375
720
  "input",
376
721
  {
377
- type: r,
378
- value: t,
379
- onInput: (a) => n(a.target.value),
380
- autocomplete: i,
381
- inputMode: s,
382
- required: l,
383
- 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)]"
722
+ ref: c,
723
+ type: a ? "text" : "password",
724
+ value: e,
725
+ placeholder: r,
726
+ onInput: (g) => t(g.target.value),
727
+ autocomplete: n,
728
+ required: i,
729
+ class: "h-14 w-full rounded-2xl bg-gray-100 pl-5 pr-12 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"
730
+ }
731
+ ),
732
+ /* @__PURE__ */ o(
733
+ "button",
734
+ {
735
+ type: "button",
736
+ onClick: () => l((g) => !g),
737
+ "aria-label": a ? d : h,
738
+ tabIndex: -1,
739
+ class: "absolute right-4 top-1/2 -translate-y-1/2 flex h-6 w-6 items-center justify-center rounded text-gray-500 transition-colors hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
740
+ children: a ? /* @__PURE__ */ o(bt, {}) : /* @__PURE__ */ o(yt, {})
741
+ }
742
+ )
743
+ ] });
744
+ }
745
+ function yt() {
746
+ return /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
747
+ /* @__PURE__ */ o(
748
+ "path",
749
+ {
750
+ d: "M1.667 10S4.583 4.167 10 4.167 18.333 10 18.333 10 15.417 15.833 10 15.833 1.667 10 1.667 10Z",
751
+ stroke: "currentColor",
752
+ "stroke-width": "1.5",
753
+ "stroke-linecap": "round",
754
+ "stroke-linejoin": "round"
755
+ }
756
+ ),
757
+ /* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "2.5", stroke: "currentColor", "stroke-width": "1.5" })
758
+ ] });
759
+ }
760
+ function bt() {
761
+ return /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
762
+ /* @__PURE__ */ o(
763
+ "path",
764
+ {
765
+ d: "M8.236 4.293A6.96 6.96 0 0 1 10 4.167C15.417 4.167 18.333 10 18.333 10a13.5 13.5 0 0 1-1.92 2.755M11.768 11.768A2.5 2.5 0 0 1 8.233 8.233",
766
+ stroke: "currentColor",
767
+ "stroke-width": "1.5",
768
+ "stroke-linecap": "round",
769
+ "stroke-linejoin": "round"
770
+ }
771
+ ),
772
+ /* @__PURE__ */ o(
773
+ "path",
774
+ {
775
+ d: "M14.953 14.953A8.84 8.84 0 0 1 10 15.833C4.583 15.833 1.667 10 1.667 10a13.5 13.5 0 0 1 3.38-3.953M1.667 1.667l16.666 16.666",
776
+ stroke: "currentColor",
777
+ "stroke-width": "1.5",
778
+ "stroke-linecap": "round",
779
+ "stroke-linejoin": "round"
384
780
  }
385
781
  )
386
782
  ] });
387
783
  }
388
- function ve() {
389
- return /* @__PURE__ */ u("div", { class: "flex items-center gap-2 py-1 text-[10px] uppercase tracking-[0.14em] text-gray-400", children: [
390
- /* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gradient-to-r from-gray-200 to-transparent" }),
391
- /* @__PURE__ */ o("span", { children: "or" }),
392
- /* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gradient-to-r from-transparent to-gray-200" })
784
+ function xt({ email: r }) {
785
+ const { t: e } = S(), t = r ? e("auth.last_used", "Last · {email}", { email: wt(r) }) : e("auth.last_used_no_email", "Last");
786
+ return /* @__PURE__ */ o("span", { class: "pointer-events-none absolute -top-2 right-3 max-w-[75%] truncate rounded-full bg-gray-900 px-2 py-0.5 text-[10px] font-semibold tracking-wide text-white shadow-sm", children: t });
787
+ }
788
+ function wt(r) {
789
+ const [e, t] = r.split("@");
790
+ return t ? `${e.slice(0, 3)}*****@${t}` : r;
791
+ }
792
+ function kt() {
793
+ const { t: r } = S();
794
+ return /* @__PURE__ */ u("div", { class: "flex items-center gap-3 py-1 text-sm text-gray-400", children: [
795
+ /* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gray-200" }),
796
+ /* @__PURE__ */ o("span", { children: r("auth.or", "or") }),
797
+ /* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gray-200" })
393
798
  ] });
394
799
  }
395
- function _e({ provider: r }) {
396
- return r === "google" ? /* @__PURE__ */ u("svg", { width: "16", height: "16", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
800
+ function vt({ provider: r }) {
801
+ return r === "google" ? /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
397
802
  /* @__PURE__ */ o("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" }),
398
803
  /* @__PURE__ */ o("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" }),
399
804
  /* @__PURE__ */ o("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" }),
400
805
  /* @__PURE__ */ o("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" })
401
- ] }) : r === "apple" ? /* @__PURE__ */ o("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("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" }) }) : r === "github" ? /* @__PURE__ */ o("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M8 0C3.6 0 0 3.6 0 8a8 8 0 0 0 5.5 7.6c.4.1.5-.2.5-.4v-1.5c-2.2.5-2.7-1-2.7-1-.4-.9-.9-1.2-.9-1.2-.7-.5.1-.5.1-.5.8.1 1.2.8 1.2.8.7 1.2 1.9.9 2.4.7 0-.5.3-.9.5-1.1-1.8-.2-3.6-.9-3.6-4 0-.9.3-1.6.8-2.1-.1-.2-.4-1 .1-2.1 0 0 .7-.2 2.2.8a7.6 7.6 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.4 1.1.2 1.9.1 2.1.5.5.8 1.2.8 2.1 0 3.1-1.9 3.7-3.6 3.9.3.3.6.8.6 1.6V15c0 .2.1.5.6.4A8 8 0 0 0 16 8c0-4.4-3.6-8-8-8Z" }) }) : /* @__PURE__ */ o("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("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" }) });
806
+ ] }) : r === "apple" ? (
807
+ // viewBox 0 0 24 24 даёт воздух сверху/снизу пути, поэтому визуально
808
+ // Apple-яблоко выглядит меньше Google. Компенсируем увеличенным
809
+ // width/height — 26×26 даёт примерно equal optical size с Google 20×20.
810
+ /* @__PURE__ */ o("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) })
811
+ ) : r === "github" ? /* @__PURE__ */ o("svg", { width: "20", height: "20", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M8 0C3.6 0 0 3.6 0 8a8 8 0 0 0 5.5 7.6c.4.1.5-.2.5-.4v-1.5c-2.2.5-2.7-1-2.7-1-.4-.9-.9-1.2-.9-1.2-.7-.5.1-.5.1-.5.8.1 1.2.8 1.2.8.7 1.2 1.9.9 2.4.7 0-.5.3-.9.5-1.1-1.8-.2-3.6-.9-3.6-4 0-.9.3-1.6.8-2.1-.1-.2-.4-1 .1-2.1 0 0 .7-.2 2.2.8a7.6 7.6 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.4 1.1.2 1.9.1 2.1.5.5.8 1.2.8 2.1 0 3.1-1.9 3.7-3.6 3.9.3.3.6.8.6 1.6V15c0 .2.1.5.6.4A8 8 0 0 0 16 8c0-4.4-3.6-8-8-8Z" }) }) : /* @__PURE__ */ o("svg", { width: "18", height: "20", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("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" }) });
812
+ }
813
+ function _t({
814
+ email: r,
815
+ onBack: e,
816
+ t
817
+ }) {
818
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-4 py-2 text-center", children: [
819
+ /* @__PURE__ */ o(
820
+ "div",
821
+ {
822
+ class: "flex h-14 w-14 items-center justify-center rounded-full",
823
+ style: {
824
+ background: "linear-gradient(135deg, #4ade80, #16a34a)",
825
+ color: "#fff",
826
+ boxShadow: "0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"
827
+ },
828
+ "aria-hidden": "true",
829
+ children: /* @__PURE__ */ o("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ o(
830
+ "path",
831
+ {
832
+ d: "M5 13l4 4L19 7",
833
+ stroke: "currentColor",
834
+ "stroke-width": "2.5",
835
+ "stroke-linecap": "round",
836
+ "stroke-linejoin": "round"
837
+ }
838
+ ) })
839
+ }
840
+ ),
841
+ /* @__PURE__ */ o("h2", { class: "mt-1 text-3xl font-bold tracking-tight text-gray-900", children: t("auth.check_email_title", "Check your email") }),
842
+ /* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: t(
843
+ "auth.reset_sent_subtitle",
844
+ "We sent a password reset link. Follow the instructions in the email to reset your password."
845
+ ) }),
846
+ r ? /* @__PURE__ */ o("p", { class: "break-all text-base font-semibold text-gray-900", children: r }) : null,
847
+ /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: t("auth.reset_link_valid", "The link is valid for 1 hour.") }),
848
+ /* @__PURE__ */ o(
849
+ "button",
850
+ {
851
+ type: "button",
852
+ onClick: e,
853
+ class: "pw-cta-shimmer relative mt-2 flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
854
+ style: {
855
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
856
+ boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
857
+ },
858
+ children: /* @__PURE__ */ o("span", { class: "relative z-10", children: t("auth.back_to_login", "Back to Login") })
859
+ }
860
+ )
861
+ ] });
402
862
  }
403
- function Se({
863
+ function St({
404
864
  block: r,
405
865
  bootstrap: e,
406
866
  auth: t,
407
867
  authSession: n,
408
868
  onBack: i,
409
- showBack: s = !0
869
+ showBack: s = !0,
870
+ intent: a = "preauth",
871
+ initialMode: l
410
872
  }) {
411
- return /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
412
- s ? /* @__PURE__ */ o(
413
- "button",
414
- {
415
- type: "button",
416
- onClick: i,
417
- 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)]",
418
- children: "← Back"
419
- }
420
- ) : null,
421
- /* @__PURE__ */ o(se, { block: r, ctx: {
422
- bootstrap: e,
423
- selectedPriceId: null,
424
- setSelectedPriceId: () => {
873
+ const { t: c } = S(), h = {
874
+ bootstrap: e,
875
+ selectedPriceId: null,
876
+ setSelectedPriceId: () => {
877
+ },
878
+ onAction: () => {
879
+ },
880
+ auth: t,
881
+ authSession: n,
882
+ initialAuthMode: l
883
+ }, d = a === "restore" ? {
884
+ ...r,
885
+ heading: c("auth.restore_purchases_heading", "Restore Purchases"),
886
+ subheading: c(
887
+ "auth.restore_purchases_subheading",
888
+ "Please sign in to restore your purchases."
889
+ )
890
+ } : a === "preauth" ? {
891
+ ...r,
892
+ heading: c("auth.login_continue_purchase", "Log in to continue your purchase"),
893
+ subheading: c(
894
+ "auth.link_purchase_subheading",
895
+ "We'll link the purchase to your account to keep access."
896
+ ),
897
+ // Preauth heading — descriptive sentence ("Log in to continue your
898
+ // purchase"), а не action verb. Длинные локализации (RU: "Войдите,
899
+ // чтобы продолжить покупку") в pill-кнопку h-12 не помещаются и
900
+ // переносятся на 2 строки. Явный короткий submit_label решает.
901
+ submit_label: c("auth.log_in", "Sign In")
902
+ } : r;
903
+ return /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 overflow-y-auto p-6 sm:p-8", children: [
904
+ s ? /* @__PURE__ */ o(Ct, { onClick: i, ariaLabel: c("nav.back_aria", "Back") }) : null,
905
+ /* @__PURE__ */ o(Me, { block: d, ctx: h })
906
+ ] });
907
+ }
908
+ function Ct({ onClick: r, ariaLabel: e }) {
909
+ return /* @__PURE__ */ o(
910
+ "button",
911
+ {
912
+ type: "button",
913
+ onClick: r,
914
+ "aria-label": e,
915
+ class: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
916
+ children: /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
917
+ /* @__PURE__ */ o(
918
+ "path",
919
+ {
920
+ d: "M5 8h8a4 4 0 0 1 0 8H9",
921
+ stroke: "currentColor",
922
+ "stroke-width": "1.75",
923
+ "stroke-linecap": "round",
924
+ "stroke-linejoin": "round"
925
+ }
926
+ ),
927
+ /* @__PURE__ */ o(
928
+ "path",
929
+ {
930
+ d: "M8 4 4 8l4 4",
931
+ stroke: "currentColor",
932
+ "stroke-width": "1.75",
933
+ "stroke-linecap": "round",
934
+ "stroke-linejoin": "round"
935
+ }
936
+ )
937
+ ] })
938
+ }
939
+ );
940
+ }
941
+ const Ee = (r) => `pw-offer-${r}-start`;
942
+ function ne(r) {
943
+ const e = r - Date.now();
944
+ return e <= 0 ? { days: 0, hours: 0, minutes: 0, seconds: 0, expired: !0 } : {
945
+ days: Math.floor(e / (1e3 * 60 * 60 * 24)),
946
+ hours: Math.floor(e % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)),
947
+ minutes: Math.floor(e % (1e3 * 60 * 60) / (1e3 * 60)),
948
+ seconds: Math.floor(e % (1e3 * 60) / 1e3),
949
+ expired: !1
950
+ };
951
+ }
952
+ function It(r) {
953
+ if (r.expires_at) {
954
+ const e = Date.parse(r.expires_at);
955
+ return Number.isFinite(e) ? e : null;
956
+ }
957
+ if (r.duration_minutes && r.duration_minutes > 0) {
958
+ if (typeof window > "u") return null;
959
+ try {
960
+ const e = Ee(r.id);
961
+ let t = window.localStorage.getItem(e);
962
+ return t || (t = (/* @__PURE__ */ new Date()).toISOString(), window.localStorage.setItem(e, t)), Date.parse(t) + r.duration_minutes * 6e4;
963
+ } catch {
964
+ return null;
965
+ }
966
+ }
967
+ return null;
968
+ }
969
+ function Te(r, e) {
970
+ if (!r || r.length === 0) return null;
971
+ if (e) {
972
+ const t = r.find((n) => n.id === e);
973
+ if (t) return t;
974
+ }
975
+ return r.find((t) => t.expires_at || t.duration_minutes) ?? null;
976
+ }
977
+ function Be(r) {
978
+ const e = r ? It(r) : null, [t, n] = k(
979
+ () => e !== null ? ne(e) : null
980
+ ), i = j(e);
981
+ return i.current = e, P(() => {
982
+ if (e === null) {
983
+ n(null);
984
+ return;
985
+ }
986
+ n(ne(e));
987
+ const s = setInterval(() => {
988
+ const a = ne(i.current ?? 0);
989
+ if (n(a), a.expired && (clearInterval(s), r?.duration_minutes && typeof window < "u"))
990
+ try {
991
+ window.localStorage.removeItem(Ee(r.id));
992
+ } catch {
993
+ }
994
+ }, 1e3);
995
+ return () => clearInterval(s);
996
+ }, [e, r?.duration_minutes, r?.id]), t;
997
+ }
998
+ function At({ block: r, ctx: e }) {
999
+ const { t } = S(), n = Te(e.bootstrap.offers, r.offer_id), i = Be(n);
1000
+ if (!n || i === null || i.expired && !r.force) return null;
1001
+ const s = r.title ?? n.label ?? t("offer.limited_time", "Limited-time offer"), a = n.discount_percent ? `${s} ${n.discount_percent}%` : s;
1002
+ return /* @__PURE__ */ u(
1003
+ "div",
1004
+ {
1005
+ class: "flex flex-wrap items-center justify-center gap-2 rounded-2xl px-4 py-3 text-[15px] font-semibold leading-tight text-white",
1006
+ style: {
1007
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)",
1008
+ textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
425
1009
  },
426
- onAction: () => {
1010
+ role: "status",
1011
+ children: [
1012
+ /* @__PURE__ */ o(Oe, {}),
1013
+ /* @__PURE__ */ o("span", { children: a }),
1014
+ /* @__PURE__ */ o(Pe, { value: i, t })
1015
+ ]
1016
+ }
1017
+ );
1018
+ }
1019
+ function Pe({ value: r, t: e }) {
1020
+ return /* @__PURE__ */ u("div", { class: "flex items-center gap-1 font-mono text-sm", children: [
1021
+ r.days > 0 ? /* @__PURE__ */ u(ae, { children: [
1022
+ /* @__PURE__ */ o(H, { children: String(r.days) }),
1023
+ /* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.d", "d") })
1024
+ ] }) : null,
1025
+ /* @__PURE__ */ o(H, { children: String(r.hours).padStart(2, "0") }),
1026
+ /* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.h", "h") }),
1027
+ /* @__PURE__ */ o(H, { children: String(r.minutes).padStart(2, "0") }),
1028
+ /* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.m", "m") }),
1029
+ /* @__PURE__ */ o(H, { children: String(r.seconds).padStart(2, "0") }),
1030
+ /* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.s", "s") })
1031
+ ] });
1032
+ }
1033
+ function H({ children: r }) {
1034
+ return /* @__PURE__ */ o("span", { class: "rounded bg-black/20 px-1.5 py-0.5 text-xs font-bold", children: r });
1035
+ }
1036
+ function Lt({ offer: r }) {
1037
+ const { t: e } = S(), t = Be(r);
1038
+ if (t === null || t.expired) return null;
1039
+ const n = r.label ?? e("offer.limited_time", "Limited-time offer"), i = r.discount_percent ? `${n} ${r.discount_percent}%` : n;
1040
+ return /* @__PURE__ */ u(
1041
+ "div",
1042
+ {
1043
+ class: "-mb-2 flex flex-wrap items-center justify-center gap-2 rounded-t-xl px-4 pb-5 pt-3 text-[15px] font-semibold leading-tight text-white",
1044
+ style: {
1045
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)",
1046
+ textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
427
1047
  },
428
- auth: t,
429
- authSession: n
430
- } })
431
- ] });
1048
+ role: "status",
1049
+ children: [
1050
+ /* @__PURE__ */ o(Oe, {}),
1051
+ /* @__PURE__ */ o("span", { children: i }),
1052
+ /* @__PURE__ */ o(Pe, { value: t, t: e })
1053
+ ]
1054
+ }
1055
+ );
432
1056
  }
433
- function Ce({
434
- auth: r,
435
- onSuccess: e,
436
- onBack: t,
437
- heading: n = "Continue as guest",
438
- description: i = "Setting up your guest session…"
439
- }) {
440
- const [s, l] = x({ kind: "signing-in" }), a = B(!0);
441
- M(() => () => {
442
- a.current = !1;
443
- }, []);
444
- const c = () => {
445
- l({ kind: "signing-in" }), (async () => {
446
- try {
447
- const p = await r.signInAnonymously();
448
- if (!a.current) return;
449
- e(p);
450
- } catch (p) {
451
- if (!a.current) return;
452
- l({
453
- kind: "error",
454
- message: p instanceof Error ? p.message : "Anonymous sign-in failed"
455
- });
456
- }
457
- })();
458
- };
459
- return M(() => {
460
- c();
461
- }, []), /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
462
- t ? /* @__PURE__ */ o(
463
- "button",
464
- {
465
- type: "button",
466
- onClick: t,
467
- 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)]",
468
- children: "← Back"
469
- }
470
- ) : null,
471
- /* @__PURE__ */ u("div", { class: "flex flex-col gap-1", children: [
472
- /* @__PURE__ */ o("h2", { class: "text-xl font-semibold text-gray-900", children: n }),
473
- /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: i })
474
- ] }),
475
- s.kind === "signing-in" ? /* @__PURE__ */ o("div", { class: "flex items-center justify-center py-6", children: /* @__PURE__ */ o(Ie, {}) }) : null,
476
- s.kind === "error" ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
477
- /* @__PURE__ */ o("div", { class: "rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700", children: s.message }),
478
- /* @__PURE__ */ o(
479
- "button",
1057
+ function Oe() {
1058
+ return /* @__PURE__ */ o(
1059
+ "svg",
1060
+ {
1061
+ width: "16",
1062
+ height: "16",
1063
+ viewBox: "0 0 12 12",
1064
+ fill: "none",
1065
+ "aria-hidden": "true",
1066
+ children: /* @__PURE__ */ o(
1067
+ "path",
480
1068
  {
481
- type: "button",
482
- onClick: c,
483
- 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",
484
- children: "Try again"
1069
+ fill: "currentColor",
1070
+ d: "m9.44 5.359-2.394-.895.61-3.036c.062-.31-.345-.531-.57-.291L2.434 6.105a.336.336 0 0 0 .126.537l2.395.894-.61 3.037c-.062.31.345.53.57.29l4.653-4.968a.336.336 0 0 0-.126-.536Z"
485
1071
  }
486
1072
  )
487
- ] }) : null
488
- ] });
489
- }
490
- function Ie() {
491
- return /* @__PURE__ */ u("svg", { class: "h-5 w-5 animate-spin text-[var(--pw-accent)]", viewBox: "0 0 24 24", fill: "none", children: [
492
- /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "3", "stroke-opacity": "0.2" }),
493
- /* @__PURE__ */ o("path", { d: "M22 12a10 10 0 0 0-10-10", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round" })
494
- ] });
1073
+ }
1074
+ );
495
1075
  }
496
- const D = 3, F = 200, V = 5e3, $ = 5, Ae = 10 * 1024 * 1024, X = ["image/jpeg", "image/png", "image/webp"], Y = /.+@.+\..+/;
497
- function Te({ client: r, authSession: e, origin: t, onBack: n }) {
498
- const i = e?.user.email ?? "", s = i || null, [l, a] = x(i), [c, p] = x(""), [g, b] = x(""), [f, m] = x([]), [y, _] = x(!1), [A, v] = x(null), [S, w] = x({}), P = ie(() => {
499
- const d = (s ?? l).trim().toLowerCase(), h = c.trim(), k = g.trim();
500
- return Y.test(d) && h.length >= D && h.length <= F && k.length >= 1 && k.length <= V;
501
- }, [s, l, c, g]), L = () => {
502
- const d = {}, h = (s ?? l).trim(), k = c.trim(), U = g.trim();
503
- return h ? Y.test(h.toLowerCase()) || (d.email = "Invalid email") : d.email = "Required", (k.length < D || k.length > F) && (d.subject = `${D}–${F} characters`), (U.length < 1 || U.length > V) && (d.message = `1–${V} characters`), w(d), Object.keys(d).length === 0;
504
- }, C = async (d) => {
505
- if (d.preventDefault(), !y && L()) {
506
- _(!0), w((h) => ({ ...h, submit: void 0 }));
1076
+ const me = 3, ye = 200, be = 5e3, ie = 5, Mt = 10 * 1024 * 1024, xe = ["image/jpeg", "image/png", "image/webp"], Et = /.+@.+\..+/;
1077
+ function Tt({ client: r, authSession: e, origin: t, onBack: n }) {
1078
+ const { t: i } = S(), s = e?.user.email ?? "", a = s || null, [l, c] = k(s), [h, d] = k(""), [g, _] = k(""), [p, v] = k([]), [m, A] = k(!1), [b, y] = k(null), [C, I] = k({}), O = () => {
1079
+ const T = {}, E = (a ?? l).trim(), q = h.trim(), U = g.trim();
1080
+ return E ? Et.test(E.toLowerCase()) || (T.email = i("support.invalid_email", "Invalid email")) : T.email = i("support.required", "Required"), (q.length < me || q.length > ye) && (T.subject = i("support.subject_length", "{min}–{max} characters", {
1081
+ min: me,
1082
+ max: ye
1083
+ })), (U.length < 1 || U.length > be) && (T.message = i("support.message_length", "{min}–{max} characters", {
1084
+ min: 1,
1085
+ max: be
1086
+ })), I(T), Object.keys(T).length === 0;
1087
+ }, M = async (T) => {
1088
+ if (T.preventDefault(), !m && O()) {
1089
+ A(!0), I((E) => ({ ...E, submit: void 0 }));
507
1090
  try {
508
- const h = (s ?? l).trim();
1091
+ const E = (a ?? l).trim();
509
1092
  await r.createSupportTicket({
510
- subject: c.trim(),
1093
+ subject: h.trim(),
511
1094
  content: g.trim(),
512
- email: h || void 0,
513
- files: f.length > 0 ? f : void 0
514
- }), v(h);
515
- } catch (h) {
516
- const k = h instanceof T && h.message || "Failed to send. Please try again.";
517
- w((U) => ({ ...U, submit: k }));
1095
+ email: E || void 0,
1096
+ files: p.length > 0 ? p : void 0
1097
+ }), y(E);
1098
+ } catch (E) {
1099
+ const q = E instanceof L && E.message || "Failed to send. Please try again.";
1100
+ I((U) => ({ ...U, submit: q }));
518
1101
  } finally {
519
- _(!1);
1102
+ A(!1);
520
1103
  }
521
1104
  }
522
- }, I = () => {
523
- p(""), b(""), m([]), w({}), v(null);
524
- };
525
- return A ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-4 py-2 text-center", children: [
526
- /* @__PURE__ */ o(
527
- "div",
528
- {
529
- class: "flex h-14 w-14 items-center justify-center rounded-full",
530
- style: {
531
- background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",
532
- color: "#fff",
533
- 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)"
534
- },
535
- "aria-hidden": "true",
536
- children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", class: "h-7 w-7", children: /* @__PURE__ */ o(
537
- "path",
538
- {
539
- fill: "currentColor",
540
- 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"
541
- }
542
- ) })
543
- }
544
- ),
545
- /* @__PURE__ */ o("div", { class: "text-lg font-semibold tracking-tight text-gray-900", children: "Request submitted" }),
546
- /* @__PURE__ */ u("div", { class: "max-w-[320px] text-sm leading-relaxed text-gray-500", children: [
547
- "We've received your message and will respond to",
548
- " ",
549
- /* @__PURE__ */ o("b", { class: "text-gray-700", children: A }),
550
- "."
1105
+ }, R = () => {
1106
+ d(""), _(""), v([]), I({}), y(null);
1107
+ }, D = "flex flex-col gap-3 bg-white px-6 pb-6 pt-3 sm:px-8", z = { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" };
1108
+ return b ? /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 flex flex-col", children: [
1109
+ /* @__PURE__ */ u("div", { class: "flex-1 min-h-0 overflow-y-auto flex flex-col items-center gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8 text-center", children: [
1110
+ /* @__PURE__ */ o(
1111
+ "div",
1112
+ {
1113
+ class: "flex h-14 w-14 items-center justify-center rounded-full",
1114
+ style: {
1115
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",
1116
+ color: "#fff",
1117
+ 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)"
1118
+ },
1119
+ "aria-hidden": "true",
1120
+ children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", class: "h-7 w-7", children: /* @__PURE__ */ o(
1121
+ "path",
1122
+ {
1123
+ fill: "currentColor",
1124
+ 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"
1125
+ }
1126
+ ) })
1127
+ }
1128
+ ),
1129
+ /* @__PURE__ */ o("div", { class: "text-lg font-semibold tracking-tight text-gray-900", children: i("support.success_heading", "Request submitted") }),
1130
+ /* @__PURE__ */ u("div", { class: "max-w-[320px] text-sm leading-relaxed text-gray-500", children: [
1131
+ i(
1132
+ "support.success_message_prefix",
1133
+ "We've received your message and will respond to"
1134
+ ),
1135
+ " ",
1136
+ /* @__PURE__ */ o("b", { class: "text-gray-700", children: b }),
1137
+ "."
1138
+ ] })
551
1139
  ] }),
552
- /* @__PURE__ */ u("div", { class: "mt-2 flex items-center justify-center gap-3", children: [
1140
+ /* @__PURE__ */ o("div", { class: D, style: z, children: /* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
553
1141
  /* @__PURE__ */ o(
554
1142
  "button",
555
1143
  {
556
1144
  type: "button",
557
1145
  onClick: n,
558
1146
  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)]",
559
- children: t === "standalone" ? "Done" : "Back"
1147
+ children: t === "standalone" ? i("support.done_button", "Done") : i("nav.back_aria", "Back")
560
1148
  }
561
1149
  ),
562
1150
  /* @__PURE__ */ o(
563
1151
  "button",
564
1152
  {
565
1153
  type: "button",
566
- onClick: I,
1154
+ onClick: R,
567
1155
  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)]",
568
1156
  style: {
569
1157
  background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
570
1158
  boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
571
1159
  },
572
- children: "Send another request"
1160
+ children: i("support.send_another", "Send another request")
573
1161
  }
574
1162
  )
575
- ] })
576
- ] }) : /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
577
- /* @__PURE__ */ o("div", { class: "flex items-center justify-between", children: /* @__PURE__ */ u(
578
- "button",
579
- {
580
- type: "button",
581
- onClick: n,
582
- 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)]",
583
- children: [
584
- " ",
585
- t === "standalone" ? "Close" : "Back"
586
- ]
587
- }
588
- ) }),
589
- /* @__PURE__ */ o("h2", { class: "text-lg font-semibold tracking-tight text-gray-900", children: "Contact Support" }),
590
- /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: "Fill out the form below and we'll get back to you." }),
591
- /* @__PURE__ */ u("form", { onSubmit: C, class: "flex flex-col gap-3", children: [
592
- s ? /* @__PURE__ */ u("div", { class: "rounded-xl border border-gray-200 bg-gray-50/60 px-3 py-2 text-xs text-gray-500", children: [
593
- "Sending as ",
594
- /* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: s })
595
- ] }) : /* @__PURE__ */ o(
596
- J,
597
- {
598
- type: "email",
599
- label: "Your email",
600
- value: l,
601
- onInput: a,
602
- error: S.email,
603
- autocomplete: "email",
604
- required: !0
605
- }
606
- ),
607
- /* @__PURE__ */ o(
608
- J,
609
- {
610
- type: "text",
611
- label: "Subject",
612
- value: c,
613
- onInput: p,
614
- error: S.subject,
615
- required: !0
616
- }
617
- ),
618
- /* @__PURE__ */ o(
619
- Me,
620
- {
621
- label: "Message",
622
- value: g,
623
- onInput: b,
624
- error: S.message,
625
- required: !0
626
- }
627
- ),
628
- /* @__PURE__ */ o(Be, { files: f, onChange: m, disabled: y }),
629
- S.submit && /* @__PURE__ */ o("p", { class: "text-xs text-red-600", children: S.submit }),
630
- /* @__PURE__ */ u("div", { class: "mt-1 flex items-center justify-end gap-2", children: [
1163
+ ] }) })
1164
+ ] }) : /* @__PURE__ */ u("form", { onSubmit: M, class: "relative flex-1 min-h-0 flex flex-col", children: [
1165
+ /* @__PURE__ */ o(Bt, { onClick: n, ariaLabel: i("nav.back_aria", "Back") }),
1166
+ /* @__PURE__ */ o("div", { class: "flex-1 min-h-0 overflow-y-auto px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8", children: /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
1167
+ /* @__PURE__ */ u("div", { class: "flex flex-col gap-2 pr-10", children: [
1168
+ /* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: i("support.heading", "Support") }),
1169
+ /* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: i("support.instruction", "Please fill out the form below to submit your support request.") })
1170
+ ] }),
1171
+ /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
1172
+ a ? /* @__PURE__ */ u("div", { class: "rounded-2xl bg-gray-100 px-5 py-3 text-sm text-gray-600", children: [
1173
+ i("support.sending_as", "Sending as"),
1174
+ " ",
1175
+ /* @__PURE__ */ o("b", { class: "font-medium text-gray-900", children: a })
1176
+ ] }) : /* @__PURE__ */ o(
1177
+ we,
1178
+ {
1179
+ type: "email",
1180
+ placeholder: i("support.email_placeholder", "Enter your email *"),
1181
+ value: l,
1182
+ onInput: c,
1183
+ error: C.email,
1184
+ autocomplete: "email",
1185
+ required: !0
1186
+ }
1187
+ ),
1188
+ /* @__PURE__ */ o(
1189
+ we,
1190
+ {
1191
+ type: "text",
1192
+ placeholder: i("support.subject_placeholder", "Enter your subject *"),
1193
+ value: h,
1194
+ onInput: d,
1195
+ error: C.subject,
1196
+ required: !0
1197
+ }
1198
+ ),
1199
+ /* @__PURE__ */ o(
1200
+ Pt,
1201
+ {
1202
+ placeholder: i("support.message_placeholder", "Enter your message *"),
1203
+ value: g,
1204
+ onInput: _,
1205
+ error: C.message,
1206
+ required: !0
1207
+ }
1208
+ ),
1209
+ /* @__PURE__ */ o(Ot, { files: p, onChange: v, disabled: m })
1210
+ ] })
1211
+ ] }) }),
1212
+ /* @__PURE__ */ u("div", { class: D, style: z, children: [
1213
+ C.submit && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: C.submit }),
1214
+ /* @__PURE__ */ u("div", { class: "flex items-center justify-end gap-3", children: [
631
1215
  /* @__PURE__ */ o(
632
1216
  "button",
633
1217
  {
634
1218
  type: "button",
635
1219
  onClick: n,
636
- disabled: y,
637
- 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)]",
638
- children: t === "standalone" ? "Close" : "Back"
1220
+ disabled: m,
1221
+ class: "rounded-full px-4 py-2 text-base font-medium text-gray-700 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
1222
+ children: t === "standalone" ? i("support.close_button", "Close") : i("nav.back_aria", "Back")
639
1223
  }
640
1224
  ),
641
1225
  /* @__PURE__ */ o(
642
1226
  "button",
643
1227
  {
644
1228
  type: "submit",
645
- disabled: !P || y,
646
- 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)]",
1229
+ disabled: m,
1230
+ class: "pw-cta-shimmer relative flex h-12 items-center justify-center overflow-hidden rounded-full px-8 text-base font-semibold text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
647
1231
  style: {
648
- background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
649
- boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1232
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
1233
+ boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
650
1234
  },
651
- children: y ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : "Send"
1235
+ children: m ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: i("support.send_button", "Send") })
652
1236
  }
653
1237
  )
654
1238
  ] })
655
1239
  ] })
656
1240
  ] });
657
1241
  }
658
- function J({ type: r, label: e, value: t, onInput: n, error: i, autocomplete: s, required: l }) {
659
- return /* @__PURE__ */ u("label", { class: "flex flex-col gap-1.5", children: [
660
- /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: e }),
1242
+ function Bt({ onClick: r, ariaLabel: e }) {
1243
+ return /* @__PURE__ */ o(
1244
+ "button",
1245
+ {
1246
+ type: "button",
1247
+ onClick: r,
1248
+ "aria-label": e,
1249
+ class: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
1250
+ children: /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
1251
+ /* @__PURE__ */ o(
1252
+ "path",
1253
+ {
1254
+ d: "M5 8h8a4 4 0 0 1 0 8H9",
1255
+ stroke: "currentColor",
1256
+ "stroke-width": "1.75",
1257
+ "stroke-linecap": "round",
1258
+ "stroke-linejoin": "round"
1259
+ }
1260
+ ),
1261
+ /* @__PURE__ */ o(
1262
+ "path",
1263
+ {
1264
+ d: "M8 4 4 8l4 4",
1265
+ stroke: "currentColor",
1266
+ "stroke-width": "1.75",
1267
+ "stroke-linecap": "round",
1268
+ "stroke-linejoin": "round"
1269
+ }
1270
+ )
1271
+ ] })
1272
+ }
1273
+ );
1274
+ }
1275
+ function we({
1276
+ type: r,
1277
+ placeholder: e,
1278
+ value: t,
1279
+ onInput: n,
1280
+ error: i,
1281
+ autocomplete: s,
1282
+ required: a
1283
+ }) {
1284
+ return /* @__PURE__ */ u("div", { children: [
661
1285
  /* @__PURE__ */ o(
662
1286
  "input",
663
1287
  {
664
1288
  type: r,
665
1289
  value: t,
666
- onInput: (a) => n(a.target.value),
1290
+ placeholder: e,
1291
+ onInput: (l) => n(l.target.value),
667
1292
  autocomplete: s,
668
- required: l,
669
- 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)]"}`
1293
+ required: a,
1294
+ class: `h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${i ? "shadow-[0_0_0_2px_rgba(239,68,68,0.5)]" : "focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"}`
670
1295
  }
671
1296
  ),
672
- i && /* @__PURE__ */ o("span", { class: "text-xs text-red-600", children: i })
1297
+ i && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: i })
673
1298
  ] });
674
1299
  }
675
- function Me({ label: r, value: e, onInput: t, error: n, required: i }) {
676
- return /* @__PURE__ */ u("label", { class: "flex flex-col gap-1.5", children: [
677
- /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: r }),
1300
+ function Pt({
1301
+ placeholder: r,
1302
+ value: e,
1303
+ onInput: t,
1304
+ error: n,
1305
+ required: i
1306
+ }) {
1307
+ return /* @__PURE__ */ u("div", { children: [
678
1308
  /* @__PURE__ */ o(
679
1309
  "textarea",
680
1310
  {
681
1311
  value: e,
1312
+ placeholder: r,
682
1313
  onInput: (s) => t(s.target.value),
683
1314
  required: i,
684
- rows: 4,
685
- 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)]"}`
1315
+ rows: 5,
1316
+ class: `min-h-[120px] w-full rounded-2xl bg-gray-100 px-5 py-3.5 text-base leading-relaxed text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${n ? "shadow-[0_0_0_2px_rgba(239,68,68,0.5)]" : "focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"}`
686
1317
  }
687
1318
  ),
688
- n && /* @__PURE__ */ o("span", { class: "text-xs text-red-600", children: n })
1319
+ n && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: n })
689
1320
  ] });
690
1321
  }
691
- function Be({ files: r, onChange: e, disabled: t }) {
692
- const n = B(null), [i, s] = x(!1), [l, a] = x(null), c = (p) => {
693
- if (!p || t) return;
694
- a(null);
695
- const g = Array.from(p);
696
- if (r.length + g.length > $) {
697
- a(`Up to ${$} files`);
1322
+ function Ot({ files: r, onChange: e, disabled: t }) {
1323
+ const { t: n } = S(), i = j(null), [s, a] = k(!1), [l, c] = k(null), h = (d) => {
1324
+ if (!d || t) return;
1325
+ c(null);
1326
+ const g = Array.from(d);
1327
+ if (r.length + g.length > ie) {
1328
+ c(n("support.too_many_files", "Up to {max} files", { max: ie }));
698
1329
  return;
699
1330
  }
700
- const b = g.filter(
701
- (f) => X.includes(f.type) && f.size <= Ae
1331
+ const _ = g.filter(
1332
+ (p) => xe.includes(p.type) && p.size <= Mt
702
1333
  );
703
- if (b.length !== g.length) {
704
- a("Only JPEG/PNG/WebP, ≤ 10MB each");
1334
+ if (_.length !== g.length) {
1335
+ c(n("support.invalid_file", "Only JPEG/PNG/WebP, ≤ 10MB each"));
705
1336
  return;
706
1337
  }
707
- e([...r, ...b]);
1338
+ e([...r, ..._]);
708
1339
  };
709
1340
  return /* @__PURE__ */ u("div", { children: [
710
- /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: "Attachments (optional)" }),
1341
+ /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: n("support.attachments_label", "Attachments (optional)") }),
711
1342
  /* @__PURE__ */ u(
712
1343
  "div",
713
1344
  {
714
1345
  role: "button",
715
1346
  tabIndex: 0,
716
- "aria-label": "Attachments upload",
717
- onClick: () => !t && n.current?.click(),
718
- onDragOver: (p) => {
719
- p.preventDefault(), t || s(!0);
1347
+ "aria-label": n("support.attachments_aria", "Attachments upload"),
1348
+ onClick: () => !t && i.current?.click(),
1349
+ onDragOver: (d) => {
1350
+ d.preventDefault(), t || a(!0);
720
1351
  },
721
- onDragLeave: () => s(!1),
722
- onDrop: (p) => {
723
- p.preventDefault(), s(!1), c(p.dataTransfer?.files ?? null);
1352
+ onDragLeave: () => a(!1),
1353
+ onDrop: (d) => {
1354
+ d.preventDefault(), a(!1), h(d.dataTransfer?.files ?? null);
724
1355
  },
725
- 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" : ""}`,
1356
+ class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${s ? "border-[var(--pw-accent)] bg-[color-mix(in_srgb,var(--pw-accent)_6%,white)]" : "border-gray-300 hover:border-gray-400 hover:bg-gray-50/60"} ${t ? "cursor-not-allowed opacity-60" : ""}`,
726
1357
  children: [
727
- /* @__PURE__ */ o("div", { class: "text-xs text-gray-500", children: "Drop images here or click to select" }),
728
- /* @__PURE__ */ u("div", { class: "mt-0.5 text-[11px] text-gray-400", children: [
729
- "JPEG/PNG/WebP, up to ",
730
- $,
731
- " files, ≤ 10MB each"
732
- ] })
1358
+ /* @__PURE__ */ o("div", { class: "text-xs text-gray-500", children: n("support.dropzone_text", "Drop images here or click to select") }),
1359
+ /* @__PURE__ */ o("div", { class: "mt-0.5 text-[11px] text-gray-400", children: n("support.file_requirements", "JPEG/PNG/WebP, up to {max} files, ≤ 10MB each", {
1360
+ max: ie
1361
+ }) })
733
1362
  ]
734
1363
  }
735
1364
  ),
736
1365
  /* @__PURE__ */ o(
737
1366
  "input",
738
1367
  {
739
- ref: n,
1368
+ ref: i,
740
1369
  type: "file",
741
1370
  multiple: !0,
742
- accept: X.join(","),
1371
+ accept: xe.join(","),
743
1372
  class: "hidden",
744
- onChange: (p) => {
745
- c(p.target.files), p.currentTarget.value = "";
1373
+ onChange: (d) => {
1374
+ h(d.target.files), d.currentTarget.value = "";
746
1375
  }
747
1376
  }
748
1377
  ),
749
1378
  l && /* @__PURE__ */ o("p", { class: "mt-1 text-xs text-red-600", children: l }),
750
- r.length > 0 && /* @__PURE__ */ o("ul", { class: "mt-2 flex flex-col gap-1", children: r.map((p, g) => /* @__PURE__ */ u(
1379
+ r.length > 0 && /* @__PURE__ */ o("ul", { class: "mt-2 flex flex-col gap-1", children: r.map((d, g) => /* @__PURE__ */ u(
751
1380
  "li",
752
1381
  {
753
1382
  class: "flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",
754
1383
  children: [
755
- /* @__PURE__ */ o("span", { class: "truncate text-gray-700", children: p.name }),
1384
+ /* @__PURE__ */ o("span", { class: "truncate text-gray-700", children: d.name }),
756
1385
  /* @__PURE__ */ o(
757
1386
  "button",
758
1387
  {
759
1388
  type: "button",
760
1389
  onClick: () => {
761
- const b = [...r];
762
- b.splice(g, 1), e(b);
1390
+ const _ = [...r];
1391
+ _.splice(g, 1), e(_);
763
1392
  },
764
1393
  disabled: t,
765
1394
  class: "text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60",
766
- "aria-label": `Remove ${p.name}`,
1395
+ "aria-label": n("support.remove_file_aria", "Remove {filename}", { filename: d.name }),
767
1396
  children: "✕"
768
1397
  }
769
1398
  )
770
1399
  ]
771
1400
  },
772
- `${p.name}-${p.size}-${g}`
1401
+ `${d.name}-${d.size}-${g}`
773
1402
  )) })
774
1403
  ] });
775
1404
  }
776
- function Ee({ block: r, ctx: e }) {
777
- const [t, n] = x(!1), i = r.priceId ?? e.selectedPriceId, s = t || r.action === "checkout" && !i;
778
- return /* @__PURE__ */ o(
1405
+ const Ut = {
1406
+ day: "cta.get_plan_daily",
1407
+ week: "cta.get_plan_weekly",
1408
+ month: "cta.get_plan_monthly",
1409
+ year: "cta.get_plan_yearly"
1410
+ }, jt = {
1411
+ day: "Get Daily Plan",
1412
+ week: "Get Weekly Plan",
1413
+ month: "Get Monthly Plan",
1414
+ year: "Get Yearly Plan"
1415
+ };
1416
+ function Rt(r, e, t, n) {
1417
+ if (e === "close") return n("cta.close", "Close");
1418
+ if (!r) return n("cta.continue", "Continue");
1419
+ if (!t && r.trial_days && r.interval && r.interval !== "lifetime")
1420
+ return n("cta.start_trial", "Start {days}-Day Free Trial", { days: r.trial_days });
1421
+ if (!r.interval || r.interval === "lifetime")
1422
+ return n("cta.get_lifetime_access", "Get Lifetime Access");
1423
+ const i = Ut[r.interval];
1424
+ return i ? n(i, jt[r.interval]) : n("cta.get_plan_generic", "Get {interval} Plan", {
1425
+ interval: Dt(r.interval)
1426
+ });
1427
+ }
1428
+ function Dt(r) {
1429
+ return r.length ? r[0].toUpperCase() + r.slice(1) : r;
1430
+ }
1431
+ function zt({ block: r, ctx: e }) {
1432
+ const { t } = S(), [n, i] = k(!1), s = r.priceId ?? e.selectedPriceId, a = n || r.action === "checkout" && !s, l = s ? e.bootstrap.prices.find((g) => g.id === s) ?? null : null, c = e.bootstrap.user?.had_previous_trial ?? !1, h = r.label ?? Rt(l, r.action, c, t);
1433
+ return /* @__PURE__ */ u(
779
1434
  "button",
780
1435
  {
781
1436
  type: "button",
782
- disabled: s,
1437
+ disabled: a,
783
1438
  onClick: async () => {
784
- if (!s) {
785
- n(!0);
1439
+ if (!a) {
1440
+ i(!0);
786
1441
  try {
787
- await e.onAction(r.action, { priceId: i });
1442
+ await e.onAction(r.action, { priceId: s });
788
1443
  } finally {
789
- n(!1);
1444
+ i(!1);
790
1445
  }
791
1446
  }
792
1447
  },
793
- 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)]",
1448
+ class: "pw-cta-shimmer relative flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
794
1449
  style: {
795
- background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
796
- 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)"
1450
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
1451
+ boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
797
1452
  },
798
- children: t ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : r.label
1453
+ children: [
1454
+ /* @__PURE__ */ o(
1455
+ "span",
1456
+ {
1457
+ class: "absolute inset-0 opacity-40",
1458
+ style: {
1459
+ background: "radial-gradient(circle at 50% 0%, color-mix(in srgb, white 40%, transparent) 0%, transparent 70%)"
1460
+ },
1461
+ "aria-hidden": "true"
1462
+ }
1463
+ ),
1464
+ n ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: h })
1465
+ ]
799
1466
  }
800
1467
  );
801
1468
  }
802
- function Pe({ ctx: r }) {
803
- const e = r.authSession, t = r.auth, [n, i] = x(!1), s = () => r.onAction("support");
804
- if (e && !e.user.is_anonymous) {
1469
+ function qt({ ctx: r }) {
1470
+ const { t: e } = S(), t = r.authSession, n = r.auth, [i, s] = k(!1), a = () => r.onAction("support");
1471
+ if (t && !t.user.is_anonymous) {
805
1472
  const l = async () => {
806
- if (!(!t || n)) {
807
- i(!0);
1473
+ if (!(!n || i)) {
1474
+ s(!0);
808
1475
  try {
809
- await t.signOut();
1476
+ await n.signOut();
810
1477
  } catch {
811
1478
  } finally {
812
- i(!1);
1479
+ s(!1);
813
1480
  }
814
1481
  }
815
1482
  };
816
- return /* @__PURE__ */ u("div", { class: "mt-2 text-center text-xs text-gray-500", children: [
817
- /* @__PURE__ */ o("span", { children: "Signed in as " }),
818
- /* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: e.user.email }),
819
- /* @__PURE__ */ u("div", { class: "mt-1 flex items-center justify-center gap-3", children: [
820
- /* @__PURE__ */ o(
821
- "button",
822
- {
823
- type: "button",
824
- onClick: l,
825
- disabled: !t || n,
826
- class: "font-medium text-gray-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:underline",
827
- children: n ? "Signing out…" : "Sign out"
828
- }
829
- ),
830
- /* @__PURE__ */ o(Q, {}),
831
- /* @__PURE__ */ o(K, { onClick: s })
1483
+ return /* @__PURE__ */ u("div", { class: "-mt-3 flex flex-col items-center gap-1.5 pt-1 text-center text-[13px] text-gray-500", children: [
1484
+ /* @__PURE__ */ u("span", { children: [
1485
+ e("session.signed_in_as_prefix", "Signed in as"),
1486
+ " ",
1487
+ /* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: t.user.email })
1488
+ ] }),
1489
+ /* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
1490
+ /* @__PURE__ */ o(G, { onClick: l, disabled: !n || i, children: i ? e("session.signing_out", "Signing out…") : e("session.sign_out", "Sign Out") }),
1491
+ /* @__PURE__ */ o(ke, {}),
1492
+ /* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
832
1493
  ] })
833
1494
  ] });
834
1495
  }
835
- return /* @__PURE__ */ u("div", { class: "mt-2 flex items-center justify-center gap-3 text-center text-xs text-gray-500", children: [
836
- /* @__PURE__ */ o(
837
- "button",
838
- {
839
- type: "button",
840
- onClick: () => r.onAction("restore"),
841
- class: "font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",
842
- children: "Restore purchases"
843
- }
844
- ),
845
- /* @__PURE__ */ o(Q, {}),
846
- /* @__PURE__ */ o(K, { onClick: s })
1496
+ return /* @__PURE__ */ u("div", { class: "-mt-3 flex items-center justify-center gap-3 pt-1 text-center text-[13px]", children: [
1497
+ /* @__PURE__ */ o(G, { onClick: () => r.onAction("restore"), children: e("session.restore_purchases", "Restore purchases") }),
1498
+ /* @__PURE__ */ o(ke, {}),
1499
+ /* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
847
1500
  ] });
848
1501
  }
849
- function K({ onClick: r }) {
1502
+ function G({
1503
+ onClick: r,
1504
+ disabled: e,
1505
+ children: t
1506
+ }) {
850
1507
  return /* @__PURE__ */ o(
851
1508
  "button",
852
1509
  {
853
1510
  type: "button",
854
1511
  onClick: r,
855
- class: "font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",
856
- children: "Contact Support"
1512
+ disabled: e,
1513
+ class: "font-semibold transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:opacity-80",
1514
+ style: { color: "var(--pw-accent)" },
1515
+ children: t
857
1516
  }
858
1517
  );
859
1518
  }
860
- function Q() {
1519
+ function ke() {
861
1520
  return /* @__PURE__ */ o("span", { class: "h-1 w-1 rounded-full bg-gray-300", "aria-hidden": "true" });
862
1521
  }
863
- function Le({ block: r }) {
1522
+ function Nt({ block: r }) {
864
1523
  return r.items.length ? /* @__PURE__ */ o("ul", { class: "flex flex-col gap-2.5", role: "list", children: r.items.map((e) => /* @__PURE__ */ u("li", { class: "flex items-start gap-3 text-sm text-gray-700", children: [
865
1524
  /* @__PURE__ */ o(
866
- "span",
1525
+ "svg",
867
1526
  {
868
- class: "mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full",
869
- style: {
870
- background: "color-mix(in srgb, var(--pw-accent) 12%, white)",
871
- color: "var(--pw-accent)"
872
- },
1527
+ width: "18",
1528
+ height: "18",
1529
+ viewBox: "0 0 20 20",
1530
+ fill: "none",
1531
+ class: "mt-0.5 flex-shrink-0 text-emerald-500",
873
1532
  "aria-hidden": "true",
874
- children: /* @__PURE__ */ o("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ o(
1533
+ children: /* @__PURE__ */ o(
875
1534
  "path",
876
1535
  {
877
- d: "M5 10l3 3 7-7",
1536
+ d: "M4 10.5l3.5 3.5 8.5-8.5",
878
1537
  stroke: "currentColor",
879
1538
  "stroke-width": "2.5",
880
1539
  "stroke-linecap": "round",
881
1540
  "stroke-linejoin": "round"
882
1541
  }
883
- ) })
1542
+ )
884
1543
  }
885
1544
  ),
886
1545
  /* @__PURE__ */ u("div", { class: "flex flex-col gap-0.5", children: [
887
1546
  /* @__PURE__ */ o("span", { class: "font-medium leading-snug text-gray-900", children: e.name }),
888
- e.desc ? /* @__PURE__ */ o("span", { class: "text-xs leading-relaxed text-gray-500", children: e.desc }) : null
1547
+ e.desc ? /* @__PURE__ */ o("span", { class: "text-xs leading-relaxed text-gray-400", children: e.desc }) : null
889
1548
  ] })
890
1549
  ] }, e.id)) }) : null;
891
1550
  }
892
- const le = 26, Ue = 14, Oe = 2;
893
- function je(r, e) {
894
- const t = e * Oe;
895
- let n = le;
896
- for (r.style.fontSize = `${n}px`; r.scrollHeight > t && n > Ue; )
1551
+ function Ft({ block: r }) {
1552
+ const { t: e } = S(), t = r.title ?? e("pricing.money_back", "30-day money-back guarantee"), n = r.subtitle, i = (r.icon ?? "dollar_shield") !== "none", s = $t(t);
1553
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-1.5 border-b-1 pb-4 mb-1 border-gray-100", children: [
1554
+ /* @__PURE__ */ u("div", { class: "inline-flex items-center gap-2 text-[12px] text-gray-700", children: [
1555
+ i ? /* @__PURE__ */ o(Vt, {}) : null,
1556
+ s ? /* @__PURE__ */ u("span", { children: [
1557
+ /* @__PURE__ */ o("b", { class: "font-bold text-gray-900", children: s.bold }),
1558
+ " ",
1559
+ /* @__PURE__ */ o("span", { class: "font-medium", children: s.rest })
1560
+ ] }) : /* @__PURE__ */ o("span", { class: "font-medium", children: t })
1561
+ ] }),
1562
+ n ? /* @__PURE__ */ o("span", { class: "text-center text-xs leading-relaxed text-gray-500", children: n }) : null
1563
+ ] });
1564
+ }
1565
+ function $t(r) {
1566
+ const e = r.match(/^(\d+[-\s]?days?)\s+(.+)$/i);
1567
+ return e ? { bold: e[1], rest: e[2] } : null;
1568
+ }
1569
+ function Vt() {
1570
+ return /* @__PURE__ */ u(
1571
+ "svg",
1572
+ {
1573
+ xmlns: "http://www.w3.org/2000/svg",
1574
+ viewBox: "0 0 24 24",
1575
+ fill: "none",
1576
+ width: "16",
1577
+ height: "16",
1578
+ class: "flex-shrink-0 text-emerald-500",
1579
+ "aria-hidden": "true",
1580
+ children: [
1581
+ /* @__PURE__ */ o(
1582
+ "path",
1583
+ {
1584
+ d: "M12 2 4 5v6c0 5.25 3.5 9.5 8 11 4.5-1.5 8-5.75 8-11V5l-8-3Z",
1585
+ stroke: "currentColor",
1586
+ "stroke-width": "2",
1587
+ "stroke-linejoin": "round"
1588
+ }
1589
+ ),
1590
+ /* @__PURE__ */ o(
1591
+ "path",
1592
+ {
1593
+ d: "m9 12 2 2 4-4",
1594
+ stroke: "currentColor",
1595
+ "stroke-width": "2",
1596
+ "stroke-linecap": "round",
1597
+ "stroke-linejoin": "round"
1598
+ }
1599
+ )
1600
+ ]
1601
+ }
1602
+ );
1603
+ }
1604
+ const Ue = 24, Ht = 16, Gt = 2;
1605
+ function Wt(r, e) {
1606
+ const t = e * Gt;
1607
+ let n = Ue;
1608
+ for (r.style.fontSize = `${n}px`; r.scrollHeight > t && n > Ht; )
897
1609
  n -= 1, r.style.fontSize = `${n}px`;
898
1610
  }
899
- function qe({ block: r, ctx: e }) {
900
- const t = r.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", s = B(null), l = t === 1 && !!e.bootstrap.settings.title_auto_fit;
901
- return M(() => {
902
- if (!l || !s.current) return;
903
- const a = getComputedStyle(s.current), c = parseFloat(a.lineHeight) || le * 1.5;
904
- je(s.current, c);
905
- }, [l, r.text]), /* @__PURE__ */ o(n, { ref: s, class: i, children: r.text });
1611
+ function Zt({ block: r, ctx: e }) {
1612
+ const t = r.level ?? 1, n = `h${t}`, i = t === 1 ? "text-[22px] sm:text-2xl font-semibold leading-tight text-center text-balance text-gray-800" : t === 2 ? "text-xl font-semibold leading-snug text-gray-900 tracking-tight" : "text-base font-medium text-gray-900", s = j(null), a = t === 1 && !!e.bootstrap.settings.title_auto_fit;
1613
+ return P(() => {
1614
+ if (!a || !s.current) return;
1615
+ const l = getComputedStyle(s.current), c = parseFloat(l.lineHeight) || Ue * 1.5;
1616
+ Wt(s.current, c);
1617
+ }, [a, r.text]), /* @__PURE__ */ o(n, { ref: s, class: i, children: r.text });
906
1618
  }
907
- function Re(r) {
1619
+ function Yt(r) {
908
1620
  const e = r.local ?? { currency: r.currency, amount: r.amount };
1621
+ if (r.interval === "year") {
1622
+ const t = (r.interval_count ?? 1) * 12;
1623
+ return { amount: e.amount / t, currency: e.currency };
1624
+ }
1625
+ return { amount: e.amount, currency: e.currency };
1626
+ }
1627
+ function oe(r, e) {
1628
+ const t = r % 1 !== 0 ? 2 : 0;
909
1629
  try {
910
- return new Intl.NumberFormat(void 0, {
1630
+ const n = new Intl.NumberFormat(void 0, {
911
1631
  style: "currency",
912
- currency: e.currency,
913
- maximumFractionDigits: e.amount % 1 === 0 ? 0 : 2
914
- }).format(e.amount);
1632
+ currency: e,
1633
+ currencyDisplay: "narrowSymbol",
1634
+ maximumFractionDigits: t,
1635
+ minimumFractionDigits: t
1636
+ }).formatToParts(r);
1637
+ let i = "", s = "";
1638
+ for (const a of n)
1639
+ a.type === "currency" ? i = a.value : a.type !== "literal" && (s += a.value);
1640
+ return { currency: i || e, amount: s.trim() };
915
1641
  } catch {
916
- return `${e.amount} ${e.currency}`;
1642
+ return { currency: e, amount: String(r) };
1643
+ }
1644
+ }
1645
+ function le(r, e) {
1646
+ const { amount: t, currency: n } = Yt(r);
1647
+ if (!e) {
1648
+ const { currency: l, amount: c } = oe(t, n);
1649
+ return { currency: l, amount: c, originalAmount: null };
917
1650
  }
1651
+ const i = t * (1 - e / 100), s = oe(i, n), a = oe(t, n);
1652
+ return {
1653
+ currency: s.currency,
1654
+ amount: s.amount,
1655
+ originalAmount: `${a.currency}${a.amount}`
1656
+ };
1657
+ }
1658
+ function je(r, e) {
1659
+ if (r.label) return r.label.toUpperCase();
1660
+ if (!r.interval || r.interval === "lifetime")
1661
+ return e("pricing.plan_label.lifetime", "LIFETIME");
1662
+ const n = {
1663
+ day: { key: "pricing.plan_label.daily", fallback: "DAILY PLAN" },
1664
+ week: { key: "pricing.plan_label.weekly", fallback: "WEEKLY PLAN" },
1665
+ month: { key: "pricing.plan_label.monthly", fallback: "MONTHLY PLAN" },
1666
+ year: { key: "pricing.plan_label.yearly", fallback: "YEARLY PLAN" }
1667
+ }[r.interval];
1668
+ return n ? e(n.key, n.fallback) : `${r.interval.toUpperCase()} PLAN`;
918
1669
  }
919
- function ee(r) {
920
- if (!r.interval || r.interval === "lifetime") return "one-time";
921
- const e = r.interval_count ?? 1;
922
- return e === 1 ? `per ${r.interval}` : `every ${e} ${r.interval}s`;
1670
+ function ce(r, e) {
1671
+ if (!r.interval || r.interval === "lifetime")
1672
+ return e("pricing.interval.lifetime_short", "lifetime");
1673
+ if (r.interval === "year") return e("pricing.interval.month", "month");
1674
+ const t = r.interval_count ?? 1;
1675
+ return t === 1 ? e(`pricing.interval.${r.interval}`, r.interval) : `${t} ${r.interval}s`;
923
1676
  }
924
- function ze({ block: r, ctx: e }) {
925
- const t = r.priceIds && r.priceIds.length > 0 ? new Set(r.priceIds) : null, n = e.bootstrap.prices.filter((a) => !t || t.has(a.id));
926
- if (n.length === 0)
927
- return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: "No prices available." });
928
- const i = r.view === "horizontal", s = r.popular_label ?? "Most popular", l = i ? Math.min(n.length, 3) : 1;
1677
+ function Kt({ block: r, ctx: e }) {
1678
+ const { t } = S(), n = r.priceIds && r.priceIds.length > 0 ? new Set(r.priceIds) : null, i = e.bootstrap.prices.filter((a) => !n || n.has(a.id));
1679
+ if (i.length === 0)
1680
+ return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: t("pricing.no_prices", "No prices available.") });
1681
+ const s = r.popular_label ?? t("pricing.most_popular", "Most popular");
1682
+ if (r.view === "compact")
1683
+ return /* @__PURE__ */ o(
1684
+ "div",
1685
+ {
1686
+ class: "flex w-full flex-col rounded-xl border border-gray-200 bg-gray-50",
1687
+ role: "radiogroup",
1688
+ "aria-label": t("pricing.plans_aria", "Plans"),
1689
+ children: i.map((a, l) => /* @__PURE__ */ o(
1690
+ Jt,
1691
+ {
1692
+ price: a,
1693
+ isLast: l === i.length - 1,
1694
+ isPopular: r.popular_price_id === a.id,
1695
+ popularLabel: s,
1696
+ offer: N(e.bootstrap.offers, a.id),
1697
+ selected: e.selectedPriceId === a.id,
1698
+ onSelect: () => {
1699
+ e.setSelectedPriceId(a.id), e.onAction("price_selected", { priceId: a.id, price: a });
1700
+ },
1701
+ t
1702
+ },
1703
+ a.id
1704
+ ))
1705
+ }
1706
+ );
1707
+ if (r.view === "horizontal") {
1708
+ const a = Math.min(i.length, 3), l = i.some(
1709
+ (c) => (N(e.bootstrap.offers, c.id)?.discount_percent ?? 0) > 0
1710
+ );
1711
+ return /* @__PURE__ */ o(
1712
+ "div",
1713
+ {
1714
+ class: "grid items-stretch gap-2",
1715
+ style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` },
1716
+ role: "radiogroup",
1717
+ "aria-label": t("pricing.plans_aria", "Plans"),
1718
+ children: i.map((c) => /* @__PURE__ */ o(
1719
+ Qt,
1720
+ {
1721
+ price: c,
1722
+ isPopular: r.popular_price_id === c.id,
1723
+ popularLabel: s,
1724
+ offer: N(e.bootstrap.offers, c.id),
1725
+ reserveStrikeRow: l,
1726
+ selected: e.selectedPriceId === c.id,
1727
+ onSelect: () => {
1728
+ e.setSelectedPriceId(c.id), e.onAction("price_selected", { priceId: c.id, price: c });
1729
+ },
1730
+ t
1731
+ },
1732
+ c.id
1733
+ ))
1734
+ }
1735
+ );
1736
+ }
929
1737
  return /* @__PURE__ */ o(
930
1738
  "div",
931
1739
  {
932
- class: i ? "grid gap-2.5" : "flex flex-col gap-2.5",
933
- style: i ? { gridTemplateColumns: `repeat(${l}, minmax(0, 1fr))` } : void 0,
1740
+ class: "flex flex-col gap-2",
934
1741
  role: "radiogroup",
935
- "aria-label": "Plans",
936
- children: n.map((a) => {
937
- const c = e.selectedPriceId === a.id, p = r.popular_price_id === a.id;
1742
+ "aria-label": t("pricing.plans_aria", "Plans"),
1743
+ children: i.map((a) => {
1744
+ const l = e.selectedPriceId === a.id, c = r.popular_price_id === a.id, d = N(e.bootstrap.offers, a.id)?.discount_percent ?? null, { currency: g, amount: _, originalAmount: p } = le(a, d);
938
1745
  return /* @__PURE__ */ u(
939
1746
  "button",
940
1747
  {
941
1748
  type: "button",
942
1749
  role: "radio",
943
- "aria-checked": c,
1750
+ "aria-checked": l,
944
1751
  onClick: () => {
945
1752
  e.setSelectedPriceId(a.id), e.onAction("price_selected", { priceId: a.id, price: a });
946
1753
  },
947
1754
  class: [
948
- "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)]",
949
- i ? "flex w-full flex-col items-start gap-1" : "flex w-full items-center justify-between gap-3",
950
- 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",
951
- p ? "mt-2.5" : ""
1755
+ "group relative inline-flex w-full mx-auto items-center justify-between flex-row-reverse gap-4 rounded-2xl border-2 px-4 py-3.5 text-left transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1756
+ // Везде border 2px selection выражается только цветом, layout
1757
+ // не прыгает (равная толщина у selected/unselected). Цветовая
1758
+ // разница accent vs gray достаточно сильная для visual hierarchy.
1759
+ l ? "border-[var(--pw-accent)] bg-transparent" : "border-gray-200 bg-transparent hover:bg-gray-50"
952
1760
  ].join(" "),
953
1761
  children: [
954
- p ? /* @__PURE__ */ o(
1762
+ /* @__PURE__ */ o(
955
1763
  "span",
956
1764
  {
957
- 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",
958
- style: {
959
- background: "linear-gradient(135deg, var(--pw-accent), color-mix(in srgb, var(--pw-accent) 70%, black))"
960
- },
1765
+ class: [
1766
+ "flex h-6.5 w-6.5 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
1767
+ l ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent",
1768
+ // Popular-label badge сидит absolute сверху-справа карточки и
1769
+ // визуально сдвигает центр content'а вниз. flex items-center
1770
+ // на карточке держит галочку по геометрическому центру, что
1771
+ // делает её визуально выше — компенсируем небольшим mt'ом.
1772
+ c ? "mt-3" : ""
1773
+ ].join(" "),
1774
+ style: l ? {
1775
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
1776
+ } : void 0,
1777
+ "aria-hidden": "true",
1778
+ children: /* @__PURE__ */ o(
1779
+ "svg",
1780
+ {
1781
+ width: "14",
1782
+ height: "10",
1783
+ viewBox: "0 0 17 12",
1784
+ fill: "none",
1785
+ xmlns: "http://www.w3.org/2000/svg",
1786
+ class: l ? "opacity-100" : "opacity-0",
1787
+ children: /* @__PURE__ */ o(
1788
+ "path",
1789
+ {
1790
+ d: "M16.5234 0.476562C16.9805 0.898438 16.9805 1.63672 16.5234 2.05859L7.52344 11.0586C7.10156 11.5156 6.36328 11.5156 5.94141 11.0586L1.44141 6.55859C0.984375 6.13672 0.984375 5.39844 1.44141 4.97656C1.86328 4.51953 2.60156 4.51953 3.02344 4.97656L6.75 8.66797L14.9414 0.476562C15.3633 0.0195312 16.1016 0.0195312 16.5234 0.476562Z",
1791
+ fill: "currentColor"
1792
+ }
1793
+ )
1794
+ }
1795
+ )
1796
+ }
1797
+ ),
1798
+ /* @__PURE__ */ u("div", { class: "flex flex-1 flex-col gap-0.5", children: [
1799
+ /* @__PURE__ */ u("div", { class: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
1800
+ /* @__PURE__ */ o("span", { class: "text-xs font-normal uppercase tracking-normal text-gray-800/70", children: je(a, t) }),
1801
+ p ? (
1802
+ // opacity-60 приглушает strike: глаз сначала ловит label
1803
+ // и discount-badge, потом main price; original «бывшая цена»
1804
+ // — третичная информация, не должна конкурировать с label.
1805
+ /* @__PURE__ */ o("span", { class: "text-[15px] font-normal text-gray-400 opacity-60 line-through decoration-gray-400 decoration-[1.5px]", children: p })
1806
+ ) : null,
1807
+ d ? (
1808
+ // Emerald pill — фиксированный «успех/выгода», не зависит от
1809
+ // brand_color. Читается даже на тёмных бренд-акцентах.
1810
+ /* @__PURE__ */ u("span", { class: "rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-bold leading-none text-emerald-700", children: [
1811
+ "-",
1812
+ d,
1813
+ "%"
1814
+ ] })
1815
+ ) : null
1816
+ ] }),
1817
+ /* @__PURE__ */ o("div", { class: "flex items-baseline gap-2 flex-wrap", children: /* @__PURE__ */ u("span", { class: "text-[26px] leading-tight whitespace-nowrap text-gray-800 font-medium", children: [
1818
+ /* @__PURE__ */ o("span", { class: "opacity-90", children: g }),
1819
+ _,
1820
+ /* @__PURE__ */ u("span", { class: "text-sm font-normal text-gray-500", children: [
1821
+ " ",
1822
+ "/ ",
1823
+ ce(a, t)
1824
+ ] })
1825
+ ] }) }),
1826
+ a.description ? /* @__PURE__ */ o("span", { class: "mt-1 text-xs leading-relaxed text-gray-500", children: a.description }) : null
1827
+ ] }),
1828
+ c ? /* @__PURE__ */ o(
1829
+ "span",
1830
+ {
1831
+ class: "absolute -top-[9px] -right-[6px] rounded-[11px] border-[5px] border-white px-2 py-1 text-[12px] font-semibold text-white",
1832
+ style: { background: "var(--pw-accent)" },
961
1833
  children: s
962
1834
  }
963
- ) : null,
964
- /* @__PURE__ */ u("div", { class: i ? "flex w-full items-start gap-2.5" : "flex flex-1 items-start gap-2.5", children: [
965
- /* @__PURE__ */ o(
966
- "span",
1835
+ ) : null
1836
+ ]
1837
+ },
1838
+ a.id
1839
+ );
1840
+ })
1841
+ }
1842
+ );
1843
+ }
1844
+ function Xt(r, e) {
1845
+ return r.label ? r.label : !r.interval || r.interval === "lifetime" ? e("pricing.interval.lifetime_short", "lifetime") : e(`pricing.interval.${r.interval}`, r.interval);
1846
+ }
1847
+ function Jt({
1848
+ price: r,
1849
+ isLast: e,
1850
+ isPopular: t,
1851
+ popularLabel: n,
1852
+ offer: i,
1853
+ selected: s,
1854
+ onSelect: a,
1855
+ t: l
1856
+ }) {
1857
+ const c = i?.discount_percent ?? null, { currency: h, amount: d, originalAmount: g } = le(r, c);
1858
+ return /* @__PURE__ */ u(
1859
+ "button",
1860
+ {
1861
+ type: "button",
1862
+ role: "radio",
1863
+ "aria-checked": s,
1864
+ onClick: a,
1865
+ class: "group relative inline-flex w-full max-w-[360px] mx-auto items-center justify-between gap-4 px-4 pt-3.5 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--pw-accent)]",
1866
+ children: [
1867
+ /* @__PURE__ */ o(
1868
+ "span",
1869
+ {
1870
+ class: [
1871
+ "flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full border transition-colors mb-3",
1872
+ s ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent"
1873
+ ].join(" "),
1874
+ style: s ? {
1875
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
1876
+ } : void 0,
1877
+ "aria-hidden": "true",
1878
+ children: /* @__PURE__ */ o(
1879
+ "svg",
1880
+ {
1881
+ width: "14",
1882
+ height: "10",
1883
+ viewBox: "0 0 17 12",
1884
+ fill: "none",
1885
+ xmlns: "http://www.w3.org/2000/svg",
1886
+ class: s ? "opacity-100" : "opacity-0",
1887
+ children: /* @__PURE__ */ o(
1888
+ "path",
967
1889
  {
968
- class: [
969
- "mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
970
- c ? "border-[var(--pw-accent)] bg-[var(--pw-accent)]" : "border-gray-300 bg-white group-hover:border-gray-400"
971
- ].join(" "),
972
- "aria-hidden": "true",
973
- children: c ? /* @__PURE__ */ o("span", { class: "h-1.5 w-1.5 rounded-full bg-white" }) : null
1890
+ d: "M16.5234 0.476562C16.9805 0.898438 16.9805 1.63672 16.5234 2.05859L7.52344 11.0586C7.10156 11.5156 6.36328 11.5156 5.94141 11.0586L1.44141 6.55859C0.984375 6.13672 0.984375 5.39844 1.44141 4.97656C1.86328 4.51953 2.60156 4.51953 3.02344 4.97656L6.75 8.66797L14.9414 0.476562C15.3633 0.0195312 16.1016 0.0195312 16.5234 0.476562Z",
1891
+ fill: "currentColor"
974
1892
  }
975
- ),
976
- /* @__PURE__ */ u("div", { class: "flex flex-col", children: [
977
- /* @__PURE__ */ o("span", { class: "text-sm font-semibold text-gray-900", children: a.label ?? ee(a) }),
978
- a.description ? /* @__PURE__ */ o("span", { class: "text-xs leading-relaxed text-gray-500", children: a.description }) : null,
979
- a.trial_days ? /* @__PURE__ */ u("span", { class: "text-xs font-medium text-[var(--pw-accent)]", children: [
980
- a.trial_days,
981
- "-day free trial"
982
- ] }) : null
983
- ] })
1893
+ )
1894
+ }
1895
+ )
1896
+ }
1897
+ ),
1898
+ /* @__PURE__ */ u(
1899
+ "div",
1900
+ {
1901
+ class: [
1902
+ "flex flex-1 items-center gap-1.5 pb-3.5",
1903
+ e ? "" : "border-b border-gray-200"
1904
+ ].join(" "),
1905
+ children: [
1906
+ /* @__PURE__ */ u("div", { class: "flex flex-wrap items-center gap-1 gap-x-1.5", children: [
1907
+ /* @__PURE__ */ o("span", { class: "text-base font-normal capitalize text-gray-800", children: Xt(r, l) }),
1908
+ t ? (
1909
+ // Pastel brand-mix pill — точно как `badge` в TelegramPricingRadio.
1910
+ // Низкий visual weight: pill про "имя плана" (most popular), а не
1911
+ // про savings — не должна конкурировать с -X% discount-pill.
1912
+ /* @__PURE__ */ o(
1913
+ "span",
1914
+ {
1915
+ class: "rounded-[9px] px-2 py-1 text-[10px] font-bold",
1916
+ style: {
1917
+ background: "linear-gradient(160deg, color-mix(in srgb, var(--pw-accent) 6%, white) 0%, color-mix(in srgb, var(--pw-accent) 15%, white) 100%)",
1918
+ color: "var(--pw-accent)"
1919
+ },
1920
+ children: n
1921
+ }
1922
+ )
1923
+ ) : null,
1924
+ c ? /* @__PURE__ */ u("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
1925
+ "-",
1926
+ c,
1927
+ "%"
1928
+ ] }) : null
984
1929
  ] }),
985
- /* @__PURE__ */ u("div", { class: i ? "mt-1 flex flex-col items-start" : "flex flex-col items-end", children: [
986
- /* @__PURE__ */ o("span", { class: "text-base font-semibold tracking-tight text-gray-900", children: Re(a) }),
987
- /* @__PURE__ */ o("span", { class: "text-[11px] text-gray-500", children: ee(a) })
1930
+ /* @__PURE__ */ o("div", { class: "flex-1" }),
1931
+ /* @__PURE__ */ u("span", { class: "flex items-baseline gap-1.5 text-base font-normal text-gray-600", children: [
1932
+ g ? /* @__PURE__ */ o("span", { class: "text-xs text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: g }) : null,
1933
+ /* @__PURE__ */ u("span", { class: "whitespace-nowrap", children: [
1934
+ /* @__PURE__ */ o("span", { class: "opacity-90", children: h }),
1935
+ d,
1936
+ /* @__PURE__ */ u("span", { class: "text-xs text-gray-400", children: [
1937
+ " ",
1938
+ "/ ",
1939
+ ce(r, l)
1940
+ ] })
1941
+ ] })
988
1942
  ] })
989
1943
  ]
990
- },
991
- a.id
992
- );
993
- })
1944
+ }
1945
+ )
1946
+ ]
1947
+ }
1948
+ );
1949
+ }
1950
+ function Qt({
1951
+ price: r,
1952
+ isPopular: e,
1953
+ popularLabel: t,
1954
+ offer: n,
1955
+ reserveStrikeRow: i,
1956
+ selected: s,
1957
+ onSelect: a,
1958
+ t: l
1959
+ }) {
1960
+ const c = n?.discount_percent ?? null, { currency: h, amount: d, originalAmount: g } = le(r, c);
1961
+ return /* @__PURE__ */ u(
1962
+ "button",
1963
+ {
1964
+ type: "button",
1965
+ role: "radio",
1966
+ "aria-checked": s,
1967
+ onClick: a,
1968
+ class: [
1969
+ "group relative flex h-full flex-col items-center justify-start gap-1 rounded-2xl border-2 px-3 pb-4 pt-3.5 text-center transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1970
+ s ? "border-[var(--pw-accent)]" : "border-gray-200 hover:bg-gray-50"
1971
+ ].join(" "),
1972
+ style: s ? { background: "color-mix(in srgb, var(--pw-accent) 6%, transparent)" } : void 0,
1973
+ children: [
1974
+ /* @__PURE__ */ o("span", { class: "flex min-h-[2.4em] items-center text-[10px] font-normal uppercase leading-tight text-gray-800/70", children: je(r, l) }),
1975
+ i ? /* @__PURE__ */ u("div", { class: "flex h-[22px] items-center justify-center gap-1.5", children: [
1976
+ g ? /* @__PURE__ */ o("span", { class: "text-[12px] text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: g }) : null,
1977
+ c ? /* @__PURE__ */ u("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
1978
+ "-",
1979
+ c,
1980
+ "%"
1981
+ ] }) : null
1982
+ ] }) : null,
1983
+ /* @__PURE__ */ u("span", { class: "text-[26px] leading-none whitespace-nowrap text-gray-800 font-medium", children: [
1984
+ /* @__PURE__ */ o("span", { class: "opacity-90", children: h }),
1985
+ d
1986
+ ] }),
1987
+ /* @__PURE__ */ u("span", { class: "text-xs font-normal text-gray-500", children: [
1988
+ "/ ",
1989
+ ce(r, l)
1990
+ ] }),
1991
+ e ? /* @__PURE__ */ o(
1992
+ "span",
1993
+ {
1994
+ class: "absolute -top-[10px] left-1/2 -translate-x-1/2 whitespace-nowrap rounded-[11px] border-[3px] border-white px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",
1995
+ style: { background: "var(--pw-accent)" },
1996
+ children: t
1997
+ }
1998
+ ) : null
1999
+ ]
994
2000
  }
995
2001
  );
996
2002
  }
997
- function De({ block: r }) {
2003
+ function er({ block: r }) {
998
2004
  return /* @__PURE__ */ o("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children: r.text });
999
2005
  }
1000
- const Fe = {
2006
+ const tr = {
1001
2007
  week: 0.25,
1002
2008
  month: 1,
1003
2009
  year: 12
1004
2010
  };
1005
- function Ve(r) {
1006
- return r || "period";
2011
+ function rr(r, e) {
2012
+ return r ? e(`pricing.interval.${r}`, r) : e("pricing.interval.period", "period");
1007
2013
  }
1008
- function $e({ block: r, ctx: e }) {
2014
+ function nr({ block: r, ctx: e }) {
2015
+ const { t } = S();
1009
2016
  if (!r.queries.length) return null;
1010
- const n = e.bootstrap.prices.find((s) => s.id === e.selectedPriceId)?.interval ?? null, i = n ? Fe[n] : void 0;
2017
+ const i = e.bootstrap.prices.find((a) => a.id === e.selectedPriceId)?.interval ?? null, s = i ? tr[i] : void 0;
1011
2018
  return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
1012
- /* @__PURE__ */ u("div", { class: "text-sm font-semibold text-gray-800", children: [
1013
- "Included per ",
1014
- /* @__PURE__ */ o("span", { children: Ve(n) }),
1015
- ":"
1016
- ] }),
1017
- /* @__PURE__ */ o("ul", { class: "flex flex-col gap-2", role: "list", children: r.queries.map((s) => {
1018
- const l = Number.isFinite(s.count) ? s.count : 0, a = i !== void 0 ? Math.round(l * i) : l;
1019
- return /* @__PURE__ */ u("li", { class: `flex gap-2 ${s.desc ? "" : "items-center"}`, children: [
2019
+ /* @__PURE__ */ o("div", { class: "text-sm font-semibold text-gray-800", children: !i || i === "lifetime" ? t("pricing.included_total", "Included for lifetime:") : t("pricing.included_per", "Included per {interval}:", {
2020
+ interval: rr(i, t)
2021
+ }) }),
2022
+ /* @__PURE__ */ o("ul", { class: "flex flex-col gap-2", role: "list", children: r.queries.map((a) => {
2023
+ const l = Number.isFinite(a.count) ? a.count : 0, c = s !== void 0 ? Math.round(l * s) : l;
2024
+ return /* @__PURE__ */ u("li", { class: `flex gap-3 ${a.desc ? "items-start" : "items-center"}`, children: [
1020
2025
  /* @__PURE__ */ o(
1021
- "span",
2026
+ "svg",
1022
2027
  {
1023
- class: `flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full ${s.desc ? "mt-0.5" : ""}`,
1024
- style: {
1025
- background: "color-mix(in srgb, var(--pw-accent) 12%, white)",
1026
- color: "var(--pw-accent)"
1027
- },
2028
+ width: "18",
2029
+ height: "18",
2030
+ viewBox: "0 0 20 20",
2031
+ fill: "none",
2032
+ class: `flex-shrink-0 text-emerald-500 ${a.desc ? "mt-0.5" : ""}`,
1028
2033
  "aria-hidden": "true",
1029
- children: /* @__PURE__ */ o("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ o(
2034
+ children: /* @__PURE__ */ o(
1030
2035
  "path",
1031
2036
  {
1032
- d: "M5 10l3 3 7-7",
2037
+ d: "M4 10.5l3.5 3.5 8.5-8.5",
1033
2038
  stroke: "currentColor",
1034
2039
  "stroke-width": "2.5",
1035
2040
  "stroke-linecap": "round",
1036
2041
  "stroke-linejoin": "round"
1037
2042
  }
1038
- ) })
2043
+ )
1039
2044
  }
1040
2045
  ),
1041
2046
  /* @__PURE__ */ u("div", { children: [
1042
- /* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children: a }),
2047
+ /* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children: c }),
1043
2048
  " ",
1044
- /* @__PURE__ */ o("span", { class: "text-sm text-gray-800", children: s.name }),
1045
- s.desc ? /* @__PURE__ */ u(ne, { children: [
2049
+ /* @__PURE__ */ o("span", { class: "text-sm text-gray-800", children: a.name }),
2050
+ a.desc ? /* @__PURE__ */ u(ae, { children: [
1046
2051
  /* @__PURE__ */ o("br", {}),
1047
- /* @__PURE__ */ o("span", { class: "text-xs text-gray-500", children: s.desc })
2052
+ /* @__PURE__ */ o("span", { class: "text-xs text-gray-400", children: a.desc })
1048
2053
  ] }) : null
1049
2054
  ] })
1050
- ] }, s.id);
2055
+ ] }, a.id);
1051
2056
  }) })
1052
2057
  ] });
1053
2058
  }
1054
- const Ne = {
1055
- heading: qe,
1056
- text: De,
1057
- price_grid: ze,
1058
- cta_button: Ee,
1059
- auth_panel: se,
1060
- current_session: Pe,
1061
- features_list: Le,
1062
- tokenization_gate: $e
2059
+ const ir = {
2060
+ heading: Zt,
2061
+ text: er,
2062
+ price_grid: Kt,
2063
+ cta_button: zt,
2064
+ auth_panel: Me,
2065
+ current_session: qt,
2066
+ features_list: Nt,
2067
+ tokenization_gate: nr,
2068
+ guarantee_badge: Ft,
2069
+ offer_banner: At
1063
2070
  };
1064
- function He({ layout: r, bootstrap: e, onAction: t, auth: n, authSession: i }) {
1065
- const s = ie(() => e.prices[0]?.id ?? null, [e.prices]), [l, a] = x(s), c = {
2071
+ function or({ layout: r, bootstrap: e, onAction: t, auth: n, authSession: i, hasTopBanner: s }) {
2072
+ const a = Ge(() => {
2073
+ for (const v of r.blocks)
2074
+ if (v.type === "price_grid" && v.popular_price_id && e.prices.some((m) => m.id === v.popular_price_id))
2075
+ return v.popular_price_id;
2076
+ return e.prices[0]?.id ?? null;
2077
+ }, [r.blocks, e.prices]), [l, c] = k(a), h = {
1066
2078
  bootstrap: e,
1067
2079
  selectedPriceId: l,
1068
- setSelectedPriceId: a,
2080
+ setSelectedPriceId: c,
1069
2081
  onAction: t,
1070
2082
  auth: n,
1071
2083
  authSession: i
2084
+ }, d = r.blocks.findIndex((v) => v.type === "cta_button"), g = d === -1 ? r.blocks : r.blocks.slice(0, d), _ = d === -1 ? [] : r.blocks.slice(d), p = (v, m) => {
2085
+ const A = ir[v.type];
2086
+ return A ? /* @__PURE__ */ o(A, { block: v, ctx: h }, `${v.type}-${m}`) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${v.type}`), null);
1072
2087
  };
1073
- return /* @__PURE__ */ o("div", { class: "flex flex-col gap-4", children: r.blocks.map((p, g) => {
1074
- const b = Ne[p.type];
1075
- return b ? /* @__PURE__ */ o(b, { block: p, ctx: c }, g) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${p.type}`), null);
1076
- }) });
2088
+ return /* @__PURE__ */ u(ae, { children: [
2089
+ /* @__PURE__ */ o("div", { class: "flex-1 min-h-0 overflow-y-auto px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8", children: /* @__PURE__ */ o("div", { class: "flex flex-col gap-6", children: g.map(p) }) }),
2090
+ _.length > 0 ? (
2091
+ // Тонкий shadow-top вместо border-t — создаёт depth, читается как
2092
+ // «footer закреплён к низу dialog'а». Линия выглядела как divider
2093
+ // в обычном flow, не передавала sticky-character.
2094
+ /* @__PURE__ */ o(
2095
+ "div",
2096
+ {
2097
+ class: "flex flex-col gap-4 bg-white px-6 pb-6 pt-3 sm:px-8",
2098
+ style: { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" },
2099
+ children: _.map((v, m) => p(v, g.length + m))
2100
+ }
2101
+ )
2102
+ ) : null
2103
+ ] });
1077
2104
  }
1078
- function Ge(r, e, t, n) {
1079
- return r ? 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 };
2105
+ function sr(r, e, t, n) {
2106
+ return r ? n ? { open: !0, view: "purchased", error: null, processing: !1 } : e.status === "idle" || e.status === "loading" ? { open: !0, view: "loading", error: null, processing: !1 } : e.status === "error" ? { open: !0, view: "error", error: e.error, processing: !1 } : t.kind === "support" ? { open: !0, view: "support", error: null, processing: !1 } : t.kind === "auth_gate" ? { open: !0, view: "auth", error: null, processing: !1 } : t.kind === "awaiting_payment" ? { open: !0, view: "awaiting_payment", error: null, processing: !1 } : t.kind === "popup_blocked" ? { open: !0, view: "popup_blocked", error: null, processing: !1 } : t.kind === "purchase_success" ? { open: !0, view: "purchased", error: null, processing: !1 } : t.kind === "verifying" ? { open: !0, view: "loading", error: null, processing: !1 } : { open: !0, view: "layout", error: null, processing: !1 } : { open: !1, view: null, error: null, processing: !1 };
1080
2107
  }
1081
- function We(r, e) {
1082
- return r.open === e.open && r.view === e.view && r.error === e.error;
2108
+ function ar(r, e) {
2109
+ return r.open === e.open && r.view === e.view && r.error === e.error && r.processing === e.processing;
1083
2110
  }
1084
- function Ze({
2111
+ function lr({
1085
2112
  client: r,
1086
2113
  open: e,
1087
2114
  onClose: t,
1088
2115
  onEvent: n,
1089
2116
  initialView: i,
1090
- purchased: s,
1091
- renew: l,
1092
- onState: a
2117
+ initialAuthMode: s,
2118
+ initialCheckoutPriceId: a,
2119
+ initialCheckoutUrl: l,
2120
+ purchased: c,
2121
+ renew: h,
2122
+ onState: d,
2123
+ inline: g,
2124
+ locale: _
1093
2125
  }) {
1094
- const [c, p] = x({ status: "idle" }), [g, b] = x(
2126
+ const [p, v] = k({ status: "idle" }), [m, A] = k(
1095
2127
  () => r.auth?.getCachedSession() ?? null
1096
- ), [f, m] = x(() => i === "support" ? { kind: "support", origin: "standalone" } : i === "auth" ? { kind: "auth_gate", origin: "standalone" } : i === "anon" ? { kind: "anon_gate", origin: "standalone" } : { kind: "layout" }), y = B(!1), _ = B(null);
1097
- M(() => {
1098
- if (!a) return;
1099
- const d = Ge(e, c, f, s), h = _.current;
1100
- h && We(h, d) || (_.current = d, a(d));
1101
- }, [e, c, f, s, a]), M(() => {
2128
+ ), [b, y] = k(() => i === "support" ? { kind: "support", origin: "standalone" } : i === "auth" ? a ? {
2129
+ kind: "auth_gate",
2130
+ pendingCheckout: { priceId: a, direct: !0 },
2131
+ origin: "standalone",
2132
+ intent: "preauth"
2133
+ } : { kind: "auth_gate", origin: "standalone" } : i === "awaiting_payment" && a && l ? {
2134
+ kind: "awaiting_payment",
2135
+ priceId: a,
2136
+ url: l
2137
+ } : i === "popup_blocked" && a && l ? {
2138
+ kind: "popup_blocked",
2139
+ priceId: a,
2140
+ url: l
2141
+ } : { kind: "layout" }), C = i === "awaiting_payment" || i === "popup_blocked" || i === "auth" && !!a, I = j(!1), O = j(null);
2142
+ P(() => {
2143
+ if (!d) return;
2144
+ const x = sr(e, p, b, c), f = O.current;
2145
+ f && ar(f, x) || (O.current = x, d(x));
2146
+ }, [e, p, b, c, d]), P(() => {
1102
2147
  if (r.auth)
1103
- return r.auth.onAuthChange((d) => b(d));
1104
- }, [r.auth]), M(() => {
2148
+ return r.auth.onAuthChange((x, f) => A(f));
2149
+ }, [r.auth]), P(() => {
1105
2150
  if (typeof r.onBootstrapChange == "function")
1106
- return r.onBootstrapChange((d) => {
1107
- p(
1108
- (h) => h.status === "ready" ? { status: "ready", data: d } : h
2151
+ return r.onBootstrapChange((x) => {
2152
+ v(
2153
+ (f) => f.status === "ready" ? { status: "ready", data: x } : f
1109
2154
  );
1110
2155
  });
1111
- }, [r]), M(() => {
1112
- if (!e || c.status === "ready" || c.status === "loading") return;
1113
- let d = !1;
1114
- return p({ status: "loading" }), r.bootstrap().then((h) => {
1115
- d || (p({ status: "ready", data: h }), n("ready", h), h.user?.has_active_subscription && !l && (n("purchase_completed", {
1116
- priceId: null,
2156
+ }, [r]), P(() => {
2157
+ if (!e || p.status === "ready" || p.status === "loading") return;
2158
+ let x = !1;
2159
+ return v({ status: "loading" }), r.bootstrap().then((f) => {
2160
+ if (x) return;
2161
+ v({ status: "ready", data: f }), n("ready", f);
2162
+ const w = i === "support" || i === "auth" || C;
2163
+ f.user?.has_active_subscription && !h && !w && (n("purchase_completed", {
2164
+ priceId: a ?? null,
1117
2165
  sessionId: null,
1118
2166
  restored: !0
1119
- }), m({ kind: "purchase_success", restored: !0 })));
1120
- }).catch((h) => {
1121
- if (d) return;
1122
- const k = h instanceof T ? h : new T("unknown", "Failed to load paywall", { cause: h });
1123
- p({ status: "error", error: k }), n("error", k);
2167
+ }), y({ kind: "purchase_success", restored: !0 }));
2168
+ }).catch((f) => {
2169
+ if (x) return;
2170
+ const w = f instanceof L ? f : new L("unknown", "Failed to load paywall", { cause: f });
2171
+ v({ status: "error", error: w }), n("error", w);
1124
2172
  }), () => {
1125
- d = !0;
2173
+ x = !0;
1126
2174
  };
1127
- }, [e, r]), M(() => {
2175
+ }, [e, r]), We(() => {
1128
2176
  if (!e) {
1129
- m({ kind: "layout" }), y.current = !1;
2177
+ y({ kind: "layout" }), I.current = !1;
1130
2178
  return;
1131
2179
  }
1132
- i === "support" ? m({ kind: "support", origin: "standalone" }) : i === "auth" ? m({ kind: "auth_gate", origin: "standalone" }) : i === "anon" && m({ kind: "anon_gate", origin: "standalone" });
1133
- }, [e, i]);
1134
- const A = async (d) => {
2180
+ i === "support" ? y({ kind: "support", origin: "standalone" }) : i === "auth" ? y(a ? {
2181
+ kind: "auth_gate",
2182
+ pendingCheckout: { priceId: a, direct: !0 },
2183
+ origin: "standalone",
2184
+ intent: "preauth"
2185
+ } : { kind: "auth_gate", origin: "standalone" }) : i === "awaiting_payment" && a && l ? y({
2186
+ kind: "awaiting_payment",
2187
+ priceId: a,
2188
+ url: l
2189
+ }) : i === "popup_blocked" && a && l && y({
2190
+ kind: "popup_blocked",
2191
+ priceId: a,
2192
+ url: l
2193
+ });
2194
+ }, [e, i, a, l]);
2195
+ const M = async (x) => {
1135
2196
  try {
1136
- const h = await r.createCheckout({
1137
- priceId: d,
1138
- ignoreActivePurchase: l === !0
2197
+ const f = r.getCachedOffers?.() ?? null, w = f ? N(f, x) : null, B = await r.createCheckout({
2198
+ priceId: x,
2199
+ offerId: w?.id,
2200
+ ignoreActivePurchase: h === !0
1139
2201
  });
1140
- if (n("checkout_started", { priceId: d, url: h.url, acquiring: h.acquiring }), typeof window > "u" || !h.url) return;
1141
- const k = window.open(h.url, "_blank");
1142
- if (k) {
2202
+ if (n("checkout_started", { priceId: x, url: B.url, acquiring: B.acquiring }), typeof window > "u" || !B.url) return;
2203
+ const $ = window.open(B.url, "_blank");
2204
+ if ($) {
1143
2205
  try {
1144
- k.opener = null;
2206
+ $.opener = null;
1145
2207
  } catch {
1146
2208
  }
1147
- m({ kind: "awaiting_payment", priceId: d, url: h.url });
2209
+ y({ kind: "awaiting_payment", priceId: x, url: B.url });
1148
2210
  } else
1149
- m({ kind: "popup_blocked", priceId: d, url: h.url });
1150
- } catch (h) {
1151
- if (h instanceof T && h.code === "already_purchased") {
2211
+ y({ kind: "popup_blocked", priceId: x, url: B.url });
2212
+ } catch (f) {
2213
+ if (f instanceof L && f.code === "already_purchased") {
1152
2214
  try {
1153
2215
  await r.getUser({ force: !0 });
1154
2216
  } catch {
1155
2217
  }
1156
- n("purchase_completed", { priceId: d, sessionId: null, restored: !0 }), m({ kind: "purchase_success", restored: !0 });
2218
+ n("purchase_completed", { priceId: x, sessionId: null, restored: !0 }), C ? t() : y({ kind: "purchase_success", restored: !0 });
1157
2219
  return;
1158
2220
  }
1159
- const k = h instanceof T ? h : new T("checkout_failed", "Checkout failed", { cause: h });
1160
- n("error", k), m({ kind: "layout" });
2221
+ const w = f instanceof L ? f : new L("checkout_failed", "Checkout failed", { cause: f });
2222
+ n("error", w), C ? t() : y({ kind: "layout" });
1161
2223
  }
1162
- }, v = (d, h) => {
2224
+ }, R = (x, f) => {
1163
2225
  if (typeof window > "u") return;
1164
- const k = window.open(h, "_blank");
1165
- if (k) {
2226
+ const w = window.open(f, "_blank");
2227
+ if (w) {
1166
2228
  try {
1167
- k.opener = null;
2229
+ w.opener = null;
1168
2230
  } catch {
1169
2231
  }
1170
- m({ kind: "awaiting_payment", priceId: d, url: h });
2232
+ y({ kind: "awaiting_payment", priceId: x, url: f });
1171
2233
  }
1172
2234
  };
1173
- M(() => {
1174
- if (f.kind !== "auth_gate" || !g || g.user.is_anonymous || y.current) return;
1175
- y.current = !0;
1176
- const d = f.pendingCheckout, h = f.origin;
1177
- m({ kind: "verifying" }), (async () => {
1178
- if (!l)
2235
+ P(() => {
2236
+ if (b.kind !== "auth_gate" || !m || m.user.is_anonymous || I.current) return;
2237
+ I.current = !0;
2238
+ const x = b.pendingCheckout, f = b.origin;
2239
+ y({ kind: "verifying" }), (async () => {
2240
+ if (!h)
1179
2241
  try {
1180
2242
  if ((await r.getUser({ force: !0 })).has_active_subscription) {
1181
2243
  n("purchase_completed", {
1182
- priceId: d?.priceId ?? null,
2244
+ priceId: x?.priceId ?? null,
1183
2245
  sessionId: null,
1184
2246
  restored: !0
1185
- }), m({ kind: "purchase_success", restored: !0 });
2247
+ }), x?.direct ? t() : y({ kind: "purchase_success", restored: !0 });
1186
2248
  return;
1187
2249
  }
1188
2250
  } catch {
1189
2251
  }
1190
- if (!d) {
1191
- h === "standalone" ? t() : m({ kind: "layout" });
2252
+ if (!x) {
2253
+ f === "standalone" ? t() : y({ kind: "layout" });
1192
2254
  return;
1193
2255
  }
1194
- await A(d.priceId);
2256
+ await M(x.priceId);
1195
2257
  })().finally(() => {
1196
- y.current = !1;
2258
+ I.current = !1;
1197
2259
  });
1198
- }, [g, f]);
1199
- const S = async (d, h) => {
1200
- if (d === "close") {
2260
+ }, [m, b]);
2261
+ const D = async (x, f) => {
2262
+ if (x === "close") {
1201
2263
  t();
1202
2264
  return;
1203
2265
  }
1204
- if (d === "price_selected") {
1205
- n("price_selected", h);
2266
+ if (x === "price_selected") {
2267
+ n("price_selected", f);
1206
2268
  return;
1207
2269
  }
1208
- if (d === "restore") {
1209
- if (!r.auth || r.auth.getCachedSession()) return;
1210
- m({ kind: "auth_gate" });
2270
+ if (x === "restore") {
2271
+ if (!r.auth) return;
2272
+ const w = r.auth.getCachedSession();
2273
+ if (w && !w.user.is_anonymous) return;
2274
+ y({ kind: "auth_gate", intent: "restore" });
1211
2275
  return;
1212
2276
  }
1213
- if (d === "support") {
1214
- m({ kind: "support", origin: "layout" });
2277
+ if (x === "support") {
2278
+ y({ kind: "support", origin: "layout" });
1215
2279
  return;
1216
2280
  }
1217
- if (d === "checkout" && c.status === "ready") {
1218
- const k = h?.priceId;
1219
- if (!k) {
1220
- n("error", new T("no_price", "No price selected"));
2281
+ if (x === "checkout" && p.status === "ready") {
2282
+ const w = f?.priceId;
2283
+ if (!w) {
2284
+ n("error", new L("no_price", "No price selected"));
1221
2285
  return;
1222
2286
  }
1223
- if ((c.data.settings.checkout_mode ?? "guest") === "preauth" && !!r.auth && !r.auth.getCachedSession()) {
1224
- m({ kind: "auth_gate", pendingCheckout: { priceId: k } });
2287
+ const B = p.data.settings.checkout_mode ?? "guest", $ = r.auth?.getCachedSession() ?? null, Re = !!$ && !$.user.is_anonymous;
2288
+ if (B === "preauth" && !!r.auth && !Re) {
2289
+ y({ kind: "auth_gate", pendingCheckout: { priceId: w } });
1225
2290
  return;
1226
2291
  }
1227
- await A(k);
2292
+ await M(w);
1228
2293
  }
1229
- }, w = c.status === "ready" ? c.data.settings.brand_color : null, P = c.status === "ready" ? !!c.data.settings.is_test_mode : !1, L = c.status === "ready" ? c.data.settings.allow_close !== !1 : !0, C = {
2294
+ }, z = p.status === "ready" ? p.data.settings.brand_color : null, T = p.status === "ready" ? p.data.settings.allow_close !== !1 : !0, q = b.kind === "layout" && p.status === "ready" ? Te(p.data.offers) : null, U = q ? /* @__PURE__ */ o(Lt, { offer: q }) : null, Y = {
1230
2295
  type: "auth_panel",
1231
- heading: "Sign in to continue",
2296
+ // Заголовок не задаём — AuthGate сам решит по intent'у (restore →
2297
+ // "Restore Purchases", остальные → дефолтный "Welcome back!").
1232
2298
  allow_signup: !0,
1233
2299
  allow_password_reset: !0,
1234
2300
  // Не скрываем при наличии сессии — auto-resume useEffect отрабатывает быстрее,
1235
2301
  // чем хотим показывать "Signed in as ..." промежуточным экраном.
1236
2302
  hide_when_authenticated: !1,
1237
- providers: c.status === "ready" ? c.data.settings.auth_providers : void 0
1238
- }, I = f.kind === "support" ? /* @__PURE__ */ o(
1239
- Te,
2303
+ providers: p.status === "ready" ? p.data.settings.auth_providers : void 0
2304
+ }, V = b.kind === "support" ? /* @__PURE__ */ o(
2305
+ Tt,
1240
2306
  {
1241
2307
  client: r,
1242
- authSession: g,
1243
- origin: f.origin,
2308
+ authSession: m,
2309
+ origin: b.origin,
1244
2310
  onBack: () => {
1245
- f.origin === "standalone" ? t() : m({ kind: "layout" });
2311
+ b.origin === "standalone" ? t() : y({ kind: "layout" });
1246
2312
  }
1247
2313
  }
1248
- ) : null;
1249
- return /* @__PURE__ */ o(
1250
- ye,
2314
+ ) : null, K = b.kind === "auth_gate" && b.origin !== "standalone" || b.kind === "support", X = p.status === "ready" ? p.data : null;
2315
+ return /* @__PURE__ */ o(at, { bootstrap: X, forceLocale: _, children: /* @__PURE__ */ o(
2316
+ lt,
1251
2317
  {
1252
2318
  open: e,
1253
2319
  onClose: t,
1254
- brandColor: w,
1255
- testMode: P,
1256
- allowClose: L,
2320
+ brandColor: z,
2321
+ topBanner: U,
2322
+ allowClose: T,
2323
+ hideCloseButton: K,
2324
+ inline: g,
1257
2325
  labelledBy: "pw-title",
1258
- children: s ? /* @__PURE__ */ o(te, { onContinue: t }) : f.kind === "purchase_success" ? /* @__PURE__ */ o(te, { restored: f.restored, onContinue: t }) : I || (c.status === "loading" || c.status === "idle" || f.kind === "verifying" ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
1259
- /* @__PURE__ */ o("span", { class: "inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" }),
1260
- /* @__PURE__ */ o("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: f.kind === "verifying" ? "Checking your subscription…" : "Loading…" })
1261
- ] }) : c.status === "error" ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
1262
- /* @__PURE__ */ o("div", { class: "flex h-11 w-11 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
1263
- /* @__PURE__ */ o(
1264
- "path",
1265
- {
1266
- d: "M10 6v5M10 14h.01",
1267
- stroke: "#dc2626",
1268
- "stroke-width": "2",
1269
- "stroke-linecap": "round"
1270
- }
1271
- ),
1272
- /* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
1273
- ] }) }),
1274
- /* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Something went wrong" }),
1275
- /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: c.error.message })
1276
- ] }) : f.kind === "auth_gate" && r.auth ? /* @__PURE__ */ o(
1277
- Se,
2326
+ children: c ? /* @__PURE__ */ o(ve, { onContinue: t }) : b.kind === "purchase_success" ? /* @__PURE__ */ o(ve, { restored: b.restored, onContinue: t }) : V || (p.status === "loading" || p.status === "idle" || b.kind === "verifying" ? /* @__PURE__ */ o(cr, { verifying: b.kind === "verifying" }) : p.status === "error" ? /* @__PURE__ */ o(ur, { message: p.error.message }) : b.kind === "auth_gate" && r.auth ? /* @__PURE__ */ o(
2327
+ St,
1278
2328
  {
1279
- block: C,
1280
- bootstrap: c.data,
2329
+ block: Y,
2330
+ bootstrap: p.data,
1281
2331
  auth: r.auth,
1282
- authSession: g,
1283
- showBack: f.origin !== "standalone",
2332
+ authSession: m,
2333
+ showBack: b.origin !== "standalone",
2334
+ intent: b.intent ?? (b.origin === "standalone" ? "standalone" : "preauth"),
2335
+ initialMode: b.origin === "standalone" ? s : void 0,
1284
2336
  onBack: () => {
1285
- f.origin === "standalone" ? t() : m({ kind: "layout" });
2337
+ b.origin === "standalone" ? t() : y({ kind: "layout" });
1286
2338
  }
1287
2339
  }
1288
- ) : f.kind === "anon_gate" && r.auth ? /* @__PURE__ */ o(
1289
- Ce,
1290
- {
1291
- auth: r.auth,
1292
- onSuccess: () => {
1293
- f.origin === "standalone" ? t() : m({ kind: "layout" });
1294
- },
1295
- onBack: f.origin === "standalone" ? void 0 : () => m({ kind: "layout" })
1296
- }
1297
- ) : f.kind === "awaiting_payment" ? /* @__PURE__ */ o(
1298
- Xe,
2340
+ ) : b.kind === "awaiting_payment" ? /* @__PURE__ */ o(
2341
+ hr,
1299
2342
  {
1300
2343
  client: r,
1301
- onBack: () => m({ kind: "layout" }),
2344
+ onBack: () => y({ kind: "layout" }),
1302
2345
  onReopen: () => {
1303
2346
  if (typeof window > "u") return;
1304
- const d = window.open(f.url, "_blank");
1305
- if (d)
2347
+ const x = window.open(b.url, "_blank");
2348
+ if (x)
1306
2349
  try {
1307
- d.opener = null;
2350
+ x.opener = null;
1308
2351
  } catch {
1309
2352
  }
1310
2353
  },
1311
- onRetry: () => A(f.priceId)
2354
+ onRetry: () => M(b.priceId)
1312
2355
  }
1313
- ) : f.kind === "popup_blocked" ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
1314
- /* @__PURE__ */ o(
1315
- "div",
1316
- {
1317
- class: "flex h-11 w-11 items-center justify-center rounded-full",
1318
- style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
1319
- "aria-hidden": "true",
1320
- children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
1321
- /* @__PURE__ */ o(
1322
- "path",
1323
- {
1324
- d: "M4 5h12v10H4z",
1325
- stroke: "currentColor",
1326
- "stroke-width": "1.75",
1327
- "stroke-linejoin": "round"
1328
- }
1329
- ),
1330
- /* @__PURE__ */ o("path", { d: "M7 9l3 3 4-5", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" })
1331
- ] })
1332
- }
1333
- ),
1334
- /* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Allow popups to continue" }),
1335
- /* @__PURE__ */ o("p", { class: "max-w-[18rem] text-xs leading-relaxed text-gray-500", children: "Your browser blocked the checkout tab. Click below to open it." }),
1336
- /* @__PURE__ */ o(
1337
- "button",
1338
- {
1339
- type: "button",
1340
- onClick: () => v(f.priceId, f.url),
1341
- 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)]",
1342
- style: {
1343
- background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
1344
- boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1345
- },
1346
- children: "Open checkout"
1347
- }
1348
- )
1349
- ] }) : /* @__PURE__ */ o(
1350
- He,
2356
+ ) : b.kind === "popup_blocked" ? /* @__PURE__ */ o(dr, { onReopen: () => R(b.priceId, b.url) }) : /* @__PURE__ */ o(
2357
+ or,
1351
2358
  {
1352
- layout: c.data.layout,
1353
- bootstrap: c.data,
1354
- onAction: S,
2359
+ layout: p.data.layout,
2360
+ bootstrap: p.data,
2361
+ onAction: D,
1355
2362
  auth: r.auth,
1356
- authSession: g
2363
+ authSession: m
1357
2364
  }
1358
2365
  ))
1359
2366
  }
1360
- );
2367
+ ) });
2368
+ }
2369
+ function cr({ verifying: r }) {
2370
+ const { t: e } = S();
2371
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
2372
+ /* @__PURE__ */ o("span", { class: "inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" }),
2373
+ /* @__PURE__ */ o("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: r ? e("modal.verifying_subscription", "Checking your subscription…") : e("modal.loading", "Loading…") })
2374
+ ] });
2375
+ }
2376
+ function ur({ message: r }) {
2377
+ const { t: e } = S();
2378
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
2379
+ /* @__PURE__ */ o("div", { class: "flex h-11 w-11 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
2380
+ /* @__PURE__ */ o("path", { d: "M10 6v5M10 14h.01", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round" }),
2381
+ /* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
2382
+ ] }) }),
2383
+ /* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: e("modal.error_generic", "Something went wrong") }),
2384
+ /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: r })
2385
+ ] });
2386
+ }
2387
+ function dr({ onReopen: r }) {
2388
+ const { t: e } = S();
2389
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
2390
+ /* @__PURE__ */ o(
2391
+ "div",
2392
+ {
2393
+ class: "flex h-14 w-14 items-center justify-center rounded-full",
2394
+ style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
2395
+ "aria-hidden": "true",
2396
+ children: /* @__PURE__ */ u("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "none", children: [
2397
+ /* @__PURE__ */ o(
2398
+ "path",
2399
+ {
2400
+ d: "M14 4h6v6",
2401
+ stroke: "currentColor",
2402
+ "stroke-width": "2",
2403
+ "stroke-linecap": "round",
2404
+ "stroke-linejoin": "round"
2405
+ }
2406
+ ),
2407
+ /* @__PURE__ */ o(
2408
+ "path",
2409
+ {
2410
+ d: "M20 4l-9 9",
2411
+ stroke: "currentColor",
2412
+ "stroke-width": "2",
2413
+ "stroke-linecap": "round",
2414
+ "stroke-linejoin": "round"
2415
+ }
2416
+ ),
2417
+ /* @__PURE__ */ o(
2418
+ "path",
2419
+ {
2420
+ d: "M19 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",
2421
+ stroke: "currentColor",
2422
+ "stroke-width": "2",
2423
+ "stroke-linecap": "round",
2424
+ "stroke-linejoin": "round"
2425
+ }
2426
+ )
2427
+ ] })
2428
+ }
2429
+ ),
2430
+ /* @__PURE__ */ o(
2431
+ "p",
2432
+ {
2433
+ id: "pw-title",
2434
+ class: "mt-1 text-lg font-semibold tracking-tight text-gray-900",
2435
+ children: e("payment.popup_blocked_title", "Allow popups to continue")
2436
+ }
2437
+ ),
2438
+ /* @__PURE__ */ o("p", { class: "max-w-[20rem] text-sm leading-relaxed text-gray-500", children: e("payment.popup_blocked_message", "Your browser blocked the checkout tab. Click below to open it.") }),
2439
+ /* @__PURE__ */ o(
2440
+ "button",
2441
+ {
2442
+ type: "button",
2443
+ onClick: r,
2444
+ 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)]",
2445
+ style: {
2446
+ background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
2447
+ boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
2448
+ },
2449
+ children: e("payment.open_checkout_button", "Open checkout")
2450
+ }
2451
+ )
2452
+ ] });
1361
2453
  }
1362
- function Xe({
2454
+ function hr({
1363
2455
  client: r,
1364
2456
  onBack: e,
1365
2457
  onReopen: t,
1366
2458
  onRetry: n
1367
2459
  }) {
1368
- const [i, s] = x(!1), [l, a] = x(!1), c = B(null);
1369
- return M(() => () => {
1370
- c.current !== null && clearTimeout(c.current);
1371
- }, []), /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
2460
+ const { t: i } = S(), [s, a] = k(!1), [l, c] = k(!1), h = j(null);
2461
+ P(() => () => {
2462
+ h.current !== null && clearTimeout(h.current);
2463
+ }, []);
2464
+ const d = async () => {
2465
+ if (!s) {
2466
+ a(!0), c(!1);
2467
+ try {
2468
+ if ((await r.getUser({ force: !0 })).has_active_subscription) {
2469
+ typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
2470
+ return;
2471
+ }
2472
+ c(!0), h.current !== null && clearTimeout(h.current), h.current = setTimeout(() => {
2473
+ c(!1), h.current = null;
2474
+ }, 5e3);
2475
+ } catch {
2476
+ c(!0);
2477
+ } finally {
2478
+ a(!1);
2479
+ }
2480
+ }
2481
+ };
2482
+ return /* @__PURE__ */ u("div", { class: "flex flex-col gap-3 px-6 pb-6 pt-4 sm:px-8 sm:pb-8 sm:pt-5", children: [
1372
2483
  /* @__PURE__ */ o(
1373
2484
  "button",
1374
2485
  {
1375
2486
  type: "button",
1376
2487
  onClick: e,
1377
2488
  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)]",
1378
- children: "← Back"
2489
+ children: i("nav.back", "← Back")
1379
2490
  }
1380
2491
  ),
1381
2492
  /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-6 text-center", children: [
1382
- /* @__PURE__ */ u("div", { class: "relative flex h-12 w-12 items-center justify-center", children: [
2493
+ /* @__PURE__ */ u("div", { class: "relative flex h-14 w-14 items-center justify-center", children: [
1383
2494
  /* @__PURE__ */ o(
1384
2495
  "span",
1385
2496
  {
@@ -1388,52 +2499,45 @@ function Xe({
1388
2499
  "aria-hidden": "true"
1389
2500
  }
1390
2501
  ),
1391
- /* @__PURE__ */ o("span", { class: "relative inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" })
2502
+ /* @__PURE__ */ o("span", { class: "relative inline-block h-8 w-8 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" })
1392
2503
  ] }),
1393
- /* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Complete payment in the new tab" }),
1394
- /* @__PURE__ */ o("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." }),
2504
+ /* @__PURE__ */ o(
2505
+ "p",
2506
+ {
2507
+ id: "pw-title",
2508
+ class: "mt-1 text-lg font-semibold tracking-tight text-gray-900",
2509
+ children: i("payment.awaiting_title", "Complete payment in the new tab")
2510
+ }
2511
+ ),
2512
+ /* @__PURE__ */ o("p", { class: "max-w-[22rem] text-sm leading-relaxed text-gray-500", children: i(
2513
+ "payment.awaiting_subtitle",
2514
+ "We'll detect your payment automatically — or click below once you're done."
2515
+ ) }),
1395
2516
  /* @__PURE__ */ o(
1396
2517
  "button",
1397
2518
  {
1398
2519
  type: "button",
1399
- onClick: async () => {
1400
- if (!i) {
1401
- s(!0), a(!1);
1402
- try {
1403
- if ((await r.getUser({ force: !0 })).has_active_subscription) {
1404
- typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
1405
- return;
1406
- }
1407
- a(!0), c.current !== null && clearTimeout(c.current), c.current = setTimeout(() => {
1408
- a(!1), c.current = null;
1409
- }, 5e3);
1410
- } catch {
1411
- a(!0);
1412
- } finally {
1413
- s(!1);
1414
- }
1415
- }
1416
- },
1417
- disabled: i,
1418
- 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)]",
2520
+ onClick: d,
2521
+ disabled: s,
2522
+ class: "mt-3 rounded-xl px-5 py-2.5 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:brightness-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1419
2523
  style: {
1420
2524
  background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
1421
- boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
2525
+ boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1422
2526
  },
1423
- children: i ? "Checking…" : "I've paid"
2527
+ children: s ? i("payment.checking", "Checking…") : i("payment.ive_paid", "I've paid")
1424
2528
  }
1425
2529
  ),
1426
- l ? /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: "Payment is still being processed. Please try again in a moment." }) : null
2530
+ l ? /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: i("payment.still_processing", "Payment is still being processed. Please try again in a moment.") }) : null
1427
2531
  ] }),
1428
2532
  /* @__PURE__ */ u("div", { class: "rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5", children: [
1429
- /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-600", children: "Checkout window didn't open or got blocked? Click here to open it again." }),
2533
+ /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-600", children: i("payment.popup_help_text", "Checkout window didn't open or got blocked? Click here to open it again.") }),
1430
2534
  /* @__PURE__ */ o(
1431
2535
  "button",
1432
2536
  {
1433
2537
  type: "button",
1434
2538
  onClick: t,
1435
2539
  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)]",
1436
- children: "Open checkout again"
2540
+ children: i("payment.open_checkout_again", "Open checkout again")
1437
2541
  }
1438
2542
  )
1439
2543
  ] }),
@@ -1443,15 +2547,16 @@ function Xe({
1443
2547
  type: "button",
1444
2548
  onClick: n,
1445
2549
  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)]",
1446
- children: "Tab closed? Try again"
2550
+ children: i("payment.tab_closed_retry", "Tab closed? Try again")
1447
2551
  }
1448
2552
  )
1449
2553
  ] });
1450
2554
  }
1451
- function te({
2555
+ function ve({
1452
2556
  onContinue: r,
1453
2557
  restored: e = !1
1454
2558
  }) {
2559
+ const { t } = S();
1455
2560
  return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
1456
2561
  /* @__PURE__ */ o(
1457
2562
  "div",
@@ -1476,8 +2581,11 @@ function te({
1476
2581
  ) })
1477
2582
  }
1478
2583
  ),
1479
- /* @__PURE__ */ o("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: e ? "Subscription restored" : "Payment received" }),
1480
- /* @__PURE__ */ o("p", { class: "text-sm leading-relaxed text-gray-500", children: e ? "Welcome back — your subscription is already active." : "Your subscription is now active." }),
2584
+ /* @__PURE__ */ o("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: e ? t("modal.purchase_restored_title", "Subscription restored") : t("modal.purchase_success_title", "Payment received") }),
2585
+ /* @__PURE__ */ o("p", { class: "text-sm leading-relaxed text-gray-500", children: e ? t(
2586
+ "modal.purchase_restored_subtitle",
2587
+ "Welcome back — your subscription is already active."
2588
+ ) : t("modal.purchase_success_subtitle", "Your subscription is now active.") }),
1481
2589
  /* @__PURE__ */ o(
1482
2590
  "button",
1483
2591
  {
@@ -1488,22 +2596,22 @@ function te({
1488
2596
  background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
1489
2597
  boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1490
2598
  },
1491
- children: "Continue"
2599
+ children: t("modal.continue", "Continue")
1492
2600
  }
1493
2601
  )
1494
2602
  ] });
1495
2603
  }
1496
- const Ye = 10 * 6e4, Je = 5e3, Ke = 3e4;
1497
- class Qe {
2604
+ const pr = 10 * 6e4, fr = 5e3, gr = 3e4;
2605
+ class mr {
1498
2606
  constructor(e) {
1499
2607
  this.timer = null, this.timeoutTimer = null, this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null, this.stopped = !1, this.checking = !1, this.opts = {
1500
2608
  client: e.client,
1501
2609
  onActive: e.onActive,
1502
2610
  onTimeout: e.onTimeout ?? (() => {
1503
2611
  }),
1504
- timeoutMs: e.timeoutMs ?? Ye,
1505
- visibleIntervalMs: e.visibleIntervalMs ?? Je,
1506
- hiddenIntervalMs: e.hiddenIntervalMs ?? Ke
2612
+ timeoutMs: e.timeoutMs ?? pr,
2613
+ visibleIntervalMs: e.visibleIntervalMs ?? fr,
2614
+ hiddenIntervalMs: e.hiddenIntervalMs ?? gr
1507
2615
  };
1508
2616
  }
1509
2617
  start() {
@@ -1542,22 +2650,27 @@ class Qe {
1542
2650
  !t || typeof t != "object" || t.type === "paywall_purchase" && this.check();
1543
2651
  }
1544
2652
  }
1545
- function et() {
2653
+ function yr() {
1546
2654
  return !(typeof document > "u" || typeof window > "u" || typeof location < "u" && location.protocol === "chrome-extension:");
1547
2655
  }
1548
- const N = { open: !1, view: null, error: null }, E = {
2656
+ const se = {
2657
+ open: !1,
2658
+ view: null,
2659
+ error: null,
2660
+ processing: !1
2661
+ }, F = {
1549
2662
  status: "paywall_status",
1550
2663
  priceId: "paywall_price_id",
1551
2664
  sessionId: "paywall_session_id"
1552
2665
  };
1553
- let tt = class {
2666
+ let br = class {
1554
2667
  constructor(e) {
1555
- this.handle = null, this.isOpen = !1, this.listeners = /* @__PURE__ */ new Map(), this.userUnsub = null, this.authUnsub = null, this.watcher = null, this.tracker = null, this.purchased = !1, this.trialStore = null, this.trialStoreConfig = null, this.lastTrialStatus = null, this.trialExpiredFired = !1, this.lastVisibility = null, this.currentState = N, this.stateListeners = /* @__PURE__ */ new Set();
1556
- const { auth: t, ownsAuth: n } = rt(e);
1557
- this.auth = t, this.ownsAuth = n, this.billing = e.client ?? new ae({ ...e, auth: this.auth }), this.host = e.host, this.shadowMode = e.shadowMode ?? "closed", this.mountThenLoad = e.mountThenLoad ?? !0, this.userUnsub = this.billing.onUserChange((i) => {
2668
+ this.handle = null, this.isOpen = !1, this.listeners = /* @__PURE__ */ new Map(), this.userUnsub = null, this.authUnsub = null, this.watcher = null, this.tracker = null, this.purchased = !1, this.trialStore = null, this.trialStoreConfig = null, this.lastTrialStatus = null, this.trialExpiredFired = !1, this.lastVisibility = null, this.currentState = se, this.stateListeners = /* @__PURE__ */ new Set();
2669
+ const { auth: t, ownsAuth: n } = xr(e);
2670
+ this.auth = t, this.ownsAuth = n, this.billing = e.client ?? new De({ ...e, auth: this.auth }), this.host = e.host, this.shadowMode = e.shadowMode ?? "closed", this.mountThenLoad = e.mountThenLoad ?? !0, this.inline = e.inline === !0, this.forceLocale = e.locale ?? null, this.userUnsub = this.billing.onUserChange((i) => {
1558
2671
  this.emit("userChange", i);
1559
- }), this.auth && (this.authUnsub = this.auth.onAuthChange((i) => {
1560
- this.emit("authChange", i);
2672
+ }), this.auth && (this.authUnsub = this.auth.onAuthChange((i, s) => {
2673
+ this.emit("authChange", { event: i, session: s });
1561
2674
  })), this.initTracker(e.analytics), e.autoDetectReturn !== !1 && typeof window < "u" && queueMicrotask(() => this.checkReturn());
1562
2675
  }
1563
2676
  initTracker(e) {
@@ -1565,7 +2678,7 @@ let tt = class {
1565
2678
  const t = typeof e == "object" && e !== null ? e : {};
1566
2679
  if (t.enabled === !1) return;
1567
2680
  const n = t.endpoint ?? `${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;
1568
- this.tracker = new ce({
2681
+ this.tracker = new ze({
1569
2682
  endpoint: n,
1570
2683
  paywallId: this.billing.paywallId,
1571
2684
  capabilities: this.billing.capabilities,
@@ -1652,6 +2765,18 @@ let tt = class {
1652
2765
  setBootstrap(e) {
1653
2766
  this.billing.setBootstrap(e);
1654
2767
  }
2768
+ /**
2769
+ * Сменить force-locale на лету — для live-preview редактора админки, когда
2770
+ * юзер переключает «Preview as user from <country>». Грузит соответствующий
2771
+ * static-чанк и форсит re-render через handle.update. См. PaywallUIOptions.locale.
2772
+ *
2773
+ * Передай `null`/`undefined`, чтобы вернуть автоматическую резолв-логику
2774
+ * (navigator.language → locale_default).
2775
+ */
2776
+ setLocale(e) {
2777
+ const t = e ?? null;
2778
+ t !== this.forceLocale && (this.forceLocale = t, this.handle && this.handle.update({ locale: t }));
2779
+ }
1655
2780
  on(e, t) {
1656
2781
  let n = this.listeners.get(e);
1657
2782
  return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t), () => n.delete(t);
@@ -1666,8 +2791,8 @@ let tt = class {
1666
2791
  for (const s of n)
1667
2792
  try {
1668
2793
  s(i);
1669
- } catch (l) {
1670
- typeof console < "u" && console.error("[paywall] listener error", l);
2794
+ } catch (a) {
2795
+ typeof console < "u" && console.error("[paywall] listener error", a);
1671
2796
  }
1672
2797
  }
1673
2798
  open(e = {}) {
@@ -1720,43 +2845,247 @@ let tt = class {
1720
2845
  this.auth && this.openInternal("auth", { ...e, skipTrial: !0 });
1721
2846
  }
1722
2847
  /**
1723
- * Открывает модалку с anonymous-gate. AnonGate сразу зовёт
1724
- * `auth.signInAnonymously()`:
1725
- * - если в storage есть `anonRefreshToken` silent resume через
1726
- * /auth/refresh, модалка схлопывается мгновенно (юзер видит лёгкий
1727
- * спиннер ~100мс);
1728
- * - иначе — fresh POST /auth/anonymous/signin без captcha (защита от
1729
- * abuse держится на Supabase per-real-IP rate-limit + CF Bot Fight Mode).
2848
+ * Шорткат над `openAuth()` открывает модалку сразу на signin-форме.
2849
+ * Эквивалент `openAuth()` (signin — дефолт). Существует для симметрии с
2850
+ * `openSignup()` и читаемости host-кода:
2851
+ * - `paywall.openSignin()` «вход в существующий аккаунт»
2852
+ * - `paywall.openSignup()` — «новая регистрация»
2853
+ * Без managed-auth no-op.
2854
+ */
2855
+ openSignin(e = {}) {
2856
+ this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signin" });
2857
+ }
2858
+ /**
2859
+ * Открывает модалку с auth-gate сразу в режиме регистрации (signup-mode
2860
+ * AuthPanel'а — email/password/repeat). Если в paywall layout админ
2861
+ * отключил allow_signup, AuthPanel игнорит mode и стартует с signin —
2862
+ * соблюдается admin-конфиг.
2863
+ * Без managed-auth — no-op.
2864
+ */
2865
+ openSignup(e = {}) {
2866
+ this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signup" });
2867
+ }
2868
+ /**
2869
+ * Direct-checkout: создать checkout-URL по конкретной цене и сразу открыть
2870
+ * платёжного провайдера, минуя layout с тарифами. Полезно когда
2871
+ * host-приложение рендерит pricing-карточки/таблицу собственным UI и
2872
+ * хочет, чтобы клик по «Buy / Get this plan» вёл прямо в Stripe/Paddle.
2873
+ *
2874
+ * **Late-mount UX.** В отличие от `open()`, модалка не появляется во время
2875
+ * фоновой работы (bootstrap + visibility/trial gates + createCheckout).
2876
+ * Хост на этой фазе показывает busy-state прямо на своей кнопке (через
2877
+ * `state.processing === true` из `paywall.getState()` — или автоматически
2878
+ * через `<PaywallButton priceId>` в sdk-react). Модалка монтируется
2879
+ * ТОЛЬКО когда реально нужна UI:
2880
+ * - `checkout_mode='preauth'` + managed-auth + не залогинен → auth-gate
2881
+ * (форма signin'а); после успеха auto-resume в createCheckout.
2882
+ * - popup провайдера заблокирован браузером → popup_blocked view с
2883
+ * retry-кнопкой под fresh user gesture.
2884
+ * - popup открылся успешно → awaiting_payment view (индикатор «оплати
2885
+ * в новой вкладке» + I've paid).
2886
+ *
2887
+ * Что эмитится без модалки:
2888
+ * - `purchase_completed{restored:true, priceId}` когда юзер уже подписан
2889
+ * (cached user, fresh bootstrap, или 409 hasActivePurchase от бэка) —
2890
+ * headless reject;
2891
+ * - `error` когда createCheckout упал или identity.email отсутствует;
2892
+ * - `visibility_blocked` / `trial_blocked` — стандартные gate-эвенты.
2893
+ *
2894
+ * Что эмитится одновременно с модалкой:
2895
+ * - `checkout_started{priceId, url, acquiring}` ровно когда headless URL
2896
+ * получен, ДО mount'а awaiting_payment/popup_blocked.
1730
2897
  *
1731
- * После успешного signIn'а модалка закрывается; host подхватывает свежую
1732
- * session через `auth.onAuthChange` или `paywall.onUserChange`. Для UX
1733
- * "просто залогиниться чтобы api-gateway работал, без покупок".
2898
+ * Offer (countdown-скидка) автоматически резолвится из cached offers'ов
2899
+ * через `getOfferForPrice(priceId)` и передаётся в createCheckout как
2900
+ * `offerId` чтобы duration_minutes-офферы тоже применились на бэке
2901
+ * (для них нет server-side таймера, без явного offer-id скидка теряется).
2902
+ *
2903
+ * Требования:
2904
+ * - `identity.email` должен быть выставлен (через `opts.identity`, либо
2905
+ * managed-auth, либо ранний `setIdentity`/`paywall.open({identity})`).
2906
+ * Без email бэк `/start-checkout` 400'нёт; SDK эмитнет `error`.
2907
+ * - В `checkout_mode='preauth'` без managed-auth — backend требует
2908
+ * email-юзера; убедись что `identity.email` явно задан.
2909
+ *
2910
+ * Без модалки совсем (когда host рендерит свой awaiting-payment экран) —
2911
+ * используй `paywall.billing.createCheckout({priceId, offerId})` напрямую,
2912
+ * но тогда auth-gate / popup_blocked / awaiting_payment придётся рисовать
2913
+ * самостоятельно.
2914
+ */
2915
+ checkout(e, t = {}) {
2916
+ if (t.identity && this.billing.setIdentity(t.identity), t.renew !== !0 && this.billing.getCachedUser()?.has_active_subscription) {
2917
+ this.emit("purchase_completed", {
2918
+ priceId: e,
2919
+ sessionId: null,
2920
+ restored: !0
2921
+ });
2922
+ return;
2923
+ }
2924
+ this.runDirectCheckout(e, t);
2925
+ }
2926
+ /** Headless prep-work для `checkout(priceId, opts)`: bootstrap → gates →
2927
+ * preauth check → createCheckout → mount модалки с финальным view.
2928
+ * Вынесено отдельным методом ради чистого async/await flow вместо вложенных
2929
+ * then-chain'ов (5+ ветвей). Любая ошибка не пробрасывается наружу: эмитим
2930
+ * через `paywall.emit('error')` и выходим — host подписан на `error`-event. */
2931
+ async runDirectCheckout(e, t) {
2932
+ const n = t.renew === !0, i = t.skipTrial === !0, s = t.skipVisibility === !0;
2933
+ this.applyProcessing(!0);
2934
+ const a = () => {
2935
+ this.applyProcessing(!1);
2936
+ };
2937
+ let l;
2938
+ try {
2939
+ l = await this.billing.bootstrap();
2940
+ } catch (m) {
2941
+ const A = m instanceof L ? m : new L("unknown", "Failed to load paywall", { cause: m });
2942
+ this.emit("error", A), a();
2943
+ return;
2944
+ }
2945
+ if (!s) {
2946
+ const m = l.settings.visibility;
2947
+ if (m && (this.lastVisibility = m, !m.visible)) {
2948
+ this.emit("visibility_blocked", m), a();
2949
+ return;
2950
+ }
2951
+ }
2952
+ if (!i && await this.checkTrialBeforeCheckout(l)) {
2953
+ a();
2954
+ return;
2955
+ }
2956
+ if (!n && l.user?.has_active_subscription) {
2957
+ this.emit("purchase_completed", {
2958
+ priceId: e,
2959
+ sessionId: null,
2960
+ restored: !0
2961
+ }), a();
2962
+ return;
2963
+ }
2964
+ const c = l.settings.checkout_mode ?? "guest", h = this.auth?.getCachedSession() ?? null, d = !!h && !h.user.is_anonymous;
2965
+ if (c === "preauth" && !!this.auth && !d) {
2966
+ this.purchased = !1, this.mountAndShow("auth", {
2967
+ renew: n,
2968
+ authMode: "signin",
2969
+ checkoutPriceId: e
2970
+ });
2971
+ return;
2972
+ }
2973
+ const _ = this.getOfferForPrice(e);
2974
+ let p;
2975
+ try {
2976
+ p = await this.billing.createCheckout({
2977
+ priceId: e,
2978
+ offerId: _?.offer.id,
2979
+ ignoreActivePurchase: n
2980
+ });
2981
+ } catch (m) {
2982
+ if (m instanceof L && m.code === "already_purchased") {
2983
+ try {
2984
+ await this.billing.getUser({ force: !0 });
2985
+ } catch {
2986
+ }
2987
+ this.emit("purchase_completed", {
2988
+ priceId: e,
2989
+ sessionId: null,
2990
+ restored: !0
2991
+ }), a();
2992
+ return;
2993
+ }
2994
+ const A = m instanceof L ? m : new L("checkout_failed", "Checkout failed", { cause: m });
2995
+ this.emit("error", A), a();
2996
+ return;
2997
+ }
2998
+ if (this.emit("checkout_started", {
2999
+ priceId: e,
3000
+ url: p.url,
3001
+ acquiring: p.acquiring
3002
+ }), this.startUserWatcher(), typeof window > "u" || !p.url) {
3003
+ this.mountAndShow("awaiting_payment", {
3004
+ renew: n,
3005
+ checkoutPriceId: e,
3006
+ checkoutUrl: p.url
3007
+ });
3008
+ return;
3009
+ }
3010
+ const v = window.open(p.url, "_blank");
3011
+ if (this.purchased = !1, v) {
3012
+ try {
3013
+ v.opener = null;
3014
+ } catch {
3015
+ }
3016
+ this.mountAndShow("awaiting_payment", {
3017
+ renew: n,
3018
+ checkoutPriceId: e,
3019
+ checkoutUrl: p.url
3020
+ });
3021
+ } else
3022
+ this.mountAndShow("popup_blocked", {
3023
+ renew: n,
3024
+ checkoutPriceId: e,
3025
+ checkoutUrl: p.url
3026
+ });
3027
+ }
3028
+ /** Trial-check без mount'а (для late-mount direct-checkout). Возвращает
3029
+ * true если trial заблокировал — caller должен прекратить flow. На любой
3030
+ * storage-ошибке log+продолжаем (не блокируем продажу). */
3031
+ async checkTrialBeforeCheckout(e) {
3032
+ const t = e.settings.trial;
3033
+ if (!t) return !1;
3034
+ const n = this.ensureTrialStore(t);
3035
+ try {
3036
+ const i = await n.check();
3037
+ if (this.lastTrialStatus = i, i.mode === "none") return !1;
3038
+ if (i.blocked) {
3039
+ const s = await n.recordBlock();
3040
+ return this.lastTrialStatus = s, this.emit("trial_blocked", s), !0;
3041
+ }
3042
+ return this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), !1;
3043
+ } catch (i) {
3044
+ return typeof console < "u" && console.warn("[paywall] trial check failed", i), !1;
3045
+ }
3046
+ }
3047
+ applyProcessing(e) {
3048
+ this.currentState.processing !== e && this.applyState({ ...this.currentState, processing: e });
3049
+ }
3050
+ /**
3051
+ * Headless anonymous signin без открытия модалки. Внутри:
3052
+ * idempotent (если уже анон — instant return) → resume через сохранённый
3053
+ * refresh_token → fresh /auth/anonymous/signin. Дедуплицирует
3054
+ * параллельные вызовы внутри AuthClient'а.
1734
3055
  *
1735
- * Без managed-auth (`auth` не подключён) методno-op. Триал и
1736
- * visibility-таргетинг этот flow обходит: анон-логин не должен зависеть
1737
- * от страны юзера или trial-стейджа.
3056
+ * Удобно для host-кнопок типа «Continue as guest» host сам управляет
3057
+ * loading-стейтом на своей кнопке, без полупустой модалки со спиннером.
3058
+ * Без managed-auth резолвится rejected promise'ом (нет AuthClient'а
3059
+ * чтобы делать signin).
1738
3060
  */
1739
- openAnonGate(e = {}) {
1740
- this.auth && this.openInternal("anon", { ...e, skipTrial: !0, skipVisibility: !0 });
3061
+ signInAnonymously() {
3062
+ return this.auth ? this.auth.signInAnonymously() : Promise.reject(
3063
+ new L(
3064
+ "invalid_config",
3065
+ "signInAnonymously requires managed-auth. Pass `auth: true` to PaywallUI."
3066
+ )
3067
+ );
1741
3068
  }
1742
3069
  openInternal(e, t) {
1743
3070
  t.identity && this.billing.setIdentity(t.identity), this.purchased = !1;
1744
- const n = t.skipTrial === !0 || e === "support", i = t.skipVisibility === !0 || e === "support" || e === "auth" || e === "anon", s = t.renew === !0;
3071
+ const n = t.skipTrial === !0 || e === "support", i = t.skipVisibility === !0 || e === "support" || e === "auth", s = t.renew === !0;
1745
3072
  if (n && i) {
1746
- this.mountAndShow(e, { renew: s });
3073
+ this.mountAndShow(e, { renew: s, authMode: t.authMode });
1747
3074
  return;
1748
3075
  }
1749
- const l = this.billing.getCachedBootstrap();
1750
- if (l) {
1751
- this.runOpenGates(e, l, { skipTrial: n, skipVisibility: i, renew: s });
3076
+ const a = this.billing.getCachedBootstrap();
3077
+ if (a) {
3078
+ this.runOpenGates(e, a, { skipTrial: n, skipVisibility: i, renew: s });
1752
3079
  return;
1753
3080
  }
1754
3081
  if (this.mountThenLoad) {
1755
- this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((a) => this.runDelayedGates(a, { skipTrial: n, skipVisibility: i })).catch(() => {
3082
+ this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((l) => this.runDelayedGates(l, { skipTrial: n, skipVisibility: i })).catch(() => {
1756
3083
  });
1757
3084
  return;
1758
3085
  }
1759
- this.billing.bootstrap().then((a) => this.runOpenGates(e, a, { skipTrial: n, skipVisibility: i, renew: s })).catch(() => {
3086
+ this.billing.bootstrap().then(
3087
+ (l) => this.runOpenGates(e, l, { skipTrial: n, skipVisibility: i, renew: s })
3088
+ ).catch(() => {
1760
3089
  this.mountAndShow(e, { renew: s });
1761
3090
  });
1762
3091
  }
@@ -1779,9 +3108,9 @@ let tt = class {
1779
3108
  i.check().then(async (s) => {
1780
3109
  if (this.isOpen && (this.lastTrialStatus = s, s.mode !== "none")) {
1781
3110
  if (s.blocked) {
1782
- const l = await i.recordBlock();
1783
- if (this.lastTrialStatus = l, !this.isOpen) return;
1784
- this.close(), this.emit("trial_blocked", l);
3111
+ const a = await i.recordBlock();
3112
+ if (this.lastTrialStatus = a, !this.isOpen) return;
3113
+ this.close(), this.emit("trial_blocked", a);
1785
3114
  return;
1786
3115
  }
1787
3116
  this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired"));
@@ -1815,53 +3144,66 @@ let tt = class {
1815
3144
  return;
1816
3145
  }
1817
3146
  const s = this.ensureTrialStore(i);
1818
- s.check().then(async (l) => {
1819
- if (this.lastTrialStatus = l, l.mode === "none") {
3147
+ s.check().then(async (a) => {
3148
+ if (this.lastTrialStatus = a, a.mode === "none") {
1820
3149
  this.mountAndShow(e, { renew: n });
1821
3150
  return;
1822
3151
  }
1823
- if (l.blocked) {
1824
- const a = await s.recordBlock();
1825
- this.lastTrialStatus = a, this.emit("trial_blocked", a);
3152
+ if (a.blocked) {
3153
+ const l = await s.recordBlock();
3154
+ this.lastTrialStatus = l, this.emit("trial_blocked", l);
1826
3155
  return;
1827
3156
  }
1828
3157
  this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), this.mountAndShow(e, { renew: n });
1829
- }).catch((l) => {
1830
- typeof console < "u" && console.warn("[paywall] trial check failed", l), this.mountAndShow(e, { renew: n });
3158
+ }).catch((a) => {
3159
+ typeof console < "u" && console.warn("[paywall] trial check failed", a), this.mountAndShow(e, { renew: n });
1831
3160
  });
1832
3161
  }
1833
3162
  ensureTrialStore(e) {
1834
- if (this.trialStore && this.trialStoreConfig && ot(this.trialStoreConfig, e))
3163
+ if (this.trialStore && this.trialStoreConfig && vr(this.trialStoreConfig, e))
1835
3164
  return this.trialStore;
1836
3165
  this.trialStoreConfig = e;
1837
3166
  const t = this.billing.createTrialStore;
1838
- return this.trialStore = typeof t == "function" ? t.call(this.billing, e) : ue(this.billing.getStorage(), this.billing.paywallId, e), this.trialStore;
3167
+ return this.trialStore = typeof t == "function" ? t.call(this.billing, e) : qe(this.billing.getStorage(), this.billing.paywallId, e), this.trialStore;
1839
3168
  }
1840
3169
  mountAndShow(e, t = {}) {
1841
- const n = t.renew === !0;
3170
+ const n = t.renew === !0, i = t.authMode, a = e === "auth" || e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutPriceId ?? null : null, l = e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutUrl ?? null : null;
1842
3171
  if (this.handle) {
1843
- this.isOpen = !0, this.handle.update({ open: !0, initialView: e, purchased: !1, renew: n }), this.emit("open");
3172
+ this.isOpen = !0, this.handle.update({
3173
+ open: !0,
3174
+ initialView: e,
3175
+ initialAuthMode: i,
3176
+ initialCheckoutPriceId: a,
3177
+ initialCheckoutUrl: l,
3178
+ purchased: !1,
3179
+ renew: n
3180
+ }), this.emit("open");
1844
3181
  return;
1845
3182
  }
1846
- this.isOpen = !0, this.handle = me(
1847
- Ze,
3183
+ this.isOpen = !0, this.handle = tt(
3184
+ lr,
1848
3185
  {
1849
3186
  client: this.billing,
1850
3187
  open: !0,
1851
3188
  initialView: e,
3189
+ initialAuthMode: i,
3190
+ initialCheckoutPriceId: a,
3191
+ initialCheckoutUrl: l,
1852
3192
  purchased: !1,
1853
3193
  renew: n,
1854
3194
  onClose: () => this.close(),
1855
- onEvent: (i, s) => {
1856
- this.emit(i, s), i === "checkout_started" && this.startUserWatcher();
3195
+ onEvent: (c, h) => {
3196
+ this.emit(c, h), c === "checkout_started" && this.startUserWatcher();
1857
3197
  },
1858
- onState: (i) => this.applyState(i)
3198
+ onState: (c) => this.applyState(c),
3199
+ inline: this.inline,
3200
+ locale: this.forceLocale
1859
3201
  },
1860
- { host: this.host, shadowMode: this.shadowMode }
3202
+ { host: this.host, shadowMode: this.shadowMode, inline: this.inline }
1861
3203
  ), this.emit("open");
1862
3204
  }
1863
3205
  applyState(e) {
1864
- if (!it(this.currentState, e)) {
3206
+ if (!kr(this.currentState, e)) {
1865
3207
  this.currentState = e;
1866
3208
  for (const t of this.stateListeners)
1867
3209
  try {
@@ -1939,6 +3281,36 @@ let tt = class {
1939
3281
  getCachedPrices() {
1940
3282
  return this.billing.getCachedPrices();
1941
3283
  }
3284
+ /** Sync-снимок офферов. null = bootstrap не загружали, [] = пейвол без офферов.
3285
+ * Бэк уже применил серверный targeting (страны/email/режим) — наружу
3286
+ * выезжает только то, что применимо к текущему юзеру. */
3287
+ getCachedOffers() {
3288
+ return this.billing.getCachedOffers();
3289
+ }
3290
+ /**
3291
+ * Резолвит активный offer для конкретной цены: price_id-таргетинг +
3292
+ * countdown (`expires_at` ИЛИ `duration_minutes` от первого открытия
3293
+ * пейвола, см. clientStorage `pw-offer-{id}-start`).
3294
+ *
3295
+ * Read-only — НЕ записывает start для `duration_minutes`-офферов. Запись
3296
+ * стартует только когда модалка реально открыта (renderer'ом). До этого
3297
+ * `getOfferForPrice` вернёт `null` для duration-only офферов, чтобы
3298
+ * страницы-хосты вне модалки (pricing, landing) не активировали countdown
3299
+ * раньше времени.
3300
+ *
3301
+ * Хост-странице нужен countdown, который тикает каждую секунду — для
3302
+ * этого использовать React-хук `usePaywallOffer(priceId)` из sdk-react
3303
+ * либо обёртку поверх `setInterval(1000)` + повторный вызов этого метода.
3304
+ */
3305
+ getOfferForPrice(e) {
3306
+ const t = this.billing.getCachedOffers();
3307
+ if (!t) return null;
3308
+ const n = N(t, e);
3309
+ return n ? Ke(n, {
3310
+ now: Date.now(),
3311
+ readStart: Qe
3312
+ }) : null;
3313
+ }
1942
3314
  /** Снимок текущего «языка юзера» — proxy над `billing.getUserLanguage()`.
1943
3315
  * Используй, чтобы синхронизировать i18n host'а с тем, что фактически
1944
3316
  * показывает пейвол. См. подробности в `BillingClient.getUserLanguage`. */
@@ -1972,22 +3344,22 @@ let tt = class {
1972
3344
  try {
1973
3345
  t = await this.billing.bootstrap({ signal: e.signal });
1974
3346
  } catch {
1975
- const l = this.billing.getCachedUser();
1976
- return l?.has_active_subscription ? {
3347
+ const a = this.billing.getCachedUser();
3348
+ return a?.has_active_subscription ? {
1977
3349
  access: "granted",
1978
3350
  reason: "has_subscription",
1979
3351
  visibility: null,
1980
3352
  trial: null,
1981
- user: l
3353
+ user: a
1982
3354
  } : {
1983
3355
  access: "blocked",
1984
3356
  reason: "no_subscription",
1985
3357
  visibility: null,
1986
3358
  trial: null,
1987
- user: l
3359
+ user: a
1988
3360
  };
1989
3361
  }
1990
- const n = t.user ?? null;
3362
+ const n = this.billing.getCachedUser() ?? t.user ?? null;
1991
3363
  if (n?.has_active_subscription)
1992
3364
  return {
1993
3365
  access: "granted",
@@ -1998,19 +3370,19 @@ let tt = class {
1998
3370
  };
1999
3371
  let i = null;
2000
3372
  if (!e.skipVisibility) {
2001
- const l = t.settings.visibility;
2002
- if (l && (i = l, this.lastVisibility = l, !l.visible))
3373
+ const a = t.settings.visibility;
3374
+ if (a && (i = a, this.lastVisibility = a, !a.visible))
2003
3375
  return { access: "granted", reason: "visibility_blocked", visibility: i, trial: null, user: n };
2004
3376
  }
2005
3377
  let s = null;
2006
3378
  if (!e.skipTrial) {
2007
- const l = t.settings.trial;
2008
- if (l)
3379
+ const a = t.settings.trial;
3380
+ if (a)
2009
3381
  try {
2010
- if (s = await this.ensureTrialStore(l).check(), this.lastTrialStatus = s, s.blocked)
3382
+ if (s = await this.ensureTrialStore(a).check(), this.lastTrialStatus = s, s.blocked)
2011
3383
  return { access: "granted", reason: "trial_blocked", visibility: i, trial: s, user: n };
2012
- } catch (a) {
2013
- typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", a);
3384
+ } catch (l) {
3385
+ typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", l);
2014
3386
  }
2015
3387
  }
2016
3388
  return { access: "blocked", reason: "no_subscription", visibility: i, trial: s, user: n };
@@ -2027,7 +3399,7 @@ let tt = class {
2027
3399
  // В extension popup runtime — no-op (popup не доживёт). Там полагаемся на
2028
3400
  // bootstrap при следующем открытии.
2029
3401
  startUserWatcher() {
2030
- this.watcher || et() && (this.watcher = new Qe({
3402
+ this.watcher || yr() && (this.watcher = new mr({
2031
3403
  client: this.billing,
2032
3404
  onActive: (e) => {
2033
3405
  this.watcher = null, this.emit("purchase_completed", { priceId: null, sessionId: null });
@@ -2046,7 +3418,7 @@ let tt = class {
2046
3418
  }), this.watcher.start());
2047
3419
  }
2048
3420
  close() {
2049
- !this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(N), this.emit("close"));
3421
+ !this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(se), this.emit("close"));
2050
3422
  }
2051
3423
  /**
2052
3424
  * Сканирует текущий URL на маркеры возврата с checkout и эмитит
@@ -2056,23 +3428,23 @@ let tt = class {
2056
3428
  */
2057
3429
  checkReturn() {
2058
3430
  if (typeof window > "u") return;
2059
- const e = new URL(window.location.href), t = re(e.hash.replace(/^#/, "")), n = re(e.search.replace(/^\?/, "")), i = t ?? n;
3431
+ const e = new URL(window.location.href), t = _e(e.hash.replace(/^#/, "")), n = _e(e.search.replace(/^\?/, "")), i = t ?? n;
2060
3432
  i && (i.status === "paid" ? (this.emit("purchase_completed", {
2061
3433
  priceId: i.priceId,
2062
3434
  sessionId: i.sessionId
2063
- }), st(i)) : (i.status === "failed" || i.status === "cancelled") && this.emit("purchase_failed", { reason: i.status }), lt(e));
3435
+ }), _r(i)) : (i.status === "failed" || i.status === "cancelled") && this.emit("purchase_failed", { reason: i.status }), Sr(e));
2064
3436
  }
2065
3437
  destroy() {
2066
- 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 = N;
3438
+ this.tracker?.destroy(), this.tracker = null, this.listeners.clear(), this.stateListeners.clear(), this.watcher?.stop(), this.watcher = null, this.userUnsub?.(), this.userUnsub = null, this.authUnsub?.(), this.authUnsub = null, this.ownsAuth && this.auth && this.auth.destroy?.(), this.ownsAuth = !1, this.billing.destroy?.(), this.handle?.unmount(), this.handle = null, this.isOpen = !1, this.currentState = se;
2067
3439
  }
2068
3440
  };
2069
- function rt(r) {
3441
+ function xr(r) {
2070
3442
  if (!r.auth) return { auth: void 0, ownsAuth: !1 };
2071
- if (r.auth instanceof H || nt(r.auth))
3443
+ if (r.auth instanceof ue || wr(r.auth))
2072
3444
  return { auth: r.auth, ownsAuth: !1 };
2073
3445
  const e = r.auth === !0 ? {} : r.auth;
2074
3446
  return {
2075
- auth: new H({
3447
+ auth: new ue({
2076
3448
  paywallId: r.paywallId,
2077
3449
  apiOrigin: e.apiOrigin ?? r.apiOrigin,
2078
3450
  storage: e.storage ?? r.storage,
@@ -2082,27 +3454,27 @@ function rt(r) {
2082
3454
  ownsAuth: !0
2083
3455
  };
2084
3456
  }
2085
- function nt(r) {
3457
+ function wr(r) {
2086
3458
  if (typeof r != "object" || r === null) return !1;
2087
3459
  const e = r;
2088
3460
  return typeof e.onAuthChange == "function" && typeof e.getCachedSession == "function" && typeof e.signOut == "function";
2089
3461
  }
2090
- function it(r, e) {
2091
- return r.open === e.open && r.view === e.view && r.error === e.error;
3462
+ function kr(r, e) {
3463
+ return r.open === e.open && r.view === e.view && r.error === e.error && r.processing === e.processing;
2092
3464
  }
2093
- function ot(r, e) {
3465
+ function vr(r, e) {
2094
3466
  return r.mode === e.mode && r.payload === e.payload && r.storage === e.storage;
2095
3467
  }
2096
- function re(r) {
3468
+ function _e(r) {
2097
3469
  if (!r) return null;
2098
- const e = new URLSearchParams(r), t = e.get(E.status);
3470
+ const e = new URLSearchParams(r), t = e.get(F.status);
2099
3471
  return t ? {
2100
3472
  status: t,
2101
- priceId: e.get(E.priceId),
2102
- sessionId: e.get(E.sessionId)
3473
+ priceId: e.get(F.priceId),
3474
+ sessionId: e.get(F.sessionId)
2103
3475
  } : null;
2104
3476
  }
2105
- function st(r) {
3477
+ function _r(r) {
2106
3478
  if (!(typeof window > "u" || !window.opener))
2107
3479
  try {
2108
3480
  window.opener.postMessage(
@@ -2117,17 +3489,17 @@ function st(r) {
2117
3489
  } catch {
2118
3490
  }
2119
3491
  }
2120
- function lt(r) {
3492
+ function Sr(r) {
2121
3493
  const e = (n, i) => {
2122
3494
  if (!n) return "";
2123
3495
  const s = new URLSearchParams(n.replace(/^[?#]/, ""));
2124
- s.delete(E.status), s.delete(E.priceId), s.delete(E.sessionId);
2125
- const l = s.toString();
2126
- return l ? i + l : "";
3496
+ s.delete(F.status), s.delete(F.priceId), s.delete(F.sessionId);
3497
+ const a = s.toString();
3498
+ return a ? i + a : "";
2127
3499
  }, t = r.pathname + e(r.search, "?") + e(r.hash, "#");
2128
3500
  window.history.replaceState(null, "", t);
2129
3501
  }
2130
- class at {
3502
+ class Cr {
2131
3503
  constructor(e, t, n) {
2132
3504
  this.transport = e, this.paywallId = t, this.config = n;
2133
3505
  }
@@ -2150,9 +3522,9 @@ class at {
2150
3522
  });
2151
3523
  }
2152
3524
  }
2153
- class ct {
3525
+ class Ir {
2154
3526
  constructor(e, t) {
2155
- this.transport = e, this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null, this.userListeners = /* @__PURE__ */ new Set(), this.balanceListeners = /* @__PURE__ */ new Set(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.remoteStorageAdapter = {
3527
+ this.transport = e, this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null, this.userListeners = /* @__PURE__ */ new Set(), this.balanceListeners = /* @__PURE__ */ new Set(), this.bootstrapListeners = /* @__PURE__ */ new Set(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.remoteStorageAdapter = {
2156
3528
  getItem: (n) => this.transport.request("storage.get", { key: n }),
2157
3529
  setItem: async (n, i) => {
2158
3530
  await this.transport.request("storage.set", { key: n, value: i });
@@ -2176,11 +3548,39 @@ class ct {
2176
3548
  { force: e.force },
2177
3549
  { signal: e.signal }
2178
3550
  );
2179
- return this.cachedBootstrap = t, t.user && this.applyUser(t.user), t;
3551
+ return this.applyBootstrap(t), t.user && this.applyUser(t.user), t;
2180
3552
  }
2181
3553
  getCachedBootstrap() {
2182
3554
  return this.cachedBootstrap;
2183
3555
  }
3556
+ /** Подписка на bootstrap-state. Структурно совместима с
3557
+ * `BillingClient.onBootstrapChange` — те же микротаск-семантики для initial
3558
+ * snapshot. В extension-режиме offscreen пока не broadcast'ит bootstrapChange,
3559
+ * поэтому listener срабатывает только на self-инициированные `bootstrap()`
3560
+ * внутри этого RemoteBillingClient'а (popup перезапрашивает bootstrap → mirror
3561
+ * обновляется → listener вызывается). Cross-surface revalidate (другая вкладка
3562
+ * обновила bootstrap) не доезжает до popup'а — для этого нужен отдельный
3563
+ * bootstrapChange-broadcast в protocol.ts/server.ts. */
3564
+ onBootstrapChange(e, t = {}) {
3565
+ this.bootstrapListeners.add(e);
3566
+ const n = t.immediate ?? "microtask";
3567
+ if (this.cachedBootstrap && n !== "none") {
3568
+ const i = this.cachedBootstrap;
3569
+ if (n === "sync")
3570
+ try {
3571
+ e(i);
3572
+ } catch (s) {
3573
+ console.warn("[paywall] onBootstrapChange initial sync threw", s);
3574
+ }
3575
+ else
3576
+ queueMicrotask(() => {
3577
+ this.bootstrapListeners.has(e) && e(i);
3578
+ });
3579
+ }
3580
+ return () => {
3581
+ this.bootstrapListeners.delete(e);
3582
+ };
3583
+ }
2184
3584
  /** Шорткат над `bootstrap()` — возвращает цены пейвола (locale-оверрайды
2185
3585
  * уже применены в offscreen'е). Те же кэш-семантики, что у `bootstrap()`. */
2186
3586
  async getPrices(e = {}) {
@@ -2190,6 +3590,12 @@ class ct {
2190
3590
  getCachedPrices() {
2191
3591
  return this.cachedBootstrap?.prices ?? null;
2192
3592
  }
3593
+ /** Sync-снимок офферов. null = bootstrap не загружали, [] = пейвол без офферов.
3594
+ * Серверный таргетинг (страны/email/режим) уже применён бэком — наружу
3595
+ * выезжает только то, что применимо к текущему юзеру. */
3596
+ getCachedOffers() {
3597
+ return this.cachedBootstrap?.offers ?? null;
3598
+ }
2193
3599
  // === Visitor ===
2194
3600
  async getVisitorId() {
2195
3601
  return this.transport.request("billing.getVisitorId", void 0);
@@ -2276,6 +3682,13 @@ class ct {
2276
3682
  signal: e.signal
2277
3683
  })];
2278
3684
  }
3685
+ /** Саппорт-тикет через offscreen'овский BillingClient. File-объекты
3686
+ * переживают chrome.runtime structured-clone (port forward'ит as-is) —
3687
+ * Bearer-токен/email-substitution делает offscreen, как в обычном
3688
+ * BillingClient. */
3689
+ async createSupportTicket(e) {
3690
+ return this.transport.request("billing.createSupportTicket", e);
3691
+ }
2279
3692
  /** Отменить подписку через бэк. По умолчанию cancel в конце текущего
2280
3693
  * периода (юзер сохраняет access до renewal date'ы). reason обязательна
2281
3694
  * (валидируется бэком) — собирается через select причин в host-UI. */
@@ -2296,7 +3709,7 @@ class ct {
2296
3709
  * read-modify-write. PaywallUI duck-types этот метод и предпочитает его
2297
3710
  * локальной фабрике, если он есть. */
2298
3711
  createTrialStore(e) {
2299
- return new at(this.transport, this.paywallId, e);
3712
+ return new Cr(this.transport, this.paywallId, e);
2300
3713
  }
2301
3714
  // === Identity ===
2302
3715
  getIdentity() {
@@ -2313,17 +3726,26 @@ class ct {
2313
3726
  return this.identity = e, e;
2314
3727
  }
2315
3728
  destroy() {
2316
- 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;
3729
+ this.unsubUserBroadcast?.(), this.unsubBalancesBroadcast?.(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.userListeners.clear(), this.balanceListeners.clear(), this.bootstrapListeners.clear(), this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null;
3730
+ }
3731
+ applyBootstrap(e) {
3732
+ this.cachedBootstrap = e;
3733
+ for (const t of [...this.bootstrapListeners])
3734
+ try {
3735
+ t(e);
3736
+ } catch (n) {
3737
+ console.warn("[paywall] onBootstrapChange listener threw", n);
3738
+ }
2317
3739
  }
2318
3740
  /** Обновить mirror user'а и эмитнуть listener'ам если он реально изменился.
2319
3741
  * Используется и для self-инициированных RPC (bootstrap/getUser), и для
2320
3742
  * broadcast'ов от offscreen — чтобы host'овский onUserChange handler
2321
3743
  * получил signal независимо от того, кто триггернул обновление. */
2322
3744
  applyUser(e) {
2323
- ut(this.cachedUser, e) || (this.cachedUser = e, this.fireUserListeners(e));
3745
+ Ar(this.cachedUser, e) || (this.cachedUser = e, this.fireUserListeners(e));
2324
3746
  }
2325
3747
  applyBalances(e) {
2326
- ht(this.cachedBalances, e) || (this.cachedBalances = e, this.fireBalanceListeners(e));
3748
+ Lr(this.cachedBalances, e) || (this.cachedBalances = e, this.fireBalanceListeners(e));
2327
3749
  }
2328
3750
  fireUserListeners(e) {
2329
3751
  for (const t of [...this.userListeners])
@@ -2342,22 +3764,22 @@ class ct {
2342
3764
  }
2343
3765
  }
2344
3766
  }
2345
- function ut(r, e) {
3767
+ function Ar(r, e) {
2346
3768
  return r === e ? !0 : !r || !e ? !1 : r.has_active_subscription === e.has_active_subscription && (r.purchases?.length ?? 0) === (e.purchases?.length ?? 0);
2347
3769
  }
2348
- function ht(r, e) {
3770
+ function Lr(r, e) {
2349
3771
  if (r === e) return !0;
2350
3772
  if (!r || !e || r.length !== e.length) return !1;
2351
3773
  for (let t = 0; t < r.length; t++)
2352
3774
  if (r[t].type !== e[t].type || r[t].count !== e[t].count) return !1;
2353
3775
  return !0;
2354
3776
  }
2355
- class dt {
3777
+ class Mr {
2356
3778
  constructor(e, t) {
2357
- this.transport = e, this.session = null, this.listeners = /* @__PURE__ */ new Set(), this.unsubBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.unsubBroadcast = this.transport.on("authChange", (n) => {
2358
- this.applySession(n);
3779
+ this.transport = e, this.session = null, this.listeners = /* @__PURE__ */ new Set(), this.unsubBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.unsubBroadcast = this.transport.on("authChange", ({ event: n, session: i }) => {
3780
+ this.applySession(n, i);
2359
3781
  }), this.hydrated = this.transport.request("auth.getCachedSession", void 0).then((n) => {
2360
- this.session === null && n !== null && this.applySession(n);
3782
+ this.session === null && n !== null && (this.session = n);
2361
3783
  }).catch(() => {
2362
3784
  });
2363
3785
  }
@@ -2373,31 +3795,32 @@ class dt {
2373
3795
  return this.session?.user ?? null;
2374
3796
  }
2375
3797
  onAuthChange(e) {
2376
- if (this.listeners.add(e), this.session) {
2377
- const t = this.session;
2378
- queueMicrotask(() => {
2379
- this.listeners.has(e) && e(t);
2380
- });
2381
- }
2382
- return () => {
3798
+ return this.listeners.add(e), this.hydrated.then(() => {
3799
+ if (this.listeners.has(e))
3800
+ try {
3801
+ e("INITIAL_SESSION", this.session);
3802
+ } catch (t) {
3803
+ console.warn("[paywall] onAuthChange INITIAL_SESSION threw", t);
3804
+ }
3805
+ }), () => {
2383
3806
  this.listeners.delete(e);
2384
3807
  };
2385
3808
  }
2386
3809
  // === Email/password ===
2387
3810
  async signInWithEmail(e) {
2388
3811
  const t = await this.transport.request("auth.signInWithEmail", e);
2389
- return this.applySession(t), t;
3812
+ return this.applySession("SIGNED_IN", t), t;
2390
3813
  }
2391
3814
  async signUp(e) {
2392
3815
  const t = await this.transport.request("auth.signUp", e);
2393
- return t.kind === "signed_in" && this.applySession(t.session), t;
3816
+ return t.kind === "signed_in" && this.applySession("SIGNED_IN", t.session), t;
2394
3817
  }
2395
3818
  async signOut() {
2396
3819
  await this.transport.request("auth.signOut", void 0);
2397
3820
  }
2398
3821
  async refresh() {
2399
3822
  const e = await this.transport.request("auth.refresh", void 0);
2400
- return this.applySession(e), e;
3823
+ return this.applySession(e ? "TOKEN_REFRESHED" : "SIGNED_OUT", e), e;
2401
3824
  }
2402
3825
  // === OTP / password reset / confirmation ===
2403
3826
  async sendOtp(e) {
@@ -2405,7 +3828,7 @@ class dt {
2405
3828
  }
2406
3829
  async verifyOtp(e) {
2407
3830
  const t = await this.transport.request("auth.verifyOtp", e);
2408
- return this.applySession(t), t;
3831
+ return this.applySession(e.type === "recovery" ? "PASSWORD_RECOVERY" : "SIGNED_IN", t), t;
2409
3832
  }
2410
3833
  async resendConfirmation(e) {
2411
3834
  await this.transport.request("auth.resendConfirmation", e);
@@ -2419,18 +3842,24 @@ class dt {
2419
3842
  async revokeAllSessions() {
2420
3843
  await this.transport.request("auth.revokeAllSessions", void 0);
2421
3844
  }
3845
+ /** Last-used auth method + email — читается из offscreen-storage. AuthPanel
3846
+ * использует для "Last used"-бейджа и pre-fill'а email. Storage paywall-
3847
+ * scoped, и offscreen — единый источник правды для всех вкладок/popup'ов. */
3848
+ async getLastLogin() {
3849
+ return this.transport.request("auth.getLastLogin", void 0);
3850
+ }
2422
3851
  // === Anonymous sign-in ===
2423
3852
  /** Анонимный sign-in (Supabase user без email). Логика (idempotent-check +
2424
3853
  * resume через сохранённый refresh_token + fresh signin) живёт в
2425
3854
  * offscreen-AuthClient'е — content только проксирует. captchaToken и
2426
- * forceCaptcha — pass-through для forward-compat / switch-account flow. */
3855
+ * forceNewAnon — pass-through для forward-compat / switch-account flow. */
2427
3856
  async signInAnonymously(e = {}) {
2428
3857
  const t = await this.transport.request("auth.signInAnonymously", {
2429
3858
  captchaToken: e.captchaToken,
2430
3859
  userMeta: e.userMeta,
2431
- forceCaptcha: e.forceCaptcha
3860
+ forceNewAnon: e.forceNewAnon
2432
3861
  });
2433
- return this.applySession(t), t;
3862
+ return this.applySession("SIGNED_IN", t), t;
2434
3863
  }
2435
3864
  /** Текущий access token (lazy-refreshable в offscreen'е). content/popup
2436
3865
  * использует для Bearer'а в внешние fetch'и — ApiGatewayClient в
@@ -2456,14 +3885,14 @@ class dt {
2456
3885
  */
2457
3886
  async signInWithOAuth(e) {
2458
3887
  if (typeof window > "u")
2459
- throw new T("oauth_unavailable", "window is required for OAuth");
3888
+ throw new L("oauth_unavailable", "window is required for OAuth");
2460
3889
  const t = `pw-oauth-pending-${Math.random().toString(36).slice(2, 10)}`, n = window.open("about:blank", t, "width=480,height=640,popup=yes");
2461
3890
  if (!n)
2462
- throw new T(
3891
+ throw new L(
2463
3892
  "popup_blocked",
2464
3893
  "browser blocked auth popup — call from a user gesture"
2465
3894
  );
2466
- gt(n, e.provider);
3895
+ Br(n, e.provider);
2467
3896
  try {
2468
3897
  const { authorizeUrl: i, state: s } = await this.transport.request("auth.oauthStart", {
2469
3898
  provider: e.provider,
@@ -2471,8 +3900,8 @@ class dt {
2471
3900
  userMeta: e.userMeta
2472
3901
  });
2473
3902
  n.name = `pw-oauth-${s}`, n.location.replace(i), e.onPopupOpened?.();
2474
- const l = await he(n, s), a = await this.transport.request("auth.oauthExchange", { state: s, code: l });
2475
- return this.applySession(a), a;
3903
+ const a = await Ne(n, s), l = await this.transport.request("auth.oauthExchange", { state: s, code: a });
3904
+ return this.applySession("SIGNED_IN", l), l;
2476
3905
  } catch (i) {
2477
3906
  try {
2478
3907
  n.close();
@@ -2484,29 +3913,29 @@ class dt {
2484
3913
  destroy() {
2485
3914
  this.unsubBroadcast?.(), this.unsubBroadcast = null, this.listeners.clear(), this.session = null;
2486
3915
  }
2487
- applySession(e) {
2488
- if (!pt(this.session, e)) {
2489
- this.session = e;
2490
- for (const t of [...this.listeners])
3916
+ applySession(e, t) {
3917
+ if (!Er(this.session, t)) {
3918
+ this.session = t;
3919
+ for (const n of [...this.listeners])
2491
3920
  try {
2492
- t(e);
2493
- } catch (n) {
2494
- console.warn("[paywall] onAuthChange listener threw", n);
3921
+ n(e, t);
3922
+ } catch (i) {
3923
+ console.warn("[paywall] onAuthChange listener threw", i);
2495
3924
  }
2496
3925
  }
2497
3926
  }
2498
3927
  }
2499
- function pt(r, e) {
3928
+ function Er(r, e) {
2500
3929
  return r === e ? !0 : !r || !e ? !1 : r.access_token === e.access_token && r.refresh_token === e.refresh_token && r.expires_at === e.expires_at && r.user.id === e.user.id;
2501
3930
  }
2502
- const ft = {
3931
+ const Tr = {
2503
3932
  google: "Google",
2504
3933
  apple: "Apple",
2505
3934
  github: "GitHub",
2506
3935
  facebook: "Facebook"
2507
3936
  };
2508
- function gt(r, e) {
2509
- const t = ft[e] ?? e;
3937
+ function Br(r, e) {
3938
+ const t = Tr[e] ?? e;
2510
3939
  try {
2511
3940
  const n = r.document;
2512
3941
  n.title = `Sign in with ${t}`;
@@ -2514,14 +3943,14 @@ function gt(r, e) {
2514
3943
  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);
2515
3944
  const s = n.createElement("div");
2516
3945
  s.className = "pw-oauth-wrap";
2517
- const l = n.createElement("div");
2518
- l.className = "pw-oauth-spinner";
2519
3946
  const a = n.createElement("div");
2520
- a.className = "pw-oauth-label", a.textContent = `Connecting to ${t}…`, s.appendChild(l), s.appendChild(a), n.body.appendChild(s);
3947
+ a.className = "pw-oauth-spinner";
3948
+ const l = n.createElement("div");
3949
+ l.className = "pw-oauth-label", l.textContent = `Connecting to ${t}…`, s.appendChild(a), s.appendChild(l), n.body.appendChild(s);
2521
3950
  } catch {
2522
3951
  }
2523
3952
  }
2524
- class mt {
3953
+ class Pr {
2525
3954
  constructor(e) {
2526
3955
  this.transport = e;
2527
3956
  }
@@ -2533,7 +3962,7 @@ class mt {
2533
3962
  });
2534
3963
  }
2535
3964
  }
2536
- class yt {
3965
+ class Or {
2537
3966
  constructor(e) {
2538
3967
  this.factory = e, this.channel = null, this.channelDisposers = [], this.pending = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map(), this.destroyed = !1, this.nextId = 0, this.clientId = `c-${Math.random().toString(36).slice(2, 10)}`;
2539
3968
  }
@@ -2547,21 +3976,21 @@ class yt {
2547
3976
  this.channel = e;
2548
3977
  const t = e.onMessage((i) => this.handleMessage(i)), n = e.onDisconnect(() => this.handleDisconnect());
2549
3978
  return this.channelDisposers = [t, n], this.request("handshake", {
2550
- protocolVersion: R,
3979
+ protocolVersion: J,
2551
3980
  clientId: this.clientId
2552
3981
  }).then((i) => {
2553
- i.protocolVersion !== R && console.warn(
2554
- `[sdk-extension] protocol version mismatch: client=${R}, offscreen=${i.protocolVersion}. Update host's @monetize.software/sdk-extension.`
3982
+ i.protocolVersion !== J && console.warn(
3983
+ `[sdk-extension] protocol version mismatch: client=${J}, offscreen=${i.protocolVersion}. Update host's @monetize.software/sdk-extension.`
2555
3984
  );
2556
3985
  }).catch(() => {
2557
3986
  }), e;
2558
3987
  }
2559
3988
  handleMessage(e) {
2560
- if (bt(e)) {
3989
+ if (jr(e)) {
2561
3990
  if (e.type === "response") {
2562
3991
  const t = this.pending.get(e.id);
2563
3992
  if (!t) return;
2564
- this.pending.delete(e.id), t.signal?.removeEventListener("abort", t.abortListener), e.ok ? t.resolve(e.result) : t.reject(de(e.error));
3993
+ this.pending.delete(e.id), t.signal?.removeEventListener("abort", t.abortListener), e.ok ? t.resolve(e.result) : t.reject(Fe(e.error));
2565
3994
  return;
2566
3995
  }
2567
3996
  if (e.type === "event") {
@@ -2582,7 +4011,7 @@ class yt {
2582
4011
  const e = Array.from(this.pending.values());
2583
4012
  this.pending.clear();
2584
4013
  for (const t of e)
2585
- t.signal?.removeEventListener("abort", t.abortListener), t.reject(new xt());
4014
+ t.signal?.removeEventListener("abort", t.abortListener), t.reject(new Ur());
2586
4015
  }
2587
4016
  request(e, t, n = {}) {
2588
4017
  if (this.destroyed)
@@ -2590,31 +4019,31 @@ class yt {
2590
4019
  if (n.signal?.aborted)
2591
4020
  return Promise.reject(new DOMException("Aborted", "AbortError"));
2592
4021
  const i = this.ensureChannel(), s = `r${++this.nextId}`;
2593
- return new Promise((l, a) => {
4022
+ return new Promise((a, l) => {
2594
4023
  const c = {
2595
- resolve: l,
2596
- reject: a,
4024
+ resolve: a,
4025
+ reject: l,
2597
4026
  signal: n.signal
2598
4027
  };
2599
4028
  n.signal && (c.abortListener = () => {
2600
4029
  if (this.pending.delete(s)) {
2601
- a(new DOMException("Aborted", "AbortError"));
4030
+ l(new DOMException("Aborted", "AbortError"));
2602
4031
  try {
2603
4032
  i.send({ type: "cancel", id: s });
2604
4033
  } catch {
2605
4034
  }
2606
4035
  }
2607
4036
  }, n.signal.addEventListener("abort", c.abortListener)), this.pending.set(s, c);
2608
- const p = {
4037
+ const h = {
2609
4038
  type: "request",
2610
4039
  id: s,
2611
4040
  kind: e,
2612
4041
  params: t
2613
4042
  };
2614
4043
  try {
2615
- i.send(p);
2616
- } catch (g) {
2617
- this.pending.delete(s), n.signal?.removeEventListener("abort", c.abortListener), a(g);
4044
+ i.send(h);
4045
+ } catch (d) {
4046
+ this.pending.delete(s), n.signal?.removeEventListener("abort", c.abortListener), l(d);
2618
4047
  }
2619
4048
  });
2620
4049
  }
@@ -2638,28 +4067,28 @@ class yt {
2638
4067
  this.channel?.close(), this.channel = null;
2639
4068
  }
2640
4069
  }
2641
- class xt extends Error {
4070
+ class Ur extends Error {
2642
4071
  constructor() {
2643
4072
  super("Transport channel disconnected mid-request"), this.code = "transport_disconnected", this.name = "TransportDisconnectedError";
2644
4073
  }
2645
4074
  }
2646
- function bt(r) {
4075
+ function jr(r) {
2647
4076
  if (typeof r != "object" || r === null) return !1;
2648
4077
  const e = r.type;
2649
4078
  return e === "request" || e === "response" || e === "event";
2650
4079
  }
2651
- let q = null;
2652
- function kt() {
2653
- return q || (q = new yt(() => pe(fe)), q);
4080
+ let W = null;
4081
+ function Rr() {
4082
+ return W || (W = new Or(() => $e(Ze)), W);
2654
4083
  }
2655
- class Tt extends tt {
4084
+ class Hr extends br {
2656
4085
  constructor(e) {
2657
- const t = kt(), n = new ct(t, {
4086
+ const t = Rr(), n = new Ir(t, {
2658
4087
  paywallId: e.paywallId,
2659
4088
  apiOrigin: e.apiOrigin
2660
4089
  });
2661
4090
  let i;
2662
- e.auth === !0 ? i = new dt(t, {
4091
+ e.auth === !0 ? i = new Mr(t, {
2663
4092
  paywallId: e.paywallId,
2664
4093
  apiOrigin: e.apiOrigin
2665
4094
  }) : e.auth && console.warn(
@@ -2675,7 +4104,7 @@ class Tt extends tt {
2675
4104
  // Внутренний EventTracker отключаем — единственный tracker живёт в
2676
4105
  // offscreen'е. Манчиально подписываемся ниже.
2677
4106
  analytics: !1
2678
- }), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new mt(t), this.bindAnalytics());
4107
+ }), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new Pr(t), this.bindAnalytics());
2679
4108
  }
2680
4109
  /** Зеркало sdk/PaywallUI.initTracker'овских биндингов, но с RemoteEventTracker.
2681
4110
  * Когда @monetize.software/sdk экспоузнет публичный hook для inject'а tracker'а,
@@ -2733,11 +4162,11 @@ class Tt extends tt {
2733
4162
  }
2734
4163
  }
2735
4164
  export {
2736
- R as PROTOCOL_VERSION,
2737
- Tt as PaywallUI,
2738
- dt as RemoteAuthClient,
2739
- ct as RemoteBillingClient,
2740
- mt as RemoteEventTracker,
2741
- kt as getContentTransport
4165
+ J as PROTOCOL_VERSION,
4166
+ Hr as PaywallUI,
4167
+ Mr as RemoteAuthClient,
4168
+ Ir as RemoteBillingClient,
4169
+ Pr as RemoteEventTracker,
4170
+ Rr as getContentTransport
2742
4171
  };
2743
4172
  //# sourceMappingURL=content.js.map