@sonordev/site-kit 6.1.1 → 6.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/agent-manifest.json +1 -1
  2. package/dist/{AnalyticsProvider-5G5AFHZN.js → AnalyticsProvider-QK6XBDEJ.js} +10 -10
  3. package/dist/{AnalyticsProvider-5G5AFHZN.js.map → AnalyticsProvider-QK6XBDEJ.js.map} +1 -1
  4. package/dist/{AnalyticsProvider-33L4E6LO.mjs → AnalyticsProvider-TIJWTISP.mjs} +6 -6
  5. package/dist/{AnalyticsProvider-33L4E6LO.mjs.map → AnalyticsProvider-TIJWTISP.mjs.map} +1 -1
  6. package/dist/{ArticleViewTracker-U2KFUSZF.js → ArticleViewTracker-ALE672ZR.js} +6 -6
  7. package/dist/{ArticleViewTracker-U2KFUSZF.js.map → ArticleViewTracker-ALE672ZR.js.map} +1 -1
  8. package/dist/{ArticleViewTracker-VZRMPK4S.mjs → ArticleViewTracker-I66RBWDK.mjs} +5 -5
  9. package/dist/{ArticleViewTracker-VZRMPK4S.mjs.map → ArticleViewTracker-I66RBWDK.mjs.map} +1 -1
  10. package/dist/ChatWidget-566CQUN6.js +26 -0
  11. package/dist/{ChatWidget-RUCQMCMN.js.map → ChatWidget-566CQUN6.js.map} +1 -1
  12. package/dist/ChatWidget-LNOY4TUZ.mjs +17 -0
  13. package/dist/{ChatWidget-LH3QZYKR.mjs.map → ChatWidget-LNOY4TUZ.mjs.map} +1 -1
  14. package/dist/EngageWidget-DF47YUHQ.js +21 -0
  15. package/dist/{EngageWidget-X2CBW7DV.js.map → EngageWidget-DF47YUHQ.js.map} +1 -1
  16. package/dist/EngageWidget-IGF7SC3R.mjs +12 -0
  17. package/dist/{EngageWidget-34BQXU7K.mjs.map → EngageWidget-IGF7SC3R.mjs.map} +1 -1
  18. package/dist/{FileField-REUU36RJ.mjs → FileField-AG63W2BC.mjs} +5 -5
  19. package/dist/{FileField-REUU36RJ.mjs.map → FileField-AG63W2BC.mjs.map} +1 -1
  20. package/dist/{FileField-2MMV53BG.js → FileField-IK6E5IOC.js} +6 -6
  21. package/dist/{FileField-2MMV53BG.js.map → FileField-IK6E5IOC.js.map} +1 -1
  22. package/dist/{FormSpotlight-Y27TPQ4G.js → FormSpotlight-6MUDJWW5.js} +9 -9
  23. package/dist/{FormSpotlight-Y27TPQ4G.js.map → FormSpotlight-6MUDJWW5.js.map} +1 -1
  24. package/dist/{FormSpotlight-ZV3IS66K.mjs → FormSpotlight-H7V4GBXG.mjs} +3 -3
  25. package/dist/{FormSpotlight-ZV3IS66K.mjs.map → FormSpotlight-H7V4GBXG.mjs.map} +1 -1
  26. package/dist/{FormStage-6NUGCDJR.mjs → FormStage-ACETL7SD.mjs} +3 -3
  27. package/dist/{FormStage-6NUGCDJR.mjs.map → FormStage-ACETL7SD.mjs.map} +1 -1
  28. package/dist/{FormStage-K7Z6IEPM.js → FormStage-ZXZRZ2LS.js} +9 -9
  29. package/dist/{FormStage-K7Z6IEPM.js.map → FormStage-ZXZRZ2LS.js.map} +1 -1
  30. package/dist/ManagedForm-4U54NPW2.js +25 -0
  31. package/dist/{ManagedForm-O67ILXN7.js.map → ManagedForm-4U54NPW2.js.map} +1 -1
  32. package/dist/ManagedForm-MOBWSG4D.mjs +16 -0
  33. package/dist/{ManagedForm-EUDKMS5G.mjs.map → ManagedForm-MOBWSG4D.mjs.map} +1 -1
  34. package/dist/{ManagedNewsletterForm-QBJODAIA.js → ManagedNewsletterForm-5LBGBE2F.js} +8 -8
  35. package/dist/{ManagedNewsletterForm-QBJODAIA.js.map → ManagedNewsletterForm-5LBGBE2F.js.map} +1 -1
  36. package/dist/{ManagedNewsletterForm-IGWTZW7X.mjs → ManagedNewsletterForm-OV3OEMUP.mjs} +7 -7
  37. package/dist/{ManagedNewsletterForm-IGWTZW7X.mjs.map → ManagedNewsletterForm-OV3OEMUP.mjs.map} +1 -1
  38. package/dist/{SignalCore-KQDRH44V.js → SignalCore-QCVR7TZV.js} +11 -11
  39. package/dist/{SignalCore-KQDRH44V.js.map → SignalCore-QCVR7TZV.js.map} +1 -1
  40. package/dist/{SignalCore-UR4KVU5X.mjs → SignalCore-XM2MHEGR.mjs} +5 -5
  41. package/dist/{SignalCore-UR4KVU5X.mjs.map → SignalCore-XM2MHEGR.mjs.map} +1 -1
  42. package/dist/SitemapSync-74EVNOFQ.mjs +9 -0
  43. package/dist/{SitemapSync-QYV3X5LH.mjs.map → SitemapSync-74EVNOFQ.mjs.map} +1 -1
  44. package/dist/SitemapSync-BQFZAE3X.js +18 -0
  45. package/dist/{SitemapSync-DQALPBTR.js.map → SitemapSync-BQFZAE3X.js.map} +1 -1
  46. package/dist/analytics/index.js +9 -9
  47. package/dist/analytics/index.mjs +4 -4
  48. package/dist/articles/index.js +1 -1
  49. package/dist/articles/index.mjs +1 -1
  50. package/dist/articles/server-ui.js +1 -1
  51. package/dist/articles/server-ui.mjs +1 -1
  52. package/dist/brand/extract-brand-profile.d.ts +2 -7
  53. package/dist/brand/extract-brand-profile.d.ts.map +1 -1
  54. package/dist/{chunk-WWJQGMMN.js → chunk-2SLA2LOD.js} +12 -12
  55. package/dist/{chunk-WWJQGMMN.js.map → chunk-2SLA2LOD.js.map} +1 -1
  56. package/dist/{chunk-7PCXI25T.mjs → chunk-3MLVI5DH.mjs} +3 -3
  57. package/dist/{chunk-7PCXI25T.mjs.map → chunk-3MLVI5DH.mjs.map} +1 -1
  58. package/dist/{chunk-U3SQBAUQ.mjs → chunk-3RISRHOK.mjs} +8 -8
  59. package/dist/{chunk-U3SQBAUQ.mjs.map → chunk-3RISRHOK.mjs.map} +1 -1
  60. package/dist/chunk-5FBALULE.mjs +6 -0
  61. package/dist/{chunk-HQWPCX3N.mjs.map → chunk-5FBALULE.mjs.map} +1 -1
  62. package/dist/{chunk-22KPMJIQ.mjs → chunk-5IQOPL7T.mjs} +3 -3
  63. package/dist/{chunk-22KPMJIQ.mjs.map → chunk-5IQOPL7T.mjs.map} +1 -1
  64. package/dist/{chunk-D6VMDDQR.js → chunk-5OUOVPXC.js} +8 -8
  65. package/dist/{chunk-D6VMDDQR.js.map → chunk-5OUOVPXC.js.map} +1 -1
  66. package/dist/{chunk-YZMI7QQ2.mjs → chunk-6FIIA6ME.mjs} +4 -4
  67. package/dist/{chunk-YZMI7QQ2.mjs.map → chunk-6FIIA6ME.mjs.map} +1 -1
  68. package/dist/{chunk-JOYMIGR2.mjs → chunk-7K6L33BX.mjs} +22 -22
  69. package/dist/{chunk-7IM7VG4E.js → chunk-7VRK3DWU.js} +6 -6
  70. package/dist/{chunk-7IM7VG4E.js.map → chunk-7VRK3DWU.js.map} +1 -1
  71. package/dist/{chunk-Y4A4G5XJ.js → chunk-AGEE4CGH.js} +5 -5
  72. package/dist/{chunk-Y4A4G5XJ.js.map → chunk-AGEE4CGH.js.map} +1 -1
  73. package/dist/{chunk-JS75ORH7.js → chunk-ATPQ6264.js} +24 -24
  74. package/dist/{chunk-IPGIFBRN.js → chunk-BGBP4UN4.js} +4 -4
  75. package/dist/{chunk-IPGIFBRN.js.map → chunk-BGBP4UN4.js.map} +1 -1
  76. package/dist/{chunk-6ZMEJSNX.mjs → chunk-CI7T4ZRP.mjs} +4 -4
  77. package/dist/{chunk-6ZMEJSNX.mjs.map → chunk-CI7T4ZRP.mjs.map} +1 -1
  78. package/dist/{chunk-BRED7YSL.js → chunk-CTAYH725.js} +11 -11
  79. package/dist/{chunk-BRED7YSL.js.map → chunk-CTAYH725.js.map} +1 -1
  80. package/dist/{chunk-DGWFHL35.mjs → chunk-D5KKVWZK.mjs} +3 -3
  81. package/dist/{chunk-DGWFHL35.mjs.map → chunk-D5KKVWZK.mjs.map} +1 -1
  82. package/dist/{chunk-U577PJLH.mjs → chunk-DVZ4BMXX.mjs} +7 -7
  83. package/dist/{chunk-U577PJLH.mjs.map → chunk-DVZ4BMXX.mjs.map} +1 -1
  84. package/dist/{chunk-OP42HO3Z.mjs → chunk-ESPOINPT.mjs} +3 -3
  85. package/dist/{chunk-OP42HO3Z.mjs.map → chunk-ESPOINPT.mjs.map} +1 -1
  86. package/dist/{chunk-VPZUQXZV.mjs → chunk-EVETX2XF.mjs} +4 -4
  87. package/dist/{chunk-VPZUQXZV.mjs.map → chunk-EVETX2XF.mjs.map} +1 -1
  88. package/dist/{chunk-6K3YRSYN.js → chunk-EVKP4SOM.js} +10 -10
  89. package/dist/{chunk-6K3YRSYN.js.map → chunk-EVKP4SOM.js.map} +1 -1
  90. package/dist/{chunk-R2BHRDPZ.mjs → chunk-EXVHO3CZ.mjs} +3 -3
  91. package/dist/{chunk-R2BHRDPZ.mjs.map → chunk-EXVHO3CZ.mjs.map} +1 -1
  92. package/dist/{chunk-YCA4KCRF.mjs → chunk-GYKFHQSZ.mjs} +3 -3
  93. package/dist/{chunk-YCA4KCRF.mjs.map → chunk-GYKFHQSZ.mjs.map} +1 -1
  94. package/dist/{chunk-U2DWXE2A.mjs → chunk-I4PUQYBI.mjs} +3 -3
  95. package/dist/{chunk-U2DWXE2A.mjs.map → chunk-I4PUQYBI.mjs.map} +1 -1
  96. package/dist/{chunk-46GMNQWN.js → chunk-I7KIVKVW.js} +3 -3
  97. package/dist/{chunk-46GMNQWN.js.map → chunk-I7KIVKVW.js.map} +1 -1
  98. package/dist/{chunk-GZLMMX76.mjs → chunk-IUNFAKOS.mjs} +3 -3
  99. package/dist/{chunk-GZLMMX76.mjs.map → chunk-IUNFAKOS.mjs.map} +1 -1
  100. package/dist/{chunk-VNJTU6LG.js → chunk-IWHAJBYL.js} +15 -15
  101. package/dist/{chunk-VNJTU6LG.js.map → chunk-IWHAJBYL.js.map} +1 -1
  102. package/dist/{chunk-EF7QCYLF.js → chunk-IZRVSIOK.js} +4 -4
  103. package/dist/{chunk-EF7QCYLF.js.map → chunk-IZRVSIOK.js.map} +1 -1
  104. package/dist/{chunk-NJSD5QY6.js → chunk-JAA42HR7.js} +7 -7
  105. package/dist/{chunk-NJSD5QY6.js.map → chunk-JAA42HR7.js.map} +1 -1
  106. package/dist/{chunk-HH5EMIXK.js → chunk-JSM4AYSZ.js} +14 -14
  107. package/dist/{chunk-HH5EMIXK.js.map → chunk-JSM4AYSZ.js.map} +1 -1
  108. package/dist/{chunk-NK7ZWPAO.js → chunk-KDLN2MR5.js} +18 -18
  109. package/dist/{chunk-NK7ZWPAO.js.map → chunk-KDLN2MR5.js.map} +1 -1
  110. package/dist/{chunk-ME5636V6.js → chunk-KEEZX6Q4.js} +3 -3
  111. package/dist/{chunk-ME5636V6.js.map → chunk-KEEZX6Q4.js.map} +1 -1
  112. package/dist/{chunk-AG7MWWGP.mjs → chunk-LXBPTKYT.mjs} +4 -4
  113. package/dist/{chunk-AG7MWWGP.mjs.map → chunk-LXBPTKYT.mjs.map} +1 -1
  114. package/dist/chunk-M2N7NY3V.js +103 -0
  115. package/dist/chunk-M2N7NY3V.js.map +1 -0
  116. package/dist/{chunk-OTCJRVFJ.js → chunk-MQEVQ5YB.js} +3 -3
  117. package/dist/{chunk-OTCJRVFJ.js.map → chunk-MQEVQ5YB.js.map} +1 -1
  118. package/dist/{chunk-S24WZNFP.js → chunk-MTHMOXZF.js} +6 -6
  119. package/dist/{chunk-S24WZNFP.js.map → chunk-MTHMOXZF.js.map} +1 -1
  120. package/dist/{chunk-3E7ZXPOB.mjs → chunk-NRT7MOEO.mjs} +4 -4
  121. package/dist/{chunk-3E7ZXPOB.mjs.map → chunk-NRT7MOEO.mjs.map} +1 -1
  122. package/dist/chunk-NYXENHD2.mjs +96 -0
  123. package/dist/chunk-NYXENHD2.mjs.map +1 -0
  124. package/dist/chunk-OI3FCJSP.js +8 -0
  125. package/dist/{chunk-QWUDHOUE.js.map → chunk-OI3FCJSP.js.map} +1 -1
  126. package/dist/{chunk-MWX6QO7A.mjs → chunk-OUP6UL74.mjs} +3 -3
  127. package/dist/{chunk-MWX6QO7A.mjs.map → chunk-OUP6UL74.mjs.map} +1 -1
  128. package/dist/{chunk-VNSV5SY7.mjs → chunk-OWEJXMKY.mjs} +3 -3
  129. package/dist/{chunk-VNSV5SY7.mjs.map → chunk-OWEJXMKY.mjs.map} +1 -1
  130. package/dist/{chunk-QYRJ4IQD.js → chunk-OZTVJSFX.js} +98 -47
  131. package/dist/chunk-OZTVJSFX.js.map +1 -0
  132. package/dist/{chunk-MJTHYT3D.js → chunk-P4J3WG6C.js} +4 -4
  133. package/dist/{chunk-MJTHYT3D.js.map → chunk-P4J3WG6C.js.map} +1 -1
  134. package/dist/{chunk-3SHAY7PK.mjs → chunk-PTQHPWEK.mjs} +88 -37
  135. package/dist/chunk-PTQHPWEK.mjs.map +1 -0
  136. package/dist/{chunk-7DMAVD7W.mjs → chunk-QSN2QST7.mjs} +3 -3
  137. package/dist/{chunk-7DMAVD7W.mjs.map → chunk-QSN2QST7.mjs.map} +1 -1
  138. package/dist/{chunk-MSSFRRXJ.mjs → chunk-RGXYE2ZI.mjs} +4 -4
  139. package/dist/{chunk-MSSFRRXJ.mjs.map → chunk-RGXYE2ZI.mjs.map} +1 -1
  140. package/dist/{chunk-NNZDWY3L.mjs → chunk-RH4XEXTK.mjs} +3 -3
  141. package/dist/{chunk-OUZQL5PV.js → chunk-RQG7I6O4.js} +4 -4
  142. package/dist/{chunk-OUZQL5PV.js.map → chunk-RQG7I6O4.js.map} +1 -1
  143. package/dist/{chunk-OB7K6EFK.js → chunk-S6CMQTVZ.js} +5 -5
  144. package/dist/{chunk-OB7K6EFK.js.map → chunk-S6CMQTVZ.js.map} +1 -1
  145. package/dist/{chunk-5YA6SI4Z.mjs → chunk-TIFVAASU.mjs} +2 -2
  146. package/dist/{chunk-JZCG25XK.js → chunk-VDGCZVUF.js} +14 -14
  147. package/dist/{chunk-JZCG25XK.js.map → chunk-VDGCZVUF.js.map} +1 -1
  148. package/dist/{chunk-3H3DTYFQ.js → chunk-XCOMBHLF.js} +8 -8
  149. package/dist/{chunk-3H3DTYFQ.js.map → chunk-XCOMBHLF.js.map} +1 -1
  150. package/dist/{chunk-I7AZC5ZQ.js → chunk-XXSSUCJB.js} +2 -2
  151. package/dist/{chunk-WVNUOUQI.mjs → chunk-YEHC7VMW.mjs} +3 -3
  152. package/dist/{chunk-WVNUOUQI.mjs.map → chunk-YEHC7VMW.mjs.map} +1 -1
  153. package/dist/{chunk-CJ5YPYAE.mjs → chunk-YK7SEUFJ.mjs} +4 -4
  154. package/dist/{chunk-CJ5YPYAE.mjs.map → chunk-YK7SEUFJ.mjs.map} +1 -1
  155. package/dist/{chunk-NN2YE5WT.js → chunk-ZUQSVCMD.js} +3 -3
  156. package/dist/cli/index.js +211 -211
  157. package/dist/cli/index.mjs +151 -151
  158. package/dist/client/index.js +4 -4
  159. package/dist/client/index.mjs +3 -3
  160. package/dist/commerce/index.js +57 -57
  161. package/dist/commerce/index.mjs +5 -5
  162. package/dist/cta-bar/CtaBar.d.ts +15 -4
  163. package/dist/cta-bar/CtaBar.d.ts.map +1 -1
  164. package/dist/cta-bar/index.js +6 -12
  165. package/dist/cta-bar/index.js.map +1 -1
  166. package/dist/cta-bar/index.mjs +6 -12
  167. package/dist/cta-bar/index.mjs.map +1 -1
  168. package/dist/engage/ChatWidget.d.ts.map +1 -1
  169. package/dist/engage/EchoUiActions.d.ts +5 -2
  170. package/dist/engage/EchoUiActions.d.ts.map +1 -1
  171. package/dist/engage/brand-color.d.ts +37 -0
  172. package/dist/engage/brand-color.d.ts.map +1 -0
  173. package/dist/engage/index.js +11 -10
  174. package/dist/engage/index.js.map +1 -1
  175. package/dist/engage/index.mjs +8 -7
  176. package/dist/engage/index.mjs.map +1 -1
  177. package/dist/fleet/index.js +8 -8
  178. package/dist/fleet/index.mjs +4 -4
  179. package/dist/forms/index.js +16 -16
  180. package/dist/forms/index.mjs +9 -9
  181. package/dist/forms/server.js +10 -10
  182. package/dist/forms/server.mjs +8 -8
  183. package/dist/forms/static.js +7 -7
  184. package/dist/forms/static.mjs +6 -6
  185. package/dist/images/index.js +11 -11
  186. package/dist/images/index.mjs +4 -4
  187. package/dist/index.js +63 -63
  188. package/dist/index.mjs +9 -9
  189. package/dist/layout/client.js +8 -8
  190. package/dist/layout/client.mjs +7 -7
  191. package/dist/layout/index.js +10 -10
  192. package/dist/layout/index.mjs +8 -8
  193. package/dist/{lib-6HOOMENJ.js → lib-6GWWPDJR.js} +7 -7
  194. package/dist/lib-BD4KKQBI.mjs +4 -0
  195. package/dist/{lib-R7IQ4ZHE.mjs → lib-N5PD6JNJ.mjs} +2 -2
  196. package/dist/{lib-BGAWCSUH.js → lib-WFB5RLEQ.js} +8 -8
  197. package/dist/maps/index.js +5 -5
  198. package/dist/maps/index.mjs +3 -3
  199. package/dist/search/index.js +4 -4
  200. package/dist/search/index.mjs +3 -3
  201. package/dist/seo/client.js +5 -5
  202. package/dist/seo/client.mjs +4 -4
  203. package/dist/seo/index.js +5 -5
  204. package/dist/seo/index.mjs +4 -4
  205. package/dist/seo/register-sitemap-cli.js +12 -93
  206. package/dist/seo/register-sitemap-cli.mjs +2 -83
  207. package/dist/server/index.js +3 -3
  208. package/dist/server/index.mjs +2 -2
  209. package/dist/shared/color.d.ts +39 -0
  210. package/dist/shared/color.d.ts.map +1 -0
  211. package/dist/shared/version.d.ts +1 -1
  212. package/dist/signal/index.js +11 -11
  213. package/dist/signal/index.mjs +2 -2
  214. package/dist/sync/index.js +17 -17
  215. package/dist/sync/index.mjs +4 -4
  216. package/dist/{web-vitals.attribution-7LKLZ5GR.mjs → web-vitals.attribution-CHXXWO72.mjs} +3 -3
  217. package/dist/web-vitals.attribution-CHXXWO72.mjs.map +1 -0
  218. package/dist/{web-vitals.attribution-ONVYQNRB.js → web-vitals.attribution-SQVZNHN3.js} +3 -3
  219. package/dist/web-vitals.attribution-SQVZNHN3.js.map +1 -0
  220. package/package.json +1 -1
  221. package/dist/ChatWidget-LH3QZYKR.mjs +0 -16
  222. package/dist/ChatWidget-RUCQMCMN.js +0 -25
  223. package/dist/EngageWidget-34BQXU7K.mjs +0 -12
  224. package/dist/EngageWidget-X2CBW7DV.js +0 -21
  225. package/dist/ManagedForm-EUDKMS5G.mjs +0 -16
  226. package/dist/ManagedForm-O67ILXN7.js +0 -25
  227. package/dist/SitemapSync-DQALPBTR.js +0 -18
  228. package/dist/SitemapSync-QYV3X5LH.mjs +0 -9
  229. package/dist/chunk-3SHAY7PK.mjs.map +0 -1
  230. package/dist/chunk-HQWPCX3N.mjs +0 -6
  231. package/dist/chunk-QWUDHOUE.js +0 -8
  232. package/dist/chunk-QYRJ4IQD.js.map +0 -1
  233. package/dist/lib-RSDMEKDQ.mjs +0 -4
  234. package/dist/web-vitals.attribution-7LKLZ5GR.mjs.map +0 -1
  235. package/dist/web-vitals.attribution-ONVYQNRB.js.map +0 -1
