@kyro-cms/core 0.12.70 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/README.md +6 -0
  2. package/dist/{WebhookService-CGNSlclW.d.ts → WebhookService-BLi5Rz2m.d.ts} +1 -1
  3. package/dist/{WebhookService-CIQPD1We.d.cts → WebhookService-BcuD8tnn.d.cts} +1 -1
  4. package/dist/WebhookService-D5PSI5t6.d.cts +143 -0
  5. package/dist/WebhookService-DPCCn_12.d.ts +143 -0
  6. package/dist/WebhookService-Dncnbgm9.d.cts +143 -0
  7. package/dist/WebhookService-UY5p89Bj.d.ts +143 -0
  8. package/dist/WebhookService-YZXBCRXA.d.ts +143 -0
  9. package/dist/WebhookService-zrDmAx7L.d.cts +143 -0
  10. package/dist/api-handler-graphql.cjs +1 -1
  11. package/dist/api-handler-graphql.js +1 -1
  12. package/dist/api-handler-trpc.cjs +1 -1
  13. package/dist/api-handler-trpc.js +1 -1
  14. package/dist/api-handler.cjs +1 -1
  15. package/dist/api-handler.js +1 -1
  16. package/dist/base-B--L0lCn.d.cts +218 -0
  17. package/dist/base-BVoDPNjJ.d.cts +218 -0
  18. package/dist/{types-CpjuXbe7.d.cts → base-CAb9EYQs.d.ts} +69 -1
  19. package/dist/base-CyG7aF1e.d.cts +218 -0
  20. package/dist/{types-CpjuXbe7.d.ts → base-DOImeJ-F.d.ts} +69 -1
  21. package/dist/base-DbnwE42-.d.cts +218 -0
  22. package/dist/base-NyiSsD-n.d.ts +218 -0
  23. package/dist/base-xflndGDO.d.ts +218 -0
  24. package/dist/bootstrap-E24SGUJP.cjs +1 -0
  25. package/dist/bootstrap-QQ6D3OYG.js +1 -0
  26. package/dist/bootstrap-QVKSKXJF.cjs +1 -0
  27. package/dist/bootstrap-RILR44UM.cjs +1 -0
  28. package/dist/{bootstrap-WB6FDH2T.js → bootstrap-YFVE7MRG.js} +1 -1
  29. package/dist/bootstrap-ZRRUPRUR.js +1 -0
  30. package/dist/chunk-262YP5XA.cjs +1 -0
  31. package/dist/chunk-2FSOHXOU.cjs +56 -0
  32. package/dist/chunk-2OS5Y4LE.cjs +1 -0
  33. package/dist/chunk-2PXXQKN3.cjs +3 -0
  34. package/dist/chunk-355R4LS5.cjs +56 -0
  35. package/dist/chunk-35IVNLMA.js +122 -0
  36. package/dist/{chunk-XVPTVTQC.js → chunk-3GXLOYM3.js} +2 -2
  37. package/dist/chunk-3KZXF4US.js +2 -0
  38. package/dist/{chunk-Z552BTXA.cjs → chunk-3LAWUINR.cjs} +1 -1
  39. package/dist/chunk-3O3AVMWM.cjs +1 -0
  40. package/dist/{chunk-637PTUHF.js → chunk-3TAUNYEM.js} +1 -1
  41. package/dist/chunk-3U6MKWET.cjs +120 -0
  42. package/dist/chunk-4BMWWGJN.js +384 -0
  43. package/dist/chunk-5A7E7N4B.cjs +431 -0
  44. package/dist/chunk-6DD4J7LI.js +2 -0
  45. package/dist/chunk-6GGPY7U2.js +4 -0
  46. package/dist/chunk-6MNLRAKM.cjs +121 -0
  47. package/dist/chunk-6NBZDW53.js +133 -0
  48. package/dist/chunk-73Y63IPP.js +57 -0
  49. package/dist/chunk-7K6ZUNJM.js +4 -0
  50. package/dist/chunk-7NKNSRCB.cjs +448 -0
  51. package/dist/{chunk-IL2TMAHB.cjs → chunk-A35ZP72D.cjs} +3 -3
  52. package/dist/chunk-A3IOQOV6.js +2 -0
  53. package/dist/chunk-A3XVL6ED.cjs +3 -0
  54. package/dist/{chunk-OBH6EEAO.cjs → chunk-APDQ6ZTG.cjs} +5 -5
  55. package/dist/chunk-ATI2UZ7U.js +2 -0
  56. package/dist/chunk-B4AC23SG.js +122 -0
  57. package/dist/chunk-BD6XHMMM.cjs +2 -0
  58. package/dist/chunk-CH4TZZI5.js +449 -0
  59. package/dist/{chunk-TBTQXIHP.js → chunk-CHYVUWZ3.js} +1 -1
  60. package/dist/{chunk-6USPOWA4.js → chunk-CNHUCCQJ.js} +10 -10
  61. package/dist/chunk-CRP6PSCE.js +2 -0
  62. package/dist/chunk-DI6TCZSE.js +122 -0
  63. package/dist/chunk-DORUYZQV.cjs +1 -0
  64. package/dist/chunk-EFKEVWAD.js +4 -0
  65. package/dist/chunk-EI7FRSNY.js +57 -0
  66. package/dist/chunk-EON4XLKQ.cjs +1 -0
  67. package/dist/chunk-EUQAOYEO.cjs +121 -0
  68. package/dist/chunk-EVAUBT7H.js +57 -0
  69. package/dist/chunk-EYHD7HZE.cjs +1 -0
  70. package/dist/chunk-EYYIPA5N.js +432 -0
  71. package/dist/chunk-F2O4QO5N.cjs +383 -0
  72. package/dist/chunk-FBWLSWZ4.js +122 -0
  73. package/dist/{chunk-3XLXKGEU.cjs → chunk-FG3IFGJP.cjs} +1 -1
  74. package/dist/chunk-FGN6IMPY.cjs +3 -0
  75. package/dist/chunk-FK2BG4HU.js +3 -0
  76. package/dist/{chunk-MVZSSTCV.js → chunk-FUFS65Q5.js} +2 -2
  77. package/dist/chunk-GWIZT2P5.js +57 -0
  78. package/dist/chunk-H3FJ54KB.cjs +121 -0
  79. package/dist/chunk-HY3EAWB2.js +4 -0
  80. package/dist/chunk-I6UJVO2P.js +57 -0
  81. package/dist/chunk-IQSF6XRV.js +57 -0
  82. package/dist/chunk-IXGDTAES.js +4 -0
  83. package/dist/chunk-JA44K75G.js +2 -0
  84. package/dist/chunk-K5XGP57D.cjs +19 -0
  85. package/dist/chunk-KEITOXIP.js +2 -0
  86. package/dist/chunk-LPFRMQFQ.js +121 -0
  87. package/dist/chunk-LYU44UNN.cjs +56 -0
  88. package/dist/chunk-MDLJTZLV.cjs +1 -0
  89. package/dist/chunk-MJAODEFC.cjs +121 -0
  90. package/dist/chunk-MYHNTJLR.cjs +56 -0
  91. package/dist/chunk-N2YHO2WI.cjs +3 -0
  92. package/dist/chunk-N4FXLQE3.cjs +132 -0
  93. package/dist/chunk-NPBXLPOP.js +3 -0
  94. package/dist/chunk-ON5XJEPO.cjs +3 -0
  95. package/dist/chunk-OT2Z4XBD.cjs +1 -0
  96. package/dist/chunk-PFTBTWSC.cjs +1 -0
  97. package/dist/chunk-PTPVFLET.js +20 -0
  98. package/dist/chunk-PZDLPRJF.js +4 -0
  99. package/dist/chunk-Q5TFO66G.cjs +1 -0
  100. package/dist/chunk-QUTYCUST.js +4 -0
  101. package/dist/chunk-REKKBAQX.cjs +56 -0
  102. package/dist/chunk-REQ622YC.js +3 -0
  103. package/dist/chunk-RTNQP6BV.js +2 -0
  104. package/dist/chunk-RUJW47ZJ.js +2 -0
  105. package/dist/{chunk-SOCBJPYB.cjs → chunk-RVBSJ4UQ.cjs} +1 -1
  106. package/dist/chunk-RXYCFZJC.cjs +121 -0
  107. package/dist/chunk-RYHOWZLK.js +2 -0
  108. package/dist/chunk-S2MZNEBQ.cjs +1 -0
  109. package/dist/chunk-S73YERS2.js +57 -0
  110. package/dist/chunk-SBNMXQNO.cjs +2 -0
  111. package/dist/chunk-T3DJ3UTP.cjs +121 -0
  112. package/dist/{chunk-ZQETJ4T4.cjs → chunk-TCFL3UWT.cjs} +1 -1
  113. package/dist/chunk-TJZO7ZSX.cjs +3 -0
  114. package/dist/chunk-TKUNRCRH.js +4 -0
  115. package/dist/chunk-TQLCOMKC.js +4 -0
  116. package/dist/chunk-TRXYDWGE.cjs +1 -0
  117. package/dist/chunk-TS55CUNJ.js +57 -0
  118. package/dist/chunk-UFBJ3WOZ.js +2 -0
  119. package/dist/chunk-UQRVQUVR.js +2 -0
  120. package/dist/chunk-UW5W35NP.js +122 -0
  121. package/dist/chunk-VI7WCO2J.cjs +3 -0
  122. package/dist/chunk-W2GPP6RB.js +122 -0
  123. package/dist/chunk-WHOA7YJU.cjs +1 -0
  124. package/dist/chunk-WNRUPL26.js +2 -0
  125. package/dist/chunk-WXT2XW7T.js +13 -0
  126. package/dist/chunk-XFYSADHV.cjs +2 -0
  127. package/dist/chunk-XIAJQLGS.js +2 -0
  128. package/dist/chunk-XK6UB77Q.js +4 -0
  129. package/dist/chunk-Y2VHO66Q.cjs +3 -0
  130. package/dist/chunk-Y5O2OD7J.cjs +3 -0
  131. package/dist/chunk-YARB43JG.cjs +56 -0
  132. package/dist/chunk-YLCEMVYY.cjs +56 -0
  133. package/dist/chunk-YSOM57GK.cjs +3 -0
  134. package/dist/chunk-Z3UVDGYS.cjs +56 -0
  135. package/dist/{chunk-4OMQURN7.js → chunk-ZAKYTBEN.js} +1 -1
  136. package/dist/chunk-ZTLGK6R4.cjs +12 -0
  137. package/dist/chunk-ZUBJ6RLQ.cjs +1 -0
  138. package/dist/cli/index.cjs +1 -1
  139. package/dist/cli/index.js +1 -1
  140. package/dist/client.cjs +109 -1
  141. package/dist/client.d.cts +1242 -6
  142. package/dist/client.d.ts +1242 -6
  143. package/dist/client.js +109 -2
  144. package/dist/drizzle/index.cjs +1 -1
  145. package/dist/drizzle/index.d.cts +3 -4
  146. package/dist/drizzle/index.d.ts +3 -4
  147. package/dist/drizzle/index.js +1 -1
  148. package/dist/fields/index.cjs +1 -1
  149. package/dist/fields/index.d.cts +2 -2
  150. package/dist/fields/index.d.ts +2 -2
  151. package/dist/fields/index.js +1 -1
  152. package/dist/graphql/index.d.cts +3 -3
  153. package/dist/graphql/index.d.ts +3 -3
  154. package/dist/{index-BHYGO3yF.d.cts → index-B9BFNOHd.d.cts} +2 -2
  155. package/dist/index-BMcYFpTv.d.cts +105 -0
  156. package/dist/{index-DTy4k1oU.d.ts → index-BttsFZDa.d.ts} +2 -2
  157. package/dist/index-CxA9uOv0.d.ts +105 -0
  158. package/dist/index-D6AXbuPI.d.ts +105 -0
  159. package/dist/index-DF0KDBaM.d.cts +105 -0
  160. package/dist/index-DG4Xu7gA.d.cts +105 -0
  161. package/dist/index-eHex8Iwj.d.ts +105 -0
  162. package/dist/index.cjs +43 -24
  163. package/dist/index.d.cts +167 -13
  164. package/dist/index.d.ts +167 -13
  165. package/dist/index.js +44 -25
  166. package/dist/lib-A2D63VXD.cjs +1 -0
  167. package/dist/lib-JQD2JAOO.js +2 -0
  168. package/dist/local-KR3AIGVA.cjs +1 -0
  169. package/dist/local-T7GISZBL.js +1 -0
  170. package/dist/mongo-auth-adapter-GR2CFFEA.js +1 -0
  171. package/dist/mongo-auth-adapter-UOO2LZUJ.cjs +1 -0
  172. package/dist/mongodb/index.cjs +1 -1
  173. package/dist/mongodb/index.d.cts +4 -4
  174. package/dist/mongodb/index.d.ts +4 -4
  175. package/dist/mongodb/index.js +1 -1
  176. package/dist/nodemailer-transport-3VWVUBM5.cjs +1 -0
  177. package/dist/nodemailer-transport-7RHATUKL.js +1 -0
  178. package/dist/nodemailer-transport-CHO2WKIY.js +1 -0
  179. package/dist/nodemailer-transport-ED2IXNGW.cjs +1 -0
  180. package/dist/postgres-auth-adapter-SK3N3OSS.js +1 -1
  181. package/dist/postgres-auth-adapter-ZO6HK5AK.cjs +1 -1
  182. package/dist/postgres-js-7YBZKGXG.cjs +1 -0
  183. package/dist/{postgres-js-WE3NBRFO.js → postgres-js-JLFIWOBH.js} +1 -1
  184. package/dist/rest/index.cjs +1 -1
  185. package/dist/rest/index.d.cts +4 -4
  186. package/dist/rest/index.d.ts +4 -4
  187. package/dist/rest/index.js +1 -1
  188. package/dist/templates/index.cjs +1 -1
  189. package/dist/templates/index.d.cts +2 -2
  190. package/dist/templates/index.d.ts +2 -2
  191. package/dist/templates/index.js +1 -1
  192. package/dist/trpc/index.cjs +1 -1
  193. package/dist/trpc/index.d.cts +3 -3
  194. package/dist/trpc/index.d.ts +3 -3
  195. package/dist/trpc/index.js +1 -1
  196. package/dist/types-B5Qz1svz.d.cts +822 -0
  197. package/dist/types-Bii0bhUV.d.cts +329 -0
  198. package/dist/types-Bii0bhUV.d.ts +329 -0
  199. package/dist/{types-CeAQSR87.d.cts → types-Bt2_ycUO.d.ts} +37 -2
  200. package/dist/types-C4wXHImf.d.ts +822 -0
  201. package/dist/types-DCWgPFmi.d.cts +822 -0
  202. package/dist/types-DROqAsr0.d.cts +330 -0
  203. package/dist/types-DROqAsr0.d.ts +330 -0
  204. package/dist/{types-BKPEavuy.d.cts → types-DlGSbh7I.d.cts} +1 -1
  205. package/dist/{types-BKPEavuy.d.ts → types-DlGSbh7I.d.ts} +1 -1
  206. package/dist/types-DsF64Wrc.d.cts +811 -0
  207. package/dist/{types-BWJx6zzm.d.ts → types-ZrjEVWfi.d.ts} +37 -2
  208. package/dist/types-dEy5JxvN.d.ts +822 -0
  209. package/dist/types-tVJc9YbX.d.cts +811 -0
  210. package/dist/ws/index.cjs +1 -1
  211. package/dist/ws/index.d.cts +121 -1
  212. package/dist/ws/index.d.ts +121 -1
  213. package/dist/ws/index.js +1 -1
  214. package/package.json +2 -2
  215. package/dist/base-Ds06wMo9.d.cts +0 -69
  216. package/dist/base-DxDXLyWe.d.ts +0 -69
  217. package/dist/bootstrap-XDT4MRML.cjs +0 -1
  218. package/dist/chunk-5M3FKE2V.js +0 -2
  219. package/dist/chunk-7FXEXHK6.js +0 -21
  220. package/dist/chunk-JSTDCK3Z.js +0 -2
  221. package/dist/chunk-JT36FTHY.cjs +0 -20
  222. package/dist/chunk-L2QXP26Q.js +0 -2
  223. package/dist/chunk-MRR7OTRX.js +0 -57
  224. package/dist/chunk-MVX2PYJJ.cjs +0 -1
  225. package/dist/chunk-MYGHZQMO.cjs +0 -1
  226. package/dist/chunk-OUAR4ZCU.cjs +0 -56
  227. package/dist/chunk-WCFHS7EZ.cjs +0 -1
  228. package/dist/index-D7kt5jT_.d.ts +0 -97
  229. package/dist/index-DPtCjn94.d.cts +0 -97
  230. package/dist/postgres-js-GXZX3AGZ.cjs +0 -1
  231. /package/dist/{chunk-XTTGHN3D.cjs → chunk-FLS2FJM6.cjs} +0 -0
  232. /package/dist/{chunk-KWGB3YNI.js → chunk-PFKVHUOT.js} +0 -0