@@ -1,12 +1,65 @@
1
1
  'use client';
2
2
  import { chatLauncherStyles } from './chunk-4U5NCKQY.mjs';
3
3
  import { GlassStyles } from './chunk-OBKS3CPP.mjs';
4
- import { useForm } from './chunk-YZMI7QQ2.mjs';
5
- import { sonorFetch } from './chunk-6ZMEJSNX.mjs';
6
- import { useState, useRef, useEffect, useCallback } from 'react';
4
+ import { useForm } from './chunk-6FIIA6ME.mjs';
5
+ import { parseColor, relativeLuminance, DARK_LUMINANCE, contrastRatio } from './chunk-NYXENHD2.mjs';
6
+ import { sonorFetch } from './chunk-CI7T4ZRP.mjs';
7
+ import { useState, useRef, useEffect, useLayoutEffect, useCallback } from 'react';
7
8
  import ReactMarkdown from 'react-markdown';
8
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
10
 
11
+ // src/engage/brand-color.ts
12
+ var TEXT_CONTRAST = 4.5;
13
+ var RESTING_TINT = 0.082;
14
+ var UNREADABLE_BRAND_SHARE = 40;
15
+ var WHITE = { r: 255, g: 255, b: 255 };
16
+ var BLACK = { r: 0, g: 0, b: 0 };
17
+ function mix(a, b, share) {
18
+ return {
19
+ r: a.r * share + b.r * (1 - share),
20
+ g: a.g * share + b.g * (1 - share),
21
+ b: a.b * share + b.b * (1 - share)
22
+ };
23
+ }
24
+ function round({ r, g, b }) {
25
+ const c = (v) => Math.round(Math.min(255, Math.max(0, v)));
26
+ return { r: c(r), g: c(g), b: c(b) };
27
+ }
28
+ function toHex(rgb) {
29
+ const { r, g, b } = round(rgb);
30
+ return `#${[r, g, b].map((c) => c.toString(16).padStart(2, "0")).join("")}`;
31
+ }
32
+ function isLightColor(color) {
33
+ const rgb = parseColor(color);
34
+ if (!rgb) return false;
35
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3 > 160;
36
+ }
37
+ function onBrandColor(brand) {
38
+ return isLightColor(brand) ? "#1a1a1a" : "white";
39
+ }
40
+ function rgbTriplet(color, fallback = "37, 99, 235") {
41
+ const rgb = parseColor(color);
42
+ if (!rgb) return fallback;
43
+ const { r, g, b } = round(rgb);
44
+ return `${r}, ${g}, ${b}`;
45
+ }
46
+ function brandTextColor(brand, panelTint) {
47
+ const tint = panelTint && parseColor(panelTint) || WHITE;
48
+ const pole = relativeLuminance(tint) < DARK_LUMINANCE ? WHITE : BLACK;
49
+ const rgb = parseColor(brand);
50
+ if (!rgb) return `color-mix(in srgb, ${brand} ${UNREADABLE_BRAND_SHARE}%, ${toHex(pole)})`;
51
+ const surface = relativeLuminance(mix(rgb, tint, RESTING_TINT));
52
+ const reads = (c) => contrastRatio(relativeLuminance(c), surface) >= TEXT_CONTRAST;
53
+ if (reads(rgb)) return brand;
54
+ let lo = 0;
55
+ let hi = 1;
56
+ for (let i = 0; i < 12; i++) {
57
+ const share = (lo + hi) / 2;
58
+ if (reads(round(mix(rgb, pole, share)))) lo = share;
59
+ else hi = share;
60
+ }
61
+ return toHex(mix(rgb, pole, lo));
62
+ }
10
63
  function alpha(rgb, a) {
11
64
  return `rgba(var(--sk-primary-rgb, ${rgb}), ${a})`;
12
65
  }
@@ -192,7 +245,7 @@ function InlineManagedForm({ slug, prefill, primaryColor, primaryRgb }) {
192
245
  borderRadius: 8,
193
246
  border: "none",
194
247
  backgroundColor: primaryColor,
195
- color: "#fff",
248
+ color: onBrandColor(primaryColor),
196
249
  fontSize: 13.5,
197
250
  fontWeight: 600,
198
251
  cursor: isSubmitting ? "default" : "pointer",
@@ -205,7 +258,7 @@ function InlineManagedForm({ slug, prefill, primaryColor, primaryRgb }) {
205
258
  }
206
259
  );
207
260
  }
208
- function SuggestActionChip({ action, message, primaryColor, primaryRgb, onSuggest }) {
261
+ function SuggestActionChip({ action, message, primaryColor, primaryRgb, brandText, onSuggest }) {
209
262
  return /* @__PURE__ */ jsx(
210
263
  "button",
211
264
  {
@@ -216,7 +269,7 @@ function SuggestActionChip({ action, message, primaryColor, primaryRgb, onSugges
216
269
  borderRadius: 16,
217
270
  border: `1px solid ${primaryColor}`,
218
271
  backgroundColor: alpha(primaryRgb, 0.063),
219
- color: primaryColor,
272
+ color: brandText,
220
273
  fontSize: 13,
221
274
  cursor: "pointer"
222
275
  },
@@ -224,7 +277,7 @@ function SuggestActionChip({ action, message, primaryColor, primaryRgb, onSugges
224
277
  }
225
278
  );
226
279
  }
227
- function EchoUiActions({ actions, primaryColor, primaryRgb, onSuggest }) {
280
+ function EchoUiActions({ actions, primaryColor, primaryRgb, brandText, onSuggest }) {
228
281
  if (!actions?.length) return null;
229
282
  const chips = actions.filter((a) => a?.type === "suggest_action");
230
283
  const forms = actions.filter((a) => a?.type === "show_form");
@@ -256,6 +309,7 @@ function EchoUiActions({ actions, primaryColor, primaryRgb, onSuggest }) {
256
309
  message: label,
257
310
  primaryColor,
258
311
  primaryRgb,
312
+ brandText,
259
313
  onSuggest
260
314
  },
261
315
  `chip-${i}`
@@ -309,21 +363,9 @@ var ECHO_CSS = `
309
363
  [data-sk-echo-panel] { animation: none !important; }
310
364
  }
311
365
  `;
312
- function isLightColor(hex) {
313
- const num = parseInt(hex.replace("#", ""), 16);
314
- const r = num >> 16;
315
- const g = num >> 8 & 255;
316
- const b = num & 255;
317
- return (r * 299 + g * 587 + b * 114) / 1e3 > 160;
318
- }
319
366
  function staticPrimaryColor(apiFallback, hardDefault) {
320
367
  return apiFallback || hardDefault;
321
368
  }
322
- function hexToRgbString(hex, fallback = "37, 99, 235") {
323
- const match = hex.replace("#", "").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
324
- if (!match) return fallback;
325
- return `${parseInt(match[1], 16)}, ${parseInt(match[2], 16)}, ${parseInt(match[3], 16)}`;
326
- }
327
369
  function hexAlpha(rgbVar, alpha2, fallbackRgb = "37, 99, 235") {
328
370
  return `rgba(var(${rgbVar}, ${fallbackRgb}), ${alpha2})`;
329
371
  }
@@ -376,11 +418,19 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
376
418
  const primaryFallback = staticPrimaryColor(widgetConfig?.brand_primary || config?.buttonColor, "#2563eb");
377
419
  const [primaryFromCssVar, setPrimaryFromCssVar] = useState(null);
378
420
  const primaryColor = primaryFromCssVar ?? primaryFallback;
379
- const primaryRgb = hexToRgbString(primaryColor);
421
+ const primaryRgb = rgbTriplet(primaryColor);
380
422
  useEffect(() => {
381
423
  const cssValue = getComputedStyle(document.documentElement).getPropertyValue("--sk-primary").trim();
382
424
  setPrimaryFromCssVar(cssValue || null);
383
425
  }, []);
426
+ const onBrand = onBrandColor(primaryColor);
427
+ const panelRef = useRef(null);
428
+ const [panelTint, setPanelTint] = useState(null);
429
+ useLayoutEffect(() => {
430
+ if (!isOpen || !panelRef.current) return;
431
+ setPanelTint(getComputedStyle(panelRef.current).getPropertyValue("--sk-glass-t").trim() || null);
432
+ }, [isOpen]);
433
+ const brandText = brandTextColor(primaryColor, panelTint);
384
434
  const businessName = propAssistantName || widgetConfig?.project_name || widgetConfig?.business_info?.name || "Chat with us";
385
435
  const logoUrl = propAssistantAvatar || widgetConfig?.logo_url || null;
386
436
  const welcomeEnabled = widgetConfig?.welcome_screen_enabled !== false;
@@ -1066,7 +1116,6 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1066
1116
  if (availability && availability.agentsOnline > 0) return { dot: "#22c55e", text: "Online" };
1067
1117
  return { dot: "var(--sk-text-tertiary, #9ca3af)", text: "We'll respond soon" };
1068
1118
  })();
1069
- const launcherIcon = isLightColor(primaryColor) ? "#1a1a1a" : "white";
1070
1119
  const ChatButton = /* @__PURE__ */ jsx(
1071
1120
  "button",
1072
1121
  {
@@ -1095,10 +1144,10 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1095
1144
  onMouseLeave: (e) => {
1096
1145
  e.currentTarget.style.transform = "scale(1)";
1097
1146
  },
1098
- children: isOpen ? /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: launcherIcon, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1147
+ children: isOpen ? /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: onBrand, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1099
1148
  /* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1100
1149
  /* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1101
- ] }) : /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: launcherIcon, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) })
1150
+ ] }) : /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: onBrand, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) })
1102
1151
  }
1103
1152
  );
1104
1153
  const Header = /* @__PURE__ */ jsxs(
@@ -1122,7 +1171,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1122
1171
  height: 40,
1123
1172
  borderRadius: "50%",
1124
1173
  backgroundColor: primaryColor,
1125
- color: launcherIcon,
1174
+ color: onBrand,
1126
1175
  boxShadow: "inset 0 1px 0 color-mix(in srgb, #ffffff 30%, transparent), 0 2px 6px rgba(0, 0, 0, 0.12)",
1127
1176
  display: "flex",
1128
1177
  alignItems: "center",
@@ -1159,7 +1208,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1159
1208
  borderRadius: 12,
1160
1209
  border: `1px solid ${hexAlpha("--sk-primary-rgb", 0.2, primaryRgb)}`,
1161
1210
  backgroundColor: hexAlpha("--sk-primary-rgb", 0.031, primaryRgb),
1162
- color: primaryColor,
1211
+ color: brandText,
1163
1212
  fontSize: 14,
1164
1213
  cursor: "pointer",
1165
1214
  textAlign: "left",
@@ -1188,7 +1237,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1188
1237
  borderRadius: 12,
1189
1238
  border: "none",
1190
1239
  backgroundColor: primaryColor,
1191
- color: isLightColor(primaryColor) ? "#1a1a1a" : "white",
1240
+ color: onBrand,
1192
1241
  fontSize: 14,
1193
1242
  fontWeight: 600,
1194
1243
  cursor: "pointer",
@@ -1200,11 +1249,11 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1200
1249
  widgetConfig?.business_info?.phone && /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: 13, color: "var(--sk-text-secondary, #6b7280)" }, children: [
1201
1250
  "Or call us at",
1202
1251
  " ",
1203
- /* @__PURE__ */ jsx("a", { href: `tel:${widgetConfig.business_info.phone}`, style: { color: primaryColor, textDecoration: "none", fontWeight: 500 }, children: widgetConfig.business_info.phone })
1252
+ /* @__PURE__ */ jsx("a", { href: `tel:${widgetConfig.business_info.phone}`, style: { color: brandText, textDecoration: "none", fontWeight: 500 }, children: widgetConfig.business_info.phone })
1204
1253
  ] })
1205
1254
  ] });
1206
1255
  const OfflineFormView = /* @__PURE__ */ jsx("div", { style: { padding: 20, flex: 1, overflowY: "auto" }, children: offlineSubmitted ? /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", padding: 20 }, children: [
1207
- /* @__PURE__ */ jsx("div", { style: { width: 56, height: 56, borderRadius: "50%", backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb), display: "flex", alignItems: "center", justifyContent: "center", margin: "0 auto 16px" }, children: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: primaryColor, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
1256
+ /* @__PURE__ */ jsx("div", { style: { width: 56, height: 56, borderRadius: "50%", backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb), display: "flex", alignItems: "center", justifyContent: "center", margin: "0 auto 16px" }, children: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: brandText, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
1208
1257
  /* @__PURE__ */ jsx("h3", { style: { margin: "0 0 8px", fontSize: 18, fontWeight: 600, color: "var(--sk-text-primary, #111827)" }, children: "Message Sent!" }),
1209
1258
  /* @__PURE__ */ jsx("p", { style: { margin: 0, color: "var(--sk-text-secondary, #6b7280)", fontSize: 14 }, children: offlineSubheading })
1210
1259
  ] }) : /* @__PURE__ */ jsxs("form", { onSubmit: handleOfflineSubmit, children: [
@@ -1251,7 +1300,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1251
1300
  borderRadius: 8,
1252
1301
  border: "none",
1253
1302
  backgroundColor: primaryColor,
1254
- color: isLightColor(primaryColor) ? "#1a1a1a" : "white",
1303
+ color: onBrand,
1255
1304
  fontSize: 14,
1256
1305
  fontWeight: 600,
1257
1306
  cursor: isLoading ? "wait" : "pointer",
@@ -1299,7 +1348,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1299
1348
  alignItems: "center",
1300
1349
  justifyContent: "center"
1301
1350
  },
1302
- children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: isLightColor(primaryColor) ? "#1a1a1a" : "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1351
+ children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: onBrand, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1303
1352
  /* @__PURE__ */ jsx("path", { d: "M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
1304
1353
  /* @__PURE__ */ jsx("circle", { cx: "8.5", cy: "7", r: "4" }),
1305
1354
  /* @__PURE__ */ jsx("line", { x1: "20", y1: "8", x2: "20", y2: "14" }),
@@ -1348,7 +1397,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1348
1397
  // Bubbles on glass stay near-opaque: the glass behind them
1349
1398
  // is for depth, never for the text to read against.
1350
1399
  backgroundColor: message.role === "user" ? primaryColor : message.role === "system" ? "color-mix(in srgb, var(--sk-text-primary, #111827) 7%, transparent)" : BUBBLE_BG,
1351
- color: message.role === "user" ? isLightColor(primaryColor) ? "#1a1a1a" : "white" : message.role === "system" ? "var(--sk-text-secondary, #6b7280)" : "var(--sk-text-primary, #111827)",
1400
+ color: message.role === "user" ? onBrand : message.role === "system" ? "var(--sk-text-secondary, #6b7280)" : "var(--sk-text-primary, #111827)",
1352
1401
  border: message.role === "user" || message.role === "system" ? "none" : HAIRLINE,
1353
1402
  boxShadow: message.role === "system" ? "none" : message.role === "user" ? "inset 0 1px 0 color-mix(in srgb, #ffffff 22%, transparent), 0 1px 2px rgba(0,0,0,0.10)" : "0 1px 2px rgba(0,0,0,0.06)",
1354
1403
  fontSize: message.role === "system" ? 13 : 14,
@@ -1384,7 +1433,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1384
1433
  padding: "8px 14px",
1385
1434
  borderRadius: 8,
1386
1435
  backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb),
1387
- color: primaryColor,
1436
+ color: brandText,
1388
1437
  fontWeight: 600,
1389
1438
  fontSize: 13,
1390
1439
  textDecoration: "none",
@@ -1430,7 +1479,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1430
1479
  borderRadius: 16,
1431
1480
  border: `1px solid ${primaryColor}`,
1432
1481
  backgroundColor: hexAlpha("--sk-primary-rgb", 0.063, primaryRgb),
1433
- color: primaryColor,
1482
+ color: brandText,
1434
1483
  fontSize: 13,
1435
1484
  cursor: "pointer"
1436
1485
  },
@@ -1444,6 +1493,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1444
1493
  actions: message.uiActions,
1445
1494
  primaryColor,
1446
1495
  primaryRgb,
1496
+ brandText,
1447
1497
  onSuggest: handleSuggestAction
1448
1498
  }
1449
1499
  ) : null,
@@ -1467,7 +1517,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1467
1517
  borderRadius: 6,
1468
1518
  border: `1px solid ${primaryColor}`,
1469
1519
  backgroundColor: "transparent",
1470
- color: primaryColor,
1520
+ color: brandText,
1471
1521
  fontSize: 13,
1472
1522
  cursor: "pointer"
1473
1523
  },
@@ -1549,7 +1599,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1549
1599
  borderRadius: "50%",
1550
1600
  border: "none",
1551
1601
  backgroundColor: (inputValue.trim() || pendingFiles.length) && !isLoading ? primaryColor : "var(--sk-border, #e5e7eb)",
1552
- color: (inputValue.trim() || pendingFiles.length) && !isLoading && isLightColor(primaryColor) ? "#1a1a1a" : "white",
1602
+ color: (inputValue.trim() || pendingFiles.length) && !isLoading ? onBrand : "white",
1553
1603
  cursor: inputValue.trim() && !isLoading ? "pointer" : "not-allowed",
1554
1604
  display: "flex",
1555
1605
  alignItems: "center",
@@ -1565,6 +1615,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1565
1615
  const ChatPopup = isOpen && /* @__PURE__ */ jsxs(
1566
1616
  "div",
1567
1617
  {
1618
+ ref: panelRef,
1568
1619
  "data-sk-echo-panel": true,
1569
1620
  className: "sk-glass sk-glass--panel",
1570
1621
  style: {
@@ -1628,5 +1679,5 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1628
1679
  }
1629
1680
 
1630
1681
  export { ChatWidget };
1631
- //# sourceMappingURL=chunk-3SHAY7PK.mjs.map
1632
- //# sourceMappingURL=chunk-3SHAY7PK.mjs.map
1682
+ //# sourceMappingURL=chunk-PTQHPWEK.mjs.map
1683
+ //# sourceMappingURL=chunk-PTQHPWEK.mjs.map