@@ -0,0 +1,448 @@
1
+ 'use strict';var chunkHPYH7GTS_cjs=require('./chunk-HPYH7GTS.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function g(o){let{brand:e,title:t,badge:r,previewText:s=t,bodyHtml:i,ctaText:n,ctaUrl:a,secondaryCtaText:l,secondaryCtaUrl:p}=o,f=e?.siteName||"Lagos Buka",m=e?.logoUrl||"https://resources.lagosbukasantonio.com/lagosbuka.svg",u=e?.logoDarkUrl||e?.logoUrl||m,K=e?.appUrl||"https://lagosbukasantonio.com";return `<!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="color-scheme" content="light dark">
7
+ <meta name="supported-color-schemes" content="light dark">
8
+ <title>${t}</title>
9
+ <style>
10
+ :root {
11
+ color-scheme: light dark;
12
+ supported-color-schemes: light dark;
13
+ }
14
+ @media (prefers-color-scheme: dark) {
15
+ .email-body { background-color: #0c0c0e !important; color: #f4f4f5 !important; }
16
+ .email-card { background-color: #141417 !important; border-color: #27272a !important; }
17
+ .email-header { background-color: #18181b !important; border-color: #27272a !important; }
18
+ .email-brand-text { color: #f4f4f5 !important; }
19
+ .email-title { color: #ffffff !important; }
20
+ .email-text { color: #a1a1aa !important; }
21
+ .email-table { background-color: #18181b !important; border-color: #27272a !important; }
22
+ .email-btn-primary { background-color: #0b3b24 !important; color: #fffdf9 !important; }
23
+ .email-footer { background-color: #0c0c0e !important; border-color: #27272a !important; }
24
+ .email-footer-text { color: #71717a !important; }
25
+ .logo-light { display: none !important; }
26
+ .logo-dark { display: inline-block !important; }
27
+ }
28
+ </style>
29
+ </head>
30
+ <body class="email-body" style="margin: 0; padding: 32px 12px; background-color: #f8fafc; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; color: #1e293b; -webkit-font-smoothing: antialiased;">
31
+ <!-- Preview Text -->
32
+ <div style="display: none; max-height: 0; overflow: hidden;">${s}</div>
33
+
34
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-card" style="max-width: 520px; margin: 0 auto; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: 20px; overflow: hidden; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);">
35
+
36
+ <!-- Brand Logo & Site Name Header -->
37
+ <tr>
38
+ <td style="padding: 28px 32px 20px 32px; text-align: center;">
39
+ <table role="presentation" border="0" cellspacing="0" cellpadding="0" style="margin: 0 auto;">
40
+ <tr>
41
+ <td align="center" valign="middle">
42
+ <a href="${K}" target="_blank" style="text-decoration: none; display: inline-block;">
43
+ <!-- Brand Logo (preferable before site name) -->
44
+ ${`
45
+ <img src="${m}" alt="${f}" class="logo-light" height="34" style="display: block; margin: 0 auto 8px auto; max-height: 34px; border: 0;" />
46
+ <img src="${u}" alt="${f}" class="logo-dark" height="34" style="display: none; margin: 0 auto 8px auto; max-height: 34px; border: 0;" />
47
+ `}
48
+ <span class="email-brand-text" style="font-size: 15px; font-weight: 700; color: #0b3b24; letter-spacing: -0.2px; display: block;">
49
+ ${f}
50
+ </span>
51
+ </a>
52
+ </td>
53
+ </tr>
54
+ </table>
55
+
56
+ <!-- Action Header -->
57
+ <div style="margin-top: 16px;">
58
+ ${r?`
59
+ <span style="display: inline-block; background-color: #ecfdf5; color: #047857; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 9999px; margin-bottom: 8px;">
60
+ ${r}
61
+ </span>
62
+ `:""}
63
+ <h1 class="email-title" style="margin: 4px 0 0 0; font-size: 20px; font-weight: 700; color: #0f172a; letter-spacing: -0.3px;">
64
+ ${t}
65
+ </h1>
66
+ </div>
67
+ </td>
68
+ </tr>
69
+
70
+ <!-- Body Content -->
71
+ <tr>
72
+ <td style="padding: 4px 32px 28px 32px;">
73
+ ${i}
74
+
75
+ ${n&&a?`
76
+ <!-- Action Button -->
77
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top: 24px;">
78
+ <tr>
79
+ <td align="center">
80
+ <a href="${a}" target="_blank" class="email-btn-primary" style="display: inline-block; padding: 12px 24px; background-color: #0b3b24; color: #ffffff; font-size: 13px; font-weight: 600; text-decoration: none; border-radius: 12px; box-shadow: 0 2px 6px rgba(11, 59, 36, 0.15);">
81
+ ${n} &rarr;
82
+ </a>
83
+ ${l&&p?`
84
+ <a href="${p}" target="_blank" style="display: inline-block; padding: 12px 20px; margin-left: 8px; background-color: #f8fafc; border: 1px solid #e2e8f0; color: #334155; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 12px;">
85
+ ${l}
86
+ </a>
87
+ `:""}
88
+ </td>
89
+ </tr>
90
+ </table>
91
+ `:""}
92
+ </td>
93
+ </tr>
94
+
95
+ <!-- Clean Footer -->
96
+ <tr>
97
+ <td class="email-footer" style="padding: 20px 32px; border-top: 1px solid #f1f5f9; background-color: #fafafa; text-align: center;">
98
+ <p class="email-footer-text" style="margin: 0; font-size: 12px; color: #64748b; line-height: 1.5;">
99
+ ${e?.address?`${e.address} &middot; `:""}
100
+ <a href="${K}" target="_blank" style="color: #0b3b24; text-decoration: none; font-weight: 600;">${f}</a>
101
+ </p>
102
+ </td>
103
+ </tr>
104
+ </table>
105
+ </body>
106
+ </html>`}chunkBUNLC3II_cjs.h();function b(o,e="User",t){let r="Confirm your email address \u2014 Kyro CMS",s=`
107
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
108
+ Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
109
+ </p>
110
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
111
+ Thank you for registering. Please confirm your email address by clicking the verification button below to activate your account.
112
+ </p>
113
+
114
+ <!-- Verification Token Link Card -->
115
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
116
+ <tr>
117
+ <td style="font-size: 12px; color: #71717a; line-height: 1.5; word-break: break-all;">
118
+ <strong>Direct link:</strong><br />
119
+ <a href="${o}" style="color: #09090b; text-decoration: underline;" class="email-value">${o}</a>
120
+ </td>
121
+ </tr>
122
+ </table>
123
+
124
+ <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
125
+ This verification link will expire in 24 hours. If you did not create an account, you can safely ignore this email.
126
+ </p>
127
+ `,i=g({brand:t,title:"Confirm Your Email Address",previewText:"Please confirm your email address to activate your Kyro CMS account.",bodyHtml:s,ctaText:"Confirm Email Address",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome, ${e}!
128
+
129
+ Please verify your email address by visiting:
130
+ ${o}
131
+
132
+ This link expires in 24 hours.
133
+
134
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function x(o,e="User",t){let r="Reset your password \u2014 Kyro CMS",s=`
135
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
136
+ Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
137
+ </p>
138
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
139
+ We received a request to reset the password for your account. Click the button below to choose a new password.
140
+ </p>
141
+
142
+ <!-- Reset Link Box -->
143
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
144
+ <tr>
145
+ <td style="font-size: 12px; color: #71717a; line-height: 1.5; word-break: break-all;">
146
+ <strong>Reset URL:</strong><br />
147
+ <a href="${o}" style="color: #09090b; text-decoration: underline;" class="email-value">${o}</a>
148
+ </td>
149
+ </tr>
150
+ </table>
151
+
152
+ <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
153
+ For security reasons, this link will expire in 1 hour. If you did not request a password reset, no further action is required.
154
+ </p>
155
+ `,i=g({brand:t,title:"Reset Your Password",previewText:"Use this secure link to reset your Kyro CMS password.",bodyHtml:s,ctaText:"Reset Password",ctaUrl:o}),n=`Hello ${e},
156
+
157
+ Reset your password using the following link:
158
+ ${o}
159
+
160
+ This link will expire in 1 hour.
161
+
162
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function _(o="User",e="https://kyro-cms.com",t){let r="Welcome to Kyro CMS!",s=`
163
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
164
+ Welcome <strong class="email-strong" style="color: #09090b;">${o}</strong>,
165
+ </p>
166
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
167
+ Your Kyro CMS account is now set up and ready to go. You can access your admin dashboard, build content collections, and manage schema endpoints.
168
+ </p>
169
+
170
+ <!-- Key Capabilities List -->
171
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
172
+ <tr>
173
+ <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
174
+ \u{1F680} <strong>What you can do next:</strong>
175
+ <ul style="margin: 8px 0 0; padding-left: 20px; color: #52525b;">
176
+ <li>Define collections & custom field schemas in <code style="font-family: monospace;">kyro.config.ts</code></li>
177
+ <li>Explore auto-generated REST, GraphQL, tRPC & WebSocket endpoints</li>
178
+ <li>Customize your visual Admin dashboard & branding settings</li>
179
+ </ul>
180
+ </td>
181
+ </tr>
182
+ </table>
183
+ `,i=g({brand:t,title:"Welcome to Kyro CMS",previewText:"Your account is verified and ready. Start building content applications.",bodyHtml:s,ctaText:"Open Dashboard",ctaUrl:e,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome to Kyro CMS, ${o}!
184
+
185
+ Your account is active. Log in at ${e} to start building.
186
+
187
+ Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function w(o="User",e,t,r){let s="Security Alert: Password Changed \u2014 Kyro CMS",i=new Date().toUTCString(),n=`
188
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
189
+ Hello <strong class="email-strong" style="color: #09090b;">${o}</strong>,
190
+ </p>
191
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
192
+ This email confirms that the password for your Kyro CMS account was successfully updated on <strong>${i}</strong>.
193
+ </p>
194
+
195
+ <!-- Security Warning Card -->
196
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
197
+ <tr>
198
+ <td style="font-size: 13px; color: #991b1b; line-height: 1.5; text-align: center;">
199
+ \u26A0\uFE0F <strong>Did not request this change?</strong><br />
200
+ If you did not initiate this change, your account may be compromised. Reset your password immediately and contact an administrator.
201
+ </td>
202
+ </tr>
203
+ </table>
204
+
205
+ ${t||r?`
206
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #f4f4f5; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
207
+ <tr>
208
+ <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
209
+ <strong>Action IP:</strong> ${t||"Unknown"}<br />
210
+ <strong>Device:</strong> ${r||"Unknown"}
211
+ </td>
212
+ </tr>
213
+ </table>`:""}
214
+ `,a=g({brand:e,title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",bodyHtml:n,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: Your Kyro CMS password was updated at ${i}.
215
+
216
+ If you did not make this change, please reset your password immediately.
217
+
218
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}chunkBUNLC3II_cjs.h();function S(o,e,t="User",r){let s="Your one-time login link \u2014 Kyro CMS",i=`
219
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
220
+ Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
221
+ </p>
222
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
223
+ Click the button below to sign in to your Kyro CMS account without entering a password.
224
+ </p>
225
+
226
+ ${e?`
227
+ <!-- One-Time Passcode Box -->
228
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 16px; text-align: center;">
229
+ <tr>
230
+ <td style="font-size: 12px; color: #71717a; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;">
231
+ One-Time Passcode
232
+ </td>
233
+ </tr>
234
+ <tr>
235
+ <td style="font-size: 28px; font-weight: 800; font-family: monospace; color: #09090b; letter-spacing: 4px;" class="email-code-box">
236
+ ${e}
237
+ </td>
238
+ </tr>
239
+ </table>`:""}
240
+
241
+ <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
242
+ This single-use link will expire in 10 minutes. Never share authentication links with anyone.
243
+ </p>
244
+ `,n=g({brand:r,title:"Sign in to Kyro CMS",previewText:"Your secure magic login link for Kyro CMS.",bodyHtml:i,ctaText:"Sign In Now",ctaUrl:o}),a=`Hello ${t},
245
+
246
+ Sign in to Kyro CMS using the link below:
247
+ ${o}${e?`
248
+
249
+ Or enter code: ${e}`:""}
250
+
251
+ This link expires in 10 minutes.
252
+
253
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function C(o,e,t="User",r,s,i){let n="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",a=`
254
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
255
+ Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
256
+ </p>
257
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
258
+ Your Kyro CMS account was temporarily locked after <strong>${o} failed login attempts</strong>.
259
+ </p>
260
+
261
+ <!-- Lockout Notice Card -->
262
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
263
+ <tr>
264
+ <td style="font-size: 13px; color: #b45309; line-height: 1.5; text-align: center;">
265
+ \u{1F512} <strong>Lockout duration:</strong> ${e} minutes.<br />
266
+ You may try logging in again after the cooling-off period expires.
267
+ </td>
268
+ </tr>
269
+ </table>
270
+
271
+ ${s||i?`
272
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #f4f4f5; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
273
+ <tr>
274
+ <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
275
+ <strong>Failed Attempts IP:</strong> ${s||"Unknown"}<br />
276
+ <strong>Device:</strong> ${i||"Unknown"}
277
+ </td>
278
+ </tr>
279
+ </table>`:""}
280
+ `,l=g({brand:r,title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",bodyHtml:a,ctaText:"Unlock Instructions",ctaUrl:"https://kyro-cms.com/docs"}),p=`Security Alert: Account temporarily locked for ${t} after ${o} failed login attempts. Unlocks in ${e} minutes.
281
+
282
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:p}}chunkBUNLC3II_cjs.h();function T(o,e="Editor",t="An Administrator",r){let s="You're invited to join Kyro CMS",i=`
283
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
284
+ Hello,
285
+ </p>
286
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
287
+ <strong class="email-strong" style="color: #09090b;">${t}</strong> has invited you to join their team workspace as an <strong>${e}</strong> in Kyro CMS.
288
+ </p>
289
+
290
+ <!-- Invite Details Card -->
291
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
292
+ <tr>
293
+ <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
294
+ <strong>Assigned Role:</strong> ${e}<br />
295
+ <strong>Invited By:</strong> ${t}
296
+ </td>
297
+ </tr>
298
+ </table>
299
+ `,n=g({brand:r,title:"Workspace Invitation",previewText:`You have been invited to join Kyro CMS as an ${e}.`,bodyHtml:i,ctaText:"Accept Invitation",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),a=`You're invited to join Kyro CMS as an ${e} by ${t}.
300
+
301
+ Accept your invitation here:
302
+ ${o}
303
+
304
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function k(o,e,t="User",r,s="Unknown Device"){let i="Security Alert: New Sign-in to Kyro CMS",n=`
305
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
306
+ Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
307
+ </p>
308
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
309
+ A new sign-in to your Kyro CMS account was detected.
310
+ </p>
311
+
312
+ <!-- Sign-in Details -->
313
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #f4f4f5; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
314
+ <tr>
315
+ <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
316
+ <strong>Time:</strong> ${e}<br />
317
+ <strong>Location/IP:</strong> ${o}<br />
318
+ <strong>Device:</strong> ${s}
319
+ </td>
320
+ </tr>
321
+ </table>
322
+
323
+ <!-- Security Warning Card -->
324
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
325
+ <tr>
326
+ <td style="font-size: 13px; color: #991b1b; line-height: 1.5; text-align: center;">
327
+ \u26A0\uFE0F <strong>Don't recognize this activity?</strong><br />
328
+ If you did not sign in recently, your account may be compromised. Please reset your password immediately and contact an administrator.
329
+ </td>
330
+ </tr>
331
+ </table>
332
+ `,a=g({brand:r,title:"New Sign-in Detected",previewText:"A new sign-in was detected on your Kyro CMS account.",bodyHtml:n,ctaText:"Review Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: New Sign-in to Kyro CMS
333
+
334
+ Hello ${t},
335
+
336
+ A new sign-in to your account was detected at ${e} from ${o} using ${s}.
337
+
338
+ If you did not sign in recently, please reset your password immediately.
339
+
340
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function E(o,e="Customer",t,r,s){let i=`Order confirmed #${o}`,n=`
341
+ <p class="email-text" style="margin: 0 0 14px; font-size: 14px; line-height: 1.6; color: #475569; text-align: center;">
342
+ Hi ${e}, thanks for your order. We're getting your food freshly prepared.
343
+ </p>
344
+
345
+ <div style="background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px; margin: 18px 0;">
346
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0">
347
+ <tr>
348
+ <td style="font-size: 12px; color: #64748b; padding-bottom: 6px;">Order number</td>
349
+ <td style="font-size: 13px; font-weight: 600; color: #0f172a; text-align: right; padding-bottom: 6px;">#${o}</td>
350
+ </tr>
351
+ <tr>
352
+ <td style="font-size: 12px; color: #64748b; padding-bottom: 6px;">Status</td>
353
+ <td style="font-size: 12px; font-weight: 600; color: #047857; text-align: right; padding-bottom: 6px;">Processing in kitchen</td>
354
+ </tr>
355
+ <tr>
356
+ <td style="font-size: 13px; font-weight: 600; color: #0f172a; padding-top: 10px; border-top: 1px solid #e2e8f0;">Total paid</td>
357
+ <td style="font-size: 15px; font-weight: 700; color: #0b3b24; text-align: right; padding-top: 10px; border-top: 1px solid #e2e8f0;">${t.startsWith("$")?t:`$${t}`}</td>
358
+ </tr>
359
+ </table>
360
+ </div>
361
+
362
+ <p style="margin: 0; font-size: 12px; color: #94a3b8; text-align: center; line-height: 1.5;">
363
+ You can track the live preparation and delivery status anytime.
364
+ </p>
365
+ `,a=g({brand:s,title:"Order Confirmed",badge:"Order received",previewText:`Your order #${o} has been confirmed.`,bodyHtml:n,ctaText:"Track order live",ctaUrl:r||"https://lagosbukasantonio.com/track-order"}),l=`Hi ${e},
366
+
367
+ Thank you for your order #${o}!
368
+
369
+ Total: ${t}
370
+
371
+ Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function v(o,e="Customer",t,r,s){let i=`Your Order #${o} is on the way!`,n=`
372
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
373
+ Great news, <strong class="email-strong" style="color: #09090b;">${e}</strong>!
374
+ </p>
375
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
376
+ Your order <strong>#${o}</strong> has been shipped and is on its way to you.
377
+ </p>
378
+
379
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
380
+ <tr>
381
+ <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
382
+ \u{1F4E6} <strong>Tracking Number:</strong> ${t}
383
+ </td>
384
+ </tr>
385
+ </table>
386
+ `,a=g({brand:s,title:"Order Shipped",previewText:`Your order #${o} has shipped. Track your package now.`,bodyHtml:n,ctaText:"Track Package",ctaUrl:r}),l=`Hi ${e},
387
+
388
+ Your order #${o} has been shipped!
389
+
390
+ Tracking Number: ${t}
391
+ Track it here: ${r}`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function A(o,e="Customer",t,r){let s=`Your Order #${o} has been delivered`,i=`
392
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
393
+ Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
394
+ </p>
395
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
396
+ Good news! Your order <strong>#${o}</strong> has been successfully delivered. We hope you love it!
397
+ </p>
398
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
399
+ We'd love to hear your thoughts. If you have a minute, please leave a review for your items.
400
+ </p>
401
+ `,n=g({brand:r,title:"Order Delivered",previewText:`Your order #${o} has arrived!`,bodyHtml:i,ctaText:"Leave a Review",ctaUrl:t}),a=`Hi ${e},
402
+
403
+ Your order #${o} has been delivered!
404
+
405
+ Leave a review here: ${t}`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function R(o,e="Customer",t,r){let s=`Refund Processed for Order #${o}`,i=`
406
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
407
+ Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
408
+ </p>
409
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
410
+ We have processed a refund for your order <strong>#${o}</strong>. It may take 3-5 business days for the funds to appear on your original payment method.
411
+ </p>
412
+
413
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
414
+ <tr>
415
+ <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
416
+ \u{1F4B8} <strong>Refund Amount:</strong> ${t}
417
+ </td>
418
+ </tr>
419
+ </table>
420
+ `,n=g({brand:r,title:"Refund Processed",previewText:`We have processed a refund of ${t} for order #${o}.`,bodyHtml:i,ctaText:"View Store",ctaUrl:"https://kyro-cms.com"}),a=`Hi ${e},
421
+
422
+ We have processed a refund of ${t} for order #${o}.
423
+
424
+ View store: https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function I(o="Customer",e,t){let r="You left something behind...",s=`
425
+ <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
426
+ Hi <strong class="email-strong" style="color: #09090b;">${o}</strong>,
427
+ </p>
428
+ <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
429
+ We noticed you left some great items in your shopping cart. They are still waiting for you, but they might sell out soon!
430
+ </p>
431
+ `,i=g({brand:t,title:"Complete Your Purchase",previewText:"Your shopping cart is waiting for you. Complete your purchase now.",bodyHtml:s,ctaText:"Return to Checkout",ctaUrl:e}),n=`Hi ${o},
432
+
433
+ You left some items in your cart! Complete your purchase here: ${e}`;return {subject:r,html:i,text:n}}function $(o){return {verifyEmail:(e,t)=>b(e,t,o),resetPassword:(e,t)=>x(e,t,o),welcome:(e,t)=>_(e,t,o),passwordChanged:e=>w(e,o),magicLink:(e,t,r)=>S(e,t,r,o),accountLocked:(e,t,r)=>C(e,t,r,o),newLogin:(e,t,r)=>k(e,t,r,o),userInvite:(e,t,r)=>T(e,t,r,o),orderConfirmation:(e,t,r,s)=>E(e,t,r||"0.00",s,o),orderShipped:(e,t,r,s)=>v(e,t,r||"",s||"",o),orderDelivered:(e,t,r)=>A(e,t,r||"",o),orderRefunded:(e,t,r)=>R(e,t,r||"0.00",o),abandonedCart:(e,t)=>I(e,t||"",o)}}chunkBUNLC3II_cjs.h();var O=false,y=class o{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(chunkHPYH7GTS_cjs.a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!O)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('./drizzle-orm-47ELDEM6.cjs');await this.db.execute(e`
434
+ CREATE TABLE IF NOT EXISTS "settings" (
435
+ "key" VARCHAR(255) PRIMARY KEY,
436
+ "value" TEXT NOT NULL,
437
+ "description" TEXT,
438
+ "updated_at" TIMESTAMP DEFAULT NOW()
439
+ )
440
+ `),O=!0;}else typeof this.db?.exec=="function"&&(this.db.exec(`
441
+ CREATE TABLE IF NOT EXISTS settings (
442
+ key TEXT PRIMARY KEY,
443
+ value TEXT NOT NULL,
444
+ description TEXT,
445
+ updated_at TEXT
446
+ )
447
+ `),O=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-47ELDEM6.cjs'),i=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let n of i)try{let a=await this.db.execute(s`SELECT * FROM ${s.raw(n)} LIMIT 1`);if(e=Array.isArray(a)?a[0]:a?.rows?a.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let i of s)try{if(e=this.db.prepare(`SELECT * FROM ${i} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-47ELDEM6.cjs'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let i=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(i)?i[0]:i?.rows?i.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(o.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(chunkHPYH7GTS_cjs.a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[chunkHPYH7GTS_cjs.a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};var U=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...$(e.brand),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-IDML4L6W.cjs');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:i}=this.config,n=`"${s||"Kyro CMS"}" <${r}>`,a=e.replyTo||i;try{let l;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);l=await p.sendMail({from:n,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:a});}break;case "resend":l=await this.sendViaResend(n,e,a);break;case "sendgrid":l=await this.sendViaSendGrid(n,e,a);break;case "mailgun":l=await this.sendViaMailgun(n,e,a);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let i={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},n=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`Resend Error: ${JSON.stringify(a)}`)}return n.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let i={personalizations:[{to:Array.isArray(t.to)?t.to.map(a=>({email:a})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},n=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`SendGrid Error: ${JSON.stringify(a)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:n}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let a=n==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let f=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",f),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let m=await fetch(`https://${a}/v3/${i}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!m.ok){let u=await m.json();throw new Error(`Mailgun Error: ${JSON.stringify(u)}`)}return m.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fetchBrandConfig(e){let t="Kyro CMS",r="https://kyro-cms.com/logo.svg",s="https://kyro-cms.com/logo-white.svg";try{let i=null,n=null;if(typeof e?.findOne=="function")i=await e.findOne({collection:"_globals_store-settings",where:{},draft:!0}),n=await e.findOne({collection:"_globals_brand-settings",where:{},draft:!0});else if(typeof e?.execute=="function"){let{sql:a}=await import('./drizzle-orm-47ELDEM6.cjs');try{let l=await e.execute(a`SELECT * FROM "_globals_store-settings" LIMIT 1`);i=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}try{let l=await e.execute(a`SELECT * FROM "_globals_brand-settings" LIMIT 1`);n=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}}else if(typeof e?.prepare=="function"){try{i=e.prepare('SELECT * FROM "_globals_store-settings" LIMIT 1').get();}catch{}try{n=e.prepare('SELECT * FROM "_globals_brand-settings" LIMIT 1').get();}catch{}}if(i?.storeName&&(t=i.storeName),n?.identity){let a=typeof n.identity=="string"?JSON.parse(n.identity):n.identity,l=async p=>{if(typeof e?.findOne=="function")return (await e.findOne({collection:"media",where:{id:{equals:p}}}))?.url;if(typeof e?.execute=="function"){let{sql:f}=await import('./drizzle-orm-47ELDEM6.cjs');try{let m=await e.execute(f`SELECT url FROM "media" WHERE id = ${p}`);return (Array.isArray(m)?m[0]:m?.rows?m.rows[0]:null)?.url}catch{}}else if(typeof e?.prepare=="function")try{return e.prepare('SELECT url FROM "media" WHERE id = ?').get(p)?.url}catch{}};if(a.primaryLogo){let p=await l(a.primaryLogo);p&&(r=p);}if(a.darkLogo){let p=await l(a.darkLogo);p&&(s=p);}}}catch{}return {siteName:t,logoUrl:r,logoDarkUrl:s,appUrl:process.env.PUBLIC_URL||"https://kyro-cms.com"}}static async fromConfig(e){let t=new y(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let i={brand:await this.fetchBrandConfig(e),provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new o(i)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let i=process.env.SMTP_HOST,n=process.env.SMTP_USER,a=process.env.SMTP_PASS;return !i||!n||!a?null:new o({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:i,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:n,pass:a}}})}if(e==="resend"){let i=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:i}}):null}if(e==="sendgrid"){let i=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:i}}):null}if(e==="mailgun"){let i=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,n=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!n?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:n,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let i=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,n=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,a=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!n?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:n,region:a}})}return null}};
448
+ exports.a=g;exports.b=b;exports.c=x;exports.d=_;exports.e=w;exports.f=S;exports.g=C;exports.h=T;exports.i=k;exports.j=E;exports.k=v;exports.l=A;exports.m=R;exports.n=I;exports.o=$;exports.p=y;exports.q=U;
@@ -1,5 +1,5 @@
1
- 'use strict';var chunk7ACHOBWY_cjs=require('./chunk-7ACHOBWY.cjs'),chunkSOCBJPYB_cjs=require('./chunk-SOCBJPYB.cjs'),chunkBCEE4NBZ_cjs=require('./chunk-BCEE4NBZ.cjs'),chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkVQ53TFYA_cjs=require('./chunk-VQ53TFYA.cjs'),chunkF4ITQ6XQ_cjs=require('./chunk-F4ITQ6XQ.cjs'),chunkZOVH6QT5_cjs=require('./chunk-ZOVH6QT5.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function b(f,t="postgres"){switch(f.type){case "text":case "email":case "password":case "color":case "icon":return t==="sqlite"?"text":"varchar";case "textarea":case "code":case "markdown":case "secret":return "text";case "number":return f.integer?"integer":"decimal";case "checkbox":return "boolean";case "date":return "timestamp";case "select":case "radio":return t==="sqlite"?"text":"varchar";case "richtext":case "json":case "array":case "group":case "blocks":case "row":case "collapsible":case "tabs":return "jsonb";case "relationship":return t==="sqlite"?"text":"varchar";case "upload":return "jsonb";default:return "jsonb"}}function de(f,t="postgres"){let i=f.slug.replace(/-/g,"_"),e=[];e.push(`export const ${i} = pgTable('${i}', {`),e.push(" id: uuid('id').primaryKey().defaultRandom(),");for(let s of f.fields){if(s.name==="id"||s.type==="password")continue;let n=b(s,t),o=s.required,a=` ${s.name}: pg.${n}('${s.name}')`;s.unique&&(a+=".unique()"),o||(a+=".nullable()"),s.defaultValue!==void 0&&(typeof s.defaultValue=="string"?a+=`.default('${s.defaultValue}')`:typeof s.defaultValue=="boolean"?a+=`.default(${s.defaultValue})`:a+=`.default(sql\`${JSON.stringify(s.defaultValue)}\`)`),a+=",",e.push(a);}return f.timestamps&&(e.push(" createdAt: pg.timestamp('created_at').defaultNow(),"),e.push(" updatedAt: pg.timestamp('updated_at').defaultNow(),")),e.push(` status: ${t==="sqlite"?"sqlite":"pg"}.varchar('status').default('draft'),`),e.push(` hasDraft: ${t==="sqlite"?"sqlite":"pg"}.boolean('hasDraft').default(false),`),e.push("});"),e.join(`
2
- `)}function j(f,t){return Array.isArray(f)?f.map(i=>{if(!i||typeof i!="object")return i;let e=i.data?{...i.data}:void 0;if(!e)return i;let s=t.find(n=>n.slug===i.type||n.slug===i.slug);if(!s||!Array.isArray(s.fields))return i;for(let n of s.fields){if(n.name&&(n.type==="upload"||n.type==="image")&&e[n.name]){let o=e[n.name];Array.isArray(o)?e[n.name]=o.map(a=>typeof a=="string"?{id:a}:a):typeof o=="string"&&(e[n.name]={id:o});}if(n.type==="blocks"&&n.name&&e[n.name]){let o=n.blocks||[];e[n.name]=j(e[n.name],o);}}return {...i,data:e}}):f}function C(f){if(typeof f!="string")return f;let t=f.replace(/-/g,"").toLowerCase();return t.length===32?`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`:f}var O=class extends chunkVQ53TFYA_cjs.a{client;schema;_schemaEnsured=false;dialect;connectionString;versionsTableReady=false;rawClient;constructor(t){if(super(),this.schema=t.schema||{},t.connectionString){this.connectionString=t.connectionString;let i=t.connectionString.toLowerCase();i.startsWith("postgres://")||i.startsWith("postgresql://")?this.dialect="postgres":i.includes(".db")||i.includes("sqlite")||i.includes("file:")?this.dialect="sqlite":this.dialect=t.type||"postgres";}else this.rawClient=t.client,this.client=t.client,this.dialect=t.type||"sqlite";}prepareData(t,i){let e=super.prepareData(t,i);e.createdAt&&typeof e.createdAt=="string"&&(e.createdAt=new Date(e.createdAt)),e.updatedAt&&typeof e.updatedAt=="string"&&(e.updatedAt=new Date(e.updatedAt));for(let s of i.fields)if(s.type==="date"&&s.name){let n=e[s.name];n&&typeof n=="string"&&(e[s.name]=new Date(n));}for(let s of i.fields){let o=b(s,this.dialect)==="jsonb";if(s.type==="tabs"&&"tabs"in s&&s.name){let a=t[s.name];if(a&&typeof a=="object"){let r={};for(let[l,c]of Object.entries(a)){let u=s.tabs.flatMap(g=>g.fields).find(g=>g.name===l);(u?.type==="upload"||u?.type==="image"||u?.type==="list"||u?.type==="relationship-block")&&c?r[l]=Array.isArray(c)||typeof c=="object"?JSON.stringify(c):c:r[l]=c;}e[s.name]=this.dialect==="sqlite"||!o?JSON.stringify(r):r;}}else if(o&&s.name&&t[s.name]!==void 0&&t[s.name]!==null)e[s.name]=this.dialect==="sqlite"?JSON.stringify(t[s.name]):t[s.name];else if((s.type==="upload"||s.type==="image"||s.type==="list"||s.type==="relationship-block")&&s.name){let a=t[s.name];a!=null&&(e[s.name]=this.dialect==="sqlite"||!o?typeof a=="string"?a:JSON.stringify(a):a);}}for(let s of i.fields)if(s.name&&e[s.name]===""){let n=b(s,this.dialect);(n==="timestamp"||n==="jsonb"||n==="decimal"||n==="integer"||n==="numeric"||n==="boolean")&&(e[s.name]=null);}return e}async connect(){if(this.connectionString&&!this.client){if(this.dialect==="postgres"){let t,i;try{t=(await import('./src-6LAUXXDM.cjs')).default,i=(await import('./postgres-js-GXZX3AGZ.cjs')).drizzle;}catch{chunkF4ITQ6XQ_cjs.a(["postgres","drizzle-orm"]),t=(await import('./src-6LAUXXDM.cjs')).default,i=(await import('./postgres-js-GXZX3AGZ.cjs')).drizzle;}let e=t(this.connectionString,{onnotice:()=>{}});this.client=i(e,{schema:this.schema});}else if(this.dialect==="sqlite"){let t,i;try{t=(await import('better-sqlite3')).default,i=(await import('./better-sqlite3-5IISPX34.cjs')).drizzle;}catch{chunkF4ITQ6XQ_cjs.a(["better-sqlite3","drizzle-orm"]),t=(await import('better-sqlite3')).default,i=(await import('./better-sqlite3-5IISPX34.cjs')).drizzle;}let e=new t(this.connectionString.replace("file:",""));this.client=i(e,{schema:this.schema});}}if(this.rawClient&&typeof this.rawClient.prepare=="function"&&typeof this.client?.select!="function"){let{drizzle:t}=await import('./d1-5ZQJOFDX.cjs');this.client=t(this.rawClient,{schema:this.schema});}this.connected=true;}async init(t,i=[]){if(await super.init(t,i),(this.connectionString&&!this.client||this.rawClient&&typeof this.client?.select!="function")&&await this.connect(),this.client&&!this._schemaEnsured){for(let s of t){let n=this.getTableName(s.slug);this.schema[n]||(this.schema[n]=this.createTableFromConfig(s));}await this.ensureCollectionTables(t);let e=i.map(s=>({slug:`_globals_${s.slug}`,fields:s.fields,label:s.label}));for(let s of e){let n=this.getTableName(s.slug);this.schema[n]||(this.schema[n]=this.createTableFromConfig(s,true)),this.collections.has(s.slug)||this.collections.set(s.slug,s);}await this.ensureCollectionTables(e),this._schemaEnsured=true;}}createTableFromConfig(t,i=false){let e=this.getTableName(t.slug),s={id:i?chunkVRZC4TTF_cjs.ia("id").primaryKey():chunkVRZC4TTF_cjs.oa("id").primaryKey().defaultRandom()};for(let n of t.fields){if(!n.name||n.name==="id"||n.type==="password")continue;let o=b(n,this.dialect),a=n.name.replace(/-/g,"_"),r=a.replace(/([A-Z])/g,"_$1").toLowerCase(),l;if(this.dialect==="sqlite")switch(o){case "varchar":case "text":l=chunk7ACHOBWY_cjs.c(r);break;case "integer":l=chunk7ACHOBWY_cjs.a(r);break;case "decimal":case "numeric":l=chunk7ACHOBWY_cjs.b(r);break;case "boolean":l=chunk7ACHOBWY_cjs.a(r,{mode:"boolean"});break;case "timestamp":l=chunk7ACHOBWY_cjs.c(r);break;case "jsonb":l=chunk7ACHOBWY_cjs.c(r);break;default:l=chunk7ACHOBWY_cjs.c(r);}else switch(o){case "varchar":l=chunkVRZC4TTF_cjs.pa(r,{length:255});break;case "integer":l=chunkVRZC4TTF_cjs.ca(r);break;case "decimal":l=chunkVRZC4TTF_cjs.ha(r);break;case "boolean":l=chunkVRZC4TTF_cjs.$(r);break;case "timestamp":l=chunkVRZC4TTF_cjs.ma(r);break;case "jsonb":l=chunkVRZC4TTF_cjs.fa(r);break;default:l=chunkVRZC4TTF_cjs.ia(r);}n.required||(l=l.default(null)),s[a]=l;}return s.createdAt||(s.createdAt=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("created_at").default(new Date().toISOString()):chunkVRZC4TTF_cjs.ma("created_at").defaultNow()),s.updatedAt||(s.updatedAt=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("updated_at").default(new Date().toISOString()):chunkVRZC4TTF_cjs.ma("updated_at").defaultNow()),e!=="users"&&e!=="audit_logs"&&(s.status||(s.status=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("status").default("draft"):chunkVRZC4TTF_cjs.pa("status",{length:20}).default("draft")),s.hasDraft||(s.hasDraft=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.a("hasDraft",{mode:"boolean"}).default(false):chunkVRZC4TTF_cjs.$("hasDraft").default(false))),this.dialect==="sqlite"?chunk7ACHOBWY_cjs.e(e,s):chunkVRZC4TTF_cjs.ra(e,s)}async ensureCollectionTables(t){let i=[];for(let e of t){let s=e.slug.startsWith("_globals_"),n=this.getTableName(e.slug),o=this.generateCreateColumns(e),a=e.fields.some(u=>u.name==="createdAt"),r=e.fields.some(u=>u.name==="updatedAt"),l=e.fields.some(u=>u.name==="status"),c=e.fields.some(u=>u.name==="hasDraft");if(this.dialect==="postgres"){let u=s?'"id" TEXT PRIMARY KEY':'"id" UUID PRIMARY KEY DEFAULT gen_random_uuid()';i.push(`
1
+ 'use strict';var chunk7ACHOBWY_cjs=require('./chunk-7ACHOBWY.cjs'),chunkRVBSJ4UQ_cjs=require('./chunk-RVBSJ4UQ.cjs'),chunkBCEE4NBZ_cjs=require('./chunk-BCEE4NBZ.cjs'),chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkVQ53TFYA_cjs=require('./chunk-VQ53TFYA.cjs'),chunkF4ITQ6XQ_cjs=require('./chunk-F4ITQ6XQ.cjs'),chunkZOVH6QT5_cjs=require('./chunk-ZOVH6QT5.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function b(f,t="postgres"){switch(f.type){case "text":case "email":case "password":case "color":case "icon":return t==="sqlite"?"text":"varchar";case "textarea":case "code":case "markdown":case "secret":return "text";case "number":return f.integer?"integer":"decimal";case "checkbox":return "boolean";case "date":return "timestamp";case "select":case "radio":return t==="sqlite"?"text":"varchar";case "richtext":case "json":case "array":case "group":case "blocks":case "row":case "collapsible":case "tabs":return "jsonb";case "relationship":return t==="sqlite"?"text":"varchar";case "upload":return "jsonb";default:return "jsonb"}}function de(f,t="postgres"){let i=f.slug.replace(/-/g,"_"),e=[];e.push(`export const ${i} = pgTable('${i}', {`),e.push(" id: uuid('id').primaryKey().defaultRandom(),");for(let s of f.fields){if(s.name==="id"||s.type==="password")continue;let n=b(s,t),o=s.required,a=` ${s.name}: pg.${n}('${s.name}')`;s.unique&&(a+=".unique()"),o||(a+=".nullable()"),s.defaultValue!==void 0&&(typeof s.defaultValue=="string"?a+=`.default('${s.defaultValue}')`:typeof s.defaultValue=="boolean"?a+=`.default(${s.defaultValue})`:a+=`.default(sql\`${JSON.stringify(s.defaultValue)}\`)`),a+=",",e.push(a);}return f.timestamps&&(e.push(" createdAt: pg.timestamp('created_at').defaultNow(),"),e.push(" updatedAt: pg.timestamp('updated_at').defaultNow(),")),e.push(` status: ${t==="sqlite"?"sqlite":"pg"}.varchar('status').default('draft'),`),e.push(` hasDraft: ${t==="sqlite"?"sqlite":"pg"}.boolean('hasDraft').default(false),`),e.push("});"),e.join(`
2
+ `)}function j(f,t){return Array.isArray(f)?f.map(i=>{if(!i||typeof i!="object")return i;let e=i.data?{...i.data}:void 0;if(!e)return i;let s=t.find(n=>n.slug===i.type||n.slug===i.slug);if(!s||!Array.isArray(s.fields))return i;for(let n of s.fields){if(n.name&&(n.type==="upload"||n.type==="image")&&e[n.name]){let o=e[n.name];Array.isArray(o)?e[n.name]=o.map(a=>typeof a=="string"?{id:a}:a):typeof o=="string"&&(e[n.name]={id:o});}if(n.type==="blocks"&&n.name&&e[n.name]){let o=n.blocks||[];e[n.name]=j(e[n.name],o);}}return {...i,data:e}}):f}function C(f){if(typeof f!="string")return f;let t=f.replace(/-/g,"").toLowerCase();return t.length===32?`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`:f}var O=class extends chunkVQ53TFYA_cjs.a{client;schema;_schemaEnsured=false;dialect;connectionString;versionsTableReady=false;rawClient;constructor(t){if(super(),this.schema=t.schema||{},t.connectionString){this.connectionString=t.connectionString;let i=t.connectionString.toLowerCase();i.startsWith("postgres://")||i.startsWith("postgresql://")?this.dialect="postgres":i.includes(".db")||i.includes("sqlite")||i.includes("file:")?this.dialect="sqlite":this.dialect=t.type||"postgres";}else this.rawClient=t.client,this.client=t.client,this.dialect=t.type||"sqlite";}prepareData(t,i){let e=super.prepareData(t,i);e.createdAt&&typeof e.createdAt=="string"&&(e.createdAt=new Date(e.createdAt)),e.updatedAt&&typeof e.updatedAt=="string"&&(e.updatedAt=new Date(e.updatedAt));for(let s of i.fields)if(s.type==="date"&&s.name){let n=e[s.name];n&&typeof n=="string"&&(e[s.name]=new Date(n));}for(let s of i.fields){let o=b(s,this.dialect)==="jsonb";if(s.type==="tabs"&&"tabs"in s&&s.name){let a=t[s.name];if(a&&typeof a=="object"){let r={};for(let[l,c]of Object.entries(a)){let u=s.tabs.flatMap(g=>g.fields).find(g=>g.name===l);(u?.type==="upload"||u?.type==="image"||u?.type==="list"||u?.type==="relationship-block")&&c?r[l]=Array.isArray(c)||typeof c=="object"?JSON.stringify(c):c:r[l]=c;}e[s.name]=this.dialect==="sqlite"||!o?JSON.stringify(r):r;}}else if(o&&s.name&&t[s.name]!==void 0&&t[s.name]!==null)e[s.name]=this.dialect==="sqlite"?JSON.stringify(t[s.name]):t[s.name];else if((s.type==="upload"||s.type==="image"||s.type==="list"||s.type==="relationship-block")&&s.name){let a=t[s.name];a!=null&&(e[s.name]=this.dialect==="sqlite"||!o?typeof a=="string"?a:JSON.stringify(a):a);}}for(let s of i.fields)if(s.name&&e[s.name]===""){let n=b(s,this.dialect);(n==="timestamp"||n==="jsonb"||n==="decimal"||n==="integer"||n==="numeric"||n==="boolean")&&(e[s.name]=null);}return e}async connect(){if(this.connectionString&&!this.client){if(this.dialect==="postgres"){let t,i;try{t=(await import('./src-6LAUXXDM.cjs')).default,i=(await import('./postgres-js-7YBZKGXG.cjs')).drizzle;}catch{chunkF4ITQ6XQ_cjs.a(["postgres","drizzle-orm"]),t=(await import('./src-6LAUXXDM.cjs')).default,i=(await import('./postgres-js-7YBZKGXG.cjs')).drizzle;}let e=t(this.connectionString,{onnotice:()=>{}});this.client=i(e,{schema:this.schema});}else if(this.dialect==="sqlite"){let t,i;try{t=(await import('better-sqlite3')).default,i=(await import('./better-sqlite3-5IISPX34.cjs')).drizzle;}catch{chunkF4ITQ6XQ_cjs.a(["better-sqlite3","drizzle-orm"]),t=(await import('better-sqlite3')).default,i=(await import('./better-sqlite3-5IISPX34.cjs')).drizzle;}let e=new t(this.connectionString.replace("file:",""));this.client=i(e,{schema:this.schema});}}if(this.rawClient&&typeof this.rawClient.prepare=="function"&&typeof this.client?.select!="function"){let{drizzle:t}=await import('./d1-5ZQJOFDX.cjs');this.client=t(this.rawClient,{schema:this.schema});}this.connected=true;}async init(t,i=[]){if(await super.init(t,i),(this.connectionString&&!this.client||this.rawClient&&typeof this.client?.select!="function")&&await this.connect(),this.client&&!this._schemaEnsured){for(let s of t){let n=this.getTableName(s.slug);this.schema[n]||(this.schema[n]=this.createTableFromConfig(s));}await this.ensureCollectionTables(t);let e=i.map(s=>({slug:`_globals_${s.slug}`,fields:s.fields,label:s.label}));for(let s of e){let n=this.getTableName(s.slug);this.schema[n]||(this.schema[n]=this.createTableFromConfig(s,true)),this.collections.has(s.slug)||this.collections.set(s.slug,s);}await this.ensureCollectionTables(e),this._schemaEnsured=true;}}createTableFromConfig(t,i=false){let e=this.getTableName(t.slug),s={id:i?chunkVRZC4TTF_cjs.ia("id").primaryKey():chunkVRZC4TTF_cjs.oa("id").primaryKey().defaultRandom()};for(let n of t.fields){if(!n.name||n.name==="id"||n.type==="password")continue;let o=b(n,this.dialect),a=n.name.replace(/-/g,"_"),r=a.replace(/([A-Z])/g,"_$1").toLowerCase(),l;if(this.dialect==="sqlite")switch(o){case "varchar":case "text":l=chunk7ACHOBWY_cjs.c(r);break;case "integer":l=chunk7ACHOBWY_cjs.a(r);break;case "decimal":case "numeric":l=chunk7ACHOBWY_cjs.b(r);break;case "boolean":l=chunk7ACHOBWY_cjs.a(r,{mode:"boolean"});break;case "timestamp":l=chunk7ACHOBWY_cjs.c(r);break;case "jsonb":l=chunk7ACHOBWY_cjs.c(r);break;default:l=chunk7ACHOBWY_cjs.c(r);}else switch(o){case "varchar":l=chunkVRZC4TTF_cjs.pa(r,{length:255});break;case "integer":l=chunkVRZC4TTF_cjs.ca(r);break;case "decimal":l=chunkVRZC4TTF_cjs.ha(r);break;case "boolean":l=chunkVRZC4TTF_cjs.$(r);break;case "timestamp":l=chunkVRZC4TTF_cjs.ma(r);break;case "jsonb":l=chunkVRZC4TTF_cjs.fa(r);break;default:l=chunkVRZC4TTF_cjs.ia(r);}n.required||(l=l.default(null)),s[a]=l;}return s.createdAt||(s.createdAt=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("created_at").default(new Date().toISOString()):chunkVRZC4TTF_cjs.ma("created_at").defaultNow()),s.updatedAt||(s.updatedAt=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("updated_at").default(new Date().toISOString()):chunkVRZC4TTF_cjs.ma("updated_at").defaultNow()),e!=="users"&&e!=="audit_logs"&&(s.status||(s.status=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("status").default("draft"):chunkVRZC4TTF_cjs.pa("status",{length:20}).default("draft")),s.hasDraft||(s.hasDraft=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.a("hasDraft",{mode:"boolean"}).default(false):chunkVRZC4TTF_cjs.$("hasDraft").default(false))),this.dialect==="sqlite"?chunk7ACHOBWY_cjs.e(e,s):chunkVRZC4TTF_cjs.ra(e,s)}async ensureCollectionTables(t){let i=[];for(let e of t){let s=e.slug.startsWith("_globals_"),n=this.getTableName(e.slug),o=this.generateCreateColumns(e),a=e.fields.some(u=>u.name==="createdAt"),r=e.fields.some(u=>u.name==="updatedAt"),l=e.fields.some(u=>u.name==="status"),c=e.fields.some(u=>u.name==="hasDraft");if(this.dialect==="postgres"){let u=s?'"id" TEXT PRIMARY KEY':'"id" UUID PRIMARY KEY DEFAULT gen_random_uuid()';i.push(`
3
3
  CREATE TABLE IF NOT EXISTS "${n}" (
4
4
  ${u},
5
5
  ${o}
@@ -129,4 +129,4 @@
129
129
  created_at text NOT NULL,
130
130
  updated_at text NOT NULL
131
131
  )
132
- `,await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(t));try{this.dialect==="postgres"?await this.executeRaw(chunkVRZC4TTF_cjs.J.raw("ALTER TABLE kyro_versions ADD COLUMN IF NOT EXISTS autosave integer NOT NULL DEFAULT 0")):await this.executeRaw(chunkVRZC4TTF_cjs.J.raw("ALTER TABLE kyro_versions ADD COLUMN autosave integer NOT NULL DEFAULT 0"));}catch{}this.versionsTableReady=true;}async execute(t){return this.executeRaw(t)}async executeRaw(t){let i="",e=[];if(typeof t=="string")i=t;else if(t&&(t.queryChunks||t.decoder))if(this.dialect==="postgres"){let n=new chunkSOCBJPYB_cjs.a().sqlToQuery(t);i=n.sql,e=n.params;}else {let n=new chunk7ACHOBWY_cjs.h().sqlToQuery(t);i=n.sql,e=n.params;}else if(t&&typeof t.toSQL=="function"){let n=t.toSQL();i=n.sql,e=n.params||[];}else i=String(t);let s=this.rawClient||this.client;if(s?.prepare&&typeof s.prepare=="function"){let n=s.prepare(i);return (e.length>0?await n.bind(...e).all():await n.all()).results||[]}if(typeof this.client?.execute=="function"){let n=await this.client.execute(t);return Array.isArray(n)?n:Array.isArray(n?.rows)?n.rows:Array.isArray(n?.[0])?n[0]:[]}return []}};function pe(f){return new O(f)}exports.a=b;exports.b=de;exports.c=O;exports.d=pe;
132
+ `,await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(t));try{this.dialect==="postgres"?await this.executeRaw(chunkVRZC4TTF_cjs.J.raw("ALTER TABLE kyro_versions ADD COLUMN IF NOT EXISTS autosave integer NOT NULL DEFAULT 0")):await this.executeRaw(chunkVRZC4TTF_cjs.J.raw("ALTER TABLE kyro_versions ADD COLUMN autosave integer NOT NULL DEFAULT 0"));}catch{}this.versionsTableReady=true;}async execute(t){return this.executeRaw(t)}async executeRaw(t){let i="",e=[];if(typeof t=="string")i=t;else if(t&&(t.queryChunks||t.decoder))if(this.dialect==="postgres"){let n=new chunkRVBSJ4UQ_cjs.a().sqlToQuery(t);i=n.sql,e=n.params;}else {let n=new chunk7ACHOBWY_cjs.h().sqlToQuery(t);i=n.sql,e=n.params;}else if(t&&typeof t.toSQL=="function"){let n=t.toSQL();i=n.sql,e=n.params||[];}else i=String(t);let s=this.rawClient||this.client;if(s?.prepare&&typeof s.prepare=="function"){let n=s.prepare(i);return (e.length>0?await n.bind(...e).all():await n.all()).results||[]}if(typeof this.client?.execute=="function"){let n=await this.client.execute(t);return Array.isArray(n)?n:Array.isArray(n?.rows)?n.rows:Array.isArray(n?.[0])?n[0]:[]}return []}};function pe(f){return new O(f)}exports.a=b;exports.b=de;exports.c=O;exports.d=pe;
@@ -0,0 +1,2 @@
1
+ import {K,H}from'./chunk-TS55CUNJ.js';import {e}from'./chunk-ATI2UZ7U.js';import {hb}from'./chunk-DI6TCZSE.js';import {a as a$1}from'./chunk-N6MNQIQU.js';import {c}from'./chunk-FUFS65Q5.js';import {a}from'./chunk-ZWDBPEXL.js';import {a as a$2}from'./chunk-5ZEYOFAK.js';import {g}from'./chunk-Y2YAKDEQ.js';import w from'kyro:config';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
+ g();var r=null,l=null;async function b(){if(!r){if(globalThis.__KYRO_INSTANCE__)try{await globalThis.__KYRO_INSTANCE__.shutdown();}catch{}try{let e$1=w.default||w,t=e$1.adapter,o=t&&!t.dialect&&typeof t.connect=="function";if(globalThis.DB&&(!t||o)){let s=globalThis.DB;e$1.adapter=new c({type:"sqlite",client:s}),K.info("Hot-swapped to D1 DrizzleAdapter");}r=H(e$1),await r.init();let a$3=e$1.adapter,p=a$3&&a$3.dialect&&(a$3.dialect==="postgres"||a$3.dialect==="sqlite"),c$1=a$3&&a$3.dialect==="mongodb",n;if(p)a$3.dialect==="postgres"?n=new a({db:a$3.client}):a$3.dialect==="sqlite"&&(n=new hb({db:a$3.rawClient||a$3.client}));else if(o&&!globalThis.DB){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";n=new a$1({path:s});}else c$1&&(n=new a$2({adapter:a$3}));if(n?.connect)try{await n.connect();}catch(s){K.warn("Auth connect warning:",s);}try{await r.loadSettings();}catch(s){K.warn("loadSettings warning:",s);}try{await e(n);}catch(s){K.warn("autoBootstrap warning:",s);}globalThis.__KYRO_INSTANCE__=r;}catch(e){throw r=null,l=null,K.error("Init failed, will retry:",e),e}}}async function E(e){let t=globalThis.DB?globalThis:null;try{let{env:o}=await import('cloudflare:workers');o&&(t=o);}catch{}if(e)try{t=e.locals?.cfContext?.env||e?.env||t;}catch{}if(!t)try{t=process.env;}catch{}t?.DB&&(globalThis.DB=t.DB),t?.STORAGE_BUCKET&&(globalThis.STORAGE_BUCKET=t.STORAGE_BUCKET),l||(l=b()),await l;}var _={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function T(e){return r?r.settings?.access?.apiAccess?.[e]??_[e]??true:_[e]??true}var R=async e=>{if(!r)try{await Promise.race([E(e),new Promise((t,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch(t){return console.error("[Kyro API] Warm error:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}try{let o=new URL(e.request.url).pathname,a=__KYRO_API_PATH__;if(o===`${a}/graphql`&&typeof r.getGraphQL=="function"){if(!T("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await r.getGraphQL().fetch(e.request,e.locals);return new Response(n.body,n)}if(o.startsWith(`${a}/trpc/`)&&typeof r.getTRPC=="function"){if(!T("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await r.getTRPC().fetch(e.request,e.locals);return new Response(n.body,n)}return await(await r.getREST()).fetch(e.request,e.locals)}catch(t){return console.error("[Kyro API Execution Error]:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Internal Server Error",message:t?.message||String(t),stack:t?.stack}),{status:500,headers:{"Content-Type":"application/json"}})}},N=R;export{r as a,E as b,R as c,N as d};